[SCM] mplayer2/master: Imported Upstream version 2.0-54-gd33877a

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Thu Apr 21 07:26:29 UTC 2011


The following commit has been merged in the master branch:
commit cc18edeacf4bc5ecadf05354ec15f3366e1bc2de
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Thu Apr 21 09:17:38 2011 +0200

    Imported Upstream version 2.0-54-gd33877a

diff --git a/ffmpeg-mt/.gitignore b/ffmpeg-mt/.gitignore
index 1081dbb..eac1758 100644
--- a/ffmpeg-mt/.gitignore
+++ b/ffmpeg-mt/.gitignore
@@ -1,7 +1,45 @@
-*.d
+.config
+.version
 *.o
+*.d
+*.exe
+*.ho
+*-example
+*-test
+*_g
 config.*
-*.so
-*.o
-*.a
-*.pc
+doc/*.1
+doc/*.html
+doc/*.pod
+doxy
+ffmpeg
+ffplay
+ffprobe
+ffserver
+libavcodec/libavcodec*
+libavcore/libavcore*
+libavdevice/libavdevice*
+libavfilter/libavfilter*
+libavformat/libavformat*
+libavutil/avconfig.h
+libavutil/libavutil*
+libpostproc/libpostproc*
+libswscale/libswscale*
+tests/audiogen
+tests/base64
+tests/data
+tests/rotozoom
+tests/seek_test
+tests/tiny_psnr
+tests/videogen
+tests/vsynth1
+tests/vsynth2
+tools/cws2fws
+tools/graph2dot
+tools/lavfi-showfiltfmts
+tools/pktdumper
+tools/probetest
+tools/qt-faststart
+tools/trasher
+tools/trasher*.d
+version.h
diff --git a/ffmpeg-mt/.gitmodules b/ffmpeg-mt/.gitmodules
deleted file mode 100644
index d49f364..0000000
--- a/ffmpeg-mt/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "libswscale"]
-	path = libswscale
-	url = git://git.mplayerhq.hu/libswscale
diff --git a/ffmpeg-mt/CREDITS b/ffmpeg-mt/CREDITS
index 404cf38..4a53778 100644
--- a/ffmpeg-mt/CREDITS
+++ b/ffmpeg-mt/CREDITS
@@ -1,5 +1,7 @@
-This file contains the name of the people who have contributed to
-FFmpeg. The names are sorted alphabetically by last name.
+This file contains the names of some of the people who have contributed to
+Libav/FFmpeg. The names are sorted alphabetically by last name.  As this file is
+currently quite outdated and git serves as a much better tool for determining
+authorship, it remains here for historical reasons only.
 
 Dénes Balatoni
 Michel Bardiaux
diff --git a/ffmpeg-mt/Changelog b/ffmpeg-mt/Changelog
index 2e99fa4..ec09c28 100644
--- a/ffmpeg-mt/Changelog
+++ b/ffmpeg-mt/Changelog
@@ -55,7 +55,7 @@ version <next>:
 - Win64 support for optimized asm functions
 - MJPEG/AVI1 to JPEG/JFIF bitstream filter
 - ASS subtitle encoder and decoder
-- IEC 61937 encapsulation for E-AC3 and TrueHD (for HDMI passthrough)
+- IEC 61937 encapsulation for E-AC3, TrueHD, DTS-HD (for HDMI passthrough)
 - overlay filter added
 - rename aspect filter to setdar, and pixelaspect to setsar
 - IEC 61937 demuxer
@@ -73,6 +73,16 @@ version <next>:
 - floating-point AC-3 encoder added
 - Lagarith decoder
 - ffmpeg -copytb option added
+- IVF muxer added
+- Wing Commander IV movies decoder added
+- movie source added
+- Bink version 'b' audio and video decoder
+- Bitmap Brothers JV playback system
+- Apple HTTP Live Streaming protocol handler
+- sndio support for playback and record
+- Linux framebuffer input device added
+- Chronomaster DFA decoder
+- Mobotix MxPEG decoder
 
 
 version 0.6:
diff --git a/ffmpeg-mt/Doxyfile b/ffmpeg-mt/Doxyfile
index 1173836..5d80a2b 100644
--- a/ffmpeg-mt/Doxyfile
+++ b/ffmpeg-mt/Doxyfile
@@ -25,7 +25,7 @@ DOXYFILE_ENCODING      = UTF-8
 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
 # by quotes) that should identify the project.
 
-PROJECT_NAME           = FFmpeg
+PROJECT_NAME           = Libav
 
 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
 # This could be handy for archiving the generated documentation or
@@ -577,7 +577,7 @@ EXCLUDE_SYMLINKS       = NO
 # against the file with absolute path, so to exclude all test directories
 # for example use the pattern */test/*
 
-EXCLUDE_PATTERNS       = *.svn *.git *.d
+EXCLUDE_PATTERNS       = *.git *.d
 
 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
 # (namespaces, classes, functions, etc.) that should be excluded from the
diff --git a/ffmpeg-mt/INSTALL b/ffmpeg-mt/INSTALL
index 8cd22bd..ac5dc5d 100644
--- a/ffmpeg-mt/INSTALL
+++ b/ffmpeg-mt/INSTALL
@@ -2,10 +2,17 @@
 1) Type './configure' to create the configuration. A list of configure
 options is printed by running 'configure --help'.
 
-'configure' can be launched from a directory different from the FFmpeg
+'configure' can be launched from a directory different from the Libav
 sources to build the objects out of tree. To do this, use an absolute
-path when launching 'configure', e.g. '/ffmpegdir/ffmpeg/configure'.
+path when launching 'configure', e.g. '/libavdir/libav/configure'.
 
-2) Then type 'make' to build FFmpeg. GNU Make 3.81 or later is required.
+2) Then type 'make' to build Libav. GNU Make 3.81 or later is required.
 
 3) Type 'make install' to install all binaries and libraries you built.
+
+NOTICE
+
+ - Non system dependencies (e.g. libx264, libvpx) are disabled by default.
+
+ - The default cflags include -g, if you want lean libraries you can either
+   pass --disable-debug or strip the debug symbols at a later time.
diff --git a/ffmpeg-mt/LICENSE b/ffmpeg-mt/LICENSE
index 8d4d651..725995d 100644
--- a/ffmpeg-mt/LICENSE
+++ b/ffmpeg-mt/LICENSE
@@ -1,17 +1,17 @@
-FFmpeg:
--------
+Libav:
+------
 
-Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
+Most files in Libav are under the GNU Lesser General Public License version 2.1
 or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other
 files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to
-FFmpeg.
+Libav.
 
-Some optional parts of FFmpeg are licensed under the GNU General Public License
+Some optional parts of Libav are licensed under the GNU General Public License
 version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of
 these parts are used by default, you have to explicitly pass --enable-gpl to
-configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
+configure to activate them. In this case, Libav's license changes to GPL v2+.
 
-Specifically, the GPL parts of FFmpeg are
+Specifically, the GPL parts of Libav are
 
 - libpostproc
 - optional x86 optimizations in the files
@@ -33,14 +33,14 @@ external libraries:
 -------------------
 
 Some external libraries, e.g. libx264, are under GPL and can be used in
-conjunction with FFmpeg. They require --enable-gpl to be passed to configure
+conjunction with Libav. They require --enable-gpl to be passed to configure
 as well.
 
 The OpenCORE external libraries are under the Apache License 2.0. That license
 is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of
-those licenses. So to combine the OpenCORE libraries with FFmpeg, the license
+those licenses. So to combine the OpenCORE libraries with Libav, the license
 version needs to be upgraded by passing --enable-version3 to configure.
 
-The nonfree external library libfaac can be hooked up in FFmpeg. You need to
+The nonfree external library libfaac can be hooked up in Libav. You need to
 pass --enable-nonfree to configure to enable it. Employ this option with care
-as FFmpeg then becomes nonfree and unredistributable.
+as Libav then becomes nonfree and unredistributable.
diff --git a/ffmpeg-mt/MAINTAINERS b/ffmpeg-mt/MAINTAINERS
deleted file mode 100644
index f3738ff..0000000
--- a/ffmpeg-mt/MAINTAINERS
+++ /dev/null
@@ -1,383 +0,0 @@
-FFmpeg maintainers
-==================
-
-Below is a list of the people maintaining different parts of the
-FFmpeg code.
-
-
-Project Leader
-==============
-
-Michael Niedermayer
-  final design decisions
-
-
-Applications
-============
-
-ffmpeg:
-  ffmpeg.c                              Michael Niedermayer
-
-ffplay:
-  ffplay.c                              Michael Niedermayer
-
-ffprobe:
-  ffprobe.c                             Stefano Sabatini
-
-ffserver:
-  ffserver.c, ffserver.h                Baptiste Coudurier
-
-Commandline utility code:
-  cmdutils.c, cmdutils.h                Michael Niedermayer
-
-QuickTime faststart:
-  tools/qt-faststart.c                  Baptiste Coudurier
-
-
-Miscellaneous Areas
-===================
-
-documentation                           Mike Melanson
-website                                 Robert Swain
-build system (configure,Makefiles)      Diego Biurrun, Mans Rullgard
-project server                          Diego Biurrun, Mans Rullgard
-mailinglists                            Michael Niedermayer, Baptiste Coudurier
-presets                                 Robert Swain
-metadata subsystem                      Aurelien Jacobs
-release management                      Diego Biurrun, Reinhard Tartler
-
-
-libavutil
-=========
-
-External Interfaces:
-  libavutil/avutil.h                    Michael Niedermayer
-Internal Interfaces:
-  libavutil/common.h                    Michael Niedermayer
-
-Other:
-  intfloat*                             Michael Niedermayer
-  rational.c, rational.h                Michael Niedermayer
-  mathematics.c, mathematics.h          Michael Niedermayer
-  integer.c, integer.h                  Michael Niedermayer
-  bswap.h
-
-
-libavcodec
-==========
-
-Generic Parts:
-  External Interfaces:
-    avcodec.h                           Michael Niedermayer
-  utility code:
-    utils.c                             Michael Niedermayer
-    mem.c                               Michael Niedermayer
-    opt.c, opt.h                        Michael Niedermayer
-  arithmetic expression evaluator:
-    eval.c                              Michael Niedermayer
-  audio and video frame extraction:
-    parser.c                            Michael Niedermayer
-  bitstream reading:
-    bitstream.c, bitstream.h            Michael Niedermayer
-  CABAC:
-    cabac.h, cabac.c                    Michael Niedermayer
-  DSP utilities:
-    dsputils.c, dsputils.h              Michael Niedermayer
-  entropy coding:
-    rangecoder.c, rangecoder.h          Michael Niedermayer
-    lzw.*                               Michael Niedermayer
-  floating point AAN DCT:
-    faandct.c, faandct.h                Michael Niedermayer
-  Golomb coding:
-    golomb.c, golomb.h                  Michael Niedermayer
-  LPC:
-    lpc.c, lpc.h                        Justin Ruggles
-  motion estimation:
-    motion*                             Michael Niedermayer
-  rate control:
-    ratecontrol.c                       Michael Niedermayer
-    libxvid_rc.c                        Michael Niedermayer
-  simple IDCT:
-    simple_idct.c, simple_idct.h        Michael Niedermayer
-  postprocessing:
-    libpostproc/*                       Michael Niedermayer
-  table generation:
-    tableprint.c, tableprint.h          Reimar Doeffinger
-
-Codecs:
-  4xm.c                                 Michael Niedermayer
-  8bps.c                                Roberto Togni
-  8svx.c                                Jaikrishnan Menon
-  aasc.c                                Kostya Shishkov
-  ac3*                                  Justin Ruggles
-  alacenc.c                             Jaikrishnan Menon
-  alsdec.c                              Thilo Borgmann
-  apedec.c                              Kostya Shishkov
-  ass*                                  Aurelien Jacobs
-  asv*                                  Michael Niedermayer
-  atrac3*                               Benjamin Larsson
-  bgmc.c, bgmc.h                        Thilo Borgmann
-  bink.c                                Kostya Shishkov
-  binkaudio.c                           Peter Ross
-  bmp.c                                 Mans Rullgard, Kostya Shishkov
-  cavs*                                 Stefan Gehrer
-  celp_filters.*                        Vitor Sessak
-  cinepak.c                             Roberto Togni
-  cljr                                  Alex Beregszaszi
-  cook.c, cookdata.h                    Benjamin Larsson
-  cscd.c                                Reimar Doeffinger
-  dca.c                                 Kostya Shishkov, Benjamin Larsson
-  dnxhd*                                Baptiste Coudurier
-  dpcm.c                                Mike Melanson
-  dxa.c                                 Kostya Shishkov
-  dv.c                                  Roman Shaposhnik
-  eacmv*, eaidct*, eat*                 Peter Ross
-  ffv1.c                                Michael Niedermayer
-  flac*                                 Justin Ruggles
-  flashsv*                              Benjamin Larsson
-  flicvideo.c                           Mike Melanson
-  g722.c                                Martin Storsjo
-  g726.c                                Roman Shaposhnik
-  gifdec.c                              Baptiste Coudurier
-  h264*                                 Loren Merritt, Michael Niedermayer
-  h261*                                 Michael Niedermayer
-  h263*                                 Michael Niedermayer
-  huffyuv.c                             Michael Niedermayer
-  idcinvideo.c                          Mike Melanson
-  imc*                                  Benjamin Larsson
-  indeo2*                               Kostya Shishkov
-  indeo5*                               Kostya Shishkov
-  interplayvideo.c                      Mike Melanson
-  ivi*                                  Kostya Shishkov
-  jpeg_ls.c                             Kostya Shishkov
-  kmvc.c                                Kostya Shishkov
-  lcl*.c                                Roberto Togni, Reimar Doeffinger
-  libgsm.c                              Michel Bardiaux
-  libdirac*                             David Conrad
-  libopenjpeg.c                         Jaikrishnan Menon
-  libschroedinger*                      David Conrad
-  libspeexdec.c                         Justin Ruggles
-  libtheoraenc.c                        David Conrad
-  libvorbis.c                           David Conrad
-  libxavs.c                             Stefan Gehrer
-  libx264.c                             Mans Rullgard, Jason Garrett-Glaser
-  loco.c                                Kostya Shishkov
-  lzo.h, lzo.c                          Reimar Doeffinger
-  mdec.c                                Michael Niedermayer
-  mimic.c                               Ramiro Polla
-  mjpeg.c                               Michael Niedermayer
-  mlp*                                  Ramiro Polla
-  mmvideo.c                             Peter Ross
-  mpc*                                  Kostya Shishkov
-  mpeg12.c, mpeg12data.h                Michael Niedermayer
-  mpegvideo.c, mpegvideo.h              Michael Niedermayer
-  msmpeg4.c, msmpeg4data.h              Michael Niedermayer
-  msrle.c                               Mike Melanson
-  msvideo1.c                            Mike Melanson
-  nellymoserdec.c                       Benjamin Larsson
-  nuv.c                                 Reimar Doeffinger
-  pcx.c                                 Ivo van Poorten
-  pgssubdec.c                           Reimar Doeffinger
-  ptx.c                                 Ivo van Poorten
-  qcelp*                                Reynaldo H. Verdejo Pinochet
-  qdm2.c, qdm2data.h                    Roberto Togni, Benjamin Larsson
-  qdrw.c                                Kostya Shishkov
-  qpeg.c                                Kostya Shishkov
-  qtrle.c                               Mike Melanson
-  ra144.c, ra144.h, ra288.c, ra288.h    Roberto Togni
-  resample2.c                           Michael Niedermayer
-  rl2.c                                 Sascha Sommer
-  rpza.c                                Roberto Togni
-  rtjpeg.c, rtjpeg.h                    Reimar Doeffinger
-  rv10.c                                Michael Niedermayer
-  rv3*                                  Kostya Shishkov
-  rv4*                                  Kostya Shishkov
-  s3tc*                                 Ivo van Poorten
-  smacker.c                             Kostya Shishkov
-  smc.c                                 Mike Melanson
-  snow.c                                Michael Niedermayer, Loren Merritt
-  sonic.c                               Alex Beregszaszi
-  srtdec.c                              Aurelien Jacobs
-  sunrast.c                             Ivo van Poorten
-  svq3.c                                Michael Niedermayer
-  targa.c                               Kostya Shishkov
-  tiff.c                                Kostya Shishkov
-  truemotion1*                          Mike Melanson
-  truemotion2*                          Kostya Shishkov
-  truespeech.c                          Kostya Shishkov
-  tscc.c                                Kostya Shishkov
-  tta.c                                 Alex Beregszaszi, Jaikrishnan Menon
-  txd.c                                 Ivo van Poorten
-  ulti*                                 Kostya Shishkov
-  vb.c                                  Kostya Shishkov
-  vc1*                                  Kostya Shishkov
-  vcr1.c                                Michael Niedermayer
-  vmnc.c                                Kostya Shishkov
-  vorbis_enc.c                          Oded Shimon
-  vorbis_dec.c                          Denes Balatoni, David Conrad
-  vp3*                                  Mike Melanson
-  vp5                                   Aurelien Jacobs
-  vp6                                   Aurelien Jacobs
-  vp8                                   David Conrad, Jason Garrett-Glaser, Ronald Bultje
-  vqavideo.c                            Mike Melanson
-  wavpack.c                             Kostya Shishkov
-  wmaprodec.c                           Sascha Sommer
-  wmavoice.c                            Ronald S. Bultje
-  wmv2.c                                Michael Niedermayer
-  wnv1.c                                Kostya Shishkov
-  xan.c                                 Mike Melanson
-  xl.c                                  Kostya Shishkov
-  xvmc.c                                Ivan Kalvachev
-  zmbv*                                 Kostya Shishkov
-
-Hardware acceleration:
-  dxva2*                                Laurent Aimar
-  vaapi*                                Gwenole Beauchesne
-  vdpau*                                Carl Eugen Hoyos
-
-
-libavdevice
-===========
-  External Interface:
-    libavdevice/avdevice.h
-
-
-  libdc1394.c                           Roman Shaposhnik
-  v4l2.c                                Luca Abeni
-  vfwcap.c                              Ramiro Polla
-
-
-libavformat
-===========
-
-Generic parts:
-  External Interface:
-    libavformat/avformat.h              Michael Niedermayer
-  Utility Code:
-    libavformat/utils.c                 Michael Niedermayer
-
-
-Muxers/Demuxers:
-  4xm.c                                 Mike Melanson
-  adtsenc.c                             Robert Swain
-  aiff.c                                Baptiste Coudurier
-  ape.c                                 Kostya Shishkov
-  ass*                                  Aurelien Jacobs
-  avi*                                  Michael Niedermayer
-  bink.c                                Peter Ross
-  caf*                                  Peter Ross
-  crc.c                                 Michael Niedermayer
-  daud.c                                Reimar Doeffinger
-  dv.c                                  Roman Shaposhnik
-  dxa.c                                 Kostya Shishkov
-  electronicarts.c                      Peter Ross
-  ffm*                                  Baptiste Coudurier
-  flac*                                 Justin Ruggles
-  flic.c                                Mike Melanson
-  flvdec.c, flvenc.c                    Michael Niedermayer
-  gxf.c                                 Reimar Doeffinger
-  gxfenc.c                              Baptiste Coudurier
-  idcin.c                               Mike Melanson
-  idroqdec.c                            Mike Melanson
-  iff.c                                 Jaikrishnan Menon
-  ipmovie.c                             Mike Melanson
-  img2.c                                Michael Niedermayer
-  iss.c                                 Stefan Gehrer
-  libnut.c                              Oded Shimon
-  lmlm4.c                               Ivo van Poorten
-  lxfdec.c                              Tomas Härdin
-  matroska.c                            Aurelien Jacobs
-  matroskadec.c                         Aurelien Jacobs
-  matroskaenc.c                         David Conrad
-  metadata*                             Aurelien Jacobs
-  mm.c                                  Peter Ross
-  mov.c                                 Michael Niedermayer, Baptiste Coudurier
-  movenc.c                              Michael Niedermayer, Baptiste Coudurier
-  mpc.c                                 Kostya Shishkov
-  mpeg.c                                Michael Niedermayer
-  mpegenc.c                             Michael Niedermayer
-  mpegts*                               Baptiste Coudurier
-  msnwc_tcp.c                           Ramiro Polla
-  mtv.c                                 Reynaldo H. Verdejo Pinochet
-  mxf*                                  Baptiste Coudurier
-  nsvdec.c                              Francois Revol
-  nut.c                                 Michael Niedermayer
-  nuv.c                                 Reimar Doeffinger
-  oggdec.c, oggdec.h                    David Conrad
-  oggenc.c                              Baptiste Coudurier
-  oggparse*.c                           David Conrad
-  oma.c                                 Maxim Poliakovski
-  psxstr.c                              Mike Melanson
-  pva.c                                 Ivo van Poorten
-  r3d.c                                 Baptiste Coudurier
-  raw.c                                 Michael Niedermayer
-  rdt.c                                 Ronald S. Bultje
-  rl2.c                                 Sascha Sommer
-  rmdec.c, rmenc.c                      Ronald S. Bultje, Kostya Shishkov
-  rtmp*                                 Kostya Shishkov
-  rtp.c, rtpenc.c                       Martin Storsjo
-  rtpdec_asf.*                          Ronald S. Bultje
-  rtpenc_mpv.*, rtpenc_aac.*            Martin Storsjo
-  rtsp.c                                Luca Barbato
-  sdp.c                                 Martin Storsjo
-  segafilm.c                            Mike Melanson
-  siff.c                                Kostya Shishkov
-  smacker.c                             Kostya Shishkov
-  srtdec.c                              Aurelien Jacobs
-  swf.c                                 Baptiste Coudurier
-  tta.c                                 Alex Beregszaszi
-  txd.c                                 Ivo van Poorten
-  voc.c                                 Aurelien Jacobs
-  wav.c                                 Michael Niedermayer
-  wc3movie.c                            Mike Melanson
-  westwood.c                            Mike Melanson
-  wtv.c                                 Peter Ross
-  wv.c                                  Kostya Shishkov
-
-Protocols:
-  http.c                                Ronald S. Bultje
-  mms*.c                                Ronald S. Bultje
-  udp.c                                 Luca Abeni
-
-
-Operating systems / CPU architectures
-=====================================
-
-Alpha                                   Mans Rullgard, Falk Hueffner
-ARM                                     Mans Rullgard
-AVR32                                   Mans Rullgard
-MIPS                                    Mans Rullgard
-Mac OS X / PowerPC                      Romain Dolbeau, Guillaume Poirier
-Amiga / PowerPC                         Colin Ward
-Linux / PowerPC                         Luca Barbato
-Windows MinGW                           Alex Beregszaszi, Ramiro Polla
-Windows Cygwin                          Victor Paesa
-ADI/Blackfin DSP                        Marc Hoffman
-Sparc                                   Roman Shaposhnik
-x86                                     Michael Niedermayer
-
-
-GnuPG Fingerprints of maintainers and others who have svn write access
-======================================================================
-
-Anton Khirnov                 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB
-Attila Kinali                 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765
-Baptiste Coudurier            8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA
-Ben Littler                   3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C
-Benoit Fouet                  B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
-Daniel Verkamp                78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
-Diego Biurrun                 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5
-Jaikrishnan Menon             61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
-Justin Ruggles                3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF
-Loren Merritt                 ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
-Luca Barbato                  6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34
-Michael Niedermayer           9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
-Panagiotis Issaris            515C E262 10A8 FDCE 5481 7B9C 3AD7 D9A5 071D B3A9
-Peter Ross                    A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
-Reimar Döffinger              C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
-Reinhard Tartler              9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4
-Reynaldo H. Verdejo Pinochet  6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
-Robert Swain                  EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71
-Sascha Sommer                 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
-Stefano Sabatini              9A43 10F8 D32C D33C 48E7 C52C 5DF2 8E4D B2EE 066B
-Tomas Härdin                  D133 29CA 4EEC 9DB4 7076 F697 B04B 7403 3313 41FD
diff --git a/ffmpeg-mt/Makefile b/ffmpeg-mt/Makefile
index d158507..0bf04d1 100644
--- a/ffmpeg-mt/Makefile
+++ b/ffmpeg-mt/Makefile
@@ -9,20 +9,18 @@ PROGS-$(CONFIG_FFPLAY)   += ffplay
 PROGS-$(CONFIG_FFPROBE)  += ffprobe
 PROGS-$(CONFIG_FFSERVER) += ffserver
 
-PROGS      := $(addsuffix   $(EXESUF), $(PROGS-yes))
-PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
-OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
-MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
-PODPAGES    = $(addprefix doc/, $(addsuffix .pod, $(PROGS-yes)))
-HTMLPAGES   = $(addprefix doc/, $(addsuffix .html, $(PROGS-yes)))
-TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
-HOSTPROGS   = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr base64)
+PROGS      := $(PROGS-yes:%=%$(EXESUF))
+OBJS        = $(PROGS-yes:%=%.o) cmdutils.o
+MANPAGES    = $(PROGS-yes:%=doc/%.1)
+PODPAGES    = $(PROGS-yes:%=doc/%.pod)
+HTMLPAGES   = $(PROGS-yes:%=doc/%.html)
+TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher))
+TESTTOOLS   = audiogen videogen rotozoom tiny_psnr base64
+HOSTPROGS  := $(TESTTOOLS:%=tests/%)
 
 BASENAMES   = ffmpeg ffplay ffprobe ffserver
-ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
-ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
-ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
-ALLHTMLPAGES= $(addsuffix .html, $(BASENAMES))
+ALLPROGS    = $(BASENAMES:%=%$(EXESUF))
+ALLMANPAGES = $(BASENAMES:%=%.1)
 
 FFLIBS-$(CONFIG_AVDEVICE) += avdevice
 FFLIBS-$(CONFIG_AVFILTER) += avfilter
@@ -30,7 +28,6 @@ FFLIBS-$(CONFIG_AVFORMAT) += avformat
 FFLIBS-$(CONFIG_AVCODEC)  += avcodec
 FFLIBS-$(CONFIG_POSTPROC) += postproc
 FFLIBS-$(CONFIG_SWSCALE)  += swscale
-FFLIBS-$(CONFIG_AVCORE)   += avcore
 
 FFLIBS := avutil
 
@@ -54,10 +51,6 @@ INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
 
 all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
 
-$(PROGS): %$(EXESUF): %_g$(EXESUF)
-	$(CP) $< $@
-	$(STRIP) $@
-
 config.h: .config
 .config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
 	@-tput bold 2>/dev/null
@@ -66,7 +59,7 @@ config.h: .config
 
 SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
                ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
-               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
+               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS
 
 define RESET
 $(1) :=
@@ -81,10 +74,10 @@ endef
 
 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
 
-ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
-ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
+ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
+ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
 
-%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
+%$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
 	$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
 
 tools/%$(EXESUF): tools/%.o
@@ -93,13 +86,14 @@ tools/%$(EXESUF): tools/%.o
 tools/%.o: tools/%.c
 	$(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
 
+-include $(wildcard tools/*.d)
+
 ffplay.o: CFLAGS += $(SDL_CFLAGS)
 
 VERSION_SH  = $(SRC_PATH_BARE)/version.sh
 GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
-SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
 
-.version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
+.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
 .version: M=@
 
 version.h .version:
@@ -111,22 +105,22 @@ version.h .version:
 
 alltools: $(TOOLS)
 
-documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \
-                                 $(ALLHTMLPAGES) $(ALLMANPAGES))
+DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
+
+documentation: $(DOCS)
 
-$(HTMLPAGES) $(PODPAGES): doc/fftools-common-opts.texi
+-include $(wildcard $(DOCS:%=%.d))
 
-doc/ffmpeg.pod doc/ffmpeg.html: doc/demuxers.texi doc/bitstream_filters.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi doc/metadata.texi
-doc/ffplay.pod doc/ffplay.html: doc/demuxers.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi
-doc/ffprobe.pod doc/ffprobe.html: doc/demuxers.texi doc/indevs.texi doc/protocols.texi
-doc/libavfilter.html: doc/filters.texi
+TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
 
 doc/%.html: TAG = HTML
-doc/%.html: doc/%.texi
-	$(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
+doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
+	$(Q)$(TEXIDEP)
+	$(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%)
 
 doc/%.pod: TAG = POD
 doc/%.pod: doc/%.texi
+	$(Q)$(TEXIDEP)
 	$(M)doc/texi2pod.pl $< $@
 
 doc/%.1: TAG = MAN
@@ -162,20 +156,21 @@ testclean:
 	$(RM) -r tests/vsynth1 tests/vsynth2 tests/data
 	$(RM) $(addprefix tests/,$(CLEANSUFFIXES))
 	$(RM) tests/seek_test$(EXESUF) tests/seek_test.o
-	$(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr base64))
+	$(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
 
 clean:: testclean
-	$(RM) $(ALLPROGS) $(ALLPROGS_G)
+	$(RM) $(ALLPROGS)
 	$(RM) $(CLEANSUFFIXES)
 	$(RM) doc/*.html doc/*.pod doc/*.1
 	$(RM) $(TOOLS)
+	$(RM) $(CLEANSUFFIXES:%=tools/%)
 
 distclean::
 	$(RM) $(DISTCLEANSUFFIXES)
 	$(RM) version.h config.* libavutil/avconfig.h
 
 config:
-	$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
+	$(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
 
 # regression tests
 
@@ -289,7 +284,7 @@ fate: $(FATE)
 
 $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
 	@echo "TEST    $(@:fate-%=%)"
-	$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)'
+	$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)'
 
 fate-list:
 	@printf '%s\n' $(sort $(FATE))
diff --git a/ffmpeg-mt/README b/ffmpeg-mt/README
index e907e90..afef671 100644
--- a/ffmpeg-mt/README
+++ b/ffmpeg-mt/README
@@ -1,5 +1,5 @@
-FFmpeg README
--------------
+Libav README
+------------
 
 1) Documentation
 ----------------
diff --git a/ffmpeg-mt/cmdutils.c b/ffmpeg-mt/cmdutils.c
index 1e7211a..cc10b48 100644
--- a/ffmpeg-mt/cmdutils.c
+++ b/ffmpeg-mt/cmdutils.c
@@ -2,20 +2,20 @@
  * Various utilities for command line tools
  * Copyright (c) 2000-2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -35,10 +35,10 @@
 #include "libswscale/swscale.h"
 #include "libpostproc/postprocess.h"
 #include "libavutil/avstring.h"
+#include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/eval.h"
 #include "libavcodec/opt.h"
-#include "libavcore/avcore.h"
 #include "cmdutils.h"
 #include "version.h"
 #if CONFIG_NETWORK
@@ -55,7 +55,7 @@ AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
 AVFormatContext *avformat_opts;
 struct SwsContext *sws_opts;
 
-const int this_year = 2011;
+static const int this_year = 2011;
 
 void init_opts(void)
 {
@@ -78,6 +78,16 @@ void uninit_opts(void)
 #if CONFIG_SWSCALE
     av_freep(&sws_opts);
 #endif
+    for (i = 0; i < opt_name_count; i++) {
+        //opt_values are only stored for codec-specific options in which case
+        //both the name and value are dup'd
+        if (opt_values[i]) {
+            av_freep(&opt_names[i]);
+            av_freep(&opt_values[i]);
+        }
+    }
+    av_freep(&opt_names);
+    av_freep(&opt_values);
 }
 
 void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
@@ -104,8 +114,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
 
 int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
 {
-    int64_t us = parse_date(timestr, is_duration);
-    if (us == INT64_MIN) {
+    int64_t us;
+    if (av_parse_time(&us, timestr, is_duration) < 0) {
         fprintf(stderr, "Invalid %s specification for %s: %s\n",
                 is_duration ? "duration" : "date", context, timestr);
         exit(1);
@@ -198,7 +208,7 @@ unknown_opt:
             } else if (po->flags & OPT_INT64) {
                 *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
             } else if (po->flags & OPT_FLOAT) {
-                *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
+                *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
             } else if (po->flags & OPT_FUNC2) {
                 if (po->u.func2_arg(opt, arg) < 0) {
                     fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
@@ -268,9 +278,9 @@ int opt_default(const char *opt, const char *arg){
 
     //FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this
     opt_values= av_realloc(opt_values, sizeof(void*)*(opt_name_count+1));
-    opt_values[opt_name_count]= o ? NULL : arg;
+    opt_values[opt_name_count]= o ? NULL : av_strdup(arg);
     opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
-    opt_names[opt_name_count++]= o ? o->name : opt;
+    opt_names[opt_name_count++]= o ? o->name : av_strdup(opt);
 
     if ((*avcodec_opts && avcodec_opts[0]->debug) || (avformat_opts && avformat_opts->debug))
         av_log_set_level(AV_LOG_DEBUG);
@@ -378,7 +388,7 @@ static int warned_cfg = 0;
         const char *indent = flags & INDENT? "  " : "";                 \
         if (flags & SHOW_VERSION) {                                     \
             unsigned int version = libname##_version();                 \
-            fprintf(outstream, "%slib%-10s %2d.%2d.%2d / %2d.%2d.%2d\n", \
+            fprintf(outstream, "%slib%-9s %2d.%3d.%2d / %2d.%3d.%2d\n", \
                     indent, #libname,                                   \
                     LIB##LIBNAME##_VERSION_MAJOR,                       \
                     LIB##LIBNAME##_VERSION_MINOR,                       \
@@ -387,7 +397,7 @@ static int warned_cfg = 0;
         }                                                               \
         if (flags & SHOW_CONFIG) {                                      \
             const char *cfg = libname##_configuration();                \
-            if (strcmp(FFMPEG_CONFIGURATION, cfg)) {                    \
+            if (strcmp(LIBAV_CONFIGURATION, cfg)) {                     \
                 if (!warned_cfg) {                                      \
                     fprintf(outstream,                                  \
                             "%sWARNING: library configuration mismatch\n", \
@@ -403,7 +413,6 @@ static int warned_cfg = 0;
 static void print_all_libs_info(FILE* outstream, int flags)
 {
     PRINT_LIB_INFO(outstream, avutil,   AVUTIL,   flags);
-    PRINT_LIB_INFO(outstream, avcore,   AVCORE,   flags);
     PRINT_LIB_INFO(outstream, avcodec,  AVCODEC,  flags);
     PRINT_LIB_INFO(outstream, avformat, AVFORMAT, flags);
     PRINT_LIB_INFO(outstream, avdevice, AVDEVICE, flags);
@@ -414,17 +423,17 @@ static void print_all_libs_info(FILE* outstream, int flags)
 
 void show_banner(void)
 {
-    fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d the FFmpeg developers\n",
+    fprintf(stderr, "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n",
             program_name, program_birth_year, this_year);
     fprintf(stderr, "  built on %s %s with %s %s\n",
             __DATE__, __TIME__, CC_TYPE, CC_VERSION);
-    fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
+    fprintf(stderr, "  configuration: " LIBAV_CONFIGURATION "\n");
     print_all_libs_info(stderr, INDENT|SHOW_CONFIG);
     print_all_libs_info(stderr, INDENT|SHOW_VERSION);
 }
 
 void show_version(void) {
-    printf("%s " FFMPEG_VERSION "\n", program_name);
+    printf("%s " LIBAV_VERSION "\n", program_name);
     print_all_libs_info(stdout, SHOW_VERSION);
 }
 
@@ -644,20 +653,16 @@ void show_bsfs(void)
 
 void show_protocols(void)
 {
-    URLProtocol *up=NULL;
+    void *opaque = NULL;
+    const char *name;
 
     printf("Supported file protocols:\n"
-           "I.. = Input  supported\n"
-           ".O. = Output supported\n"
-           "..S = Seek   supported\n"
-           "FLAGS NAME\n"
-           "----- \n");
-    while((up = av_protocol_next(up)))
-        printf("%c%c%c   %s\n",
-               up->url_read  ? 'I' : '.',
-               up->url_write ? 'O' : '.',
-               up->url_seek  ? 'S' : '.',
-               up->name);
+           "Input:\n");
+    while ((name = avio_enum_protocols(&opaque, 0)))
+        printf("%s\n", name);
+    printf("Output:\n");
+    while ((name = avio_enum_protocols(&opaque, 1)))
+        printf("%s\n", name);
 }
 
 void show_filters(void)
diff --git a/ffmpeg-mt/cmdutils.h b/ffmpeg-mt/cmdutils.h
index 9fb7845..0067295 100644
--- a/ffmpeg-mt/cmdutils.h
+++ b/ffmpeg-mt/cmdutils.h
@@ -2,20 +2,20 @@
  * Various utilities for command line tools
  * copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -37,8 +37,6 @@ extern const char program_name[];
  */
 extern const int program_birth_year;
 
-extern const int this_year;
-
 extern const char **opt_names;
 extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
 extern AVFormatContext *avformat_opts;
diff --git a/ffmpeg-mt/common.mak b/ffmpeg-mt/common.mak
index 110f505..03fae6f 100644
--- a/ffmpeg-mt/common.mak
+++ b/ffmpeg-mt/common.mak
@@ -21,7 +21,7 @@ endif
 ifndef V
 Q      = @
 ECHO   = printf "$(1)\t%s\n" $(2)
-BRIEF  = CC AS YASM AR LD HOSTCC STRIP CP
+BRIEF  = CC AS YASM AR LD HOSTCC
 SILENT = DEPCC YASMDEP RM RANLIB
 MSG    = $@
 M      = @$(call ECHO,$(TAG),$@);
@@ -31,7 +31,7 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
 $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
 endif
 
-ALLFFLIBS = avcodec avcore avdevice avfilter avformat avutil postproc swscale
+ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
 
 IFLAGS   := -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
 CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
@@ -89,7 +89,7 @@ FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
 
 EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
 OBJS      := $(addprefix $(SUBDIR),$(sort $(OBJS)))
-TESTOBJS  := $(addprefix $(SUBDIR),$(TESTOBJS))
+TESTOBJS  := $(addprefix $(SUBDIR),$(TESTOBJS) $(TESTPROGS:%=%-test.o))
 TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
 HOSTOBJS  := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
 HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
@@ -111,4 +111,4 @@ CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
 DISTCLEANSUFFIXES = *.pc
 LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
 
--include $(wildcard $(OBJS:.o=.d))
+-include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))
diff --git a/ffmpeg-mt/configure b/ffmpeg-mt/configure
index 070cfa7..cfb8347 100755
--- a/ffmpeg-mt/configure
+++ b/ffmpeg-mt/configure
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# FFmpeg configure script
+# Libav configure script
 #
 # Copyright (c) 2000-2002 Fabrice Bellard
 # Copyright (c) 2005-2008 Diego Biurrun
@@ -44,9 +44,9 @@ if test "$E1" != 0 || test "$E2" = 0; then
     echo "No compatible shell script interpreter found."
     echo "This configure script requires a POSIX-compatible shell"
     echo "such as bash or ksh."
-    echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
+    echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
     echo "Instead, install a working POSIX-compatible shell."
-    echo "Disabling this configure test will create a broken FFmpeg."
+    echo "Disabling this configure test will create a broken Libav."
     if test "$BASH_VERSION" = '2.04.0(1)-release'; then
         echo "This bash version ($BASH_VERSION) is broken on your platform."
         echo "Upgrade to a later version if available."
@@ -86,7 +86,6 @@ Configuration options:
   --disable-ffserver       disable ffserver build
   --disable-avdevice       disable libavdevice build
   --disable-avcodec        disable libavcodec build
-  --disable-avcore         disable libavcore build
   --disable-avformat       disable libavformat build
   --disable-swscale        disable libswscale build
   --enable-postproc        enable GPLed postprocessing support [no]
@@ -223,6 +222,7 @@ Advanced options (experts only):
   --disable-mmx2           disable MMX2 optimizations
   --disable-sse            disable SSE optimizations
   --disable-ssse3          disable SSSE3 optimizations
+  --disable-avx            disable AVX optimizations
   --disable-armv5te        disable armv5te optimizations
   --disable-armv6          disable armv6 optimizations
   --disable-armv6t2        disable armv6t2 optimizations
@@ -237,13 +237,13 @@ Advanced options (experts only):
   --enable-sram            allow use of on-chip SRAM
   --disable-symver         disable symbol versioning
 
-Developer options (useful when working on FFmpeg itself):
+Developer options (useful when working on Libav itself):
   --disable-debug          disable debugging symbols
   --enable-debug=LEVEL     set the debug level [$debuglevel]
   --disable-optimizations  disable compiler optimizations
   --enable-extra-warnings  enable more compiler warnings
-  --disable-stripping      disable stripping of executables and shared libraries
-  --samples=PATH           location of test samples for FATE
+  --samples=PATH           location of test samples for FATE, if not set use
+                           \$FATE_SAMPLES at make invocation time.
 
 NOTE: Object files are built at the place where configure is launched.
 EOF
@@ -277,8 +277,8 @@ die(){
     cat <<EOF
 
 If you think configure made a mistake, make sure you are using the latest
-version from SVN.  If the latest version fails, report the problem to the
-ffmpeg-user at mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
+version from Git.  If the latest version fails, report the problem to the
+libav-user at libav.org mailing list or IRC #libav on irc.freenode.net.
 EOF
     if disabled logging; then
         cat <<EOF
@@ -313,6 +313,10 @@ sh_quote(){
     echo "$v"
 }
 
+cleanws(){
+    echo "$@" | sed 's/^ *//;s/  */ /g;s/ *$//'
+}
+
 filter(){
     pat=$1
     shift
@@ -321,6 +325,14 @@ filter(){
     done
 }
 
+filter_out(){
+    pat=$1
+    shift
+    for v; do
+        eval "case $v in $pat) ;; *) echo $v ;; esac"
+    done
+}
+
 map(){
     m=$1
     shift
@@ -343,6 +355,16 @@ set_weak(){
     done
 }
 
+set_safe(){
+    var=$1
+    shift
+    eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
+}
+
+get_safe(){
+    eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
+}
+
 pushvar(){
     for var in $*; do
         eval level=\${${var}_level:=0}
@@ -618,7 +640,7 @@ check_ld(){
         test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
     done
     check_cc $($filter_cflags $flags) || return
-    check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
+    check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
 }
 
 check_cppflags(){
@@ -686,20 +708,17 @@ EOF
 check_func_headers(){
     log check_func_headers "$@"
     headers=$1
-    func=$2
+    funcs=$2
     shift 2
-    disable $func
-    incs=""
-    for hdr in $headers; do
-        incs="$incs
-#include <$hdr>"
-    done
-    check_ld "$@" <<EOF && enable $func && enable_safe $headers
-$incs
-int main(int argc, char **argv){
-    return (long) $func;
-}
-EOF
+    {
+        for hdr in $headers; do
+            echo "#include <$hdr>"
+        done
+        for func in $funcs; do
+            echo "long check_$func(void) { return (long) $func; }"
+        done
+        echo "int main(void) { return 0; }"
+    } | check_ld "$@" && enable $funcs && enable_safe $headers
 }
 
 check_cpp_condition(){
@@ -726,9 +745,23 @@ check_lib(){
 check_lib2(){
     log check_lib2 "$@"
     headers="$1"
-    func="$2"
+    funcs="$2"
     shift 2
-    check_func_headers "$headers" $func "$@" && add_extralibs "$@"
+    check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
+}
+
+check_pkg_config(){
+    log check_pkg_config "$@"
+    pkg="$1"
+    headers="$2"
+    funcs="$3"
+    shift 3
+    $pkg_config --exists $pkg || return
+    pkg_cflags=$($pkg_config --cflags $pkg)
+    pkg_libs=$($pkg_config --libs $pkg)
+    check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
+        set_safe ${pkg}_cflags $pkg_cflags   &&
+        set_safe ${pkg}_libs   $pkg_libs
 }
 
 check_exec(){
@@ -812,6 +845,13 @@ require2(){
     check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
 }
 
+require_pkg_config(){
+    pkg="$1"
+    check_pkg_config "$@" || die "ERROR: $pkg not found"
+    add_cflags    $(get_safe ${pkg}_cflags)
+    add_extralibs $(get_safe ${pkg}_libs)
+}
+
 check_host_cc(){
     log check_host_cc "$@"
     cat > $TMPC
@@ -858,8 +898,8 @@ COMPONENT_LIST="
 CONFIG_LIST="
     $COMPONENT_LIST
     aandct
+    ac3dsp
     avcodec
-    avcore
     avdevice
     avfilter
     avformat
@@ -916,6 +956,7 @@ CONFIG_LIST="
     rtpdec
     runtime_cpudetect
     shared
+    sinewin
     small
     sram
     static
@@ -965,6 +1006,7 @@ ARCH_EXT_LIST='
     armv6
     armv6t2
     armvfp
+    avx
     iwmmxt
     mmi
     mmx
@@ -994,7 +1036,6 @@ HAVE_LIST="
     bswap
     closesocket
     cmov
-    conio_h
     dcbzl
     dev_bktr_ioctl_bt848_h
     dev_bktr_ioctl_meteor_h
@@ -1024,6 +1065,7 @@ HAVE_LIST="
     inet_aton
     inline_asm
     isatty
+    kbhit
     ldbrx
     libdc1394_1
     libdc1394_2
@@ -1051,6 +1093,7 @@ HAVE_LIST="
     sdl
     sdl_video_size
     setmode
+    sndio_h
     socklen_t
     soundcard_h
     poll_h
@@ -1071,7 +1114,6 @@ HAVE_LIST="
     sys_soundcard_h
     sys_videoio_h
     ten_operands
-    termios_h
     threads
     truncf
     vfp_args
@@ -1099,7 +1141,6 @@ CMDLINE_SELECT="
     extra_warnings
     logging
     optimizations
-    stripping
     symver
     yasm
 "
@@ -1134,9 +1175,9 @@ CMDLINE_SET="
     logfile
     malloc_prefix
     nm
+    pkg_config
     samples
     source_path
-    strip
     sysinclude
     sysroot
     target_exec
@@ -1173,6 +1214,7 @@ mmx_deps="x86"
 mmx2_deps="mmx"
 sse_deps="mmx"
 ssse3_deps="sse"
+avx_deps="ssse3"
 
 aligned_stack_if_any="ppc x86"
 fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
@@ -1190,20 +1232,21 @@ mdct_select="fft"
 rdft_select="fft"
 
 # decoders / encoders / hardware accelerators
-aac_decoder_select="mdct rdft"
-aac_encoder_select="mdct"
+aac_decoder_select="mdct rdft sinewin"
+aac_encoder_select="mdct sinewin"
 aac_latm_decoder_select="aac_decoder aac_latm_parser"
-ac3_decoder_select="mdct ac3_parser"
-ac3_encoder_select="mdct"
+ac3_decoder_select="mdct ac3dsp ac3_parser"
+ac3_encoder_select="mdct ac3dsp"
+ac3_fixed_encoder_select="ac3dsp"
 alac_encoder_select="lpc"
 amrnb_decoder_select="lsp"
 amrwb_decoder_select="lsp"
-atrac1_decoder_select="mdct"
+atrac1_decoder_select="mdct sinewin"
 atrac3_decoder_select="mdct"
 binkaudio_dct_decoder_select="mdct rdft dct"
 binkaudio_rdft_decoder_select="mdct rdft"
 cavs_decoder_select="golomb"
-cook_decoder_select="mdct"
+cook_decoder_select="mdct sinewin"
 cscd_decoder_suggest="zlib"
 dca_decoder_select="mdct"
 dnxhd_encoder_select="aandct"
@@ -1262,8 +1305,8 @@ msmpeg4v2_decoder_select="h263_decoder"
 msmpeg4v2_encoder_select="h263_encoder"
 msmpeg4v3_decoder_select="h263_decoder"
 msmpeg4v3_encoder_select="h263_encoder"
-nellymoser_decoder_select="mdct"
-nellymoser_encoder_select="mdct"
+nellymoser_decoder_select="mdct sinewin"
+nellymoser_encoder_select="mdct sinewin"
 png_decoder_select="zlib"
 png_encoder_select="zlib"
 qcelp_decoder_select="lsp"
@@ -1279,9 +1322,6 @@ shorten_decoder_select="golomb"
 sipr_decoder_select="lsp"
 snow_decoder_select="dwt"
 snow_encoder_select="aandct dwt"
-sonic_decoder_select="golomb"
-sonic_encoder_select="golomb"
-sonic_ls_encoder_select="golomb"
 svq1_encoder_select="aandct"
 svq3_decoder_select="golomb h264dsp h264pred"
 svq3_decoder_suggest="zlib"
@@ -1290,7 +1330,7 @@ tiff_decoder_suggest="zlib"
 tiff_encoder_suggest="zlib"
 truehd_decoder_select="mlp_decoder"
 tscc_decoder_select="zlib"
-twinvq_decoder_select="mdct lsp"
+twinvq_decoder_select="mdct lsp sinewin"
 vc1_decoder_select="h263_decoder"
 vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
 vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
@@ -1302,12 +1342,12 @@ vp6_decoder_select="huffman"
 vp6a_decoder_select="vp6_decoder"
 vp6f_decoder_select="vp6_decoder"
 vp8_decoder_select="h264pred"
-wmapro_decoder_select="mdct"
-wmav1_decoder_select="mdct"
-wmav1_encoder_select="mdct"
-wmav2_decoder_select="mdct"
-wmav2_encoder_select="mdct"
-wmavoice_decoder_select="lsp rdft dct mdct"
+wmapro_decoder_select="mdct sinewin"
+wmav1_decoder_select="mdct sinewin"
+wmav1_encoder_select="mdct sinewin"
+wmav2_decoder_select="mdct sinewin"
+wmav2_encoder_select="mdct sinewin"
+wmavoice_decoder_select="lsp rdft dct mdct sinewin"
 wmv1_decoder_select="h263_decoder"
 wmv1_encoder_select="h263_encoder"
 wmv2_decoder_select="h263_decoder"
@@ -1352,19 +1392,19 @@ libxavs_encoder_deps="libxavs"
 libxvid_encoder_deps="libxvid"
 
 # demuxers / muxers
-ac3_demuxer_deps="ac3_parser"
+ac3_demuxer_select="ac3_parser"
 asf_stream_muxer_select="asf_muxer"
 avisynth_demuxer_deps="avisynth"
-dirac_demuxer_deps="dirac_parser"
+dirac_demuxer_select="dirac_parser"
 eac3_demuxer_select="ac3_parser"
-flac_demuxer_deps="flac_parser"
+flac_demuxer_select="flac_parser"
 ipod_muxer_select="mov_muxer"
 libnut_demuxer_deps="libnut"
 libnut_muxer_deps="libnut"
 matroska_audio_muxer_select="matroska_muxer"
 matroska_demuxer_suggest="zlib bzlib"
 mov_demuxer_suggest="zlib"
-mp3_demuxer_deps="mpegaudio_parser"
+mp3_demuxer_select="mpegaudio_parser"
 mp4_muxer_select="mov_muxer"
 mpegtsraw_demuxer_select="mpegts_demuxer"
 mxf_d10_muxer_select="mxf_muxer"
@@ -1387,10 +1427,13 @@ alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
 alsa_outdev_deps="alsa_asoundlib_h"
 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
 dv1394_indev_deps="dv1394 dv_demuxer"
+fbdev_indev_deps="linux_fb_h"
 jack_indev_deps="jack_jack_h"
 libdc1394_indev_deps="libdc1394"
 oss_indev_deps_any="soundcard_h sys_soundcard_h"
 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
+sndio_indev_deps="sndio_h"
+sndio_outdev_deps="sndio_h"
 v4l_indev_deps="linux_videodev_h"
 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
@@ -1429,7 +1472,7 @@ ffmpeg_select="buffer_filter"
 ffplay_deps="avcodec avformat swscale sdl"
 ffplay_select="rdft"
 ffprobe_deps="avcodec avformat"
-ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
+ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
 ffserver_extralibs='$ldl'
 
 doc_deps="texi2html"
@@ -1486,6 +1529,7 @@ test_deps _encoder _decoder                                             \
     pbm=pbmpipe                                                         \
     pcx                                                                 \
     pgm="pgm pgmpipe"                                                   \
+    png                                                                 \
     ppm="ppm ppmpipe"                                                   \
     rawvideo="rgb yuv"                                                  \
     roq                                                                 \
@@ -1559,8 +1603,8 @@ host_cc_default="gcc"
 ln_s="ln -sf"
 nm_default="nm"
 objformat="elf"
+pkg_config_default=pkg-config
 ranlib="ranlib"
-strip_default="strip"
 yasmexe="yasm"
 nogas=":"
 
@@ -1576,7 +1620,6 @@ host_os=$target_os_default
 
 # configurable options
 enable avcodec
-enable avcore
 enable avdevice
 enable avfilter
 enable avformat
@@ -1594,7 +1637,6 @@ enable network
 enable optimizations
 enable protocols
 enable static
-enable stripping
 enable swscale
 enable swscale_alpha
 
@@ -1642,7 +1684,7 @@ for v in "$@"; do
     r=${v#*=}
     l=${v%"$r"}
     r=$(sh_quote "$r")
-    FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
+    LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
 done
 
 find_things(){
@@ -1754,7 +1796,7 @@ done
 
 disabled logging && logfile=/dev/null
 
-echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
+echo "# $0 $LIBAV_CONFIGURATION" > $logfile
 set >> $logfile
 
 test -n "$cross_prefix" && enable cross_compile
@@ -1769,18 +1811,18 @@ set_default arch target_os
 ar_default="${cross_prefix}${ar_default}"
 cc_default="${cross_prefix}${cc_default}"
 nm_default="${cross_prefix}${nm_default}"
+pkg_config_default="${cross_prefix}${pkg_config_default}"
 ranlib="${cross_prefix}${ranlib}"
-strip_default="${cross_prefix}${strip_default}"
 
 sysinclude_default="${sysroot}/usr/include"
 
-set_default cc nm strip sysinclude
+set_default cc nm pkg_config sysinclude
 enabled cross_compile || host_cc_default=$cc
 set_default host_cc
 
 exesuf() {
     case $1 in
-        mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
+        mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
     esac
 }
 
@@ -1792,11 +1834,11 @@ HOSTEXESUF=$(exesuf $host_os)
 : ${TMPDIR:=$TMP}
 : ${TMPDIR:=/tmp}
 
-if ! check_cmd type mktemp; then
+if ! check_cmd mktemp -u XXXXXX; then
     # simple replacement for missing mktemp
     # NOT SAFE FOR GENERAL USE
     mktemp(){
-        echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
+        echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
     }
 fi
 
@@ -1809,7 +1851,6 @@ tmpfile(){
 }
 
 trap 'rm -f -- $TMPFILES' EXIT
-trap exit HUP INT TERM
 
 tmpfile TMPC  .c
 tmpfile TMPE  $EXESUF
@@ -1822,6 +1863,8 @@ tmpfile TMPASM .asm
 
 unset -f mktemp
 
+chmod +x $TMPE
+
 # make sure we can execute files in $TMPDIR
 cat > $TMPSH 2>> $logfile <<EOF
 #! /bin/sh
@@ -1851,8 +1894,11 @@ if   $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
 elif $cc -v 2>&1 | grep -qi ^gcc; then
     cc_type=gcc
     cc_version=__VERSION__
-    gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
-    cc_ident="gcc $($cc -dumpversion) $gcc_extra_ver"
+    gcc_version=$($cc --version | head -n1)
+    gcc_basever=$($cc -dumpversion)
+    gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
+    gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
+    cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
     if ! $cc -dumpversion | grep -q '^2\.'; then
         CC_DEPFLAGS='-MD -MP -MF $(@:.o=.d) -MT $@'
         AS_DEPFLAGS='-MD -MP -MF $(@:.o=.d) -MT $@'
@@ -1902,6 +1948,7 @@ elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
     AS_DEPFLAGS='-MMD'
     speed_cflags='-O3'
     size_cflags='-Os'
+    filter_asflags="filter_out -W${armcc_opt}*"
 elif $cc -version 2>/dev/null | grep -q TMS470; then
     cc_type=tms470
     cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
@@ -2027,7 +2074,7 @@ add_asflags $extra_cflags
 
 if test -n "$sysroot"; then
     case "$cc_type" in
-        gcc|llvm_gcc)
+        gcc|llvm_gcc|clang)
             add_cppflags --sysroot="$sysroot"
             add_ldflags --sysroot="$sysroot"
         ;;
@@ -2035,10 +2082,6 @@ if test -n "$sysroot"; then
             add_cppflags -I"$sysinclude"
             add_ldflags  --sysroot="$sysroot"
         ;;
-        clang)
-            add_cppflags -isysroot "$sysroot"
-            add_ldflags -isysroot "$sysroot"
-        ;;
     esac
 fi
 
@@ -2098,7 +2141,7 @@ case "$arch" in
         arch="sparc"
         subarch="sparc64"
     ;;
-    i[3-6]86|i86pc|BePC|x86_64|amd64)
+    i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
         arch="x86"
     ;;
 esac
@@ -2294,6 +2337,7 @@ case $target_os in
     haiku)
         prefix_default="/boot/common"
         network_extralibs="-lnetwork"
+        host_libs=
         ;;
     sunos)
         FFSERVERLDFLAGS=""
@@ -2304,6 +2348,7 @@ case $target_os in
         nm_opts='-P -g'
         ;;
     netbsd)
+        disable symver
         oss_indev_extralibs="-lossaudio"
         oss_outdev_extralibs="-lossaudio"
         add_cppflags -D_XOPEN_SOURCE=600
@@ -2311,28 +2356,32 @@ case $target_os in
     openbsd)
         enable malloc_aligned
         # On OpenBSD 4.5. the compiler does not use PIC unless
-        # explicitly using -fPIC. FFmpeg builds fine without PIC,
+        # explicitly using -fPIC. Libav builds fine without PIC,
         # however the generated executable will not do anything
         # (simply quits with exit-code 1, no crash, no output).
         # Thus explicitly enable PIC here.
         enable pic
+        disable symver
         SHFLAGS='-shared'
         oss_indev_extralibs="-lossaudio"
         oss_outdev_extralibs="-lossaudio"
         ;;
-    freebsd|dragonfly)
+    dragonfly)
+        enable malloc_aligned
+        disable symver
+        ;;
+    freebsd)
         enable malloc_aligned
         ;;
     bsd/os)
         add_extralibs -lpoll -lgnugetopt
-        strip="strip -d"
         ;;
     darwin)
         enable malloc_aligned
         gas="gas-preprocessor.pl $cc"
         enabled ppc && add_asflags -force_cpusubtype_ALL
-        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
-        strip="${strip} -x"
+        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
+        enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
         add_ldflags -Wl,-dynamic,-search_paths_first
         SLIBSUF=".dylib"
         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
@@ -2352,17 +2401,16 @@ case $target_os in
         LIBTARGET=i386
         if enabled x86_64; then
             enable malloc_aligned
-            LIBTARGET=x64
+            LIBTARGET="i386:x86-64"
         elif enabled arm; then
-            LIBTARGET=arm
+            LIBTARGET=arm-wince
         fi
         shlibdir_default="$bindir_default"
-        disable ffserver
         SLIBPREF=""
         SLIBSUF=".dll"
         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
-        SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
+        SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
             install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
             install -d "$(LIBDIR)"; \
@@ -2370,11 +2418,13 @@ case $target_os in
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
         SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
         objformat="win32"
+        dlltool="${cross_prefix}dlltool"
         enable dos_paths
         check_cflags -fno-common
         check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
                                       || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
                 die "ERROR: MinGW runtime version must be >= 3.15."
+        add_cppflags -U__STRICT_ANSI__
         ;;
     cygwin*)
         target_os=cygwin
@@ -2389,8 +2439,6 @@ case $target_os in
         check_cflags -fno-common
         ;;
     *-dos|freedos|opendos)
-        disable ffplay ffserver
-        disable $INDEV_LIST $OUTDEV_LIST
         network_extralibs="-lsocket"
         objformat="coff"
         enable dos_paths
@@ -2403,7 +2451,6 @@ case $target_os in
         ranlib="echo ignoring ranlib"
         ;;
     os/2*)
-        strip="lxlite"
         ln_s="cp -f"
         add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
         SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
@@ -2429,6 +2476,15 @@ case $target_os in
         ;;
     gnu)
         ;;
+    qnx)
+        add_cppflags -D_QNX_SOURCE
+        network_extralibs="-lsocket"
+        ;;
+    symbian)
+        SLIBSUF=".dll"
+        enable dos_paths
+        add_cflags --include=$sysinclude/gcce/gcce.h
+        ;;
     none)
         ;;
     *)
@@ -2436,7 +2492,7 @@ case $target_os in
         ;;
 esac
 
-echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
+echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$LIBAV_CONFIGURATION" >config.fate
 
 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
 
@@ -2472,8 +2528,6 @@ die_license_disabled version3 libopencore_amrwb
 
 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
 
-check_deps $ARCH_EXT_LIST
-
 disabled optimizations || check_cflags -fomit-frame-pointer
 
 enable_pic() {
@@ -2524,10 +2578,18 @@ elif enabled arm; then
     check_cflags -marm
     nogas=die
 
-    check_ld <<EOF && enable vfp_args
+    if     check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
+        enable vfp_args
+    elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
+        case "${cross_prefix:-$cc}" in
+            *hardfloat*)         enable vfp_args;   fpabi=vfp ;;
+            *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
 __asm__ (".eabi_attribute 28, 1");
 int main(void) { return 0; }
 EOF
+        esac
+        warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
+    fi
 
     # We have to check if pld is a nop and disable it.
     check_asm pld '"pld [r0]"'
@@ -2642,8 +2704,9 @@ EOF
             elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
         esac
 
-        check_yasm "pabsw xmm0, xmm0" && enable yasm ||
+        check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
             die "yasm not found, use --disable-yasm for a crippled build"
+        check_yasm "vpaddw xmm0, xmm0, xmm0" || disable avx
     fi
 
     case "$cpu" in
@@ -2660,12 +2723,40 @@ if enabled asm; then
         $nogas "GNU assembler not found, install gas-preprocessor"
 fi
 
+check_ldflags -Wl,--as-needed
+
 if check_func dlopen; then
     ldl=
 elif check_func dlopen -ldl; then
     ldl=-ldl
 fi
 
+if enabled network; then
+    check_type "sys/types.h sys/socket.h" socklen_t
+    check_type netdb.h "struct addrinfo"
+    check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
+    check_type netinet/in.h "struct sockaddr_in6"
+    check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
+    check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
+    # Prefer arpa/inet.h over winsock2
+    if check_header arpa/inet.h ; then
+        check_func closesocket
+    elif check_header winsock2.h ; then
+        check_func_headers winsock2.h closesocket -lws2 && \
+            network_extralibs="-lws2" || \
+        { check_func_headers winsock2.h closesocket -lws2_32 && \
+            network_extralibs="-lws2_32"; }
+        check_type ws2tcpip.h socklen_t
+        check_type ws2tcpip.h "struct addrinfo"
+        check_type ws2tcpip.h "struct ipv6_mreq"
+        check_type ws2tcpip.h "struct sockaddr_in6"
+        check_type ws2tcpip.h "struct sockaddr_storage"
+        check_struct winsock2.h "struct sockaddr" sa_len
+    else
+        disable network
+    fi
+fi
+
 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
 check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
 
@@ -2684,6 +2775,7 @@ check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
 check_func  setrlimit
 check_func  strerror_r
 check_func  strtok_r
+check_func_headers conio.h kbhit
 check_func_headers io.h setmode
 check_func_headers lzo/lzo1x.h lzo1x_999_compress
 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
@@ -2691,7 +2783,6 @@ check_func_headers windows.h GetProcessTimes
 check_func_headers windows.h MapViewOfFile
 check_func_headers windows.h VirtualAlloc
 
-check_header conio.h
 check_header dlfcn.h
 check_header dxva2api.h
 check_header malloc.h
@@ -2699,7 +2790,6 @@ check_header poll.h
 check_header sys/mman.h
 check_header sys/resource.h
 check_header sys/select.h
-check_header termios.h
 check_header vdpau/vdpau.h
 check_header vdpau/vdpau_x11.h
 check_header X11/extensions/XvMClib.h
@@ -2759,22 +2849,19 @@ check_mathfunc truncf
 # these are off by default, so fail if requested and not available
 enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
 enabled frei0r     && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
-enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
-                      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 libdirac   && require_pkg_config dirac                          \
+    "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h"  \
+    "dirac_decoder_init dirac_encoder_init"
 enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
 enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
 enabled libmp3lame && require  "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -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 libopencv  && { check_lib opencv/cv.h cvCreateImageHeader $(pkg-config --libs opencv) ||
-                        die "ERROR: libopencv not found"; }
+enabled libopencv  && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
 enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
-enabled librtmp    && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
-                        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)
+enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
+enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
 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
@@ -2799,11 +2886,7 @@ if enabled libdc1394; then
     die "ERROR: No version of libdc1394 found "
 fi
 
-SDL_CONFIG="${cross_prefix}sdl-config"
-if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
-    sdl_cflags=$("${SDL_CONFIG}" --cflags)
-    sdl_libs=$("${SDL_CONFIG}" --libs)
-    check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
+if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
     enable sdl &&
     check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
@@ -2811,32 +2894,7 @@ fi
 
 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
 
-if enabled network; then
-    check_type "sys/types.h sys/socket.h" socklen_t
-    check_type netdb.h "struct addrinfo"
-    check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
-    check_type netinet/in.h "struct sockaddr_in6"
-    check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
-    check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
-    # Prefer arpa/inet.h over winsock2
-    if check_header arpa/inet.h ; then
-        check_func closesocket
-    elif check_header winsock2.h ; then
-        check_func_headers winsock2.h closesocket -lws2 && \
-            network_extralibs="-lws2" || \
-        { check_func_headers winsock2.h closesocket -lws2_32 && \
-            network_extralibs="-lws2_32"; }
-        check_type ws2tcpip.h socklen_t
-        check_type ws2tcpip.h "struct addrinfo"
-        check_type ws2tcpip.h "struct ipv6_mreq"
-        check_type ws2tcpip.h "struct sockaddr_in6"
-        check_type ws2tcpip.h "struct sockaddr_storage"
-        check_struct winsock2.h "struct sockaddr" sa_len
-    else
-        disable network
-    fi
-fi
-
+check_header linux/fb.h
 check_header linux/videodev.h
 check_header linux/videodev2.h
 check_header sys/videoio.h
@@ -2855,6 +2913,7 @@ check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_def
   check_header dev/video/bktr/ioctl_bt848.h; } ||
 check_header dev/ic/bt8xx.h
 
+check_header sndio.h
 check_header sys/soundcard.h
 check_header soundcard.h
 
@@ -2862,6 +2921,8 @@ enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimes
 
 enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
 
+enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
+
 enabled x11grab                         &&
 check_header X11/Xlib.h                 &&
 check_header X11/extensions/XShm.h      &&
@@ -2897,9 +2958,8 @@ enabled extra_warnings && check_cflags -Winline
 
 # add some linker flags
 check_ldflags -Wl,--warn-common
-check_ldflags -Wl,--as-needed
-check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavcore -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
-check_ldflags -Wl,-Bsymbolic
+check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
+test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
 
 echo "X{};" > $TMPV
 if test_ldflags -Wl,--version-script,$TMPV; then
@@ -2930,10 +2990,11 @@ if enabled icc; then
     check_cflags -w1
     # -wd: Disable following warnings
     # 144, 167, 556: -Wno-pointer-sign
+    # 1292: attribute "foo" ignored
     # 10006: ignoring unknown option -fno-signed-zeros
     # 10148: ignoring unknown option -Wno-parentheses
     # 10156: ignoring option '-W'; no argument required
-    check_cflags -wd144,167,556,10006,10148,10156
+    check_cflags -wd144,167,556,1292,10006,10148,10156
     # 11030: Warning unknown option --as-needed
     # 10156: ignoring option '-export'; no argument required
     check_ldflags -wd10156,11030
@@ -2967,8 +3028,12 @@ elif enabled armcc; then
     # 2523: use of inline assembler is deprecated
     add_cflags -W${armcc_opt},--diag_suppress=2523
     add_cflags -W${armcc_opt},--diag_suppress=1207
+    add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
+    add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
 elif enabled tms470; then
     add_cflags -pds=824 -pds=837
+elif enabled pathscale; then
+    add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
 fi
 
 enabled_any $THREADS_LIST      && enable threads
@@ -3041,7 +3106,6 @@ if enabled sparc; then
     echo "VIS enabled               ${vis-no}"
 fi
 echo "debug symbols             ${debug-no}"
-echo "strip symbols             ${stripping-no}"
 echo "optimizations             ${optimizations-no}"
 echo "static                    ${static-no}"
 echo "shared                    ${shared-no}"
@@ -3067,6 +3131,7 @@ echo "librtmp enabled           ${librtmp-no}"
 echo "libschroedinger enabled   ${libschroedinger-no}"
 echo "libspeex enabled          ${libspeex-no}"
 echo "libtheora enabled         ${libtheora-no}"
+echo "libva enabled             ${vaapi-no}"
 echo "libvorbis enabled         ${libvorbis-no}"
 echo "libvpx enabled            ${libvpx-no}"
 echo "libx264 enabled           ${libx264-no}"
@@ -3079,7 +3144,7 @@ echo
 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
     echo "Enabled ${type}s:"
     eval list=\$$(toupper $type)_LIST
-    print_enabled '_*' $list | sort | pr -3 -t
+    print_enabled '_*' $list | sort | pr -r -3 -t
     echo
 done
 
@@ -3104,7 +3169,6 @@ if enabled source_path_used; then
         doc
         libavcodec
         libavcodec/$arch
-        libavcore
         libavdevice
         libavfilter
         libavfilter/$arch
@@ -3124,7 +3188,6 @@ if enabled source_path_used; then
         doc/texi2pod.pl
         libavcodec/Makefile
         libavcodec/${arch}/Makefile
-        libavcore/Makefile
         libavdevice/Makefile
         libavfilter/Makefile
         libavfilter/${arch}/Makefile
@@ -3137,15 +3200,13 @@ if enabled source_path_used; then
     map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
 fi
 
-enabled stripping || strip="echo skipping strip"
-
 config_files="$TMPH config.mak"
 
 cat > config.mak <<EOF
 # Automatically generated by configure - do not modify!
-ifndef FFMPEG_CONFIG_MAK
-FFMPEG_CONFIG_MAK=1
-FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
+ifndef LIBAV_CONFIG_MAK
+LIBAV_CONFIG_MAK=1
+LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
 prefix=$prefix
 LIBDIR=\$(DESTDIR)$libdir
 SHLIBDIR=\$(DESTDIR)$shlibdir
@@ -3166,13 +3227,12 @@ YASM=$yasmexe
 YASMDEP=$yasmexe
 AR=$ar
 RANLIB=$ranlib
-CP=cp -p
 LN_S=$ln_s
-STRIP=$strip
 CPPFLAGS=$CPPFLAGS
 CFLAGS=$CFLAGS
 ASFLAGS=$ASFLAGS
 CC_O=$CC_O
+DLLTOOL=$dlltool
 LDFLAGS=$LDFLAGS
 FFSERVERLDFLAGS=$FFSERVERLDFLAGS
 SHFLAGS=$SHFLAGS
@@ -3211,7 +3271,7 @@ SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
 SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
 SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
 SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
-SAMPLES=$samples
+SAMPLES:=${samples:-\$(FATE_SAMPLES)}
 EOF
 
 get_version(){
@@ -3226,24 +3286,22 @@ get_version(){
 
 get_version LIBSWSCALE  libswscale/swscale.h
 get_version LIBPOSTPROC libpostproc/postprocess.h
-get_version LIBAVCODEC  libavcodec/avcodec.h
-get_version LIBAVCORE   libavcore/avcore.h
+get_version LIBAVCODEC  libavcodec/version.h
 get_version LIBAVDEVICE libavdevice/avdevice.h
-get_version LIBAVFORMAT libavformat/avformat.h
+get_version LIBAVFORMAT libavformat/version.h
 get_version LIBAVUTIL   libavutil/avutil.h
 get_version LIBAVFILTER libavfilter/avfilter.h
 
 cat > $TMPH <<EOF
 /* Automatically generated by configure - do not modify! */
-#ifndef FFMPEG_CONFIG_H
-#define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
-#define FFMPEG_LICENSE "$(c_escape $license)"
+#ifndef LIBAV_CONFIG_H
+#define LIBAV_CONFIG_H
+#define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
+#define LIBAV_LICENSE "$(c_escape $license)"
 #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
 #define CC_TYPE "$cc_type"
 #define CC_VERSION $cc_version
 #define restrict $_restrict
-#define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\\n\\t"
 #define EXTERN_PREFIX "${extern_prefix}"
 #define EXTERN_ASM ${extern_prefix}
 #define SLIBSUF "$SLIBSUF"
@@ -3290,8 +3348,8 @@ LAVFI_TESTS=$(print_enabled  -n _test $LAVFI_TESTS)
 SEEK_TESTS=$(print_enabled   -n _test $SEEK_TESTS)
 EOF
 
-echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
-echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
+echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
+echo "endif # LIBAV_CONFIG_MAK" >> config.mak
 
 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
 cp_if_changed $TMPH config.h
@@ -3355,11 +3413,10 @@ Cflags: -I\${includedir}
 EOF
 }
 
-pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "-lm"
-pkgconfig_generate libavcore "FFmpeg multimedia shared core utilities library" "$LIBAVCORE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
-pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
-pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
-pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
-pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
-pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
-pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "-lm" "libavutil = $LIBAVUTIL_VERSION"
+pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "-lm"
+pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
+pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
+pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
+pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
+pkgconfig_generate libpostproc "Libav post processing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
+pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "-lm" "libavutil = $LIBAVUTIL_VERSION"
diff --git a/ffmpeg-mt/doc/APIchanges b/ffmpeg-mt/doc/APIchanges
index 6663553..7d12737 100644
--- a/ffmpeg-mt/doc/APIchanges
+++ b/ffmpeg-mt/doc/APIchanges
@@ -2,7 +2,6 @@ Never assume the API of libav* to be stable unless at least 1 week has passed si
 the last major version increase.
 The last version increases were:
 libavcodec:  ?
-libavcore:   2010-07-21
 libavdevice: ?
 libavfilter: 2009-10-18
 libavformat: ?
@@ -13,15 +12,120 @@ libavutil:   2009-03-08
 
 API changes, most recent first:
 
-XXXX-XX-XX - rX - lavc 52.xx.0 - avcodec_thread_init()
+2011-04-08 - lavf 52.106.0 - avformat.h
+  Minor avformat.h cleanup:
+    a9bf9d8 deprecate av_guess_image2_codec
+    c3675df rename avf_sdp_create->av_sdp_create
+
+2011-04-03 - lavf 52.105.0 - avio.h
+  Large-scale renaming/deprecating of AVIOContext-related functions:
+    724f6a0 deprecate url_fdopen
+    403ee83 deprecate url_open_dyn_packet_buf
+    6dc7d80 rename url_close_dyn_buf       -> avio_close_dyn_buf
+    b92c545 rename url_open_dyn_buf        -> avio_open_dyn_buf
+    8978fed introduce an AVIOContext.seekable field as a replacement for
+            AVIOContext.is_streamed and url_is_streamed()
+    b64030f deprecate get_checksum()
+    4c4427a deprecate init_checksum()
+    4ec153b deprecate udp_set_remote_url/get_local_port
+    933e90a deprecate av_url_read_fseek/fpause
+    8d9769a deprecate url_fileno
+    b7f2fdd rename put_flush_packet -> avio_flush
+    35f1023 deprecate url_close_buf
+    83fddae deprecate url_open_buf
+    d9d86e0 rename url_fprintf -> avio_printf
+    59f65d9 deprecate url_setbufsize
+    3e68b3b deprecate url_ferror
+    66e5b1d deprecate url_feof
+    e8bb2e2 deprecate url_fget_max_packet_size
+    76aa876 rename url_fsize -> avio_size
+    e519753 deprecate url_fgetc
+    655e45e deprecate url_fgets
+    a2704c9 rename url_ftell -> avio_tell
+    e16ead0 deprecate get_strz() in favor of avio_get_str
+    0300db8,2af07d3 rename url_fskip -> avio_skip
+    6b4aa5d rename url_fseek -> avio_seek
+    61840b4 deprecate put_tag
+    22a3212 rename url_fopen/fclose -> avio_open/close.
+    0ac8e2b deprecate put_nbyte
+    77eb550 rename put_byte          -> avio_w8
+                   put_[b/l]e<type>  -> avio_w[b/l]<type>
+                   put_buffer        -> avio_write
+    b7effd4 rename get_byte          -> avio_r8,
+                   get_[b/l]e<type>  -> avio_r[b/l]<type>
+                   get_buffer        -> avio_read
+    b3db9ce deprecate get_partial_buffer
+    8d9ac96 rename av_alloc_put_byte -> avio_alloc_context
+
+2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type
+  Add audio_service_type field to AVCodecContext.
+
+2011-03-02 - 863c471 - lavf  52.103.0 - av_pkt_dump2, av_pkt_dump_log2
+  Add new functions av_pkt_dump2, av_pkt_dump_log2 that uses the
+  source stream timebase for outputting timestamps. Deprecate
+  av_pkt_dump and av_pkt_dump_log.
+
+2011-02-20 - e731b8d - lavf  52.102.0 - avio.h
+  * e731b8d - rename init_put_byte() to ffio_init_context(), deprecating the
+              original, and move it to a private header so it is no longer
+              part of our public API. Instead, use av_alloc_put_byte().
+  * ae628ec - rename ByteIOContext to AVIOContext.
+
+2011-02-16 - 09d171b - lavf  52.101.0 - avformat.h
+                       lavu  52.39.0  - parseutils.h
+  * 610219a - Add av_ prefix to dump_format().
+  * f6c7375 - Replace parse_date() in lavf with av_parse_time() in lavu.
+  * ab0287f - Move find_info_tag from lavf to lavu and add av_prefix to it.
+
+2011-02-15 - lavu 52.38.0 - merge libavcore
+  libavcore is merged back completely into libavutil
+
+2011-02-10 - 55bad0c - lavc 52.113.0 - vbv_delay
+  Add vbv_delay field to AVCodecContext
+
+2011-02-14 - 24a83bd - lavf 52.100.0 - AV_DISPOSITION_CLEAN_EFFECTS
+  Add AV_DISPOSITION_CLEAN_EFFECTS disposition flag.
+
+2011-02-14 - 910b5b8 - lavfi 1.76.0 - AVFilterLink sample_aspect_ratio
+  Add sample_aspect_ratio field to AVFilterLink.
+
+2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition
+  Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED.
+
+2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init()
   Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead
   set thread_count before calling avcodec_open.
 
-XXXX-XX-XX - rX - lavc 52.xx.0 - threading API
+2011-02-09 - 778b08a - lavc 52.111.0 - threading API
   Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/
   release_buffer()/draw_horiz_band() callbacks for appropriate codecs.
   Add thread_type and active_thread_type fields to AVCodecContext.
 
+2011-02-08 - 3940caa - lavf 52.98.0 - av_probe_input_buffer
+  Add av_probe_input_buffer() to avformat.h for probing format from a
+  ByteIOContext.
+
+2011-02-06 - fe174fc - lavf 52.97.0 - avio.h
+  Add flag for non-blocking protocols: URL_FLAG_NONBLOCK
+
+2011-02-04 - f124b08 - lavf 52.96.0 - avformat_free_context()
+  Add avformat_free_context() in avformat.h.
+
+2011-02-03 - f5b82f4 - lavc 52.109.0 - add CODEC_ID_PRORES
+  Add CODEC_ID_PRORES to avcodec.h.
+
+2011-02-03 - fe9a3fb - lavc 52.109.0 - H.264 profile defines
+  Add defines for H.264 * Constrained Baseline and Intra profiles
+
+2011-02-02 - lavf 52.95.0
+  * 50196a9 - add a new installed header version.h.
+  * 4efd5cf, dccbd97, 93b78d1 - add several variants of public
+    avio_{put,get}_str* functions.  Deprecate corresponding semi-public
+    {put,get}_str*.
+
+2011-02-02 - dfd2a00 - lavu 50.37.0 - log.h
+  Make av_dlog public.
+
 2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
   Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples.
 
@@ -38,7 +142,7 @@ XXXX-XX-XX - rX - lavc 52.xx.0 - threading API
 2011-01-07 - r26260 - lavc 52.105.0 - pkt_pts
   Add pkt_pts to AVFrame.
 
-2011-01-XX - r26XXX - lavc 52.104.0 - av_get_profile_name()
+2011-01-07 - r26259 - lavc 52.104.0 - av_get_profile_name()
   Add av_get_profile_name to libavcodec/avcodec.h.
 
 2010-12-27 - r26108 - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
@@ -394,16 +498,22 @@ XXXX-XX-XX - rX - lavc 52.xx.0 - threading API
 
 2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
   Add CODEC_CAP_EXPERIMENTAL flag.
+  NOTE: this was backported to 0.6
 
 2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed()
   Add av_get_random_seed().
 
 2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
   Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags.
+  NOTE: this was backported to 0.6
 
 2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef
   Add interlaced and top_field_first fields to AVFilterPicRef.
 
+------------------------------8<-------------------------------------
+                   0.6 branch was cut here
+----------------------------->8--------------------------------------
+
 2010-05-01 - r23002 - lavf 52.62.0 - probe function
   Add av_probe_input_format2 to API, it allows ignoring probe
   results below given score and returns the actual probe score.
diff --git a/ffmpeg-mt/doc/TODO b/ffmpeg-mt/doc/TODO
index 747eee4..8ff8a6b 100644
--- a/ffmpeg-mt/doc/TODO
+++ b/ffmpeg-mt/doc/TODO
@@ -69,7 +69,7 @@ unassigned TODO: (unordered)
 - JPEG2000 decoder & encoder
 - MPEG4 GMC encoding support
 - macroblock based pixel format (better cache locality, somewhat complex, one paper claimed it faster for high res)
-- regression tests for codecs which do not have an encoder (I+P-frame bitstream in svn)
+- regression tests for codecs which do not have an encoder (I+P-frame bitstream in the 'master' branch)
 - add support for using mplayers video filters to ffmpeg
 - H264 encoder
 - per MB ratecontrol (so VCD and such do work better)
diff --git a/ffmpeg-mt/doc/bitstream_filters.texi b/ffmpeg-mt/doc/bitstream_filters.texi
index 1ad67cd..c33fca6 100644
--- a/ffmpeg-mt/doc/bitstream_filters.texi
+++ b/ffmpeg-mt/doc/bitstream_filters.texi
@@ -1,7 +1,7 @@
 @chapter Bitstream Filters
 @c man begin BITSTREAM FILTERS
 
-When you configure your FFmpeg build, all the supported bitstream
+When you configure your Libav build, all the supported bitstream
 filters are enabled by default. You can list all available ones using
 the configure option @code{--list-bsfs}.
 
diff --git a/ffmpeg-mt/doc/build_system.txt b/ffmpeg-mt/doc/build_system.txt
index b22ff84..1011f57 100644
--- a/ffmpeg-mt/doc/build_system.txt
+++ b/ffmpeg-mt/doc/build_system.txt
@@ -1,34 +1,30 @@
-FFmpeg currently uses a custom build system, this text attempts to document
+Libav currently uses a custom build system, this text attempts to document
 some of its obscure features and options.
 
-Options to make:
-make V=1 <target>
-    Build target with verbosity 1, instead of 1, 2 can be used too
+Makefile variables:
 
+V
+    Disable the default terse mode, the full command issued by make and its
+    output will be shown on the screen.
 
-Useful standard make commands:
-make -t <target>
-    Touch all files that otherwise would be build, this is useful to reduce
-    unneeded rebuilding when changing headers, but note you must force rebuilds
-    of files that actually need it by hand then.
+DESTDIR
+    Destination directory for the install targets, useful to prepare packages
+    or install Libav in cross-environments.
 
-make -j<num>
-    rebuild with multiple jobs at the same time. Faster on multi processor systems
+Makefile targets:
 
-make -k
-    continue build in case of errors, this is useful for the regression tests
-    sometimes but note it will still not run all reg tests.
+all
+    Default target, builds all the libraries and the executables.
 
+install
+    Install headers, libraries and programs.
 
-Targets to make:
-fate-list
-    Will list all fate/regression test targets
+libavformat/output-example
+    Build the libavformat basic example.
 
-fate
-    Run the fate test suite, note you must have installed it
+libavcodec/api-example
+    Build the libavcodec basic example.
 
+libswscale/swscale-test
+    Build the swscale self-test (useful also as example).
 
-Setting up local fate:
-use the following command to get the fate test samples
-rsync -aL rsync://rsync.mplayerhq.hu:/samples/fate-suite/ fate/fate-suite
-pass --samples=<path to the samples> to configure
diff --git a/ffmpeg-mt/doc/demuxers.texi b/ffmpeg-mt/doc/demuxers.texi
index 5fcaf4f..bbdde9c 100644
--- a/ffmpeg-mt/doc/demuxers.texi
+++ b/ffmpeg-mt/doc/demuxers.texi
@@ -1,10 +1,10 @@
 @chapter Demuxers
 @c man begin DEMUXERS
 
-Demuxers are configured elements in FFmpeg which allow to read the
+Demuxers are configured elements in Libav which allow to read the
 multimedia streams from a particular type of file.
 
-When you configure your FFmpeg build, all the supported demuxers
+When you configure your Libav build, all the supported demuxers
 are enabled by default. You can list all available ones using the
 configure option "--list-demuxers".
 
@@ -24,20 +24,18 @@ Image file demuxer.
 
 This demuxer reads from a list of image files specified by a pattern.
 
-The filename of each file to read must contain a sequential number,
-which specifies the position of the file in the sequence.
-
-The pattern must contain the string "%d" or "%0 at var{N}d", which
-specifies the position of the characters representing the seqential
+The pattern may contain the string "%d" or "%0 at var{N}d", which
+specifies the position of the characters representing a sequential
 number in each filename matched by the pattern. If the form
 "%d0 at var{N}d" is used, the string representing the number in each
 filename is 0-padded and @var{N} is the total number of 0-padded
 digits representing the number. The literal character '%' can be
 specified in the pattern with the string "%%".
 
-The first filename of the file sequence specified by the pattern must
-contain a number inclusively contained between 0 and 4, all the
-following numbers must be sequential.
+If the pattern contains "%d" or "%0 at var{N}d", the first filename of
+the file list specified by the pattern must contain a number
+inclusively contained between 0 and 4, all the following numbers must
+be sequential. This limitation may be hopefully fixed.
 
 The pattern may contain a suffix which is used to automatically
 determine the format of the images contained in the files.
@@ -59,4 +57,11 @@ second:
 ffmpeg -r 10 -f image2 -i 'img-%03d.jpeg' out.avi
 @end example
 
+Note that the pattern must not necessarily contain "%d" or
+"%0 at var{N}d", for example to convert a single image file
+ at file{img.jpeg} you can employ the command:
+ at example
+ffmpeg -f image2 -i img.jpeg img.png
+ at end example
+
 @c man end INPUT DEVICES
diff --git a/ffmpeg-mt/doc/developer.texi b/ffmpeg-mt/doc/developer.texi
index 89bc339..ec196d7 100644
--- a/ffmpeg-mt/doc/developer.texi
+++ b/ffmpeg-mt/doc/developer.texi
@@ -2,11 +2,12 @@
 
 @settitle Developer Documentation
 @titlepage
- at sp 7
 @center @titlefont{Developer Documentation}
- at sp 3
 @end titlepage
 
+ at top
+
+ at contents
 
 @chapter Developers Guide
 
@@ -31,12 +32,12 @@ generated by ./configure to understand what is needed.
 
 You can use libavcodec or libavformat in your commercial program, but
 @emph{any patch you make must be published}. The best way to proceed is
-to send your patches to the FFmpeg mailing list.
+to send your patches to the Libav mailing list.
 
 @anchor{Coding Rules}
 @section Coding Rules
 
-FFmpeg is programmed in the ISO C90 language with a few additional
+Libav is programmed in the ISO C90 language with a few additional
 features from ISO C99, namely:
 @itemize @bullet
 @item
@@ -53,7 +54,7 @@ These features are supported by all compilers we care about, so we will not
 accept patches to remove their use unless they absolutely do not impair
 clarity and performance.
 
-All code must compile with GCC 2.95 and GCC 3.3. Currently, FFmpeg also
+All code must compile with GCC 2.95 and GCC 3.3. Currently, Libav also
 compiles with several other compilers, such as the Compaq ccc compiler
 or Sun Studio 9, and we would like to keep it that way unless it would
 be exceedingly involved. To ensure compatibility, please do not use any
@@ -73,9 +74,9 @@ Indent size is 4.
 The presentation is one inspired by 'indent -i4 -kr -nut'.
 The TAB character is forbidden outside of Makefiles as is any
 form of trailing whitespace. Commits containing either will be
-rejected by the Subversion repository.
+rejected by the git repository.
 
-The main priority in FFmpeg is simplicity and small code size in order to
+The main priority in Libav is simplicity and small code size in order to
 minimize the bug count.
 
 Comments: Use the JavaDoc/Doxygen
@@ -128,7 +129,7 @@ should also be avoided if they don't make the code easier to understand.
    an "or any later version" clause is also acceptable, but LGPL is
    preferred.
 @item
-   You must not commit code which breaks FFmpeg! (Meaning unfinished but
+   You must not commit code which breaks Libav! (Meaning unfinished but
    enabled code which breaks compilation or compiles but does not work or
    breaks the regression tests)
    You can commit unfinished stuff (for testing etc), but it must be disabled
@@ -150,7 +151,7 @@ should also be avoided if they don't make the code easier to understand.
    ask/discuss it on the developer mailing list.
 @item
    Do not change behavior of the programs (renaming options etc) or public
-   API or ABI without first discussing it on the ffmpeg-devel mailing list.
+   API or ABI without first discussing it on the libav-devel mailing list.
    Do not remove functionality from the code. Just improve!
 
    Note: Redundant code can be removed.
@@ -159,7 +160,7 @@ should also be avoided if they don't make the code easier to understand.
    which change behavior, defaults etc, without asking first. The same
    applies to compiler warning fixes, trivial looking fixes and to code
    maintained by other developers. We usually have a reason for doing things
-   the way we do. Send your changes as patches to the ffmpeg-devel mailing
+   the way we do. Send your changes as patches to the libav-devel mailing
    list, and if the code maintainers say OK, you may commit. This does not
    apply to files you wrote and/or maintain.
 @item
@@ -167,7 +168,7 @@ should also be avoided if they don't make the code easier to understand.
    with functional changes, such commits will be rejected and removed. Every
    developer has his own indentation style, you should not change it. Of course
    if you (re)write something, you can use your own style, even though we would
-   prefer if the indentation throughout FFmpeg was consistent (Many projects
+   prefer if the indentation throughout Libav was consistent (Many projects
    force a given indentation style - we do not.). If you really need to make
    indentation changes (try to avoid this), separate them strictly from real
    changes.
@@ -181,27 +182,27 @@ should also be avoided if they don't make the code easier to understand.
    particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
 @item
    If you apply a patch by someone else, include the name and email address in
-   the log message. Since the ffmpeg-cvslog mailing list is publicly
+   the log message. Since the libav-commits mailing list is publicly
    archived you should add some SPAM protection to the email address. Send an
-   answer to ffmpeg-devel (or wherever you got the patch from) saying that
+   answer to libav-devel (or wherever you got the patch from) saying that
    you applied the patch.
 @item
    When applying patches that have been discussed (at length) on the mailing
    list, reference the thread in the log message.
 @item
     Do NOT commit to code actively maintained by others without permission.
-    Send a patch to ffmpeg-devel instead. If no one answers within a reasonable
+    Send a patch to libav-devel instead. If no one answers within a reasonable
     timeframe (12h for build failures and security fixes, 3 days small changes,
     1 week for big patches) then commit your patch if you think it is OK.
     Also note, the maintainer can simply ask for more time to review!
 @item
-    Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits
+    Subscribe to the libav-commits mailing list. The diffs of all commits
     are sent there and reviewed by all the other developers. Bugs and possible
     improvements or general questions regarding commits are discussed there. We
     expect you to react if problems with your code are uncovered.
 @item
     Update the documentation if you change behavior or add features. If you are
-    unsure how best to do this, send a patch to ffmpeg-devel, the documentation
+    unsure how best to do this, send a patch to libav-devel, the documentation
     maintainer(s) will review and commit your stuff.
 @item
     Try to keep important discussions and requests (also) on the public
@@ -252,7 +253,7 @@ keeping it as a logical unit that contains an individual change, even
 if it spans multiple files. This makes reviewing your patches much easier
 for us and greatly increases your chances of getting your patch applied.
 
-Use the patcheck tool of FFmpeg to check your patch.
+Use the patcheck tool of Libav to check your patch.
 The tool is located in the tools directory.
 
 Run the regression tests before submitting a patch so that you can
@@ -260,8 +261,8 @@ verify that there are no big problems.
 
 Patches should be posted as base64 encoded attachments (or any other
 encoding which ensures that the patch will not be trashed during
-transmission) to the ffmpeg-devel mailing list, see
- at url{http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel}
+transmission) to the libav-devel mailing list, see
+ at url{https://lists.libav.org/mailman/listinfo/libav-devel}
 
 It also helps quite a bit if you tell us what the patch does (for example
 'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant
@@ -274,7 +275,7 @@ Your patch will be reviewed on the mailing list. You will likely be asked
 to make some changes and are expected to send in an improved version that
 incorporates the requests from the review. This process may go through
 several iterations. Once your patch is deemed good enough, some developer
-will pick it up and commit it to the official FFmpeg tree.
+will pick it up and commit it to the official Libav tree.
 
 Give us a few days to react. But if some time passes without reaction,
 send a reminder by email. Your patch should eventually be dealt with.
@@ -311,7 +312,7 @@ send a reminder by email. Your patch should eventually be dealt with.
     If it depends on a parser or a library, did you add that dependency in
     configure?
 @item
-    Did you "svn add" the appropriate files before commiting?
+    Did you "git add" the appropriate files before committing?
 @end enumerate
 
 @section patch submission checklist
@@ -324,7 +325,7 @@ send a reminder by email. Your patch should eventually be dealt with.
 @item
     Is the patch a unified diff?
 @item
-    Is the patch against latest FFmpeg SVN?
+    Is the patch against latest Libav git master branch?
 @item
     Are you subscribed to ffmpeg-dev?
     (the list is subscribers only due to spam)
@@ -360,7 +361,7 @@ send a reminder by email. Your patch should eventually be dealt with.
     If the patch fixes a bug, did you provide enough information, including
     a sample, so the bug can be reproduced and the fix can be verified?
     Note please do not attach samples >100k to mails but rather provide a
-    URL, you can upload to ftp://upload.ffmpeg.org
+    URL, you can upload to ftp://upload.libav.org
 @item
     Did you provide a verbose summary about what the patch does change?
 @item
@@ -373,7 +374,7 @@ send a reminder by email. Your patch should eventually be dealt with.
     patch easily?
 @item
     If you added a new file, did you insert a license header? It should be
-    taken from FFmpeg, not randomly copied and pasted from somewhere else.
+    taken from Libav, not randomly copied and pasted from somewhere else.
 @item
     You should maintain alphabetical order in alphabetically ordered lists as
     long as doing so does not break API/ABI compatibility.
@@ -386,8 +387,8 @@ send a reminder by email. Your patch should eventually be dealt with.
 
 @section Patch review process
 
-All patches posted to ffmpeg-devel will be reviewed, unless they contain a
-clear note that the patch is not for SVN.
+All patches posted to libav-devel will be reviewed, unless they contain a
+clear note that the patch is not for the git master branch.
 Reviews and comments will be posted as replies to the patch on the
 mailing list. The patch submitter then has to take care of every comment,
 that can be by resubmitting a changed patch or by discussion. Resubmitted
diff --git a/ffmpeg-mt/doc/encoders.texi b/ffmpeg-mt/doc/encoders.texi
new file mode 100644
index 0000000..59337e2
--- /dev/null
+++ b/ffmpeg-mt/doc/encoders.texi
@@ -0,0 +1,356 @@
+ at chapter Encoders
+ at c man begin ENCODERS
+
+Encoders are configured elements in Libav which allow the encoding of
+multimedia streams.
+
+When you configure your Libav build, all the supported native encoders
+are enabled by default. Encoders requiring an external library must be enabled
+manually via the corresponding @code{--enable-lib} option. You can list all
+available encoders using the configure option @code{--list-encoders}.
+
+You can disable all the encoders with the configure option
+ at code{--disable-encoders} and selectively enable / disable single encoders
+with the options @code{--enable-encoder=@var{ENCODER}} /
+ at code{--disable-encoder=@var{ENCODER}}.
+
+The option @code{-codecs} of the ff* tools will display the list of
+enabled encoders.
+
+A description of some of the currently available encoders follows.
+
+ at section Audio Encoders
+
+ at subsection ac3 and ac3_fixed
+
+AC-3 audio encoders.
+
+These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
+the undocumented RealAudio 3 (a.k.a. dnet).
+
+The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed}
+encoder only uses fixed-point integer math. This does not mean that one is
+always faster, just that one or the other may be better suited to a
+particular system. The floating-point encoder will generally produce better
+quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the
+default codec for any of the output formats, so it must be specified explicitly
+using the option @code{-acodec ac3_fixed} in order to use it.
+
+ at subheading AC-3 Metadata
+
+The AC-3 metadata options are used to set parameters that describe the audio,
+but in most cases do not affect the audio encoding itself. Some of the options
+do directly affect or influence the decoding and playback of the resulting
+bitstream, while others are just for informational purposes. A few of the
+options will add bits to the output stream that could otherwise be used for
+audio data, and will thus affect the quality of the output. Those will be
+indicated accordingly with a note in the option list below.
+
+These parameters are described in detail in several publicly-available
+documents.
+ at itemize
+ at item @uref{http://www.atsc.org/cms/standards/a_52-2010.pdf,A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard}
+ at item @uref{http://www.atsc.org/cms/standards/a_54a_with_corr_1.pdf,A/54 - Guide to the Use of the ATSC Digital Television Standard}
+ at item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf,Dolby Metadata Guide}
+ at item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines}
+ at end itemize
+
+ at subsubheading Metadata Control Options
+
+ at table @option
+
+ at item -per_frame_metadata @var{boolean}
+Allow Per-Frame Metadata. Specifies if the encoder should check for changing
+metadata for each frame.
+ at table @option
+ at item 0
+The metadata values set at initialization will be used for every frame in the
+stream. (default)
+ at item 1
+Metadata values can be changed before encoding each frame.
+ at end table
+
+ at end table
+
+ at subsubheading Downmix Levels
+
+ at table @option
+
+ at item -center_mixlev @var{level}
+Center Mix Level. The amount of gain the decoder should apply to the center
+channel when downmixing to stereo. This field will only be written to the
+bitstream if a center channel is present. The value is specified as a scale
+factor. There are 3 valid values:
+ at table @option
+ at item 0.707
+Apply -3dB gain
+ at item 0.595
+Apply -4.5dB gain (default)
+ at item 0.500
+Apply -6dB gain
+ at end table
+
+ at item -surround_mixlev @var{level}
+Surround Mix Level. The amount of gain the decoder should apply to the surround
+channel(s) when downmixing to stereo. This field will only be written to the
+bitstream if one or more surround channels are present. The value is specified
+as a scale factor.  There are 3 valid values:
+ at table @option
+ at item 0.707
+Apply -3dB gain
+ at item 0.500
+Apply -6dB gain (default)
+ at item 0.000
+Silence Surround Channel(s)
+ at end table
+
+ at end table
+
+ at subsubheading Audio Production Information
+Audio Production Information is optional information describing the mixing
+environment.  Either none or both of the fields are written to the bitstream.
+
+ at table @option
+
+ at item -mixing_level @var{number}
+Mixing Level. Specifies peak sound pressure level (SPL) in the production
+environment when the mix was mastered. Valid values are 80 to 111, or -1 for
+unknown or not indicated. The default value is -1, but that value cannot be
+used if the Audio Production Information is written to the bitstream. Therefore,
+if the @code{room_type} option is not the default value, the @code{mixing_level}
+option must not be -1.
+
+ at item -room_type @var{type}
+Room Type. Describes the equalization used during the final mixing session at
+the studio or on the dubbing stage. A large room is a dubbing stage with the
+industry standard X-curve equalization; a small room has flat equalization.
+This field will not be written to the bitstream if both the @code{mixing_level}
+option and the @code{room_type} option have the default values.
+ at table @option
+ at item 0
+ at itemx notindicated
+Not Indicated (default)
+ at item 1
+ at itemx large
+Large Room
+ at item 2
+ at itemx small
+Small Room
+ at end table
+
+ at end table
+
+ at subsubheading Other Metadata Options
+
+ at table @option
+
+ at item -copyright @var{boolean}
+Copyright Indicator. Specifies whether a copyright exists for this audio.
+ at table @option
+ at item 0
+ at itemx off
+No Copyright Exists (default)
+ at item 1
+ at itemx on
+Copyright Exists
+ at end table
+
+ at item -dialnorm @var{value}
+Dialogue Normalization. Indicates how far the average dialogue level of the
+program is below digital 100% full scale (0 dBFS). This parameter determines a
+level shift during audio reproduction that sets the average volume of the
+dialogue to a preset level. The goal is to match volume level between program
+sources. A value of -31dB will result in no volume level change, relative to
+the source volume, during audio reproduction. Valid values are whole numbers in
+the range -31 to -1, with -31 being the default.
+
+ at item -dsur_mode @var{mode}
+Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
+(Pro Logic). This field will only be written to the bitstream if the audio
+stream is stereo. Using this option does @b{NOT} mean the encoder will actually
+apply Dolby Surround processing.
+ at table @option
+ at item 0
+ at itemx notindicated
+Not Indicated (default)
+ at item 1
+ at itemx off
+Not Dolby Surround Encoded
+ at item 2
+ at itemx on
+Dolby Surround Encoded
+ at end table
+
+ at item -original @var{boolean}
+Original Bit Stream Indicator. Specifies whether this audio is from the
+original source and not a copy.
+ at table @option
+ at item 0
+ at itemx off
+Not Original Source
+ at item 1
+ at itemx on
+Original Source (default)
+ at end table
+
+ at end table
+
+ at subsubheading Extended Bitstream Information
+The extended bitstream options are part of the Alternate Bit Stream Syntax as
+specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
+If any one parameter in a group is specified, all values in that group will be
+written to the bitstream.  Default values are used for those that are written
+but have not been specified.  If the mixing levels are written, the decoder
+will use these values instead of the ones specified in the @code{center_mixlev}
+and @code{surround_mixlev} options if it supports the Alternate Bit Stream
+Syntax.
+
+ at subsubheading Extended Bitstream Information - Part 1
+
+ at table @option
+
+ at item -dmix_mode @var{mode}
+Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
+(Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
+ at table @option
+ at item 0
+ at itemx notindicated
+Not Indicated (default)
+ at item 1
+ at itemx ltrt
+Lt/Rt Downmix Preferred
+ at item 2
+ at itemx loro
+Lo/Ro Downmix Preferred
+ at end table
+
+ at item -ltrt_cmixlev @var{level}
+Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
+center channel when downmixing to stereo in Lt/Rt mode.
+ at table @option
+ at item 1.414
+Apply +3dB gain
+ at item 1.189
+Apply +1.5dB gain
+ at item 1.000
+Apply 0dB gain
+ at item 0.841
+Apply -1.5dB gain
+ at item 0.707
+Apply -3.0dB gain
+ at item 0.595
+Apply -4.5dB gain (default)
+ at item 0.500
+Apply -6.0dB gain
+ at item 0.000
+Silence Center Channel
+ at end table
+
+ at item -ltrt_surmixlev @var{level}
+Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
+surround channel(s) when downmixing to stereo in Lt/Rt mode.
+ at table @option
+ at item 0.841
+Apply -1.5dB gain
+ at item 0.707
+Apply -3.0dB gain
+ at item 0.595
+Apply -4.5dB gain
+ at item 0.500
+Apply -6.0dB gain (default)
+ at item 0.000
+Silence Surround Channel(s)
+ at end table
+
+ at item -loro_cmixlev @var{level}
+Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
+center channel when downmixing to stereo in Lo/Ro mode.
+ at table @option
+ at item 1.414
+Apply +3dB gain
+ at item 1.189
+Apply +1.5dB gain
+ at item 1.000
+Apply 0dB gain
+ at item 0.841
+Apply -1.5dB gain
+ at item 0.707
+Apply -3.0dB gain
+ at item 0.595
+Apply -4.5dB gain (default)
+ at item 0.500
+Apply -6.0dB gain
+ at item 0.000
+Silence Center Channel
+ at end table
+
+ at item -loro_surmixlev @var{level}
+Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
+surround channel(s) when downmixing to stereo in Lo/Ro mode.
+ at table @option
+ at item 0.841
+Apply -1.5dB gain
+ at item 0.707
+Apply -3.0dB gain
+ at item 0.595
+Apply -4.5dB gain
+ at item 0.500
+Apply -6.0dB gain (default)
+ at item 0.000
+Silence Surround Channel(s)
+ at end table
+
+ at end table
+
+ at subsubheading Extended Bitstream Information - Part 2
+
+ at table @option
+
+ at item -dsurex_mode @var{mode}
+Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
+(7.1 matrixed to 5.1). Using this option does @b{NOT} mean the encoder will actually
+apply Dolby Surround EX processing.
+ at table @option
+ at item 0
+ at itemx notindicated
+Not Indicated (default)
+ at item 1
+ at itemx on
+Dolby Surround EX On
+ at item 2
+ at itemx off
+Dolby Surround EX Off
+ at end table
+
+ at item -dheadphone_mode @var{mode}
+Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
+encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
+option does @b{NOT} mean the encoder will actually apply Dolby Headphone
+processing.
+ at table @option
+ at item 0
+ at itemx notindicated
+Not Indicated (default)
+ at item 1
+ at itemx on
+Dolby Headphone On
+ at item 2
+ at itemx off
+Dolby Headphone Off
+ at end table
+
+ at item -ad_conv_type @var{type}
+A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
+conversion.
+ at table @option
+ at item 0
+ at itemx standard
+Standard A/D Converter (default)
+ at item 1
+ at itemx hdcd
+HDCD A/D Converter
+ at end table
+
+ at end table
+
+ at c man end ENCODERS
diff --git a/ffmpeg-mt/doc/eval.texi b/ffmpeg-mt/doc/eval.texi
index 99cd034..a989a37 100644
--- a/ffmpeg-mt/doc/eval.texi
+++ b/ffmpeg-mt/doc/eval.texi
@@ -1,7 +1,7 @@
 @chapter Expression Evaluation
 @c man begin EXPRESSION EVALUATION
 
-When evaluating an arithemetic expression, FFmpeg uses an internal
+When evaluating an arithemetic expression, Libav uses an internal
 formula evaluator, implemented through the @file{libavutil/eval.h}
 interface.
 
diff --git a/ffmpeg-mt/doc/faq.texi b/ffmpeg-mt/doc/faq.texi
index c03a2e1..27b26b6 100644
--- a/ffmpeg-mt/doc/faq.texi
+++ b/ffmpeg-mt/doc/faq.texi
@@ -1,52 +1,53 @@
 \input texinfo @c -*- texinfo -*-
 
- at settitle FFmpeg FAQ
+ at settitle Libav FAQ
 @titlepage
- at sp 7
- at center @titlefont{FFmpeg FAQ}
- at sp 3
+ at center @titlefont{Libav FAQ}
 @end titlepage
 
+ at top
+
+ at contents
 
 @chapter General Questions
 
- at section When will the next FFmpeg version be released? / Why are FFmpeg releases so few and far between?
+ at section When will the next Libav version be released? / Why are Libav releases so few and far between?
 
-Like most open source projects FFmpeg suffers from a certain lack of
+Like most open source projects Libav suffers from a certain lack of
 manpower. For this reason the developers have to prioritize the work
 they do and putting out releases is not at the top of the list, fixing
 bugs and reviewing patches takes precedence. Please don't complain or
 request more timely and/or frequent releases unless you are willing to
 help out creating them.
 
- at section I have a problem with an old version of FFmpeg; where should I report it?
-Nowhere. We do not support old FFmpeg versions in any way, we simply lack
+ at section I have a problem with an old version of Libav; where should I report it?
+Nowhere. We do not support old Libav versions in any way, we simply lack
 the time, motivation and manpower to do so. If you have a problem with an
-old version of FFmpeg, upgrade to the latest Subversion snapshot. If you
+old version of Libav, upgrade to the latest git snapshot. If you
 still experience the problem, then you can report it according to the
-guidelines in @url{http://ffmpeg.org/bugreports.html}.
+guidelines in @url{http://libav.org/bugreports.html}.
 
- at section Why doesn't FFmpeg support feature [xyz]?
+ at section Why doesn't Libav support feature [xyz]?
 
-Because no one has taken on that task yet. FFmpeg development is
+Because no one has taken on that task yet. Libav development is
 driven by the tasks that are important to the individual developers.
 If there is a feature that is important to you, the best way to get
 it implemented is to undertake the task yourself or sponsor a developer.
 
- at section FFmpeg does not support codec XXX. Can you include a Windows DLL loader to support it?
+ at section Libav does not support codec XXX. Can you include a Windows DLL loader to support it?
 
 No. Windows DLLs are not portable, bloated and often slow.
-Moreover FFmpeg strives to support all codecs natively.
+Moreover Libav strives to support all codecs natively.
 A DLL loader is not conducive to that goal.
 
- at section My bug report/mail to ffmpeg-devel/user has not received any replies.
+ at section My bug report/mail to libav-devel/user has not received any replies.
 
 Likely reasons
 @itemize
 @item We are busy and haven't had time yet to read your report or
 investigate the issue.
- at item You didn't follow @url{http://ffmpeg.org/bugreports.html}.
- at item You didn't use Subversion HEAD.
+ at item You didn't follow @url{http://libav.org/bugreports.html}.
+ at item You didn't use git master.
 @item You reported a segmentation fault without gdb output.
 @item You describe a problem but not how to reproduce it.
 @item It's unclear if you use ffmpeg as command line tool or use
@@ -54,10 +55,10 @@ libav* from another application.
 @item You speak about a video having problems on playback but
 not what you use to play it.
 @item We have no faint clue what you are talking about besides
-that it is related to FFmpeg.
+that it is related to Libav.
 @end itemize
 
- at section Is there a forum for FFmpeg? I do not like mailing lists.
+ at section Is there a forum for Libav? I do not like mailing lists.
 
 You may view our mailing lists with a more forum-alike look here:
 @url{http://dir.gmane.org/gmane.comp.video.ffmpeg.user},
@@ -123,7 +124,7 @@ problem and an NP-hard problem...
 @section ffmpeg does not work; what is wrong?
 
 Try a @code{make distclean} in the ffmpeg source directory before the build. If this does not help see
-(@url{http://ffmpeg.org/bugreports.html}).
+(@url{http://libav.org/bugreports.html}).
 
 @section How do I encode single pictures into movies?
 
@@ -146,7 +147,7 @@ that match @code{*jpg} to the @file{/tmp} directory in the sequence of
 @file{img001.jpg}, @file{img002.jpg} and so on.
 
 @example
-  x=1; for i in *jpg; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done
+  x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done
 @end example
 
 If you want to sequence them by oldest modified first, substitute
@@ -271,7 +272,7 @@ material, and try '-top 0/1' if the result looks really messed-up.
 
 @section How can I read DirectShow files?
 
-If you have built FFmpeg with @code{./configure --enable-avisynth}
+If you have built Libav with @code{./configure --enable-avisynth}
 (only possible on MinGW/Cygwin platforms),
 then you may use any file that DirectShow can read as input.
 
@@ -367,11 +368,11 @@ examining all of the vbv_delay values and making complicated computations."
 
 @chapter Development
 
- at section Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat?
+ at section Are there examples illustrating how to use the Libav libraries, particularly libavcodec and libavformat?
 
-Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively,
+Yes. Read the Developers Guide of the Libav documentation. Alternatively,
 examine the source code for one of the many open source projects that
-already incorporate FFmpeg at (@url{projects.html}).
+already incorporate Libav at (@url{projects.html}).
 
 @section Can you support my C compiler XXX?
 
@@ -382,14 +383,14 @@ with @code{#ifdef}s related to the compiler.
 @section Is Microsoft Visual C++ supported?
 
 No. Microsoft Visual C++ is not compliant to the C99 standard and does
-not - among other things - support the inline assembly used in FFmpeg.
+not - among other things - support the inline assembly used in Libav.
 If you wish to use MSVC++ for your
 project then you can link the MSVC++ code with libav* as long as
 you compile the latter with a working C compiler. For more information, see
-the @emph{Microsoft Visual C++ compatibility} section in the FFmpeg
+the @emph{Microsoft Visual C++ compatibility} section in the Libav
 documentation.
 
-There have been efforts to make FFmpeg compatible with MSVC++ in the
+There have been efforts to make Libav compatible with MSVC++ in the
 past. However, they have all been rejected as too intrusive, especially
 since MinGW does the job adequately. None of the core developers
 work with MSVC++ and thus this item is low priority. Should you find
@@ -397,23 +398,19 @@ the silver bullet that solves this problem, feel free to shoot it at us.
 
 We strongly recommend you to move over from MSVC++ to MinGW tools.
 
- at section Can I use FFmpeg or libavcodec under Windows?
+ at section Can I use Libav or libavcodec under Windows?
 
-Yes, but the Cygwin or MinGW tools @emph{must} be used to compile FFmpeg.
-Read the @emph{Windows} section in the FFmpeg documentation to find more
+Yes, but the Cygwin or MinGW tools @emph{must} be used to compile Libav.
+Read the @emph{Windows} section in the Libav documentation to find more
 information.
 
-To get help and instructions for building FFmpeg under Windows, check out
-the FFmpeg Windows Help Forum at
- at url{http://ffmpeg.arrozcru.org/}.
-
 @section Can you add automake, libtool or autoconf support?
 
 No. These tools are too bloated and they complicate the build.
 
 @section Why not rewrite ffmpeg in object-oriented C++?
 
-FFmpeg is already organized in a highly modular manner and does not need to
+Libav is already organized in a highly modular manner and does not need to
 be rewritten in a formal object language. Further, many of the developers
 favor straight C; it works for them. For more arguments on this matter,
 read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}).
@@ -422,7 +419,7 @@ read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}).
 
 The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug
 information. Those binaries are stripped to create ffmpeg, ffplay, etc. If
-you need the debug information, used the *_g versions.
+you need the debug information, use the *_g versions.
 
 @section I do not like the LGPL, can I contribute code under the GPL instead?
 
@@ -440,16 +437,16 @@ the compilation failure then you are probably not qualified for this.
 
 @section I'm using libavcodec from within my C++ application but the linker complains about missing symbols which seem to be available.
 
-FFmpeg is a pure C project, so to use the libraries within your C++ application
+Libav is a pure C project, so to use the libraries within your C++ application
 you need to explicitly state that you are using a C library. You can do this by
-encompassing your FFmpeg includes using @code{extern "C"}.
+encompassing your Libav includes using @code{extern "C"}.
 
 See @url{http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3}
 
 @section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat?
 
 You have to implement a URLProtocol, see @file{libavformat/file.c} in
-FFmpeg and @file{libmpdemux/demux_lavf.c} in MPlayer sources.
+Libav and @file{libmpdemux/demux_lavf.c} in MPlayer sources.
 
 @section I get "No compatible shell script interpreter found." in MSys.
 
diff --git a/ffmpeg-mt/doc/fate.txt b/ffmpeg-mt/doc/fate.txt
new file mode 100644
index 0000000..f5f3759
--- /dev/null
+++ b/ffmpeg-mt/doc/fate.txt
@@ -0,0 +1,45 @@
+FATE Automated Testing Environment
+
+FATE provides a regression testsuite that can be run locally or configured
+to send reports to fate.libav.org.
+In order to run, it needs a large amount of data (samples and references)
+that is provided separately from the actual source distribution.
+
+Use the following command to get the fate test samples
+
+# rsync -aL rsync://samples.libav.org:/samples/fate-suite/ fate-suite
+
+To inform the build system about the testsuite location, pass
+`--samples=<path to the samples>` to configure or set the SAMPLES Make
+variable or the FATE_SAMPLES environment variable to a suitable value.
+
+For information on how to set up FATE to send results to the official Libav
+testing framework, please refer to the following wiki page:
+http://wiki.multimedia.cx/index.php?title=FATE
+
+FATE Makefile targets:
+
+fate-list
+    Will list all fate/regression test targets.
+
+fate
+    Run the FATE test suite (requires the fate-suite dataset).
+
+Fate Makefile variables:
+
+V
+    Verbosity level, can be set to 0, 1 or 2.
+    * 0: show just the test arguments
+    * 1: show just the command used in the test
+    * 2: show everything
+
+SAMPLES
+    Specify or override the path to the FATE samples at make time, it has a
+    meaning only while running the regression tests.
+
+THREADS
+    Specify how many threads to use while running regression tests, it is
+    quite useful to detect thread-related regressions.
+
+Example:
+    make V=1 SAMPLES=/var/fate/samples THREADS=2 fate
diff --git a/ffmpeg-mt/doc/ffmpeg.texi b/ffmpeg-mt/doc/ffmpeg.texi
index c2fff7c..21c6f2c 100644
--- a/ffmpeg-mt/doc/ffmpeg.texi
+++ b/ffmpeg-mt/doc/ffmpeg.texi
@@ -2,11 +2,13 @@
 
 @settitle FFmpeg Documentation
 @titlepage
- at sp 7
 @center @titlefont{FFmpeg Documentation}
- at sp 3
 @end titlepage
 
+ at top
+
+ at contents
+
 @chapter Synopsis
 
 The generic syntax is:
@@ -584,6 +586,28 @@ Set the ISO 639 language code (3 letters) of the current audio stream.
 @table @option
 @item -atag @var{fourcc/tag}
 Force audio tag/fourcc.
+ at item -audio_service_type @var{type}
+Set the type of service that the audio stream contains.
+ at table @option
+ at item ma
+Main Audio Service (default)
+ at item ef
+Effects
+ at item vi
+Visually Impaired
+ at item hi
+Hearing Impaired
+ at item di
+Dialogue
+ at item co
+Commentary
+ at item em
+Emergency
+ at item vo
+Voice Over
+ at item ka
+Karaoke
+ at end table
 @item -absf @var{bitstream_filter}
 Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
 @end table
@@ -620,13 +644,48 @@ Synchronize read on input.
 @section Advanced options
 
 @table @option
- at item -map @var{input_stream_id}[:@var{sync_stream_id}]
-Set stream mapping from input streams to output streams.
-Just enumerate the input streams in the order you want them in the output.
- at var{sync_stream_id} if specified sets the input stream to sync
-against.
+ at item -map @var{input_file_id}. at var{input_stream_id}[:@var{sync_file_id}. at var{sync_stream_id}]
+
+Designate an input stream as a source for the output file. Each input
+stream is identified by the input file index @var{input_file_id} and
+the input stream index @var{input_stream_id} within the input
+file. Both indexes start at 0. If specified,
+ at var{sync_file_id}. at var{sync_stream_id} sets which input stream
+is used as a presentation sync reference.
+
+The @code{-map} options must be specified just after the output file.
+If any @code{-map} options are used, the number of @code{-map} options
+on the command line must match the number of streams in the output
+file. The first @code{-map} option on the command line specifies the
+source for output stream 0, the second @code{-map} option specifies
+the source for output stream 1, etc.
+
+For example, if you have two audio streams in the first input file,
+these streams are identified by "0.0" and "0.1". You can use
+ at code{-map} to select which stream to place in an output file. For
+example:
+ at example
+ffmpeg -i INPUT out.wav -map 0.1
+ at end example
+will map the input stream in @file{INPUT} identified by "0.1" to
+the (single) output stream in @file{out.wav}.
+
+For example, to select the stream with index 2 from input file
+ at file{a.mov} (specified by the identifier "0.2"), and stream with
+index 6 from input @file{b.mov} (specified by the identifier "1.6"),
+and copy them to the output file @file{out.mov}:
+ at example
+ffmpeg -i a.mov -i b.mov -vcodec copy -acodec copy out.mov -map 0.2 -map 1.6
+ at end example
+
+To add more streams to the output file, you can use the
+ at code{-newaudio}, @code{-newvideo}, @code{-newsubtitle} options.
+
 @item -map_meta_data @var{outfile}[, at var{metadata}]:@var{infile}[, at var{metadata}]
-Set meta data information of @var{outfile} from @var{infile}. Note that those
+Deprecated, use @var{-map_metadata} instead.
+
+ at item -map_metadata @var{outfile}[, at var{metadata}]:@var{infile}[, at var{metadata}]
+Set metadata information of @var{outfile} from @var{infile}. Note that those
 are file indices (zero-based), not filenames.
 Optional @var{metadata} parameters specify, which metadata to copy - (g)lobal
 (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
@@ -642,7 +701,7 @@ file index can be used to create a dummy mapping that just disables automatic co
 For example to copy metadata from the first stream of the input file to global metadata
 of the output file:
 @example
-ffmpeg -i in.ogg -map_meta_data 0:0,s0 out.mp3
+ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3
 @end example
 @item -map_chapters @var{outfile}:@var{infile}
 Copy chapters from @var{infile} to @var{outfile}. If no chapter mapping is specified,
@@ -712,8 +771,10 @@ Set the maximum demux-decode delay.
 @item -muxpreload @var{seconds}
 Set the initial demux-decode delay.
 @item -streamid @var{output-stream-index}:@var{new-value}
-Assign a new value to a stream's stream-id field in the next output file.
-All stream-id fields are reset to default for each output file.
+Assign a new stream-id value to an output stream. This option should be
+specified prior to the output filename to which it applies.
+For the situation where multiple output files exist, a streamid
+may be reassigned to a different value.
 
 For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
 an output mpegts file:
@@ -728,7 +789,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs,
 one for each line, specifying a sequence of options which would be
 awkward to specify on the command line. Lines starting with the hash
 ('#') character are ignored and are used to provide comments. Check
-the @file{ffpresets} directory in the FFmpeg source tree for examples.
+the @file{ffpresets} directory in the Libav source tree for examples.
 
 Preset files are specified with the @code{vpre}, @code{apre},
 @code{spre}, and @code{fpre} options. The @code{fpre} option takes the
@@ -974,7 +1035,9 @@ file to which you want to add them.
 @c man end EXAMPLES
 
 @include eval.texi
+ at include encoders.texi
 @include demuxers.texi
+ at include muxers.texi
 @include indevs.texi
 @include outdevs.texi
 @include protocols.texi
@@ -988,11 +1051,11 @@ file to which you want to add them.
 @settitle FFmpeg video converter
 
 @c man begin SEEALSO
-ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation
+ffplay(1), ffprobe(1), ffserver(1) and the Libav HTML documentation
 @c man end
 
 @c man begin AUTHORS
-The FFmpeg developers
+The Libav developers
 @c man end
 
 @end ignore
diff --git a/ffmpeg-mt/doc/ffplay.texi b/ffmpeg-mt/doc/ffplay.texi
index c9c38da..6199e6d 100644
--- a/ffmpeg-mt/doc/ffplay.texi
+++ b/ffmpeg-mt/doc/ffplay.texi
@@ -2,11 +2,13 @@
 
 @settitle FFplay Documentation
 @titlepage
- at sp 7
 @center @titlefont{FFplay Documentation}
- at sp 3
 @end titlepage
 
+ at top
+
+ at contents
+
 @chapter Synopsis
 
 @example
@@ -18,9 +20,9 @@ ffplay [options] @file{input_file}
 @chapter Description
 @c man begin DESCRIPTION
 
-FFplay is a very simple and portable media player using the FFmpeg
+FFplay is a very simple and portable media player using the Libav
 libraries and the SDL library. It is mostly used as a testbed for the
-various FFmpeg APIs.
+various Libav APIs.
 @c man end
 
 @chapter Options
@@ -155,6 +157,7 @@ Seek to percentage in file corresponding to fraction of width.
 
 @include eval.texi
 @include demuxers.texi
+ at include muxers.texi
 @include indevs.texi
 @include outdevs.texi
 @include protocols.texi
@@ -166,11 +169,11 @@ Seek to percentage in file corresponding to fraction of width.
 @settitle FFplay media player
 
 @c man begin SEEALSO
-ffmpeg(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation
+ffmpeg(1), ffprobe(1), ffserver(1) and the Libav HTML documentation
 @c man end
 
 @c man begin AUTHORS
-The FFmpeg developers
+The Libav developers
 @c man end
 
 @end ignore
diff --git a/ffmpeg-mt/doc/ffprobe.texi b/ffmpeg-mt/doc/ffprobe.texi
index 8f3a5a9..b775f55 100644
--- a/ffmpeg-mt/doc/ffprobe.texi
+++ b/ffmpeg-mt/doc/ffprobe.texi
@@ -2,11 +2,13 @@
 
 @settitle FFprobe Documentation
 @titlepage
- at sp 7
 @center @titlefont{FFprobe Documentation}
- at sp 3
 @end titlepage
 
+ at top
+
+ at contents
+
 @chapter Synopsis
 
 The generic syntax is:
@@ -110,6 +112,7 @@ with name "STREAM".
 @c man end
 
 @include demuxers.texi
+ at include muxers.texi
 @include protocols.texi
 @include indevs.texi
 
@@ -119,11 +122,11 @@ with name "STREAM".
 @settitle FFprobe media prober
 
 @c man begin SEEALSO
-ffmpeg(1), ffplay(1), ffserver(1) and the FFmpeg HTML documentation
+ffmpeg(1), ffplay(1), ffserver(1) and the Libav HTML documentation
 @c man end
 
 @c man begin AUTHORS
-The FFmpeg developers
+The Libav developers
 @c man end
 
 @end ignore
diff --git a/ffmpeg-mt/doc/ffserver.conf b/ffmpeg-mt/doc/ffserver.conf
index 2171170..62728b0 100644
--- a/ffmpeg-mt/doc/ffserver.conf
+++ b/ffmpeg-mt/doc/ffserver.conf
@@ -371,7 +371,7 @@ ACL allow 192.168.0.0 192.168.255.255
 # Redirect index.html to the appropriate site
 
 <Redirect index.html>
-URL http://www.ffmpeg.org/
+URL http://www.libav.org/
 </Redirect>
 
 
diff --git a/ffmpeg-mt/doc/ffserver.texi b/ffmpeg-mt/doc/ffserver.texi
index 77deb85..021b237 100644
--- a/ffmpeg-mt/doc/ffserver.texi
+++ b/ffmpeg-mt/doc/ffserver.texi
@@ -2,11 +2,13 @@
 
 @settitle FFserver Documentation
 @titlepage
- at sp 7
 @center @titlefont{FFserver Documentation}
- at sp 3
 @end titlepage
 
+ at top
+
+ at contents
+
 @chapter Synopsys
 
 The generic syntax is:
@@ -264,11 +266,11 @@ rather than as a daemon.
 @c man begin SEEALSO
 
 ffmpeg(1), ffplay(1), ffprobe(1), the @file{ffmpeg/doc/ffserver.conf}
-example and the FFmpeg HTML documentation
+example and the Libav HTML documentation
 @c man end
 
 @c man begin AUTHORS
-The FFmpeg developers
+The Libav developers
 @c man end
 
 @end ignore
diff --git a/ffmpeg-mt/doc/fftools-common-opts.texi b/ffmpeg-mt/doc/fftools-common-opts.texi
index d72ca5c..3a1cb3b 100644
--- a/ffmpeg-mt/doc/fftools-common-opts.texi
+++ b/ffmpeg-mt/doc/fftools-common-opts.texi
@@ -88,6 +88,6 @@ can be disabled setting the environment variable
 @env{FFMPEG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting
 the environment variable @env{FFMPEG_FORCE_COLOR}.
 The use of the environment variable @env{NO_COLOR} is deprecated and
-will be dropped in a following FFmpeg version.
+will be dropped in a following Libav version.
 
 @end table
diff --git a/ffmpeg-mt/doc/filters.texi b/ffmpeg-mt/doc/filters.texi
index 3842886..872afc6 100644
--- a/ffmpeg-mt/doc/filters.texi
+++ b/ffmpeg-mt/doc/filters.texi
@@ -92,7 +92,7 @@ Follows a BNF description for the filtergraph syntax:
 @chapter Audio Filters
 @c man begin AUDIO FILTERS
 
-When you configure your FFmpeg build, you can disable any of the
+When you configure your Libav build, you can disable any of the
 existing filters using --disable-filters.
 The configure output will show the audio filters included in your
 build.
@@ -155,7 +155,7 @@ tools.
 @chapter Video Filters
 @c man begin VIDEO FILTERS
 
-When you configure your FFmpeg build, you can disable any of the
+When you configure your Libav build, you can disable any of the
 existing filters using --disable-filters.
 The configure output will show the video filters included in your
 build.
@@ -353,6 +353,39 @@ drawbox
 drawbox=10:20:200:60:red@@0.5"
 @end example
 
+ at section fade
+
+Apply fade-in/out effect to input video.
+
+It accepts the parameters:
+ at var{type}:@var{start_frame}:@var{nb_frames}
+
+ at var{type} specifies if the effect type, can be either "in" for
+fade-in, or "out" for a fade-out effect.
+
+ at var{start_frame} specifies the number of the start frame for starting
+to apply the fade effect.
+
+ at var{nb_frames} specifies the number of frames for which the fade
+effect has to last. At the end of the fade-in effect the output video
+will have the same intensity as the input video, at the end of the
+fade-out transition the output video will be completely black.
+
+A few usage examples follow, usable too as test scenarios.
+ at example
+# fade in first 30 frames of video
+fade=in:0:30
+
+# fade out last 45 frames of a 200-frame video
+fade=out:155:45
+
+# fade in first 25 frames and fade out last 25 frames of a 1000-frame video
+fade=in:0:25, fade=out:975:25
+
+# make first 5 frames black, then fade in from frame 5-24
+fade=in:5:20
+ at end example
+
 @section fifo
 
 Buffer input images and send them when they are requested.
@@ -386,7 +419,7 @@ format=yuv420p:yuv444p:yuv410p
 Apply a frei0r effect to the input video.
 
 To enable compilation of this filter you need to install the frei0r
-header and configure FFmpeg with --enable-frei0r.
+header and configure Libav with --enable-frei0r.
 
 The filter supports the syntax:
 @example
@@ -524,7 +557,7 @@ Pass the video source unchanged to the output.
 Apply video transform using libopencv.
 
 To enable this filter install libopencv library and headers and
-configure FFmpeg with --enable-libopencv.
+configure Libav with --enable-libopencv.
 
 The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
 
@@ -657,13 +690,13 @@ Follow some examples:
 overlay=main_w-overlay_w-10:main_h-overlay_h-10
 
 # insert a transparent PNG logo in the bottom left corner of the input
-movie=0:png:logo.png [logo];
+movie=logo.png [logo];
 [in][logo] overlay=10:main_h-overlay_h-10 [out]
 
 # insert 2 different transparent PNG logos (second logo on bottom
 # right corner):
-movie=0:png:logo1.png [logo1];
-movie=0:png:logo2.png [logo2];
+movie=logo1.png [logo1];
+movie=logo2.png [logo2];
 [in][logo1]       overlay=10:H-h-10 [in+logo1];
 [in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
 
@@ -1088,6 +1121,61 @@ to the pad with identifier "in".
 "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]"
 @end example
 
+ at section movie
+
+Read a video stream from a movie container.
+
+It accepts the syntax: @var{movie_name}[:@var{options}] where
+ at var{movie_name} is the name of the resource to read (not necessarily
+a file but also a device or a stream accessed through some protocol),
+and @var{options} is an optional sequence of @var{key}=@var{value}
+pairs, separated by ":".
+
+The description of the accepted options follows.
+
+ at table @option
+
+ at item format_name, f
+Specifies the format assumed for the movie to read, and can be either
+the name of a container or an input device. If not specified the
+format is guessed from @var{movie_name} or by probing.
+
+ at item seek_point, sp
+Specifies the seek point in seconds, the frames will be output
+starting from this seek point, the parameter is evaluated with
+ at code{av_strtod} so the numerical value may be suffixed by an IS
+postfix. Default value is "0".
+
+ at item stream_index, si
+Specifies the index of the video stream to read. If the value is -1,
+the best suited video stream will be automatically selected. Default
+value is "-1".
+
+ at end table
+
+This filter allows to overlay a second video on top of main input of
+a filtergraph as shown in this graph:
+ at example
+input -----------> deltapts0 --> overlay --> output
+                                    ^
+                                    |
+movie --> scale--> deltapts1 -------+
+ at end example
+
+Some examples follow:
+ at example
+# skip 3.2 seconds from the start of the avi file in.avi, and overlay it
+# on top of the input labelled as "in".
+movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+# read from a video4linux2 device, and overlay it on top of the input
+# labelled as "in"
+movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
+[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
+
+ at end example
+
 @section nullsrc
 
 Null video source, never return images. It is mainly useful as a
@@ -1109,7 +1197,7 @@ timebase. The expression can contain the constants "PI", "E", "PHI",
 Provide a frei0r source.
 
 To enable compilation of this filter you need to install the frei0r
-header and configure FFmpeg with --enable-frei0r.
+header and configure Libav with --enable-frei0r.
 
 The source supports the syntax:
 @example
diff --git a/ffmpeg-mt/doc/general.texi b/ffmpeg-mt/doc/general.texi
index cbdc679..5d66e42 100644
--- a/ffmpeg-mt/doc/general.texi
+++ b/ffmpeg-mt/doc/general.texi
@@ -2,21 +2,22 @@
 
 @settitle General Documentation
 @titlepage
- at sp 7
 @center @titlefont{General Documentation}
- at sp 3
 @end titlepage
 
+ at top
+
+ at contents
 
 @chapter external libraries
 
-FFmpeg can be hooked up with a number of external libraries to add support
+Libav can be hooked up with a number of external libraries to add support
 for more formats. None of them are used by default, their use has to be
 explicitly requested by passing the appropriate flags to @file{./configure}.
 
 @section OpenCORE AMR
 
-FFmpeg can make use of the OpenCORE libraries for AMR-NB
+Libav can make use of the OpenCORE libraries for AMR-NB
 decoding/encoding and AMR-WB decoding.
 
 Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the instructions for
@@ -26,7 +27,7 @@ installing the libraries. Then pass @code{--enable-libopencore-amrnb} and/or
 Note that OpenCORE is under the Apache License 2.0 (see
 @url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is
 incompatible with the LGPL version 2.1 and GPL version 2. You have to
-upgrade FFmpeg's license to LGPL version 3 (or if you have enabled
+upgrade Libav's license to LGPL version 3 (or if you have enabled
 GPL components, GPL version 3) to use it.
 
 
@@ -36,7 +37,7 @@ You can use the @code{-formats} and @code{-codecs} options to have an exhaustive
 
 @section File Formats
 
-FFmpeg supports the following file formats through the @code{libavformat}
+Libav supports the following file formats through the @code{libavformat}
 library:
 
 @multitable @columnfractions .4 .1 .1 .4
@@ -61,6 +62,8 @@ library:
     @tab Used in some games from Bethesda Softworks.
 @item Bink                      @tab   @tab X
     @tab Multimedia format used by many games.
+ at item Bitmap Brothers JV        @tab   @tab X
+    @tab Used in Z and Z95 games.
 @item Brute Force & Ignorance   @tab   @tab X
     @tab Used in the game Flash Traffic: City of Angels.
 @item Interplay C93             @tab   @tab X
@@ -78,6 +81,8 @@ library:
     @tab Audio format used in some games by CRYO Interactive Entertainment.
 @item D-Cinema audio            @tab X @tab X
 @item Deluxe Paint Animation    @tab   @tab X
+ at item DFA                       @tab   @tab X
+    @tab This format is used in Chronomaster game
 @item DV video                  @tab X @tab X
 @item DXA                       @tab   @tab X
     @tab This format is used in the non-Windows version of the Feeble Files
@@ -110,7 +115,7 @@ library:
     @tab Format used in various Interplay computer games.
 @item IV8                       @tab   @tab X
     @tab A format generated by IndigoVision 8000 video server.
- at item IVF (On2)                 @tab   @tab X
+ at item IVF (On2)                 @tab X @tab X
     @tab A format used by libvpx
 @item LMLM4                     @tab   @tab X
     @tab Used by Linux Media Labs MPEG-4 PCI boards
@@ -351,7 +356,7 @@ following image formats are supported:
 @item Bethesda VID video     @tab     @tab  X
     @tab Used in some games from Bethesda Softworks.
 @item Bink Video             @tab     @tab  X
-    @tab Support for version 'b' is missing.
+ at item Bitmap Brothers JV video  @tab   @tab X
 @item Brute Force & Ignorance   @tab   @tab X
     @tab Used in the game Flash Traffic: City of Angels.
 @item C93 video              @tab     @tab  X
@@ -368,6 +373,8 @@ following image formats are supported:
 @item Cirrus Logic AccuPak   @tab     @tab  X
     @tab fourcc: CLJR
 @item Creative YUV (CYUV)    @tab     @tab  X
+ at item DFA                    @tab     @tab  X
+    @tab Codec used in Chronomaster game.
 @item Dirac                  @tab  E  @tab  E
     @tab supported through external libdirac/libschroedinger libraries
 @item Deluxe Paint Animation @tab     @tab  X
@@ -436,6 +443,7 @@ following image formats are supported:
 @item Miro VideoXL           @tab     @tab  X
     @tab fourcc: VIXL
 @item MJPEG (Motion JPEG)    @tab  X  @tab  X
+ at item Mobotix MxPEG video    @tab     @tab  X
 @item Motion Pixels video    @tab     @tab  X
 @item MPEG-1 video           @tab  X  @tab  X
 @item MPEG-1/2 video XvMC (X-Video Motion Compensation)  @tab     @tab  X
@@ -510,6 +518,8 @@ following image formats are supported:
     @tab not completely working
 @item Wing Commander III / Xan  @tab     @tab  X
     @tab Used in Wing Commander III .MVE files.
+ at item Wing Commander IV / Xan  @tab     @tab  X
+    @tab Used in Wing Commander IV.
 @item Winnov WNV1            @tab     @tab  X
 @item WMV7                   @tab  X  @tab  X
 @item YAMAHA SMAF            @tab  X  @tab  X
@@ -660,10 +670,6 @@ following image formats are supported:
 @item Sierra VMD audio       @tab     @tab  X
     @tab Used in Sierra VMD files.
 @item Smacker audio          @tab     @tab  X
- at item Sonic                  @tab  X  @tab  X
-    @tab experimental codec
- at item Sonic lossless         @tab  X  @tab  X
-    @tab experimental codec
 @item Speex                  @tab     @tab  E
     @tab supported through external library libspeex
 @item True Audio (TTA)       @tab     @tab  X
@@ -705,6 +711,7 @@ performance on systems without hardware floating point support).
 
 @multitable @columnfractions .4 .1
 @item Name         @tab Support
+ at item Apple HTTP Live Streaming @tab X
 @item file         @tab X
 @item Gopher       @tab X
 @item HTTP         @tab X
@@ -745,18 +752,18 @@ Using a cross-compiler is preferred for various reasons.
 
 @subsection DJGPP
 
-FFmpeg cannot be compiled because of broken system headers, add
+Libav cannot be compiled because of broken system headers, add
 @code{--extra-cflags=-U__STRICT_ANSI__} to the configure options as a
 workaround.
 
 @section OS/2
 
-For information about compiling FFmpeg on OS/2 see
+For information about compiling Libav on OS/2 see
 @url{http://www.edm2.com/index.php/FFmpeg}.
 
 @section Unix-like
 
-Some parts of FFmpeg cannot be built with version 2.15 of the GNU
+Some parts of Libav cannot be built with version 2.15 of the GNU
 assembler which is still provided by a few AMD64 distributions. To
 make sure your compiler really uses the required version of gas
 after a binutils upgrade, run:
@@ -771,7 +778,7 @@ to configure.
 
 @subsection BSD
 
-BSD make will not build FFmpeg, you need to install and use GNU Make
+BSD make will not build Libav, you need to install and use GNU Make
 (@file{gmake}).
 
 @subsubsection FreeBSD
@@ -784,7 +791,7 @@ getting the system headers fixed.
 
 @subsection (Open)Solaris
 
-GNU Make is required to build FFmpeg, so you have to invoke (@file{gmake}),
+GNU Make is required to build Libav, so you have to invoke (@file{gmake}),
 standard Solaris Make will not work. When building with a non-c99 front-end
 (gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o}
 or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options
@@ -802,22 +809,18 @@ bash ./configure
 MacOS X on PowerPC or ARM (iPhone) requires a preprocessor from
 @url{http://github.com/yuvi/gas-preprocessor} to build the optimized
 assembler functions. Just download the Perl script and put it somewhere
-in your PATH, FFmpeg's configure will pick it up automatically.
+in your PATH, Libav's configure will pick it up automatically.
 
 @section Windows
 
-To get help and instructions for building FFmpeg under Windows, check out
-the FFmpeg Windows Help Forum at
- at url{http://ffmpeg.arrozcru.org/}.
-
 @subsection Native Windows compilation
 
-FFmpeg can be built to run natively on Windows using the MinGW tools. Install
+Libav can be built to run natively on Windows using the MinGW tools. Install
 the latest versions of MSYS and MinGW from @url{http://www.mingw.org/}.
 You can find detailed installation
 instructions in the download section and the FAQ.
 
-FFmpeg does not build out-of-the-box with the packages the automated MinGW
+Libav does not build out-of-the-box with the packages the automated MinGW
 installer provides. It also requires coreutils to be installed and many other
 packages updated to the latest version. The minimum version for some packages
 are listed below:
@@ -829,7 +832,7 @@ are listed below:
 @item mingw-runtime 3.15
 @end itemize
 
-FFmpeg automatically passes @code{-fno-common} to the compiler to work around
+Libav automatically passes @code{-fno-common} to the compiler to work around
 a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}).
 
 Within the MSYS shell, configure and make with:
@@ -860,14 +863,14 @@ Edit the @file{bin/sdl-config} script so that it points to the correct prefix
 where SDL was installed. Verify that @file{sdl-config} can be launched from
 the MSYS command line.
 
- at item By using @code{./configure --enable-shared} when configuring FFmpeg,
+ at item By using @code{./configure --enable-shared} when configuring Libav,
 you can build libavutil, libavcodec and libavformat as DLLs.
 
 @end itemize
 
 @subsection Microsoft Visual C++ compatibility
 
-As stated in the FAQ, FFmpeg will not compile under MSVC++. However, if you
+As stated in the FAQ, Libav will not compile under MSVC++. However, if you
 want to use the libav* libraries in your own applications, you can still
 compile those applications using MSVC++. But the libav* libraries you link
 to @emph{must} be built with MinGW. However, you will not be able to debug
@@ -875,13 +878,13 @@ inside the libav* libraries, since MSVC++ does not recognize the debug
 symbols generated by GCC.
 We strongly recommend you to move over from MSVC++ to MinGW tools.
 
-This description of how to use the FFmpeg libraries with MSVC++ is based on
+This description of how to use the Libav libraries with MSVC++ is based on
 Microsoft Visual C++ 2005 Express Edition. If you have a different version,
 you might have to modify the procedures slightly.
 
 @subsubsection Using static libraries
 
-Assuming you have just built and installed FFmpeg in @file{/usr/local}.
+Assuming you have just built and installed Libav in @file{/usr/local}.
 
 @enumerate
 
@@ -892,13 +895,13 @@ Application Wizard, uncheck the "Precompiled headers" option.
 @item Write the source code for your application, or, for testing, just
 copy the code from an existing sample application into the source file
 that MSVC++ has already created for you. For example, you can copy
- at file{libavformat/output-example.c} from the FFmpeg distribution.
+ at file{libavformat/output-example.c} from the Libav distribution.
 
 @item Open the "Project / Properties" dialog box. In the "Configuration"
 combo box, select "All Configurations" so that the changes you make will
 affect both debug and release builds. In the tree view on the left hand
 side, select "C/C++ / General", then edit the "Additional Include
-Directories" setting to contain the path where the FFmpeg includes were
+Directories" setting to contain the path where the Libav includes were
 installed (i.e. @file{c:\msys\1.0\local\include}).
 Do not add MinGW's include directory here, or the include files will
 conflict with MSVC's.
@@ -906,7 +909,7 @@ conflict with MSVC's.
 @item Still in the "Project / Properties" dialog box, select
 "Linker / General" from the tree view and edit the
 "Additional Library Directories" setting to contain the @file{lib}
-directory where FFmpeg was installed (i.e. @file{c:\msys\1.0\local\lib}),
+directory where Libav was installed (i.e. @file{c:\msys\1.0\local\lib}),
 the directory where MinGW libs are installed (i.e. @file{c:\mingw\lib}),
 and the directory where MinGW's GCC libs are installed
 (i.e. @file{C:\mingw\lib\gcc\mingw32\4.2.1-sjlj}). Then select
@@ -923,13 +926,13 @@ set to "Multi-threaded DLL".
 
 @item Click "OK" to close the "Project / Properties" dialog box.
 
- at item MSVC++ lacks some C99 header files that are fundamental for FFmpeg.
+ at item MSVC++ lacks some C99 header files that are fundamental for Libav.
 Get msinttypes from @url{http://code.google.com/p/msinttypes/downloads/list}
 and install it in MSVC++'s include directory
 (i.e. @file{C:\Program Files\Microsoft Visual Studio 8\VC\include}).
 
 @item MSVC++ also does not understand the @code{inline} keyword used by
-FFmpeg, so you must add this line before @code{#include}ing libav*:
+Libav, so you must add this line before @code{#include}ing libav*:
 @example
 #define inline _inline
 @end example
@@ -962,10 +965,10 @@ and run @file{c:\msys\1.0\msys.bat} from there.
 @item Within the MSYS shell, run @code{lib.exe}. If you get a help message
 from @file{Microsoft (R) Library Manager}, this means your environment
 variables are set up correctly, the @file{Microsoft (R) Library Manager}
-is on the path and will be used by FFmpeg to create
+is on the path and will be used by Libav to create
 MSVC++-compatible import libraries.
 
- at item Build FFmpeg with
+ at item Build Libav with
 
 @example
 ./configure --enable-shared --enable-memalign-hack
@@ -984,7 +987,7 @@ you should only need to add the directory where the LIB files are installed
 (i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are
 installed in the @file{bin} directory. And instead of adding the static
 libraries (@file{libxxx.a} files) you should add the MSVC import libraries
-(@file{avcodec.lib}, @file{avformat.lib}, @file{avcore.lib}, and
+(@file{avcodec.lib}, @file{avformat.lib}, and
 @file{avutil.lib}). Note that you should not use the GCC import
 libraries (@file{libxxx.dll.a} files), as these will give you undefined
 reference errors. There should be no need for @file{libmingwex.a},
@@ -994,7 +997,7 @@ of DLL files, but the ones that are actually used to run your application
 are the ones with a major version number in their filenames
 (i.e. @file{avcodec-51.dll}).
 
-FFmpeg headers do not declare global data for Windows DLLs through the usual
+Libav headers do not declare global data for Windows DLLs through the usual
 dllexport/dllimport interface. Such data will be exported properly while
 building, but to use them in your MSVC++ code you will have to edit the
 appropriate headers and mark the data as dllimport. For example, in
@@ -1003,19 +1006,25 @@ libavutil/pixdesc.h you should have:
 extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[];
 @end example
 
+Note that using import libraries created by dlltool requires
+the linker optimization option to be set to
+"References: Keep Unreferenced Data (/OPT:NOREF)", otherwise
+the resulting binaries will fail during runtime. This isn't
+required when using import libraries generated by lib.exe.
+
 @subsection Cross compilation for Windows with Linux
 
 You must use the MinGW cross compilation tools available at
 @url{http://www.mingw.org/}.
 
-Then configure FFmpeg with the following options:
+Then configure Libav with the following options:
 @example
 ./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-
 @end example
 (you can change the cross-prefix according to the prefix chosen for the
 MinGW tools).
 
-Then you can easily test FFmpeg with Wine
+Then you can easily test Libav with Wine
 (@url{http://www.winehq.com/}).
 
 @subsection Compilation under Cygwin
@@ -1026,7 +1035,7 @@ llrint() in its C library.
 Install your Cygwin with all the "Base" packages, plus the
 following "Devel" ones:
 @example
-binutils, gcc4-core, make, subversion, mingw-runtime, texi2html
+binutils, gcc4-core, make, git, mingw-runtime, texi2html
 @end example
 
 And the following "Utils" one:
@@ -1049,7 +1058,7 @@ shared libraries:
 ./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions
 @end example
 
-If you want to build FFmpeg with additional libraries, download Cygwin
+If you want to build Libav with additional libraries, download Cygwin
 "Devel" packages for Ogg and Vorbis from any Cygwin packages repository:
 @example
 libogg-devel, libvorbis-devel
diff --git a/ffmpeg-mt/doc/git-howto.txt b/ffmpeg-mt/doc/git-howto.txt
index 0b847ee..3ac21c8 100644
--- a/ffmpeg-mt/doc/git-howto.txt
+++ b/ffmpeg-mt/doc/git-howto.txt
@@ -28,9 +28,9 @@ Consult these resources whenever you have problems, they are quite exhaustive.
 You do not need a special username or password.
 All you need is to provide a ssh public key to the Git server admin.
 
-What follows now is a basic introduction to Git and some FFmpeg-specific
+What follows now is a basic introduction to Git and some Libav-specific
 guidelines. Read it at least once, if you are granted commit privileges to the
-FFmpeg project you are expected to be familiar with these rules.
+Libav project you are expected to be familiar with these rules.
 
 
 
@@ -44,29 +44,35 @@ I. BASICS:
 
 1. Cloning the source tree:
 
-    git clone git://git.videolan.org/ffmpeg <target>
+    git clone git://git.libav.org/libav.git <target>
 
-  This will put the FFmpeg sources into the directory <target>.
+  This will put the Libav sources into the directory <target>.
 
-    git clone git at git.videolan.org:ffmpeg <target>
+    git clone git at git.libav.org:libav.git <target>
 
-  This will put the FFmpeg sources into the directory <target> and let
+  This will put the Libav sources into the directory <target> and let
   you push back your changes to the remote repository.
 
 
 2. Updating the source tree to the latest revision:
 
-    git pull
+    git pull (--ff-only)
 
-  pulls in the latest changes from the repository to your local master branch.
+  pulls in the latest changes from the tracked branch. The tracked branch
+  can be remote. By default the master branch tracks the branch master in
+  the remote origin.
+  Caveat: Since merge commits are forbidden at least for the initial
+          months of git --ff-only or --rebase (see below) are recommended.
+          --ff-only will fail and not create merge commits if your branch
+          has diverged (has a different history) from the tracked branch.
 
 2.a Rebasing your local branches:
 
     git pull --rebase
 
   fetches the changes from the main repository and replays your local commits
-  over it. This is useful to keep all your local changes at the top of your
-  tree.
+  over it. This is required to keep all your local changes at the top of
+  Libav's master tree. The master tree will reject pushes with merge commits.
 
 
 3. Adding/removing files/directories:
@@ -91,7 +97,7 @@ I. BASICS:
     git log <filename(s)>
 
   You may also use the graphical tools like gitview or gitk or the web
-  interface available at http://git.videolan.org
+  interface available at http://git.libav.org/
 
 6. Checking source tree status:
 
@@ -124,6 +130,11 @@ I. BASICS:
 
     git add [-i|-p|-A] <filenames/dirnames>
 
+  Make sure you have told git your name and email address, e.g. by running
+    git config --global user.name "My Name"
+    git config --global user.email my at email.invalid
+  (--global to set the global configuration for all your git checkouts).
+
   Git will select the changes to the files for commit. Optionally you can use
   the interactive or the patch mode to select hunk by hunk what should be
   added to the commit.
@@ -233,6 +244,16 @@ I. BASICS:
   will show the svn changeset r23456. With older git versions searching in
   the git log output is the easiest option (especially if a pager with
   search capabilities is used).
+  This commit can be checked out with
+
+    git checkout -b svn_23456 :/'as revision 23456'
+
+  or for git < 1.7.1 with
+
+    git checkout -b svn_23456 $SHA1
+
+  where $SHA1 is the commit SHA1 from the 'git log' output.
+
 
-Contact the project admins <root at ffmpeg dot org> if you have technical
+Contact the project admins <git at libav dot org> if you have technical
 problems with the GIT server.
diff --git a/ffmpeg-mt/doc/indevs.texi b/ffmpeg-mt/doc/indevs.texi
index 8e862ff..c5e04b0 100644
--- a/ffmpeg-mt/doc/indevs.texi
+++ b/ffmpeg-mt/doc/indevs.texi
@@ -1,10 +1,10 @@
 @chapter Input Devices
 @c man begin INPUT DEVICES
 
-Input devices are configured elements in FFmpeg which allow to access
+Input devices are configured elements in Libav which allow to access
 the data coming from a multimedia device attached to your system.
 
-When you configure your FFmpeg build, all the supported input devices
+When you configure your Libav build, all the supported input devices
 are enabled by default. You can list all available ones using the
 configure option "--list-indevs".
 
@@ -59,6 +59,31 @@ BSD video input device.
 
 Linux DV 1394 input device.
 
+ at section fbdev
+
+Linux framebuffer input device.
+
+The Linux framebuffer is a graphic hardware-independent abstraction
+layer to show graphics on a computer monitor, typically on the
+console. It is accessed through a file device node, usually
+ at file{/dev/fb0}.
+
+For more detailed information read the file
+Documentation/fb/framebuffer.txt included in the Linux source tree.
+
+To record from the framebuffer device @file{/dev/fb0} with
+ at file{ffmpeg}:
+ at example
+ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
+ at end example
+
+You can take a single screenshot image with the command:
+ at example
+ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg
+ at end example
+
+See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
+
 @section jack
 
 JACK input device.
@@ -70,7 +95,7 @@ A JACK input device creates one or more JACK writable clients, one for
 each audio channel, with name @var{client_name}:input_ at var{N}, where
 @var{client_name} is the name provided by the application, and @var{N}
 is a number which identifies the channel.
-Each writable client will send the acquired data to the FFmpeg input
+Each writable client will send the acquired data to the Libav input
 device.
 
 Once you have created one or more JACK readable clients, you need to
@@ -129,6 +154,23 @@ ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
 For more information about OSS see:
 @url{http://manuals.opensound.com/usersguide/dsp.html}
 
+ at section sndio
+
+sndio input device.
+
+To enable this input device during configuration you need libsndio
+installed on your system.
+
+The filename to provide to the input device is the device node
+representing the sndio input device, and is usually set to
+ at file{/dev/audio0}.
+
+For example to grab from @file{/dev/audio0} using @file{ffmpeg} use the
+command:
+ at example
+ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
+ at end example
+
 @section video4linux and video4linux2
 
 Video4Linux and Video4Linux2 input video devices.
diff --git a/ffmpeg-mt/doc/issue_tracker.txt b/ffmpeg-mt/doc/issue_tracker.txt
index e5a74db..d92ab42 100644
--- a/ffmpeg-mt/doc/issue_tracker.txt
+++ b/ffmpeg-mt/doc/issue_tracker.txt
@@ -1,11 +1,11 @@
-FFmpeg's bug/patch/feature request tracker manual
-=================================================
+Libav's bug/patch/feature request tracker manual
+================================================
 
 NOTE: This is a draft.
 
 Overview:
 ---------
-FFmpeg uses Roundup for tracking issues, new issues and changes to
+Libav uses Roundup for tracking issues, new issues and changes to
 existing issues can be done through a web interface and through email.
 It is possible to subscribe to individual issues by adding yourself to the
 nosy list or to subscribe to the ffmpeg-issues mailing list which receives
@@ -60,7 +60,7 @@ critical
     No feature request can be critical.
 
 important
-    Bugs which make FFmpeg unusable for a significant number of users, and
+    Bugs which make Libav unusable for a significant number of users, and
     patches fixing them.
     Examples here might be completely broken MPEG-4 decoding or a build issue
     on Linux.
@@ -81,7 +81,7 @@ minor
 wish
     Something that is desirable to have but that there is no urgency at
     all to implement, e.g. something completely cosmetic like a website
-    restyle or a personalized doxy template or the FFmpeg logo.
+    restyle or a personalized doxy template or the Libav logo.
     This priority is not valid for bugs.
 
 
diff --git a/ffmpeg-mt/doc/libavfilter.texi b/ffmpeg-mt/doc/libavfilter.texi
index 8745928..1c12205 100644
--- a/ffmpeg-mt/doc/libavfilter.texi
+++ b/ffmpeg-mt/doc/libavfilter.texi
@@ -2,24 +2,25 @@
 
 @settitle Libavfilter Documentation
 @titlepage
- at sp 7
 @center @titlefont{Libavfilter Documentation}
- at sp 3
 @end titlepage
 
+ at top
+
+ at contents
 
 @chapter Introduction
 
-Libavfilter is the filtering API of FFmpeg. It is the substitute of the
+Libavfilter is the filtering API of Libav. It is the substitute of the
 now deprecated 'vhooks' and started as a Google Summer of Code project.
 
-Integrating libavfilter into the main FFmpeg repository is a work in
+Integrating libavfilter into the main Libav repository is a work in
 progress. If you wish to try the unfinished development code of
 libavfilter then check it out from the libavfilter repository into
 some directory of your choice by:
 
 @example
-   svn checkout svn://svn.ffmpeg.org/soc/libavfilter
+   svn checkout svn://svn.libav.org/soc/libavfilter
 @end example
 
 And then read the README file in the top directory to learn how to
@@ -73,7 +74,7 @@ not have video output.
 
 @chapter graph2dot
 
-The @file{graph2dot} program included in the FFmpeg @file{tools}
+The @file{graph2dot} program included in the Libav @file{tools}
 directory can be used to parse a filter graph description and issue a
 corresponding textual representation in the dot language.
 
diff --git a/ffmpeg-mt/doc/metadata.texi b/ffmpeg-mt/doc/metadata.texi
index 2a28575..cfaf491 100644
--- a/ffmpeg-mt/doc/metadata.texi
+++ b/ffmpeg-mt/doc/metadata.texi
@@ -1,7 +1,7 @@
 @chapter Metadata
 @c man begin METADATA
 
-FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
+Libav is able to dump metadata from media files into a simple UTF-8-encoded
 INI-like text file and then load it back using the metadata muxer/demuxer.
 
 The file format is as follows:
@@ -53,7 +53,7 @@ A ffmetadata file might look like this:
 ;FFMETADATA1
 title=bike\\shed
 ;this is a comment
-artist=FFmpeg troll team
+artist=Libav troll team
 
 [CHAPTER]
 TIMEBASE=1/1000
diff --git a/ffmpeg-mt/doc/multithreading.txt b/ffmpeg-mt/doc/multithreading.txt
index a106842..b72bc16 100644
--- a/ffmpeg-mt/doc/multithreading.txt
+++ b/ffmpeg-mt/doc/multithreading.txt
@@ -1,7 +1,7 @@
-FFmpeg multithreading methods
+Libav multithreading methods
 ==============================================
 
-FFmpeg provides two methods for multithreading codecs.
+Libav provides two methods for multithreading codecs.
 
 Slice threading decodes multiple parts of a frame at the same time, using
 AVCodecContext execute() and execute2().
diff --git a/ffmpeg-mt/doc/muxers.texi b/ffmpeg-mt/doc/muxers.texi
new file mode 100644
index 0000000..ead9869
--- /dev/null
+++ b/ffmpeg-mt/doc/muxers.texi
@@ -0,0 +1,207 @@
+ at chapter Muxers
+ at c man begin MUXERS
+
+Muxers are configured elements in Libav which allow writing
+multimedia streams to a particular type of file.
+
+When you configure your Libav build, all the supported muxers
+are enabled by default. You can list all available muxers using the
+configure option @code{--list-muxers}.
+
+You can disable all the muxers with the configure option
+ at code{--disable-muxers} and selectively enable / disable single muxers
+with the options @code{--enable-muxer=@var{MUXER}} /
+ at code{--disable-muxer=@var{MUXER}}.
+
+The option @code{-formats} of the ff* tools will display the list of
+enabled muxers.
+
+A description of some of the currently available muxers follows.
+
+ at anchor{crc}
+ at section crc
+
+CRC (Cyclic Redundancy Check) testing format.
+
+This muxer computes and prints the Adler-32 CRC of all the input audio
+and video frames. By default audio frames are converted to signed
+16-bit raw audio and video frames to raw video before computing the
+CRC.
+
+The output of the muxer consists of a single line of the form:
+CRC=0x at var{CRC}, where @var{CRC} is a hexadecimal number 0-padded to
+8 digits containing the CRC for all the decoded input frames.
+
+For example to compute the CRC of the input, and store it in the file
+ at file{out.crc}:
+ at example
+ffmpeg -i INPUT -f crc out.crc
+ at end example
+
+You can print the CRC to stdout with the command:
+ at example
+ffmpeg -i INPUT -f crc -
+ at end example
+
+You can select the output format of each frame with @file{ffmpeg} by
+specifying the audio and video codec and format. For example to
+compute the CRC of the input audio converted to PCM unsigned 8-bit
+and the input video converted to MPEG-2 video, use the command:
+ at example
+ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc -
+ at end example
+
+See also the @code{framecrc} muxer (@pxref{framecrc}).
+
+ at anchor{framecrc}
+ at section framecrc
+
+Per-frame CRC (Cyclic Redundancy Check) testing format.
+
+This muxer computes and prints the Adler-32 CRC for each decoded audio
+and video frame. By default audio frames are converted to signed
+16-bit raw audio and video frames to raw video before computing the
+CRC.
+
+The output of the muxer consists of a line for each audio and video
+frame of the form: @var{stream_index}, @var{frame_dts},
+ at var{frame_size}, 0x at var{CRC}, where @var{CRC} is a hexadecimal
+number 0-padded to 8 digits containing the CRC of the decoded frame.
+
+For example to compute the CRC of each decoded frame in the input, and
+store it in the file @file{out.crc}:
+ at example
+ffmpeg -i INPUT -f framecrc out.crc
+ at end example
+
+You can print the CRC of each decoded frame to stdout with the command:
+ at example
+ffmpeg -i INPUT -f framecrc -
+ at end example
+
+You can select the output format of each frame with @file{ffmpeg} by
+specifying the audio and video codec and format. For example, to
+compute the CRC of each decoded input audio frame converted to PCM
+unsigned 8-bit and of each decoded input video frame converted to
+MPEG-2 video, use the command:
+ at example
+ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f framecrc -
+ at end example
+
+See also the @code{crc} muxer (@pxref{crc}).
+
+ at section image2
+
+Image file muxer.
+
+The image file muxer writes video frames to image files.
+
+The output filenames are specified by a pattern, which can be used to
+produce sequentially numbered series of files.
+The pattern may contain the string "%d" or "%0 at var{N}d", this string
+specifies the position of the characters representing a numbering in
+the filenames. If the form "%0 at var{N}d" is used, the string
+representing the number in each filename is 0-padded to @var{N}
+digits. The literal character '%' can be specified in the pattern with
+the string "%%".
+
+If the pattern contains "%d" or "%0 at var{N}d", the first filename of
+the file list specified will contain the number 1, all the following
+numbers will be sequential.
+
+The pattern may contain a suffix which is used to automatically
+determine the format of the image files to write.
+
+For example the pattern "img-%03d.bmp" will specify a sequence of
+filenames of the form @file{img-001.bmp}, @file{img-002.bmp}, ...,
+ at file{img-010.bmp}, etc.
+The pattern "img%%-%d.jpg" will specify a sequence of filenames of the
+form @file{img%-1.jpg}, @file{img%-2.jpg}, ..., @file{img%-10.jpg},
+etc.
+
+The following example shows how to use @file{ffmpeg} for creating a
+sequence of files @file{img-001.jpeg}, @file{img-002.jpeg}, ...,
+taking one image every second from the input video:
+ at example
+ffmpeg -i in.avi -r 1 -f image2 'img-%03d.jpeg'
+ at end example
+
+Note that with @file{ffmpeg}, if the format is not specified with the
+ at code{-f} option and the output filename specifies an image file
+format, the image2 muxer is automatically selected, so the previous
+command can be written as:
+ at example
+ffmpeg -i in.avi -r 1 'img-%03d.jpeg'
+ at end example
+
+Note also that the pattern must not necessarily contain "%d" or
+"%0 at var{N}d", for example to create a single image file
+ at file{img.jpeg} from the input video you can employ the command:
+ at example
+ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg
+ at end example
+
+ at section mpegts
+
+MPEG transport stream muxer.
+
+This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
+
+The muxer options are:
+
+ at table @option
+ at item -mpegts_original_network_id @var{number}
+Set the original_network_id (default 0x0001). This is unique identifier
+of a network in DVB. Its main use is in the unique identification of a
+service through the path Original_Network_ID, Transport_Stream_ID.
+ at item -mpegts_transport_stream_id @var{number}
+Set the transport_stream_id (default 0x0001). This identifies a
+transponder in DVB.
+ at item -mpegts_service_id @var{number}
+Set the service_id (default 0x0001) also known as program in DVB.
+ at item -mpegts_pmt_start_pid @var{number}
+Set the first PID for PMT (default 0x1000, max 0x1f00).
+ at item -mpegts_start_pid @var{number}
+Set the first PID for data packets (default 0x0100, max 0x0f00).
+ at end table
+
+The recognized metadata settings in mpegts muxer are @code{service_provider}
+and @code{service_name}. If they are not set the default for
+ at code{service_provider} is "FFmpeg" and the default for
+ at code{service_name} is "Service01".
+
+ at example
+ffmpeg -i file.mpg -acodec copy -vcodec copy \
+     -mpegts_original_network_id 0x1122 \
+     -mpegts_transport_stream_id 0x3344 \
+     -mpegts_service_id 0x5566 \
+     -mpegts_pmt_start_pid 0x1500 \
+     -mpegts_start_pid 0x150 \
+     -metadata service_provider="Some provider" \
+     -metadata service_name="Some Channel" \
+     -y out.ts
+ at end example
+
+ at section null
+
+Null muxer.
+
+This muxer does not generate any output file, it is mainly useful for
+testing or benchmarking purposes.
+
+For example to benchmark decoding with @file{ffmpeg} you can use the
+command:
+ at example
+ffmpeg -benchmark -i INPUT -f null out.null
+ at end example
+
+Note that the above command does not read or write the @file{out.null}
+file, but specifying the output file is required by the @file{ffmpeg}
+syntax.
+
+Alternatively you can write the command as:
+ at example
+ffmpeg -benchmark -i INPUT -f null -
+ at end example
+
+ at c man end MUXERS
diff --git a/ffmpeg-mt/doc/optimization.txt b/ffmpeg-mt/doc/optimization.txt
index 5d51235..78e0077 100644
--- a/ffmpeg-mt/doc/optimization.txt
+++ b/ffmpeg-mt/doc/optimization.txt
@@ -17,15 +17,15 @@ Understanding these overoptimized functions:
 As many functions tend to be a bit difficult to understand because
 of optimizations, it can be hard to optimize them further, or write
 architecture-specific versions. It is recommended to look at older
-revisions of the interesting files (for a web frontend try ViewVC at
-http://svn.ffmpeg.org/ffmpeg/trunk/).
+revisions of the interesting files (web frontends for the various Libav
+branches are listed at http://libav.org/download.html).
 Alternatively, look into the other architecture-specific versions in
 the x86/, ppc/, alpha/ subdirectories. Even if you don't exactly
 comprehend the instructions, it could help understanding the functions
 and how they can be optimized.
 
 NOTE: If you still don't understand some function, ask at our mailing list!!!
-(http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel)
+(https://lists.libav.org/mailman/listinfo/libav-devel)
 
 
 When is an optimization justified?
@@ -201,7 +201,7 @@ Inline asm vs. external asm
 ---------------------------
 Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc)
 and external asm (.s or .asm files, handled by an assembler such as yasm/nasm)
-are accepted in FFmpeg. Which one to use differs per specific case.
+are accepted in Libav. Which one to use differs per specific case.
 
 - if your code is intended to be inlined in a C function, inline asm is always
    better, because external asm cannot be inlined
diff --git a/ffmpeg-mt/doc/outdevs.texi b/ffmpeg-mt/doc/outdevs.texi
index 3c0acee..938909c 100644
--- a/ffmpeg-mt/doc/outdevs.texi
+++ b/ffmpeg-mt/doc/outdevs.texi
@@ -1,10 +1,10 @@
 @chapter Output Devices
 @c man begin OUTPUT DEVICES
 
-Output devices are configured elements in FFmpeg which allow to write
+Output devices are configured elements in Libav which allow to write
 multimedia data to an output device attached to your system.
 
-When you configure your FFmpeg build, all the supported output devices
+When you configure your Libav build, all the supported output devices
 are enabled by default. You can list all available ones using the
 configure option "--list-outdevs".
 
@@ -26,4 +26,8 @@ ALSA (Advanced Linux Sound Architecture) output device.
 
 OSS (Open Sound System) output device.
 
+ at section sndio
+
+sndio audio output device.
+
 @c man end OUTPUT DEVICES
diff --git a/ffmpeg-mt/doc/protocols.texi b/ffmpeg-mt/doc/protocols.texi
index 29f5c90..18749ef 100644
--- a/ffmpeg-mt/doc/protocols.texi
+++ b/ffmpeg-mt/doc/protocols.texi
@@ -1,10 +1,10 @@
 @chapter Protocols
 @c man begin PROTOCOLS
 
-Protocols are configured elements in FFmpeg which allow to access
+Protocols are configured elements in Libav which allow to access
 resources which require the use of a particular protocol.
 
-When you configure your FFmpeg build, all the supported protocols are
+When you configure your Libav build, all the supported protocols are
 enabled by default. You can list all available ones using the
 configure option "--list-protocols".
 
@@ -19,6 +19,22 @@ supported protocols.
 
 A description of the currently available protocols follows.
 
+ at section applehttp
+
+Read Apple HTTP Live Streaming compliant segmented stream as
+a uniform one. The M3U8 playlists describing the segments can be
+remote HTTP resources or local files, accessed using the standard
+file protocol.
+HTTP is default, specific protocol can be declared by specifying
+"+ at var{proto}" after the applehttp URI scheme name, where @var{proto}
+is either "file" or "http".
+
+ at example
+applehttp://host/path/to/remote/resource.m3u8
+applehttp+http://host/path/to/remote/resource.m3u8
+applehttp+file://path/to/local/resource.m3u8
+ at end example
+
 @section concat
 
 Physical concatenation protocol.
@@ -386,6 +402,23 @@ ffplay sap://[ff0e::2:7ffe]
 
 Trasmission Control Protocol.
 
+The required syntax for a TCP url is:
+ at example
+tcp://@var{hostname}:@var{port}[?@var{options}]
+ at end example
+
+ at table @option
+
+ at item listen
+Listen for an incoming connection
+
+ at example
+ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
+ffplay tcp://@var{hostname}:@var{port}
+ at end example
+
+ at end table
+
 @section udp
 
 User Datagram Protocol.
@@ -417,9 +450,9 @@ set the time to live value (for multicast only)
 
 @item connect=@var{1|0}
 Initialize the UDP socket with @code{connect()}. In this case, the
-destination address can't be changed with udp_set_remote_url later.
+destination address can't be changed with ff_udp_set_remote_url later.
 If the destination address isn't known at the start, this option can
-be specified in udp_set_remote_url, too.
+be specified in ff_udp_set_remote_url, too.
 This allows finding out the source address for the packets with getsockname,
 and makes writes return with AVERROR(ECONNREFUSED) if "destination
 unreachable" is received.
diff --git a/ffmpeg-mt/doc/soc.txt b/ffmpeg-mt/doc/soc.txt
index 8b4a86d..e45bd6c 100644
--- a/ffmpeg-mt/doc/soc.txt
+++ b/ffmpeg-mt/doc/soc.txt
@@ -8,17 +8,17 @@ it's a little late for this year's soc (2006).
 
 The Goal:
 Our goal in respect to soc is and must be of course exactly one thing and
-that is to improve FFmpeg, to reach this goal, code must
-* conform to the svn policy and patch submission guidelines
-* must improve FFmpeg somehow (faster, smaller, "better",
+that is to improve Libav, to reach this goal, code must
+* conform to the development policy and patch submission guidelines
+* must improve Libav somehow (faster, smaller, "better",
   more codecs supported, fewer bugs, cleaner, ...)
 
 for mentors and other developers to help students to reach that goal it is
 essential that changes to their codebase are publicly visible, clean and
 easy reviewable that again leads us to:
-* use of a revision control system like svn
+* use of a revision control system like git
 * separation of cosmetic from non-cosmetic changes (this is almost entirely
   ignored by mentors and students in soc 2006 which might lead to a suprise
   when the code will be reviewed at the end before a possible inclusion in
-  FFmpeg, individual changes were generally not reviewable due to cosmetics).
+  Libav, individual changes were generally not reviewable due to cosmetics).
 * frequent commits, so that comments can be provided early
diff --git a/ffmpeg-mt/doc/t2h.init b/ffmpeg-mt/doc/t2h.init
new file mode 100644
index 0000000..cd38a3e
--- /dev/null
+++ b/ffmpeg-mt/doc/t2h.init
@@ -0,0 +1,24 @@
+# no horiz rules between sections
+$end_section = \&FFMPEG_end_section;
+sub FFMPEG_end_section($$)
+{
+}
+
+$print_page_foot = \&FFMPEG_print_page_foot;
+sub FFMPEG_print_page_foot($$)
+{
+    my $fh = shift;
+    print $fh "$SMALL_RULE\n";
+    T2H_DEFAULT_print_page_foot($fh);
+}
+
+# no navigation elements
+$SECTION_NAVIGATION = 0;
+# the same for texi2html 5.0
+$HEADERS = 0;
+
+# TOC and Chapter headings link
+$TOC_LINKS = 1;
+
+# print the TOC where @contents is used
+$INLINE_CONTENTS = 1;
diff --git a/ffmpeg-mt/doc/texi2pod.pl b/ffmpeg-mt/doc/texi2pod.pl
index aa3273e..84c36ff 100755
--- a/ffmpeg-mt/doc/texi2pod.pl
+++ b/ffmpeg-mt/doc/texi2pod.pl
@@ -231,10 +231,12 @@ while(<$inf>) {
 
     # Single line command handlers.
 
-    /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
+    /^\@(?:section|unnumbered|unnumberedsec|center|heading)\s+(.+)$/
         and $_ = "\n=head2 $1\n";
-    /^\@subsection\s+(.+)$/
+    /^\@(?:subsection|subheading)\s+(.+)$/
         and $_ = "\n=head3 $1\n";
+    /^\@(?:subsubsection|subsubheading)\s+(.+)$/
+        and $_ = "\n=head4 $1\n";
 
     # Block command handlers:
     /^\@itemize\s*(\@[a-z]+|\*|-)?/ and do {
diff --git a/ffmpeg-mt/ffmpeg.c b/ffmpeg-mt/ffmpeg.c
index 4829f30..841c798 100644
--- a/ffmpeg-mt/ffmpeg.c
+++ b/ffmpeg-mt/ffmpeg.c
@@ -2,20 +2,20 @@
  * FFmpeg main
  * Copyright (c) 2000-2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,9 +36,9 @@
 #include "libswscale/swscale.h"
 #include "libavcodec/opt.h"
 #include "libavcodec/audioconvert.h"
-#include "libavcore/audioconvert.h"
-#include "libavcore/parseutils.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/audioconvert.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/samplefmt.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/fifo.h"
 #include "libavutil/intreadwrite.h"
@@ -69,12 +69,7 @@
 #include <sys/select.h>
 #endif
 
-#if HAVE_TERMIOS_H
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <termios.h>
-#elif HAVE_CONIO_H
+#if HAVE_KBHIT
 #include <conio.h>
 #endif
 #include <time.h>
@@ -115,6 +110,8 @@ static const OptionDef options[];
 #define MAX_STREAMS 1024    /* arbitrary sanity check value */
 #endif
 
+#define FFM_PACKET_SIZE 4096 //XXX a duplicate of the line in ffm.h
+
 static const char *last_asked_format = NULL;
 static AVFormatContext *input_files[MAX_FILES];
 static int64_t input_files_ts_offset[MAX_FILES];
@@ -172,7 +169,7 @@ static int loop_output = AVFMT_NOOUTPUTLOOP;
 static int qp_hist = 0;
 #if CONFIG_AVFILTER
 static char *vfilters = NULL;
-AVFilterGraph *graph = NULL;
+static AVFilterGraph *graph = NULL;
 #endif
 
 static int intra_only = 0;
@@ -251,7 +248,7 @@ static int64_t timer_start;
 
 static uint8_t *audio_buf;
 static uint8_t *audio_out;
-unsigned int allocated_audio_out_size, allocated_audio_buf_size;
+static unsigned int allocated_audio_out_size, allocated_audio_buf_size;
 
 static short *samples;
 
@@ -340,12 +337,6 @@ typedef struct AVInputFile {
     int nb_streams;       /* nb streams we are aware of */
 } AVInputFile;
 
-#if HAVE_TERMIOS_H
-
-/* init terminal so that we can grab keys */
-static struct termios oldtty;
-#endif
-
 #if CONFIG_AVFILTER
 
 static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
@@ -423,9 +414,6 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
 static void term_exit(void)
 {
     av_log(NULL, AV_LOG_QUIET, "");
-#if HAVE_TERMIOS_H
-    tcsetattr (0, TCSANOW, &oldtty);
-#endif
 }
 
 static volatile int received_sigterm = 0;
@@ -439,26 +427,6 @@ sigterm_handler(int sig)
 
 static void term_init(void)
 {
-#if HAVE_TERMIOS_H
-    struct termios tty;
-
-    tcgetattr (0, &tty);
-    oldtty = tty;
-    atexit(term_exit);
-
-    tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
-                          |INLCR|IGNCR|ICRNL|IXON);
-    tty.c_oflag |= OPOST;
-    tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
-    tty.c_cflag &= ~(CSIZE|PARENB);
-    tty.c_cflag |= CS8;
-    tty.c_cc[VMIN] = 1;
-    tty.c_cc[VTIME] = 0;
-
-    tcsetattr (0, TCSANOW, &tty);
-    signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */
-#endif
-
     signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).  */
     signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */
 #ifdef SIGXCPU
@@ -469,25 +437,7 @@ static void term_init(void)
 /* read a key without blocking */
 static int read_key(void)
 {
-#if HAVE_TERMIOS_H
-    int n = 1;
-    unsigned char ch;
-    struct timeval tv;
-    fd_set rfds;
-
-    FD_ZERO(&rfds);
-    FD_SET(0, &rfds);
-    tv.tv_sec = 0;
-    tv.tv_usec = 0;
-    n = select(1, &rfds, NULL, NULL, &tv);
-    if (n > 0) {
-        n = read(0, &ch, 1);
-        if (n == 1)
-            return ch;
-
-        return n;
-    }
-#elif HAVE_CONIO_H
+#if HAVE_KBHIT
     if(kbhit())
         return(getch());
 #endif
@@ -505,25 +455,10 @@ static int ffmpeg_exit(int ret)
 
     /* close files */
     for(i=0;i<nb_output_files;i++) {
-        /* maybe av_close_output_file ??? */
         AVFormatContext *s = output_files[i];
-        int j;
         if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
-            url_fclose(s->pb);
-        for(j=0;j<s->nb_streams;j++) {
-            av_metadata_free(&s->streams[j]->metadata);
-            av_free(s->streams[j]->codec);
-            av_free(s->streams[j]->info);
-            av_free(s->streams[j]);
-        }
-        for(j=0;j<s->nb_programs;j++) {
-            av_metadata_free(&s->programs[j]->metadata);
-        }
-        for(j=0;j<s->nb_chapters;j++) {
-            av_metadata_free(&s->chapters[j]->metadata);
-        }
-        av_metadata_free(&s->metadata);
-        av_free(s);
+            avio_close(s->pb);
+        avformat_free_context(s);
         av_free(output_streams_for_file[i]);
     }
     for(i=0;i<nb_input_files;i++) {
@@ -538,7 +473,6 @@ static int ffmpeg_exit(int ret)
         fclose(vstats_file);
     av_free(vstats_filename);
 
-    av_free(opt_names);
     av_free(streamid_map);
     av_free(input_codecs);
     av_free(output_codecs);
@@ -600,8 +534,14 @@ static void choose_sample_fmt(AVStream *st, AVCodec *codec)
             if(*p == st->codec->sample_fmt)
                 break;
         }
-        if(*p == -1)
+        if (*p == -1) {
+            av_log(NULL, AV_LOG_WARNING,
+                   "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
+                   av_get_sample_fmt_name(st->codec->sample_fmt),
+                   codec->name,
+                   av_get_sample_fmt_name(codec->sample_fmts[0]));
             st->codec->sample_fmt = codec->sample_fmts[0];
+        }
     }
 }
 
@@ -820,7 +760,9 @@ need_realloc:
             if (ost->resample)
                 audio_resample_close(ost->resample);
         }
-        if (ost->resample_sample_fmt  == enc->sample_fmt &&
+        /* if audio_sync_method is >1 the resampler is needed for audio drift compensation */
+        if (audio_sync_method <= 1 &&
+            ost->resample_sample_fmt  == enc->sample_fmt &&
             ost->resample_channels    == enc->channels   &&
             ost->resample_sample_rate == enc->sample_rate) {
             ost->resample = NULL;
@@ -1357,9 +1299,9 @@ static void print_report(AVFormatContext **output_files,
 
     oc = output_files[0];
 
-    total_size = url_fsize(oc->pb);
-    if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too
-        total_size= url_ftell(oc->pb);
+    total_size = avio_size(oc->pb);
+    if(total_size<0) // FIXME improve avio_size() so it works with non seekable output too
+        total_size= avio_tell(oc->pb);
 
     buf[0] = '\0';
     ti1 = 1e10;
@@ -1450,6 +1392,14 @@ static void print_report(AVFormatContext **output_files,
     }
 }
 
+static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
+{
+    int fill_char = 0x00;
+    if (sample_fmt == AV_SAMPLE_FMT_U8)
+        fill_char = 0x80;
+    memset(buf, fill_char, size);
+}
+
 /* pkt = NULL means EOF (needed to flush decoder buffers) */
 static int output_packet(AVInputStream *ist, int ist_index,
                          AVOutputStream **ost_table, int nb_ostreams,
@@ -1540,6 +1490,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
                     decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
                     /* XXX: allocate picture correctly */
                     avcodec_get_frame_defaults(&picture);
+                    avpkt.pts = pkt_pts;
+                    avpkt.dts = ist->pts;
                     pkt_pts = AV_NOPTS_VALUE;
 
                     ret = avcodec_decode_video2(ist->st->codec,
@@ -1601,10 +1553,13 @@ static int output_packet(AVInputStream *ist, int ist_index,
 
 #if CONFIG_AVFILTER
         if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ist->input_video_filter) {
+            AVRational sar;
+            if (ist->st->sample_aspect_ratio.num) sar = ist->st->sample_aspect_ratio;
+            else                                  sar = ist->st->codec->sample_aspect_ratio;
             // add it to be filtered
             av_vsrc_buffer_add_frame(ist->input_video_filter, &picture,
                                      ist->pts,
-                                     ist->st->codec->sample_aspect_ratio);
+                                     sar);
         }
 #endif
 
@@ -1787,7 +1742,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
                                     int frame_bytes = enc->frame_size*osize*enc->channels;
                                     if (allocated_audio_buf_size < frame_bytes)
                                         ffmpeg_exit(1);
-                                    memset(audio_buf+fifo_bytes, 0, frame_bytes - fifo_bytes);
+                                    generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);
                                 }
 
                                 ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf);
@@ -1844,7 +1799,7 @@ static void print_sdp(AVFormatContext **avc, int n)
 {
     char sdp[2048];
 
-    avf_sdp_create(avc, n, sdp, sizeof(sdp));
+    av_sdp_create(avc, n, sdp, sizeof(sdp));
     printf("SDP:\n%s\n", sdp);
     fflush(stdout);
 }
@@ -1979,7 +1934,7 @@ static int transcode(AVFormatContext **output_files,
     for(i=0;i<nb_output_files;i++) {
         os = output_files[i];
         if (!os->nb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) {
-            dump_format(output_files[i], i, output_files[i]->filename, 1);
+            av_dump_format(output_files[i], i, output_files[i]->filename, 1);
             fprintf(stderr, "Output file #%d does not contain any stream\n", i);
             ret = AVERROR(EINVAL);
             goto fail;
@@ -2030,7 +1985,7 @@ static int transcode(AVFormatContext **output_files,
                 /* Sanity check that the stream types match */
                 if (ist_table[ost->source_index]->st->codec->codec_type != ost->st->codec->codec_type) {
                     int i= ost->file_index;
-                    dump_format(output_files[i], i, output_files[i]->filename, 1);
+                    av_dump_format(output_files[i], i, output_files[i]->filename, 1);
                     fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
                         stream_maps[n].file_index, stream_maps[n].stream_index,
                         ost->file_index, ost->index);
@@ -2081,7 +2036,7 @@ static int transcode(AVFormatContext **output_files,
                     }
                     if (!found) {
                         int i= ost->file_index;
-                        dump_format(output_files[i], i, output_files[i]->filename, 1);
+                        av_dump_format(output_files[i], i, output_files[i]->filename, 1);
                         fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n",
                                 ost->file_index, ost->index);
                         ffmpeg_exit(1);
@@ -2138,7 +2093,7 @@ static int transcode(AVFormatContext **output_files,
                 goto fail;
             memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
             codec->extradata_size= icodec->extradata_size;
-            if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){
+            if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
                 codec->time_base = icodec->time_base;
                 codec->time_base.num *= icodec->ticks_per_frame;
                 av_reduce(&codec->time_base.num, &codec->time_base.den,
@@ -2155,6 +2110,7 @@ static int transcode(AVFormatContext **output_files,
                 codec->sample_rate = icodec->sample_rate;
                 codec->channels = icodec->channels;
                 codec->frame_size = icodec->frame_size;
+                codec->audio_service_type = icodec->audio_service_type;
                 codec->block_align= icodec->block_align;
                 if(codec->block_align == 1 && codec->codec_id == CODEC_ID_MP3)
                     codec->block_align= 0;
@@ -2461,7 +2417,7 @@ static int transcode(AVFormatContext **output_files,
     /* dump the file output parameters - cannot be done before in case
        of stream copy */
     for(i=0;i<nb_output_files;i++) {
-        dump_format(output_files[i], i, output_files[i]->filename, 1);
+        av_dump_format(output_files[i], i, output_files[i]->filename, 1);
     }
 
     /* dump the stream mapping */
@@ -2492,8 +2448,12 @@ static int transcode(AVFormatContext **output_files,
     }
 
     if (!using_stdin && verbose >= 0) {
+#if HAVE_KBHIT
         fprintf(stderr, "Press [q] to stop encoding\n");
-        url_set_interrupt_cb(decode_interrupt_cb);
+#else
+        fprintf(stderr, "Press ctrl-c to stop encoding\n");
+#endif
+        avio_set_interrupt_cb(decode_interrupt_cb);
     }
     term_init();
 
@@ -2557,7 +2517,7 @@ static int transcode(AVFormatContext **output_files,
         }
 
         /* finish if limit size exhausted */
-        if (limit_filesize != 0 && limit_filesize <= url_ftell(output_files[0]->pb))
+        if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb))
             break;
 
         /* read a frame from it and output it in the fifo */
@@ -2580,7 +2540,8 @@ static int transcode(AVFormatContext **output_files,
         memset(no_packet, 0, sizeof(no_packet));
 
         if (do_pkt_dump) {
-            av_pkt_dump_log(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump);
+            av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
+                             is->streams[pkt.stream_index]);
         }
         /* the following test is needed in case new streams appear
            dynamically in stream : we ignore them */
@@ -2681,10 +2642,7 @@ static int transcode(AVFormatContext **output_files,
         }
     }
 #if CONFIG_AVFILTER
-    if (graph) {
-        avfilter_graph_free(graph);
-        av_freep(&graph);
-    }
+    avfilter_graph_free(&graph);
 #endif
 
     /* finished ! */
@@ -2996,7 +2954,7 @@ static void parse_meta_type(char *arg, char *type, int *index, char **endptr)
         *type = 'g';
 }
 
-static void opt_map_meta_data(const char *arg)
+static void opt_map_metadata(const char *arg)
 {
     AVMetaDataMap *m, *m1;
     char *p;
@@ -3022,6 +2980,13 @@ static void opt_map_meta_data(const char *arg)
         metadata_chapters_autocopy = 0;
 }
 
+static void opt_map_meta_data(const char *arg)
+{
+    fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. "
+                    "Use -map_metadata instead.\n");
+    opt_map_metadata(arg);
+}
+
 static void opt_map_chapters(const char *arg)
 {
     AVChapterMap *c;
@@ -3229,7 +3194,7 @@ static void opt_input_file(const char *filename)
     for(i=0;i<ic->nb_streams;i++) {
         AVStream *st = ic->streams[i];
         AVCodecContext *dec = st->codec;
-        avcodec_thread_init(dec, thread_count);
+        dec->thread_count = thread_count;
         input_codecs = grow_array(input_codecs, sizeof(*input_codecs), &nb_input_codecs, nb_input_codecs + 1);
         switch (dec->codec_type) {
         case AVMEDIA_TYPE_AUDIO:
@@ -3307,7 +3272,7 @@ static void opt_input_file(const char *filename)
     input_files_ts_offset[nb_input_files] = input_ts_offset - (copy_ts ? 0 : timestamp);
     /* dump the file content */
     if (verbose >= 0)
-        dump_format(ic, nb_input_files, filename, 0);
+        av_dump_format(ic, nb_input_files, filename, 0);
 
     nb_input_files++;
 
@@ -3787,7 +3752,7 @@ static void opt_output_file(const char *filename)
         }
 
         /* open the file */
-        if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) {
+        if ((err = avio_open(&oc->pb, filename, AVIO_WRONLY)) < 0) {
             print_error(filename, err);
             ffmpeg_exit(1);
         }
@@ -3807,7 +3772,6 @@ static void opt_output_file(const char *filename)
 
     set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL);
 
-    nb_streamid_map = 0;
     av_freep(&forced_key_frames);
 }
 
@@ -4180,8 +4144,11 @@ static const OptionDef options[] = {
     { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
     { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
     { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
-    { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" },
-    { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "set meta data information of outfile from infile", "outfile[,metadata]:infile[,metadata]" },
+    { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file.stream[:syncfile.syncstream]" },
+    { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "DEPRECATED set meta data information of outfile from infile",
+      "outfile[,metadata]:infile[,metadata]" },
+    { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set metadata information of outfile from infile",
+      "outfile[,metadata]:infile[,metadata]" },
     { "map_chapters",  HAS_ARG | OPT_EXPERT, {(void*)opt_map_chapters},  "set chapters mapping", "outfile:infile" },
     { "t", OPT_FUNC2 | HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" },
     { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, //
@@ -4324,7 +4291,7 @@ int main(int argc, char **argv)
 
 #if HAVE_ISATTY
     if(isatty(STDIN_FILENO))
-        url_set_interrupt_cb(decode_interrupt_cb);
+        avio_set_interrupt_cb(decode_interrupt_cb);
 #endif
 
     init_opts();
diff --git a/ffmpeg-mt/ffplay.c b/ffmpeg-mt/ffplay.c
index 4b608df..bd8a985 100644
--- a/ffmpeg-mt/ffplay.c
+++ b/ffmpeg-mt/ffplay.c
@@ -1,21 +1,21 @@
 /*
- * FFplay : Simple Media Player based on the FFmpeg libraries
+ * FFplay : Simple Media Player based on the Libav libraries
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,9 +28,9 @@
 #include "libavutil/avstring.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/pixdesc.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/parseutils.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/samplefmt.h"
 #include "libavformat/avformat.h"
 #include "libavdevice/avdevice.h"
 #include "libswscale/swscale.h"
@@ -58,6 +58,7 @@
 const char program_name[] = "FFplay";
 const int program_birth_year = 2003;
 
+//#define DEBUG
 //#define DEBUG_SYNC
 
 #define MAX_QUEUE_SIZE (15 * 1024 * 1024)
@@ -711,40 +712,6 @@ static void video_image_display(VideoState *is)
         if (aspect_ratio <= 0.0)
             aspect_ratio = 1.0;
         aspect_ratio *= (float)vp->width / (float)vp->height;
-        /* if an active format is indicated, then it overrides the
-           mpeg format */
-#if 0
-        if (is->video_st->codec->dtg_active_format != is->dtg_active_format) {
-            is->dtg_active_format = is->video_st->codec->dtg_active_format;
-            printf("dtg_active_format=%d\n", is->dtg_active_format);
-        }
-#endif
-#if 0
-        switch(is->video_st->codec->dtg_active_format) {
-        case FF_DTG_AFD_SAME:
-        default:
-            /* nothing to do */
-            break;
-        case FF_DTG_AFD_4_3:
-            aspect_ratio = 4.0 / 3.0;
-            break;
-        case FF_DTG_AFD_16_9:
-            aspect_ratio = 16.0 / 9.0;
-            break;
-        case FF_DTG_AFD_14_9:
-            aspect_ratio = 14.0 / 9.0;
-            break;
-        case FF_DTG_AFD_4_3_SP_14_9:
-            aspect_ratio = 14.0 / 9.0;
-            break;
-        case FF_DTG_AFD_16_9_SP_14_9:
-            aspect_ratio = 14.0 / 9.0;
-            break;
-        case FF_DTG_AFD_SP_4_3:
-            aspect_ratio = 4.0 / 3.0;
-            break;
-        }
-#endif
 
         if (is->subtitle_st)
         {
@@ -1569,8 +1536,6 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke
         return 0;
     }
 
-    /* NOTE: ipts is the PTS of the _first_ picture beginning in
-       this packet, if any */
     len1 = avcodec_decode_video2(is->video_st->codec,
                                  frame, &got_picture,
                                  pkt);
@@ -1587,11 +1552,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke
         if (*pts == AV_NOPTS_VALUE) {
             *pts = 0;
         }
-    }
 
-//            if (len1 < 0)
-//                break;
-    if (got_picture){
         is->skip_frames_index += 1;
         if(is->skip_frames_index >= is->skip_frames){
             is->skip_frames_index -= FFMAX(is->skip_frames, 1.0);
@@ -1788,30 +1749,20 @@ static AVFilter input_filter =
                                   { .name = NULL }},
 };
 
-#endif  /* CONFIG_AVFILTER */
-
-static int video_thread(void *arg)
+static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters)
 {
-    VideoState *is = arg;
-    AVFrame *frame= avcodec_alloc_frame();
-    int64_t pts_int;
-    double pts;
-    int ret;
-
-#if CONFIG_AVFILTER
-    int64_t pos;
     char sws_flags_str[128];
+    int ret;
     FFSinkContext ffsink_ctx = { .pix_fmt = PIX_FMT_YUV420P };
     AVFilterContext *filt_src = NULL, *filt_out = NULL;
-    AVFilterGraph *graph = avfilter_graph_alloc();
     snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags);
     graph->scale_sws_opts = av_strdup(sws_flags_str);
 
-    if (avfilter_graph_create_filter(&filt_src, &input_filter, "src",
-                                     NULL, is, graph) < 0)
+    if ((ret = avfilter_graph_create_filter(&filt_src, &input_filter, "src",
+                                            NULL, is, graph)) < 0)
         goto the_end;
-    if (avfilter_graph_create_filter(&filt_out, &ffsink, "out",
-                                     NULL, &ffsink_ctx, graph) < 0)
+    if ((ret = avfilter_graph_create_filter(&filt_out, &ffsink, "out",
+                                            NULL, &ffsink_ctx, graph)) < 0)
         goto the_end;
 
     if(vfilters) {
@@ -1828,17 +1779,40 @@ static int video_thread(void *arg)
         inputs->pad_idx = 0;
         inputs->next    = NULL;
 
-        if (avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL) < 0)
+        if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0)
             goto the_end;
         av_freep(&vfilters);
     } else {
-        if(avfilter_link(filt_src, 0, filt_out, 0) < 0)          goto the_end;
+        if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0)
+            goto the_end;
     }
 
-    if (avfilter_graph_config(graph, NULL) < 0)
+    if ((ret = avfilter_graph_config(graph, NULL)) < 0)
         goto the_end;
 
     is->out_video_filter = filt_out;
+the_end:
+    return ret;
+}
+
+#endif  /* CONFIG_AVFILTER */
+
+static int video_thread(void *arg)
+{
+    VideoState *is = arg;
+    AVFrame *frame= avcodec_alloc_frame();
+    int64_t pts_int;
+    double pts;
+    int ret;
+
+#if CONFIG_AVFILTER
+    AVFilterGraph *graph = avfilter_graph_alloc();
+    AVFilterContext *filt_out = NULL;
+    int64_t pos;
+
+    if ((ret = configure_video_filters(graph, is, vfilters)) < 0)
+        goto the_end;
+    filt_out = is->out_video_filter;
 #endif
 
     for(;;) {
@@ -1859,12 +1833,12 @@ static int video_thread(void *arg)
         }
 
         if (av_cmp_q(tb, is->video_st->time_base)) {
-            int64_t pts1 = pts_int;
+            av_unused int64_t pts1 = pts_int;
             pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base);
-            av_log(NULL, AV_LOG_DEBUG, "video_thread(): "
-                   "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
-                   tb.num, tb.den, pts1,
-                   is->video_st->time_base.num, is->video_st->time_base.den, pts_int);
+            av_dlog(NULL, "video_thread(): "
+                    "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
+                    tb.num, tb.den, pts1,
+                    is->video_st->time_base.num, is->video_st->time_base.den, pts_int);
         }
 #else
         ret = get_video_frame(is, frame, &pts_int, &pkt);
@@ -1892,8 +1866,7 @@ static int video_thread(void *arg)
     }
  the_end:
 #if CONFIG_AVFILTER
-    avfilter_graph_free(graph);
-    av_freep(&graph);
+    avfilter_graph_free(&graph);
 #endif
     av_free(frame);
     return 0;
@@ -2253,7 +2226,7 @@ static int stream_component_open(VideoState *is, int stream_index)
     avctx->skip_loop_filter= skip_loop_filter;
     avctx->error_recognition= error_recognition;
     avctx->error_concealment= error_concealment;
-    avcodec_thread_init(avctx, thread_count);
+    avctx->thread_count= thread_count;
 
     set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec);
 
@@ -2420,7 +2393,7 @@ static int decode_thread(void *arg)
     is->subtitle_stream = -1;
 
     global_video_state = is;
-    url_set_interrupt_cb(decode_interrupt_cb);
+    avio_set_interrupt_cb(decode_interrupt_cb);
 
     memset(ap, 0, sizeof(*ap));
 
@@ -2491,7 +2464,7 @@ static int decode_thread(void *arg)
                                  st_index[AVMEDIA_TYPE_VIDEO]),
                                 NULL, 0);
     if (show_status) {
-        dump_format(ic, 0, is->filename, 0);
+        av_dump_format(ic, 0, is->filename, 0);
     }
 
     /* open the streams */
@@ -2595,9 +2568,9 @@ static int decode_thread(void *arg)
         }
         ret = av_read_frame(ic, pkt);
         if (ret < 0) {
-            if (ret == AVERROR_EOF || url_feof(ic->pb))
+            if (ret == AVERROR_EOF || (ic->pb && ic->pb->eof_reached))
                 eof=1;
-            if (url_ferror(ic->pb))
+            if (ic->pb && ic->pb->error)
                 break;
             SDL_Delay(100); /* wait for user event */
             continue;
@@ -2639,7 +2612,7 @@ static int decode_thread(void *arg)
         av_close_input_file(is->ic);
         is->ic = NULL; /* safety */
     }
-    url_set_interrupt_cb(NULL);
+    avio_set_interrupt_cb(NULL);
 
     if (ret != 0) {
         SDL_Event event;
@@ -2832,7 +2805,7 @@ static void event_loop(void)
                         }else if(cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos>=0){
                             pos= cur_stream->audio_pkt.pos;
                         }else
-                            pos = url_ftell(cur_stream->ic->pb);
+                            pos = avio_tell(cur_stream->ic->pb);
                         if (cur_stream->ic->bit_rate)
                             incr *= cur_stream->ic->bit_rate / 8.0;
                         else
@@ -2865,7 +2838,7 @@ static void event_loop(void)
             }
             if (cur_stream) {
                 if(seek_by_bytes || cur_stream->ic->duration<=0){
-                    uint64_t size=  url_fsize(cur_stream->ic->pb);
+                    uint64_t size=  avio_size(cur_stream->ic->pb);
                     stream_seek(cur_stream, size*x/cur_stream->width, 0, 1);
                 }else{
                     int64_t ts;
diff --git a/ffmpeg-mt/ffpresets/libx264-fast.ffpreset b/ffmpeg-mt/ffpresets/libx264-fast.ffpreset
index cac6534..0fc1f22 100644
--- a/ffmpeg-mt/ffpresets/libx264-fast.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-fast.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=2
diff --git a/ffmpeg-mt/ffpresets/libx264-fast_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-fast_firstpass.ffpreset
index 65ec011..cdcbbbf 100644
--- a/ffmpeg-mt/ffpresets/libx264-fast_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-fast_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-faster.ffpreset b/ffmpeg-mt/ffpresets/libx264-faster.ffpreset
index a32eed3..3156cd8 100644
--- a/ffmpeg-mt/ffpresets/libx264-faster.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-faster.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=2
diff --git a/ffmpeg-mt/ffpresets/libx264-faster_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-faster_firstpass.ffpreset
index c777eb4..9bcf18a 100644
--- a/ffmpeg-mt/ffpresets/libx264-faster_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-faster_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-lossless_fast.ffpreset b/ffmpeg-mt/ffpresets/libx264-lossless_fast.ffpreset
index ea08d3c..b7696b5 100644
--- a/ffmpeg-mt/ffpresets/libx264-lossless_fast.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-lossless_fast.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 directpred=1
 flags2=+fastpskip
diff --git a/ffmpeg-mt/ffpresets/libx264-lossless_max.ffpreset b/ffmpeg-mt/ffpresets/libx264-lossless_max.ffpreset
index 8c049c9..75c387f 100644
--- a/ffmpeg-mt/ffpresets/libx264-lossless_max.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-lossless_max.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 refs=16
 directpred=1
diff --git a/ffmpeg-mt/ffpresets/libx264-lossless_medium.ffpreset b/ffmpeg-mt/ffpresets/libx264-lossless_medium.ffpreset
index 558be6c..116e334 100644
--- a/ffmpeg-mt/ffpresets/libx264-lossless_medium.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-lossless_medium.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 directpred=1
 flags2=+fastpskip
diff --git a/ffmpeg-mt/ffpresets/libx264-lossless_slow.ffpreset b/ffmpeg-mt/ffpresets/libx264-lossless_slow.ffpreset
index ff641cf..0d496f6 100644
--- a/ffmpeg-mt/ffpresets/libx264-lossless_slow.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-lossless_slow.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 refs=2
 directpred=1
diff --git a/ffmpeg-mt/ffpresets/libx264-lossless_slower.ffpreset b/ffmpeg-mt/ffpresets/libx264-lossless_slower.ffpreset
index 854f74b..672e0cd 100644
--- a/ffmpeg-mt/ffpresets/libx264-lossless_slower.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-lossless_slower.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 refs=4
 directpred=1
diff --git a/ffmpeg-mt/ffpresets/libx264-lossless_ultrafast.ffpreset b/ffmpeg-mt/ffpresets/libx264-lossless_ultrafast.ffpreset
index 1c429f2..a2eda65 100644
--- a/ffmpeg-mt/ffpresets/libx264-lossless_ultrafast.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-lossless_ultrafast.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 directpred=1
 flags2=+fastpskip
diff --git a/ffmpeg-mt/ffpresets/libx264-medium.ffpreset b/ffmpeg-mt/ffpresets/libx264-medium.ffpreset
index 039f1d6..3c90ec5 100644
--- a/ffmpeg-mt/ffpresets/libx264-medium.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-medium.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=3
diff --git a/ffmpeg-mt/ffpresets/libx264-medium_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-medium_firstpass.ffpreset
index e415989..2ad0a9c 100644
--- a/ffmpeg-mt/ffpresets/libx264-medium_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-medium_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-placebo.ffpreset b/ffmpeg-mt/ffpresets/libx264-placebo.ffpreset
index fae2222..9f4719f 100644
--- a/ffmpeg-mt/ffpresets/libx264-placebo.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-placebo.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=16
 refs=16
diff --git a/ffmpeg-mt/ffpresets/libx264-placebo_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-placebo_firstpass.ffpreset
index fae2222..9f4719f 100644
--- a/ffmpeg-mt/ffpresets/libx264-placebo_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-placebo_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=16
 refs=16
diff --git a/ffmpeg-mt/ffpresets/libx264-slow.ffpreset b/ffmpeg-mt/ffpresets/libx264-slow.ffpreset
index 0f3f4d4..dabe0ae 100644
--- a/ffmpeg-mt/ffpresets/libx264-slow.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-slow.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=5
diff --git a/ffmpeg-mt/ffpresets/libx264-slow_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-slow_firstpass.ffpreset
index 89e74e4..4af64db 100644
--- a/ffmpeg-mt/ffpresets/libx264-slow_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-slow_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-slower.ffpreset b/ffmpeg-mt/ffpresets/libx264-slower.ffpreset
index f3a412c..239ee68 100644
--- a/ffmpeg-mt/ffpresets/libx264-slower.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-slower.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=8
diff --git a/ffmpeg-mt/ffpresets/libx264-slower_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-slower_firstpass.ffpreset
index aa1eb1e..4b5b420 100644
--- a/ffmpeg-mt/ffpresets/libx264-slower_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-slower_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-superfast.ffpreset b/ffmpeg-mt/ffpresets/libx264-superfast.ffpreset
index bcd4599..fb2ab8c 100644
--- a/ffmpeg-mt/ffpresets/libx264-superfast.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-superfast.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-superfast_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-superfast_firstpass.ffpreset
index ef06b1d..55ff9a2 100644
--- a/ffmpeg-mt/ffpresets/libx264-superfast_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-superfast_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-ultrafast.ffpreset b/ffmpeg-mt/ffpresets/libx264-ultrafast.ffpreset
index b6d2080..28dc0eb 100644
--- a/ffmpeg-mt/ffpresets/libx264-ultrafast.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-ultrafast.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=0
 i_qfactor=0.71
 b_strategy=0
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=0
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-ultrafast_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-ultrafast_firstpass.ffpreset
index b6d2080..28dc0eb 100644
--- a/ffmpeg-mt/ffpresets/libx264-ultrafast_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-ultrafast_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=0
 i_qfactor=0.71
 b_strategy=0
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=0
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-veryfast.ffpreset b/ffmpeg-mt/ffpresets/libx264-veryfast.ffpreset
index 16ca594..bfa3d8f 100644
--- a/ffmpeg-mt/ffpresets/libx264-veryfast.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-veryfast.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-veryfast_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-veryfast_firstpass.ffpreset
index 39eaf3e..ac2332d 100644
--- a/ffmpeg-mt/ffpresets/libx264-veryfast_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-veryfast_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=1
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=3
 refs=1
diff --git a/ffmpeg-mt/ffpresets/libx264-veryslow.ffpreset b/ffmpeg-mt/ffpresets/libx264-veryslow.ffpreset
index a060625..e07aeb8 100644
--- a/ffmpeg-mt/ffpresets/libx264-veryslow.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-veryslow.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=8
 refs=16
diff --git a/ffmpeg-mt/ffpresets/libx264-veryslow_firstpass.ffpreset b/ffmpeg-mt/ffpresets/libx264-veryslow_firstpass.ffpreset
index 6e7079b..e17c04b 100644
--- a/ffmpeg-mt/ffpresets/libx264-veryslow_firstpass.ffpreset
+++ b/ffmpeg-mt/ffpresets/libx264-veryslow_firstpass.ffpreset
@@ -11,8 +11,8 @@ sc_threshold=40
 i_qfactor=0.71
 b_strategy=2
 qcomp=0.6
-qmin=10
-qmax=51
+qmin=0
+qmax=69
 qdiff=4
 bf=8
 refs=1
diff --git a/ffmpeg-mt/ffprobe.c b/ffmpeg-mt/ffprobe.c
index 2c99e5a..6c672e7 100644
--- a/ffmpeg-mt/ffprobe.c
+++ b/ffmpeg-mt/ffprobe.c
@@ -1,21 +1,21 @@
 /*
- * FFprobe : Simple Media Prober based on the FFmpeg libraries
+ * FFprobe : Simple Media Prober based on the Libav libraries
  * Copyright (c) 2007-2010 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -277,7 +277,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
         return err;
     }
 
-    dump_format(fmt_ctx, 0, filename, 0);
+    av_dump_format(fmt_ctx, 0, filename, 0);
 
     /* bind a decoder to each input stream */
     for (i = 0; i < fmt_ctx->nb_streams; i++) {
diff --git a/ffmpeg-mt/ffserver.c b/ffmpeg-mt/ffserver.c
index 89e8e95..36cd9ce 100644
--- a/ffmpeg-mt/ffserver.c
+++ b/ffmpeg-mt/ffserver.c
@@ -2,20 +2,20 @@
  * Multiple format streaming server
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,14 +29,17 @@
 #include <strings.h>
 #include <stdlib.h>
 #include "libavformat/avformat.h"
+#include "libavformat/ffm.h"
 #include "libavformat/network.h"
 #include "libavformat/os_support.h"
 #include "libavformat/rtpdec.h"
 #include "libavformat/rtsp.h"
+// XXX for ffio_open_dyn_packet_buffer, to be removed
+#include "libavformat/avio_internal.h"
 #include "libavutil/avstring.h"
 #include "libavutil/lfg.h"
 #include "libavutil/random_seed.h"
-#include "libavcore/parseutils.h"
+#include "libavutil/parseutils.h"
 #include "libavcodec/opt.h"
 #include <stdarg.h>
 #include <unistd.h>
@@ -163,7 +166,7 @@ typedef struct HTTPContext {
 
     /* RTSP state specific */
     uint8_t *pb_buffer; /* XXX: use that in all the code */
-    ByteIOContext *pb;
+    AVIOContext *pb;
     int seq; /* RTSP sequence number */
 
     /* RTP state specific */
@@ -384,7 +387,10 @@ static void http_vlog(const char *fmt, va_list vargs)
     }
 }
 
-static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 1, 2)))
+#endif
+static void http_log(const char *fmt, ...)
 {
     va_list vargs;
     va_start(vargs, fmt);
@@ -689,8 +695,8 @@ static int http_server(void)
            second to handle timeouts */
         do {
             ret = poll(poll_table, poll_entry - poll_table, delay);
-            if (ret < 0 && ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
+            if (ret < 0 && ff_neterrno() != AVERROR(EAGAIN) &&
+                ff_neterrno() != AVERROR(EINTR))
                 return -1;
         } while (ret < 0);
 
@@ -866,10 +872,10 @@ static void close_connection(HTTPContext *c)
     if (!c->last_packet_sent && c->state == HTTPSTATE_SEND_DATA_TRAILER) {
         if (ctx->oformat) {
             /* prepare header */
-            if (url_open_dyn_buf(&ctx->pb) >= 0) {
+            if (avio_open_dyn_buf(&ctx->pb) >= 0) {
                 av_write_trailer(ctx);
                 av_freep(&c->pb_buffer);
-                url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+                avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
             }
         }
     }
@@ -913,8 +919,8 @@ static int handle_connection(HTTPContext *c)
     read_loop:
         len = recv(c->fd, c->buffer_ptr, 1, 0);
         if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
+            if (ff_neterrno() != AVERROR(EAGAIN) &&
+                ff_neterrno() != AVERROR(EINTR))
                 return -1;
         } else if (len == 0) {
             return -1;
@@ -949,8 +955,8 @@ static int handle_connection(HTTPContext *c)
             return 0;
         len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
         if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR)) {
+            if (ff_neterrno() != AVERROR(EAGAIN) &&
+                ff_neterrno() != AVERROR(EINTR)) {
                 /* error : close connection */
                 av_freep(&c->pb_buffer);
                 return -1;
@@ -1019,8 +1025,8 @@ static int handle_connection(HTTPContext *c)
             return 0;
         len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
         if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR)) {
+            if (ff_neterrno() != AVERROR(EAGAIN) &&
+                ff_neterrno() != AVERROR(EINTR)) {
                 /* error : close connection */
                 av_freep(&c->pb_buffer);
                 return -1;
@@ -1046,8 +1052,8 @@ static int handle_connection(HTTPContext *c)
         len = send(c->fd, c->packet_buffer_ptr,
                     c->packet_buffer_end - c->packet_buffer_ptr, 0);
         if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR)) {
+            if (ff_neterrno() != AVERROR(EAGAIN) &&
+                ff_neterrno() != AVERROR(EINTR)) {
                 /* error : close connection */
                 av_freep(&c->packet_buffer);
                 return -1;
@@ -1192,19 +1198,6 @@ static int modify_current_stream(HTTPContext *c, char *rates)
     return action_required;
 }
 
-
-static void do_switch_stream(HTTPContext *c, int i)
-{
-    if (c->switch_feed_streams[i] >= 0) {
-#ifdef PHILIP
-        c->feed_streams[i] = c->switch_feed_streams[i];
-#endif
-
-        /* Now update the stream */
-    }
-    c->switch_feed_streams[i] = -1;
-}
-
 /* XXX: factorize in utils.c ? */
 /* XXX: take care with different space meaning */
 static void skip_spaces(const char **pp)
@@ -1578,7 +1571,7 @@ static int http_parse_request(HTTPContext *c)
         if (modify_current_stream(c, ratebuf)) {
             for (i = 0; i < FF_ARRAY_ELEMS(c->feed_streams); i++) {
                 if (c->switch_feed_streams[i] >= 0)
-                    do_switch_stream(c, i);
+                    c->switch_feed_streams[i] = -1;
             }
         }
     }
@@ -1864,14 +1857,14 @@ static int http_parse_request(HTTPContext *c)
     return 0;
 }
 
-static void fmt_bytecount(ByteIOContext *pb, int64_t count)
+static void fmt_bytecount(AVIOContext *pb, int64_t count)
 {
     static const char *suffix = " kMGTP";
     const char *s;
 
     for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++);
 
-    url_fprintf(pb, "%"PRId64"%c", count, *s);
+    avio_printf(pb, "%"PRId64"%c", count, *s);
 }
 
 static void compute_status(HTTPContext *c)
@@ -1881,29 +1874,29 @@ static void compute_status(HTTPContext *c)
     char *p;
     time_t ti;
     int i, len;
-    ByteIOContext *pb;
+    AVIOContext *pb;
 
-    if (url_open_dyn_buf(&pb) < 0) {
+    if (avio_open_dyn_buf(&pb) < 0) {
         /* XXX: return an error ? */
         c->buffer_ptr = c->buffer;
         c->buffer_end = c->buffer;
         return;
     }
 
-    url_fprintf(pb, "HTTP/1.0 200 OK\r\n");
-    url_fprintf(pb, "Content-type: %s\r\n", "text/html");
-    url_fprintf(pb, "Pragma: no-cache\r\n");
-    url_fprintf(pb, "\r\n");
+    avio_printf(pb, "HTTP/1.0 200 OK\r\n");
+    avio_printf(pb, "Content-type: %s\r\n", "text/html");
+    avio_printf(pb, "Pragma: no-cache\r\n");
+    avio_printf(pb, "\r\n");
 
-    url_fprintf(pb, "<html><head><title>%s Status</title>\n", program_name);
+    avio_printf(pb, "<html><head><title>%s Status</title>\n", program_name);
     if (c->stream->feed_filename[0])
-        url_fprintf(pb, "<link rel=\"shortcut icon\" href=\"%s\">\n", c->stream->feed_filename);
-    url_fprintf(pb, "</head>\n<body>");
-    url_fprintf(pb, "<h1>%s Status</h1>\n", program_name);
+        avio_printf(pb, "<link rel=\"shortcut icon\" href=\"%s\">\n", c->stream->feed_filename);
+    avio_printf(pb, "</head>\n<body>");
+    avio_printf(pb, "<h1>%s Status</h1>\n", program_name);
     /* format status */
-    url_fprintf(pb, "<h2>Available Streams</h2>\n");
-    url_fprintf(pb, "<table cellspacing=0 cellpadding=4>\n");
-    url_fprintf(pb, "<tr><th valign=top>Path<th align=left>Served<br>Conns<th><br>bytes<th valign=top>Format<th>Bit rate<br>kbits/s<th align=left>Video<br>kbits/s<th><br>Codec<th align=left>Audio<br>kbits/s<th><br>Codec<th align=left valign=top>Feed\n");
+    avio_printf(pb, "<h2>Available Streams</h2>\n");
+    avio_printf(pb, "<table cellspacing=0 cellpadding=4>\n");
+    avio_printf(pb, "<tr><th valign=top>Path<th align=left>Served<br>Conns<th><br>bytes<th valign=top>Format<th>Bit rate<br>kbits/s<th align=left>Video<br>kbits/s<th><br>Codec<th align=left>Audio<br>kbits/s<th><br>Codec<th align=left valign=top>Feed\n");
     stream = first_stream;
     while (stream != NULL) {
         char sfilename[1024];
@@ -1931,9 +1924,9 @@ static void compute_status(HTTPContext *c)
                 }
             }
 
-            url_fprintf(pb, "<tr><td><a href=\"/%s\">%s</a> ",
+            avio_printf(pb, "<tr><td><a href=\"/%s\">%s</a> ",
                          sfilename, stream->filename);
-            url_fprintf(pb, "<td align=right> %d <td align=right> ",
+            avio_printf(pb, "<td align=right> %d <td align=right> ",
                         stream->conns_served);
             fmt_bytecount(pb, stream->bytes_served);
             switch(stream->stream_type) {
@@ -1972,33 +1965,33 @@ static void compute_status(HTTPContext *c)
                             abort();
                         }
                     }
-                    url_fprintf(pb, "<td align=center> %s <td align=right> %d <td align=right> %d <td> %s %s <td align=right> %d <td> %s %s",
+                    avio_printf(pb, "<td align=center> %s <td align=right> %d <td align=right> %d <td> %s %s <td align=right> %d <td> %s %s",
                                  stream->fmt->name,
                                  stream->bandwidth,
                                  video_bit_rate / 1000, video_codec_name, video_codec_name_extra,
                                  audio_bit_rate / 1000, audio_codec_name, audio_codec_name_extra);
                     if (stream->feed)
-                        url_fprintf(pb, "<td>%s", stream->feed->filename);
+                        avio_printf(pb, "<td>%s", stream->feed->filename);
                     else
-                        url_fprintf(pb, "<td>%s", stream->feed_filename);
-                    url_fprintf(pb, "\n");
+                        avio_printf(pb, "<td>%s", stream->feed_filename);
+                    avio_printf(pb, "\n");
                 }
                 break;
             default:
-                url_fprintf(pb, "<td align=center> - <td align=right> - <td align=right> - <td><td align=right> - <td>\n");
+                avio_printf(pb, "<td align=center> - <td align=right> - <td align=right> - <td><td align=right> - <td>\n");
                 break;
             }
         }
         stream = stream->next;
     }
-    url_fprintf(pb, "</table>\n");
+    avio_printf(pb, "</table>\n");
 
     stream = first_stream;
     while (stream != NULL) {
         if (stream->feed == stream) {
-            url_fprintf(pb, "<h2>Feed %s</h2>", stream->filename);
+            avio_printf(pb, "<h2>Feed %s</h2>", stream->filename);
             if (stream->pid) {
-                url_fprintf(pb, "Running as pid %d.\n", stream->pid);
+                avio_printf(pb, "Running as pid %d.\n", stream->pid);
 
 #if defined(linux) && !defined(CONFIG_NOCUTILS)
                 {
@@ -2017,7 +2010,7 @@ static void compute_status(HTTPContext *c)
 
                         if (fscanf(pid_stat, "%10s %64s", cpuperc,
                                    cpuused) == 2) {
-                            url_fprintf(pb, "Currently using %s%% of the cpu. Total time used %s.\n",
+                            avio_printf(pb, "Currently using %s%% of the cpu. Total time used %s.\n",
                                          cpuperc, cpuused);
                         }
                         fclose(pid_stat);
@@ -2025,9 +2018,9 @@ static void compute_status(HTTPContext *c)
                 }
 #endif
 
-                url_fprintf(pb, "<p>");
+                avio_printf(pb, "<p>");
             }
-            url_fprintf(pb, "<table cellspacing=0 cellpadding=4><tr><th>Stream<th>type<th>kbits/s<th align=left>codec<th align=left>Parameters\n");
+            avio_printf(pb, "<table cellspacing=0 cellpadding=4><tr><th>Stream<th>type<th>kbits/s<th align=left>codec<th align=left>Parameters\n");
 
             for (i = 0; i < stream->nb_streams; i++) {
                 AVStream *st = stream->streams[i];
@@ -2050,26 +2043,26 @@ static void compute_status(HTTPContext *c)
                 default:
                     abort();
                 }
-                url_fprintf(pb, "<tr><td align=right>%d<td>%s<td align=right>%d<td>%s<td>%s\n",
+                avio_printf(pb, "<tr><td align=right>%d<td>%s<td align=right>%d<td>%s<td>%s\n",
                         i, type, st->codec->bit_rate/1000, codec ? codec->name : "", parameters);
             }
-            url_fprintf(pb, "</table>\n");
+            avio_printf(pb, "</table>\n");
 
         }
         stream = stream->next;
     }
 
     /* connection status */
-    url_fprintf(pb, "<h2>Connection Status</h2>\n");
+    avio_printf(pb, "<h2>Connection Status</h2>\n");
 
-    url_fprintf(pb, "Number of connections: %d / %d<br>\n",
+    avio_printf(pb, "Number of connections: %d / %d<br>\n",
                  nb_connections, nb_max_connections);
 
-    url_fprintf(pb, "Bandwidth in use: %"PRIu64"k / %"PRIu64"k<br>\n",
+    avio_printf(pb, "Bandwidth in use: %"PRIu64"k / %"PRIu64"k<br>\n",
                  current_bandwidth, max_bandwidth);
 
-    url_fprintf(pb, "<table>\n");
-    url_fprintf(pb, "<tr><th>#<th>File<th>IP<th>Proto<th>State<th>Target bits/sec<th>Actual bits/sec<th>Bytes transferred\n");
+    avio_printf(pb, "<table>\n");
+    avio_printf(pb, "<tr><th>#<th>File<th>IP<th>Proto<th>State<th>Target bits/sec<th>Actual bits/sec<th>Bytes transferred\n");
     c1 = first_http_ctx;
     i = 0;
     while (c1 != NULL) {
@@ -2088,7 +2081,7 @@ static void compute_status(HTTPContext *c)
 
         i++;
         p = inet_ntoa(c1->from_addr.sin_addr);
-        url_fprintf(pb, "<tr><td><b>%d</b><td>%s%s<td>%s<td>%s<td>%s<td align=right>",
+        avio_printf(pb, "<tr><td><b>%d</b><td>%s%s<td>%s<td>%s<td>%s<td align=right>",
                     i,
                     c1->stream ? c1->stream->filename : "",
                     c1->state == HTTPSTATE_RECEIVE_DATA ? "(input)" : "",
@@ -2096,22 +2089,22 @@ static void compute_status(HTTPContext *c)
                     c1->protocol,
                     http_state[c1->state]);
         fmt_bytecount(pb, bitrate);
-        url_fprintf(pb, "<td align=right>");
+        avio_printf(pb, "<td align=right>");
         fmt_bytecount(pb, compute_datarate(&c1->datarate, c1->data_count) * 8);
-        url_fprintf(pb, "<td align=right>");
+        avio_printf(pb, "<td align=right>");
         fmt_bytecount(pb, c1->data_count);
-        url_fprintf(pb, "\n");
+        avio_printf(pb, "\n");
         c1 = c1->next;
     }
-    url_fprintf(pb, "</table>\n");
+    avio_printf(pb, "</table>\n");
 
     /* date */
     ti = time(NULL);
     p = ctime(&ti);
-    url_fprintf(pb, "<hr size=1 noshade>Generated at %s", p);
-    url_fprintf(pb, "</body>\n</html>\n");
+    avio_printf(pb, "<hr size=1 noshade>Generated at %s", p);
+    avio_printf(pb, "</body>\n</html>\n");
 
-    len = url_close_dyn_buf(pb, &c->pb_buffer);
+    len = avio_close_dyn_buf(pb, &c->pb_buffer);
     c->buffer_ptr = c->pb_buffer;
     c->buffer_end = c->pb_buffer + len;
 }
@@ -2145,11 +2138,10 @@ static int open_input_stream(HTTPContext *c, const char *info)
         strcpy(input_filename, c->stream->feed->feed_filename);
         buf_size = FFM_PACKET_SIZE;
         /* compute position (absolute time) */
-        if (find_info_tag(buf, sizeof(buf), "date", info)) {
-            stream_pos = parse_date(buf, 0);
-            if (stream_pos == INT64_MIN)
-                return -1;
-        } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
+        if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
+            if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0)
+                return ret;
+        } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) {
             int prebuffer = strtol(buf, 0, 10);
             stream_pos = av_gettime() - prebuffer * (int64_t)1000000;
         } else
@@ -2158,10 +2150,9 @@ static int open_input_stream(HTTPContext *c, const char *info)
         strcpy(input_filename, c->stream->feed_filename);
         buf_size = 0;
         /* compute position (relative time) */
-        if (find_info_tag(buf, sizeof(buf), "date", info)) {
-            stream_pos = parse_date(buf, 1);
-            if (stream_pos == INT64_MIN)
-                return -1;
+        if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
+            if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0)
+                return ret;
         } else
             stream_pos = 0;
     }
@@ -2268,11 +2259,11 @@ static int http_prepare_data(HTTPContext *c)
         c->got_key_frame = 0;
 
         /* prepare header and save header data in a stream */
-        if (url_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
+        if (avio_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
             /* XXX: potential leak */
             return -1;
         }
-        c->fmt_ctx.pb->is_streamed = 1;
+        c->fmt_ctx.pb->seekable = 0;
 
         /*
          * HACK to avoid mpeg ps muxer to spit many underflow errors
@@ -2289,7 +2280,7 @@ static int http_prepare_data(HTTPContext *c)
         }
         av_metadata_free(&c->fmt_ctx.metadata);
 
-        len = url_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
+        len = avio_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
         c->buffer_ptr = c->pb_buffer;
         c->buffer_end = c->pb_buffer + len;
 
@@ -2349,7 +2340,7 @@ static int http_prepare_data(HTTPContext *c)
                         for(i=0;i<c->stream->nb_streams;i++) {
                             if (c->switch_feed_streams[i] == pkt.stream_index)
                                 if (pkt.flags & AV_PKT_FLAG_KEY)
-                                    do_switch_stream(c, i);
+                                    c->switch_feed_streams[i] = -1;
                             if (c->switch_feed_streams[i] >= 0)
                                 c->switch_pending = 1;
                         }
@@ -2401,9 +2392,9 @@ static int http_prepare_data(HTTPContext *c)
                             max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
                         else
                             max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
-                        ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size);
+                        ret = ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size);
                     } else {
-                        ret = url_open_dyn_buf(&ctx->pb);
+                        ret = avio_open_dyn_buf(&ctx->pb);
                     }
                     if (ret < 0) {
                         /* XXX: potential leak */
@@ -2411,7 +2402,7 @@ static int http_prepare_data(HTTPContext *c)
                     }
                     ost = ctx->streams[pkt.stream_index];
 
-                    ctx->pb->is_streamed = 1;
+                    ctx->pb->seekable = 0;
                     if (pkt.dts != AV_NOPTS_VALUE)
                         pkt.dts = av_rescale_q(pkt.dts, ist->time_base, ost->time_base);
                     if (pkt.pts != AV_NOPTS_VALUE)
@@ -2422,7 +2413,7 @@ static int http_prepare_data(HTTPContext *c)
                         c->state = HTTPSTATE_SEND_DATA_TRAILER;
                     }
 
-                    len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+                    len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
                     c->cur_frame_bytes = len;
                     c->buffer_ptr = c->pb_buffer;
                     c->buffer_end = c->pb_buffer + len;
@@ -2444,13 +2435,13 @@ static int http_prepare_data(HTTPContext *c)
             return -1;
         ctx = &c->fmt_ctx;
         /* prepare header */
-        if (url_open_dyn_buf(&ctx->pb) < 0) {
+        if (avio_open_dyn_buf(&ctx->pb) < 0) {
             /* XXX: potential leak */
             return -1;
         }
-        c->fmt_ctx.pb->is_streamed = 1;
+        c->fmt_ctx.pb->seekable = 0;
         av_write_trailer(ctx);
-        len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+        len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
         c->buffer_ptr = c->pb_buffer;
         c->buffer_end = c->pb_buffer + len;
 
@@ -2503,7 +2494,7 @@ static int http_send_data(HTTPContext *c)
 
                 if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP) {
                     /* RTP packets are sent inside the RTSP TCP connection */
-                    ByteIOContext *pb;
+                    AVIOContext *pb;
                     int interleaved_index, size;
                     uint8_t header[4];
                     HTTPContext *rtsp_c;
@@ -2515,7 +2506,7 @@ static int http_send_data(HTTPContext *c)
                     /* if already sending something, then wait. */
                     if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST)
                         break;
-                    if (url_open_dyn_buf(&pb) < 0)
+                    if (avio_open_dyn_buf(&pb) < 0)
                         goto fail1;
                     interleaved_index = c->packet_stream_index * 2;
                     /* RTCP packets are sent at odd indexes */
@@ -2526,11 +2517,11 @@ static int http_send_data(HTTPContext *c)
                     header[1] = interleaved_index;
                     header[2] = len >> 8;
                     header[3] = len;
-                    put_buffer(pb, header, 4);
+                    avio_write(pb, header, 4);
                     /* write RTP packet data */
                     c->buffer_ptr += 4;
-                    put_buffer(pb, c->buffer_ptr, len);
-                    size = url_close_dyn_buf(pb, &c->packet_buffer);
+                    avio_write(pb, c->buffer_ptr, len);
+                    size = avio_close_dyn_buf(pb, &c->packet_buffer);
                     /* prepare asynchronous TCP sending */
                     rtsp_c->packet_buffer_ptr = c->packet_buffer;
                     rtsp_c->packet_buffer_end = c->packet_buffer + size;
@@ -2562,8 +2553,8 @@ static int http_send_data(HTTPContext *c)
                 /* TCP data output */
                 len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
                 if (len < 0) {
-                    if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                        ff_neterrno() != FF_NETERROR(EINTR))
+                    if (ff_neterrno() != AVERROR(EAGAIN) &&
+                        ff_neterrno() != AVERROR(EINTR))
                         /* error : close connection */
                         return -1;
                     else
@@ -2636,8 +2627,8 @@ static int http_receive_data(HTTPContext *c)
         len = recv(c->fd, c->buffer_ptr, 1, 0);
 
         if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
+            if (ff_neterrno() != AVERROR(EAGAIN) &&
+                ff_neterrno() != AVERROR(EINTR))
                 /* error : close connection */
                 goto fail;
             return 0;
@@ -2663,8 +2654,8 @@ static int http_receive_data(HTTPContext *c)
         len = recv(c->fd, c->buffer_ptr,
                    FFMIN(c->chunk_size, c->buffer_end - c->buffer_ptr), 0);
         if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
+            if (ff_neterrno() != AVERROR(EAGAIN) &&
+                ff_neterrno() != AVERROR(EINTR))
                 /* error : close connection */
                 goto fail;
         } else if (len == 0)
@@ -2724,7 +2715,7 @@ static int http_receive_data(HTTPContext *c)
         } else {
             /* We have a header in our hands that contains useful data */
             AVFormatContext *s = NULL;
-            ByteIOContext *pb;
+            AVIOContext *pb;
             AVInputFormat *fmt_in;
             int i;
 
@@ -2733,8 +2724,9 @@ static int http_receive_data(HTTPContext *c)
             if (!fmt_in)
                 goto fail;
 
-            url_open_buf(&pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY);
-            pb->is_streamed = 1;
+            pb = avio_alloc_context(c->buffer, c->buffer_end - c->buffer,
+                                    0, NULL, NULL, NULL, NULL);
+            pb->seekable = 0;
 
             if (av_open_input_stream(&s, pb, c->stream->feed_filename, fmt_in, NULL) < 0) {
                 av_free(pb);
@@ -2824,20 +2816,20 @@ static void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number)
         break;
     }
 
-    url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str);
-    url_fprintf(c->pb, "CSeq: %d\r\n", c->seq);
+    avio_printf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str);
+    avio_printf(c->pb, "CSeq: %d\r\n", c->seq);
 
     /* output GMT time */
     ti = time(NULL);
     tm = gmtime(&ti);
     strftime(buf2, sizeof(buf2), "%a, %d %b %Y %H:%M:%S", tm);
-    url_fprintf(c->pb, "Date: %s GMT\r\n", buf2);
+    avio_printf(c->pb, "Date: %s GMT\r\n", buf2);
 }
 
 static void rtsp_reply_error(HTTPContext *c, enum RTSPStatusCode error_number)
 {
     rtsp_reply_header(c, error_number);
-    url_fprintf(c->pb, "\r\n");
+    avio_printf(c->pb, "\r\n");
 }
 
 static int rtsp_parse_request(HTTPContext *c)
@@ -2861,7 +2853,7 @@ static int rtsp_parse_request(HTTPContext *c)
     av_strlcpy(c->url, url, sizeof(c->url));
     av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
 
-    if (url_open_dyn_buf(&c->pb) < 0) {
+    if (avio_open_dyn_buf(&c->pb) < 0) {
         /* XXX: cannot do more */
         c->pb = NULL; /* safety */
         return -1;
@@ -2918,7 +2910,7 @@ static int rtsp_parse_request(HTTPContext *c)
         rtsp_reply_error(c, RTSP_STATUS_METHOD);
 
  the_end:
-    len = url_close_dyn_buf(c->pb, &c->pb_buffer);
+    len = avio_close_dyn_buf(c->pb, &c->pb_buffer);
     c->pb = NULL; /* safety */
     if (len < 0) {
         /* XXX: cannot do more */
@@ -2966,7 +2958,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
         avc->streams[i]->codec = stream->streams[i]->codec;
     }
     *pbuffer = av_mallocz(2048);
-    avf_sdp_create(&avc, 1, *pbuffer, 2048);
+    av_sdp_create(&avc, 1, *pbuffer, 2048);
 
  sdp_done:
 #if !FF_API_MAX_STREAMS
@@ -2982,10 +2974,10 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
 static void rtsp_cmd_options(HTTPContext *c, const char *url)
 {
 //    rtsp_reply_header(c, RTSP_STATUS_OK);
-    url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", RTSP_STATUS_OK, "OK");
-    url_fprintf(c->pb, "CSeq: %d\r\n", c->seq);
-    url_fprintf(c->pb, "Public: %s\r\n", "OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE");
-    url_fprintf(c->pb, "\r\n");
+    avio_printf(c->pb, "RTSP/1.0 %d %s\r\n", RTSP_STATUS_OK, "OK");
+    avio_printf(c->pb, "CSeq: %d\r\n", c->seq);
+    avio_printf(c->pb, "Public: %s\r\n", "OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE");
+    avio_printf(c->pb, "\r\n");
 }
 
 static void rtsp_cmd_describe(HTTPContext *c, const char *url)
@@ -3026,11 +3018,11 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url)
         return;
     }
     rtsp_reply_header(c, RTSP_STATUS_OK);
-    url_fprintf(c->pb, "Content-Base: %s/\r\n", url);
-    url_fprintf(c->pb, "Content-Type: application/sdp\r\n");
-    url_fprintf(c->pb, "Content-Length: %d\r\n", content_length);
-    url_fprintf(c->pb, "\r\n");
-    put_buffer(c->pb, content, content_length);
+    avio_printf(c->pb, "Content-Base: %s/\r\n", url);
+    avio_printf(c->pb, "Content-Type: application/sdp\r\n");
+    avio_printf(c->pb, "Content-Length: %d\r\n", content_length);
+    avio_printf(c->pb, "\r\n");
+    avio_write(c->pb, content, content_length);
     av_free(content);
 }
 
@@ -3175,30 +3167,30 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url,
     /* now everything is OK, so we can send the connection parameters */
     rtsp_reply_header(c, RTSP_STATUS_OK);
     /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id);
+    avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id);
 
     switch(rtp_c->rtp_protocol) {
     case RTSP_LOWER_TRANSPORT_UDP:
         rtp_port = rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]);
         rtcp_port = rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]);
-        url_fprintf(c->pb, "Transport: RTP/AVP/UDP;unicast;"
+        avio_printf(c->pb, "Transport: RTP/AVP/UDP;unicast;"
                     "client_port=%d-%d;server_port=%d-%d",
                     th->client_port_min, th->client_port_max,
                     rtp_port, rtcp_port);
         break;
     case RTSP_LOWER_TRANSPORT_TCP:
-        url_fprintf(c->pb, "Transport: RTP/AVP/TCP;interleaved=%d-%d",
+        avio_printf(c->pb, "Transport: RTP/AVP/TCP;interleaved=%d-%d",
                     stream_index * 2, stream_index * 2 + 1);
         break;
     default:
         break;
     }
     if (setup.transport_option[0] != '\0')
-        url_fprintf(c->pb, ";%s", setup.transport_option);
-    url_fprintf(c->pb, "\r\n");
+        avio_printf(c->pb, ";%s", setup.transport_option);
+    avio_printf(c->pb, "\r\n");
 
 
-    url_fprintf(c->pb, "\r\n");
+    avio_printf(c->pb, "\r\n");
 }
 
 
@@ -3211,7 +3203,7 @@ static HTTPContext *find_rtp_session_with_url(const char *url,
     char path1[1024];
     const char *path;
     char buf[1024];
-    int s;
+    int s, len;
 
     rtp_c = find_rtp_session(session_id);
     if (!rtp_c)
@@ -3231,6 +3223,10 @@ static HTTPContext *find_rtp_session_with_url(const char *url,
         return rtp_c;
       }
     }
+    len = strlen(path);
+    if (len > 0 && path[len - 1] == '/' &&
+        !strncmp(path, rtp_c->stream->filename, len - 1))
+        return rtp_c;
     return NULL;
 }
 
@@ -3256,8 +3252,8 @@ static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPMessageHeader *h)
     /* now everything is OK, so we can send the connection parameters */
     rtsp_reply_header(c, RTSP_STATUS_OK);
     /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id);
-    url_fprintf(c->pb, "\r\n");
+    avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id);
+    avio_printf(c->pb, "\r\n");
 }
 
 static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h)
@@ -3281,8 +3277,8 @@ static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h
     /* now everything is OK, so we can send the connection parameters */
     rtsp_reply_header(c, RTSP_STATUS_OK);
     /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id);
-    url_fprintf(c->pb, "\r\n");
+    avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id);
+    avio_printf(c->pb, "\r\n");
 }
 
 static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h)
@@ -3304,8 +3300,8 @@ static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader
     /* now everything is OK, so we can send the connection parameters */
     rtsp_reply_header(c, RTSP_STATUS_OK);
     /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", session_id);
-    url_fprintf(c->pb, "\r\n");
+    avio_printf(c->pb, "Session: %s\r\n", session_id);
+    avio_printf(c->pb, "\r\n");
 }
 
 
@@ -3432,7 +3428,7 @@ static int rtp_new_av_stream(HTTPContext *c,
                      "rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
         }
 
-        if (url_open(&h, ctx->filename, URL_WRONLY) < 0)
+        if (url_open(&h, ctx->filename, AVIO_WRONLY) < 0)
             goto fail;
         c->rtp_handles[stream_index] = h;
         max_packet_size = url_get_max_packet_size(h);
@@ -3451,7 +3447,7 @@ static int rtp_new_av_stream(HTTPContext *c,
              c->stream->filename, stream_index, c->protocol);
 
     /* normally, no packets should be output here, but the packet size may be checked */
-    if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
+    if (ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
         /* XXX: close stream */
         goto fail;
     }
@@ -3463,7 +3459,7 @@ static int rtp_new_av_stream(HTTPContext *c,
         av_free(ctx);
         return -1;
     }
-    url_close_dyn_buf(ctx->pb, &dummy_buf);
+    avio_close_dyn_buf(ctx->pb, &dummy_buf);
     av_free(dummy_buf);
 
     c->rtp_ctx[stream_index] = ctx;
@@ -3497,7 +3493,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
     fst->priv_data = av_mallocz(sizeof(FeedData));
     fst->index = stream->nb_streams;
     av_set_pts_info(fst, 33, 1, 90000);
-    fst->sample_aspect_ratio = (AVRational){0,1};
+    fst->sample_aspect_ratio = codec->sample_aspect_ratio;
     stream->streams[stream->nb_streams++] = fst;
     return fst;
 }
@@ -3772,7 +3768,7 @@ static void build_feed_streams(void)
             }
 
             /* only write the header of the ffm file */
-            if (url_fopen(&s->pb, feed->feed_filename, URL_WRONLY) < 0) {
+            if (avio_open(&s->pb, feed->feed_filename, AVIO_WRONLY) < 0) {
                 http_log("Could not open output feed file '%s'\n",
                          feed->feed_filename);
                 exit(1);
@@ -3791,7 +3787,7 @@ static void build_feed_streams(void)
             }
             /* XXX: need better api */
             av_freep(&s->priv_data);
-            url_fclose(s->pb);
+            avio_close(s->pb);
         }
         /* get feed size and write index */
         fd = open(feed->feed_filename, O_RDONLY);
diff --git a/ffmpeg-mt/ffserver.h b/ffmpeg-mt/ffserver.h
index c76752f..868b83b 100644
--- a/ffmpeg-mt/ffserver.h
+++ b/ffmpeg-mt/ffserver.h
@@ -2,20 +2,20 @@
  * Multiple format streaming server
  * copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef FFMPEG_FFSERVER_H
diff --git a/ffmpeg-mt/libavcodec/4xm.c b/ffmpeg-mt/libavcodec/4xm.c
index 30c4c59..dc6f8bd 100644
--- a/ffmpeg-mt/libavcodec/4xm.c
+++ b/ffmpeg-mt/libavcodec/4xm.c
@@ -2,20 +2,20 @@
  * 4XM codec
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -865,7 +865,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec fourxm_decoder = {
+AVCodec ff_fourxm_decoder = {
     "4xm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_4XM,
diff --git a/ffmpeg-mt/libavcodec/8bps.c b/ffmpeg-mt/libavcodec/8bps.c
index 292c739..1c6d406 100644
--- a/ffmpeg-mt/libavcodec/8bps.c
+++ b/ffmpeg-mt/libavcodec/8bps.c
@@ -2,20 +2,20 @@
  * Quicktime Planar RGB (8BPS) Video Decoder
  * Copyright (C) 2003 Roberto Togni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -219,7 +219,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
 
 
 
-AVCodec eightbps_decoder = {
+AVCodec ff_eightbps_decoder = {
         "8bps",
         AVMEDIA_TYPE_VIDEO,
         CODEC_ID_8BPS,
diff --git a/ffmpeg-mt/libavcodec/8svx.c b/ffmpeg-mt/libavcodec/8svx.c
index 66820be..5fdea91 100644
--- a/ffmpeg-mt/libavcodec/8svx.c
+++ b/ffmpeg-mt/libavcodec/8svx.c
@@ -2,20 +2,20 @@
  * 8SVX audio decoder
  * Copyright (C) 2008 Jaikrishnan Menon
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -92,7 +92,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec eightsvx_fib_decoder = {
+AVCodec ff_eightsvx_fib_decoder = {
   .name           = "8svx_fib",
   .type           = AVMEDIA_TYPE_AUDIO,
   .id             = CODEC_ID_8SVX_FIB,
@@ -102,7 +102,7 @@ AVCodec eightsvx_fib_decoder = {
   .long_name      = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
 };
 
-AVCodec eightsvx_exp_decoder = {
+AVCodec ff_eightsvx_exp_decoder = {
   .name           = "8svx_exp",
   .type           = AVMEDIA_TYPE_AUDIO,
   .id             = CODEC_ID_8SVX_EXP,
diff --git a/ffmpeg-mt/libavcodec/Makefile b/ffmpeg-mt/libavcodec/Makefile
index 90f07d6..837f7e2 100644
--- a/ffmpeg-mt/libavcodec/Makefile
+++ b/ffmpeg-mt/libavcodec/Makefile
@@ -1,9 +1,9 @@
 include $(SUBDIR)../config.mak
 
 NAME = avcodec
-FFLIBS = avcore avutil
+FFLIBS = avutil
 
-HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h
+HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h version.h xvmc.h
 
 OBJS = allcodecs.o                                                      \
        audioconvert.o                                                   \
@@ -12,6 +12,7 @@ OBJS = allcodecs.o                                                      \
        bitstream_filter.o                                               \
        dsputil.o                                                        \
        faanidct.o                                                       \
+       fmtconvert.o                                                     \
        imgconvert.o                                                     \
        jrevdct.o                                                        \
        opt.o                                                            \
@@ -25,21 +26,24 @@ OBJS = allcodecs.o                                                      \
 
 # parts needed for many different codecs
 OBJS-$(CONFIG_AANDCT)                  += aandcttab.o
+OBJS-$(CONFIG_AC3DSP)                  += ac3dsp.o
 OBJS-$(CONFIG_ENCODERS)                += faandct.o jfdctfst.o jfdctint.o
 OBJS-$(CONFIG_DCT)                     += dct.o
 OBJS-$(CONFIG_DWT)                     += dwt.o
 OBJS-$(CONFIG_DXVA2)                   += dxva2.o
-FFT-OBJS-$(CONFIG_HARDCODED_TABLES)    += cos_tables.o
-OBJS-$(CONFIG_FFT)                     += avfft.o fft.o $(FFT-OBJS-yes)
+FFT-OBJS-$(CONFIG_HARDCODED_TABLES)    += cos_tables.o cos_fixed_tables.o
+OBJS-$(CONFIG_FFT)                     += avfft.o fft_fixed.o fft_float.o \
+                                          $(FFT-OBJS-yes)
 OBJS-$(CONFIG_GOLOMB)                  += golomb.o
 OBJS-$(CONFIG_H264DSP)                 += h264dsp.o h264idct.o
 OBJS-$(CONFIG_H264PRED)                += h264pred.o
 OBJS-$(CONFIG_HUFFMAN)                 += huffman.o
 OBJS-$(CONFIG_LPC)                     += lpc.o
 OBJS-$(CONFIG_LSP)                     += lsp.o
-OBJS-$(CONFIG_MDCT)                    += mdct.o
+OBJS-$(CONFIG_MDCT)                    += mdct_fixed.o mdct_float.o
 RDFT-OBJS-$(CONFIG_HARDCODED_TABLES)   += sin_tables.o
 OBJS-$(CONFIG_RDFT)                    += rdft.o $(RDFT-OBJS-yes)
+OBJS-$(CONFIG_SINEWIN)                 += sinewin.o
 OBJS-$(CONFIG_VAAPI)                   += vaapi.o
 OBJS-$(CONFIG_VDPAU)                   += vdpau.o
 
@@ -47,14 +51,14 @@ OBJS-$(CONFIG_VDPAU)                   += vdpau.o
 OBJS-$(CONFIG_A64MULTI_ENCODER)        += a64multienc.o elbg.o
 OBJS-$(CONFIG_A64MULTI5_ENCODER)       += a64multienc.o elbg.o
 OBJS-$(CONFIG_AAC_DECODER)             += aacdec.o aactab.o aacsbr.o aacps.o \
-                                          aacadtsdec.o mpeg4audio.o
+                                          aacadtsdec.o mpeg4audio.o kbdwin.o
 OBJS-$(CONFIG_AAC_ENCODER)             += aacenc.o aaccoder.o    \
                                           aacpsy.o aactab.o      \
                                           psymodel.o iirfilter.o \
-                                          mpeg4audio.o
+                                          mpeg4audio.o kbdwin.o
 OBJS-$(CONFIG_AASC_DECODER)            += aasc.o msrledec.o
-OBJS-$(CONFIG_AC3_DECODER)             += ac3dec.o ac3dec_data.o ac3.o
-OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc_float.o ac3tab.o ac3.o
+OBJS-$(CONFIG_AC3_DECODER)             += ac3dec.o ac3dec_data.o ac3.o kbdwin.o
+OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc_float.o ac3tab.o ac3.o kbdwin.o
 OBJS-$(CONFIG_AC3_FIXED_ENCODER)       += ac3enc_fixed.o ac3tab.o ac3.o
 OBJS-$(CONFIG_ALAC_DECODER)            += alac.o
 OBJS-$(CONFIG_ALAC_ENCODER)            += alacenc.o
@@ -100,6 +104,7 @@ OBJS-$(CONFIG_COOK_DECODER)            += cook.o
 OBJS-$(CONFIG_CSCD_DECODER)            += cscd.o
 OBJS-$(CONFIG_CYUV_DECODER)            += cyuv.o
 OBJS-$(CONFIG_DCA_DECODER)             += dca.o synth_filter.o dcadsp.o
+OBJS-$(CONFIG_DFA_DECODER)             += dfa.o
 OBJS-$(CONFIG_DNXHD_DECODER)           += dnxhddec.o dnxhddata.o
 OBJS-$(CONFIG_DNXHD_ENCODER)           += dnxhdenc.o dnxhddata.o       \
                                           mpegvideo_enc.o motion_est.o \
@@ -167,7 +172,6 @@ OBJS-$(CONFIG_H264_DECODER)            += h264.o                               \
                                           h264_refs.o h264_cavlc.o h264_cabac.o\
                                           mpegvideo.o error_resilience.o
 OBJS-$(CONFIG_H264_DXVA2_HWACCEL)      += dxva2_h264.o
-OBJS-$(CONFIG_H264_ENCODER)            += h264enc.o h264dspenc.o
 OBJS-$(CONFIG_H264_VAAPI_HWACCEL)      += vaapi_h264.o
 OBJS-$(CONFIG_HUFFYUV_DECODER)         += huffyuv.o
 OBJS-$(CONFIG_HUFFYUV_ENCODER)         += huffyuv.o
@@ -183,6 +187,7 @@ OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o
 OBJS-$(CONFIG_JPEGLS_DECODER)          += jpeglsdec.o jpegls.o \
                                           mjpegdec.o mjpeg.o
 OBJS-$(CONFIG_JPEGLS_ENCODER)          += jpeglsenc.o jpegls.o
+OBJS-$(CONFIG_JV_DECODER)              += jvdec.o
 OBJS-$(CONFIG_KGV1_DECODER)            += kgv1dec.o
 OBJS-$(CONFIG_KMVC_DECODER)            += kmvc.o
 OBJS-$(CONFIG_LAGARITH_DECODER)        += lagarith.o lagarithrac.o
@@ -267,6 +272,7 @@ OBJS-$(CONFIG_MSMPEG4V3_ENCODER)       += msmpeg4.o msmpeg4data.o h263dec.o \
 OBJS-$(CONFIG_MSRLE_DECODER)           += msrle.o msrledec.o
 OBJS-$(CONFIG_MSVIDEO1_DECODER)        += msvideo1.o
 OBJS-$(CONFIG_MSZH_DECODER)            += lcldec.o
+OBJS-$(CONFIG_MXPEG_DECODER)           += mxpegdec.o
 OBJS-$(CONFIG_NELLYMOSER_DECODER)      += nellymoserdec.o nellymoser.o
 OBJS-$(CONFIG_NELLYMOSER_ENCODER)      += nellymoserenc.o nellymoser.o
 OBJS-$(CONFIG_NUV_DECODER)             += nuv.o rtjpeg.o
@@ -335,9 +341,6 @@ OBJS-$(CONFIG_SNOW_ENCODER)            += snow.o rangecoder.o motion_est.o \
                                           ituh263enc.o mpegvideo_enc.o     \
                                           mpeg12data.o
 OBJS-$(CONFIG_SOL_DPCM_DECODER)        += dpcm.o
-OBJS-$(CONFIG_SONIC_DECODER)           += sonic.o
-OBJS-$(CONFIG_SONIC_ENCODER)           += sonic.o
-OBJS-$(CONFIG_SONIC_LS_ENCODER)        += sonic.o
 OBJS-$(CONFIG_SP5X_DECODER)            += sp5xdec.o mjpegdec.o mjpeg.o
 OBJS-$(CONFIG_SRT_DECODER)             += srtdec.o ass.o
 OBJS-$(CONFIG_SUNRAST_DECODER)         += sunrast.o
@@ -415,7 +418,7 @@ OBJS-$(CONFIG_WNV1_DECODER)            += wnv1.o
 OBJS-$(CONFIG_WS_SND1_DECODER)         += ws-snd1.o
 OBJS-$(CONFIG_XAN_DPCM_DECODER)        += dpcm.o
 OBJS-$(CONFIG_XAN_WC3_DECODER)         += xan.o
-OBJS-$(CONFIG_XAN_WC4_DECODER)         += xan.o
+OBJS-$(CONFIG_XAN_WC4_DECODER)         += xxan.o
 OBJS-$(CONFIG_XL_DECODER)              += xl.o
 OBJS-$(CONFIG_XSUB_DECODER)            += xsubdec.o
 OBJS-$(CONFIG_XSUB_ENCODER)            += xsubenc.o
@@ -653,7 +656,7 @@ SKIPHEADERS                            += mpegaudio3.h
 
 EXAMPLES = api
 
-TESTPROGS = cabac dct eval fft h264 iirfilter rangecoder snow
+TESTPROGS = cabac dct eval fft fft-fixed h264 iirfilter rangecoder snow
 TESTPROGS-$(HAVE_MMX) += motion
 TESTOBJS = dctref.o
 
@@ -670,6 +673,9 @@ $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
 $(SUBDIR)cos_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
 	$(M)./$< > $@
 
+$(SUBDIR)cos_fixed_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
+	$(M)./$< cos fixed > $@
+
 $(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
 	$(M)./$< sin > $@
 
@@ -691,7 +697,7 @@ $(SUBDIR)%_tablegen$(HOSTEXESUF): $(SUBDIR)%_tablegen.c $(SUBDIR)%_tablegen.h $(
 	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $(filter %.c,$^) $(HOSTLIBS)
 
 GEN_HEADERS = cbrt_tables.h aacps_tables.h aac_tables.h dv_tables.h     \
-              mdct_tables.h mpegaudio_tables.h motionpixels_tables.h    \
+              sinewin_tables.h mpegaudio_tables.h motionpixels_tables.h \
               pcm_tables.h qdm2_tables.h
 GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS))
 
@@ -703,7 +709,7 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
 $(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h
 $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
 $(SUBDIR)dv.o: $(SUBDIR)dv_tables.h
-$(SUBDIR)mdct.o: $(SUBDIR)mdct_tables.h
+$(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h
 $(SUBDIR)mpegaudiodec.o: $(SUBDIR)mpegaudio_tables.h
 $(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h
 $(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h
diff --git a/ffmpeg-mt/libavcodec/a64colors.h b/ffmpeg-mt/libavcodec/a64colors.h
index a9cdb6f..d977426 100644
--- a/ffmpeg-mt/libavcodec/a64colors.h
+++ b/ffmpeg-mt/libavcodec/a64colors.h
@@ -2,20 +2,20 @@
  * a64 video encoder - c64 colors in rgb (Pepto)
  * Copyright (c) 2009 Tobias Bindhammer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/a64enc.h b/ffmpeg-mt/libavcodec/a64enc.h
index fb559ba..b64b952 100644
--- a/ffmpeg-mt/libavcodec/a64enc.h
+++ b/ffmpeg-mt/libavcodec/a64enc.h
@@ -2,20 +2,20 @@
  * a64 video encoder - basic headers
  * Copyright (c) 2009 Tobias Bindhammer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/a64multienc.c b/ffmpeg-mt/libavcodec/a64multienc.c
index d465996..3b45e5a 100644
--- a/ffmpeg-mt/libavcodec/a64multienc.c
+++ b/ffmpeg-mt/libavcodec/a64multienc.c
@@ -2,20 +2,20 @@
  * a64 video encoder - multicolor modes
  * Copyright (c) 2009 Tobias Bindhammer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -362,7 +362,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
     return 0;
 }
 
-AVCodec a64multi_encoder = {
+AVCodec ff_a64multi_encoder = {
     .name           = "a64multi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_A64_MULTI,
@@ -370,12 +370,12 @@ AVCodec a64multi_encoder = {
     .init           = a64multi_init_encoder,
     .encode         = a64multi_encode_frame,
     .close          = a64multi_close_encoder,
-    .pix_fmts       = (enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
+    .pix_fmts       = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
     .long_name      = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
     .capabilities   = CODEC_CAP_DELAY,
 };
 
-AVCodec a64multi5_encoder = {
+AVCodec ff_a64multi5_encoder = {
     .name           = "a64multi5",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_A64_MULTI5,
@@ -383,7 +383,7 @@ AVCodec a64multi5_encoder = {
     .init           = a64multi_init_encoder,
     .encode         = a64multi_encode_frame,
     .close          = a64multi_close_encoder,
-    .pix_fmts       = (enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
+    .pix_fmts       = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
     .long_name      = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
     .capabilities   = CODEC_CAP_DELAY,
 };
diff --git a/ffmpeg-mt/libavcodec/a64tables.h b/ffmpeg-mt/libavcodec/a64tables.h
index a955ef4..b95c5ce 100644
--- a/ffmpeg-mt/libavcodec/a64tables.h
+++ b/ffmpeg-mt/libavcodec/a64tables.h
@@ -2,20 +2,20 @@
  * a64 video encoder - tables used by a64 encoders
  * Copyright (c) 2009 Tobias Bindhammer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aac.h b/ffmpeg-mt/libavcodec/aac.h
index b40d2c0..e3385e2 100644
--- a/ffmpeg-mt/libavcodec/aac.h
+++ b/ffmpeg-mt/libavcodec/aac.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
  * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -35,6 +35,7 @@
 #include "fft.h"
 #include "mpeg4audio.h"
 #include "sbr.h"
+#include "fmtconvert.h"
 
 #include <stdint.h>
 
@@ -42,6 +43,7 @@
 #define MAX_ELEM_ID 16
 
 #define TNS_MAX_ORDER 20
+#define MAX_LTP_LONG_SFB 40
 
 enum RawDataBlockType {
     TYPE_SCE,
@@ -130,6 +132,16 @@ typedef struct {
 #define SCALE_DIFF_ZERO  60    ///< codebook index corresponding to zero scalefactor indices difference
 
 /**
+ * Long Term Prediction
+ */
+typedef struct {
+    int8_t present;
+    int16_t lag;
+    float coef;
+    int8_t used[MAX_LTP_LONG_SFB];
+} LongTermPrediction;
+
+/**
  * Individual Channel Stream
  */
 typedef struct {
@@ -138,6 +150,7 @@ typedef struct {
     uint8_t use_kb_window[2];   ///< If set, use Kaiser-Bessel window, otherwise use a sinus window.
     int num_window_groups;
     uint8_t group_len[8];
+    LongTermPrediction ltp;
     const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
     const uint8_t *swb_sizes;   ///< table of scalefactor band sizes for a particular window
     int num_swb;                ///< number of scalefactor window bands
@@ -205,14 +218,15 @@ typedef struct {
     IndividualChannelStream ics;
     TemporalNoiseShaping tns;
     Pulse pulse;
-    enum BandType band_type[128];             ///< band types
-    int band_type_run_end[120];               ///< band type run end points
-    float sf[120];                            ///< scalefactors
-    int sf_idx[128];                          ///< scalefactor indices (used by encoder)
-    uint8_t zeroes[128];                      ///< band is not coded (used by encoder)
-    DECLARE_ALIGNED(16, float, coeffs)[1024]; ///< coefficients for IMDCT
-    DECLARE_ALIGNED(16, float, saved)[1024];  ///< overlap
-    DECLARE_ALIGNED(16, float, ret)[2048];    ///< PCM output
+    enum BandType band_type[128];                   ///< band types
+    int band_type_run_end[120];                     ///< band type run end points
+    float sf[120];                                  ///< scalefactors
+    int sf_idx[128];                                ///< scalefactor indices (used by encoder)
+    uint8_t zeroes[128];                            ///< band is not coded (used by encoder)
+    DECLARE_ALIGNED(16, float,   coeffs)[1024];     ///< coefficients for IMDCT
+    DECLARE_ALIGNED(16, float,   saved)[1024];      ///< overlap
+    DECLARE_ALIGNED(16, float,   ret)[2048];        ///< PCM output
+    DECLARE_ALIGNED(16, int16_t, ltp_state)[3072];  ///< time signal for LTP
     PredictorState predictor_state[MAX_PREDICTORS];
 } SingleChannelElement;
 
@@ -267,7 +281,9 @@ typedef struct {
      */
     FFTContext mdct;
     FFTContext mdct_small;
+    FFTContext mdct_ltp;
     DSPContext dsp;
+    FmtConvertContext fmt_conv;
     int random_state;
     /** @} */
 
@@ -276,7 +292,6 @@ typedef struct {
      * @{
      */
     float *output_data[MAX_CHANNELS];                 ///< Points to each element's 'ret' buffer (PCM output).
-    float add_bias;                                   ///< offset for dsp.float_to_int16
     float sf_scale;                                   ///< Pre-scale for correct IMDCT and dsp.float_to_int16.
     int sf_offset;                                    ///< offset into pow2sf_tab as appropriate for dsp.float_to_int16
     /** @} */
diff --git a/ffmpeg-mt/libavcodec/aac_ac3_parser.c b/ffmpeg-mt/libavcodec/aac_ac3_parser.c
index 8791161..58f30a4 100644
--- a/ffmpeg-mt/libavcodec/aac_ac3_parser.c
+++ b/ffmpeg-mt/libavcodec/aac_ac3_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -94,6 +94,7 @@ get_next:
             avctx->channel_layout = s->channel_layout;
         }
         avctx->frame_size = s->samples;
+        avctx->audio_service_type = s->service_type;
     }
 
     avctx->bit_rate = s->bit_rate;
diff --git a/ffmpeg-mt/libavcodec/aac_ac3_parser.h b/ffmpeg-mt/libavcodec/aac_ac3_parser.h
index 75f6d4b..c4ed816 100644
--- a/ffmpeg-mt/libavcodec/aac_ac3_parser.h
+++ b/ffmpeg-mt/libavcodec/aac_ac3_parser.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -49,6 +49,7 @@ typedef struct AACAC3ParseContext {
     int bit_rate;
     int samples;
     int64_t channel_layout;
+    int service_type;
 
     int remaining_size;
     uint64_t state;
diff --git a/ffmpeg-mt/libavcodec/aac_adtstoasc_bsf.c b/ffmpeg-mt/libavcodec/aac_adtstoasc_bsf.c
index 9b615e6..fbb86f8 100644
--- a/ffmpeg-mt/libavcodec/aac_adtstoasc_bsf.c
+++ b/ffmpeg-mt/libavcodec/aac_adtstoasc_bsf.c
@@ -2,20 +2,20 @@
  * MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration bitstream filter
  * Copyright (c) 2009 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -107,7 +107,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
     return 0;
 }
 
-AVBitStreamFilter aac_adtstoasc_bsf = {
+AVBitStreamFilter ff_aac_adtstoasc_bsf = {
     "aac_adtstoasc",
     sizeof(AACBSFContext),
     aac_adtstoasc_filter,
diff --git a/ffmpeg-mt/libavcodec/aac_parser.c b/ffmpeg-mt/libavcodec/aac_parser.c
index 3ad4610..1c5546e 100644
--- a/ffmpeg-mt/libavcodec/aac_parser.c
+++ b/ffmpeg-mt/libavcodec/aac_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -60,7 +60,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
 }
 
 
-AVCodecParser aac_parser = {
+AVCodecParser ff_aac_parser = {
     { CODEC_ID_AAC },
     sizeof(AACAC3ParseContext),
     aac_parse_init,
diff --git a/ffmpeg-mt/libavcodec/aac_tablegen.c b/ffmpeg-mt/libavcodec/aac_tablegen.c
index 33a179f..b2c6c95 100644
--- a/ffmpeg-mt/libavcodec/aac_tablegen.c
+++ b/ffmpeg-mt/libavcodec/aac_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aac_tablegen.h b/ffmpeg-mt/libavcodec/aac_tablegen.h
index 3a820ba..c7be492 100644
--- a/ffmpeg-mt/libavcodec/aac_tablegen.h
+++ b/ffmpeg-mt/libavcodec/aac_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aac_tablegen_decl.h b/ffmpeg-mt/libavcodec/aac_tablegen_decl.h
index 9a90a09..ce4ecb5 100644
--- a/ffmpeg-mt/libavcodec/aac_tablegen_decl.h
+++ b/ffmpeg-mt/libavcodec/aac_tablegen_decl.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacadtsdec.c b/ffmpeg-mt/libavcodec/aacadtsdec.c
index fd86d28..a9ff8ef 100644
--- a/ffmpeg-mt/libavcodec/aacadtsdec.c
+++ b/ffmpeg-mt/libavcodec/aacadtsdec.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2003 Michael Niedermayer
  * Copyright (c) 2009 Alex Converse
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacadtsdec.h b/ffmpeg-mt/libavcodec/aacadtsdec.h
index 6e0a869..2fa1b4b 100644
--- a/ffmpeg-mt/libavcodec/aacadtsdec.h
+++ b/ffmpeg-mt/libavcodec/aacadtsdec.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aaccoder.c b/ffmpeg-mt/libavcodec/aaccoder.c
index 8063fb6..e7f8cb0 100644
--- a/ffmpeg-mt/libavcodec/aaccoder.c
+++ b/ffmpeg-mt/libavcodec/aaccoder.c
@@ -2,20 +2,20 @@
  * AAC coefficients encoder
  * Copyright (C) 2008-2009 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -110,7 +110,7 @@ static av_always_inline float quantize_and_encode_band_cost_template(
     const float IQ = ff_aac_pow2sf_tab[200 + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
     const float  Q = ff_aac_pow2sf_tab[200 - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
     const float CLIPPED_ESCAPE = 165140.0f*IQ;
-    int i, j, k;
+    int i, j;
     float cost = 0;
     const int dim = BT_PAIR ? 2 : 4;
     int resbits = 0;
@@ -146,34 +146,34 @@ static av_always_inline float quantize_and_encode_band_cost_template(
             curidx *= range;
             curidx += quants[j] + off;
         }
-            curbits =  ff_aac_spectral_bits[cb-1][curidx];
-            vec     = &ff_aac_codebook_vectors[cb-1][curidx*dim];
-            if (BT_UNSIGNED) {
-                for (k = 0; k < dim; k++) {
-                    float t = fabsf(in[i+k]);
-                    float di;
-                    if (BT_ESC && vec[k] == 64.0f) { //FIXME: slow
-                        if (t >= CLIPPED_ESCAPE) {
-                            di = t - CLIPPED_ESCAPE;
-                            curbits += 21;
-                        } else {
-                            int c = av_clip(quant(t, Q), 0, 8191);
-                            di = t - c*cbrtf(c)*IQ;
-                            curbits += av_log2(c)*2 - 4 + 1;
-                        }
+        curbits =  ff_aac_spectral_bits[cb-1][curidx];
+        vec     = &ff_aac_codebook_vectors[cb-1][curidx*dim];
+        if (BT_UNSIGNED) {
+            for (j = 0; j < dim; j++) {
+                float t = fabsf(in[i+j]);
+                float di;
+                if (BT_ESC && vec[j] == 64.0f) { //FIXME: slow
+                    if (t >= CLIPPED_ESCAPE) {
+                        di = t - CLIPPED_ESCAPE;
+                        curbits += 21;
                     } else {
-                        di = t - vec[k]*IQ;
+                        int c = av_clip(quant(t, Q), 0, 8191);
+                        di = t - c*cbrtf(c)*IQ;
+                        curbits += av_log2(c)*2 - 4 + 1;
                     }
-                    if (vec[k] != 0.0f)
-                        curbits++;
-                    rd += di*di;
-                }
-            } else {
-                for (k = 0; k < dim; k++) {
-                    float di = in[i+k] - vec[k]*IQ;
-                    rd += di*di;
+                } else {
+                    di = t - vec[j]*IQ;
                 }
+                if (vec[j] != 0.0f)
+                    curbits++;
+                rd += di*di;
             }
+        } else {
+            for (j = 0; j < dim; j++) {
+                float di = in[i+j] - vec[j]*IQ;
+                rd += di*di;
+            }
+        }
         cost    += rd * lambda + curbits;
         resbits += curbits;
         if (cost >= uplim)
@@ -575,7 +575,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
         int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512);
         q1 = qnrg + 30;
         q0 = qnrg - 30;
-    //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
+        //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
         if (q0 < q0low) {
             q1 += q0low - q0;
             q0  = q0low;
@@ -723,7 +723,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
             sce->zeroes[w*16+g] = !nz;
             if (nz)
                 minthr = FFMIN(minthr, uplim);
-            allz = FFMAX(allz, nz);
+            allz |= nz;
         }
     }
     for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
@@ -817,7 +817,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
                 int prevsc = sce->sf_idx[w*16+g];
                 if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
                     if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
-                    sce->sf_idx[w*16+g]--;
+                        sce->sf_idx[w*16+g]--;
                     else //Try to make sure there is some energy in every band
                         sce->sf_idx[w*16+g]-=2;
                 }
@@ -1057,7 +1057,7 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe,
                     for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
                         M[i] = (sce0->coeffs[start+w2*128+i]
                               + sce1->coeffs[start+w2*128+i]) * 0.5;
-                        S[i] =  sce0->coeffs[start+w2*128+i]
+                        S[i] =  M[i]
                               - sce1->coeffs[start+w2*128+i];
                     }
                     abs_pow34_v(L34, sce0->coeffs+start+w2*128, sce0->ics.swb_sizes[g]);
diff --git a/ffmpeg-mt/libavcodec/aacdec.c b/ffmpeg-mt/libavcodec/aacdec.c
index fa527da..3ce0dce 100644
--- a/ffmpeg-mt/libavcodec/aacdec.c
+++ b/ffmpeg-mt/libavcodec/aacdec.c
@@ -7,20 +7,20 @@
  * Copyright (c) 2008-2010 Paul Kendall <paul at kcbbs.gen.nz>
  * Copyright (c) 2010      Janne Grunau <janne-ffmpeg at jannau.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -42,7 +42,7 @@
  * Y                    filterbank - standard
  * N (code in SoC repo) filterbank - Scalable Sample Rate
  * Y                    Temporal Noise Shaping
- * N (code in SoC repo) Long Term Prediction
+ * Y                    Long Term Prediction
  * Y                    intensity stereo
  * Y                    channel coupling
  * Y                    frequency domain prediction
@@ -85,7 +85,10 @@
 #include "get_bits.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "fmtconvert.h"
 #include "lpc.h"
+#include "kbdwin.h"
+#include "sinewin.h"
 
 #include "aac.h"
 #include "aactab.h"
@@ -167,7 +170,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
 /**
  * Check for the channel element in the current channel position configuration.
  * If it exists, make sure the appropriate element is allocated and map the
- * channel order to match the internal FFmpeg channel layout.
+ * channel order to match the internal Libav channel layout.
  *
  * @param   che_pos current channel position configuration
  * @param   type channel element type
@@ -477,6 +480,7 @@ static int decode_audio_specific_config(AACContext *ac,
     switch (m4ac->object_type) {
     case AOT_AAC_MAIN:
     case AOT_AAC_LC:
+    case AOT_AAC_LTP:
         if (decode_ga_specific_config(ac, avctx, &gb, m4ac, m4ac->chan_config))
             return -1;
         break;
@@ -562,22 +566,15 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
     ff_aac_sbr_init();
 
     dsputil_init(&ac->dsp, avctx);
+    ff_fmt_convert_init(&ac->fmt_conv, avctx);
 
     ac->random_state = 0x1f2e3d4c;
 
     // -1024 - Compensate wrong IMDCT method.
-    // 32768 - Required to scale values to the correct range for the bias method
-    //         for float to int16 conversion.
-
-    if (ac->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        ac->add_bias  = 385.0f;
-        ac->sf_scale  = 1. / (-1024. * 32768.);
-        ac->sf_offset = 0;
-    } else {
-        ac->add_bias  = 0.0f;
-        ac->sf_scale  = 1. / -1024.;
-        ac->sf_offset = 60;
-    }
+    // 60    - Required to scale values to the correct range [-32768,32767]
+    //         for float to int16 conversion. (1 << (60 / 4)) == 32768
+    ac->sf_scale  = 1. / -1024.;
+    ac->sf_offset = 60;
 
     ff_aac_tableinit();
 
@@ -586,8 +583,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
                     ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]),
                     352);
 
-    ff_mdct_init(&ac->mdct, 11, 1, 1.0);
-    ff_mdct_init(&ac->mdct_small, 8, 1, 1.0);
+    ff_mdct_init(&ac->mdct,       11, 1, 1.0);
+    ff_mdct_init(&ac->mdct_small,  8, 1, 1.0);
+    ff_mdct_init(&ac->mdct_ltp,   11, 0, 1.0);
     // window initialization
     ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
     ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
@@ -637,6 +635,20 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
 }
 
 /**
+ * Decode Long Term Prediction data; reference: table 4.xx.
+ */
+static void decode_ltp(AACContext *ac, LongTermPrediction *ltp,
+                       GetBitContext *gb, uint8_t max_sfb)
+{
+    int sfb;
+
+    ltp->lag  = get_bits(gb, 11);
+    ltp->coef = ltp_coef[get_bits(gb, 3)] * ac->sf_scale;
+    for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++)
+        ltp->used[sfb] = get_bits1(gb);
+}
+
+/**
  * Decode Individual Channel Stream info; reference: table 4.6.
  *
  * @param   common_window   Channels have independent [0], or shared [1], Individual Channel Stream information.
@@ -690,9 +702,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
                 memset(ics, 0, sizeof(IndividualChannelStream));
                 return -1;
             } else {
-                av_log_missing_feature(ac->avctx, "Predictor bit set but LTP is", 1);
-                memset(ics, 0, sizeof(IndividualChannelStream));
-                return -1;
+                if ((ics->ltp.present = get_bits(gb, 1)))
+                    decode_ltp(ac, &ics->ltp, gb, ics->max_sfb);
             }
         }
     }
@@ -1062,9 +1073,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
 
                             UPDATE_CACHE(re, gb);
                             GET_VLC(code, re, gb, vlc_tab, 8, 2);
-#if MIN_CACHE_BITS < 20
-                            UPDATE_CACHE(re, gb);
-#endif
                             cb_idx = cb_vector_idx[code];
                             nnz = cb_idx >> 8 & 15;
                             bits = SHOW_UBITS(re, gb, nnz) << (32-nnz);
@@ -1157,12 +1165,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
                                         return -1;
                                     }
 
-#if MIN_CACHE_BITS < 21
-                                    LAST_SKIP_BITS(re, gb, b + 1);
-                                    UPDATE_CACHE(re, gb);
-#else
                                     SKIP_BITS(re, gb, b + 1);
-#endif
                                     b += 4;
                                     n = (1 << b) + SHOW_UBITS(re, gb, b);
                                     LAST_SKIP_BITS(re, gb, b);
@@ -1385,13 +1388,13 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
  *                      [1] mask is decoded from bitstream; [2] mask is all 1s;
  *                      [3] reserved for scalable AAC
  */
-static void apply_intensity_stereo(ChannelElement *cpe, int ms_present)
+static void apply_intensity_stereo(AACContext *ac, ChannelElement *cpe, int ms_present)
 {
     const IndividualChannelStream *ics = &cpe->ch[1].ics;
     SingleChannelElement         *sce1 = &cpe->ch[1];
     float *coef0 = cpe->ch[0].coeffs, *coef1 = cpe->ch[1].coeffs;
     const uint16_t *offsets = ics->swb_offset;
-    int g, group, i, k, idx = 0;
+    int g, group, i, idx = 0;
     int c;
     float scale;
     for (g = 0; g < ics->num_window_groups; g++) {
@@ -1404,8 +1407,10 @@ static void apply_intensity_stereo(ChannelElement *cpe, int ms_present)
                         c *= 1 - 2 * cpe->ms_mask[idx];
                     scale = c * sce1->sf[idx];
                     for (group = 0; group < ics->group_len[g]; group++)
-                        for (k = offsets[i]; k < offsets[i + 1]; k++)
-                            coef1[group * 128 + k] = scale * coef0[group * 128 + k];
+                        ac->dsp.vector_fmul_scalar(coef1 + group * 128 + offsets[i],
+                                                   coef0 + group * 128 + offsets[i],
+                                                   scale,
+                                                   offsets[i + 1] - offsets[i]);
                 }
             } else {
                 int bt_run_end = sce1->band_type_run_end[idx];
@@ -1434,6 +1439,9 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
         i = cpe->ch[1].ics.use_kb_window[0];
         cpe->ch[1].ics = cpe->ch[0].ics;
         cpe->ch[1].ics.use_kb_window[1] = i;
+        if (cpe->ch[1].ics.predictor_present && (ac->m4ac.object_type != AOT_AAC_MAIN))
+            if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1)))
+                decode_ltp(ac, &cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb);
         ms_present = get_bits(gb, 2);
         if (ms_present == 3) {
             av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
@@ -1455,7 +1463,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
         }
     }
 
-    apply_intensity_stereo(cpe, ms_present);
+    apply_intensity_stereo(ac, cpe, ms_present);
     return 0;
 }
 
@@ -1673,6 +1681,7 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns,
     int w, filt, m, i;
     int bottom, top, order, start, end, size, inc;
     float lpc[TNS_MAX_ORDER];
+    float tmp[TNS_MAX_ORDER];
 
     for (w = 0; w < ics->num_windows; w++) {
         bottom = ics->num_swb;
@@ -1698,18 +1707,125 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns,
             }
             start += w * 128;
 
-            // ar filter
-            for (m = 0; m < size; m++, start += inc)
-                for (i = 1; i <= FFMIN(m, order); i++)
-                    coef[start] -= coef[start - i * inc] * lpc[i - 1];
+            if (decode) {
+                // ar filter
+                for (m = 0; m < size; m++, start += inc)
+                    for (i = 1; i <= FFMIN(m, order); i++)
+                        coef[start] -= coef[start - i * inc] * lpc[i - 1];
+            } else {
+                // ma filter
+                for (m = 0; m < size; m++, start += inc) {
+                    tmp[0] = coef[start];
+                    for (i = 1; i <= FFMIN(m, order); i++)
+                        coef[start] += tmp[i] * lpc[i - 1];
+                    for (i = order; i > 0; i--)
+                        tmp[i] = tmp[i - 1];
+                }
+            }
         }
     }
 }
 
 /**
+ *  Apply windowing and MDCT to obtain the spectral
+ *  coefficient from the predicted sample by LTP.
+ */
+static void windowing_and_mdct_ltp(AACContext *ac, float *out,
+                                   float *in, IndividualChannelStream *ics)
+{
+    const float *lwindow      = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
+    const float *swindow      = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
+    const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024;
+    const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
+
+    if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
+        ac->dsp.vector_fmul(in, in, lwindow_prev, 1024);
+    } else {
+        memset(in, 0, 448 * sizeof(float));
+        ac->dsp.vector_fmul(in + 448, in + 448, swindow_prev, 128);
+        memcpy(in + 576, in + 576, 448 * sizeof(float));
+    }
+    if (ics->window_sequence[0] != LONG_START_SEQUENCE) {
+        ac->dsp.vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024);
+    } else {
+        memcpy(in + 1024, in + 1024, 448 * sizeof(float));
+        ac->dsp.vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128);
+        memset(in + 1024 + 576, 0, 448 * sizeof(float));
+    }
+    ac->mdct_ltp.mdct_calc(&ac->mdct_ltp, out, in);
+}
+
+/**
+ * Apply the long term prediction
+ */
+static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
+{
+    const LongTermPrediction *ltp = &sce->ics.ltp;
+    const uint16_t *offsets = sce->ics.swb_offset;
+    int i, sfb;
+
+    if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
+        float *predTime = sce->ret;
+        float *predFreq = ac->buf_mdct;
+        int16_t num_samples = 2048;
+
+        if (ltp->lag < 1024)
+            num_samples = ltp->lag + 1024;
+        for (i = 0; i < num_samples; i++)
+            predTime[i] = sce->ltp_state[i + 2048 - ltp->lag] * ltp->coef;
+        memset(&predTime[i], 0, (2048 - i) * sizeof(float));
+
+        windowing_and_mdct_ltp(ac, predFreq, predTime, &sce->ics);
+
+        if (sce->tns.present)
+            apply_tns(predFreq, &sce->tns, &sce->ics, 0);
+
+        for (sfb = 0; sfb < FFMIN(sce->ics.max_sfb, MAX_LTP_LONG_SFB); sfb++)
+            if (ltp->used[sfb])
+                for (i = offsets[sfb]; i < offsets[sfb + 1]; i++)
+                    sce->coeffs[i] += predFreq[i];
+    }
+}
+
+/**
+ * Update the LTP buffer for next frame
+ */
+static void update_ltp(AACContext *ac, SingleChannelElement *sce)
+{
+    IndividualChannelStream *ics = &sce->ics;
+    float *saved     = sce->saved;
+    float *saved_ltp = sce->coeffs;
+    const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
+    const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
+    int i;
+
+    if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
+        memcpy(saved_ltp,       saved, 512 * sizeof(float));
+        memset(saved_ltp + 576, 0,     448 * sizeof(float));
+        ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960,     &swindow[64],      64);
+        for (i = 0; i < 64; i++)
+            saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i];
+    } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) {
+        memcpy(saved_ltp,       ac->buf_mdct + 512, 448 * sizeof(float));
+        memset(saved_ltp + 576, 0,                  448 * sizeof(float));
+        ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960,     &swindow[64],      64);
+        for (i = 0; i < 64; i++)
+            saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i];
+    } else { // LONG_STOP or ONLY_LONG
+        ac->dsp.vector_fmul_reverse(saved_ltp,       ac->buf_mdct + 512,     &lwindow[512],     512);
+        for (i = 0; i < 512; i++)
+            saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * lwindow[511 - i];
+    }
+
+    memcpy(sce->ltp_state, &sce->ltp_state[1024], 1024 * sizeof(int16_t));
+    ac->fmt_conv.float_to_int16(&(sce->ltp_state[1024]), sce->ret,  1024);
+    ac->fmt_conv.float_to_int16(&(sce->ltp_state[2048]), saved_ltp, 1024);
+}
+
+/**
  * Conduct IMDCT and windowing.
  */
-static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float bias)
+static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
 {
     IndividualChannelStream *ics = &sce->ics;
     float *in    = sce->coeffs;
@@ -1725,9 +1841,9 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float
     // imdct
     if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
         for (i = 0; i < 1024; i += 128)
-            ff_imdct_half(&ac->mdct_small, buf + i, in + i);
+            ac->mdct_small.imdct_half(&ac->mdct_small, buf + i, in + i);
     } else
-        ff_imdct_half(&ac->mdct, buf, in);
+        ac->mdct.imdct_half(&ac->mdct, buf, in);
 
     /* window overlapping
      * NOTE: To simplify the overlapping code, all 'meaningless' short to long
@@ -1737,32 +1853,29 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float
      */
     if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) &&
             (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) {
-        ac->dsp.vector_fmul_window(    out,               saved,            buf,         lwindow_prev, bias, 512);
+        ac->dsp.vector_fmul_window(    out,               saved,            buf,         lwindow_prev, 512);
     } else {
-        for (i = 0; i < 448; i++)
-            out[i] = saved[i] + bias;
+        memcpy(                        out,               saved,            448 * sizeof(float));
 
         if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
-            ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448,      buf + 0*128, swindow_prev, bias, 64);
-            ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow,      bias, 64);
-            ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow,      bias, 64);
-            ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow,      bias, 64);
-            ac->dsp.vector_fmul_window(temp,              buf + 3*128 + 64, buf + 4*128, swindow,      bias, 64);
+            ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448,      buf + 0*128, swindow_prev, 64);
+            ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow,      64);
+            ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow,      64);
+            ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow,      64);
+            ac->dsp.vector_fmul_window(temp,              buf + 3*128 + 64, buf + 4*128, swindow,      64);
             memcpy(                    out + 448 + 4*128, temp, 64 * sizeof(float));
         } else {
-            ac->dsp.vector_fmul_window(out + 448,         saved + 448,      buf,         swindow_prev, bias, 64);
-            for (i = 576; i < 1024; i++)
-                out[i] = buf[i-512] + bias;
+            ac->dsp.vector_fmul_window(out + 448,         saved + 448,      buf,         swindow_prev, 64);
+            memcpy(                    out + 576,         buf + 64,         448 * sizeof(float));
         }
     }
 
     // buffer update
     if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
-        for (i = 0; i < 64; i++)
-            saved[i] = temp[64 + i] - bias;
-        ac->dsp.vector_fmul_window(saved + 64,  buf + 4*128 + 64, buf + 5*128, swindow, 0, 64);
-        ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 0, 64);
-        ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 0, 64);
+        memcpy(                    saved,       temp + 64,         64 * sizeof(float));
+        ac->dsp.vector_fmul_window(saved + 64,  buf + 4*128 + 64, buf + 5*128, swindow, 64);
+        ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 64);
+        ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 64);
         memcpy(                    saved + 448, buf + 7*128 + 64,  64 * sizeof(float));
     } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) {
         memcpy(                    saved,       buf + 512,        448 * sizeof(float));
@@ -1819,13 +1932,12 @@ static void apply_independent_coupling(AACContext *ac,
 {
     int i;
     const float gain = cce->coup.gain[index][0];
-    const float bias = ac->add_bias;
     const float *src = cce->ch[0].ret;
     float *dest = target->ret;
     const int len = 1024 << (ac->m4ac.sbr == 1);
 
     for (i = 0; i < len; i++)
-        dest[i] += gain * (src[i] - bias);
+        dest[i] += gain * src[i];
 }
 
 /**
@@ -1869,13 +1981,20 @@ static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
 static void spectral_to_sample(AACContext *ac)
 {
     int i, type;
-    float imdct_bias = (ac->m4ac.sbr <= 0) ? ac->add_bias : 0.0f;
     for (type = 3; type >= 0; type--) {
         for (i = 0; i < MAX_ELEM_ID; i++) {
             ChannelElement *che = ac->che[type][i];
             if (che) {
                 if (type <= TYPE_CPE)
                     apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling);
+                if (ac->m4ac.object_type == AOT_AAC_LTP) {
+                    if (che->ch[0].ics.predictor_present) {
+                        if (che->ch[0].ics.ltp.present)
+                            apply_ltp(ac, &che->ch[0]);
+                        if (che->ch[1].ics.ltp.present && type == TYPE_CPE)
+                            apply_ltp(ac, &che->ch[1]);
+                    }
+                }
                 if (che->ch[0].tns.present)
                     apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1);
                 if (che->ch[1].tns.present)
@@ -1883,9 +2002,13 @@ static void spectral_to_sample(AACContext *ac)
                 if (type <= TYPE_CPE)
                     apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling);
                 if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) {
-                    imdct_and_windowing(ac, &che->ch[0], imdct_bias);
+                    imdct_and_windowing(ac, &che->ch[0]);
+                    if (ac->m4ac.object_type == AOT_AAC_LTP)
+                        update_ltp(ac, &che->ch[0]);
                     if (type == TYPE_CPE) {
-                        imdct_and_windowing(ac, &che->ch[1], imdct_bias);
+                        imdct_and_windowing(ac, &che->ch[1]);
+                        if (ac->m4ac.object_type == AOT_AAC_LTP)
+                            update_ltp(ac, &che->ch[1]);
                     }
                     if (ac->m4ac.sbr > 0) {
                         ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret);
@@ -2053,7 +2176,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
     *data_size = data_size_tmp;
 
     if (samples)
-        ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
+        ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
 
     if (ac->output_configured)
         ac->output_configured = OC_LOCKED;
@@ -2099,6 +2222,7 @@ static av_cold int aac_decode_close(AVCodecContext *avctx)
 
     ff_mdct_end(&ac->mdct);
     ff_mdct_end(&ac->mdct_small);
+    ff_mdct_end(&ac->mdct_ltp);
     return 0;
 }
 
@@ -2359,7 +2483,7 @@ av_cold static int latm_decode_init(AVCodecContext *avctx)
 }
 
 
-AVCodec aac_decoder = {
+AVCodec ff_aac_decoder = {
     "aac",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AAC,
@@ -2380,9 +2504,9 @@ AVCodec aac_decoder = {
     in MPEG transport streams which only contain one program.
     To do a more complex LATM demuxing a separate LATM demuxer should be used.
 */
-AVCodec aac_latm_decoder = {
+AVCodec ff_aac_latm_decoder = {
     .name = "aac_latm",
-    .type = CODEC_TYPE_AUDIO,
+    .type = AVMEDIA_TYPE_AUDIO,
     .id   = CODEC_ID_AAC_LATM,
     .priv_data_size = sizeof(struct LATMContext),
     .init   = latm_decode_init,
diff --git a/ffmpeg-mt/libavcodec/aacdectab.h b/ffmpeg-mt/libavcodec/aacdectab.h
index b4307f1..64c2a1c 100644
--- a/ffmpeg-mt/libavcodec/aacdectab.h
+++ b/ffmpeg-mt/libavcodec/aacdectab.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
  * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,11 +30,19 @@
 #ifndef AVCODEC_AACDECTAB_H
 #define AVCODEC_AACDECTAB_H
 
-#include "libavcore/audioconvert.h"
+#include "libavutil/audioconvert.h"
 #include "aac.h"
 
 #include <stdint.h>
 
+/* @name ltp_coef
+ * Table of the LTP coefficient (multiplied by 2)
+ */
+static const float ltp_coef[8] = {
+     1.141658,    1.393232,    1.626008,    1.822608,
+     1.969800,    2.135788,    2.2389202,   2.739066,
+};
+
 /* @name tns_tmp2_map
  * Tables of the tmp2[] arrays of LPC coefficients used for TNS.
  * The suffix _M_N[] indicate the values of coef_compress and coef_res
diff --git a/ffmpeg-mt/libavcodec/aacenc.c b/ffmpeg-mt/libavcodec/aacenc.c
index c52ffa0..d4b6112 100644
--- a/ffmpeg-mt/libavcodec/aacenc.c
+++ b/ffmpeg-mt/libavcodec/aacenc.c
@@ -2,20 +2,20 @@
  * AAC encoder
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -34,6 +34,8 @@
 #include "put_bits.h"
 #include "dsputil.h"
 #include "mpeg4audio.h"
+#include "kbdwin.h"
+#include "sinewin.h"
 
 #include "aac.h"
 #include "aactab.h"
@@ -149,6 +151,11 @@ static void put_audio_specific_config(AVCodecContext *avctx)
     put_bits(&pb, 1, 0); //frame length - 1024 samples
     put_bits(&pb, 1, 0); //does not depend on core coder
     put_bits(&pb, 1, 0); //is not extension
+
+    //Explicitly Mark SBR absent
+    put_bits(&pb, 11, 0x2b7); //sync extension
+    put_bits(&pb, 5,  AOT_SBR);
+    put_bits(&pb, 1,  0);
     flush_put_bits(&pb);
 }
 
@@ -193,8 +200,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
 
     s->samples            = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0]));
     s->cpe                = av_mallocz(sizeof(ChannelElement) * aac_chan_configs[avctx->channels-1][0]);
-    avctx->extradata      = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE);
-    avctx->extradata_size = 2;
+    avctx->extradata      = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);
+    avctx->extradata_size = 5;
     put_audio_specific_config(avctx);
 
     sizes[0]   = swb_size_1024[i];
@@ -220,40 +227,41 @@ static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s,
     const float * lwindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
     const float * swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
     const float * pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
+    float *output = sce->ret;
 
     if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
-        memcpy(s->output, sce->saved, sizeof(float)*1024);
+        memcpy(output, sce->saved, sizeof(float)*1024);
         if (sce->ics.window_sequence[0] == LONG_STOP_SEQUENCE) {
-            memset(s->output, 0, sizeof(s->output[0]) * 448);
+            memset(output, 0, sizeof(output[0]) * 448);
             for (i = 448; i < 576; i++)
-                s->output[i] = sce->saved[i] * pwindow[i - 448];
+                output[i] = sce->saved[i] * pwindow[i - 448];
             for (i = 576; i < 704; i++)
-                s->output[i] = sce->saved[i];
+                output[i] = sce->saved[i];
         }
         if (sce->ics.window_sequence[0] != LONG_START_SEQUENCE) {
             for (i = 0; i < 1024; i++) {
-                s->output[i+1024]         = audio[i * chans] * lwindow[1024 - i - 1];
+                output[i+1024]         = audio[i * chans] * lwindow[1024 - i - 1];
                 sce->saved[i] = audio[i * chans] * lwindow[i];
             }
         } else {
             for (i = 0; i < 448; i++)
-                s->output[i+1024]         = audio[i * chans];
+                output[i+1024]         = audio[i * chans];
             for (; i < 576; i++)
-                s->output[i+1024]         = audio[i * chans] * swindow[576 - i - 1];
-            memset(s->output+1024+576, 0, sizeof(s->output[0]) * 448);
+                output[i+1024]         = audio[i * chans] * swindow[576 - i - 1];
+            memset(output+1024+576, 0, sizeof(output[0]) * 448);
             for (i = 0; i < 1024; i++)
                 sce->saved[i] = audio[i * chans];
         }
-        ff_mdct_calc(&s->mdct1024, sce->coeffs, s->output);
+        s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output);
     } else {
         for (k = 0; k < 1024; k += 128) {
             for (i = 448 + k; i < 448 + k + 256; i++)
-                s->output[i - 448 - k] = (i < 1024)
+                output[i - 448 - k] = (i < 1024)
                                          ? sce->saved[i]
                                          : audio[(i-1024)*chans];
-            s->dsp.vector_fmul        (s->output,     k ?  swindow : pwindow, 128);
-            s->dsp.vector_fmul_reverse(s->output+128, s->output+128, swindow, 128);
-            ff_mdct_calc(&s->mdct128, sce->coeffs + k, s->output);
+            s->dsp.vector_fmul        (output,     output, k ?  swindow : pwindow, 128);
+            s->dsp.vector_fmul_reverse(output+128, output+128, swindow, 128);
+            s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + k, output);
         }
         for (i = 0; i < 1024; i++)
             sce->saved[i] = audio[i * chans];
@@ -636,7 +644,7 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec aac_encoder = {
+AVCodec ff_aac_encoder = {
     "aac",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AAC,
diff --git a/ffmpeg-mt/libavcodec/aacenc.h b/ffmpeg-mt/libavcodec/aacenc.h
index 86c68d3..3d584d2 100644
--- a/ffmpeg-mt/libavcodec/aacenc.h
+++ b/ffmpeg-mt/libavcodec/aacenc.h
@@ -2,20 +2,20 @@
  * AAC encoder
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -52,8 +52,7 @@ typedef struct AACEncContext {
     FFTContext mdct1024;                         ///< long (1024 samples) frame transform context
     FFTContext mdct128;                          ///< short (128 samples) frame transform context
     DSPContext  dsp;
-    DECLARE_ALIGNED(16, FFTSample, output)[2048]; ///< temporary buffer for MDCT input coefficients
-    int16_t* samples;                            ///< saved preprocessed input
+    int16_t *samples;                            ///< saved preprocessed input
 
     int samplerate_index;                        ///< MPEG-4 samplerate index
 
diff --git a/ffmpeg-mt/libavcodec/aacps.c b/ffmpeg-mt/libavcodec/aacps.c
index fc124d1..724c132 100644
--- a/ffmpeg-mt/libavcodec/aacps.c
+++ b/ffmpeg-mt/libavcodec/aacps.c
@@ -2,20 +2,20 @@
  * MPEG-4 Parametric Stereo decoding functions
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacps.h b/ffmpeg-mt/libavcodec/aacps.h
index 5fc211a..59a9bff 100644
--- a/ffmpeg-mt/libavcodec/aacps.h
+++ b/ffmpeg-mt/libavcodec/aacps.h
@@ -2,20 +2,20 @@
  * MPEG-4 Parametric Stereo definitions and declarations
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacps_tablegen.c b/ffmpeg-mt/libavcodec/aacps_tablegen.c
index dc7797f..8650226 100644
--- a/ffmpeg-mt/libavcodec/aacps_tablegen.c
+++ b/ffmpeg-mt/libavcodec/aacps_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacps_tablegen.h b/ffmpeg-mt/libavcodec/aacps_tablegen.h
index c7e062b..492cb0c 100644
--- a/ffmpeg-mt/libavcodec/aacps_tablegen.h
+++ b/ffmpeg-mt/libavcodec/aacps_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacpsdata.c b/ffmpeg-mt/libavcodec/aacpsdata.c
index 7431cae..675bd8e 100644
--- a/ffmpeg-mt/libavcodec/aacpsdata.c
+++ b/ffmpeg-mt/libavcodec/aacpsdata.c
@@ -2,20 +2,20 @@
  * MPEG-4 Parametric Stereo data tables
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacpsy.c b/ffmpeg-mt/libavcodec/aacpsy.c
index a987be0..4250a5d 100644
--- a/ffmpeg-mt/libavcodec/aacpsy.c
+++ b/ffmpeg-mt/libavcodec/aacpsy.c
@@ -2,20 +2,20 @@
  * AAC encoder psychoacoustic model
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,8 +39,8 @@
  * constants for 3GPP AAC psychoacoustic model
  * @{
  */
-#define PSY_3GPP_SPREAD_HI   1.5f // spreading factor for ascending threshold spreading  (15 dB/Bark)
-#define PSY_3GPP_SPREAD_LOW  3.0f // spreading factor for descending threshold spreading (30 dB/Bark)
+#define PSY_3GPP_THR_SPREAD_HI   1.5f // spreading factor for low-to-hi threshold spreading  (15 dB/Bark)
+#define PSY_3GPP_THR_SPREAD_LOW  3.0f // spreading factor for hi-to-low threshold spreading  (30 dB/Bark)
 
 #define PSY_3GPP_RPEMIN      0.01f
 #define PSY_3GPP_RPELEV      2.0f
@@ -61,9 +61,7 @@
  */
 typedef struct AacPsyBand{
     float energy;    ///< band energy
-    float ffac;      ///< form factor
     float thr;       ///< energy threshold
-    float min_snr;   ///< minimal SNR
     float thr_quiet; ///< threshold in quiet
 }AacPsyBand;
 
@@ -88,17 +86,18 @@ typedef struct AacPsyChannel{
  * psychoacoustic model frame type-dependent coefficients
  */
 typedef struct AacPsyCoeffs{
-    float ath       [64]; ///< absolute threshold of hearing per bands
-    float barks     [64]; ///< Bark value for each spectral band in long frame
-    float spread_low[64]; ///< spreading factor for low-to-high threshold spreading in long frame
-    float spread_hi [64]; ///< spreading factor for high-to-low threshold spreading in long frame
+    float ath;           ///< absolute threshold of hearing per bands
+    float barks;         ///< Bark value for each spectral band in long frame
+    float spread_low[2]; ///< spreading factor for low-to-high threshold spreading in long frame
+    float spread_hi [2]; ///< spreading factor for high-to-low threshold spreading in long frame
+    float min_snr;       ///< minimal SNR
 }AacPsyCoeffs;
 
 /**
  * 3GPP TS26.403-inspired psychoacoustic model specific data
  */
 typedef struct AacPsyContext{
-    AacPsyCoeffs psy_coef[2];
+    AacPsyCoeffs psy_coef[2][64];
     AacPsyChannel *ch;
 }AacPsyContext;
 
@@ -243,27 +242,30 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
 
     minath = ath(3410, ATH_ADD);
     for (j = 0; j < 2; j++) {
-        AacPsyCoeffs *coeffs = &pctx->psy_coef[j];
+        AacPsyCoeffs *coeffs = pctx->psy_coef[j];
+        const uint8_t *band_sizes = ctx->bands[j];
         float line_to_frequency = ctx->avctx->sample_rate / (j ? 256.f : 2048.0f);
         i = 0;
         prev = 0.0;
         for (g = 0; g < ctx->num_bands[j]; g++) {
-            i += ctx->bands[j][g];
+            i += band_sizes[g];
             bark = calc_bark((i-1) * line_to_frequency);
-            coeffs->barks[g] = (bark + prev) / 2.0;
+            coeffs[g].barks = (bark + prev) / 2.0;
             prev = bark;
         }
         for (g = 0; g < ctx->num_bands[j] - 1; g++) {
-            coeffs->spread_low[g] = pow(10.0, -(coeffs->barks[g+1] - coeffs->barks[g]) * PSY_3GPP_SPREAD_LOW);
-            coeffs->spread_hi [g] = pow(10.0, -(coeffs->barks[g+1] - coeffs->barks[g]) * PSY_3GPP_SPREAD_HI);
+            AacPsyCoeffs *coeff = &coeffs[g];
+            float bark_width = coeffs[g+1].barks - coeffs->barks;
+            coeff->spread_low[0] = pow(10.0, -bark_width * PSY_3GPP_THR_SPREAD_LOW);
+            coeff->spread_hi [0] = pow(10.0, -bark_width * PSY_3GPP_THR_SPREAD_HI);
         }
         start = 0;
         for (g = 0; g < ctx->num_bands[j]; g++) {
             minscale = ath(start * line_to_frequency, ATH_ADD);
-            for (i = 1; i < ctx->bands[j][g]; i++)
+            for (i = 1; i < band_sizes[g]; i++)
                 minscale = FFMIN(minscale, ath((start + i) * line_to_frequency, ATH_ADD));
-            coeffs->ath[g] = minscale - minath;
-            start += ctx->bands[j][g];
+            coeffs[g].ath = minscale - minath;
+            start += band_sizes[g];
         }
     }
 
@@ -393,9 +395,9 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel,
     AacPsyChannel *pch  = &pctx->ch[channel];
     int start = 0;
     int i, w, g;
-    const int num_bands       = ctx->num_bands[wi->num_windows == 8];
-    const uint8_t* band_sizes = ctx->bands[wi->num_windows == 8];
-    AacPsyCoeffs *coeffs     = &pctx->psy_coef[wi->num_windows == 8];
+    const int      num_bands  = ctx->num_bands[wi->num_windows == 8];
+    const uint8_t *band_sizes = ctx->bands[wi->num_windows == 8];
+    AacPsyCoeffs  *coeffs     = pctx->psy_coef[wi->num_windows == 8];
 
     //calculate energies, initial thresholds and related values - 5.4.2 "Threshold Calculation"
     for (w = 0; w < wi->num_windows*16; w += 16) {
@@ -406,26 +408,37 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel,
                 band->energy += coefs[start+i] * coefs[start+i];
             band->thr     = band->energy * 0.001258925f;
             start        += band_sizes[g];
-
-            ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].energy = band->energy;
         }
     }
-    //modify thresholds - spread, threshold in quiet - 5.4.3 "Spreaded Energy Calculation"
+    //modify thresholds and energies - spread, threshold in quiet, pre-echo control
     for (w = 0; w < wi->num_windows*16; w += 16) {
-        AacPsyBand *band = &pch->band[w];
+        AacPsyBand *bands = &pch->band[w];
+        //5.4.2.3 "Spreading" & 5.4.3 "Spreaded Energy Calculation"
         for (g = 1; g < num_bands; g++)
-            band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_hi [g]);
+            bands[g].thr = FFMAX(bands[g].thr, bands[g-1].thr * coeffs[g].spread_hi[0]);
         for (g = num_bands - 2; g >= 0; g--)
-            band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_low[g]);
+            bands[g].thr = FFMAX(bands[g].thr, bands[g+1].thr * coeffs[g].spread_low[0]);
+        //5.4.2.4 "Threshold in quiet"
         for (g = 0; g < num_bands; g++) {
-            band[g].thr_quiet = band[g].thr = FFMAX(band[g].thr, coeffs->ath[g]);
+            AacPsyBand *band = &bands[g];
+            band->thr_quiet = band->thr = FFMAX(band->thr, coeffs[g].ath);
+            //5.4.2.5 "Pre-echo control"
             if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w)))
-                band[g].thr = FFMAX(PSY_3GPP_RPEMIN*band[g].thr, FFMIN(band[g].thr,
-                                    PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet));
+                band->thr = FFMAX(PSY_3GPP_RPEMIN*band->thr, FFMIN(band->thr,
+                                  PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet));
+        }
+    }
+
+    for (w = 0; w < wi->num_windows*16; w += 16) {
+        for (g = 0; g < num_bands; g++) {
+            AacPsyBand *band     = &pch->band[w+g];
+            FFPsyBand  *psy_band = &ctx->psy_bands[channel*PSY_MAX_BANDS+w+g];
 
-            ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].threshold = band[g].thr;
+            psy_band->threshold = band->thr;
+            psy_band->energy    = band->energy;
         }
     }
+
     memcpy(pch->prev_band, pch->band, sizeof(pch->band));
 }
 
@@ -553,22 +566,9 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx,
         if (pch->prev_attack == 3 || att_sum) {
             uselongblock = 0;
 
-            if (attacks[1] && attacks[0])
-                attacks[1] = 0;
-            if (attacks[2] && attacks[1])
-                attacks[2] = 0;
-            if (attacks[3] && attacks[2])
-                attacks[3] = 0;
-            if (attacks[4] && attacks[3])
-                attacks[4] = 0;
-            if (attacks[5] && attacks[4])
-                attacks[5] = 0;
-            if (attacks[6] && attacks[5])
-                attacks[6] = 0;
-            if (attacks[7] && attacks[6])
-                attacks[7] = 0;
-            if (attacks[8] && attacks[7])
-                attacks[8] = 0;
+            for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++)
+                if (attacks[i] && attacks[i-1])
+                    attacks[i] = 0;
         }
     } else {
         /* We have no lookahead info, so just use same type as the previous sequence. */
diff --git a/ffmpeg-mt/libavcodec/aacpsy.h b/ffmpeg-mt/libavcodec/aacpsy.h
index 05c93cd..5d1e142 100644
--- a/ffmpeg-mt/libavcodec/aacpsy.h
+++ b/ffmpeg-mt/libavcodec/aacpsy.h
@@ -2,20 +2,20 @@
  * AAC encoder psychoacoustic model
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacsbr.c b/ffmpeg-mt/libavcodec/aacsbr.c
index 050305a..0df5249 100644
--- a/ffmpeg-mt/libavcodec/aacsbr.c
+++ b/ffmpeg-mt/libavcodec/aacsbr.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
  * Copyright (c) 2009-2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1134,16 +1134,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
  * @param   W       array of complex-valued samples split into subbands
  */
 static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x,
-                             float z[320], float W[2][32][32][2],
-                             float scale)
+                             float z[320], float W[2][32][32][2])
 {
     int i, k;
     memcpy(W[0], W[1], sizeof(W[0]));
     memcpy(x    , x+1024, (320-32)*sizeof(x[0]));
-    if (scale != 1.0f)
-        dsp->vector_fmul_scalar(x+288, in, scale, 1024);
-    else
-        memcpy(x+288, in, 1024*sizeof(*x));
+    memcpy(x+288, in,         1024*sizeof(x[0]));
     for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames
                                // are not supported
         dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320);
@@ -1159,7 +1155,7 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in,
         }
         z[64+63] = z[32];
 
-        ff_imdct_half(mdct, z, z+64);
+        mdct->imdct_half(mdct, z, z+64);
         for (k = 0; k < 32; k++) {
             W[1][i][k][0] = -z[63-k];
             W[1][i][k][1] = z[k];
@@ -1175,12 +1171,10 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in,
 static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
                               float *out, float X[2][38][64],
                               float mdct_buf[2][64],
-                              float *v0, int *v_off, const unsigned int div,
-                              float bias, float scale)
+                              float *v0, int *v_off, const unsigned int div)
 {
     int i, n;
     const float *sbr_qmf_window = div ? sbr_qmf_window_ds : sbr_qmf_window_us;
-    int scale_and_bias = scale != 1.0f || bias != 0.0f;
     float *v;
     for (i = 0; i < 32; i++) {
         if (*v_off == 0) {
@@ -1196,7 +1190,7 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
                 X[0][i][   n] = -X[0][i][n];
                 X[0][i][32+n] =  X[1][i][31-n];
             }
-            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
+            mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
             for (n = 0; n < 32; n++) {
                 v[     n] =  mdct_buf[0][63 - 2*n];
                 v[63 - n] = -mdct_buf[0][62 - 2*n];
@@ -1205,8 +1199,8 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
             for (n = 1; n < 64; n+=2) {
                 X[1][i][n] = -X[1][i][n];
             }
-            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
-            ff_imdct_half(mdct, mdct_buf[1], X[1][i]);
+            mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
+            mdct->imdct_half(mdct, mdct_buf[1], X[1][i]);
             for (n = 0; n < 64; n++) {
                 v[      n] = -mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
                 v[127 - n] =  mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
@@ -1222,9 +1216,6 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
         dsp->vector_fmul_add(out, v + ( 960 >> div), sbr_qmf_window + (448 >> div), out   , 64 >> div);
         dsp->vector_fmul_add(out, v + (1024 >> div), sbr_qmf_window + (512 >> div), out   , 64 >> div);
         dsp->vector_fmul_add(out, v + (1216 >> div), sbr_qmf_window + (576 >> div), out   , 64 >> div);
-        if (scale_and_bias)
-            for (n = 0; n < 64 >> div; n++)
-                out[n] = out[n] * scale + bias;
         out += 64 >> div;
     }
 }
@@ -1727,7 +1718,7 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
         /* decode channel */
         sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
                          (float*)sbr->qmf_filter_scratch,
-                         sbr->data[ch].W, 1/(-1024 * ac->sf_scale));
+                         sbr->data[ch].W);
         sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W);
         if (sbr->start) {
             sbr_hf_inverse_filter(sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]);
@@ -1760,12 +1751,10 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
     sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X[0], sbr->qmf_filter_scratch,
                       sbr->data[0].synthesis_filterbank_samples,
                       &sbr->data[0].synthesis_filterbank_samples_offset,
-                      downsampled,
-                      ac->add_bias, -1024 * ac->sf_scale);
+                      downsampled);
     if (nch == 2)
         sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, R, sbr->X[1], sbr->qmf_filter_scratch,
                           sbr->data[1].synthesis_filterbank_samples,
                           &sbr->data[1].synthesis_filterbank_samples_offset,
-                          downsampled,
-                          ac->add_bias, -1024 * ac->sf_scale);
+                          downsampled);
 }
diff --git a/ffmpeg-mt/libavcodec/aacsbr.h b/ffmpeg-mt/libavcodec/aacsbr.h
index 6b10ed4..dca8330 100644
--- a/ffmpeg-mt/libavcodec/aacsbr.h
+++ b/ffmpeg-mt/libavcodec/aacsbr.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
  * Copyright (c) 2010      Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aacsbrdata.h b/ffmpeg-mt/libavcodec/aacsbrdata.h
index 5d33a60..44d578f 100644
--- a/ffmpeg-mt/libavcodec/aacsbrdata.h
+++ b/ffmpeg-mt/libavcodec/aacsbrdata.h
@@ -2,20 +2,20 @@
  * AAC Spectral Band Replication decoding data
  * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aactab.c b/ffmpeg-mt/libavcodec/aactab.c
index 17102a6..46886b1 100644
--- a/ffmpeg-mt/libavcodec/aactab.c
+++ b/ffmpeg-mt/libavcodec/aactab.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
  * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aactab.h b/ffmpeg-mt/libavcodec/aactab.h
index c621399..c76d65d 100644
--- a/ffmpeg-mt/libavcodec/aactab.h
+++ b/ffmpeg-mt/libavcodec/aactab.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
  * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aandcttab.c b/ffmpeg-mt/libavcodec/aandcttab.c
index 87c50b3..0c5b573 100644
--- a/ffmpeg-mt/libavcodec/aandcttab.c
+++ b/ffmpeg-mt/libavcodec/aandcttab.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aandcttab.h b/ffmpeg-mt/libavcodec/aandcttab.h
index d774828..daccb7b 100644
--- a/ffmpeg-mt/libavcodec/aandcttab.h
+++ b/ffmpeg-mt/libavcodec/aandcttab.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/aasc.c b/ffmpeg-mt/libavcodec/aasc.c
index 82bd2bf..e80e094 100644
--- a/ffmpeg-mt/libavcodec/aasc.c
+++ b/ffmpeg-mt/libavcodec/aasc.c
@@ -2,20 +2,20 @@
  * Autodesk RLE Decoder
  * Copyright (C) 2005 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -109,7 +109,7 @@ static av_cold int aasc_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec aasc_decoder = {
+AVCodec ff_aasc_decoder = {
     "aasc",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_AASC,
diff --git a/ffmpeg-mt/libavcodec/ac3.c b/ffmpeg-mt/libavcodec/ac3.c
index 4ab77b8..704c6e0 100644
--- a/ffmpeg-mt/libavcodec/ac3.c
+++ b/ffmpeg-mt/libavcodec/ac3.c
@@ -2,20 +2,20 @@
  * Common code between the AC-3 encoder and decoder
  * Copyright (c) 2000 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,12 +28,10 @@
 #include "ac3.h"
 #include "get_bits.h"
 
-#if CONFIG_HARDCODED_TABLES
-
 /**
  * Starting frequency coefficient bin for each critical band.
  */
-static const uint8_t band_start_tab[AC3_CRITICAL_BANDS+1] = {
+const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1] = {
       0,  1,   2,   3,   4,   5,   6,   7,   8,   9,
      10,  11, 12,  13,  14,  15,  16,  17,  18,  19,
      20,  21, 22,  23,  24,  25,  26,  27,  28,  31,
@@ -41,10 +39,12 @@ static const uint8_t band_start_tab[AC3_CRITICAL_BANDS+1] = {
      79,  85, 97, 109, 121, 133, 157, 181, 205, 229, 253
 };
 
+#if CONFIG_HARDCODED_TABLES
+
 /**
  * Map each frequency coefficient bin to the critical band that contains it.
  */
-static const uint8_t bin_to_band_tab[253] = {
+const uint8_t ff_ac3_bin_to_band_tab[253] = {
      0,
      1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12,
     13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
@@ -70,8 +70,7 @@ static const uint8_t bin_to_band_tab[253] = {
 };
 
 #else /* CONFIG_HARDCODED_TABLES */
-static uint8_t band_start_tab[51];
-static uint8_t bin_to_band_tab[253];
+uint8_t ff_ac3_bin_to_band_tab[253];
 #endif
 
 static inline int calc_lowcomp1(int a, int b0, int b1, int c)
@@ -107,10 +106,10 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
 
     /* PSD integration */
     bin  = start;
-    band = bin_to_band_tab[start];
+    band = ff_ac3_bin_to_band_tab[start];
     do {
         int v = psd[bin++];
-        int band_end = FFMIN(band_start_tab[band+1], end);
+        int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end);
         for (; bin < band_end; bin++) {
             int max = FFMAX(v, psd[bin]);
             /* logadd */
@@ -118,7 +117,7 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
             v = max + ff_ac3_log_add_tab[adr];
         }
         band_psd[band++] = v;
-    } while (end > band_start_tab[band]);
+    } while (end > ff_ac3_band_start_tab[band]);
 }
 
 int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
@@ -133,8 +132,8 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
     int lowcomp, fastleak, slowleak;
 
     /* excitation function */
-    band_start = bin_to_band_tab[start];
-    band_end   = bin_to_band_tab[end-1] + 1;
+    band_start = ff_ac3_bin_to_band_tab[start];
+    band_end   = ff_ac3_bin_to_band_tab[end-1] + 1;
 
     if (band_start == 0) {
         lowcomp = 0;
@@ -213,69 +212,20 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
     return 0;
 }
 
-void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
-                               int snr_offset, int floor,
-                               const uint8_t *bap_tab, uint8_t *bap)
-{
-    int bin, band;
-
-    /* special case, if snr offset is -960, set all bap's to zero */
-    if (snr_offset == -960) {
-        memset(bap, 0, AC3_MAX_COEFS);
-        return;
-    }
-
-    bin  = start;
-    band = bin_to_band_tab[start];
-    do {
-        int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;
-        int band_end = FFMIN(band_start_tab[band+1], end);
-        for (; bin < band_end; bin++) {
-            int address = av_clip((psd[bin] - m) >> 5, 0, 63);
-            bap[bin] = bap_tab[address];
-        }
-    } while (end > band_start_tab[band++]);
-}
-
-/* AC-3 bit allocation. The algorithm is the one described in the AC-3
-   spec. */
-void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
-                                   int8_t *exp, int start, int end,
-                                   int snr_offset, int fast_gain, int is_lfe,
-                                   int dba_mode, int dba_nsegs,
-                                   uint8_t *dba_offsets, uint8_t *dba_lengths,
-                                   uint8_t *dba_values)
-{
-    int16_t psd[AC3_MAX_COEFS];           /* scaled exponents */
-    int16_t band_psd[AC3_CRITICAL_BANDS]; /* interpolated exponents */
-    int16_t mask[AC3_CRITICAL_BANDS];   /* masking value */
-
-    ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd);
-
-    ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe,
-                               dba_mode, dba_nsegs, dba_offsets, dba_lengths,
-                               dba_values, mask);
-
-    ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor,
-                              ff_ac3_bap_tab, bap);
-}
-
 /**
  * Initialize some tables.
  * note: This function must remain thread safe because it is called by the
  *       AVParser init code.
  */
-av_cold void ac3_common_init(void)
+av_cold void ff_ac3_common_init(void)
 {
 #if !CONFIG_HARDCODED_TABLES
-    /* compute bndtab and masktab from bandsz */
+    /* compute ff_ac3_bin_to_band_tab from ff_ac3_band_start_tab */
     int bin = 0, band;
     for (band = 0; band < AC3_CRITICAL_BANDS; band++) {
-        int band_end = bin + ff_ac3_critical_band_size_tab[band];
-        band_start_tab[band] = bin;
+        int band_end = ff_ac3_band_start_tab[band+1];
         while (bin < band_end)
-            bin_to_band_tab[bin++] = band;
+            ff_ac3_bin_to_band_tab[bin++] = band;
     }
-    band_start_tab[AC3_CRITICAL_BANDS] = bin;
 #endif /* !CONFIG_HARDCODED_TABLES */
 }
diff --git a/ffmpeg-mt/libavcodec/ac3.h b/ffmpeg-mt/libavcodec/ac3.h
index 89a88b6..4ed8c25 100644
--- a/ffmpeg-mt/libavcodec/ac3.h
+++ b/ffmpeg-mt/libavcodec/ac3.h
@@ -2,20 +2,20 @@
  * Common code between the AC-3 encoder and decoder
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,6 +36,7 @@
 #define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
 #define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
 #define AC3_CRITICAL_BANDS 50
+#define AC3_MAX_CPL_BANDS  18
 
 #include "ac3tab.h"
 
@@ -47,6 +48,17 @@
 #define EXP_D25   2
 #define EXP_D45   3
 
+/* pre-defined gain values */
+#define LEVEL_PLUS_3DB          1.4142135623730950
+#define LEVEL_PLUS_1POINT5DB    1.1892071150027209
+#define LEVEL_MINUS_1POINT5DB   0.8408964152537145
+#define LEVEL_MINUS_3DB         0.7071067811865476
+#define LEVEL_MINUS_4POINT5DB   0.5946035575013605
+#define LEVEL_MINUS_6DB         0.5000000000000000
+#define LEVEL_MINUS_9DB         0.3535533905932738
+#define LEVEL_ZERO              0.0000000000000000
+#define LEVEL_ONE               1.0000000000000000
+
 /** Delta bit allocation strategy */
 typedef enum {
     DBA_REUSE = 0,
@@ -86,6 +98,7 @@ typedef struct {
     uint16_t crc1;
     uint8_t sr_code;
     uint8_t bitstream_id;
+    uint8_t bitstream_mode;
     uint8_t channel_mode;
     uint8_t lfe_on;
     uint8_t frame_type;
@@ -115,7 +128,7 @@ typedef enum {
     EAC3_FRAME_TYPE_RESERVED
 } EAC3FrameType;
 
-void ac3_common_init(void);
+void ff_ac3_common_init(void);
 
 /**
  * Calculate the log power-spectral density of the input signal.
@@ -162,30 +175,4 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
                                uint8_t *dba_lengths, uint8_t *dba_values,
                                int16_t *mask);
 
-/**
- * Calculate bit allocation pointers.
- * The SNR is the difference between the masking curve and the signal.  AC-3
- * uses this value for each frequency bin to allocate bits.  The snroffset
- * parameter is a global adjustment to the SNR for all bins.
- *
- * @param[in]  mask       masking curve
- * @param[in]  psd        signal power for each frequency bin
- * @param[in]  start      starting bin location
- * @param[in]  end        ending bin location
- * @param[in]  snr_offset SNR adjustment
- * @param[in]  floor      noise floor
- * @param[in]  bap_tab    look-up table for bit allocation pointers
- * @param[out] bap        bit allocation pointers
- */
-void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
-                               int snr_offset, int floor,
-                               const uint8_t *bap_tab, uint8_t *bap);
-
-void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
-                                   int8_t *exp, int start, int end,
-                                   int snr_offset, int fast_gain, int is_lfe,
-                                   int dba_mode, int dba_nsegs,
-                                   uint8_t *dba_offsets, uint8_t *dba_lengths,
-                                   uint8_t *dba_values);
-
 #endif /* AVCODEC_AC3_H */
diff --git a/ffmpeg-mt/libavcodec/ac3_parser.c b/ffmpeg-mt/libavcodec/ac3_parser.c
index b844ec3..82eeda3 100644
--- a/ffmpeg-mt/libavcodec/ac3_parser.c
+++ b/ffmpeg-mt/libavcodec/ac3_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,6 +24,7 @@
 #include "ac3_parser.h"
 #include "aac_ac3_parser.h"
 #include "get_bits.h"
+#include "libavutil/audioconvert.h"
 
 
 #define AC3_HEADER_SIZE 7
@@ -68,7 +69,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
 
         skip_bits(gbc, 5); // skip bsid, already got it
 
-        skip_bits(gbc, 3); // skip bitstream mode
+        hdr->bitstream_mode = get_bits(gbc, 3);
         hdr->channel_mode = get_bits(gbc, 3);
 
         if(hdr->channel_mode == AC3_CHMODE_STEREO) {
@@ -123,40 +124,11 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
     }
     hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
     if (hdr->lfe_on)
-        hdr->channel_layout |= CH_LOW_FREQUENCY;
+        hdr->channel_layout |= AV_CH_LOW_FREQUENCY;
 
     return 0;
 }
 
-int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr){
-    int ret, i;
-    ret = ff_ac3_parse_header(gbc, hdr);
-    if(!ret){
-        if(hdr->bitstream_id>10){
-            /* Enhanced AC-3 */
-            skip_bits(gbc, 5); // skip bitstream id
-
-            /* skip dialog normalization and compression gain */
-            for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
-                skip_bits(gbc, 5); // skip dialog normalization
-                if (get_bits1(gbc)) {
-                    skip_bits(gbc, 8); //skip Compression gain word
-                }
-            }
-            /* dependent stream channel map */
-            if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc)) {
-                    hdr->channel_map = get_bits(gbc, 16); //custom channel map
-                    return 0;
-            }
-        }
-        //default channel map based on acmod and lfeon
-        hdr->channel_map = ff_eac3_default_chmap[hdr->channel_mode];
-        if(hdr->lfe_on)
-            hdr->channel_map |= AC3_CHMAP_LFE;
-    }
-    return ret;
-}
-
 static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
         int *need_next_header, int *new_frame_start)
 {
@@ -179,6 +151,9 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
     hdr_info->channels = hdr.channels;
     hdr_info->channel_layout = hdr.channel_layout;
     hdr_info->samples = hdr.num_blocks * 256;
+    hdr_info->service_type = hdr.bitstream_mode;
+    if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)
+        hdr_info->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
     if(hdr.bitstream_id>10)
         hdr_info->codec_id = CODEC_ID_EAC3;
     else if (hdr_info->codec_id == CODEC_ID_NONE)
@@ -198,7 +173,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
 }
 
 
-AVCodecParser ac3_parser = {
+AVCodecParser ff_ac3_parser = {
     { CODEC_ID_AC3, CODEC_ID_EAC3 },
     sizeof(AACAC3ParseContext),
     ac3_parse_init,
diff --git a/ffmpeg-mt/libavcodec/ac3_parser.h b/ffmpeg-mt/libavcodec/ac3_parser.h
index 2f4a2ee..d62490b 100644
--- a/ffmpeg-mt/libavcodec/ac3_parser.h
+++ b/ffmpeg-mt/libavcodec/ac3_parser.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -38,15 +38,4 @@
  */
 int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
 
-/**
- * Parse AC-3 frame header and sets channel_map
- * Parse the header up to the lfeon (channel_map in E-AC-3)
- * element, which is the first 52, 54 or 104 bits depending
- * on the audio coding mode.
- * @param[in]  gbc BitContext containing the first 54 bits of the frame.
- * @param[out] hdr Pointer to struct where header info is written.
- * @return value returned by ff_ac3_parse_header
- */
-int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr);
-
 #endif /* AVCODEC_AC3_PARSER_H */
diff --git a/ffmpeg-mt/libavcodec/ac3dec.c b/ffmpeg-mt/libavcodec/ac3dec.c
index 32172dc..396df87 100644
--- a/ffmpeg-mt/libavcodec/ac3dec.c
+++ b/ffmpeg-mt/libavcodec/ac3dec.c
@@ -7,20 +7,20 @@
  * Copyright (c) 2007-2008 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
  * Copyright (c) 2007 Justin Ruggles <justin.ruggles at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -35,6 +35,7 @@
 #include "ac3_parser.h"
 #include "ac3dec.h"
 #include "ac3dec_data.h"
+#include "kbdwin.h"
 
 /** Large enough for maximum possible frame size when the specification limit is ignored */
 #define AC3_FRAME_BUFFER_SIZE 32768
@@ -66,16 +67,6 @@ static const uint8_t quantization_tab[16] = {
 static float dynamic_range_tab[256];
 
 /** Adjustments in dB gain */
-#define LEVEL_PLUS_3DB          1.4142135623730950
-#define LEVEL_PLUS_1POINT5DB    1.1892071150027209
-#define LEVEL_MINUS_1POINT5DB   0.8408964152537145
-#define LEVEL_MINUS_3DB         0.7071067811865476
-#define LEVEL_MINUS_4POINT5DB   0.5946035575013605
-#define LEVEL_MINUS_6DB         0.5000000000000000
-#define LEVEL_MINUS_9DB         0.3535533905932738
-#define LEVEL_ZERO              0.0000000000000000
-#define LEVEL_ONE               1.0000000000000000
-
 static const float gain_levels[9] = {
     LEVEL_PLUS_3DB,
     LEVEL_PLUS_1POINT5DB,
@@ -187,22 +178,18 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
     AC3DecodeContext *s = avctx->priv_data;
     s->avctx = avctx;
 
-    ac3_common_init();
+    ff_ac3_common_init();
     ac3_tables_init();
     ff_mdct_init(&s->imdct_256, 8, 1, 1.0);
     ff_mdct_init(&s->imdct_512, 9, 1, 1.0);
     ff_kbd_window_init(s->window, 5.0, 256);
     dsputil_init(&s->dsp, avctx);
+    ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
+    ff_fmt_convert_init(&s->fmt_conv, avctx);
     av_lfg_init(&s->dith_state, 0);
 
-    /* set bias values for float to int16 conversion */
-    if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        s->add_bias = 385.0f;
-        s->mul_bias = 1.0f;
-    } else {
-        s->add_bias = 0.0f;
-        s->mul_bias = 32767.0f;
-    }
+    /* set scale value for float to int16 conversion */
+    s->mul_bias = 32767.0f;
 
     /* allow downmixing to stereo or mono */
     if (avctx->channels > 0 && avctx->request_channels > 0 &&
@@ -213,11 +200,9 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
     s->downmixed = 1;
 
     /* allocate context input buffer */
-    if (avctx->error_recognition >= FF_ER_CAREFUL) {
         s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
         if (!s->input_buffer)
             return AVERROR(ENOMEM);
-    }
 
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
     return 0;
@@ -279,6 +264,7 @@ static int parse_frame_header(AC3DecodeContext *s)
 
     /* get decoding parameters from header info */
     s->bit_alloc_params.sr_code     = hdr.sr_code;
+    s->bitstream_mode               = hdr.bitstream_mode;
     s->channel_mode                 = hdr.channel_mode;
     s->channel_layout               = hdr.channel_layout;
     s->lfe_on                       = hdr.lfe_on;
@@ -626,9 +612,6 @@ static void do_rematrixing(AC3DecodeContext *s)
 static inline void do_imdct(AC3DecodeContext *s, int channels)
 {
     int ch;
-    float add_bias = s->add_bias;
-    if(s->out_channels==1 && channels>1)
-        add_bias *= LEVEL_MINUS_3DB; // compensate for the gain in downmix
 
     for (ch=1; ch<=channels; ch++) {
         if (s->block_switch[ch]) {
@@ -636,14 +619,14 @@ static inline void do_imdct(AC3DecodeContext *s, int channels)
             float *x = s->tmp_output+128;
             for(i=0; i<128; i++)
                 x[i] = s->transform_coeffs[ch][2*i];
-            ff_imdct_half(&s->imdct_256, s->tmp_output, x);
-            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, add_bias, 128);
+            s->imdct_256.imdct_half(&s->imdct_256, s->tmp_output, x);
+            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128);
             for(i=0; i<128; i++)
                 x[i] = s->transform_coeffs[ch][2*i+1];
-            ff_imdct_half(&s->imdct_256, s->delay[ch-1], x);
+            s->imdct_256.imdct_half(&s->imdct_256, s->delay[ch-1], x);
         } else {
-            ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]);
-            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, add_bias, 128);
+            s->imdct_512.imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]);
+            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128);
             memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float));
         }
     }
@@ -1231,7 +1214,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
             /* Compute bit allocation */
             const uint8_t *bap_tab = s->channel_uses_aht[ch] ?
                                      ff_eac3_hebap_tab : ff_ac3_bap_tab;
-            ff_ac3_bit_alloc_calc_bap(s->mask[ch], s->psd[ch],
+            s->ac3dsp.bit_alloc_calc_bap(s->mask[ch], s->psd[ch],
                                       s->start_freq[ch], s->end_freq[ch],
                                       s->snr_offset[ch],
                                       s->bit_alloc_params.floor,
@@ -1264,7 +1247,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
         } else {
             gain *= s->dynamic_range[0];
         }
-        s->dsp.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256);
+        s->fmt_conv.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256);
     }
 
     /* apply spectral extension to high frequency bins */
@@ -1321,15 +1304,17 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
     const uint8_t *channel_map;
     const float *output[AC3_MAX_CHANNELS];
 
-    /* initialize the GetBitContext with the start of valid AC-3 Frame */
-    if (s->input_buffer) {
-        /* copy input buffer to decoder context to avoid reading past the end
-           of the buffer, which can be caused by a damaged input stream. */
+    /* copy input buffer to decoder context to avoid reading past the end
+       of the buffer, which can be caused by a damaged input stream. */
+    if (buf_size >= 2 && AV_RB16(buf) == 0x770B) {
+        // seems to be byte-swapped AC-3
+        int cnt = FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE) >> 1;
+        s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)buf, cnt);
+    } else
         memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
-        init_get_bits(&s->gbc, s->input_buffer, buf_size * 8);
-    } else {
-        init_get_bits(&s->gbc, buf, buf_size * 8);
-    }
+    buf = s->input_buffer;
+    /* initialize the GetBitContext with the start of valid AC-3 Frame */
+    init_get_bits(&s->gbc, buf, buf_size * 8);
 
     /* parse the syncinfo */
     *data_size = 0;
@@ -1406,6 +1391,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
         if(s->out_channels < s->channels)
             s->output_mode  = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
     }
+    /* set audio service type based on bitstream mode for AC-3 */
+    avctx->audio_service_type = s->bitstream_mode;
+    if (s->bitstream_mode == 0x7 && s->channels > 1)
+        avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
 
     /* decode the audio blocks */
     channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
@@ -1416,7 +1405,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
             av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
             err = 1;
         }
-        s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
+        s->fmt_conv.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
         out_samples += 256 * s->out_channels;
     }
     *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t);
@@ -1437,7 +1426,7 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ac3_decoder = {
+AVCodec ff_ac3_decoder = {
     .name = "ac3",
     .type = AVMEDIA_TYPE_AUDIO,
     .id = CODEC_ID_AC3,
@@ -1449,7 +1438,7 @@ AVCodec ac3_decoder = {
 };
 
 #if CONFIG_EAC3_DECODER
-AVCodec eac3_decoder = {
+AVCodec ff_eac3_decoder = {
     .name = "eac3",
     .type = AVMEDIA_TYPE_AUDIO,
     .id = CODEC_ID_EAC3,
diff --git a/ffmpeg-mt/libavcodec/ac3dec.h b/ffmpeg-mt/libavcodec/ac3dec.h
index 0707769..3459441 100644
--- a/ffmpeg-mt/libavcodec/ac3dec.h
+++ b/ffmpeg-mt/libavcodec/ac3dec.h
@@ -2,20 +2,20 @@
  * Common code between the AC-3 and E-AC-3 decoders
  * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -52,9 +52,11 @@
 
 #include "libavutil/lfg.h"
 #include "ac3.h"
+#include "ac3dsp.h"
 #include "get_bits.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "fmtconvert.h"
 
 /* override ac3.h to include coupling channel */
 #undef AC3_MAX_CHANNELS
@@ -78,6 +80,7 @@ typedef struct {
     int bit_rate;                           ///< stream bit rate, in bits-per-second
     int sample_rate;                        ///< sample frequency, in Hz
     int num_blocks;                         ///< number of audio blocks
+    int bitstream_mode;                     ///< bitstream mode                         (bsmod)
     int channel_mode;                       ///< channel mode                           (acmod)
     int channel_layout;                     ///< channel layout
     int lfe_on;                             ///< lfe channel in use
@@ -102,12 +105,12 @@ typedef struct {
     int cpl_strategy_exists[AC3_MAX_BLOCKS];///< coupling strategy exists               (cplstre)
     int channel_in_cpl[AC3_MAX_CHANNELS];   ///< channel in coupling                    (chincpl)
     int phase_flags_in_use;                 ///< phase flags in use                     (phsflginu)
-    int phase_flags[18];                    ///< phase flags                            (phsflg)
+    int phase_flags[AC3_MAX_CPL_BANDS];     ///< phase flags                            (phsflg)
     int num_cpl_bands;                      ///< number of coupling bands               (ncplbnd)
-    uint8_t cpl_band_sizes[18];             ///< number of coeffs in each coupling band
+    uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band
     int firstchincpl;                       ///< first channel in coupling
     int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states      (firstcplcos)
-    int cpl_coords[AC3_MAX_CHANNELS][18];   ///< coupling coordinates                   (cplco)
+    int cpl_coords[AC3_MAX_CHANNELS][AC3_MAX_CPL_BANDS]; ///< coupling coordinates      (cplco)
 ///@}
 
 ///@defgroup spx spectral extension
@@ -190,7 +193,8 @@ typedef struct {
 
 ///@defgroup opt optimization
     DSPContext dsp;                         ///< for optimization
-    float add_bias;                         ///< offset for float_to_int16 conversion
+    AC3DSPContext ac3dsp;
+    FmtConvertContext fmt_conv;             ///< optimized conversion functions
     float mul_bias;                         ///< scaling for float_to_int16 conversion
 ///@}
 
diff --git a/ffmpeg-mt/libavcodec/ac3dec_data.c b/ffmpeg-mt/libavcodec/ac3dec_data.c
index c403902..ba3cbd3 100644
--- a/ffmpeg-mt/libavcodec/ac3dec_data.c
+++ b/ffmpeg-mt/libavcodec/ac3dec_data.c
@@ -2,20 +2,20 @@
  * AC-3 and E-AC-3 decoder tables
  * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ac3dec_data.h b/ffmpeg-mt/libavcodec/ac3dec_data.h
index e2ab7dd..a758f8b 100644
--- a/ffmpeg-mt/libavcodec/ac3dec_data.h
+++ b/ffmpeg-mt/libavcodec/ac3dec_data.h
@@ -2,20 +2,20 @@
  * AC-3 and E-AC-3 decoder tables
  * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ac3dsp.c b/ffmpeg-mt/libavcodec/ac3dsp.c
new file mode 100644
index 0000000..dccad3b
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/ac3dsp.c
@@ -0,0 +1,189 @@
+/*
+ * AC-3 DSP utils
+ * Copyright (c) 2011 Justin Ruggles
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+#include "avcodec.h"
+#include "ac3.h"
+#include "ac3dsp.h"
+
+static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
+{
+    int blk, i;
+
+    if (!num_reuse_blocks)
+        return;
+
+    for (i = 0; i < nb_coefs; i++) {
+        uint8_t min_exp = *exp;
+        uint8_t *exp1 = exp + 256;
+        for (blk = 0; blk < num_reuse_blocks; blk++) {
+            uint8_t next_exp = *exp1;
+            if (next_exp < min_exp)
+                min_exp = next_exp;
+            exp1 += 256;
+        }
+        *exp++ = min_exp;
+    }
+}
+
+static int ac3_max_msb_abs_int16_c(const int16_t *src, int len)
+{
+    int i, v = 0;
+    for (i = 0; i < len; i++)
+        v |= abs(src[i]);
+    return v;
+}
+
+static void ac3_lshift_int16_c(int16_t *src, unsigned int len,
+                               unsigned int shift)
+{
+    uint32_t *src32 = (uint32_t *)src;
+    const uint32_t mask = ~(((1 << shift) - 1) << 16);
+    int i;
+    len >>= 1;
+    for (i = 0; i < len; i += 8) {
+        src32[i  ] = (src32[i  ] << shift) & mask;
+        src32[i+1] = (src32[i+1] << shift) & mask;
+        src32[i+2] = (src32[i+2] << shift) & mask;
+        src32[i+3] = (src32[i+3] << shift) & mask;
+        src32[i+4] = (src32[i+4] << shift) & mask;
+        src32[i+5] = (src32[i+5] << shift) & mask;
+        src32[i+6] = (src32[i+6] << shift) & mask;
+        src32[i+7] = (src32[i+7] << shift) & mask;
+    }
+}
+
+static void ac3_rshift_int32_c(int32_t *src, unsigned int len,
+                               unsigned int shift)
+{
+    do {
+        *src++ >>= shift;
+        *src++ >>= shift;
+        *src++ >>= shift;
+        *src++ >>= shift;
+        *src++ >>= shift;
+        *src++ >>= shift;
+        *src++ >>= shift;
+        *src++ >>= shift;
+        len -= 8;
+    } while (len > 0);
+}
+
+static void float_to_fixed24_c(int32_t *dst, const float *src, unsigned int len)
+{
+    const float scale = 1 << 24;
+    do {
+        *dst++ = lrintf(*src++ * scale);
+        *dst++ = lrintf(*src++ * scale);
+        *dst++ = lrintf(*src++ * scale);
+        *dst++ = lrintf(*src++ * scale);
+        *dst++ = lrintf(*src++ * scale);
+        *dst++ = lrintf(*src++ * scale);
+        *dst++ = lrintf(*src++ * scale);
+        *dst++ = lrintf(*src++ * scale);
+        len -= 8;
+    } while (len > 0);
+}
+
+static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd,
+                                     int start, int end,
+                                     int snr_offset, int floor,
+                                     const uint8_t *bap_tab, uint8_t *bap)
+{
+    int bin, band;
+
+    /* special case, if snr offset is -960, set all bap's to zero */
+    if (snr_offset == -960) {
+        memset(bap, 0, AC3_MAX_COEFS);
+        return;
+    }
+
+    bin  = start;
+    band = ff_ac3_bin_to_band_tab[start];
+    do {
+        int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;
+        int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end);
+        for (; bin < band_end; bin++) {
+            int address = av_clip((psd[bin] - m) >> 5, 0, 63);
+            bap[bin] = bap_tab[address];
+        }
+    } while (end > ff_ac3_band_start_tab[band++]);
+}
+
+static int ac3_compute_mantissa_size_c(int mant_cnt[5], uint8_t *bap,
+                                       int nb_coefs)
+{
+    int bits, b, i;
+
+    bits = 0;
+    for (i = 0; i < nb_coefs; i++) {
+        b = bap[i];
+        if (b <= 4) {
+            // bap=1 to bap=4 will be counted in compute_mantissa_size_final
+            mant_cnt[b]++;
+        } else if (b <= 13) {
+            // bap=5 to bap=13 use (bap-1) bits
+            bits += b - 1;
+        } else {
+            // bap=14 uses 14 bits and bap=15 uses 16 bits
+            bits += (b == 14) ? 14 : 16;
+        }
+    }
+    return bits;
+}
+
+static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs)
+{
+    int i;
+
+    for (i = 0; i < nb_coefs; i++) {
+        int e;
+        int v = abs(coef[i]);
+        if (v == 0)
+            e = 24;
+        else {
+            e = 23 - av_log2(v);
+            if (e >= 24) {
+                e = 24;
+                coef[i] = 0;
+            }
+            av_assert2(e >= 0);
+        }
+        exp[i] = e;
+    }
+}
+
+av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
+{
+    c->ac3_exponent_min = ac3_exponent_min_c;
+    c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c;
+    c->ac3_lshift_int16 = ac3_lshift_int16_c;
+    c->ac3_rshift_int32 = ac3_rshift_int32_c;
+    c->float_to_fixed24 = float_to_fixed24_c;
+    c->bit_alloc_calc_bap = ac3_bit_alloc_calc_bap_c;
+    c->compute_mantissa_size = ac3_compute_mantissa_size_c;
+    c->extract_exponents = ac3_extract_exponents_c;
+
+    if (ARCH_ARM)
+        ff_ac3dsp_init_arm(c, bit_exact);
+    if (HAVE_MMX)
+        ff_ac3dsp_init_x86(c, bit_exact);
+}
diff --git a/ffmpeg-mt/libavcodec/ac3dsp.h b/ffmpeg-mt/libavcodec/ac3dsp.h
new file mode 100644
index 0000000..b750767
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/ac3dsp.h
@@ -0,0 +1,116 @@
+/*
+ * AC-3 DSP utils
+ * Copyright (c) 2011 Justin Ruggles
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_AC3DSP_H
+#define AVCODEC_AC3DSP_H
+
+#include <stdint.h>
+
+typedef struct AC3DSPContext {
+    /**
+     * Set each encoded exponent in a block to the minimum of itself and the
+     * exponents in the same frequency bin of up to 5 following blocks.
+     * @param exp   pointer to the start of the current block of exponents.
+     *              constraints: align 16
+     * @param num_reuse_blocks  number of blocks that will reuse exponents from the current block.
+     *                          constraints: range 0 to 5
+     * @param nb_coefs  number of frequency coefficients.
+     */
+    void (*ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+
+    /**
+     * Calculate the maximum MSB of the absolute value of each element in an
+     * array of int16_t.
+     * @param src input array
+     *            constraints: align 16. values must be in range [-32767,32767]
+     * @param len number of values in the array
+     *            constraints: multiple of 16 greater than 0
+     * @return    a value with the same MSB as max(abs(src[]))
+     */
+    int (*ac3_max_msb_abs_int16)(const int16_t *src, int len);
+
+    /**
+     * Left-shift each value in an array of int16_t by a specified amount.
+     * @param src    input array
+     *               constraints: align 16
+     * @param len    number of values in the array
+     *               constraints: multiple of 32 greater than 0
+     * @param shift  left shift amount
+     *               constraints: range [0,15]
+     */
+    void (*ac3_lshift_int16)(int16_t *src, unsigned int len, unsigned int shift);
+
+    /**
+     * Right-shift each value in an array of int32_t by a specified amount.
+     * @param src    input array
+     *               constraints: align 16
+     * @param len    number of values in the array
+     *               constraints: multiple of 16 greater than 0
+     * @param shift  right shift amount
+     *               constraints: range [0,31]
+     */
+    void (*ac3_rshift_int32)(int32_t *src, unsigned int len, unsigned int shift);
+
+    /**
+     * Convert an array of float in range [-1.0,1.0] to int32_t with range
+     * [-(1<<24),(1<<24)]
+     *
+     * @param dst destination array of int32_t.
+     *            constraints: 16-byte aligned
+     * @param src source array of float.
+     *            constraints: 16-byte aligned
+     * @param len number of elements to convert.
+     *            constraints: multiple of 32 greater than zero
+     */
+    void (*float_to_fixed24)(int32_t *dst, const float *src, unsigned int len);
+
+    /**
+     * Calculate bit allocation pointers.
+     * The SNR is the difference between the masking curve and the signal.  AC-3
+     * uses this value for each frequency bin to allocate bits.  The snroffset
+     * parameter is a global adjustment to the SNR for all bins.
+     *
+     * @param[in]  mask       masking curve
+     * @param[in]  psd        signal power for each frequency bin
+     * @param[in]  start      starting bin location
+     * @param[in]  end        ending bin location
+     * @param[in]  snr_offset SNR adjustment
+     * @param[in]  floor      noise floor
+     * @param[in]  bap_tab    look-up table for bit allocation pointers
+     * @param[out] bap        bit allocation pointers
+     */
+    void (*bit_alloc_calc_bap)(int16_t *mask, int16_t *psd, int start, int end,
+                               int snr_offset, int floor,
+                               const uint8_t *bap_tab, uint8_t *bap);
+
+    /**
+     * Calculate the number of bits needed to encode a set of mantissas.
+     */
+    int (*compute_mantissa_size)(int mant_cnt[5], uint8_t *bap, int nb_coefs);
+
+    void (*extract_exponents)(uint8_t *exp, int32_t *coef, int nb_coefs);
+} AC3DSPContext;
+
+void ff_ac3dsp_init    (AC3DSPContext *c, int bit_exact);
+void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact);
+void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact);
+
+#endif /* AVCODEC_AC3DSP_H */
diff --git a/ffmpeg-mt/libavcodec/ac3enc.c b/ffmpeg-mt/libavcodec/ac3enc.c
index e59916c..04e8b4f 100644
--- a/ffmpeg-mt/libavcodec/ac3enc.c
+++ b/ffmpeg-mt/libavcodec/ac3enc.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles at gmail.com>
  * Copyright (c) 2006-2010 Prakash Punnoor <prakash at punnoor.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,14 +27,21 @@
  */
 
 //#define DEBUG
+//#define ASSERT_LEVEL 2
 
-#include "libavcore/audioconvert.h"
+#include <stdint.h>
+
+#include "libavutil/audioconvert.h"
+#include "libavutil/avassert.h"
 #include "libavutil/crc.h"
+#include "libavutil/opt.h"
 #include "avcodec.h"
 #include "put_bits.h"
 #include "dsputil.h"
+#include "ac3dsp.h"
 #include "ac3.h"
 #include "audioconvert.h"
+#include "fft.h"
 
 
 #ifndef CONFIG_AC3ENC_FLOAT
@@ -51,16 +58,52 @@
 #define AC3_REMATRIXING_NONE    1
 #define AC3_REMATRIXING_ALWAYS  3
 
-/** Scale a float value by 2^bits and convert to an integer. */
-#define SCALE_FLOAT(a, bits) lrintf((a) * (float)(1 << (bits)))
-
-
 #if CONFIG_AC3ENC_FLOAT
-#include "ac3enc_float.h"
+#define MAC_COEF(d,a,b) ((d)+=(a)*(b))
+typedef float SampleType;
+typedef float CoefType;
+typedef float CoefSumType;
 #else
-#include "ac3enc_fixed.h"
+#define MAC_COEF(d,a,b) MAC64(d,a,b)
+typedef int16_t SampleType;
+typedef int32_t CoefType;
+typedef int64_t CoefSumType;
 #endif
 
+typedef struct AC3MDCTContext {
+    const SampleType *window;           ///< MDCT window function
+    FFTContext fft;                     ///< FFT context for MDCT calculation
+} AC3MDCTContext;
+
+/**
+ * Encoding Options used by AVOption.
+ */
+typedef struct AC3EncOptions {
+    /* AC-3 metadata options*/
+    int dialogue_level;
+    int bitstream_mode;
+    float center_mix_level;
+    float surround_mix_level;
+    int dolby_surround_mode;
+    int audio_production_info;
+    int mixing_level;
+    int room_type;
+    int copyright;
+    int original;
+    int extended_bsi_1;
+    int preferred_stereo_downmix;
+    float ltrt_center_mix_level;
+    float ltrt_surround_mix_level;
+    float loro_center_mix_level;
+    float loro_surround_mix_level;
+    int extended_bsi_2;
+    int dolby_surround_ex_mode;
+    int dolby_headphone_mode;
+    int ad_converter_type;
+
+    /* other encoding options */
+    int allow_per_frame_metadata;
+} AC3EncOptions;
 
 /**
  * Data for a single audio block.
@@ -75,17 +118,21 @@ typedef struct AC3Block {
     int16_t  **band_psd;                        ///< psd per critical band
     int16_t  **mask;                            ///< masking curve
     uint16_t **qmant;                           ///< quantized mantissas
-    int8_t   exp_shift[AC3_MAX_CHANNELS];       ///< exponent shift values
+    uint8_t  coeff_shift[AC3_MAX_CHANNELS];     ///< fixed-point coefficient shift values
     uint8_t  new_rematrixing_strategy;          ///< send new rematrixing flags in this block
     uint8_t  rematrixing_flags[4];              ///< rematrixing flags
+    struct AC3Block *exp_ref_block[AC3_MAX_CHANNELS]; ///< reference blocks for EXP_REUSE
 } AC3Block;
 
 /**
  * AC-3 encoder private context.
  */
 typedef struct AC3EncodeContext {
+    AVClass *av_class;                      ///< AVClass used for AVOption
+    AC3EncOptions options;                  ///< encoding options
     PutBitContext pb;                       ///< bitstream writer context
     DSPContext dsp;
+    AC3DSPContext ac3dsp;                   ///< AC-3 optimized functions
     AC3MDCTContext mdct;                    ///< MDCT context
 
     AC3Block blocks[AC3_MAX_BLOCKS];        ///< per-block info
@@ -107,14 +154,24 @@ typedef struct AC3EncodeContext {
     int channels;                           ///< total number of channels               (nchans)
     int lfe_on;                             ///< indicates if there is an LFE channel   (lfeon)
     int lfe_channel;                        ///< channel index of the LFE channel
+    int has_center;                         ///< indicates if there is a center channel
+    int has_surround;                       ///< indicates if there are one or more surround channels
     int channel_mode;                       ///< channel mode                           (acmod)
     const uint8_t *channel_map;             ///< channel map used to reorder channels
 
+    int center_mix_level;                   ///< center mix level code
+    int surround_mix_level;                 ///< surround mix level code
+    int ltrt_center_mix_level;              ///< Lt/Rt center mix level code
+    int ltrt_surround_mix_level;            ///< Lt/Rt surround mix level code
+    int loro_center_mix_level;              ///< Lo/Ro center mix level code
+    int loro_surround_mix_level;            ///< Lo/Ro surround mix level code
+
     int cutoff;                             ///< user-specified cutoff frequency, in Hz
     int bandwidth_code[AC3_MAX_CHANNELS];   ///< bandwidth code (0 to 60)               (chbwcod)
     int nb_coefs[AC3_MAX_CHANNELS];
 
     int rematrixing;                        ///< determines how rematrixing strategy is calculated
+    int num_rematrixing_bands;              ///< number of rematrixing bands
 
     /* bitrate allocation control */
     int slow_gain_code;                     ///< slow gain code                         (sgaincod)
@@ -130,10 +187,6 @@ typedef struct AC3EncodeContext {
     int frame_bits;                         ///< all frame bits except exponents and mantissas
     int exponent_bits;                      ///< number of bits used for exponents
 
-    /* mantissa encoding */
-    int mant1_cnt, mant2_cnt, mant4_cnt;    ///< mantissa counts for bap=1,2,4
-    uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4
-
     SampleType **planar_samples;
     uint8_t *bap_buffer;
     uint8_t *bap1_buffer;
@@ -151,6 +204,82 @@ typedef struct AC3EncodeContext {
     DECLARE_ALIGNED(16, SampleType, windowed_samples)[AC3_WINDOW_SIZE];
 } AC3EncodeContext;
 
+typedef struct AC3Mant {
+    uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4
+    int mant1_cnt, mant2_cnt, mant4_cnt;    ///< mantissa counts for bap=1,2,4
+} AC3Mant;
+
+#define CMIXLEV_NUM_OPTIONS 3
+static const float cmixlev_options[CMIXLEV_NUM_OPTIONS] = {
+    LEVEL_MINUS_3DB, LEVEL_MINUS_4POINT5DB, LEVEL_MINUS_6DB
+};
+
+#define SURMIXLEV_NUM_OPTIONS 3
+static const float surmixlev_options[SURMIXLEV_NUM_OPTIONS] = {
+    LEVEL_MINUS_3DB, LEVEL_MINUS_6DB, LEVEL_ZERO
+};
+
+#define EXTMIXLEV_NUM_OPTIONS 8
+static const float extmixlev_options[EXTMIXLEV_NUM_OPTIONS] = {
+    LEVEL_PLUS_3DB,  LEVEL_PLUS_1POINT5DB,  LEVEL_ONE,       LEVEL_MINUS_4POINT5DB,
+    LEVEL_MINUS_3DB, LEVEL_MINUS_4POINT5DB, LEVEL_MINUS_6DB, LEVEL_ZERO
+};
+
+
+#define OFFSET(param) offsetof(AC3EncodeContext, options.param)
+#define AC3ENC_PARAM (AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
+
+static const AVOption options[] = {
+/* Metadata Options */
+{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), FF_OPT_TYPE_INT, 0, 0, 1, AC3ENC_PARAM},
+/* downmix levels */
+{"center_mixlev", "Center Mix Level", OFFSET(center_mix_level), FF_OPT_TYPE_FLOAT, LEVEL_MINUS_4POINT5DB, 0.0, 1.0, AC3ENC_PARAM},
+{"surround_mixlev", "Surround Mix Level", OFFSET(surround_mix_level), FF_OPT_TYPE_FLOAT, LEVEL_MINUS_6DB, 0.0, 1.0, AC3ENC_PARAM},
+/* audio production information */
+{"mixing_level", "Mixing Level", OFFSET(mixing_level), FF_OPT_TYPE_INT, -1, -1, 111, AC3ENC_PARAM},
+{"room_type", "Room Type", OFFSET(room_type), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "room_type"},
+    {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
+    {"large",        "Large Room",              0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
+    {"small",        "Small Room",              0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
+/* other metadata options */
+{"copyright", "Copyright Bit", OFFSET(copyright), FF_OPT_TYPE_INT, 0, 0, 1, AC3ENC_PARAM},
+{"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), FF_OPT_TYPE_INT, -31, -31, -1, AC3ENC_PARAM},
+{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), FF_OPT_TYPE_INT, 0, 0, 2, AC3ENC_PARAM, "dsur_mode"},
+    {"notindicated", "Not Indicated (default)",    0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
+    {"on",           "Dolby Surround Encoded",     0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
+    {"off",          "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
+{"original", "Original Bit Stream", OFFSET(original), FF_OPT_TYPE_INT, 1, 0, 1, AC3ENC_PARAM},
+/* extended bitstream information */
+{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "dmix_mode"},
+    {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
+    {"ltrt", "Lt/Rt Downmix Preferred",         0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
+    {"loro", "Lo/Ro Downmix Preferred",         0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
+{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
+{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
+{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
+{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, -1.0, -1.0, 2.0, AC3ENC_PARAM},
+{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "dsurex_mode"},
+    {"notindicated", "Not Indicated (default)",       0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
+    {"on",           "Dolby Surround EX Encoded",     0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
+    {"off",          "Not Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
+{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), FF_OPT_TYPE_INT, -1, -1, 2, AC3ENC_PARAM, "dheadphone_mode"},
+    {"notindicated", "Not Indicated (default)",     0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
+    {"on",           "Dolby Headphone Encoded",     0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
+    {"off",          "Not Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, 2, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
+{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), FF_OPT_TYPE_INT, -1, -1, 1, AC3ENC_PARAM, "ad_conv_type"},
+    {"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
+    {"hdcd",     "HDCD",               0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
+{NULL}
+};
+
+#if CONFIG_AC3ENC_FLOAT
+static AVClass ac3enc_class = { "AC-3 Encoder", av_default_item_name,
+                                options, LIBAVUTIL_VERSION_INT };
+#else
+static AVClass ac3enc_class = { "Fixed-Point AC-3 Encoder", av_default_item_name,
+                                options, LIBAVUTIL_VERSION_INT };
+#endif
+
 
 /* prototypes for functions in ac3enc_fixed.c and ac3enc_float.c */
 
@@ -159,10 +288,8 @@ static av_cold void mdct_end(AC3MDCTContext *mdct);
 static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
                              int nbits);
 
-static void mdct512(AC3MDCTContext *mdct, CoefType *out, SampleType *in);
-
-static void apply_window(SampleType *output, const SampleType *input,
-                         const SampleType *window, int n);
+static void apply_window(DSPContext *dsp, SampleType *output, const SampleType *input,
+                         const SampleType *window, unsigned int len);
 
 static int normalize_samples(AC3EncodeContext *s);
 
@@ -203,6 +330,36 @@ static const int64_t ac3_channel_layouts[] = {
 
 
 /**
+ * LUT to select the bandwidth code based on the bit rate, sample rate, and
+ * number of full-bandwidth channels.
+ * bandwidth_tab[fbw_channels-1][sample rate code][bit rate code]
+ */
+static const uint8_t ac3_bandwidth_tab[5][3][19] = {
+//      32  40  48  56  64  80  96 112 128 160 192 224 256 320 384 448 512 576 640
+
+    { {  0,  0,  0, 12, 16, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48 },
+      {  0,  0,  0, 16, 20, 36, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56 },
+      {  0,  0,  0, 32, 40, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 } },
+
+    { {  0,  0,  0,  0,  0,  0,  0, 20, 24, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48 },
+      {  0,  0,  0,  0,  0,  0,  4, 24, 28, 36, 56, 56, 56, 56, 56, 56, 56, 56, 56 },
+      {  0,  0,  0,  0,  0,  0, 20, 44, 52, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 } },
+
+    { {  0,  0,  0,  0,  0,  0,  0,  0,  0, 16, 24, 32, 40, 48, 48, 48, 48, 48, 48 },
+      {  0,  0,  0,  0,  0,  0,  0,  0,  4, 20, 28, 36, 44, 56, 56, 56, 56, 56, 56 },
+      {  0,  0,  0,  0,  0,  0,  0,  0, 20, 40, 48, 60, 60, 60, 60, 60, 60, 60, 60 } },
+
+    { {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12, 24, 32, 48, 48, 48, 48, 48, 48 },
+      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16, 28, 36, 56, 56, 56, 56, 56, 56 },
+      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 48, 60, 60, 60, 60, 60, 60, 60 } },
+
+    { {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 20, 32, 40, 48, 48, 48, 48 },
+      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12, 24, 36, 44, 56, 56, 56, 56 },
+      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 28, 44, 60, 60, 60, 60, 60, 60 } }
+};
+
+
+/**
  * Adjust the frame size to make the average bit rate match the target bit rate.
  * This is only needed for 11025, 22050, and 44100 sample rates.
  */
@@ -221,7 +378,7 @@ static void adjust_frame_size(AC3EncodeContext *s)
 
 /**
  * Deinterleave input samples.
- * Channels are reordered from FFmpeg's default order to AC-3 order.
+ * Channels are reordered from Libav's default order to AC-3 order.
  */
 static void deinterleave_input_samples(AC3EncodeContext *s,
                                        const SampleType *samples)
@@ -262,11 +419,12 @@ static void apply_mdct(AC3EncodeContext *s)
             AC3Block *block = &s->blocks[blk];
             const SampleType *input_samples = &s->planar_samples[ch][blk * AC3_BLOCK_SIZE];
 
-            apply_window(s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE);
+            apply_window(&s->dsp, s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE);
 
-            block->exp_shift[ch] = normalize_samples(s);
+            block->coeff_shift[ch] = normalize_samples(s);
 
-            mdct512(&s->mdct, block->mdct_coef[ch], s->windowed_samples);
+            s->mdct.fft.mdct_calcw(&s->mdct.fft, block->mdct_coef[ch],
+                                   s->windowed_samples);
         }
     }
 }
@@ -303,15 +461,17 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
     int blk, bnd, i;
     AC3Block *block, *block0;
 
+    s->num_rematrixing_bands = 4;
+
     if (s->rematrixing & AC3_REMATRIXING_IS_STATIC)
         return;
 
     nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]);
 
-    s->blocks[0].new_rematrixing_strategy = 1;
     for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
         block = &s->blocks[blk];
-        for (bnd = 0; bnd < 4; bnd++) {
+        block->new_rematrixing_strategy = !blk;
+        for (bnd = 0; bnd < s->num_rematrixing_bands; bnd++) {
             /* calculate calculate sum of squared coeffs for one band in one block */
             int start = ff_ac3_rematrix_band_tab[bnd];
             int end   = FFMIN(nb_coefs, ff_ac3_rematrix_band_tab[bnd+1]);
@@ -321,10 +481,10 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
                 CoefType rt = block->mdct_coef[1][i];
                 CoefType md = lt + rt;
                 CoefType sd = lt - rt;
-                sum[0] += lt * lt;
-                sum[1] += rt * rt;
-                sum[2] += md * md;
-                sum[3] += sd * sd;
+                MAC_COEF(sum[0], lt, lt);
+                MAC_COEF(sum[1], rt, rt);
+                MAC_COEF(sum[2], md, md);
+                MAC_COEF(sum[3], sd, sd);
             }
 
             /* compare sums to determine if rematrixing will be used for this band */
@@ -335,7 +495,6 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
 
             /* determine if new rematrixing flags will be sent */
             if (blk &&
-                !block->new_rematrixing_strategy &&
                 block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) {
                 block->new_rematrixing_strategy = 1;
             }
@@ -364,7 +523,7 @@ static void apply_rematrixing(AC3EncodeContext *s)
         AC3Block *block = &s->blocks[blk];
         if (block->new_rematrixing_strategy)
             flags = block->rematrixing_flags;
-        for (bnd = 0; bnd < 4; bnd++) {
+        for (bnd = 0; bnd < s->num_rematrixing_bands; bnd++) {
             if (flags[bnd]) {
                 start = ff_ac3_rematrix_band_tab[bnd];
                 end   = FFMIN(nb_coefs, ff_ac3_rematrix_band_tab[bnd+1]);
@@ -403,28 +562,13 @@ static av_cold void exponent_init(AC3EncodeContext *s)
  */
 static void extract_exponents(AC3EncodeContext *s)
 {
-    int blk, ch, i;
+    int blk, ch;
 
     for (ch = 0; ch < s->channels; ch++) {
         for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
             AC3Block *block = &s->blocks[blk];
-            uint8_t *exp   = block->exp[ch];
-            int32_t *coef = block->fixed_coef[ch];
-            int exp_shift  = block->exp_shift[ch];
-            for (i = 0; i < AC3_MAX_COEFS; i++) {
-                int e;
-                int v = abs(coef[i]);
-                if (v == 0)
-                    e = 24;
-                else {
-                    e = 23 - av_log2(v) + exp_shift;
-                    if (e >= 24) {
-                        e = 24;
-                        coef[i] = 0;
-                    }
-                }
-                exp[i] = e;
-            }
+            s->ac3dsp.extract_exponents(block->exp[ch], block->fixed_coef[ch],
+                                        AC3_MAX_COEFS);
         }
     }
 }
@@ -434,7 +578,7 @@ static void extract_exponents(AC3EncodeContext *s)
  * Exponent Difference Threshold.
  * New exponents are sent if their SAD exceed this number.
  */
-#define EXP_DIFF_THRESHOLD 1000
+#define EXP_DIFF_THRESHOLD 500
 
 
 /**
@@ -458,7 +602,6 @@ static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy,
             exp_strategy[blk] = EXP_REUSE;
         exp += AC3_MAX_COEFS;
     }
-    emms_c();
 
     /* now select the encoding strategy type : if exponents are often
        recoded, we use a coarse encoding */
@@ -499,31 +642,6 @@ static void compute_exp_strategy(AC3EncodeContext *s)
 
 
 /**
- * Set each encoded exponent in a block to the minimum of itself and the
- * exponents in the same frequency bin of up to 5 following blocks.
- */
-static void exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
-{
-    int blk, i;
-
-    if (!num_reuse_blocks)
-        return;
-
-    for (i = 0; i < nb_coefs; i++) {
-        uint8_t min_exp = *exp;
-        uint8_t *exp1 = exp + AC3_MAX_COEFS;
-        for (blk = 0; blk < num_reuse_blocks; blk++) {
-            uint8_t next_exp = *exp1;
-            if (next_exp < min_exp)
-                min_exp = next_exp;
-            exp1 += AC3_MAX_COEFS;
-        }
-        *exp++ = min_exp;
-    }
-}
-
-
-/**
  * Update the exponents so that they are the ones the decoder will decode.
  */
 static void encode_exponents_blk_ch(uint8_t *exp, int nb_exps, int exp_strategy)
@@ -598,7 +716,7 @@ static void encode_exponents_blk_ch(uint8_t *exp, int nb_exps, int exp_strategy)
 static void encode_exponents(AC3EncodeContext *s)
 {
     int blk, blk1, ch;
-    uint8_t *exp, *exp1, *exp_strategy;
+    uint8_t *exp, *exp_strategy;
     int nb_coefs, num_reuse_blocks;
 
     for (ch = 0; ch < s->channels; ch++) {
@@ -610,25 +728,22 @@ static void encode_exponents(AC3EncodeContext *s)
         while (blk < AC3_MAX_BLOCKS) {
             blk1 = blk + 1;
 
-            /* count the number of EXP_REUSE blocks after the current block */
-            while (blk1 < AC3_MAX_BLOCKS && exp_strategy[blk1] == EXP_REUSE)
+            /* count the number of EXP_REUSE blocks after the current block
+               and set exponent reference block pointers */
+            s->blocks[blk].exp_ref_block[ch] = &s->blocks[blk];
+            while (blk1 < AC3_MAX_BLOCKS && exp_strategy[blk1] == EXP_REUSE) {
+                s->blocks[blk1].exp_ref_block[ch] = &s->blocks[blk];
                 blk1++;
+            }
             num_reuse_blocks = blk1 - blk - 1;
 
             /* for the EXP_REUSE case we select the min of the exponents */
-            exponent_min(exp, num_reuse_blocks, nb_coefs);
+            s->ac3dsp.ac3_exponent_min(exp, num_reuse_blocks, nb_coefs);
 
             encode_exponents_blk_ch(exp, nb_coefs, exp_strategy[blk]);
 
-            /* copy encoded exponents for reuse case */
-            exp1 = exp + AC3_MAX_COEFS;
-            while (blk < blk1-1) {
-                memcpy(exp1, exp, nb_coefs * sizeof(*exp));
-                exp1 += AC3_MAX_COEFS;
-                blk++;
-            }
+            exp += AC3_MAX_COEFS * (num_reuse_blocks + 1);
             blk = blk1;
-            exp = exp1;
         }
     }
 }
@@ -670,16 +785,19 @@ static void group_exponents(AC3EncodeContext *s)
                 exp1   = p[0];
                 p     += group_size;
                 delta0 = exp1 - exp0 + 2;
+                av_assert2(delta0 >= 0 && delta0 <= 4);
 
                 exp0   = exp1;
                 exp1   = p[0];
                 p     += group_size;
                 delta1 = exp1 - exp0 + 2;
+                av_assert2(delta1 >= 0 && delta1 <= 4);
 
                 exp0   = exp1;
                 exp1   = p[0];
                 p     += group_size;
                 delta2 = exp1 - exp0 + 2;
+                av_assert2(delta2 >= 0 && delta2 <= 4);
 
                 block->grouped_exp[ch][i] = ((delta0 * 5 + delta1) * 5) + delta2;
             }
@@ -704,6 +822,8 @@ static void process_exponents(AC3EncodeContext *s)
     encode_exponents(s);
 
     group_exponents(s);
+
+    emms_c();
 }
 
 
@@ -774,7 +894,7 @@ static void bit_alloc_init(AC3EncodeContext *s)
     s->fast_decay_code = 1;
     s->slow_gain_code  = 1;
     s->db_per_bit_code = 3;
-    s->floor_code      = 4;
+    s->floor_code      = 7;
     for (ch = 0; ch < s->channels; ch++)
         s->fast_gain_code[ch] = 4;
 
@@ -801,14 +921,24 @@ static void bit_alloc_init(AC3EncodeContext *s)
  */
 static void count_frame_bits(AC3EncodeContext *s)
 {
+    AC3EncOptions *opt = &s->options;
     int blk, ch;
     int frame_bits = 0;
 
+    if (opt->audio_production_info)
+        frame_bits += 7;
+    if (s->bitstream_id == 6) {
+        if (opt->extended_bsi_1)
+            frame_bits += 14;
+        if (opt->extended_bsi_2)
+            frame_bits += 14;
+    }
+
     for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
         /* stereo rematrixing */
         if (s->channel_mode == AC3_CHMODE_STEREO &&
             s->blocks[blk].new_rematrixing_strategy) {
-            frame_bits += 4;
+            frame_bits += s->num_rematrixing_bands;
         }
 
         for (ch = 0; ch < s->fbw_channels; ch++) {
@@ -821,31 +951,6 @@ static void count_frame_bits(AC3EncodeContext *s)
 
 
 /**
- * Calculate the number of bits needed to encode a set of mantissas.
- */
-static int compute_mantissa_size(int mant_cnt[5], uint8_t *bap, int nb_coefs)
-{
-    int bits, b, i;
-
-    bits = 0;
-    for (i = 0; i < nb_coefs; i++) {
-        b = bap[i];
-        if (b <= 4) {
-            // bap=1 to bap=4 will be counted in compute_mantissa_size_final
-            mant_cnt[b]++;
-        } else if (b <= 13) {
-            // bap=5 to bap=13 use (bap-1) bits
-            bits += b - 1;
-        } else {
-            // bap=14 uses 14 bits and bap=15 uses 16 bits
-            bits += (b == 14) ? 14 : 16;
-        }
-    }
-    return bits;
-}
-
-
-/**
  * Finalize the mantissa bit count by adding in the grouped mantissas.
  */
 static int compute_mantissa_size_final(int mant_cnt[5])
@@ -926,7 +1031,7 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset)
     reset_block_bap(s);
     mantissa_bits = 0;
     for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
-        AC3Block *block = &s->blocks[blk];
+        AC3Block *block;
         // initialize grouped mantissa counts. these are set so that they are
         // padded to the next whole group size when bits are counted in
         // compute_mantissa_size_final
@@ -938,15 +1043,14 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset)
                blocks within a frame are the exponent values.  We can take
                advantage of that by reusing the bit allocation pointers
                whenever we reuse exponents. */
-            if (s->exp_strategy[ch][blk] == EXP_REUSE) {
-                memcpy(block->bap[ch], s->blocks[blk-1].bap[ch], AC3_MAX_COEFS);
-            } else {
-                ff_ac3_bit_alloc_calc_bap(block->mask[ch], block->psd[ch], 0,
+            block = s->blocks[blk].exp_ref_block[ch];
+            if (s->exp_strategy[ch][blk] != EXP_REUSE) {
+                s->ac3dsp.bit_alloc_calc_bap(block->mask[ch], block->psd[ch], 0,
                                           s->nb_coefs[ch], snr_offset,
                                           s->bit_alloc.floor, ff_ac3_bap_tab,
                                           block->bap[ch]);
             }
-            mantissa_bits += compute_mantissa_size(mant_cnt, block->bap[ch], s->nb_coefs[ch]);
+            mantissa_bits += s->ac3dsp.compute_mantissa_size(mant_cnt, block->bap[ch], s->nb_coefs[ch]);
         }
         mantissa_bits += compute_mantissa_size_final(mant_cnt);
     }
@@ -965,6 +1069,7 @@ static int cbr_bit_allocation(AC3EncodeContext *s)
     int snr_offset, snr_incr;
 
     bits_left = 8 * s->frame_size - (s->frame_bits + s->exponent_bits);
+    av_assert2(bits_left >= 0);
 
     snr_offset = s->coarse_snr_offset << 4;
 
@@ -1110,18 +1215,8 @@ static int compute_bit_allocation(AC3EncodeContext *s)
  */
 static inline int sym_quant(int c, int e, int levels)
 {
-    int v;
-
-    if (c >= 0) {
-        v = (levels * (c << e)) >> 24;
-        v = (v + 1) >> 1;
-        v = (levels >> 1) + v;
-    } else {
-        v = (levels * ((-c) << e)) >> 24;
-        v = (v + 1) >> 1;
-        v = (levels >> 1) - v;
-    }
-    assert(v >= 0 && v < levels);
+    int v = (((levels * c) >> (24 - e)) + levels) >> 1;
+    av_assert2(v >= 0 && v < levels);
     return v;
 }
 
@@ -1143,7 +1238,7 @@ static inline int asym_quant(int c, int e, int qbits)
     m = (1 << (qbits-1));
     if (v >= m)
         v = m - 1;
-    assert(v >= -m);
+    av_assert2(v >= -m);
     return v & ((1 << qbits)-1);
 }
 
@@ -1151,8 +1246,8 @@ static inline int asym_quant(int c, int e, int qbits)
 /**
  * Quantize a set of mantissas for a single channel in a single block.
  */
-static void quantize_mantissas_blk_ch(AC3EncodeContext *s, int32_t *fixed_coef,
-                                      int8_t exp_shift, uint8_t *exp,
+static void quantize_mantissas_blk_ch(AC3Mant *s, int32_t *fixed_coef,
+                                      uint8_t *exp,
                                       uint8_t *bap, uint16_t *qmant, int n)
 {
     int i;
@@ -1160,7 +1255,7 @@ static void quantize_mantissas_blk_ch(AC3EncodeContext *s, int32_t *fixed_coef,
     for (i = 0; i < n; i++) {
         int v;
         int c = fixed_coef[i];
-        int e = exp[i] - exp_shift;
+        int e = exp[i];
         int b = bap[i];
         switch (b) {
         case 0:
@@ -1252,12 +1347,13 @@ static void quantize_mantissas(AC3EncodeContext *s)
 
     for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
         AC3Block *block = &s->blocks[blk];
-        s->mant1_cnt  = s->mant2_cnt  = s->mant4_cnt  = 0;
-        s->qmant1_ptr = s->qmant2_ptr = s->qmant4_ptr = NULL;
+        AC3Block *ref_block;
+        AC3Mant m = { 0 };
 
         for (ch = 0; ch < s->channels; ch++) {
-            quantize_mantissas_blk_ch(s, block->fixed_coef[ch], block->exp_shift[ch],
-                                      block->exp[ch], block->bap[ch],
+            ref_block = block->exp_ref_block[ch];
+            quantize_mantissas_blk_ch(&m, block->fixed_coef[ch],
+                                      ref_block->exp[ch], ref_block->bap[ch],
                                       block->qmant[ch], s->nb_coefs[ch]);
         }
     }
@@ -1269,6 +1365,8 @@ static void quantize_mantissas(AC3EncodeContext *s)
  */
 static void output_frame_header(AC3EncodeContext *s)
 {
+    AC3EncOptions *opt = &s->options;
+
     put_bits(&s->pb, 16, 0x0b77);   /* frame header */
     put_bits(&s->pb, 16, 0);        /* crc1: will be filled later */
     put_bits(&s->pb, 2,  s->bit_alloc.sr_code);
@@ -1277,20 +1375,43 @@ static void output_frame_header(AC3EncodeContext *s)
     put_bits(&s->pb, 3,  s->bitstream_mode);
     put_bits(&s->pb, 3,  s->channel_mode);
     if ((s->channel_mode & 0x01) && s->channel_mode != AC3_CHMODE_MONO)
-        put_bits(&s->pb, 2, 1);     /* XXX -4.5 dB */
+        put_bits(&s->pb, 2, s->center_mix_level);
     if (s->channel_mode & 0x04)
-        put_bits(&s->pb, 2, 1);     /* XXX -6 dB */
+        put_bits(&s->pb, 2, s->surround_mix_level);
     if (s->channel_mode == AC3_CHMODE_STEREO)
-        put_bits(&s->pb, 2, 0);     /* surround not indicated */
+        put_bits(&s->pb, 2, opt->dolby_surround_mode);
     put_bits(&s->pb, 1, s->lfe_on); /* LFE */
-    put_bits(&s->pb, 5, 31);        /* dialog norm: -31 db */
+    put_bits(&s->pb, 5, -opt->dialogue_level);
     put_bits(&s->pb, 1, 0);         /* no compression control word */
     put_bits(&s->pb, 1, 0);         /* no lang code */
-    put_bits(&s->pb, 1, 0);         /* no audio production info */
-    put_bits(&s->pb, 1, 0);         /* no copyright */
-    put_bits(&s->pb, 1, 1);         /* original bitstream */
+    put_bits(&s->pb, 1, opt->audio_production_info);
+    if (opt->audio_production_info) {
+        put_bits(&s->pb, 5, opt->mixing_level - 80);
+        put_bits(&s->pb, 2, opt->room_type);
+    }
+    put_bits(&s->pb, 1, opt->copyright);
+    put_bits(&s->pb, 1, opt->original);
+    if (s->bitstream_id == 6) {
+        /* alternate bit stream syntax */
+        put_bits(&s->pb, 1, opt->extended_bsi_1);
+        if (opt->extended_bsi_1) {
+            put_bits(&s->pb, 2, opt->preferred_stereo_downmix);
+            put_bits(&s->pb, 3, s->ltrt_center_mix_level);
+            put_bits(&s->pb, 3, s->ltrt_surround_mix_level);
+            put_bits(&s->pb, 3, s->loro_center_mix_level);
+            put_bits(&s->pb, 3, s->loro_surround_mix_level);
+        }
+        put_bits(&s->pb, 1, opt->extended_bsi_2);
+        if (opt->extended_bsi_2) {
+            put_bits(&s->pb, 2, opt->dolby_surround_ex_mode);
+            put_bits(&s->pb, 2, opt->dolby_headphone_mode);
+            put_bits(&s->pb, 1, opt->ad_converter_type);
+            put_bits(&s->pb, 9, 0);     /* xbsi2 and encinfo : reserved */
+        }
+    } else {
     put_bits(&s->pb, 1, 0);         /* no time code 1 */
     put_bits(&s->pb, 1, 0);         /* no time code 2 */
+    }
     put_bits(&s->pb, 1, 0);         /* no additional bit stream info */
 }
 
@@ -1327,7 +1448,7 @@ static void output_audio_block(AC3EncodeContext *s, int blk)
         put_bits(&s->pb, 1, block->new_rematrixing_strategy);
         if (block->new_rematrixing_strategy) {
             /* rematrixing flags */
-            for (rbnd = 0; rbnd < 4; rbnd++)
+            for (rbnd = 0; rbnd < s->num_rematrixing_bands; rbnd++)
                 put_bits(&s->pb, 1, block->rematrixing_flags[rbnd]);
         }
     }
@@ -1391,9 +1512,10 @@ static void output_audio_block(AC3EncodeContext *s, int blk)
     /* mantissas */
     for (ch = 0; ch < s->channels; ch++) {
         int b, q;
+        AC3Block *ref_block = block->exp_ref_block[ch];
         for (i = 0; i < s->nb_coefs[ch]; i++) {
             q = block->qmant[ch][i];
-            b = block->bap[ch][i];
+            b = ref_block->bap[ch][i];
             switch (b) {
             case 0:                                         break;
             case 1: if (q != 128) put_bits(&s->pb,   5, q); break;
@@ -1456,10 +1578,11 @@ static void output_frame_end(AC3EncodeContext *s)
     frame_size_58 = ((s->frame_size >> 2) + (s->frame_size >> 4)) << 1;
 
     /* pad the remainder of the frame with zeros */
+    av_assert2(s->frame_size * 8 - put_bits_count(&s->pb) >= 18);
     flush_put_bits(&s->pb);
     frame = s->pb.buf;
     pad_bytes = s->frame_size - (put_bits_ptr(&s->pb) - frame) - 2;
-    assert(pad_bytes >= 0);
+    av_assert2(pad_bytes >= 0);
     if (pad_bytes > 0)
         memset(put_bits_ptr(&s->pb), 0, pad_bytes);
 
@@ -1502,6 +1625,268 @@ static void output_frame(AC3EncodeContext *s, unsigned char *frame)
 }
 
 
+static void dprint_options(AVCodecContext *avctx)
+{
+#ifdef DEBUG
+    AC3EncodeContext *s = avctx->priv_data;
+    AC3EncOptions *opt = &s->options;
+    char strbuf[32];
+
+    switch (s->bitstream_id) {
+    case  6:  strncpy(strbuf, "AC-3 (alt syntax)", 32);      break;
+    case  8:  strncpy(strbuf, "AC-3 (standard)", 32);        break;
+    case  9:  strncpy(strbuf, "AC-3 (dnet half-rate)", 32);  break;
+    case 10:  strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break;
+    default: snprintf(strbuf, 32, "ERROR");
+    }
+    av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id);
+    av_dlog(avctx, "sample_fmt: %s\n", av_get_sample_fmt_name(avctx->sample_fmt));
+    av_get_channel_layout_string(strbuf, 32, s->channels, avctx->channel_layout);
+    av_dlog(avctx, "channel_layout: %s\n", strbuf);
+    av_dlog(avctx, "sample_rate: %d\n", s->sample_rate);
+    av_dlog(avctx, "bit_rate: %d\n", s->bit_rate);
+    if (s->cutoff)
+        av_dlog(avctx, "cutoff: %d\n", s->cutoff);
+
+    av_dlog(avctx, "per_frame_metadata: %s\n",
+            opt->allow_per_frame_metadata?"on":"off");
+    if (s->has_center)
+        av_dlog(avctx, "center_mixlev: %0.3f (%d)\n", opt->center_mix_level,
+                s->center_mix_level);
+    else
+        av_dlog(avctx, "center_mixlev: {not written}\n");
+    if (s->has_surround)
+        av_dlog(avctx, "surround_mixlev: %0.3f (%d)\n", opt->surround_mix_level,
+                s->surround_mix_level);
+    else
+        av_dlog(avctx, "surround_mixlev: {not written}\n");
+    if (opt->audio_production_info) {
+        av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level);
+        switch (opt->room_type) {
+        case 0:  strncpy(strbuf, "notindicated", 32); break;
+        case 1:  strncpy(strbuf, "large", 32);        break;
+        case 2:  strncpy(strbuf, "small", 32);        break;
+        default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type);
+        }
+        av_dlog(avctx, "room_type: %s\n", strbuf);
+    } else {
+        av_dlog(avctx, "mixing_level: {not written}\n");
+        av_dlog(avctx, "room_type: {not written}\n");
+    }
+    av_dlog(avctx, "copyright: %s\n", opt->copyright?"on":"off");
+    av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level);
+    if (s->channel_mode == AC3_CHMODE_STEREO) {
+        switch (opt->dolby_surround_mode) {
+        case 0:  strncpy(strbuf, "notindicated", 32); break;
+        case 1:  strncpy(strbuf, "on", 32);           break;
+        case 2:  strncpy(strbuf, "off", 32);          break;
+        default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode);
+        }
+        av_dlog(avctx, "dsur_mode: %s\n", strbuf);
+    } else {
+        av_dlog(avctx, "dsur_mode: {not written}\n");
+    }
+    av_dlog(avctx, "original: %s\n", opt->original?"on":"off");
+
+    if (s->bitstream_id == 6) {
+        if (opt->extended_bsi_1) {
+            switch (opt->preferred_stereo_downmix) {
+            case 0:  strncpy(strbuf, "notindicated", 32); break;
+            case 1:  strncpy(strbuf, "ltrt", 32);         break;
+            case 2:  strncpy(strbuf, "loro", 32);         break;
+            default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix);
+            }
+            av_dlog(avctx, "dmix_mode: %s\n", strbuf);
+            av_dlog(avctx, "ltrt_cmixlev: %0.3f (%d)\n",
+                    opt->ltrt_center_mix_level, s->ltrt_center_mix_level);
+            av_dlog(avctx, "ltrt_surmixlev: %0.3f (%d)\n",
+                    opt->ltrt_surround_mix_level, s->ltrt_surround_mix_level);
+            av_dlog(avctx, "loro_cmixlev: %0.3f (%d)\n",
+                    opt->loro_center_mix_level, s->loro_center_mix_level);
+            av_dlog(avctx, "loro_surmixlev: %0.3f (%d)\n",
+                    opt->loro_surround_mix_level, s->loro_surround_mix_level);
+        } else {
+            av_dlog(avctx, "extended bitstream info 1: {not written}\n");
+        }
+        if (opt->extended_bsi_2) {
+            switch (opt->dolby_surround_ex_mode) {
+            case 0:  strncpy(strbuf, "notindicated", 32); break;
+            case 1:  strncpy(strbuf, "on", 32);           break;
+            case 2:  strncpy(strbuf, "off", 32);          break;
+            default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode);
+            }
+            av_dlog(avctx, "dsurex_mode: %s\n", strbuf);
+            switch (opt->dolby_headphone_mode) {
+            case 0:  strncpy(strbuf, "notindicated", 32); break;
+            case 1:  strncpy(strbuf, "on", 32);           break;
+            case 2:  strncpy(strbuf, "off", 32);          break;
+            default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode);
+            }
+            av_dlog(avctx, "dheadphone_mode: %s\n", strbuf);
+
+            switch (opt->ad_converter_type) {
+            case 0:  strncpy(strbuf, "standard", 32); break;
+            case 1:  strncpy(strbuf, "hdcd", 32);     break;
+            default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type);
+            }
+            av_dlog(avctx, "ad_conv_type: %s\n", strbuf);
+        } else {
+            av_dlog(avctx, "extended bitstream info 2: {not written}\n");
+        }
+    }
+#endif
+}
+
+
+#define FLT_OPTION_THRESHOLD 0.01
+
+static int validate_float_option(float v, const float *v_list, int v_list_size)
+{
+    int i;
+
+    for (i = 0; i < v_list_size; i++) {
+        if (v < (v_list[i] + FLT_OPTION_THRESHOLD) &&
+            v > (v_list[i] - FLT_OPTION_THRESHOLD))
+            break;
+    }
+    if (i == v_list_size)
+        return -1;
+
+    return i;
+}
+
+
+static void validate_mix_level(void *log_ctx, const char *opt_name,
+                               float *opt_param, const float *list,
+                               int list_size, int default_value, int min_value,
+                               int *ctx_param)
+{
+    int mixlev = validate_float_option(*opt_param, list, list_size);
+    if (mixlev < min_value) {
+        mixlev = default_value;
+        if (*opt_param >= 0.0) {
+            av_log(log_ctx, AV_LOG_WARNING, "requested %s is not valid. using "
+                   "default value: %0.3f\n", opt_name, list[mixlev]);
+        }
+    }
+    *opt_param = list[mixlev];
+    *ctx_param = mixlev;
+}
+
+
+/**
+ * Validate metadata options as set by AVOption system.
+ * These values can optionally be changed per-frame.
+ */
+static int validate_metadata(AVCodecContext *avctx)
+{
+    AC3EncodeContext *s = avctx->priv_data;
+    AC3EncOptions *opt = &s->options;
+
+    /* validate mixing levels */
+    if (s->has_center) {
+        validate_mix_level(avctx, "center_mix_level", &opt->center_mix_level,
+                           cmixlev_options, CMIXLEV_NUM_OPTIONS, 1, 0,
+                           &s->center_mix_level);
+    }
+    if (s->has_surround) {
+        validate_mix_level(avctx, "surround_mix_level", &opt->surround_mix_level,
+                           surmixlev_options, SURMIXLEV_NUM_OPTIONS, 1, 0,
+                           &s->surround_mix_level);
+    }
+
+    /* set audio production info flag */
+    if (opt->mixing_level >= 0 || opt->room_type >= 0) {
+        if (opt->mixing_level < 0) {
+            av_log(avctx, AV_LOG_ERROR, "mixing_level must be set if "
+                   "room_type is set\n");
+            return AVERROR(EINVAL);
+        }
+        if (opt->mixing_level < 80) {
+            av_log(avctx, AV_LOG_ERROR, "invalid mixing level. must be between "
+                   "80dB and 111dB\n");
+            return AVERROR(EINVAL);
+        }
+        /* default room type */
+        if (opt->room_type < 0)
+            opt->room_type = 0;
+        opt->audio_production_info = 1;
+    } else {
+        opt->audio_production_info = 0;
+    }
+
+    /* set extended bsi 1 flag */
+    if ((s->has_center || s->has_surround) &&
+        (opt->preferred_stereo_downmix >= 0 ||
+         opt->ltrt_center_mix_level   >= 0 ||
+         opt->ltrt_surround_mix_level >= 0 ||
+         opt->loro_center_mix_level   >= 0 ||
+         opt->loro_surround_mix_level >= 0)) {
+        /* default preferred stereo downmix */
+        if (opt->preferred_stereo_downmix < 0)
+            opt->preferred_stereo_downmix = 0;
+        /* validate Lt/Rt center mix level */
+        validate_mix_level(avctx, "ltrt_center_mix_level",
+                           &opt->ltrt_center_mix_level, extmixlev_options,
+                           EXTMIXLEV_NUM_OPTIONS, 5, 0,
+                           &s->ltrt_center_mix_level);
+        /* validate Lt/Rt surround mix level */
+        validate_mix_level(avctx, "ltrt_surround_mix_level",
+                           &opt->ltrt_surround_mix_level, extmixlev_options,
+                           EXTMIXLEV_NUM_OPTIONS, 6, 3,
+                           &s->ltrt_surround_mix_level);
+        /* validate Lo/Ro center mix level */
+        validate_mix_level(avctx, "loro_center_mix_level",
+                           &opt->loro_center_mix_level, extmixlev_options,
+                           EXTMIXLEV_NUM_OPTIONS, 5, 0,
+                           &s->loro_center_mix_level);
+        /* validate Lo/Ro surround mix level */
+        validate_mix_level(avctx, "loro_surround_mix_level",
+                           &opt->loro_surround_mix_level, extmixlev_options,
+                           EXTMIXLEV_NUM_OPTIONS, 6, 3,
+                           &s->loro_surround_mix_level);
+        opt->extended_bsi_1 = 1;
+    } else {
+        opt->extended_bsi_1 = 0;
+    }
+
+    /* set extended bsi 2 flag */
+    if (opt->dolby_surround_ex_mode >= 0 ||
+        opt->dolby_headphone_mode   >= 0 ||
+        opt->ad_converter_type      >= 0) {
+        /* default dolby surround ex mode */
+        if (opt->dolby_surround_ex_mode < 0)
+            opt->dolby_surround_ex_mode = 0;
+        /* default dolby headphone mode */
+        if (opt->dolby_headphone_mode < 0)
+            opt->dolby_headphone_mode = 0;
+        /* default A/D converter type */
+        if (opt->ad_converter_type < 0)
+            opt->ad_converter_type = 0;
+        opt->extended_bsi_2 = 1;
+    } else {
+        opt->extended_bsi_2 = 0;
+    }
+
+    /* set bitstream id for alternate bitstream syntax */
+    if (opt->extended_bsi_1 || opt->extended_bsi_2) {
+        if (s->bitstream_id > 8 && s->bitstream_id < 11) {
+            static int warn_once = 1;
+            if (warn_once) {
+                av_log(avctx, AV_LOG_WARNING, "alternate bitstream syntax is "
+                       "not compatible with reduced samplerates. writing of "
+                       "extended bitstream information will be disabled.\n");
+                warn_once = 0;
+            }
+        } else {
+            s->bitstream_id = 6;
+        }
+    }
+
+    return 0;
+}
+
+
 /**
  * Encode a single AC-3 frame.
  */
@@ -1512,6 +1897,12 @@ static int ac3_encode_frame(AVCodecContext *avctx, unsigned char *frame,
     const SampleType *samples = data;
     int ret;
 
+    if (s->options.allow_per_frame_metadata) {
+        ret = validate_metadata(avctx);
+        if (ret)
+            return ret;
+    }
+
     if (s->bit_alloc.sr_code == 1)
         adjust_frame_size(s);
 
@@ -1519,10 +1910,10 @@ static int ac3_encode_frame(AVCodecContext *avctx, unsigned char *frame,
 
     apply_mdct(s);
 
-    compute_rematrixing_strategy(s);
-
     scale_coefficients(s);
 
+    compute_rematrixing_strategy(s);
+
     apply_rematrixing(s);
 
     process_exponents(s);
@@ -1620,6 +2011,8 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
     default:
         return AVERROR(EINVAL);
     }
+    s->has_center   = (s->channel_mode & 0x01) && s->channel_mode != AC3_CHMODE_MONO;
+    s->has_surround =  s->channel_mode & 0x04;
 
     s->channel_map  = ff_ac3_enc_channel_map[s->channel_mode][s->lfe_on];
     *channel_layout = ch_layout;
@@ -1658,6 +2051,7 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
     s->sample_rate        = avctx->sample_rate;
     s->bit_alloc.sr_shift = i % 3;
     s->bit_alloc.sr_code  = i / 3;
+    s->bitstream_id       = 8 + s->bit_alloc.sr_shift;
 
     /* validate bit rate */
     for (i = 0; i < 19; i++) {
@@ -1680,6 +2074,22 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
     if (s->cutoff > (s->sample_rate >> 1))
         s->cutoff = s->sample_rate >> 1;
 
+    /* validate audio service type / channels combination */
+    if ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_KARAOKE &&
+         avctx->channels == 1) ||
+        ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_COMMENTARY ||
+          avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_EMERGENCY  ||
+          avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_VOICE_OVER)
+         && avctx->channels > 1)) {
+        av_log(avctx, AV_LOG_ERROR, "invalid audio service type for the "
+                                    "specified number of channels\n");
+        return AVERROR(EINVAL);
+    }
+
+    ret = validate_metadata(avctx);
+    if (ret)
+        return ret;
+
     return 0;
 }
 
@@ -1700,9 +2110,7 @@ static av_cold void set_bandwidth(AC3EncodeContext *s)
         bw_code        = av_clip((fbw_coeffs - 73) / 3, 0, 60);
     } else {
         /* use default bandwidth setting */
-        /* XXX: should compute the bandwidth according to the frame
-           size, so that we avoid annoying high frequency artifacts */
-        bw_code = 50;
+        bw_code = ac3_bandwidth_tab[s->fbw_channels-1][s->bit_alloc.sr_code][s->frame_size_code/2];
     }
 
     /* set number of coefficients for each channel */
@@ -1815,14 +2223,15 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx)
 
     avctx->frame_size = AC3_FRAME_SIZE;
 
-    ac3_common_init();
+    ff_ac3_common_init();
 
     ret = validate_options(avctx, s);
     if (ret)
         return ret;
 
-    s->bitstream_id   = 8 + s->bit_alloc.sr_shift;
-    s->bitstream_mode = 0; /* complete main audio service */
+    s->bitstream_mode = avctx->audio_service_type;
+    if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE)
+        s->bitstream_mode = 0x7;
 
     s->frame_size_min  = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code];
     s->bits_written    = 0;
@@ -1856,6 +2265,9 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx)
     avctx->coded_frame= avcodec_alloc_frame();
 
     dsputil_init(&s->dsp, avctx);
+    ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
+
+    dprint_options(avctx);
 
     return 0;
 init_fail:
diff --git a/ffmpeg-mt/libavcodec/ac3enc_fixed.c b/ffmpeg-mt/libavcodec/ac3enc_fixed.c
index 3723b08..720d87d 100644
--- a/ffmpeg-mt/libavcodec/ac3enc_fixed.c
+++ b/ffmpeg-mt/libavcodec/ac3enc_fixed.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles at gmail.com>
  * Copyright (c) 2006-2010 Prakash Punnoor <prakash at punnoor.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,54 +26,17 @@
  * fixed-point AC-3 encoder.
  */
 
+#define CONFIG_FFT_FLOAT 0
 #undef CONFIG_AC3ENC_FLOAT
 #include "ac3enc.c"
 
 
-/** Scale a float value by 2^15, convert to an integer, and clip to range -32767..32767. */
-#define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767)
-
-
 /**
  * Finalize MDCT and free allocated memory.
  */
 static av_cold void mdct_end(AC3MDCTContext *mdct)
 {
-    mdct->nbits = 0;
-    av_freep(&mdct->costab);
-    av_freep(&mdct->sintab);
-    av_freep(&mdct->xcos1);
-    av_freep(&mdct->xsin1);
-    av_freep(&mdct->rot_tmp);
-    av_freep(&mdct->cplx_tmp);
-}
-
-
-/**
- * Initialize FFT tables.
- * @param ln log2(FFT size)
- */
-static av_cold int fft_init(AVCodecContext *avctx, AC3MDCTContext *mdct, int ln)
-{
-    int i, n, n2;
-    float alpha;
-
-    n  = 1 << ln;
-    n2 = n >> 1;
-
-    FF_ALLOC_OR_GOTO(avctx, mdct->costab, n2 * sizeof(*mdct->costab), fft_alloc_fail);
-    FF_ALLOC_OR_GOTO(avctx, mdct->sintab, n2 * sizeof(*mdct->sintab), fft_alloc_fail);
-
-    for (i = 0; i < n2; i++) {
-        alpha     = 2.0 * M_PI * i / n;
-        mdct->costab[i] = FIX15(cos(alpha));
-        mdct->sintab[i] = FIX15(sin(alpha));
-    }
-
-    return 0;
-fft_alloc_fail:
-    mdct_end(mdct);
-    return AVERROR(ENOMEM);
+    ff_fft_end(&mdct->fft);
 }
 
 
@@ -84,183 +47,19 @@ fft_alloc_fail:
 static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
                              int nbits)
 {
-    int i, n, n4, ret;
-
-    n  = 1 << nbits;
-    n4 = n >> 2;
-
-    mdct->nbits = nbits;
-
-    ret = fft_init(avctx, mdct, nbits - 2);
-    if (ret)
-        return ret;
-
+    int ret = ff_mdct_init(&mdct->fft, nbits, 0, 1.0);
     mdct->window = ff_ac3_window;
-
-    FF_ALLOC_OR_GOTO(avctx, mdct->xcos1,    n4 * sizeof(*mdct->xcos1),    mdct_alloc_fail);
-    FF_ALLOC_OR_GOTO(avctx, mdct->xsin1,    n4 * sizeof(*mdct->xsin1),    mdct_alloc_fail);
-    FF_ALLOC_OR_GOTO(avctx, mdct->rot_tmp,  n  * sizeof(*mdct->rot_tmp),  mdct_alloc_fail);
-    FF_ALLOC_OR_GOTO(avctx, mdct->cplx_tmp, n4 * sizeof(*mdct->cplx_tmp), mdct_alloc_fail);
-
-    for (i = 0; i < n4; i++) {
-        float alpha = 2.0 * M_PI * (i + 1.0 / 8.0) / n;
-        mdct->xcos1[i] = FIX15(-cos(alpha));
-        mdct->xsin1[i] = FIX15(-sin(alpha));
-    }
-
-    return 0;
-mdct_alloc_fail:
-    mdct_end(mdct);
-    return AVERROR(ENOMEM);
-}
-
-
-/** Butterfly op */
-#define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1)  \
-{                                                       \
-  int ax, ay, bx, by;                                   \
-  bx  = pre1;                                           \
-  by  = pim1;                                           \
-  ax  = qre1;                                           \
-  ay  = qim1;                                           \
-  pre = (bx + ax) >> 1;                                 \
-  pim = (by + ay) >> 1;                                 \
-  qre = (bx - ax) >> 1;                                 \
-  qim = (by - ay) >> 1;                                 \
-}
-
-
-/** Complex multiply */
-#define CMUL(pre, pim, are, aim, bre, bim)              \
-{                                                       \
-   pre = (MUL16(are, bre) - MUL16(aim, bim)) >> 15;     \
-   pim = (MUL16(are, bim) + MUL16(bre, aim)) >> 15;     \
-}
-
-
-/**
- * Calculate a 2^n point complex FFT on 2^ln points.
- * @param z  complex input/output samples
- * @param ln log2(FFT size)
- */
-static void fft(AC3MDCTContext *mdct, IComplex *z, int ln)
-{
-    int j, l, np, np2;
-    int nblocks, nloops;
-    register IComplex *p,*q;
-    int tmp_re, tmp_im;
-
-    np = 1 << ln;
-
-    /* reverse */
-    for (j = 0; j < np; j++) {
-        int k = av_reverse[j] >> (8 - ln);
-        if (k < j)
-            FFSWAP(IComplex, z[k], z[j]);
-    }
-
-    /* pass 0 */
-
-    p = &z[0];
-    j = np >> 1;
-    do {
-        BF(p[0].re, p[0].im, p[1].re, p[1].im,
-           p[0].re, p[0].im, p[1].re, p[1].im);
-        p += 2;
-    } while (--j);
-
-    /* pass 1 */
-
-    p = &z[0];
-    j = np >> 2;
-    do {
-        BF(p[0].re, p[0].im, p[2].re,  p[2].im,
-           p[0].re, p[0].im, p[2].re,  p[2].im);
-        BF(p[1].re, p[1].im, p[3].re,  p[3].im,
-           p[1].re, p[1].im, p[3].im, -p[3].re);
-        p+=4;
-    } while (--j);
-
-    /* pass 2 .. ln-1 */
-
-    nblocks = np >> 3;
-    nloops  =  1 << 2;
-    np2     = np >> 1;
-    do {
-        p = z;
-        q = z + nloops;
-        for (j = 0; j < nblocks; j++) {
-            BF(p->re, p->im, q->re, q->im,
-               p->re, p->im, q->re, q->im);
-            p++;
-            q++;
-            for(l = nblocks; l < np2; l += nblocks) {
-                CMUL(tmp_re, tmp_im, mdct->costab[l], -mdct->sintab[l], q->re, q->im);
-                BF(p->re, p->im, q->re,  q->im,
-                   p->re, p->im, tmp_re, tmp_im);
-                p++;
-                q++;
-            }
-            p += nloops;
-            q += nloops;
-        }
-        nblocks = nblocks >> 1;
-        nloops  = nloops  << 1;
-    } while (nblocks);
-}
-
-
-/**
- * Calculate a 512-point MDCT
- * @param out 256 output frequency coefficients
- * @param in  512 windowed input audio samples
- */
-static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in)
-{
-    int i, re, im, n, n2, n4;
-    int16_t *rot = mdct->rot_tmp;
-    IComplex *x  = mdct->cplx_tmp;
-
-    n  = 1 << mdct->nbits;
-    n2 = n >> 1;
-    n4 = n >> 2;
-
-    /* shift to simplify computations */
-    for (i = 0; i <n4; i++)
-        rot[i] = -in[i + 3*n4];
-    memcpy(&rot[n4], &in[0], 3*n4*sizeof(*in));
-
-    /* pre rotation */
-    for (i = 0; i < n4; i++) {
-        re =  ((int)rot[   2*i] - (int)rot[ n-1-2*i]) >> 1;
-        im = -((int)rot[n2+2*i] - (int)rot[n2-1-2*i]) >> 1;
-        CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i]);
-    }
-
-    fft(mdct, x, mdct->nbits - 2);
-
-    /* post rotation */
-    for (i = 0; i < n4; i++) {
-        re = x[i].re;
-        im = x[i].im;
-        CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i]);
-    }
+    return ret;
 }
 
 
 /**
  * Apply KBD window to input samples prior to MDCT.
  */
-static void apply_window(int16_t *output, const int16_t *input,
-                         const int16_t *window, int n)
+static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input,
+                         const int16_t *window, unsigned int len)
 {
-    int i;
-    int n2 = n >> 1;
-
-    for (i = 0; i < n2; i++) {
-        output[i]     = MUL16(input[i],     window[i]) >> 15;
-        output[n-i-1] = MUL16(input[n-i-1], window[i]) >> 15;
-    }
+    dsp->apply_window_int16(output, input, window, len);
 }
 
 
@@ -270,162 +69,47 @@ static void apply_window(int16_t *output, const int16_t *input,
  * @param n   number of values in the array
  * @return    log2(max(abs(tab[])))
  */
-static int log2_tab(int16_t *tab, int n)
+static int log2_tab(AC3EncodeContext *s, int16_t *src, int len)
 {
-    int i, v;
-
-    v = 0;
-    for (i = 0; i < n; i++)
-        v |= abs(tab[i]);
-
+    int v = s->ac3dsp.ac3_max_msb_abs_int16(src, len);
     return av_log2(v);
 }
 
 
 /**
- * Left-shift each value in an array by a specified amount.
- * @param tab    input array
- * @param n      number of values in the array
- * @param lshift left shift amount. a negative value means right shift.
- */
-static void lshift_tab(int16_t *tab, int n, int lshift)
-{
-    int i;
-
-    if (lshift > 0) {
-        for (i = 0; i < n; i++)
-            tab[i] <<= lshift;
-    } else if (lshift < 0) {
-        lshift = -lshift;
-        for (i = 0; i < n; i++)
-            tab[i] >>= lshift;
-    }
-}
-
-
-/**
  * Normalize the input samples to use the maximum available precision.
- * This assumes signed 16-bit input samples. Exponents are reduced by 9 to
- * match the 24-bit internal precision for MDCT coefficients.
+ * This assumes signed 16-bit input samples.
  *
  * @return exponent shift
  */
 static int normalize_samples(AC3EncodeContext *s)
 {
-    int v = 14 - log2_tab(s->windowed_samples, AC3_WINDOW_SIZE);
-    v = FFMAX(0, v);
-    lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v);
-    return v - 9;
+    int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE);
+    if (v > 0)
+        s->ac3dsp.ac3_lshift_int16(s->windowed_samples, AC3_WINDOW_SIZE, v);
+    /* +6 to right-shift from 31-bit to 25-bit */
+    return v + 6;
 }
 
 
 /**
- * Scale MDCT coefficients from float to fixed-point.
+ * Scale MDCT coefficients to 25-bit signed fixed-point.
  */
 static void scale_coefficients(AC3EncodeContext *s)
 {
-    /* scaling/conversion is obviously not needed for the fixed-point encoder
-       since the coefficients are already fixed-point. */
-    return;
-}
-
-
-#ifdef TEST
-/*************************************************************************/
-/* TEST */
-
-#include "libavutil/lfg.h"
-
-#define MDCT_NBITS 9
-#define MDCT_SAMPLES (1 << MDCT_NBITS)
-#define FN (MDCT_SAMPLES/4)
-
-
-static void fft_test(AC3MDCTContext *mdct, AVLFG *lfg)
-{
-    IComplex in[FN], in1[FN];
-    int k, n, i;
-    float sum_re, sum_im, a;
-
-    for (i = 0; i < FN; i++) {
-        in[i].re = av_lfg_get(lfg) % 65535 - 32767;
-        in[i].im = av_lfg_get(lfg) % 65535 - 32767;
-        in1[i]   = in[i];
-    }
-    fft(mdct, in, 7);
-
-    /* do it by hand */
-    for (k = 0; k < FN; k++) {
-        sum_re = 0;
-        sum_im = 0;
-        for (n = 0; n < FN; n++) {
-            a = -2 * M_PI * (n * k) / FN;
-            sum_re += in1[n].re * cos(a) - in1[n].im * sin(a);
-            sum_im += in1[n].re * sin(a) + in1[n].im * cos(a);
-        }
-        av_log(NULL, AV_LOG_DEBUG, "%3d: %6d,%6d %6.0f,%6.0f\n",
-               k, in[k].re, in[k].im, sum_re / FN, sum_im / FN);
-    }
-}
-
-
-static void mdct_test(AC3MDCTContext *mdct, AVLFG *lfg)
-{
-    int16_t input[MDCT_SAMPLES];
-    int32_t output[AC3_MAX_COEFS];
-    float input1[MDCT_SAMPLES];
-    float output1[AC3_MAX_COEFS];
-    float s, a, err, e, emax;
-    int i, k, n;
+    int blk, ch;
 
-    for (i = 0; i < MDCT_SAMPLES; i++) {
-        input[i]  = (av_lfg_get(lfg) % 65535 - 32767) * 9 / 10;
-        input1[i] = input[i];
-    }
-
-    mdct512(mdct, output, input);
-
-    /* do it by hand */
-    for (k = 0; k < AC3_MAX_COEFS; k++) {
-        s = 0;
-        for (n = 0; n < MDCT_SAMPLES; n++) {
-            a = (2*M_PI*(2*n+1+MDCT_SAMPLES/2)*(2*k+1) / (4 * MDCT_SAMPLES));
-            s += input1[n] * cos(a);
+    for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
+        AC3Block *block = &s->blocks[blk];
+        for (ch = 0; ch < s->channels; ch++) {
+            s->ac3dsp.ac3_rshift_int32(block->mdct_coef[ch], AC3_MAX_COEFS,
+                                       block->coeff_shift[ch]);
         }
-        output1[k] = -2 * s / MDCT_SAMPLES;
     }
-
-    err  = 0;
-    emax = 0;
-    for (i = 0; i < AC3_MAX_COEFS; i++) {
-        av_log(NULL, AV_LOG_DEBUG, "%3d: %7d %7.0f\n", i, output[i], output1[i]);
-        e = output[i] - output1[i];
-        if (e > emax)
-            emax = e;
-        err += e * e;
-    }
-    av_log(NULL, AV_LOG_DEBUG, "err2=%f emax=%f\n", err / AC3_MAX_COEFS, emax);
-}
-
-
-int main(void)
-{
-    AVLFG lfg;
-    AC3MDCTContext mdct;
-
-    mdct.avctx = NULL;
-    av_log_set_level(AV_LOG_DEBUG);
-    mdct_init(&mdct, 9);
-
-    fft_test(&mdct, &lfg);
-    mdct_test(&mdct, &lfg);
-
-    return 0;
 }
-#endif /* TEST */
 
 
-AVCodec ac3_fixed_encoder = {
+AVCodec ff_ac3_fixed_encoder = {
     "ac3_fixed",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AC3,
@@ -436,5 +120,6 @@ AVCodec ac3_fixed_encoder = {
     NULL,
     .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
+    .priv_class = &ac3enc_class,
     .channel_layouts = ac3_channel_layouts,
 };
diff --git a/ffmpeg-mt/libavcodec/ac3enc_fixed.h b/ffmpeg-mt/libavcodec/ac3enc_fixed.h
deleted file mode 100644
index 12c8ace..0000000
--- a/ffmpeg-mt/libavcodec/ac3enc_fixed.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * The simplest AC-3 encoder
- * Copyright (c) 2000 Fabrice Bellard
- * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles at gmail.com>
- * Copyright (c) 2006-2010 Prakash Punnoor <prakash at punnoor.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * fixed-point AC-3 encoder header.
- */
-
-#ifndef AVCODEC_AC3ENC_FIXED_H
-#define AVCODEC_AC3ENC_FIXED_H
-
-#include <stdint.h>
-
-
-typedef int16_t SampleType;
-typedef int32_t CoefType;
-typedef int64_t CoefSumType;
-
-
-/**
- * Compex number.
- * Used in fixed-point MDCT calculation.
- */
-typedef struct IComplex {
-    int16_t re,im;
-} IComplex;
-
-typedef struct AC3MDCTContext {
-    const int16_t *window;                  ///< MDCT window function
-    int nbits;                              ///< log2(transform size)
-    int16_t *costab;                        ///< FFT cos table
-    int16_t *sintab;                        ///< FFT sin table
-    int16_t *xcos1;                         ///< MDCT cos table
-    int16_t *xsin1;                         ///< MDCT sin table
-    int16_t *rot_tmp;                       ///< temp buffer for pre-rotated samples
-    IComplex *cplx_tmp;                     ///< temp buffer for complex pre-rotated samples
-} AC3MDCTContext;
-
-#endif /* AVCODEC_AC3ENC_FIXED_H */
diff --git a/ffmpeg-mt/libavcodec/ac3enc_float.c b/ffmpeg-mt/libavcodec/ac3enc_float.c
index f324636..d2435de 100644
--- a/ffmpeg-mt/libavcodec/ac3enc_float.c
+++ b/ffmpeg-mt/libavcodec/ac3enc_float.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles at gmail.com>
  * Copyright (c) 2006-2010 Prakash Punnoor <prakash at punnoor.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,6 +28,7 @@
 
 #define CONFIG_AC3ENC_FLOAT 1
 #include "ac3enc.c"
+#include "kbdwin.h"
 
 
 /**
@@ -48,17 +49,19 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
                              int nbits)
 {
     float *window;
-    int n, n2;
+    int i, n, n2;
 
     n  = 1 << nbits;
     n2 = n >> 1;
 
-    window = av_malloc(n2 * sizeof(*window));
+    window = av_malloc(n * sizeof(*window));
     if (!window) {
         av_log(avctx, AV_LOG_ERROR, "Cannot allocate memory.\n");
         return AVERROR(ENOMEM);
     }
     ff_kbd_window_init(window, 5.0, n2);
+    for (i = 0; i < n2; i++)
+        window[n-1-i] = window[i];
     mdct->window = window;
 
     return ff_mdct_init(&mdct->fft, nbits, 0, -2.0 / n);
@@ -66,29 +69,12 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
 
 
 /**
- * Calculate a 512-point MDCT
- * @param out 256 output frequency coefficients
- * @param in  512 windowed input audio samples
- */
-static void mdct512(AC3MDCTContext *mdct, float *out, float *in)
-{
-    ff_mdct_calc(&mdct->fft, out, in);
-}
-
-
-/**
  * Apply KBD window to input samples prior to MDCT.
  */
-static void apply_window(float *output, const float *input,
-                         const float *window, int n)
+static void apply_window(DSPContext *dsp, float *output, const float *input,
+                         const float *window, unsigned int len)
 {
-    int i;
-    int n2 = n >> 1;
-
-    for (i = 0; i < n2; i++) {
-        output[i]     = input[i]     * window[i];
-        output[n-i-1] = input[n-i-1] * window[i];
-    }
+    dsp->vector_fmul(output, input, window, len);
 }
 
 
@@ -107,13 +93,12 @@ static int normalize_samples(AC3EncodeContext *s)
  */
 static void scale_coefficients(AC3EncodeContext *s)
 {
-    int i;
-    for (i = 0; i < AC3_MAX_COEFS * AC3_MAX_BLOCKS * s->channels; i++)
-        s->fixed_coef_buffer[i] = SCALE_FLOAT(s->mdct_coef_buffer[i], 24);
+    s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer, s->mdct_coef_buffer,
+                               AC3_MAX_COEFS * AC3_MAX_BLOCKS * s->channels);
 }
 
 
-AVCodec ac3_encoder = {
+AVCodec ff_ac3_encoder = {
     "ac3",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AC3,
@@ -124,5 +109,6 @@ AVCodec ac3_encoder = {
     NULL,
     .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
+    .priv_class = &ac3enc_class,
     .channel_layouts = ac3_channel_layouts,
 };
diff --git a/ffmpeg-mt/libavcodec/ac3enc_float.h b/ffmpeg-mt/libavcodec/ac3enc_float.h
deleted file mode 100644
index 1726ca0..0000000
--- a/ffmpeg-mt/libavcodec/ac3enc_float.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * The simplest AC-3 encoder
- * Copyright (c) 2000 Fabrice Bellard
- * Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles at gmail.com>
- * Copyright (c) 2006-2010 Prakash Punnoor <prakash at punnoor.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * floating-point AC-3 encoder header.
- */
-
-#ifndef AVCODEC_AC3ENC_FLOAT_H
-#define AVCODEC_AC3ENC_FLOAT_H
-
-#include "fft.h"
-
-
-typedef float SampleType;
-typedef float CoefType;
-typedef float CoefSumType;
-
-
-typedef struct AC3MDCTContext {
-    const float *window;    ///< MDCT window function
-    FFTContext fft;         ///< FFT context for MDCT calculation
-} AC3MDCTContext;
-
-#endif /* AVCODEC_AC3ENC_FLOAT_H */
diff --git a/ffmpeg-mt/libavcodec/ac3tab.c b/ffmpeg-mt/libavcodec/ac3tab.c
index 4fc0824..6a4d8cd 100644
--- a/ffmpeg-mt/libavcodec/ac3tab.c
+++ b/ffmpeg-mt/libavcodec/ac3tab.c
@@ -2,20 +2,20 @@
  * AC-3 tables
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,7 +24,7 @@
  * tables taken directly from the AC-3 spec.
  */
 
-#include "libavcore/audioconvert.h"
+#include "libavutil/audioconvert.h"
 #include "avcodec.h"
 #include "ac3tab.h"
 
@@ -141,7 +141,7 @@ const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 };
 /* AC-3 MDCT window */
 
 /* MDCT window */
-const int16_t ff_ac3_window[AC3_WINDOW_SIZE/2] = {
+DECLARE_ALIGNED(16, const int16_t, ff_ac3_window)[AC3_WINDOW_SIZE/2] = {
     4,    7,   12,   16,   21,   28,   34,   42,
    51,   61,   72,   84,   97,  111,  127,  145,
   164,  184,  207,  231,  257,  285,  315,  347,
@@ -292,11 +292,6 @@ const uint16_t ff_ac3_fast_gain_tab[8]= {
     0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400,
 };
 
-const uint8_t ff_ac3_critical_band_size_tab[AC3_CRITICAL_BANDS]={
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
-    3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
-};
 /**
  * Default channel map for a dependent substream defined by acmod
  */
diff --git a/ffmpeg-mt/libavcodec/ac3tab.h b/ffmpeg-mt/libavcodec/ac3tab.h
index dd8cabf..292ce0d 100644
--- a/ffmpeg-mt/libavcodec/ac3tab.h
+++ b/ffmpeg-mt/libavcodec/ac3tab.h
@@ -2,20 +2,20 @@
  * AC-3 tables
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,12 @@
 #include "libavutil/common.h"
 #include "ac3.h"
 
+#if CONFIG_HARDCODED_TABLES
+#   define HCONST const
+#else
+#   define HCONST
+#endif
+
 extern const uint16_t ff_ac3_frame_size_tab[38][3];
 extern const uint8_t  ff_ac3_channels_tab[8];
 extern const uint16_t ff_ac3_channel_layout_tab[8];
@@ -43,8 +49,9 @@ extern const uint16_t ff_ac3_slow_gain_tab[4];
 extern const uint16_t ff_ac3_db_per_bit_tab[4];
 extern const int16_t  ff_ac3_floor_tab[8];
 extern const uint16_t ff_ac3_fast_gain_tab[8];
-extern const uint8_t  ff_ac3_critical_band_size_tab[AC3_CRITICAL_BANDS];
 extern const uint16_t ff_eac3_default_chmap[8];
+extern const uint8_t  ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1];
+extern HCONST uint8_t ff_ac3_bin_to_band_tab[253];
 
 /** Custom channel map locations bitmask
  *  Other channels described in documentation:
diff --git a/ffmpeg-mt/libavcodec/acelp_filters.c b/ffmpeg-mt/libavcodec/acelp_filters.c
index 31f0e86..04f6d4a 100644
--- a/ffmpeg-mt/libavcodec/acelp_filters.c
+++ b/ffmpeg-mt/libavcodec/acelp_filters.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/acelp_filters.h b/ffmpeg-mt/libavcodec/acelp_filters.h
index 0b1ccf4..b8715d2 100644
--- a/ffmpeg-mt/libavcodec/acelp_filters.h
+++ b/ffmpeg-mt/libavcodec/acelp_filters.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/acelp_pitch_delay.c b/ffmpeg-mt/libavcodec/acelp_pitch_delay.c
index cddf726..4e44bc9 100644
--- a/ffmpeg-mt/libavcodec/acelp_pitch_delay.c
+++ b/ffmpeg-mt/libavcodec/acelp_pitch_delay.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/acelp_pitch_delay.h b/ffmpeg-mt/libavcodec/acelp_pitch_delay.h
index ce06bc2..6d182bb 100644
--- a/ffmpeg-mt/libavcodec/acelp_pitch_delay.h
+++ b/ffmpeg-mt/libavcodec/acelp_pitch_delay.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/acelp_vectors.c b/ffmpeg-mt/libavcodec/acelp_vectors.c
index e41e5fa..8e59e4b 100644
--- a/ffmpeg-mt/libavcodec/acelp_vectors.c
+++ b/ffmpeg-mt/libavcodec/acelp_vectors.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/acelp_vectors.h b/ffmpeg-mt/libavcodec/acelp_vectors.h
index f3bc781..07d1000 100644
--- a/ffmpeg-mt/libavcodec/acelp_vectors.h
+++ b/ffmpeg-mt/libavcodec/acelp_vectors.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/adpcm.c b/ffmpeg-mt/libavcodec/adpcm.c
index ee2ce54..70a5360 100644
--- a/ffmpeg-mt/libavcodec/adpcm.c
+++ b/ffmpeg-mt/libavcodec/adpcm.c
@@ -2,20 +2,20 @@
  * ADPCM codecs
  * Copyright (c) 2001-2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -1708,7 +1708,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
 
 #if CONFIG_ENCODERS
 #define ADPCM_ENCODER(id,name,long_name_)       \
-AVCodec name ## _encoder = {                    \
+AVCodec ff_ ## name ## _encoder = {             \
     #name,                                      \
     AVMEDIA_TYPE_AUDIO,                         \
     id,                                         \
@@ -1719,14 +1719,14 @@ AVCodec name ## _encoder = {                    \
     NULL,                                       \
     .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
 #else
 #define ADPCM_ENCODER(id,name,long_name_)
 #endif
 
 #if CONFIG_DECODERS
 #define ADPCM_DECODER(id,name,long_name_)       \
-AVCodec name ## _decoder = {                    \
+AVCodec ff_ ## name ## _decoder = {             \
     #name,                                      \
     AVMEDIA_TYPE_AUDIO,                         \
     id,                                         \
@@ -1736,13 +1736,13 @@ AVCodec name ## _decoder = {                    \
     NULL,                                       \
     adpcm_decode_frame,                         \
     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
 #else
 #define ADPCM_DECODER(id,name,long_name_)
 #endif
 
 #define ADPCM_CODEC(id,name,long_name_)         \
-    ADPCM_ENCODER(id,name,long_name_) ADPCM_DECODER(id,name,long_name_)
+    ADPCM_ENCODER(id,name,long_name_); ADPCM_DECODER(id,name,long_name_)
 
 /* Note: Do not forget to add new entries to the Makefile as well. */
 ADPCM_DECODER(CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie");
diff --git a/ffmpeg-mt/libavcodec/adx.h b/ffmpeg-mt/libavcodec/adx.h
index 0fa1003..c420696 100644
--- a/ffmpeg-mt/libavcodec/adx.h
+++ b/ffmpeg-mt/libavcodec/adx.h
@@ -2,20 +2,20 @@
  * ADX ADPCM codecs
  * Copyright (c) 2001,2003 BERO
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/adxdec.c b/ffmpeg-mt/libavcodec/adxdec.c
index 030f2d7..48acc65 100644
--- a/ffmpeg-mt/libavcodec/adxdec.c
+++ b/ffmpeg-mt/libavcodec/adxdec.c
@@ -2,20 +2,20 @@
  * ADX ADPCM codecs
  * Copyright (c) 2001,2003 BERO
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -166,7 +166,7 @@ static int adx_decode_frame(AVCodecContext *avctx,
     return buf-buf0;
 }
 
-AVCodec adpcm_adx_decoder = {
+AVCodec ff_adpcm_adx_decoder = {
     "adpcm_adx",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_ADPCM_ADX,
diff --git a/ffmpeg-mt/libavcodec/adxenc.c b/ffmpeg-mt/libavcodec/adxenc.c
index 2200f5c..b0847f4 100644
--- a/ffmpeg-mt/libavcodec/adxenc.c
+++ b/ffmpeg-mt/libavcodec/adxenc.c
@@ -2,20 +2,20 @@
  * ADX ADPCM codecs
  * Copyright (c) 2001,2003 BERO
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -183,7 +183,7 @@ static int adx_encode_frame(AVCodecContext *avctx,
     return dst-frame;
 }
 
-AVCodec adpcm_adx_encoder = {
+AVCodec ff_adpcm_adx_encoder = {
     "adpcm_adx",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_ADPCM_ADX,
diff --git a/ffmpeg-mt/libavcodec/alac.c b/ffmpeg-mt/libavcodec/alac.c
index 3a25578..4ea3f7e 100644
--- a/ffmpeg-mt/libavcodec/alac.c
+++ b/ffmpeg-mt/libavcodec/alac.c
@@ -2,20 +2,20 @@
  * ALAC (Apple Lossless Audio Codec) decoder
  * Copyright (c) 2005 David Hammerton
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -691,7 +691,7 @@ static av_cold int alac_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec alac_decoder = {
+AVCodec ff_alac_decoder = {
     "alac",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_ALAC,
diff --git a/ffmpeg-mt/libavcodec/alacenc.c b/ffmpeg-mt/libavcodec/alacenc.c
index d1369c4..2e20a60 100644
--- a/ffmpeg-mt/libavcodec/alacenc.c
+++ b/ffmpeg-mt/libavcodec/alacenc.c
@@ -2,20 +2,20 @@
  * ALAC audio encoder
  * Copyright (c) 2008  Jaikrishnan Menon <realityman at gmx.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -51,11 +51,11 @@ typedef struct RiceContext {
     int rice_modifier;
 } RiceContext;
 
-typedef struct LPCContext {
+typedef struct AlacLPCContext {
     int lpc_order;
     int lpc_coeff[ALAC_MAX_LPC_ORDER+1];
     int lpc_quant;
-} LPCContext;
+} AlacLPCContext;
 
 typedef struct AlacEncodeContext {
     int compression_level;
@@ -69,8 +69,8 @@ typedef struct AlacEncodeContext {
     int interlacing_leftweight;
     PutBitContext pbctx;
     RiceContext rc;
-    LPCContext lpc[MAX_CHANNELS];
-    DSPContext dspctx;
+    AlacLPCContext lpc[MAX_CHANNELS];
+    LPCContext lpc_ctx;
     AVCodecContext *avctx;
 } AlacEncodeContext;
 
@@ -141,7 +141,7 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch)
         s->lpc[ch].lpc_coeff[4] =   80;
         s->lpc[ch].lpc_coeff[5] =  -25;
     } else {
-        opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch],
+        opt_order = ff_lpc_calc_coefs(&s->lpc_ctx, s->sample_buf[ch],
                                       s->avctx->frame_size,
                                       s->min_prediction_order,
                                       s->max_prediction_order,
@@ -237,7 +237,7 @@ static void alac_stereo_decorrelation(AlacEncodeContext *s)
 static void alac_linear_predictor(AlacEncodeContext *s, int ch)
 {
     int i;
-    LPCContext lpc = s->lpc[ch];
+    AlacLPCContext lpc = s->lpc[ch];
 
     if(lpc.lpc_order == 31) {
         s->predictor_buf[0] = s->sample_buf[ch][0];
@@ -378,6 +378,7 @@ static void write_compressed_frame(AlacEncodeContext *s)
 static av_cold int alac_encode_init(AVCodecContext *avctx)
 {
     AlacEncodeContext *s    = avctx->priv_data;
+    int ret;
     uint8_t *alac_extradata = av_mallocz(ALAC_EXTRADATA_SIZE+1);
 
     avctx->frame_size      = DEFAULT_FRAME_SIZE;
@@ -455,9 +456,10 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
     avctx->coded_frame->key_frame = 1;
 
     s->avctx = avctx;
-    dsputil_init(&s->dspctx, avctx);
+    ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, s->max_prediction_order,
+                      AV_LPC_TYPE_LEVINSON);
 
-    return 0;
+    return ret;
 }
 
 static int alac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
@@ -513,13 +515,15 @@ verbatim:
 
 static av_cold int alac_encode_close(AVCodecContext *avctx)
 {
+    AlacEncodeContext *s = avctx->priv_data;
+    ff_lpc_end(&s->lpc_ctx);
     av_freep(&avctx->extradata);
     avctx->extradata_size = 0;
     av_freep(&avctx->coded_frame);
     return 0;
 }
 
-AVCodec alac_encoder = {
+AVCodec ff_alac_encoder = {
     "alac",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_ALAC,
diff --git a/ffmpeg-mt/libavcodec/allcodecs.c b/ffmpeg-mt/libavcodec/allcodecs.c
index 94da5c0..7636392 100644
--- a/ffmpeg-mt/libavcodec/allcodecs.c
+++ b/ffmpeg-mt/libavcodec/allcodecs.c
@@ -2,20 +2,20 @@
  * Provide registration of all codecs, parsers and bitstream filters for libavcodec.
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,23 +27,23 @@
 #include "avcodec.h"
 
 #define REGISTER_HWACCEL(X,x) { \
-          extern AVHWAccel x##_hwaccel; \
-          if(CONFIG_##X##_HWACCEL) av_register_hwaccel(&x##_hwaccel); }
+          extern AVHWAccel ff_##x##_hwaccel; \
+          if(CONFIG_##X##_HWACCEL) av_register_hwaccel(&ff_##x##_hwaccel); }
 
 #define REGISTER_ENCODER(X,x) { \
-          extern AVCodec x##_encoder; \
-          if(CONFIG_##X##_ENCODER)  avcodec_register(&x##_encoder); }
+          extern AVCodec ff_##x##_encoder; \
+          if(CONFIG_##X##_ENCODER)  avcodec_register(&ff_##x##_encoder); }
 #define REGISTER_DECODER(X,x) { \
-          extern AVCodec x##_decoder; \
-          if(CONFIG_##X##_DECODER)  avcodec_register(&x##_decoder); }
+          extern AVCodec ff_##x##_decoder; \
+          if(CONFIG_##X##_DECODER)  avcodec_register(&ff_##x##_decoder); }
 #define REGISTER_ENCDEC(X,x)  REGISTER_ENCODER(X,x); REGISTER_DECODER(X,x)
 
 #define REGISTER_PARSER(X,x) { \
-          extern AVCodecParser x##_parser; \
-          if(CONFIG_##X##_PARSER)  av_register_codec_parser(&x##_parser); }
+          extern AVCodecParser ff_##x##_parser; \
+          if(CONFIG_##X##_PARSER)  av_register_codec_parser(&ff_##x##_parser); }
 #define REGISTER_BSF(X,x) { \
-          extern AVBitStreamFilter x##_bsf; \
-          if(CONFIG_##X##_BSF)     av_register_bitstream_filter(&x##_bsf); }
+          extern AVBitStreamFilter ff_##x##_bsf; \
+          if(CONFIG_##X##_BSF)     av_register_bitstream_filter(&ff_##x##_bsf); }
 
 void avcodec_register_all(void)
 {
@@ -88,6 +88,7 @@ void avcodec_register_all(void)
     REGISTER_DECODER (CLJR, cljr);
     REGISTER_DECODER (CSCD, cscd);
     REGISTER_DECODER (CYUV, cyuv);
+    REGISTER_DECODER (DFA, dfa);
     REGISTER_ENCDEC  (DNXHD, dnxhd);
     REGISTER_DECODER (DPX, dpx);
     REGISTER_DECODER (DSICINVIDEO, dsicinvideo);
@@ -126,6 +127,7 @@ void avcodec_register_all(void)
     REGISTER_DECODER (INDEO5, indeo5);
     REGISTER_DECODER (INTERPLAY_VIDEO, interplay_video);
     REGISTER_ENCDEC  (JPEGLS, jpegls);
+    REGISTER_DECODER (JV, jv);
     REGISTER_DECODER (KGV1, kgv1);
     REGISTER_DECODER (KMVC, kmvc);
     REGISTER_DECODER (LAGARITH, lagarith);
@@ -151,6 +153,7 @@ void avcodec_register_all(void)
     REGISTER_DECODER (MSRLE, msrle);
     REGISTER_DECODER (MSVIDEO1, msvideo1);
     REGISTER_DECODER (MSZH, mszh);
+    REGISTER_DECODER (MXPEG, mxpeg);
     REGISTER_DECODER (NUV, nuv);
     REGISTER_ENCDEC  (PAM, pam);
     REGISTER_ENCDEC  (PBM, pbm);
@@ -214,6 +217,7 @@ void avcodec_register_all(void)
     REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau);
     REGISTER_DECODER (WNV1, wnv1);
     REGISTER_DECODER (XAN_WC3, xan_wc3);
+    REGISTER_DECODER (XAN_WC4, xan_wc4);
     REGISTER_DECODER (XL, xl);
     REGISTER_DECODER (YOP, yop);
     REGISTER_ENCDEC  (ZLIB, zlib);
@@ -264,8 +268,6 @@ void avcodec_register_all(void)
     REGISTER_DECODER (SHORTEN, shorten);
     REGISTER_DECODER (SIPR, sipr);
     REGISTER_DECODER (SMACKAUD, smackaud);
-    REGISTER_ENCDEC  (SONIC, sonic);
-    REGISTER_ENCODER (SONIC_LS, sonic_ls);
     REGISTER_DECODER (TRUEHD, truehd);
     REGISTER_DECODER (TRUESPEECH, truespeech);
     REGISTER_DECODER (TTA, tta);
diff --git a/ffmpeg-mt/libavcodec/alpha/asm.h b/ffmpeg-mt/libavcodec/alpha/asm.h
index 827721e..ab4cfcc 100644
--- a/ffmpeg-mt/libavcodec/alpha/asm.h
+++ b/ffmpeg-mt/libavcodec/alpha/asm.h
@@ -2,20 +2,20 @@
  * Alpha optimized DSP utils
  * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.c b/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.c
index b87367f..610f92a 100644
--- a/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.c
+++ b/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.c
@@ -2,20 +2,20 @@
  * Alpha optimized DSP utils
  * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.h b/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.h
index a3fa3dd..0dcacab 100644
--- a/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.h
+++ b/ffmpeg-mt/libavcodec/alpha/dsputil_alpha.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/dsputil_alpha_asm.S b/ffmpeg-mt/libavcodec/alpha/dsputil_alpha_asm.S
index 32a8bc9..ca857ac 100644
--- a/ffmpeg-mt/libavcodec/alpha/dsputil_alpha_asm.S
+++ b/ffmpeg-mt/libavcodec/alpha/dsputil_alpha_asm.S
@@ -2,20 +2,20 @@
  * Alpha optimized DSP utils
  * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/motion_est_alpha.c b/ffmpeg-mt/libavcodec/alpha/motion_est_alpha.c
index 863dd23..bb9ab13 100644
--- a/ffmpeg-mt/libavcodec/alpha/motion_est_alpha.c
+++ b/ffmpeg-mt/libavcodec/alpha/motion_est_alpha.c
@@ -2,20 +2,20 @@
  * Alpha optimized DSP utils
  * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/motion_est_mvi_asm.S b/ffmpeg-mt/libavcodec/alpha/motion_est_mvi_asm.S
index 2399085..7fe4e16 100644
--- a/ffmpeg-mt/libavcodec/alpha/motion_est_mvi_asm.S
+++ b/ffmpeg-mt/libavcodec/alpha/motion_est_mvi_asm.S
@@ -2,20 +2,20 @@
  * Alpha optimized DSP utils
  * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/mpegvideo_alpha.c b/ffmpeg-mt/libavcodec/alpha/mpegvideo_alpha.c
index de32545..add5736 100644
--- a/ffmpeg-mt/libavcodec/alpha/mpegvideo_alpha.c
+++ b/ffmpeg-mt/libavcodec/alpha/mpegvideo_alpha.c
@@ -2,20 +2,20 @@
  * Alpha optimized DSP utils
  * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/regdef.h b/ffmpeg-mt/libavcodec/alpha/regdef.h
index aa1959f..fa9ad98 100644
--- a/ffmpeg-mt/libavcodec/alpha/regdef.h
+++ b/ffmpeg-mt/libavcodec/alpha/regdef.h
@@ -2,20 +2,20 @@
  * Alpha optimized DSP utils
  * copyright (c) 2002 Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alpha/simple_idct_alpha.c b/ffmpeg-mt/libavcodec/alpha/simple_idct_alpha.c
index 0c0689a..8f5c134 100644
--- a/ffmpeg-mt/libavcodec/alpha/simple_idct_alpha.c
+++ b/ffmpeg-mt/libavcodec/alpha/simple_idct_alpha.c
@@ -9,20 +9,20 @@
  * Alpha optimizations by Måns Rullgård <mans at mansr.com>
  *                     and Falk Hueffner <falk at debian.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/alsdec.c b/ffmpeg-mt/libavcodec/alsdec.c
index 116e5e2..17c5490 100644
--- a/ffmpeg-mt/libavcodec/alsdec.c
+++ b/ffmpeg-mt/libavcodec/alsdec.c
@@ -2,20 +2,20 @@
  * MPEG-4 ALS decoder
  * Copyright (c) 2009 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,7 +36,7 @@
 #include "bytestream.h"
 #include "bgmc.h"
 #include "dsputil.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/samplefmt.h"
 #include "libavutil/crc.h"
 
 #include <stdint.h>
@@ -253,24 +253,24 @@ static av_cold void dprint_specific_config(ALSDecContext *ctx)
     AVCodecContext *avctx    = ctx->avctx;
     ALSSpecificConfig *sconf = &ctx->sconf;
 
-    dprintf(avctx, "resolution = %i\n",           sconf->resolution);
-    dprintf(avctx, "floating = %i\n",             sconf->floating);
-    dprintf(avctx, "frame_length = %i\n",         sconf->frame_length);
-    dprintf(avctx, "ra_distance = %i\n",          sconf->ra_distance);
-    dprintf(avctx, "ra_flag = %i\n",              sconf->ra_flag);
-    dprintf(avctx, "adapt_order = %i\n",          sconf->adapt_order);
-    dprintf(avctx, "coef_table = %i\n",           sconf->coef_table);
-    dprintf(avctx, "long_term_prediction = %i\n", sconf->long_term_prediction);
-    dprintf(avctx, "max_order = %i\n",            sconf->max_order);
-    dprintf(avctx, "block_switching = %i\n",      sconf->block_switching);
-    dprintf(avctx, "bgmc = %i\n",                 sconf->bgmc);
-    dprintf(avctx, "sb_part = %i\n",              sconf->sb_part);
-    dprintf(avctx, "joint_stereo = %i\n",         sconf->joint_stereo);
-    dprintf(avctx, "mc_coding = %i\n",            sconf->mc_coding);
-    dprintf(avctx, "chan_config = %i\n",          sconf->chan_config);
-    dprintf(avctx, "chan_sort = %i\n",            sconf->chan_sort);
-    dprintf(avctx, "RLSLMS = %i\n",               sconf->rlslms);
-    dprintf(avctx, "chan_config_info = %i\n",     sconf->chan_config_info);
+    av_dlog(avctx, "resolution = %i\n",           sconf->resolution);
+    av_dlog(avctx, "floating = %i\n",             sconf->floating);
+    av_dlog(avctx, "frame_length = %i\n",         sconf->frame_length);
+    av_dlog(avctx, "ra_distance = %i\n",          sconf->ra_distance);
+    av_dlog(avctx, "ra_flag = %i\n",              sconf->ra_flag);
+    av_dlog(avctx, "adapt_order = %i\n",          sconf->adapt_order);
+    av_dlog(avctx, "coef_table = %i\n",           sconf->coef_table);
+    av_dlog(avctx, "long_term_prediction = %i\n", sconf->long_term_prediction);
+    av_dlog(avctx, "max_order = %i\n",            sconf->max_order);
+    av_dlog(avctx, "block_switching = %i\n",      sconf->block_switching);
+    av_dlog(avctx, "bgmc = %i\n",                 sconf->bgmc);
+    av_dlog(avctx, "sb_part = %i\n",              sconf->sb_part);
+    av_dlog(avctx, "joint_stereo = %i\n",         sconf->joint_stereo);
+    av_dlog(avctx, "mc_coding = %i\n",            sconf->mc_coding);
+    av_dlog(avctx, "chan_config = %i\n",          sconf->chan_config);
+    av_dlog(avctx, "chan_sort = %i\n",            sconf->chan_sort);
+    av_dlog(avctx, "RLSLMS = %i\n",               sconf->rlslms);
+    av_dlog(avctx, "chan_config_info = %i\n",     sconf->chan_config_info);
 #endif
 }
 
@@ -1564,6 +1564,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     av_freep(&ctx->chan_data);
     av_freep(&ctx->chan_data_buffer);
     av_freep(&ctx->reverted_channels);
+    av_freep(&ctx->crc_buffer);
 
     return 0;
 }
@@ -1737,7 +1738,7 @@ static av_cold void flush(AVCodecContext *avctx)
 }
 
 
-AVCodec als_decoder = {
+AVCodec ff_als_decoder = {
     "als",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MP4ALS,
diff --git a/ffmpeg-mt/libavcodec/amr.h b/ffmpeg-mt/libavcodec/amr.h
index 7e5a4dc..ae6e4d1 100644
--- a/ffmpeg-mt/libavcodec/amr.h
+++ b/ffmpeg-mt/libavcodec/amr.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Marcelo Galvao Povoa
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/amrnbdata.h b/ffmpeg-mt/libavcodec/amrnbdata.h
index 2f21439..d6d1f34 100644
--- a/ffmpeg-mt/libavcodec/amrnbdata.h
+++ b/ffmpeg-mt/libavcodec/amrnbdata.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2007 Robert Swain
  * Copyright (c) 2009 Colin McQuillan
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/amrnbdec.c b/ffmpeg-mt/libavcodec/amrnbdec.c
index a7d9fc5..f21b738 100644
--- a/ffmpeg-mt/libavcodec/amrnbdec.c
+++ b/ffmpeg-mt/libavcodec/amrnbdec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2007 Robert Swain
  * Copyright (c) 2009 Colin McQuillan
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -255,7 +255,7 @@ static void lsf2lsp_for_mode12k2(AMRContext *p, double lsp[LP_FILTER_ORDER],
     }
 
     if (update)
-        memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(float));
+        memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r));
 
     for (i = 0; i < LP_FILTER_ORDER; i++)
         lsf_q[i] = lsf_r[i] * (LSF_R_FAC / 8000.0) + lsf_no_r[i] * (1.0 / 8000.0);
@@ -1036,7 +1036,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
 }
 
 
-AVCodec amrnb_decoder = {
+AVCodec ff_amrnb_decoder = {
     .name           = "amrnb",
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = CODEC_ID_AMR_NB,
diff --git a/ffmpeg-mt/libavcodec/amrwbdata.h b/ffmpeg-mt/libavcodec/amrwbdata.h
index 36553d5..f4db99e 100644
--- a/ffmpeg-mt/libavcodec/amrwbdata.h
+++ b/ffmpeg-mt/libavcodec/amrwbdata.h
@@ -2,20 +2,20 @@
  * AMR wideband data and definitions
  * Copyright (c) 2010 Marcelo Galvao Povoa
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/amrwbdec.c b/ffmpeg-mt/libavcodec/amrwbdec.c
index 941d065..00df227 100644
--- a/ffmpeg-mt/libavcodec/amrwbdec.c
+++ b/ffmpeg-mt/libavcodec/amrwbdec.c
@@ -2,20 +2,20 @@
  * AMR wideband decoder
  * Copyright (c) 2010 Marcelo Galvao Povoa
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A particular PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -89,7 +89,7 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx)
     AMRWBContext *ctx = avctx->priv_data;
     int i;
 
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
+    avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
 
     av_lfg_init(&ctx->prng, 1);
 
@@ -1225,13 +1225,13 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     return expected_fr_size;
 }
 
-AVCodec amrwb_decoder = {
+AVCodec ff_amrwb_decoder = {
     .name           = "amrwb",
-    .type           = CODEC_TYPE_AUDIO,
+    .type           = AVMEDIA_TYPE_AUDIO,
     .id             = CODEC_ID_AMR_WB,
     .priv_data_size = sizeof(AMRWBContext),
     .init           = amrwb_decode_init,
     .decode         = amrwb_decode_frame,
     .long_name      = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate WideBand"),
-    .sample_fmts    = (enum AVSampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_NONE},
+    .sample_fmts    = (enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
 };
diff --git a/ffmpeg-mt/libavcodec/anm.c b/ffmpeg-mt/libavcodec/anm.c
index f384861..ef037f2 100644
--- a/ffmpeg-mt/libavcodec/anm.c
+++ b/ffmpeg-mt/libavcodec/anm.c
@@ -2,20 +2,20 @@
  * Deluxe Paint Animation decoder
  * Copyright (c) 2009 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -183,7 +183,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec anm_decoder = {
+AVCodec ff_anm_decoder = {
     "anm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ANM,
diff --git a/ffmpeg-mt/libavcodec/ansi.c b/ffmpeg-mt/libavcodec/ansi.c
index 8e7171c..892cc34 100644
--- a/ffmpeg-mt/libavcodec/ansi.c
+++ b/ffmpeg-mt/libavcodec/ansi.c
@@ -2,20 +2,20 @@
  * ASCII/ANSI art decoder
  * Copyright (c) 2010 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -422,7 +422,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ansi_decoder = {
+AVCodec ff_ansi_decoder = {
     .name           = "ansi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_ANSI,
diff --git a/ffmpeg-mt/libavcodec/apedec.c b/ffmpeg-mt/libavcodec/apedec.c
index 4975954..d5a7efd 100644
--- a/ffmpeg-mt/libavcodec/apedec.c
+++ b/ffmpeg-mt/libavcodec/apedec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
  *  based upon libdemac from Dave Chapman.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,7 @@
 #include "dsputil.h"
 #include "get_bits.h"
 #include "bytestream.h"
+#include "libavutil/audioconvert.h"
 
 /**
  * @file
@@ -199,7 +200,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
 
     dsputil_init(&s->dsp, avctx);
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+    avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
     return 0;
 }
 
@@ -883,7 +884,7 @@ static void ape_flush(AVCodecContext *avctx)
     s->samples= 0;
 }
 
-AVCodec ape_decoder = {
+AVCodec ff_ape_decoder = {
     "ape",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_APE,
diff --git a/ffmpeg-mt/libavcodec/api-example.c b/ffmpeg-mt/libavcodec/api-example.c
index f34075e..0221a30 100644
--- a/ffmpeg-mt/libavcodec/api-example.c
+++ b/ffmpeg-mt/libavcodec/api-example.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/Makefile b/ffmpeg-mt/libavcodec/arm/Makefile
index 4c30e0a..a5abfdd 100644
--- a/ffmpeg-mt/libavcodec/arm/Makefile
+++ b/ffmpeg-mt/libavcodec/arm/Makefile
@@ -1,7 +1,14 @@
+OBJS-$(CONFIG_AC3DSP)                  += arm/ac3dsp_init_arm.o         \
+                                          arm/ac3dsp_arm.o
+
 OBJS-$(CONFIG_DCA_DECODER)             += arm/dcadsp_init_arm.o         \
 
+ARMV6-OBJS-$(CONFIG_AC3DSP)            += arm/ac3dsp_armv6.o
+
 OBJS-$(CONFIG_VP5_DECODER)             += arm/vp56dsp_init_arm.o
 OBJS-$(CONFIG_VP6_DECODER)             += arm/vp56dsp_init_arm.o
+OBJS-$(CONFIG_VP8_DECODER)             += arm/vp8dsp_init_arm.o
+ARMV6-OBJS-$(CONFIG_VP8_DECODER)       += arm/vp8_armv6.o
 
 OBJS-$(CONFIG_H264DSP)                 += arm/h264dsp_init_arm.o
 OBJS-$(CONFIG_H264PRED)                += arm/h264pred_init_arm.o
@@ -9,6 +16,8 @@ OBJS-$(CONFIG_H264PRED)                += arm/h264pred_init_arm.o
 OBJS                                   += arm/dsputil_init_arm.o        \
                                           arm/dsputil_arm.o             \
                                           arm/fft_init_arm.o            \
+                                          arm/fft_fixed_init_arm.o      \
+                                          arm/fmtconvert_init_arm.o     \
                                           arm/jrevdct_arm.o             \
                                           arm/mpegvideo_arm.o           \
                                           arm/simple_idct_arm.o         \
@@ -21,16 +30,22 @@ OBJS-$(HAVE_ARMV5TE)                   += arm/dsputil_init_armv5te.o    \
 OBJS-$(HAVE_ARMV6)                     += arm/dsputil_init_armv6.o      \
                                           arm/dsputil_armv6.o           \
                                           arm/simple_idct_armv6.o       \
+                                          $(ARMV6-OBJS-yes)
+
+VFP-OBJS-$(HAVE_ARMV6)                 += arm/fmtconvert_vfp.o          \
 
 OBJS-$(HAVE_ARMVFP)                    += arm/dsputil_vfp.o             \
                                           arm/dsputil_init_vfp.o        \
+                                          $(VFP-OBJS-yes)
 
 OBJS-$(HAVE_IWMMXT)                    += arm/dsputil_iwmmxt.o          \
                                           arm/mpegvideo_iwmmxt.o        \
 
 NEON-OBJS-$(CONFIG_FFT)                += arm/fft_neon.o                \
+                                          arm/fft_fixed_neon.o          \
 
 NEON-OBJS-$(CONFIG_MDCT)               += arm/mdct_neon.o               \
+                                          arm/mdct_fixed_neon.o         \
 
 NEON-OBJS-$(CONFIG_RDFT)               += arm/rdft_neon.o               \
 
@@ -39,6 +54,8 @@ NEON-OBJS-$(CONFIG_H264DSP)            += arm/h264dsp_neon.o            \
 
 NEON-OBJS-$(CONFIG_H264PRED)           += arm/h264pred_neon.o           \
 
+NEON-OBJS-$(CONFIG_AC3DSP)             += arm/ac3dsp_neon.o
+
 NEON-OBJS-$(CONFIG_DCA_DECODER)        += arm/dcadsp_neon.o             \
                                           arm/synth_filter_neon.o       \
 
@@ -50,8 +67,11 @@ NEON-OBJS-$(CONFIG_VP5_DECODER)        += arm/vp56dsp_neon.o            \
 NEON-OBJS-$(CONFIG_VP6_DECODER)        += arm/vp56dsp_neon.o            \
                                           arm/vp3dsp_neon.o             \
 
+NEON-OBJS-$(CONFIG_VP8_DECODER)        += arm/vp8dsp_neon.o
+
 OBJS-$(HAVE_NEON)                      += arm/dsputil_init_neon.o       \
                                           arm/dsputil_neon.o            \
+                                          arm/fmtconvert_neon.o         \
                                           arm/int_neon.o                \
                                           arm/mpegvideo_neon.o          \
                                           arm/simple_idct_neon.o        \
diff --git a/ffmpeg-mt/libavcodec/arm/aac.h b/ffmpeg-mt/libavcodec/arm/aac.h
index 390cdbf..e907c9e 100644
--- a/ffmpeg-mt/libavcodec/arm/aac.h
+++ b/ffmpeg-mt/libavcodec/arm/aac.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/ac3dsp_arm.S b/ffmpeg-mt/libavcodec/arm/ac3dsp_arm.S
new file mode 100644
index 0000000..d7d498e
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/ac3dsp_arm.S
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+function ff_ac3_compute_mantissa_size_arm, export=1
+        push            {r4-r8,lr}
+        ldm             r0,  {r4-r8}
+        mov             r3,  r0
+        mov             r0,  #0
+1:
+        ldrb            lr,  [r1], #1
+        subs            r2,  r2,  #1
+        blt             2f
+        cmp             lr,  #4
+        bgt             3f
+        subs            lr,  lr,  #1
+        addlt           r4,  r4,  #1
+        addeq           r5,  r5,  #1
+        ble             1b
+        subs            lr,  lr,  #2
+        addlt           r6,  r6,  #1
+        addeq           r7,  r7,  #1
+        addgt           r8,  r8,  #1
+        b               1b
+3:
+        cmp             lr,  #14
+        sublt           lr,  lr,  #1
+        addgt           r0,  r0,  #16
+        addle           r0,  r0,  lr
+        b               1b
+2:
+        stm             r3,  {r4-r8}
+        pop             {r4-r8,pc}
+endfunc
diff --git a/ffmpeg-mt/libavcodec/arm/ac3dsp_armv6.S b/ffmpeg-mt/libavcodec/arm/ac3dsp_armv6.S
new file mode 100644
index 0000000..7f01add
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/ac3dsp_armv6.S
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+function ff_ac3_bit_alloc_calc_bap_armv6, export=1
+        ldr             r12, [sp]
+        cmp             r12, #-960
+        beq             4f
+        push            {r4-r11,lr}
+        add             r5,  sp,  #40
+        movrel          r4,  X(ff_ac3_bin_to_band_tab)
+        movrel          lr,  X(ff_ac3_band_start_tab)
+        ldm             r5,  {r5-r7}
+        ldrb            r4,  [r4, r2]
+        add             r1,  r1,  r2,  lsl #1           @ psd + start
+        add             r0,  r0,  r4,  lsl #1           @ mask + band
+        add             r4,  lr,  r4
+        add             r7,  r7,  r2                    @ bap + start
+        ldrb            r10, [r4], #1
+1:
+        ldrsh           r9,  [r0], #2                   @ mask[band]
+        movw            r8,  #0x1fe0
+        sub             r9,  r9,  r12                   @   - snr_offset
+        mov             r11, r10
+        ldrb            r10, [r4], #1                   @ band_start_tab[band++]
+        subs            r9,  r9,  r5                    @   - floor
+        movlt           r9,  #0
+        cmp             r10, r3                         @   - end
+        and             r9,  r9,  r8                    @   & 0x1fe0
+        subgt           r8,  r3,  r11
+        suble           r8,  r10, r11
+        add             r9,  r9,  r5                    @   + floor => m
+        tst             r8,  #1
+        add             r2,  r7,  r8
+        bne             3f
+        b               5f
+2:
+        ldrsh           r8,  [r1], #2
+        ldrsh           lr,  [r1], #2
+        sub             r8,  r8,  r9
+        sub             lr,  lr,  r9
+        usat            r8,  #6,  r8,  asr #5           @ address
+        usat            lr,  #6,  lr,  asr #5
+        ldrb            r8,  [r6, r8]                   @ bap_tab[address]
+        ldrb            lr,  [r6, lr]
+        strb            r8,  [r7], #1                   @ bap[bin]
+        strb            lr,  [r7], #1
+5:      cmp             r7,  r2
+        blo             2b
+        cmp             r3,  r11
+        bgt             1b
+        pop             {r4-r11,pc}
+3:
+        ldrsh           r8,  [r1], #2                   @ psd[bin]
+        sub             r8,  r8,  r9                    @   - m
+        usat            r8,  #6,  r8,  asr #5           @ address
+        ldrb            r8,  [r6, r8]                   @ bap_tab[address]
+        strb            r8,  [r7], #1                   @ bap[bin]
+        b               5b
+4:
+        ldr             r0,  [sp, #12]
+        mov             r1,  #0
+        mov             r2,  #256
+        b               memset
+endfunc
diff --git a/ffmpeg-mt/libavcodec/arm/ac3dsp_init_arm.c b/ffmpeg-mt/libavcodec/arm/ac3dsp_init_arm.c
new file mode 100644
index 0000000..fd78e1e
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/ac3dsp_init_arm.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include "libavutil/attributes.h"
+#include "libavcodec/ac3dsp.h"
+#include "config.h"
+
+void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+int ff_ac3_max_msb_abs_int16_neon(const int16_t *src, int len);
+void ff_ac3_lshift_int16_neon(int16_t *src, unsigned len, unsigned shift);
+void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift);
+void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len);
+void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
+
+void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd,
+                                     int start, int end,
+                                     int snr_offset, int floor,
+                                     const uint8_t *bap_tab, uint8_t *bap);
+
+int ff_ac3_compute_mantissa_size_arm(int cnt[5], uint8_t *bap, int nb_coefs);
+
+av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
+{
+    c->compute_mantissa_size     = ff_ac3_compute_mantissa_size_arm;
+
+    if (HAVE_ARMV6) {
+        c->bit_alloc_calc_bap    = ff_ac3_bit_alloc_calc_bap_armv6;
+    }
+
+    if (HAVE_NEON) {
+        c->ac3_exponent_min      = ff_ac3_exponent_min_neon;
+        c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon;
+        c->ac3_lshift_int16      = ff_ac3_lshift_int16_neon;
+        c->ac3_rshift_int32      = ff_ac3_rshift_int32_neon;
+        c->float_to_fixed24      = ff_float_to_fixed24_neon;
+        c->extract_exponents     = ff_ac3_extract_exponents_neon;
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/arm/ac3dsp_neon.S b/ffmpeg-mt/libavcodec/arm/ac3dsp_neon.S
new file mode 100644
index 0000000..946b39f
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/ac3dsp_neon.S
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+function ff_ac3_max_msb_abs_int16_neon, export=1
+        vmov.i16        q0,  #0
+        vmov.i16        q2,  #0
+1:      vld1.16         {q1},     [r0,:128]!
+        vabs.s16        q1,  q1
+        vld1.16         {q3},     [r0,:128]!
+        vabs.s16        q3,  q3
+        vorr            q0,  q0,  q1
+        vorr            q2,  q2,  q3
+        subs            r1,  r1,  #16
+        bgt             1b
+        vorr            q0,  q0,  q2
+        vorr            d0,  d0,  d1
+        vpmax.u16       d0,  d0,  d0
+        vpmax.u16       d0,  d0,  d0
+        vmov.u16        r0,  d0[0]
+        bx              lr
+endfunc
+
+function ff_ac3_exponent_min_neon, export=1
+        cmp             r1,  #0
+        bxeq            lr
+        push            {lr}
+        mov             r12, #256
+1:
+        vld1.8          {q0},     [r0,:128]
+        mov             lr,  r1
+        add             r3,  r0,  #256
+2:      vld1.8          {q1},     [r3,:128], r12
+        subs            lr,  lr,  #1
+        vmin.u8         q0,  q0,  q1
+        bgt             2b
+        subs            r2,  r2,  #16
+        vst1.8          {q0},     [r0,:128]!
+        bgt             1b
+        pop             {pc}
+endfunc
+
+function ff_ac3_lshift_int16_neon, export=1
+        vdup.16         q0,  r2
+1:      vld1.16         {q1},     [r0,:128]
+        vshl.s16        q1,  q1,  q0
+        vst1.16         {q1},     [r0,:128]!
+        subs            r1,  r1,  #8
+        bgt             1b
+        bx              lr
+endfunc
+
+function ff_ac3_rshift_int32_neon, export=1
+        rsb             r2,  r2,  #0
+        vdup.32         q0,  r2
+1:      vld1.32         {q1},     [r0,:128]
+        vshl.s32        q1,  q1,  q0
+        vst1.32         {q1},     [r0,:128]!
+        subs            r1,  r1,  #4
+        bgt             1b
+        bx              lr
+endfunc
+
+function ff_float_to_fixed24_neon, export=1
+1:      vld1.32         {q0-q1},  [r1,:128]!
+        vcvt.s32.f32    q0,  q0,  #24
+        vld1.32         {q2-q3},  [r1,:128]!
+        vcvt.s32.f32    q1,  q1,  #24
+        vcvt.s32.f32    q2,  q2,  #24
+        vst1.32         {q0-q1},  [r0,:128]!
+        vcvt.s32.f32    q3,  q3,  #24
+        vst1.32         {q2-q3},  [r0,:128]!
+        subs            r2,  r2,  #16
+        bgt             1b
+        bx              lr
+endfunc
+
+function ff_ac3_extract_exponents_neon, export=1
+        vmov.i32        q14, #24
+        vmov.i32        q15, #8
+1:
+        vld1.32         {q0},     [r1,:128]
+        vabs.s32        q1,  q0
+        vclz.i32        q3,  q1
+        vsub.i32        q3,  q3,  q15
+        vcge.s32        q2,  q3,  q14
+        vbit            q3,  q14, q2
+        vbic            q0,  q0,  q2
+        vmovn.i32       d6,  q3
+        vmovn.i16       d6,  q3
+        vst1.32         {q0},     [r1,:128]!
+        vst1.32         {d6[0]},  [r0,:32]!
+        subs            r2,  r2,  #4
+        bgt             1b
+        bx              lr
+endfunc
diff --git a/ffmpeg-mt/libavcodec/arm/asm-offsets.h b/ffmpeg-mt/libavcodec/arm/asm-offsets.h
index 9d72b5c..43c1630 100644
--- a/ffmpeg-mt/libavcodec/arm/asm-offsets.h
+++ b/ffmpeg-mt/libavcodec/arm/asm-offsets.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,22 +29,11 @@
 #endif
 
 /* MpegEncContext */
-#if defined(__ARM_EABI__) || defined(__eabi__)
-#error These offsets are out of date in -mt. Send new ones or --disable-asm
-#define Y_DC_SCALE               0xab4
-#define C_DC_SCALE               0xab8
-#define AC_PRED                  0xae0
-#define BLOCK_LAST_INDEX         0x21c0
-#define INTER_SCANTAB_RASTER_END 0x23c0
-#define H263_AIC                 0x2670
-#elif defined(__APPLE__)
-#error These offsets are out of date in -mt. Send new ones or --disable-asm
-#define Y_DC_SCALE               0xa70
-#define C_DC_SCALE               0xa74
-#define AC_PRED                  0xa9c
-#define BLOCK_LAST_INDEX         0x217c
-#define INTER_SCANTAB_RASTER_END 0x237c
-#define H263_AIC                 0x2620
-#endif
+#define Y_DC_SCALE               0xb4
+#define C_DC_SCALE               0xb8
+#define AC_PRED                  0xbc
+#define BLOCK_LAST_INDEX         0xc0
+#define H263_AIC                 0xf0
+#define INTER_SCANTAB_RASTER_END 0x138
 
 #endif
diff --git a/ffmpeg-mt/libavcodec/arm/asm.S b/ffmpeg-mt/libavcodec/arm/asm.S
index e050783..6e3d788 100644
--- a/ffmpeg-mt/libavcodec/arm/asm.S
+++ b/ffmpeg-mt/libavcodec/arm/asm.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -50,6 +50,16 @@ ELF     .type   \name, %function
 \name:
 .endm
 
+.macro  const   name, align=2
+    .macro endconst
+ELF     .size   \name, . - \name
+        .purgem endconst
+    .endm
+        .section        .rodata
+        .align          \align
+\name:
+.endm
+
 .macro  mov32   rd, val
 #if HAVE_ARMV6T2
         movw            \rd, #(\val) & 0xffff
diff --git a/ffmpeg-mt/libavcodec/arm/dcadsp_init_arm.c b/ffmpeg-mt/libavcodec/arm/dcadsp_init_arm.c
index 816718d..b5ac206 100644
--- a/ffmpeg-mt/libavcodec/arm/dcadsp_init_arm.c
+++ b/ffmpeg-mt/libavcodec/arm/dcadsp_init_arm.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 #include "libavcodec/dcadsp.h"
 
 void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs,
-                         int decifactor, float scale, float bias);
+                         int decifactor, float scale);
 
 void av_cold ff_dcadsp_init_arm(DCADSPContext *s)
 {
diff --git a/ffmpeg-mt/libavcodec/arm/dcadsp_neon.S b/ffmpeg-mt/libavcodec/arm/dcadsp_neon.S
index 19960ab..6120836 100644
--- a/ffmpeg-mt/libavcodec/arm/dcadsp_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/dcadsp_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,7 +29,7 @@ function ff_dca_lfe_fir_neon, export=1
         cmp             r3,  #32
         moveq           r6,  #256/32
         movne           r6,  #256/64
-NOVFP   vldr            d0,  [sp, #16]          @ scale, bias
+NOVFP   vldr            s0,  [sp, #16]          @ scale
         mov             lr,  #-16
 1:
         vmov.f32        q2,  #0.0               @ v0
@@ -51,8 +51,7 @@ NOVFP   vldr            d0,  [sp, #16]          @ scale, bias
         vadd.f32        d4,  d4,  d5
         vadd.f32        d6,  d6,  d7
         vpadd.f32       d4,  d4,  d6
-        vdup.32         d5,  d0[1]
-        vmla.f32        d5,  d4,  d0[0]
+        vmul.f32        d5,  d4,  d0[0]
         vst1.32         {d5[0]},  [r0,:32]!
         vst1.32         {d5[1]},  [r4,:32]!
         bne             1b
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_arm.S b/ffmpeg-mt/libavcodec/arm/dsputil_arm.S
index 7ee85e8..2117628 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_arm.S
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_arm.S
@@ -2,20 +2,20 @@
 @ ARMv4 optimized DSP utils
 @ Copyright (c) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
 @
-@ This file is part of FFmpeg.
+@ This file is part of Libav.
 @
-@ FFmpeg is free software; you can redistribute it and/or
+@ Libav is free software; you can redistribute it and/or
 @ modify it under the terms of the GNU Lesser General Public
 @ License as published by the Free Software Foundation; either
 @ version 2.1 of the License, or (at your option) any later version.
 @
-@ FFmpeg is distributed in the hope that it will be useful,
+@ Libav is distributed in the hope that it will be useful,
 @ but WITHOUT ANY WARRANTY; without even the implied warranty of
 @ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 @ Lesser General Public License for more details.
 @
 @ You should have received a copy of the GNU Lesser General Public
-@ License along with FFmpeg; if not, write to the Free Software
+@ License along with Libav; if not, write to the Free Software
 @ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 @
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_arm.h b/ffmpeg-mt/libavcodec/arm/dsputil_arm.h
index 7f8579d..14d9836 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_arm.h
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_arm.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_armv6.S b/ffmpeg-mt/libavcodec/arm/dsputil_armv6.S
index 214d947..8acb96d 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_armv6.S
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_armv6.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_init_arm.c b/ffmpeg-mt/libavcodec/arm/dsputil_init_arm.c
index 5c13290..92796c3 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_init_arm.c
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_init_arm.c
@@ -2,20 +2,20 @@
  * ARM optimized DSP utils
  * Copyright (c) 2001 Lionel Ulmer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_init_armv5te.c b/ffmpeg-mt/libavcodec/arm/dsputil_init_armv5te.c
index 750e514..572e06c 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_init_armv5te.c
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_init_armv5te.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_init_armv6.c b/ffmpeg-mt/libavcodec/arm/dsputil_init_armv6.c
index 3209062..362050c 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_init_armv6.c
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_init_armv6.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_init_neon.c b/ffmpeg-mt/libavcodec/arm/dsputil_init_neon.c
index 04ebb00..cd58011 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_init_neon.c
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_init_neon.c
@@ -2,20 +2,20 @@
  * ARM NEON optimised DSP functions
  * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -138,10 +138,9 @@ void ff_avg_h264_chroma_mc2_neon(uint8_t *, uint8_t *, int, int, int, int);
 void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *);
 void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *);
 
-void ff_vector_fmul_neon(float *dst, const float *src, int len);
+void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len);
 void ff_vector_fmul_window_neon(float *dst, const float *src0,
-                                const float *src1, const float *win,
-                                float add_bias, int len);
+                                const float *src1, const float *win, int len);
 void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul,
                                 int len);
 void ff_vector_fmul_sv_scalar_2_neon(float *dst, const float *src,
@@ -154,8 +153,6 @@ void ff_sv_fmul_scalar_4_neon(float *dst, const float **vp, float mul,
                               int len);
 void ff_butterflies_float_neon(float *v1, float *v2, int len);
 float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len);
-void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src,
-                                        float mul, int len);
 void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
                                  const float *src1, int len);
 void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1,
@@ -163,8 +160,6 @@ void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1,
 
 void ff_vector_clipf_neon(float *dst, const float *src, float min, float max,
                           int len);
-void ff_float_to_int16_neon(int16_t *, const float *, long);
-void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int);
 
 void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize);
 
@@ -173,6 +168,9 @@ int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int le
 int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2,
                                              const int16_t *v3, int len, int mul);
 
+void ff_apply_window_int16_neon(int16_t *dst, const int16_t *src,
+                                const int16_t *window, unsigned n);
+
 void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
 {
     if (!avctx->lowres) {
@@ -309,7 +307,6 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
     c->vector_fmul_scalar         = ff_vector_fmul_scalar_neon;
     c->butterflies_float          = ff_butterflies_float_neon;
     c->scalarproduct_float        = ff_scalarproduct_float_neon;
-    c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon;
     c->vector_fmul_reverse        = ff_vector_fmul_reverse_neon;
     c->vector_fmul_add            = ff_vector_fmul_add_neon;
     c->vector_clipf               = ff_vector_clipf_neon;
@@ -320,14 +317,11 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
     c->sv_fmul_scalar[0] = ff_sv_fmul_scalar_2_neon;
     c->sv_fmul_scalar[1] = ff_sv_fmul_scalar_4_neon;
 
-    if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
-        c->float_to_int16            = ff_float_to_int16_neon;
-        c->float_to_int16_interleave = ff_float_to_int16_interleave_neon;
-    }
-
     if (CONFIG_VORBIS_DECODER)
         c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon;
 
     c->scalarproduct_int16 = ff_scalarproduct_int16_neon;
     c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_neon;
+
+    c->apply_window_int16 = ff_apply_window_int16_neon;
 }
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_init_vfp.c b/ffmpeg-mt/libavcodec/arm/dsputil_init_vfp.c
index 9f8c1b7..3928911 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_init_vfp.c
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_init_vfp.c
@@ -1,36 +1,33 @@
 /*
  * Copyright (c) 2008 Siarhei Siamashka <ssvb at users.sourceforge.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavcodec/dsputil.h"
 #include "dsputil_arm.h"
 
-void ff_vector_fmul_vfp(float *dst, const float *src, int len);
+void ff_vector_fmul_vfp(float *dst, const float *src0,
+                        const float *src1, int len);
 void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
                                 const float *src1, int len);
-void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len);
 
 void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx)
 {
     c->vector_fmul = ff_vector_fmul_vfp;
     c->vector_fmul_reverse = ff_vector_fmul_reverse_vfp;
-#if HAVE_ARMV6
-    c->float_to_int16 = ff_float_to_int16_vfp;
-#endif
 }
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt.c b/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt.c
index 758d9cb..e83edb5 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt.c
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt.c
@@ -2,20 +2,20 @@
  * iWMMXt optimized DSP utils
  * Copyright (c) 2004 AGAWA Koji
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt_rnd_template.c b/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt_rnd_template.c
index 35a5a9b..df0ead6 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt_rnd_template.c
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_iwmmxt_rnd_template.c
@@ -2,20 +2,20 @@
  * iWMMXt optimized DSP utils
  * copyright (c) 2004 AGAWA Koji
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_neon.S b/ffmpeg-mt/libavcodec/arm/dsputil_neon.S
index 2bcdb39..5b80e40 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_neon.S
@@ -2,20 +2,20 @@
  * ARM NEON optimised DSP functions
  * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -400,389 +400,48 @@ function ff_add_pixels_clamped_neon, export=1
         bx              lr
 endfunc
 
-function ff_float_to_int16_neon, export=1
-        subs            r2,  r2,  #8
-        vld1.64         {d0-d1},  [r1,:128]!
-        vcvt.s32.f32    q8,  q0,  #16
-        vld1.64         {d2-d3},  [r1,:128]!
-        vcvt.s32.f32    q9,  q1,  #16
-        beq             3f
-        bics            ip,  r2,  #15
-        beq             2f
-1:      subs            ip,  ip,  #16
-        vshrn.s32       d4,  q8,  #16
-        vld1.64         {d0-d1},  [r1,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vshrn.s32       d5,  q9,  #16
-        vld1.64         {d2-d3},  [r1,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vshrn.s32       d6,  q0,  #16
-        vst1.64         {d4-d5},  [r0,:128]!
-        vshrn.s32       d7,  q1,  #16
-        vld1.64         {d16-d17},[r1,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r1,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.64         {d6-d7},  [r0,:128]!
-        bne             1b
-        ands            r2,  r2,  #15
-        beq             3f
-2:      vld1.64         {d0-d1},  [r1,:128]!
-        vshrn.s32       d4,  q8,  #16
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r1,:128]!
-        vshrn.s32       d5,  q9,  #16
-        vcvt.s32.f32    q1,  q1,  #16
-        vshrn.s32       d6,  q0,  #16
-        vst1.64         {d4-d5},  [r0,:128]!
-        vshrn.s32       d7,  q1,  #16
-        vst1.64         {d6-d7},  [r0,:128]!
-        bx              lr
-3:      vshrn.s32       d4,  q8,  #16
-        vshrn.s32       d5,  q9,  #16
-        vst1.64         {d4-d5},  [r0,:128]!
-        bx              lr
-endfunc
-
-function ff_float_to_int16_interleave_neon, export=1
-        cmp             r3, #2
-        ldrlt           r1, [r1]
-        blt             ff_float_to_int16_neon
-        bne             4f
-
-        ldr             r3, [r1]
-        ldr             r1, [r1, #4]
-
-        subs            r2,  r2,  #8
-        vld1.64         {d0-d1},  [r3,:128]!
-        vcvt.s32.f32    q8,  q0,  #16
-        vld1.64         {d2-d3},  [r3,:128]!
-        vcvt.s32.f32    q9,  q1,  #16
-        vld1.64         {d20-d21},[r1,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r1,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        beq             3f
-        bics            ip,  r2,  #15
-        beq             2f
-1:      subs            ip,  ip,  #16
-        vld1.64         {d0-d1},  [r3,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vsri.32         q10, q8,  #16
-        vld1.64         {d2-d3},  [r3,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vld1.64         {d24-d25},[r1,:128]!
-        vcvt.s32.f32    q12, q12, #16
-        vld1.64         {d26-d27},[r1,:128]!
-        vsri.32         q11, q9,  #16
-        vst1.64         {d20-d21},[r0,:128]!
-        vcvt.s32.f32    q13, q13, #16
-        vst1.64         {d22-d23},[r0,:128]!
-        vsri.32         q12, q0,  #16
-        vld1.64         {d16-d17},[r3,:128]!
-        vsri.32         q13, q1,  #16
-        vst1.64         {d24-d25},[r0,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r3,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vld1.64         {d20-d21},[r1,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r1,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        vst1.64         {d26-d27},[r0,:128]!
-        bne             1b
-        ands            r2,  r2,  #15
-        beq             3f
-2:      vsri.32         q10, q8,  #16
-        vld1.64         {d0-d1},  [r3,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r3,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vld1.64         {d24-d25},[r1,:128]!
-        vcvt.s32.f32    q12, q12, #16
-        vsri.32         q11, q9,  #16
-        vld1.64         {d26-d27},[r1,:128]!
-        vcvt.s32.f32    q13, q13, #16
-        vst1.64         {d20-d21},[r0,:128]!
-        vsri.32         q12, q0,  #16
-        vst1.64         {d22-d23},[r0,:128]!
-        vsri.32         q13, q1,  #16
-        vst1.64         {d24-d27},[r0,:128]!
-        bx              lr
-3:      vsri.32         q10, q8,  #16
-        vsri.32         q11, q9,  #16
-        vst1.64         {d20-d23},[r0,:128]!
-        bx              lr
-
-4:      push            {r4-r8,lr}
-        cmp             r3,  #4
-        lsl             ip,  r3,  #1
-        blt             4f
-
-        @ 4 channels
-5:      ldmia           r1!, {r4-r7}
-        mov             lr,  r2
-        mov             r8,  r0
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vld1.64         {d20-d21},[r6,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r7,:128]!
-        vcvt.s32.f32    q11, q11, #16
-6:      subs            lr,  lr,  #8
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vsri.32         q9,  q8,  #16
-        vld1.64         {d2-d3},  [r5,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vsri.32         q11, q10, #16
-        vld1.64         {d4-d5},  [r6,:128]!
-        vcvt.s32.f32    q2,  q2,  #16
-        vzip.32         d18, d22
-        vld1.64         {d6-d7},  [r7,:128]!
-        vcvt.s32.f32    q3,  q3,  #16
-        vzip.32         d19, d23
-        vst1.64         {d18},    [r8], ip
-        vsri.32         q1,  q0,  #16
-        vst1.64         {d22},    [r8], ip
-        vsri.32         q3,  q2,  #16
-        vst1.64         {d19},    [r8], ip
-        vzip.32         d2,  d6
-        vst1.64         {d23},    [r8], ip
-        vzip.32         d3,  d7
-        beq             7f
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vst1.64         {d2},     [r8], ip
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.64         {d6},     [r8], ip
-        vld1.64         {d20-d21},[r6,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vst1.64         {d3},     [r8], ip
-        vld1.64         {d22-d23},[r7,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        vst1.64         {d7},     [r8], ip
-        b               6b
-7:      vst1.64         {d2},     [r8], ip
-        vst1.64         {d6},     [r8], ip
-        vst1.64         {d3},     [r8], ip
-        vst1.64         {d7},     [r8], ip
-        subs            r3,  r3,  #4
-        popeq           {r4-r8,pc}
-        cmp             r3,  #4
-        add             r0,  r0,  #8
-        bge             5b
-
-        @ 2 channels
-4:      cmp             r3,  #2
-        blt             4f
-        ldmia           r1!, {r4-r5}
-        mov             lr,  r2
-        mov             r8,  r0
-        tst             lr,  #8
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vld1.64         {d20-d21},[r4,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r5,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        beq             6f
-        subs            lr,  lr,  #8
-        beq             7f
-        vsri.32         d18, d16, #16
-        vsri.32         d19, d17, #16
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vst1.32         {d18[0]}, [r8], ip
-        vsri.32         d22, d20, #16
-        vst1.32         {d18[1]}, [r8], ip
-        vsri.32         d23, d21, #16
-        vst1.32         {d19[0]}, [r8], ip
-        vst1.32         {d19[1]}, [r8], ip
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.32         {d22[0]}, [r8], ip
-        vst1.32         {d22[1]}, [r8], ip
-        vld1.64         {d20-d21},[r4,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vst1.32         {d23[0]}, [r8], ip
-        vst1.32         {d23[1]}, [r8], ip
-        vld1.64         {d22-d23},[r5,:128]!
-        vcvt.s32.f32    q11, q11, #16
-6:      subs            lr,  lr,  #16
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vsri.32         d18, d16, #16
-        vld1.64         {d2-d3},  [r5,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vsri.32         d19, d17, #16
-        vld1.64         {d4-d5},  [r4,:128]!
-        vcvt.s32.f32    q2,  q2,  #16
-        vld1.64         {d6-d7},  [r5,:128]!
-        vcvt.s32.f32    q3,  q3,  #16
-        vst1.32         {d18[0]}, [r8], ip
-        vsri.32         d22, d20, #16
-        vst1.32         {d18[1]}, [r8], ip
-        vsri.32         d23, d21, #16
-        vst1.32         {d19[0]}, [r8], ip
-        vsri.32         d2,  d0,  #16
-        vst1.32         {d19[1]}, [r8], ip
-        vsri.32         d3,  d1,  #16
-        vst1.32         {d22[0]}, [r8], ip
-        vsri.32         d6,  d4,  #16
-        vst1.32         {d22[1]}, [r8], ip
-        vsri.32         d7,  d5,  #16
-        vst1.32         {d23[0]}, [r8], ip
-        vst1.32         {d23[1]}, [r8], ip
-        beq             6f
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vst1.32         {d2[0]},  [r8], ip
-        vst1.32         {d2[1]},  [r8], ip
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.32         {d3[0]},  [r8], ip
-        vst1.32         {d3[1]},  [r8], ip
-        vld1.64         {d20-d21},[r4,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vst1.32         {d6[0]},  [r8], ip
-        vst1.32         {d6[1]},  [r8], ip
-        vld1.64         {d22-d23},[r5,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        vst1.32         {d7[0]},  [r8], ip
-        vst1.32         {d7[1]},  [r8], ip
-        bgt             6b
-6:      vst1.32         {d2[0]},  [r8], ip
-        vst1.32         {d2[1]},  [r8], ip
-        vst1.32         {d3[0]},  [r8], ip
-        vst1.32         {d3[1]},  [r8], ip
-        vst1.32         {d6[0]},  [r8], ip
-        vst1.32         {d6[1]},  [r8], ip
-        vst1.32         {d7[0]},  [r8], ip
-        vst1.32         {d7[1]},  [r8], ip
-        b               8f
-7:      vsri.32         d18, d16, #16
-        vsri.32         d19, d17, #16
-        vst1.32         {d18[0]}, [r8], ip
-        vsri.32         d22, d20, #16
-        vst1.32         {d18[1]}, [r8], ip
-        vsri.32         d23, d21, #16
-        vst1.32         {d19[0]}, [r8], ip
-        vst1.32         {d19[1]}, [r8], ip
-        vst1.32         {d22[0]}, [r8], ip
-        vst1.32         {d22[1]}, [r8], ip
-        vst1.32         {d23[0]}, [r8], ip
-        vst1.32         {d23[1]}, [r8], ip
-8:      subs            r3,  r3,  #2
-        add             r0,  r0,  #4
-        popeq           {r4-r8,pc}
-
-        @ 1 channel
-4:      ldr             r4,  [r1],#4
-        tst             r2,  #8
-        mov             lr,  r2
-        mov             r5,  r0
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r4,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        bne             8f
-6:      subs            lr,  lr,  #16
-        vld1.64         {d4-d5},  [r4,:128]!
-        vcvt.s32.f32    q2,  q2,  #16
-        vld1.64         {d6-d7},  [r4,:128]!
-        vcvt.s32.f32    q3,  q3,  #16
-        vst1.16         {d0[1]},  [r5,:16], ip
-        vst1.16         {d0[3]},  [r5,:16], ip
-        vst1.16         {d1[1]},  [r5,:16], ip
-        vst1.16         {d1[3]},  [r5,:16], ip
-        vst1.16         {d2[1]},  [r5,:16], ip
-        vst1.16         {d2[3]},  [r5,:16], ip
-        vst1.16         {d3[1]},  [r5,:16], ip
-        vst1.16         {d3[3]},  [r5,:16], ip
-        beq             7f
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r4,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-7:      vst1.16         {d4[1]},  [r5,:16], ip
-        vst1.16         {d4[3]},  [r5,:16], ip
-        vst1.16         {d5[1]},  [r5,:16], ip
-        vst1.16         {d5[3]},  [r5,:16], ip
-        vst1.16         {d6[1]},  [r5,:16], ip
-        vst1.16         {d6[3]},  [r5,:16], ip
-        vst1.16         {d7[1]},  [r5,:16], ip
-        vst1.16         {d7[3]},  [r5,:16], ip
-        bgt             6b
-        pop             {r4-r8,pc}
-8:      subs            lr,  lr,  #8
-        vst1.16         {d0[1]},  [r5,:16], ip
-        vst1.16         {d0[3]},  [r5,:16], ip
-        vst1.16         {d1[1]},  [r5,:16], ip
-        vst1.16         {d1[3]},  [r5,:16], ip
-        vst1.16         {d2[1]},  [r5,:16], ip
-        vst1.16         {d2[3]},  [r5,:16], ip
-        vst1.16         {d3[1]},  [r5,:16], ip
-        vst1.16         {d3[3]},  [r5,:16], ip
-        popeq           {r4-r8,pc}
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r4,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        b               6b
-endfunc
-
 function ff_vector_fmul_neon, export=1
-        mov             r3,  r0
-        subs            r2,  r2,  #8
-        vld1.64         {d0-d3},  [r0,:128]!
-        vld1.64         {d4-d7},  [r1,:128]!
+        subs            r3,  r3,  #8
+        vld1.64         {d0-d3},  [r1,:128]!
+        vld1.64         {d4-d7},  [r2,:128]!
         vmul.f32        q8,  q0,  q2
         vmul.f32        q9,  q1,  q3
         beq             3f
-        bics            ip,  r2,  #15
+        bics            ip,  r3,  #15
         beq             2f
 1:      subs            ip,  ip,  #16
-        vld1.64         {d0-d1},  [r0,:128]!
-        vld1.64         {d4-d5},  [r1,:128]!
+        vld1.64         {d0-d1},  [r1,:128]!
+        vld1.64         {d4-d5},  [r2,:128]!
         vmul.f32        q10, q0,  q2
-        vld1.64         {d2-d3},  [r0,:128]!
-        vld1.64         {d6-d7},  [r1,:128]!
+        vld1.64         {d2-d3},  [r1,:128]!
+        vld1.64         {d6-d7},  [r2,:128]!
         vmul.f32        q11, q1,  q3
-        vst1.64         {d16-d19},[r3,:128]!
-        vld1.64         {d0-d1},  [r0,:128]!
-        vld1.64         {d4-d5},  [r1,:128]!
+        vst1.64         {d16-d19},[r0,:128]!
+        vld1.64         {d0-d1},  [r1,:128]!
+        vld1.64         {d4-d5},  [r2,:128]!
         vmul.f32        q8,  q0,  q2
-        vld1.64         {d2-d3},  [r0,:128]!
-        vld1.64         {d6-d7},  [r1,:128]!
+        vld1.64         {d2-d3},  [r1,:128]!
+        vld1.64         {d6-d7},  [r2,:128]!
         vmul.f32        q9,  q1,  q3
-        vst1.64         {d20-d23},[r3,:128]!
+        vst1.64         {d20-d23},[r0,:128]!
         bne             1b
-        ands            r2,  r2,  #15
+        ands            r3,  r3,  #15
         beq             3f
-2:      vld1.64         {d0-d1},  [r0,:128]!
-        vld1.64         {d4-d5},  [r1,:128]!
-        vst1.64         {d16-d17},[r3,:128]!
+2:      vld1.64         {d0-d1},  [r1,:128]!
+        vld1.64         {d4-d5},  [r2,:128]!
+        vst1.64         {d16-d17},[r0,:128]!
         vmul.f32        q8,  q0,  q2
-        vld1.64         {d2-d3},  [r0,:128]!
-        vld1.64         {d6-d7},  [r1,:128]!
-        vst1.64         {d18-d19},[r3,:128]!
+        vld1.64         {d2-d3},  [r1,:128]!
+        vld1.64         {d6-d7},  [r2,:128]!
+        vst1.64         {d18-d19},[r0,:128]!
         vmul.f32        q9,  q1,  q3
-3:      vst1.64         {d16-d19},[r3,:128]!
+3:      vst1.64         {d16-d19},[r0,:128]!
         bx              lr
 endfunc
 
 function ff_vector_fmul_window_neon, export=1
-VFP     vdup.32         q8,  d0[0]
-NOVFP   vld1.32         {d16[],d17[]}, [sp,:32]
         push            {r4,r5,lr}
-VFP     ldr             lr,  [sp, #12]
-NOVFP   ldr             lr,  [sp, #16]
+        ldr             lr,  [sp, #12]
         sub             r2,  r2,  #8
         sub             r5,  lr,  #2
         add             r2,  r2,  r5, lsl #2
@@ -794,14 +453,12 @@ NOVFP   ldr             lr,  [sp, #16]
         vld1.64         {d4,d5},  [r3,:128]!
         vld1.64         {d6,d7},  [r4,:128], r5
 1:      subs            lr,  lr,  #4
-        vmov            q11, q8
-        vmla.f32        d22, d0,  d4
-        vmov            q10, q8
-        vmla.f32        d23, d1,  d5
+        vmul.f32        d22, d0,  d4
         vrev64.32       q3,  q3
-        vmla.f32        d20, d0,  d7
+        vmul.f32        d23, d1,  d5
         vrev64.32       q1,  q1
-        vmla.f32        d21, d1,  d6
+        vmul.f32        d20, d0,  d7
+        vmul.f32        d21, d1,  d6
         beq             2f
         vmla.f32        d22, d3,  d7
         vld1.64         {d0,d1},  [r1,:128]!
@@ -1056,34 +713,6 @@ NOVFP   vmov.32         r0,  d0[0]
         bx              lr
 endfunc
 
-function ff_int32_to_float_fmul_scalar_neon, export=1
-VFP     vdup.32         q0,  d0[0]
-VFP     len     .req    r2
-NOVFP   vdup.32         q0,  r2
-NOVFP   len     .req    r3
-
-        vld1.32         {q1},[r1,:128]!
-        vcvt.f32.s32    q3,  q1
-        vld1.32         {q2},[r1,:128]!
-        vcvt.f32.s32    q8,  q2
-1:      subs            len, len, #8
-        pld             [r1, #16]
-        vmul.f32        q9,  q3,  q0
-        vmul.f32        q10, q8,  q0
-        beq             2f
-        vld1.32         {q1},[r1,:128]!
-        vcvt.f32.s32    q3,  q1
-        vld1.32         {q2},[r1,:128]!
-        vcvt.f32.s32    q8,  q2
-        vst1.32         {q9}, [r0,:128]!
-        vst1.32         {q10},[r0,:128]!
-        b               1b
-2:      vst1.32         {q9}, [r0,:128]!
-        vst1.32         {q10},[r0,:128]!
-        bx              lr
-        .unreq  len
-endfunc
-
 function ff_vector_fmul_reverse_neon, export=1
         add             r2,  r2,  r3,  lsl #2
         sub             r2,  r2,  #32
@@ -1160,3 +789,26 @@ NOVFP   ldr             r2,  [sp]
         vst1.f32        {q9},[r0,:128]!
         bx              lr
 endfunc
+
+function ff_apply_window_int16_neon, export=1
+        push            {r4,lr}
+        add             r4,  r1,  r3,  lsl #1
+        add             lr,  r0,  r3,  lsl #1
+        sub             r4,  r4,  #16
+        sub             lr,  lr,  #16
+        mov             r12, #-16
+1:
+        vld1.16         {q0},     [r1,:128]!
+        vld1.16         {q2},     [r2,:128]!
+        vld1.16         {q1},     [r4,:128], r12
+        vrev64.16       q3,  q2
+        vqrdmulh.s16    q0,  q0,  q2
+        vqrdmulh.s16    d2,  d2,  d7
+        vqrdmulh.s16    d3,  d3,  d6
+        vst1.16         {q0},     [r0,:128]!
+        vst1.16         {q1},     [lr,:128], r12
+        subs            r3,  r3,  #16
+        bgt             1b
+
+        pop             {r4,pc}
+endfunc
diff --git a/ffmpeg-mt/libavcodec/arm/dsputil_vfp.S b/ffmpeg-mt/libavcodec/arm/dsputil_vfp.S
index b704ba9..b41db03 100644
--- a/ffmpeg-mt/libavcodec/arm/dsputil_vfp.S
+++ b/ffmpeg-mt/libavcodec/arm/dsputil_vfp.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Siarhei Siamashka <ssvb at users.sourceforge.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -41,34 +41,33 @@
  * ARM VFP optimized implementation of 'vector_fmul_c' function.
  * Assume that len is a positive number and is multiple of 8
  */
-@ void ff_vector_fmul_vfp(float *dst, const float *src, int len)
+@ void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1, int len)
 function ff_vector_fmul_vfp, export=1
         vpush           {d8-d15}
-        mov             r3,  r0
         fmrx            r12, fpscr
         orr             r12, r12, #(3 << 16) /* set vector size to 4 */
         fmxr            fpscr, r12
 
-        vldmia          r3!, {s0-s3}
-        vldmia          r1!, {s8-s11}
-        vldmia          r3!, {s4-s7}
-        vldmia          r1!, {s12-s15}
+        vldmia          r1!, {s0-s3}
+        vldmia          r2!, {s8-s11}
+        vldmia          r1!, {s4-s7}
+        vldmia          r2!, {s12-s15}
         vmul.f32        s8,  s0,  s8
 1:
-        subs            r2,  r2,  #16
+        subs            r3,  r3,  #16
         vmul.f32        s12, s4,  s12
-        vldmiage        r3!, {s16-s19}
-        vldmiage        r1!, {s24-s27}
-        vldmiage        r3!, {s20-s23}
-        vldmiage        r1!, {s28-s31}
+        vldmiage        r1!, {s16-s19}
+        vldmiage        r2!, {s24-s27}
+        vldmiage        r1!, {s20-s23}
+        vldmiage        r2!, {s28-s31}
         vmulge.f32      s24, s16, s24
         vstmia          r0!, {s8-s11}
         vstmia          r0!, {s12-s15}
         vmulge.f32      s28, s20, s28
-        vldmiagt        r3!, {s0-s3}
-        vldmiagt        r1!, {s8-s11}
-        vldmiagt        r3!, {s4-s7}
-        vldmiagt        r1!, {s12-s15}
+        vldmiagt        r1!, {s0-s3}
+        vldmiagt        r2!, {s8-s11}
+        vldmiagt        r1!, {s4-s7}
+        vldmiagt        r2!, {s12-s15}
         vmulge.f32      s8,  s0,  s8
         vstmiage        r0!, {s24-s27}
         vstmiage        r0!, {s28-s31}
@@ -132,58 +131,3 @@ function ff_vector_fmul_reverse_vfp, export=1
         vpop            {d8-d15}
         bx              lr
 endfunc
-
-#if HAVE_ARMV6
-/**
- * ARM VFP optimized float to int16 conversion.
- * Assume that len is a positive number and is multiple of 8, destination
- * buffer is at least 4 bytes aligned (8 bytes alignment is better for
- * performance), little endian byte sex
- */
-@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
-function ff_float_to_int16_vfp, export=1
-        push            {r4-r8,lr}
-        vpush           {d8-d11}
-        vldmia          r1!, {s16-s23}
-        vcvt.s32.f32    s0,  s16
-        vcvt.s32.f32    s1,  s17
-        vcvt.s32.f32    s2,  s18
-        vcvt.s32.f32    s3,  s19
-        vcvt.s32.f32    s4,  s20
-        vcvt.s32.f32    s5,  s21
-        vcvt.s32.f32    s6,  s22
-        vcvt.s32.f32    s7,  s23
-1:
-        subs            r2,  r2,  #8
-        vmov            r3,  r4,  s0, s1
-        vmov            r5,  r6,  s2, s3
-        vmov            r7,  r8,  s4, s5
-        vmov            ip,  lr,  s6, s7
-        vldmiagt        r1!, {s16-s23}
-        ssat            r4,  #16, r4
-        ssat            r3,  #16, r3
-        ssat            r6,  #16, r6
-        ssat            r5,  #16, r5
-        pkhbt           r3,  r3,  r4, lsl #16
-        pkhbt           r4,  r5,  r6, lsl #16
-        vcvtgt.s32.f32  s0,  s16
-        vcvtgt.s32.f32  s1,  s17
-        vcvtgt.s32.f32  s2,  s18
-        vcvtgt.s32.f32  s3,  s19
-        vcvtgt.s32.f32  s4,  s20
-        vcvtgt.s32.f32  s5,  s21
-        vcvtgt.s32.f32  s6,  s22
-        vcvtgt.s32.f32  s7,  s23
-        ssat            r8,  #16, r8
-        ssat            r7,  #16, r7
-        ssat            lr,  #16, lr
-        ssat            ip,  #16, ip
-        pkhbt           r5,  r7,  r8, lsl #16
-        pkhbt           r6,  ip,  lr, lsl #16
-        stmia           r0!, {r3-r6}
-        bgt             1b
-
-        vpop            {d8-d11}
-        pop             {r4-r8,pc}
-endfunc
-#endif
diff --git a/ffmpeg-mt/libavcodec/arm/fft_fixed_init_arm.c b/ffmpeg-mt/libavcodec/arm/fft_fixed_init_arm.c
new file mode 100644
index 0000000..be412cd
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/fft_fixed_init_arm.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define CONFIG_FFT_FLOAT 0
+#include "libavcodec/fft.h"
+
+void ff_fft_fixed_calc_neon(FFTContext *s, FFTComplex *z);
+void ff_mdct_fixed_calc_neon(FFTContext *s, FFTSample *o, const FFTSample *i);
+void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i);
+
+av_cold void ff_fft_fixed_init_arm(FFTContext *s)
+{
+    if (HAVE_NEON) {
+        s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
+        s->fft_calc        = ff_fft_fixed_calc_neon;
+
+#if CONFIG_MDCT
+        if (!s->inverse && s->mdct_bits >= 5) {
+            s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
+            s->mdct_calc        = ff_mdct_fixed_calc_neon;
+            s->mdct_calcw       = ff_mdct_fixed_calcw_neon;
+        }
+#endif
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/arm/fft_fixed_neon.S b/ffmpeg-mt/libavcodec/arm/fft_fixed_neon.S
new file mode 100644
index 0000000..14884d3
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/fft_fixed_neon.S
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+.macro  bflies          d0,  d1,  r0,  r1
+        vrev64.32       \r0, \d1                @ t5, t6, t1, t2
+        vhsub.s16       \r1, \d1, \r0           @ t1-t5, t2-t6, t5-t1, t6-t2
+        vhadd.s16       \r0, \d1, \r0           @ t1+t5, t2+t6, t5+t1, t6+t2
+        vext.16         \r1, \r1, \r1, #1       @ t2-t6, t5-t1, t6-t2, t1-t5
+        vtrn.32         \r0, \r1                @ t1+t5, t2+t6, t2-t6, t5-t1
+                                                @ t5,    t6,    t4,    t3
+        vhsub.s16       \d1, \d0, \r0
+        vhadd.s16       \d0, \d0, \r0
+.endm
+
+.macro  transform01     q0,  q1,  d3,  c0,  c1,  r0,  w0,  w1
+        vrev32.16       \r0, \d3
+        vmull.s16       \w0, \d3, \c0
+        vmlal.s16       \w0, \r0, \c1
+        vshrn.s32       \d3, \w0, #15
+        bflies          \q0, \q1, \w0, \w1
+.endm
+
+.macro  transform2      d0,  d1,  d2,  d3,  q0,  q1,  c0,  c1,  c2,  c3, \
+                        r0,  r1,  w0,  w1
+        vrev32.16       \r0, \d1
+        vrev32.16       \r1, \d3
+        vmull.s16       \w0, \d1, \c0
+        vmlal.s16       \w0, \r0, \c1
+        vmull.s16       \w1, \d3, \c2
+        vmlal.s16       \w1, \r1, \c3
+        vshrn.s32       \d1, \w0, #15
+        vshrn.s32       \d3, \w1, #15
+        bflies          \q0, \q1, \w0, \w1
+.endm
+
+.macro  fft4            d0,  d1,  r0,  r1
+        vhsub.s16       \r0, \d0, \d1           @ t3, t4, t8, t7
+        vhsub.s16       \r1, \d1, \d0
+        vhadd.s16       \d0, \d0, \d1           @ t1, t2, t6, t5
+        vmov.i64        \d1, #0xffff<<32
+        vbit            \r0, \r1, \d1
+        vrev64.16       \r1, \r0                @ t7, t8, t4, t3
+        vtrn.32         \r0, \r1                @ t3, t4, t7, t8
+        vtrn.32         \d0, \r0                @ t1, t2, t3, t4, t6, t5, t8, t7
+        vhsub.s16       \d1, \d0, \r0           @ r2, i2, r3, i1
+        vhadd.s16       \d0, \d0, \r0           @ r0, i0, r1, i3
+.endm
+
+.macro  fft8            d0,  d1,  d2,  d3,  q0,  q1,  c0,  c1,  r0,  r1, w0, w1
+        fft4            \d0, \d1, \r0, \r1
+        vtrn.32         \d0, \d1                @ z0, z2, z1, z3
+        vhadd.s16       \r0, \d2, \d3           @ t1, t2, t3, t4
+        vhsub.s16       \d3, \d2, \d3           @ z5, z7
+        vmov            \d2, \r0
+        transform01     \q0, \q1, \d3, \c0, \c1, \r0, \w0, \w1
+.endm
+
+function fft4_neon
+        vld1.16         {d0-d1},  [r0,:128]
+        fft4            d0,  d1,  d2,  d3
+        vst1.16         {d0-d1},  [r0,:128]
+        bx              lr
+endfunc
+
+function fft8_neon
+        vld1.16         {d0-d3},  [r0,:128]
+        movrel          r1,  coefs
+        vld1.16         {d30},    [r1,:64]
+        vdup.16         d31, d30[0]
+        fft8            d0,  d1,  d2,  d3,  q0,  q1,  d31, d30, d20, d21, q8, q9
+        vtrn.32         d0,  d1
+        vtrn.32         d2,  d3
+        vst1.16         {d0-d3},  [r0,:128]
+        bx              lr
+endfunc
+
+function fft16_neon
+        vld1.16         {d0-d3},  [r0,:128]!
+        vld1.16         {d4-d7},  [r0,:128]
+        movrel          r1,  coefs
+        sub             r0,  r0,  #32
+        vld1.16         {d28-d31},[r1,:128]
+        vdup.16         d31, d28[0]
+        fft8            d0,  d1,  d2,  d3,  q0,  q1,  d31, d28, d20, d21, q8, q9
+        vswp            d5,  d6
+        fft4            q2,  q3,  q8,  q9
+        vswp            d5,  d6
+        vtrn.32         q0,  q1             @ z0, z4, z2, z6, z1, z5, z3, z7
+        vtrn.32         q2,  q3             @ z8, z12,z10,z14,z9, z13,z11,z15
+        vswp            d1,  d2
+        vdup.16         d31, d28[0]
+        transform01     q0,  q2,  d5,  d31, d28, d20, q8, q9
+        vdup.16         d26, d29[0]
+        vdup.16         d27, d30[0]
+        transform2      d2,  d6,  d3,  d7,  q1,  q3,  d26, d30, d27, d29, \
+                        d20, d21, q8,  q9
+        vtrn.32         q0,  q1
+        vtrn.32         q2,  q3
+        vst1.16         {d0-d3},  [r0,:128]!
+        vst1.16         {d4-d7},  [r0,:128]
+        bx              lr
+endfunc
+
+function fft_pass_neon
+        push            {r4,lr}
+        movrel          lr,  coefs + 24
+        vld1.16         {d30},    [lr,:64]
+        lsl             r12, r2,  #3
+        vmov            d31, d30
+        add             r3,  r1,  r2,  lsl #2
+        mov             lr,  #-8
+        sub             r3,  r3,  #2
+        mov             r4,  r0
+        vld1.16         {d27[]},  [r3,:16]
+        sub             r3,  r3,  #6
+        vld1.16         {q0},     [r4,:128], r12
+        vld1.16         {q1},     [r4,:128], r12
+        vld1.16         {q2},     [r4,:128], r12
+        vld1.16         {q3},     [r4,:128], r12
+        vld1.16         {d28},    [r1,:64]!
+        vld1.16         {d29},    [r3,:64], lr
+        vswp            d1,  d2
+        vswp            d5,  d6
+        vtrn.32         d0,  d1
+        vtrn.32         d4,  d5
+        vdup.16         d25, d28[1]
+        vmul.s16        d27, d27, d31
+        transform01     q0,  q2,  d5,  d25, d27, d20, q8,  q9
+        b               2f
+1:
+        mov             r4,  r0
+        vdup.16         d26, d29[0]
+        vld1.16         {q0},     [r4,:128], r12
+        vld1.16         {q1},     [r4,:128], r12
+        vld1.16         {q2},     [r4,:128], r12
+        vld1.16         {q3},     [r4,:128], r12
+        vld1.16         {d28},    [r1,:64]!
+        vld1.16         {d29},    [r3,:64], lr
+        vswp            d1,  d2
+        vswp            d5,  d6
+        vtrn.32         d0,  d1
+        vtrn.32         d4,  d5
+        vdup.16         d24, d28[0]
+        vdup.16         d25, d28[1]
+        vdup.16         d27, d29[3]
+        vmul.s16        q13, q13, q15
+        transform2      d0,  d4,  d1,  d5,  q0,  q2,  d24, d26, d25, d27, \
+                        d16, d17, q9,  q10
+2:
+        vtrn.32         d2,  d3
+        vtrn.32         d6,  d7
+        vdup.16         d24, d28[2]
+        vdup.16         d26, d29[2]
+        vdup.16         d25, d28[3]
+        vdup.16         d27, d29[1]
+        vmul.s16        q13, q13, q15
+        transform2      d2,  d6,  d3,  d7,  q1,  q3,  d24, d26, d25, d27, \
+                        d16, d17, q9,  q10
+        vtrn.32         d0,  d1
+        vtrn.32         d2,  d3
+        vtrn.32         d4,  d5
+        vtrn.32         d6,  d7
+        vswp            d1,  d2
+        vswp            d5,  d6
+        mov             r4,  r0
+        vst1.16         {q0},     [r4,:128], r12
+        vst1.16         {q1},     [r4,:128], r12
+        vst1.16         {q2},     [r4,:128], r12
+        vst1.16         {q3},     [r4,:128], r12
+        add             r0,  r0,  #16
+        subs            r2,  r2,  #2
+        bgt             1b
+        pop             {r4,pc}
+endfunc
+
+#define F_SQRT1_2   23170
+#define F_COS_16_1  30274
+#define F_COS_16_3  12540
+
+const   coefs, align=4
+        .short          F_SQRT1_2, -F_SQRT1_2, -F_SQRT1_2,  F_SQRT1_2
+        .short          F_COS_16_1,-F_COS_16_1,-F_COS_16_1, F_COS_16_1
+        .short          F_COS_16_3,-F_COS_16_3,-F_COS_16_3, F_COS_16_3
+        .short          1,         -1,         -1,          1
+endconst
+
+.macro  def_fft n, n2, n4
+function fft\n\()_neon
+        push            {r4, lr}
+        mov             r4,  r0
+        bl              fft\n2\()_neon
+        add             r0,  r4,  #\n4*2*4
+        bl              fft\n4\()_neon
+        add             r0,  r4,  #\n4*3*4
+        bl              fft\n4\()_neon
+        mov             r0,  r4
+        pop             {r4, lr}
+        movrel          r1,  X(ff_cos_\n\()_fixed)
+        mov             r2,  #\n4/2
+        b               fft_pass_neon
+endfunc
+.endm
+
+        def_fft    32,    16,     8
+        def_fft    64,    32,    16
+        def_fft   128,    64,    32
+        def_fft   256,   128,    64
+        def_fft   512,   256,   128
+        def_fft  1024,   512,   256
+        def_fft  2048,  1024,   512
+        def_fft  4096,  2048,  1024
+        def_fft  8192,  4096,  2048
+        def_fft 16384,  8192,  4096
+        def_fft 32768, 16384,  8192
+        def_fft 65536, 32768, 16384
+
+function ff_fft_fixed_calc_neon, export=1
+        ldr             r2,  [r0]
+        sub             r2,  r2,  #2
+        movrel          r3,  fft_fixed_tab_neon
+        ldr             r3,  [r3, r2, lsl #2]
+        mov             r0,  r1
+        bx              r3
+endfunc
+
+const   fft_fixed_tab_neon
+        .word fft4_neon
+        .word fft8_neon
+        .word fft16_neon
+        .word fft32_neon
+        .word fft64_neon
+        .word fft128_neon
+        .word fft256_neon
+        .word fft512_neon
+        .word fft1024_neon
+        .word fft2048_neon
+        .word fft4096_neon
+        .word fft8192_neon
+        .word fft16384_neon
+        .word fft32768_neon
+        .word fft65536_neon
+endconst
diff --git a/ffmpeg-mt/libavcodec/arm/fft_init_arm.c b/ffmpeg-mt/libavcodec/arm/fft_init_arm.c
index bde1240..4ee4909 100644
--- a/ffmpeg-mt/libavcodec/arm/fft_init_arm.c
+++ b/ffmpeg-mt/libavcodec/arm/fft_init_arm.c
@@ -1,24 +1,25 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavcodec/fft.h"
+#include "libavcodec/rdft.h"
 #include "libavcodec/synth_filter.h"
 
 void ff_fft_permute_neon(FFTContext *s, FFTComplex *z);
@@ -34,7 +35,7 @@ void ff_synth_filter_float_neon(FFTContext *imdct,
                                 float *synth_buf_ptr, int *synth_buf_offset,
                                 float synth_buf2[32], const float window[512],
                                 float out[32], const float in[32],
-                                float scale, float bias);
+                                float scale);
 
 av_cold void ff_fft_init_arm(FFTContext *s)
 {
@@ -44,7 +45,7 @@ av_cold void ff_fft_init_arm(FFTContext *s)
         s->imdct_calc   = ff_imdct_calc_neon;
         s->imdct_half   = ff_imdct_half_neon;
         s->mdct_calc    = ff_mdct_calc_neon;
-        s->permutation  = FF_MDCT_PERM_INTERLEAVE;
+        s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
     }
 }
 
diff --git a/ffmpeg-mt/libavcodec/arm/fft_neon.S b/ffmpeg-mt/libavcodec/arm/fft_neon.S
index 1db7abd..8876218 100644
--- a/ffmpeg-mt/libavcodec/arm/fft_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/fft_neon.S
@@ -7,20 +7,20 @@
  * This algorithm (though not any of the implementation details) is
  * based on libdjbfft by D. J. Bernstein.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/fmtconvert_init_arm.c b/ffmpeg-mt/libavcodec/arm/fmtconvert_init_arm.c
new file mode 100644
index 0000000..92e07f1
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/fmtconvert_init_arm.c
@@ -0,0 +1,48 @@
+/*
+ * ARM optimized Format Conversion Utils
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/fmtconvert.h"
+
+void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src,
+                                        float mul, int len);
+
+void ff_float_to_int16_neon(int16_t *dst, const float *src, long len);
+void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int);
+
+void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len);
+
+void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx)
+{
+    if (HAVE_ARMVFP && HAVE_ARMV6) {
+        c->float_to_int16 = ff_float_to_int16_vfp;
+    }
+
+    if (HAVE_NEON) {
+        c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon;
+
+        if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
+            c->float_to_int16            = ff_float_to_int16_neon;
+            c->float_to_int16_interleave = ff_float_to_int16_interleave_neon;
+        }
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/arm/fmtconvert_neon.S b/ffmpeg-mt/libavcodec/arm/fmtconvert_neon.S
new file mode 100644
index 0000000..4b0e9a2
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/fmtconvert_neon.S
@@ -0,0 +1,391 @@
+/*
+ * ARM NEON optimised Format Conversion Utils
+ * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "asm.S"
+
+        preserve8
+        .text
+
+function ff_float_to_int16_neon, export=1
+        subs            r2,  r2,  #8
+        vld1.64         {d0-d1},  [r1,:128]!
+        vcvt.s32.f32    q8,  q0,  #16
+        vld1.64         {d2-d3},  [r1,:128]!
+        vcvt.s32.f32    q9,  q1,  #16
+        beq             3f
+        bics            ip,  r2,  #15
+        beq             2f
+1:      subs            ip,  ip,  #16
+        vshrn.s32       d4,  q8,  #16
+        vld1.64         {d0-d1},  [r1,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vshrn.s32       d5,  q9,  #16
+        vld1.64         {d2-d3},  [r1,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+        vshrn.s32       d6,  q0,  #16
+        vst1.64         {d4-d5},  [r0,:128]!
+        vshrn.s32       d7,  q1,  #16
+        vld1.64         {d16-d17},[r1,:128]!
+        vcvt.s32.f32    q8,  q8,  #16
+        vld1.64         {d18-d19},[r1,:128]!
+        vcvt.s32.f32    q9,  q9,  #16
+        vst1.64         {d6-d7},  [r0,:128]!
+        bne             1b
+        ands            r2,  r2,  #15
+        beq             3f
+2:      vld1.64         {d0-d1},  [r1,:128]!
+        vshrn.s32       d4,  q8,  #16
+        vcvt.s32.f32    q0,  q0,  #16
+        vld1.64         {d2-d3},  [r1,:128]!
+        vshrn.s32       d5,  q9,  #16
+        vcvt.s32.f32    q1,  q1,  #16
+        vshrn.s32       d6,  q0,  #16
+        vst1.64         {d4-d5},  [r0,:128]!
+        vshrn.s32       d7,  q1,  #16
+        vst1.64         {d6-d7},  [r0,:128]!
+        bx              lr
+3:      vshrn.s32       d4,  q8,  #16
+        vshrn.s32       d5,  q9,  #16
+        vst1.64         {d4-d5},  [r0,:128]!
+        bx              lr
+endfunc
+
+function ff_float_to_int16_interleave_neon, export=1
+        cmp             r3, #2
+        ldrlt           r1, [r1]
+        blt             ff_float_to_int16_neon
+        bne             4f
+
+        ldr             r3, [r1]
+        ldr             r1, [r1, #4]
+
+        subs            r2,  r2,  #8
+        vld1.64         {d0-d1},  [r3,:128]!
+        vcvt.s32.f32    q8,  q0,  #16
+        vld1.64         {d2-d3},  [r3,:128]!
+        vcvt.s32.f32    q9,  q1,  #16
+        vld1.64         {d20-d21},[r1,:128]!
+        vcvt.s32.f32    q10, q10, #16
+        vld1.64         {d22-d23},[r1,:128]!
+        vcvt.s32.f32    q11, q11, #16
+        beq             3f
+        bics            ip,  r2,  #15
+        beq             2f
+1:      subs            ip,  ip,  #16
+        vld1.64         {d0-d1},  [r3,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vsri.32         q10, q8,  #16
+        vld1.64         {d2-d3},  [r3,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+        vld1.64         {d24-d25},[r1,:128]!
+        vcvt.s32.f32    q12, q12, #16
+        vld1.64         {d26-d27},[r1,:128]!
+        vsri.32         q11, q9,  #16
+        vst1.64         {d20-d21},[r0,:128]!
+        vcvt.s32.f32    q13, q13, #16
+        vst1.64         {d22-d23},[r0,:128]!
+        vsri.32         q12, q0,  #16
+        vld1.64         {d16-d17},[r3,:128]!
+        vsri.32         q13, q1,  #16
+        vst1.64         {d24-d25},[r0,:128]!
+        vcvt.s32.f32    q8,  q8,  #16
+        vld1.64         {d18-d19},[r3,:128]!
+        vcvt.s32.f32    q9,  q9,  #16
+        vld1.64         {d20-d21},[r1,:128]!
+        vcvt.s32.f32    q10, q10, #16
+        vld1.64         {d22-d23},[r1,:128]!
+        vcvt.s32.f32    q11, q11, #16
+        vst1.64         {d26-d27},[r0,:128]!
+        bne             1b
+        ands            r2,  r2,  #15
+        beq             3f
+2:      vsri.32         q10, q8,  #16
+        vld1.64         {d0-d1},  [r3,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vld1.64         {d2-d3},  [r3,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+        vld1.64         {d24-d25},[r1,:128]!
+        vcvt.s32.f32    q12, q12, #16
+        vsri.32         q11, q9,  #16
+        vld1.64         {d26-d27},[r1,:128]!
+        vcvt.s32.f32    q13, q13, #16
+        vst1.64         {d20-d21},[r0,:128]!
+        vsri.32         q12, q0,  #16
+        vst1.64         {d22-d23},[r0,:128]!
+        vsri.32         q13, q1,  #16
+        vst1.64         {d24-d27},[r0,:128]!
+        bx              lr
+3:      vsri.32         q10, q8,  #16
+        vsri.32         q11, q9,  #16
+        vst1.64         {d20-d23},[r0,:128]!
+        bx              lr
+
+4:      push            {r4-r8,lr}
+        cmp             r3,  #4
+        lsl             ip,  r3,  #1
+        blt             4f
+
+        @ 4 channels
+5:      ldmia           r1!, {r4-r7}
+        mov             lr,  r2
+        mov             r8,  r0
+        vld1.64         {d16-d17},[r4,:128]!
+        vcvt.s32.f32    q8,  q8,  #16
+        vld1.64         {d18-d19},[r5,:128]!
+        vcvt.s32.f32    q9,  q9,  #16
+        vld1.64         {d20-d21},[r6,:128]!
+        vcvt.s32.f32    q10, q10, #16
+        vld1.64         {d22-d23},[r7,:128]!
+        vcvt.s32.f32    q11, q11, #16
+6:      subs            lr,  lr,  #8
+        vld1.64         {d0-d1},  [r4,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vsri.32         q9,  q8,  #16
+        vld1.64         {d2-d3},  [r5,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+        vsri.32         q11, q10, #16
+        vld1.64         {d4-d5},  [r6,:128]!
+        vcvt.s32.f32    q2,  q2,  #16
+        vzip.32         d18, d22
+        vld1.64         {d6-d7},  [r7,:128]!
+        vcvt.s32.f32    q3,  q3,  #16
+        vzip.32         d19, d23
+        vst1.64         {d18},    [r8], ip
+        vsri.32         q1,  q0,  #16
+        vst1.64         {d22},    [r8], ip
+        vsri.32         q3,  q2,  #16
+        vst1.64         {d19},    [r8], ip
+        vzip.32         d2,  d6
+        vst1.64         {d23},    [r8], ip
+        vzip.32         d3,  d7
+        beq             7f
+        vld1.64         {d16-d17},[r4,:128]!
+        vcvt.s32.f32    q8,  q8,  #16
+        vst1.64         {d2},     [r8], ip
+        vld1.64         {d18-d19},[r5,:128]!
+        vcvt.s32.f32    q9,  q9,  #16
+        vst1.64         {d6},     [r8], ip
+        vld1.64         {d20-d21},[r6,:128]!
+        vcvt.s32.f32    q10, q10, #16
+        vst1.64         {d3},     [r8], ip
+        vld1.64         {d22-d23},[r7,:128]!
+        vcvt.s32.f32    q11, q11, #16
+        vst1.64         {d7},     [r8], ip
+        b               6b
+7:      vst1.64         {d2},     [r8], ip
+        vst1.64         {d6},     [r8], ip
+        vst1.64         {d3},     [r8], ip
+        vst1.64         {d7},     [r8], ip
+        subs            r3,  r3,  #4
+        popeq           {r4-r8,pc}
+        cmp             r3,  #4
+        add             r0,  r0,  #8
+        bge             5b
+
+        @ 2 channels
+4:      cmp             r3,  #2
+        blt             4f
+        ldmia           r1!, {r4-r5}
+        mov             lr,  r2
+        mov             r8,  r0
+        tst             lr,  #8
+        vld1.64         {d16-d17},[r4,:128]!
+        vcvt.s32.f32    q8,  q8,  #16
+        vld1.64         {d18-d19},[r5,:128]!
+        vcvt.s32.f32    q9,  q9,  #16
+        vld1.64         {d20-d21},[r4,:128]!
+        vcvt.s32.f32    q10, q10, #16
+        vld1.64         {d22-d23},[r5,:128]!
+        vcvt.s32.f32    q11, q11, #16
+        beq             6f
+        subs            lr,  lr,  #8
+        beq             7f
+        vsri.32         d18, d16, #16
+        vsri.32         d19, d17, #16
+        vld1.64         {d16-d17},[r4,:128]!
+        vcvt.s32.f32    q8,  q8,  #16
+        vst1.32         {d18[0]}, [r8], ip
+        vsri.32         d22, d20, #16
+        vst1.32         {d18[1]}, [r8], ip
+        vsri.32         d23, d21, #16
+        vst1.32         {d19[0]}, [r8], ip
+        vst1.32         {d19[1]}, [r8], ip
+        vld1.64         {d18-d19},[r5,:128]!
+        vcvt.s32.f32    q9,  q9,  #16
+        vst1.32         {d22[0]}, [r8], ip
+        vst1.32         {d22[1]}, [r8], ip
+        vld1.64         {d20-d21},[r4,:128]!
+        vcvt.s32.f32    q10, q10, #16
+        vst1.32         {d23[0]}, [r8], ip
+        vst1.32         {d23[1]}, [r8], ip
+        vld1.64         {d22-d23},[r5,:128]!
+        vcvt.s32.f32    q11, q11, #16
+6:      subs            lr,  lr,  #16
+        vld1.64         {d0-d1},  [r4,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vsri.32         d18, d16, #16
+        vld1.64         {d2-d3},  [r5,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+        vsri.32         d19, d17, #16
+        vld1.64         {d4-d5},  [r4,:128]!
+        vcvt.s32.f32    q2,  q2,  #16
+        vld1.64         {d6-d7},  [r5,:128]!
+        vcvt.s32.f32    q3,  q3,  #16
+        vst1.32         {d18[0]}, [r8], ip
+        vsri.32         d22, d20, #16
+        vst1.32         {d18[1]}, [r8], ip
+        vsri.32         d23, d21, #16
+        vst1.32         {d19[0]}, [r8], ip
+        vsri.32         d2,  d0,  #16
+        vst1.32         {d19[1]}, [r8], ip
+        vsri.32         d3,  d1,  #16
+        vst1.32         {d22[0]}, [r8], ip
+        vsri.32         d6,  d4,  #16
+        vst1.32         {d22[1]}, [r8], ip
+        vsri.32         d7,  d5,  #16
+        vst1.32         {d23[0]}, [r8], ip
+        vst1.32         {d23[1]}, [r8], ip
+        beq             6f
+        vld1.64         {d16-d17},[r4,:128]!
+        vcvt.s32.f32    q8,  q8,  #16
+        vst1.32         {d2[0]},  [r8], ip
+        vst1.32         {d2[1]},  [r8], ip
+        vld1.64         {d18-d19},[r5,:128]!
+        vcvt.s32.f32    q9,  q9,  #16
+        vst1.32         {d3[0]},  [r8], ip
+        vst1.32         {d3[1]},  [r8], ip
+        vld1.64         {d20-d21},[r4,:128]!
+        vcvt.s32.f32    q10, q10, #16
+        vst1.32         {d6[0]},  [r8], ip
+        vst1.32         {d6[1]},  [r8], ip
+        vld1.64         {d22-d23},[r5,:128]!
+        vcvt.s32.f32    q11, q11, #16
+        vst1.32         {d7[0]},  [r8], ip
+        vst1.32         {d7[1]},  [r8], ip
+        bgt             6b
+6:      vst1.32         {d2[0]},  [r8], ip
+        vst1.32         {d2[1]},  [r8], ip
+        vst1.32         {d3[0]},  [r8], ip
+        vst1.32         {d3[1]},  [r8], ip
+        vst1.32         {d6[0]},  [r8], ip
+        vst1.32         {d6[1]},  [r8], ip
+        vst1.32         {d7[0]},  [r8], ip
+        vst1.32         {d7[1]},  [r8], ip
+        b               8f
+7:      vsri.32         d18, d16, #16
+        vsri.32         d19, d17, #16
+        vst1.32         {d18[0]}, [r8], ip
+        vsri.32         d22, d20, #16
+        vst1.32         {d18[1]}, [r8], ip
+        vsri.32         d23, d21, #16
+        vst1.32         {d19[0]}, [r8], ip
+        vst1.32         {d19[1]}, [r8], ip
+        vst1.32         {d22[0]}, [r8], ip
+        vst1.32         {d22[1]}, [r8], ip
+        vst1.32         {d23[0]}, [r8], ip
+        vst1.32         {d23[1]}, [r8], ip
+8:      subs            r3,  r3,  #2
+        add             r0,  r0,  #4
+        popeq           {r4-r8,pc}
+
+        @ 1 channel
+4:      ldr             r4,  [r1],#4
+        tst             r2,  #8
+        mov             lr,  r2
+        mov             r5,  r0
+        vld1.64         {d0-d1},  [r4,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vld1.64         {d2-d3},  [r4,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+        bne             8f
+6:      subs            lr,  lr,  #16
+        vld1.64         {d4-d5},  [r4,:128]!
+        vcvt.s32.f32    q2,  q2,  #16
+        vld1.64         {d6-d7},  [r4,:128]!
+        vcvt.s32.f32    q3,  q3,  #16
+        vst1.16         {d0[1]},  [r5,:16], ip
+        vst1.16         {d0[3]},  [r5,:16], ip
+        vst1.16         {d1[1]},  [r5,:16], ip
+        vst1.16         {d1[3]},  [r5,:16], ip
+        vst1.16         {d2[1]},  [r5,:16], ip
+        vst1.16         {d2[3]},  [r5,:16], ip
+        vst1.16         {d3[1]},  [r5,:16], ip
+        vst1.16         {d3[3]},  [r5,:16], ip
+        beq             7f
+        vld1.64         {d0-d1},  [r4,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vld1.64         {d2-d3},  [r4,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+7:      vst1.16         {d4[1]},  [r5,:16], ip
+        vst1.16         {d4[3]},  [r5,:16], ip
+        vst1.16         {d5[1]},  [r5,:16], ip
+        vst1.16         {d5[3]},  [r5,:16], ip
+        vst1.16         {d6[1]},  [r5,:16], ip
+        vst1.16         {d6[3]},  [r5,:16], ip
+        vst1.16         {d7[1]},  [r5,:16], ip
+        vst1.16         {d7[3]},  [r5,:16], ip
+        bgt             6b
+        pop             {r4-r8,pc}
+8:      subs            lr,  lr,  #8
+        vst1.16         {d0[1]},  [r5,:16], ip
+        vst1.16         {d0[3]},  [r5,:16], ip
+        vst1.16         {d1[1]},  [r5,:16], ip
+        vst1.16         {d1[3]},  [r5,:16], ip
+        vst1.16         {d2[1]},  [r5,:16], ip
+        vst1.16         {d2[3]},  [r5,:16], ip
+        vst1.16         {d3[1]},  [r5,:16], ip
+        vst1.16         {d3[3]},  [r5,:16], ip
+        popeq           {r4-r8,pc}
+        vld1.64         {d0-d1},  [r4,:128]!
+        vcvt.s32.f32    q0,  q0,  #16
+        vld1.64         {d2-d3},  [r4,:128]!
+        vcvt.s32.f32    q1,  q1,  #16
+        b               6b
+endfunc
+
+function ff_int32_to_float_fmul_scalar_neon, export=1
+VFP     vdup.32         q0,  d0[0]
+VFP     len     .req    r2
+NOVFP   vdup.32         q0,  r2
+NOVFP   len     .req    r3
+
+        vld1.32         {q1},[r1,:128]!
+        vcvt.f32.s32    q3,  q1
+        vld1.32         {q2},[r1,:128]!
+        vcvt.f32.s32    q8,  q2
+1:      subs            len, len, #8
+        pld             [r1, #16]
+        vmul.f32        q9,  q3,  q0
+        vmul.f32        q10, q8,  q0
+        beq             2f
+        vld1.32         {q1},[r1,:128]!
+        vcvt.f32.s32    q3,  q1
+        vld1.32         {q2},[r1,:128]!
+        vcvt.f32.s32    q8,  q2
+        vst1.32         {q9}, [r0,:128]!
+        vst1.32         {q10},[r0,:128]!
+        b               1b
+2:      vst1.32         {q9}, [r0,:128]!
+        vst1.32         {q10},[r0,:128]!
+        bx              lr
+        .unreq  len
+endfunc
diff --git a/ffmpeg-mt/libavcodec/arm/fmtconvert_vfp.S b/ffmpeg-mt/libavcodec/arm/fmtconvert_vfp.S
new file mode 100644
index 0000000..e01627b
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/fmtconvert_vfp.S
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2008 Siarhei Siamashka <ssvb at users.sourceforge.net>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "asm.S"
+
+        .syntax unified
+
+/**
+ * ARM VFP optimized float to int16 conversion.
+ * Assume that len is a positive number and is multiple of 8, destination
+ * buffer is at least 4 bytes aligned (8 bytes alignment is better for
+ * performance), little endian byte sex
+ */
+@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
+function ff_float_to_int16_vfp, export=1
+        push            {r4-r8,lr}
+        vpush           {d8-d11}
+        vldmia          r1!, {s16-s23}
+        vcvt.s32.f32    s0,  s16
+        vcvt.s32.f32    s1,  s17
+        vcvt.s32.f32    s2,  s18
+        vcvt.s32.f32    s3,  s19
+        vcvt.s32.f32    s4,  s20
+        vcvt.s32.f32    s5,  s21
+        vcvt.s32.f32    s6,  s22
+        vcvt.s32.f32    s7,  s23
+1:
+        subs            r2,  r2,  #8
+        vmov            r3,  r4,  s0, s1
+        vmov            r5,  r6,  s2, s3
+        vmov            r7,  r8,  s4, s5
+        vmov            ip,  lr,  s6, s7
+        vldmiagt        r1!, {s16-s23}
+        ssat            r4,  #16, r4
+        ssat            r3,  #16, r3
+        ssat            r6,  #16, r6
+        ssat            r5,  #16, r5
+        pkhbt           r3,  r3,  r4, lsl #16
+        pkhbt           r4,  r5,  r6, lsl #16
+        vcvtgt.s32.f32  s0,  s16
+        vcvtgt.s32.f32  s1,  s17
+        vcvtgt.s32.f32  s2,  s18
+        vcvtgt.s32.f32  s3,  s19
+        vcvtgt.s32.f32  s4,  s20
+        vcvtgt.s32.f32  s5,  s21
+        vcvtgt.s32.f32  s6,  s22
+        vcvtgt.s32.f32  s7,  s23
+        ssat            r8,  #16, r8
+        ssat            r7,  #16, r7
+        ssat            lr,  #16, lr
+        ssat            ip,  #16, ip
+        pkhbt           r5,  r7,  r8, lsl #16
+        pkhbt           r6,  ip,  lr, lsl #16
+        stmia           r0!, {r3-r6}
+        bgt             1b
+
+        vpop            {d8-d11}
+        pop             {r4-r8,pc}
+endfunc
diff --git a/ffmpeg-mt/libavcodec/arm/h264dsp_init_arm.c b/ffmpeg-mt/libavcodec/arm/h264dsp_init_arm.c
index e55a9f4..20f5ac2 100644
--- a/ffmpeg-mt/libavcodec/arm/h264dsp_init_arm.c
+++ b/ffmpeg-mt/libavcodec/arm/h264dsp_init_arm.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/h264dsp_neon.S b/ffmpeg-mt/libavcodec/arm/h264dsp_neon.S
index bd15ced..b76e447 100644
--- a/ffmpeg-mt/libavcodec/arm/h264dsp_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/h264dsp_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/h264idct_neon.S b/ffmpeg-mt/libavcodec/arm/h264idct_neon.S
index 6b6a669..b725354 100644
--- a/ffmpeg-mt/libavcodec/arm/h264idct_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/h264idct_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/h264pred_init_arm.c b/ffmpeg-mt/libavcodec/arm/h264pred_init_arm.c
index 87cc558..3f1c5c6 100644
--- a/ffmpeg-mt/libavcodec/arm/h264pred_init_arm.c
+++ b/ffmpeg-mt/libavcodec/arm/h264pred_init_arm.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/h264pred_neon.S b/ffmpeg-mt/libavcodec/arm/h264pred_neon.S
index e2c69e1..fe8a369 100644
--- a/ffmpeg-mt/libavcodec/arm/h264pred_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/h264pred_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -131,8 +131,8 @@ function ff_pred16x16_plane_neon, export=1
         vadd.i16        d5,  d6,  d7
         vpadd.i16       d4,  d4,  d5
         vpadd.i16       d4,  d4,  d4
-        vshl.i16        d5,  d4,  #2
-        vaddl.s16       q2,  d4,  d5
+        vshll.s16       q3,  d4,  #2
+        vaddw.s16       q2,  q3,  d4
         vrshrn.s32      d4,  q2,  #6
         mov             r3,  #0
         vtrn.16         d4,  d5
diff --git a/ffmpeg-mt/libavcodec/arm/int_neon.S b/ffmpeg-mt/libavcodec/arm/int_neon.S
index e8023e0..5a14991 100644
--- a/ffmpeg-mt/libavcodec/arm/int_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/int_neon.S
@@ -2,20 +2,20 @@
  * ARM NEON optimised integer operations
  * Copyright (c) 2009 Kostya Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mathops.h b/ffmpeg-mt/libavcodec/arm/mathops.h
index 2244fa1..1fce8e3 100644
--- a/ffmpeg-mt/libavcodec/arm/mathops.h
+++ b/ffmpeg-mt/libavcodec/arm/mathops.h
@@ -2,20 +2,20 @@
  * simple math operations
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mdct_fixed_neon.S b/ffmpeg-mt/libavcodec/arm/mdct_fixed_neon.S
new file mode 100644
index 0000000..d219216
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/mdct_fixed_neon.S
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2011 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+        preserve8
+
+.macro  prerot          dst, rt
+        lsr             r3,  r6,  #2            @ n4
+        add             \rt, r4,  r6,  lsr #1   @ revtab + n4
+        add             r9,  r3,  r3,  lsl #1   @ n3
+        add             r8,  r7,  r6            @ tcos + n4
+        add             r3,  r2,  r6,  lsr #1   @ in + n4
+        add             r9,  r2,  r9,  lsl #1   @ in + n3
+        sub             r8,  r8,  #16
+        sub             r10, r3,  #16
+        sub             r11, r9,  #16
+        mov             r12, #-16
+1:
+        vld2.16         {d0,d1},  [r9, :128]!
+        vld2.16         {d2,d3},  [r11,:128], r12
+        vld2.16         {d4,d5},  [r3, :128]!
+        vld2.16         {d6,d7},  [r10,:128], r12
+        vld2.16         {d16,d17},[r7, :128]!   @ cos, sin
+        vld2.16         {d18,d19},[r8, :128], r12
+        vrev64.16       q1,  q1
+        vrev64.16       q3,  q3
+        vrev64.16       q9,  q9
+        vneg.s16        d0,  d0
+        vneg.s16        d2,  d2
+        vneg.s16        d16, d16
+        vneg.s16        d18, d18
+        vhsub.s16       d0,  d0,  d3            @ re
+        vhsub.s16       d4,  d7,  d4            @ im
+        vhsub.s16       d6,  d6,  d5
+        vhsub.s16       d2,  d2,  d1
+        vmull.s16       q10, d0,  d16
+        vmlsl.s16       q10, d4,  d17
+        vmull.s16       q11, d0,  d17
+        vmlal.s16       q11, d4,  d16
+        vmull.s16       q12, d6,  d18
+        vmlsl.s16       q12, d2,  d19
+        vmull.s16       q13, d6,  d19
+        vmlal.s16       q13, d2,  d18
+        vshrn.s32       d0,  q10, #15
+        vshrn.s32       d1,  q11, #15
+        vshrn.s32       d2,  q12, #15
+        vshrn.s32       d3,  q13, #15
+        vzip.16         d0,  d1
+        vzip.16         d2,  d3
+        ldrh            lr,  [r4], #2
+        ldrh            r2,  [\rt, #-2]!
+        add             lr,  \dst, lr,  lsl #2
+        add             r2,  \dst, r2,  lsl #2
+        vst1.32         {d0[0]},  [lr,:32]
+        vst1.32         {d2[0]},  [r2,:32]
+        ldrh            lr,  [r4], #2
+        ldrh            r2,  [\rt, #-2]!
+        add             lr,  \dst, lr,  lsl #2
+        add             r2,  \dst, r2,  lsl #2
+        vst1.32         {d0[1]},  [lr,:32]
+        vst1.32         {d2[1]},  [r2,:32]
+        ldrh            lr,  [r4], #2
+        ldrh            r2,  [\rt, #-2]!
+        add             lr,  \dst, lr,  lsl #2
+        add             r2,  \dst, r2,  lsl #2
+        vst1.32         {d1[0]},  [lr,:32]
+        vst1.32         {d3[0]},  [r2,:32]
+        ldrh            lr,  [r4], #2
+        ldrh            r2,  [\rt, #-2]!
+        add             lr,  \dst, lr,  lsl #2
+        add             r2,  \dst, r2,  lsl #2
+        vst1.32         {d1[1]},  [lr,:32]
+        vst1.32         {d3[1]},  [r2,:32]
+        subs            r6,  r6,  #32
+        bgt             1b
+.endm
+
+function ff_mdct_fixed_calc_neon, export=1
+        push            {r1,r4-r11,lr}
+
+        ldr             r4,  [r0, #8]           @ revtab
+        ldr             r6,  [r0, #16]          @ mdct_size; n
+        ldr             r7,  [r0, #24]          @ tcos
+
+        prerot          r1,  r5
+
+        mov             r4,  r0
+        bl              X(ff_fft_fixed_calc_neon)
+
+        pop             {r5}
+        mov             r12, #-16
+        ldr             r6,  [r4, #16]          @ mdct_size; n
+        ldr             r7,  [r4, #24]          @ tcos
+        add             r5,  r5,  r6,  lsr #1
+        add             r7,  r7,  r6,  lsr #1
+        sub             r1,  r5,  #16
+        sub             r2,  r7,  #16
+1:
+        vld2.16         {d4,d5},  [r7,:128]!
+        vld2.16         {d6,d7},  [r2,:128], r12
+        vld2.16         {d0,d1},  [r5,:128]
+        vld2.16         {d2,d3},  [r1,:128]
+        vrev64.16       q3,  q3
+        vrev64.16       q1,  q1
+        vneg.s16        q3,  q3
+        vneg.s16        q2,  q2
+        vmull.s16       q11, d2,  d6
+        vmlal.s16       q11, d3,  d7
+        vmull.s16       q8,  d0,  d5
+        vmlsl.s16       q8,  d1,  d4
+        vmull.s16       q9,  d0,  d4
+        vmlal.s16       q9,  d1,  d5
+        vmull.s16       q10, d2,  d7
+        vmlsl.s16       q10, d3,  d6
+        vshrn.s32       d0,  q11, #15
+        vshrn.s32       d1,  q8,  #15
+        vshrn.s32       d2,  q9,  #15
+        vshrn.s32       d3,  q10, #15
+        vrev64.16       q0,  q0
+        vst2.16         {d2,d3},  [r5,:128]!
+        vst2.16         {d0,d1},  [r1,:128], r12
+        subs            r6,  r6,  #32
+        bgt             1b
+
+        pop             {r4-r11,pc}
+endfunc
+
+function ff_mdct_fixed_calcw_neon, export=1
+        push            {r1,r4-r11,lr}
+
+        ldrd            r4,  r5,  [r0, #8]      @ revtab, tmp_buf
+        ldr             r6,  [r0, #16]          @ mdct_size; n
+        ldr             r7,  [r0, #24]          @ tcos
+
+        prerot          r5,  r1
+
+        mov             r4,  r0
+        mov             r1,  r5
+        bl              X(ff_fft_fixed_calc_neon)
+
+        pop             {r7}
+        mov             r12, #-16
+        ldr             r6,  [r4, #16]          @ mdct_size; n
+        ldr             r9,  [r4, #24]          @ tcos
+        add             r5,  r5,  r6,  lsr #1
+        add             r7,  r7,  r6
+        add             r9,  r9,  r6,  lsr #1
+        sub             r3,  r5,  #16
+        sub             r1,  r7,  #16
+        sub             r2,  r9,  #16
+1:
+        vld2.16         {d4,d5},  [r9,:128]!
+        vld2.16         {d6,d7},  [r2,:128], r12
+        vld2.16         {d0,d1},  [r5,:128]!
+        vld2.16         {d2,d3},  [r3,:128], r12
+        vrev64.16       q3,  q3
+        vrev64.16       q1,  q1
+        vneg.s16        q3,  q3
+        vneg.s16        q2,  q2
+        vmull.s16       q8,  d2,  d6
+        vmlal.s16       q8,  d3,  d7
+        vmull.s16       q9,  d0,  d5
+        vmlsl.s16       q9,  d1,  d4
+        vmull.s16       q10, d0,  d4
+        vmlal.s16       q10, d1,  d5
+        vmull.s16       q11, d2,  d7
+        vmlsl.s16       q11, d3,  d6
+        vrev64.32       q8,  q8
+        vrev64.32       q9,  q9
+        vst2.32         {q10,q11},[r7,:128]!
+        vst2.32         {d16,d18},[r1,:128], r12
+        vst2.32         {d17,d19},[r1,:128], r12
+        subs            r6,  r6,  #32
+        bgt             1b
+
+        pop             {r4-r11,pc}
+endfunc
diff --git a/ffmpeg-mt/libavcodec/arm/mdct_neon.S b/ffmpeg-mt/libavcodec/arm/mdct_neon.S
index fcf8022..c375f4c 100644
--- a/ffmpeg-mt/libavcodec/arm/mdct_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/mdct_neon.S
@@ -2,20 +2,20 @@
  * ARM NEON optimised MDCT
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.c b/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.c
index 6cb1bc8..b1d1312 100644
--- a/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.c
+++ b/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2002 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.h b/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.h
index 4cc25fd..0812ca1 100644
--- a/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.h
+++ b/ffmpeg-mt/libavcodec/arm/mpegvideo_arm.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te.c b/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te.c
index 1d383ca..30197d8 100644
--- a/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te.c
+++ b/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te.c
@@ -2,20 +2,20 @@
  * Optimization of some functions from mpegvideo.c for armv5te
  * Copyright (c) 2007 Siarhei Siamashka <ssvb at users.sourceforge.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te_s.S b/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te_s.S
index c8cb2c6..6473926 100644
--- a/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te_s.S
+++ b/ffmpeg-mt/libavcodec/arm/mpegvideo_armv5te_s.S
@@ -2,20 +2,20 @@
  * Optimization of some functions from mpegvideo.c for armv5te
  * Copyright (c) 2007 Siarhei Siamashka <ssvb at users.sourceforge.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mpegvideo_iwmmxt.c b/ffmpeg-mt/libavcodec/arm/mpegvideo_iwmmxt.c
index 0a28863..4d5edd8 100644
--- a/ffmpeg-mt/libavcodec/arm/mpegvideo_iwmmxt.c
+++ b/ffmpeg-mt/libavcodec/arm/mpegvideo_iwmmxt.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2004 AGAWA Koji
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/mpegvideo_neon.S b/ffmpeg-mt/libavcodec/arm/mpegvideo_neon.S
index b25ead4..365dcf6 100644
--- a/ffmpeg-mt/libavcodec/arm/mpegvideo_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/mpegvideo_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -22,10 +22,9 @@
 #include "asm-offsets.h"
 
 function ff_dct_unquantize_h263_inter_neon, export=1
-        add             r0,  r0,  #0x2200
-        add             r12, r0,  #BLOCK_LAST_INDEX-0x2200
+        add             r12, r0,  #BLOCK_LAST_INDEX
         ldr             r12, [r12, r2, lsl #2]
-        add             r0,  r0,  #INTER_SCANTAB_RASTER_END-0x2200
+        add             r0,  r0,  #INTER_SCANTAB_RASTER_END
         ldrb            r12, [r0, r12]
         sub             r2,  r3,  #1
         lsl             r0,  r3,  #1
@@ -75,17 +74,15 @@ endfunc
 
 function ff_dct_unquantize_h263_intra_neon, export=1
         push            {r4-r6,lr}
+        add             r12, r0,  #BLOCK_LAST_INDEX
         ldr             r6,  [r0, #AC_PRED]
-        add             r5,  r0,  #0x2700
+        add             lr,  r0,  #INTER_SCANTAB_RASTER_END
         cmp             r6,  #0
         movne           r12, #63
         bne             1f
-        add             lr,  r0,  #0x2200
-        add             r12, lr,  #BLOCK_LAST_INDEX-0x2200
-        add             lr,  lr,  #INTER_SCANTAB_RASTER_END-0x2200
         ldr             r12, [r12, r2, lsl #2]
         ldrb            r12, [lr, r12]
-1:      ldr             r5,  [r5, #H263_AIC-0x2700]
+1:      ldr             r5,  [r0, #H263_AIC]
         ldrsh           r4,  [r1]
         cmp             r5,  #0
         mov             r5,  r1
diff --git a/ffmpeg-mt/libavcodec/arm/rdft_neon.S b/ffmpeg-mt/libavcodec/arm/rdft_neon.S
index 4f8a103..8aafdc9 100644
--- a/ffmpeg-mt/libavcodec/arm/rdft_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/rdft_neon.S
@@ -2,20 +2,20 @@
  * ARM NEON optimised RDFT
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/simple_idct_arm.S b/ffmpeg-mt/libavcodec/arm/simple_idct_arm.S
index ecb83d2..4e6dfa4 100644
--- a/ffmpeg-mt/libavcodec/arm/simple_idct_arm.S
+++ b/ffmpeg-mt/libavcodec/arm/simple_idct_arm.S
@@ -5,22 +5,22 @@
  * Author: Frederic Boulay <dilb at handhelds.org>
  *
  * The function defined in this file is derived from the simple_idct function
- * from the libavcodec library part of the FFmpeg project.
+ * from the libavcodec library part of the Libav project.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/simple_idct_armv5te.S b/ffmpeg-mt/libavcodec/arm/simple_idct_armv5te.S
index 27aeca4..5d03c0c 100644
--- a/ffmpeg-mt/libavcodec/arm/simple_idct_armv5te.S
+++ b/ffmpeg-mt/libavcodec/arm/simple_idct_armv5te.S
@@ -4,20 +4,20 @@
  * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2006 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/simple_idct_armv6.S b/ffmpeg-mt/libavcodec/arm/simple_idct_armv6.S
index d61c1fd..b2eb525 100644
--- a/ffmpeg-mt/libavcodec/arm/simple_idct_armv6.S
+++ b/ffmpeg-mt/libavcodec/arm/simple_idct_armv6.S
@@ -4,20 +4,20 @@
  * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2007 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/simple_idct_neon.S b/ffmpeg-mt/libavcodec/arm/simple_idct_neon.S
index 17cde58..0628b96 100644
--- a/ffmpeg-mt/libavcodec/arm/simple_idct_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/simple_idct_neon.S
@@ -6,20 +6,20 @@
  * Based on Simple IDCT
  * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/synth_filter_neon.S b/ffmpeg-mt/libavcodec/arm/synth_filter_neon.S
index a7c23df..d4f67b7 100644
--- a/ffmpeg-mt/libavcodec/arm/synth_filter_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/synth_filter_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -42,7 +42,7 @@ VFP     vpop            {d0}
 
         ldr             r5,  [sp, #9*4]         @ window
         ldr             r2,  [sp, #10*4]        @ out
-NOVFP   vldr            d0,  [sp, #12*4]        @ scale, bias
+NOVFP   vldr            s0,  [sp, #12*4]        @ scale
         add             r8,  r9,  #12*4
 
         mov             lr,  #64*4
@@ -90,10 +90,8 @@ NOVFP   vldr            d0,  [sp, #12*4]        @ scale, bias
         sub             r11, r11, #512*4
         b               2b
 3:
-        vdup.32         q8,  d0[1]
-        vdup.32         q9,  d0[1]
-        vmla.f32        q8,  q10, d0[0]
-        vmla.f32        q9,  q1,  d0[0]
+        vmul.f32        q8,  q10, d0[0]
+        vmul.f32        q9,  q1,  d0[0]
         vst1.32         {q3},     [r3,:128]
         sub             r3,  r3,  #16*4
         vst1.32         {q2},     [r3,:128]
diff --git a/ffmpeg-mt/libavcodec/arm/vp3dsp_neon.S b/ffmpeg-mt/libavcodec/arm/vp3dsp_neon.S
index d97ed3d..c1a55ca 100644
--- a/ffmpeg-mt/libavcodec/arm/vp3dsp_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/vp3dsp_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/vp56_arith.h b/ffmpeg-mt/libavcodec/arm/vp56_arith.h
new file mode 100644
index 0000000..f5dbd1d
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/vp56_arith.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2010 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_ARM_VP56_ARITH_H
+#define AVCODEC_ARM_VP56_ARITH_H
+
+#if HAVE_ARMV6 && HAVE_INLINE_ASM
+
+#define vp56_rac_get_prob vp56_rac_get_prob_armv6
+static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr)
+{
+    unsigned shift     = ff_vp56_norm_shift[c->high];
+    unsigned code_word = c->code_word << shift;
+    unsigned high      = c->high << shift;
+    unsigned bit;
+
+    __asm__ volatile ("adds    %3,  %3,  %0           \n"
+                      "cmpcs   %7,  %4                \n"
+                      "ldrcsh  %2,  [%4], #2          \n"
+                      "rsb     %0,  %6,  #256         \n"
+                      "smlabb  %0,  %5,  %6,  %0      \n"
+                      "rev16cs %2,  %2                \n"
+                      "orrcs   %1,  %1,  %2,  lsl %3  \n"
+                      "subcs   %3,  %3,  #16          \n"
+                      "lsr     %0,  %0,  #8           \n"
+                      "cmp     %1,  %0,  lsl #16      \n"
+                      "subge   %1,  %1,  %0,  lsl #16 \n"
+                      "subge   %0,  %5,  %0           \n"
+                      "movge   %2,  #1                \n"
+                      "movlt   %2,  #0                \n"
+                      : "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit),
+                        "+&r"(c->bits), "+&r"(c->buffer)
+                      : "r"(high), "r"(pr), "r"(c->end - 1),
+                        "0"(shift), "1"(code_word));
+
+    return bit;
+}
+
+#define vp56_rac_get_prob_branchy vp56_rac_get_prob_branchy_armv6
+static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr)
+{
+    unsigned shift     = ff_vp56_norm_shift[c->high];
+    unsigned code_word = c->code_word << shift;
+    unsigned high      = c->high << shift;
+    unsigned low;
+    unsigned tmp;
+
+    __asm__ volatile ("adds    %3,  %3,  %0           \n"
+                      "cmpcs   %7,  %4                \n"
+                      "ldrcsh  %2,  [%4], #2          \n"
+                      "rsb     %0,  %6,  #256         \n"
+                      "smlabb  %0,  %5,  %6,  %0      \n"
+                      "rev16cs %2,  %2                \n"
+                      "orrcs   %1,  %1,  %2,  lsl %3  \n"
+                      "subcs   %3,  %3,  #16          \n"
+                      "lsr     %0,  %0,  #8           \n"
+                      "lsl     %2,  %0,  #16          \n"
+                      : "=&r"(low), "+&r"(code_word), "=&r"(tmp),
+                        "+&r"(c->bits), "+&r"(c->buffer)
+                      : "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift));
+
+    if (code_word >= tmp) {
+        c->high      = high - low;
+        c->code_word = code_word - tmp;
+        return 1;
+    }
+
+    c->high      = low;
+    c->code_word = code_word;
+    return 0;
+}
+
+#endif
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/arm/vp56dsp_init_arm.c b/ffmpeg-mt/libavcodec/arm/vp56dsp_init_arm.c
index ceab9a8..5989602 100644
--- a/ffmpeg-mt/libavcodec/arm/vp56dsp_init_arm.c
+++ b/ffmpeg-mt/libavcodec/arm/vp56dsp_init_arm.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/vp56dsp_neon.S b/ffmpeg-mt/libavcodec/arm/vp56dsp_neon.S
index 0353661..b95d8ab 100644
--- a/ffmpeg-mt/libavcodec/arm/vp56dsp_neon.S
+++ b/ffmpeg-mt/libavcodec/arm/vp56dsp_neon.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/arm/vp8.h b/ffmpeg-mt/libavcodec/arm/vp8.h
new file mode 100644
index 0000000..35cdd8b
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/vp8.h
@@ -0,0 +1,29 @@
+/**
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_ARM_VP8_H
+#define AVCODEC_ARM_VP8_H
+
+#if HAVE_ARMV6
+#define decode_block_coeffs_internal ff_decode_block_coeffs_armv6
+int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16],
+                                 uint8_t probs[8][3][NUM_DCT_TOKENS-1],
+                                 int i, uint8_t *token_prob, int16_t qmul[2]);
+#endif
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/arm/vp8_armv6.S b/ffmpeg-mt/libavcodec/arm/vp8_armv6.S
new file mode 100644
index 0000000..88fa398
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/vp8_armv6.S
@@ -0,0 +1,220 @@
+/**
+ * Copyright (C) 2010 Mans Rullgard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+        .syntax         unified
+
+.macro rac_get_prob     h, bs, buf, cw, pr, t0, t1
+        adds            \bs, \bs, \t0
+        lsl             \cw, \cw, \t0
+        lsl             \t0, \h,  \t0
+        rsb             \h,  \pr, #256
+        ldrhcs          \t1, [\buf], #2
+        smlabb          \h,  \t0, \pr, \h
+        rev16cs         \t1, \t1
+        orrcs           \cw, \cw, \t1, lsl \bs
+        subcs           \bs, \bs, #16
+        lsr             \h,  \h,  #8
+        cmp             \cw, \h,  lsl #16
+        subge           \cw, \cw, \h,  lsl #16
+        subge           \h,  \t0, \h
+.endm
+
+.macro rac_get_128      h, bs, buf, cw, t0, t1
+        adds            \bs, \bs, \t0
+        lsl             \cw, \cw, \t0
+        lsl             \t0, \h,  \t0
+        ldrhcs          \t1, [\buf], #2
+        mov             \h,  #128
+        rev16cs         \t1, \t1
+        add             \h,  \h,  \t0, lsl #7
+        orrcs           \cw, \cw, \t1, lsl \bs
+        subcs           \bs, \bs, #16
+        lsr             \h,  \h,  #8
+        cmp             \cw, \h,  lsl #16
+        subge           \cw, \cw, \h,  lsl #16
+        subge           \h,  \t0, \h
+.endm
+
+function ff_decode_block_coeffs_armv6, export=1
+        push            {r0,r1,r4-r11,lr}
+        movrel          lr,  X(ff_vp56_norm_shift)
+        ldrd            r4,  r5,  [sp, #44]             @ token_prob, qmul
+        cmp             r3,  #0
+        ldr             r11, [r5]
+        ldm             r0,  {r5-r7}                    @ high, bits, buf
+        pkhtbne         r11, r11, r11, asr #16
+        ldr             r8,  [r0, #16]                  @ code_word
+0:
+        ldrb            r9,  [lr, r5]
+        add             r3,  r3,  #1
+        ldrb            r0,  [r4, #1]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        blt             2f
+
+        ldrb            r9,  [lr, r5]
+        ldrb            r0,  [r4, #2]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        ldrb            r9,  [lr, r5]
+        bge             3f
+
+        add             r4,  r3,  r3,  lsl #5
+        sxth            r12, r11
+        add             r4,  r2,  r4
+        adds            r6,  r6,  r9
+        add             r4,  r4,  #11
+        lsl             r8,  r8,  r9
+        ldrhcs          r10, [r7], #2
+        lsl             r9,  r5,  r9
+        mov             r5,  #128
+        rev16cs         r10, r10
+        add             r5,  r5,  r9,  lsl #7
+        orrcs           r8,  r8,  r10, lsl r6
+        subcs           r6,  r6,  #16
+        lsr             r5,  r5,  #8
+        cmp             r8,  r5,  lsl #16
+        movrel          r10, zigzag_scan-1
+        subge           r8,  r8,  r5,  lsl #16
+        subge           r5,  r9,  r5
+        ldrb            r10, [r10, r3]
+        rsbge           r12, r12, #0
+        cmp             r3,  #16
+        strh            r12, [r1, r10]
+        bge             6f
+5:
+        ldrb            r9,  [lr, r5]
+        ldrb            r0,  [r4]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        pkhtb           r11, r11, r11, asr #16
+        bge             0b
+
+6:
+        ldr             r0,  [sp]
+        ldr             r9,  [r0, #12]
+        cmp             r7,  r9
+        movhi           r7,  r9
+        stm             r0,  {r5-r7}                    @ high, bits, buf
+        str             r8,  [r0, #16]                  @ code_word
+
+        add             sp,  sp,  #8
+        mov             r0,  r3
+        pop             {r4-r11,pc}
+2:
+        add             r4,  r3,  r3,  lsl #5
+        cmp             r3,  #16
+        add             r4,  r2,  r4
+        pkhtb           r11, r11, r11, asr #16
+        bne             0b
+        b               6b
+3:
+        ldrb            r0,  [r4, #3]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        ldrb            r9,  [lr, r5]
+        bge             1f
+
+        mov             r12, #2
+        ldrb            r0,  [r4, #4]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        addge           r12, #1
+        ldrb            r9,  [lr, r5]
+        blt             4f
+        ldrb            r0,  [r4, #5]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        addge           r12, #1
+        ldrb            r9,  [lr, r5]
+        b               4f
+1:
+        ldrb            r0,  [r4, #6]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        ldrb            r9,  [lr, r5]
+        bge             3f
+
+        ldrb            r0,  [r4, #7]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        ldrb            r9,  [lr, r5]
+        bge             2f
+
+        mov             r12, #5
+        mov             r0,  #159
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        addge           r12, r12, #1
+        ldrb            r9,  [lr, r5]
+        b               4f
+2:
+        mov             r12, #7
+        mov             r0,  #165
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        addge           r12, r12, #2
+        ldrb            r9,  [lr, r5]
+        mov             r0,  #145
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        addge           r12, r12, #1
+        ldrb            r9,  [lr, r5]
+        b               4f
+3:
+        ldrb            r0,  [r4, #8]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        addge           r4,  r4,  #1
+        ldrb            r9,  [lr, r5]
+        movge           r12, #2
+        movlt           r12, #0
+        ldrb            r0,  [r4, #9]
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        mov             r9,  #8
+        addge           r12, r12, #1
+        movrel          r4,  ff_vp8_dct_cat_prob
+        lsl             r9,  r9,  r12
+        ldr             r4,  [r4, r12, lsl #2]
+        add             r12, r9,  #3
+        mov             r1,  #0
+        ldrb            r0,  [r4], #1
+1:
+        ldrb            r9,  [lr, r5]
+        lsl             r1,  r1,  #1
+        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
+        ldrb            r0,  [r4], #1
+        addge           r1,  r1,  #1
+        cmp             r0,  #0
+        bne             1b
+        ldrb            r9,  [lr, r5]
+        add             r12, r12, r1
+        ldr             r1,  [sp, #4]
+4:
+        add             r4,  r3,  r3,  lsl #5
+        add             r4,  r2,  r4
+        add             r4,  r4,  #22
+        rac_get_128     r5,  r6,  r7,  r8,  r9,  r10
+        rsbge           r12, r12, #0
+        smulbb          r12, r12, r11
+        movrel          r9,  zigzag_scan-1
+        ldrb            r9,  [r9, r3]
+        cmp             r3,  #16
+        strh            r12, [r1, r9]
+        bge             6b
+        b               5b
+endfunc
+
+        .section        .rodata
+zigzag_scan:
+        .byte            0,  2,  8, 16
+        .byte           10,  4,  6, 12
+        .byte           18, 24, 26, 20
+        .byte           14, 22, 28, 30
diff --git a/ffmpeg-mt/libavcodec/arm/vp8dsp_init_arm.c b/ffmpeg-mt/libavcodec/arm/vp8dsp_init_arm.c
new file mode 100644
index 0000000..269c6e3
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/vp8dsp_init_arm.c
@@ -0,0 +1,163 @@
+/**
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include "libavcodec/vp8dsp.h"
+
+void ff_vp8_luma_dc_wht_neon(DCTELEM block[4][4][16], DCTELEM dc[16]);
+void ff_vp8_luma_dc_wht_dc_neon(DCTELEM block[4][4][16], DCTELEM dc[16]);
+
+void ff_vp8_idct_add_neon(uint8_t *dst, DCTELEM block[16], int stride);
+void ff_vp8_idct_dc_add_neon(uint8_t *dst, DCTELEM block[16], int stride);
+void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, DCTELEM block[4][16], int stride);
+void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, DCTELEM block[4][16], int stride);
+
+void ff_vp8_v_loop_filter16_neon(uint8_t *dst, int stride,
+                                 int flim_E, int flim_I, int hev_thresh);
+void ff_vp8_h_loop_filter16_neon(uint8_t *dst, int stride,
+                                 int flim_E, int flim_I, int hev_thresh);
+void ff_vp8_v_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
+                                  int flim_E, int flim_I, int hev_thresh);
+void ff_vp8_h_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
+                                  int flim_E, int flim_I, int hev_thresh);
+
+void ff_vp8_v_loop_filter16_inner_neon(uint8_t *dst, int stride,
+                                       int flim_E, int flim_I, int hev_thresh);
+void ff_vp8_h_loop_filter16_inner_neon(uint8_t *dst, int stride,
+                                       int flim_E, int flim_I, int hev_thresh);
+void ff_vp8_v_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
+                                        int stride, int flim_E, int flim_I,
+                                        int hev_thresh);
+void ff_vp8_h_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
+                                        int stride, int flim_E, int flim_I,
+                                        int hev_thresh);
+
+void ff_vp8_v_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim);
+void ff_vp8_h_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim);
+
+
+#define VP8_MC(n)                                                       \
+    void ff_put_vp8_##n##_neon(uint8_t *dst, int dststride,             \
+                               uint8_t *src, int srcstride,             \
+                               int h, int x, int y)
+
+#define VP8_EPEL(w)                             \
+    VP8_MC(pixels ## w);                        \
+    VP8_MC(epel ## w ## _h4);                   \
+    VP8_MC(epel ## w ## _h6);                   \
+    VP8_MC(epel ## w ## _v4);                   \
+    VP8_MC(epel ## w ## _h4v4);                 \
+    VP8_MC(epel ## w ## _h6v4);                 \
+    VP8_MC(epel ## w ## _v6);                   \
+    VP8_MC(epel ## w ## _h4v6);                 \
+    VP8_MC(epel ## w ## _h6v6)
+
+VP8_EPEL(16);
+VP8_EPEL(8);
+VP8_EPEL(4);
+
+VP8_MC(bilin16_h);
+VP8_MC(bilin16_v);
+VP8_MC(bilin16_hv);
+VP8_MC(bilin8_h);
+VP8_MC(bilin8_v);
+VP8_MC(bilin8_hv);
+VP8_MC(bilin4_h);
+VP8_MC(bilin4_v);
+VP8_MC(bilin4_hv);
+
+av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp)
+{
+    if (HAVE_NEON) {
+        dsp->vp8_luma_dc_wht    = ff_vp8_luma_dc_wht_neon;
+        dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_neon;
+
+        dsp->vp8_idct_add       = ff_vp8_idct_add_neon;
+        dsp->vp8_idct_dc_add    = ff_vp8_idct_dc_add_neon;
+        dsp->vp8_idct_dc_add4y  = ff_vp8_idct_dc_add4y_neon;
+        dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon;
+
+        dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon;
+        dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon;
+        dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon;
+        dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon;
+
+        dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon;
+        dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon;
+        dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon;
+        dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon;
+
+        dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon;
+        dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon;
+
+        dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
+        dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon;
+        dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon;
+        dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon;
+
+        dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
+        dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon;
+        dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon;
+        dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon;
+        dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon;
+        dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon;
+        dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon;
+        dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon;
+        dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon;
+
+        dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon;
+        dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon;
+        dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon;
+        dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon;
+        dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon;
+        dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon;
+        dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon;
+        dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon;
+        dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon;
+
+        dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon;
+
+        dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon;
+
+        dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon;
+        dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon;
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/arm/vp8dsp_neon.S b/ffmpeg-mt/libavcodec/arm/vp8dsp_neon.S
new file mode 100644
index 0000000..92b1ef4
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/arm/vp8dsp_neon.S
@@ -0,0 +1,1912 @@
+/**
+ * VP8 NEON optimisations
+ *
+ * Copyright (c) 2010 Rob Clark <rob at ti.com>
+ * Copyright (c) 2011 Mans Rullgard <mans at mansr.com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "asm.S"
+
+function ff_vp8_luma_dc_wht_neon, export=1
+        vld1.16         {q0-q1},  [r1,:128]
+        vmov.i16        q15, #0
+
+        vadd.i16        d4,  d0,  d3
+        vadd.i16        d6,  d1,  d2
+        vst1.16         {q15},    [r1,:128]!
+        vsub.i16        d7,  d1,  d2
+        vsub.i16        d5,  d0,  d3
+        vst1.16         {q15},    [r1,:128]
+        vadd.i16        q0,  q2,  q3
+        vsub.i16        q1,  q2,  q3
+
+        vmov.i16        q8, #3
+
+        vtrn.32         d0,  d2
+        vtrn.32         d1,  d3
+        vtrn.16         d0,  d1
+        vtrn.16         d2,  d3
+
+        vadd.i16        d0,  d0,  d16
+
+        vadd.i16        d4,  d0,  d3
+        vadd.i16        d6,  d1,  d2
+        vsub.i16        d7,  d1,  d2
+        vsub.i16        d5,  d0,  d3
+        vadd.i16        q0,  q2,  q3
+        vsub.i16        q1,  q2,  q3
+
+        vshr.s16        q0,  q0,  #3
+        vshr.s16        q1,  q1,  #3
+
+        mov             r3,  #32
+        vst1.16         {d0[0]},  [r0,:16], r3
+        vst1.16         {d1[0]},  [r0,:16], r3
+        vst1.16         {d2[0]},  [r0,:16], r3
+        vst1.16         {d3[0]},  [r0,:16], r3
+        vst1.16         {d0[1]},  [r0,:16], r3
+        vst1.16         {d1[1]},  [r0,:16], r3
+        vst1.16         {d2[1]},  [r0,:16], r3
+        vst1.16         {d3[1]},  [r0,:16], r3
+        vst1.16         {d0[2]},  [r0,:16], r3
+        vst1.16         {d1[2]},  [r0,:16], r3
+        vst1.16         {d2[2]},  [r0,:16], r3
+        vst1.16         {d3[2]},  [r0,:16], r3
+        vst1.16         {d0[3]},  [r0,:16], r3
+        vst1.16         {d1[3]},  [r0,:16], r3
+        vst1.16         {d2[3]},  [r0,:16], r3
+        vst1.16         {d3[3]},  [r0,:16], r3
+
+        bx              lr
+endfunc
+
+function ff_vp8_luma_dc_wht_dc_neon, export=1
+        ldrsh           r2,  [r1]
+        mov             r3,  #0
+        add             r2,  r2,  #3
+        strh            r3,  [r1]
+        asr             r2,  r2,  #3
+    .rept 16
+        strh            r2,  [r0], #32
+    .endr
+        bx              lr
+endfunc
+
+function ff_vp8_idct_add_neon, export=1
+        vld1.16         {q0-q1},  [r1,:128]
+        movw            r3,  #20091
+        movt            r3,  #35468/2
+        vdup.32         d4,  r3
+
+        vmull.s16       q12, d1,  d4[0]
+        vmull.s16       q13, d3,  d4[0]
+        vqdmulh.s16     d20, d1,  d4[1]
+        vqdmulh.s16     d23, d3,  d4[1]
+        vshrn.s32       d21, q12, #16
+        vshrn.s32       d22, q13, #16
+        vadd.s16        d21, d21, d1
+        vadd.s16        d22, d22, d3
+
+        vadd.s16        d16, d0,  d2
+        vsub.s16        d17, d0,  d2
+        vadd.s16        d18, d21, d23
+        vsub.s16        d19, d20, d22
+        vadd.s16        q0,  q8,  q9
+        vsub.s16        q1,  q8,  q9
+
+        vtrn.32         d0,  d3
+        vtrn.32         d1,  d2
+        vtrn.16         d0,  d1
+        vtrn.16         d3,  d2
+
+        vmov.i16        q15, #0
+        vmull.s16       q12, d1,  d4[0]
+        vst1.16         {q15},    [r1,:128]!
+        vmull.s16       q13, d2,  d4[0]
+        vst1.16         {q15},    [r1,:128]
+        vqdmulh.s16     d21, d1,  d4[1]
+        vqdmulh.s16     d23, d2,  d4[1]
+        vshrn.s32       d20, q12, #16
+        vshrn.s32       d22, q13, #16
+        vadd.i16        d20, d20, d1
+        vadd.i16        d22, d22, d2
+
+        vadd.i16        d16, d0,  d3
+        vsub.i16        d17, d0,  d3
+        vadd.i16        d18, d20, d23
+        vld1.32         {d20[]},  [r0,:32], r2
+        vsub.i16        d19, d21, d22
+        vld1.32         {d22[]},  [r0,:32], r2
+        vadd.s16        q0,  q8,  q9
+        vld1.32         {d23[]},  [r0,:32], r2
+        vsub.s16        q1,  q8,  q9
+        vld1.32         {d21[]},  [r0,:32], r2
+        vrshr.s16       q0,  q0,  #3
+        vtrn.32         q10, q11
+        vrshr.s16       q1,  q1,  #3
+
+        sub             r0,  r0,  r2,  lsl #2
+
+        vtrn.32         d0,  d3
+        vtrn.32         d1,  d2
+        vtrn.16         d0,  d1
+        vtrn.16         d3,  d2
+
+        vaddw.u8        q0,  q0,  d20
+        vaddw.u8        q1,  q1,  d21
+        vqmovun.s16     d0,  q0
+        vqmovun.s16     d1,  q1
+
+        vst1.32         {d0[0]},  [r0,:32], r2
+        vst1.32         {d0[1]},  [r0,:32], r2
+        vst1.32         {d1[1]},  [r0,:32], r2
+        vst1.32         {d1[0]},  [r0,:32], r2
+
+        bx              lr
+endfunc
+
+function ff_vp8_idct_dc_add_neon, export=1
+        mov             r3,  #0
+        ldrsh           r12, [r1]
+        strh            r3,  [r1]
+        vdup.16         q1,  r12
+        vrshr.s16       q1,  q1,  #3
+        vld1.32         {d0[]},   [r0,:32], r2
+        vld1.32         {d1[]},   [r0,:32], r2
+        vld1.32         {d0[1]},  [r0,:32], r2
+        vld1.32         {d1[1]},  [r0,:32], r2
+        vaddw.u8        q2,  q1,  d0
+        vaddw.u8        q3,  q1,  d1
+        sub             r0,  r0,  r2, lsl #2
+        vqmovun.s16     d0,  q2
+        vqmovun.s16     d1,  q3
+        vst1.32         {d0[0]},  [r0,:32], r2
+        vst1.32         {d1[0]},  [r0,:32], r2
+        vst1.32         {d0[1]},  [r0,:32], r2
+        vst1.32         {d1[1]},  [r0,:32], r2
+        bx              lr
+endfunc
+
+function ff_vp8_idct_dc_add4uv_neon, export=1
+        vmov.i16        d0,  #0
+        mov             r3,  #32
+        vld1.16         {d16[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        vld1.16         {d17[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        vld1.16         {d18[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        vld1.16         {d19[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        mov             r3,  r0
+        vrshr.s16       q8,  q8,  #3            @ dc >>= 3
+        vld1.8          {d0},     [r0,:64], r2
+        vrshr.s16       q9,  q9,  #3
+        vld1.8          {d1},     [r0,:64], r2
+        vaddw.u8        q10, q8,  d0
+        vld1.8          {d2},     [r0,:64], r2
+        vaddw.u8        q0,  q8,  d1
+        vld1.8          {d3},     [r0,:64], r2
+        vaddw.u8        q11, q8,  d2
+        vld1.8          {d4},     [r0,:64], r2
+        vaddw.u8        q1,  q8,  d3
+        vld1.8          {d5},     [r0,:64], r2
+        vaddw.u8        q12, q9,  d4
+        vld1.8          {d6},     [r0,:64], r2
+        vaddw.u8        q2,  q9,  d5
+        vld1.8          {d7},     [r0,:64], r2
+        vaddw.u8        q13, q9,  d6
+        vqmovun.s16     d20, q10
+        vaddw.u8        q3,  q9,  d7
+        vqmovun.s16     d21, q0
+        vqmovun.s16     d22, q11
+        vst1.8          {d20},    [r3,:64], r2
+        vqmovun.s16     d23, q1
+        vst1.8          {d21},    [r3,:64], r2
+        vqmovun.s16     d24, q12
+        vst1.8          {d22},    [r3,:64], r2
+        vqmovun.s16     d25, q2
+        vst1.8          {d23},    [r3,:64], r2
+        vqmovun.s16     d26, q13
+        vst1.8          {d24},    [r3,:64], r2
+        vqmovun.s16     d27, q3
+        vst1.8          {d25},    [r3,:64], r2
+        vst1.8          {d26},    [r3,:64], r2
+        vst1.8          {d27},    [r3,:64], r2
+
+        bx              lr
+endfunc
+
+function ff_vp8_idct_dc_add4y_neon, export=1
+        vmov.i16        d0,  #0
+        mov             r3,  #32
+        vld1.16         {d16[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        vld1.16         {d17[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        vld1.16         {d18[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        vld1.16         {d19[]},  [r1,:16]
+        vst1.16         {d0[0]},  [r1,:16], r3
+        vrshr.s16       q8,  q8,  #3            @ dc >>= 3
+        vld1.8          {q0},     [r0,:128], r2
+        vrshr.s16       q9,  q9,  #3
+        vld1.8          {q1},     [r0,:128], r2
+        vaddw.u8        q10, q8,  d0
+        vld1.8          {q2},     [r0,:128], r2
+        vaddw.u8        q0,  q9,  d1
+        vld1.8          {q3},     [r0,:128], r2
+        vaddw.u8        q11, q8,  d2
+        vaddw.u8        q1,  q9,  d3
+        vaddw.u8        q12, q8,  d4
+        vaddw.u8        q2,  q9,  d5
+        vaddw.u8        q13, q8,  d6
+        vaddw.u8        q3,  q9,  d7
+        sub             r0,  r0,  r2,  lsl #2
+        vqmovun.s16     d20, q10
+        vqmovun.s16     d21, q0
+        vqmovun.s16     d22, q11
+        vqmovun.s16     d23, q1
+        vqmovun.s16     d24, q12
+        vst1.8          {q10},    [r0,:128], r2
+        vqmovun.s16     d25, q2
+        vst1.8          {q11},    [r0,:128], r2
+        vqmovun.s16     d26, q13
+        vst1.8          {q12},    [r0,:128], r2
+        vqmovun.s16     d27, q3
+        vst1.8          {q13},    [r0,:128], r2
+
+        bx              lr
+endfunc
+
+@ Register layout:
+@   P3..Q3 -> q0..q7
+@   flim_E -> q14
+@   flim_I -> q15
+@   hev_thresh -> r12
+@
+.macro  vp8_loop_filter, inner=0, simple=0
+    .if \simple
+        vabd.u8         q9,  q3,  q4            @ abs(P0-Q0)
+        vabd.u8         q15, q2,  q5            @ abs(P1-Q1)
+        vqadd.u8        q9,  q9,  q9            @ abs(P0-Q0) * 2
+        vshr.u8         q10, q15, #1            @ abs(P1-Q1) / 2
+        vqadd.u8        q11, q9,  q10           @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2)
+        vmov.i8         q13, #0x80
+        vcle.u8         q8,  q11, q14           @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) <= flim
+    .else
+        @ calculate hev and normal_limit:
+        vabd.u8         q12, q2,  q3            @ abs(P1-P0)
+        vabd.u8         q13, q5,  q4            @ abs(Q1-Q0)
+        vabd.u8         q10, q0,  q1            @ abs(P3-P2)
+        vabd.u8         q11, q1,  q2            @ abs(P2-P1)
+        vcle.u8         q8,  q12, q15           @ abs(P1-P0) <= flim_I
+        vcle.u8         q9,  q13, q15           @ abs(Q1-Q0) <= flim_I
+        vcle.u8         q10, q10, q15           @ abs(P3-P2) <= flim_I
+        vcle.u8         q11, q11, q15           @ abs(P2-P1) <= flim_I
+        vand            q8,  q8,  q9
+        vabd.u8         q9,  q7,  q6            @ abs(Q3-Q2)
+        vand            q8,  q8,  q11
+        vabd.u8         q11, q6,  q5            @ abs(Q2-Q1)
+        vand            q8,  q8,  q10
+        vcle.u8         q10, q9,  q15           @ abs(Q3-Q2) <= flim_I
+        vcle.u8         q11, q11, q15           @ abs(Q2-Q1) <= flim_I
+        vabd.u8         q9,  q3,  q4            @ abs(P0-Q0)
+        vabd.u8         q15, q2,  q5            @ abs(P1-Q1)
+        vand            q8,  q8,  q10
+        vqadd.u8        q9,  q9,  q9            @ abs(P0-Q0) * 2
+        vand            q8,  q8,  q11
+        vshr.u8         q10, q15, #1            @ abs(P1-Q1) / 2
+        vdup.8          q15, r12                @ hev_thresh
+        vqadd.u8        q11, q9,  q10           @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2)
+        vcgt.u8         q12, q12, q15           @ abs(P1-P0) > hev_thresh
+        vcle.u8         q11, q11, q14           @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) <= flim_E
+        vcgt.u8         q14, q13, q15           @ abs(Q1-Q0) > hev_thresh
+        vand            q8,  q8,  q11
+        vmov.i8         q13, #0x80
+        vorr            q9,  q12, q14
+    .endif
+
+        @ at this point:
+        @   q8: normal_limit
+        @   q9: hev
+
+        @ convert to signed value:
+        veor            q3,  q3,  q13           @ PS0 = P0 ^ 0x80
+        veor            q4,  q4,  q13           @ QS0 = Q0 ^ 0x80
+
+        vmov.i16        q12, #3
+        vsubl.s8        q10, d8,  d6            @ QS0 - PS0
+        vsubl.s8        q11, d9,  d7            @   (widened to 16bit)
+        veor            q2,  q2,  q13           @ PS1 = P1 ^ 0x80
+        veor            q5,  q5,  q13           @ QS1 = Q1 ^ 0x80
+        vmul.i16        q10, q10, q12           @ w = 3 * (QS0 - PS0)
+        vmul.i16        q11, q11, q12
+
+        vqsub.s8        q12, q2,  q5            @ clamp(PS1-QS1)
+        vmov.i8         q14, #4
+        vmov.i8         q15, #3
+    .if \inner
+        vand            q12, q12, q9            @ if(hev) w += clamp(PS1-QS1)
+    .endif
+        vaddw.s8        q10, q10, d24           @ w += clamp(PS1-QS1)
+        vaddw.s8        q11, q11, d25
+        vqmovn.s16      d20, q10                @ narrow result back into q10
+        vqmovn.s16      d21, q11
+    .if !\inner && !\simple
+        veor            q1,  q1,  q13           @ PS2 = P2 ^ 0x80
+        veor            q6,  q6,  q13           @ QS2 = Q2 ^ 0x80
+    .endif
+        vand            q10, q10, q8            @ w &= normal_limit
+
+        @ registers used at this point..
+        @   q0 -> P3  (don't corrupt)
+        @   q1-q6 -> PS2-QS2
+        @   q7 -> Q3  (don't corrupt)
+        @   q9 -> hev
+        @   q10 -> w
+        @   q13 -> #0x80
+        @   q14 -> #4
+        @   q15 -> #3
+        @   q8, q11, q12 -> unused
+
+        @ filter_common:   is4tap==1
+        @   c1 = clamp(w + 4) >> 3;
+        @   c2 = clamp(w + 3) >> 3;
+        @   Q0 = s2u(QS0 - c1);
+        @   P0 = s2u(PS0 + c2);
+
+    .if \simple
+        vqadd.s8        q11, q10, q14           @ c1 = clamp((w&hev)+4)
+        vqadd.s8        q12, q10, q15           @ c2 = clamp((w&hev)+3)
+        vshr.s8         q11, q11, #3            @ c1 >>= 3
+        vshr.s8         q12, q12, #3            @ c2 >>= 3
+        vqsub.s8        q4,  q4,  q11           @ QS0 = clamp(QS0-c1)
+        vqadd.s8        q3,  q3,  q12           @ PS0 = clamp(PS0+c2)
+        veor            q4,  q4,  q13           @ Q0 = QS0 ^ 0x80
+        veor            q3,  q3,  q13           @ P0 = PS0 ^ 0x80
+        veor            q5,  q5,  q13           @ Q1 = QS1 ^ 0x80
+        veor            q2,  q2,  q13           @ P1 = PS1 ^ 0x80
+    .elseif \inner
+        @ the !is4tap case of filter_common, only used for inner blocks
+        @   c3 = ((c1&~hev) + 1) >> 1;
+        @   Q1 = s2u(QS1 - c3);
+        @   P1 = s2u(PS1 + c3);
+        vqadd.s8        q11, q10, q14           @ c1 = clamp((w&hev)+4)
+        vqadd.s8        q12, q10, q15           @ c2 = clamp((w&hev)+3)
+        vshr.s8         q11, q11, #3            @ c1 >>= 3
+        vshr.s8         q12, q12, #3            @ c2 >>= 3
+        vqsub.s8        q4,  q4,  q11           @ QS0 = clamp(QS0-c1)
+        vqadd.s8        q3,  q3,  q12           @ PS0 = clamp(PS0+c2)
+        vbic            q11, q11, q9            @ c1 & ~hev
+        veor            q4,  q4,  q13           @ Q0 = QS0 ^ 0x80
+        vrshr.s8        q11, q11, #1            @ c3 >>= 1
+        veor            q3,  q3,  q13           @ P0 = PS0 ^ 0x80
+        vqsub.s8        q5,  q5,  q11           @ QS1 = clamp(QS1-c3)
+        vqadd.s8        q2,  q2,  q11           @ PS1 = clamp(PS1+c3)
+        veor            q5,  q5,  q13           @ Q1 = QS1 ^ 0x80
+        veor            q2,  q2,  q13           @ P1 = PS1 ^ 0x80
+    .else
+        vand            q12, q10, q9            @ w & hev
+        vqadd.s8        q11, q12, q14           @ c1 = clamp((w&hev)+4)
+        vqadd.s8        q12, q12, q15           @ c2 = clamp((w&hev)+3)
+        vshr.s8         q11, q11, #3            @ c1 >>= 3
+        vshr.s8         q12, q12, #3            @ c2 >>= 3
+        vbic            q10, q10, q9            @ w &= ~hev
+        vqsub.s8        q4,  q4,  q11           @ QS0 = clamp(QS0-c1)
+        vqadd.s8        q3,  q3,  q12           @ PS0 = clamp(PS0+c2)
+
+        @ filter_mbedge:
+        @   a = clamp((27*w + 63) >> 7);
+        @   Q0 = s2u(QS0 - a);
+        @   P0 = s2u(PS0 + a);
+        @   a = clamp((18*w + 63) >> 7);
+        @   Q1 = s2u(QS1 - a);
+        @   P1 = s2u(PS1 + a);
+        @   a = clamp((9*w + 63) >> 7);
+        @   Q2 = s2u(QS2 - a);
+        @   P2 = s2u(PS2 + a);
+        vmov.i16        q9,  #63
+        vshll.s8        q14, d20, #3
+        vshll.s8        q15, d21, #3
+        vaddw.s8        q14, q14, d20
+        vaddw.s8        q15, q15, d21
+        vadd.s16        q8,  q9,  q14
+        vadd.s16        q9,  q9,  q15           @  9*w + 63
+        vadd.s16        q11, q8,  q14
+        vadd.s16        q12, q9,  q15           @ 18*w + 63
+        vadd.s16        q14, q11, q14
+        vadd.s16        q15, q12, q15           @ 27*w + 63
+        vqshrn.s16      d16, q8,  #7
+        vqshrn.s16      d17, q9,  #7            @ clamp(( 9*w + 63)>>7)
+        vqshrn.s16      d22, q11, #7
+        vqshrn.s16      d23, q12, #7            @ clamp((18*w + 63)>>7)
+        vqshrn.s16      d28, q14, #7
+        vqshrn.s16      d29, q15, #7            @ clamp((27*w + 63)>>7)
+        vqadd.s8        q1,  q1,  q8            @ PS2 = clamp(PS2+a)
+        vqsub.s8        q6,  q6,  q8            @ QS2 = clamp(QS2-a)
+        vqadd.s8        q2,  q2,  q11           @ PS1 = clamp(PS1+a)
+        vqsub.s8        q5,  q5,  q11           @ QS1 = clamp(QS1-a)
+        vqadd.s8        q3,  q3,  q14           @ PS0 = clamp(PS0+a)
+        vqsub.s8        q4,  q4,  q14           @ QS0 = clamp(QS0-a)
+        veor            q3,  q3,  q13           @ P0 = PS0 ^ 0x80
+        veor            q4,  q4,  q13           @ Q0 = QS0 ^ 0x80
+        veor            q2,  q2,  q13           @ P1 = PS1 ^ 0x80
+        veor            q5,  q5,  q13           @ Q1 = QS1 ^ 0x80
+        veor            q1,  q1,  q13           @ P2 = PS2 ^ 0x80
+        veor            q6,  q6,  q13           @ Q2 = QS2 ^ 0x80
+    .endif
+.endm
+
+.macro transpose8x16matrix
+        vtrn.32         q0,   q4
+        vtrn.32         q1,   q5
+        vtrn.32         q2,   q6
+        vtrn.32         q3,   q7
+
+        vtrn.16         q0,   q2
+        vtrn.16         q1,   q3
+        vtrn.16         q4,   q6
+        vtrn.16         q5,   q7
+
+        vtrn.8          q0,   q1
+        vtrn.8          q2,   q3
+        vtrn.8          q4,   q5
+        vtrn.8          q6,   q7
+.endm
+
+.macro  vp8_v_loop_filter16 name, inner=0, simple=0
+function ff_vp8_v_loop_filter16\name\()_neon, export=1
+        vpush           {q4-q7}
+        sub             r0,  r0,  r1,  lsl #1+!\simple
+
+        @ Load pixels:
+    .if !\simple
+        ldr             r12, [sp, #64]          @ hev_thresh
+        vld1.8          {q0},     [r0,:128], r1 @ P3
+        vld1.8          {q1},     [r0,:128], r1 @ P2
+    .endif
+        vld1.8          {q2},     [r0,:128], r1 @ P1
+        vld1.8          {q3},     [r0,:128], r1 @ P0
+        vld1.8          {q4},     [r0,:128], r1 @ Q0
+        vld1.8          {q5},     [r0,:128], r1 @ Q1
+    .if !\simple
+        vld1.8          {q6},     [r0,:128], r1 @ Q2
+        vld1.8          {q7},     [r0,:128]     @ Q3
+        vdup.8          q15, r3                 @ flim_I
+    .endif
+        vdup.8          q14, r2                 @ flim_E
+
+        vp8_loop_filter inner=\inner, simple=\simple
+
+        @ back up to P2:  dst -= stride * 6
+        sub             r0,  r0,  r1,  lsl #2
+    .if !\simple
+        sub             r0,  r0,  r1,  lsl #1
+
+        @ Store pixels:
+        vst1.8          {q1},     [r0,:128], r1 @ P2
+    .endif
+        vst1.8          {q2},     [r0,:128], r1 @ P1
+        vst1.8          {q3},     [r0,:128], r1 @ P0
+        vst1.8          {q4},     [r0,:128], r1 @ Q0
+        vst1.8          {q5},     [r0,:128], r1 @ Q1
+    .if !\simple
+        vst1.8          {q6},     [r0,:128]     @ Q2
+    .endif
+
+        vpop            {q4-q7}
+        bx              lr
+endfunc
+.endm
+
+vp8_v_loop_filter16
+vp8_v_loop_filter16 _inner,  inner=1
+vp8_v_loop_filter16 _simple, simple=1
+
+.macro  vp8_v_loop_filter8uv name, inner=0
+function ff_vp8_v_loop_filter8uv\name\()_neon, export=1
+        vpush           {q4-q7}
+        sub             r0,  r0,  r2,  lsl #2
+        sub             r1,  r1,  r2,  lsl #2
+        ldr             r12, [sp, #64]          @ flim_I
+
+        @ Load pixels:
+        vld1.8          {d0},     [r0,:64], r2  @ P3
+        vld1.8          {d1},     [r1,:64], r2  @ P3
+        vld1.8          {d2},     [r0,:64], r2  @ P2
+        vld1.8          {d3},     [r1,:64], r2  @ P2
+        vld1.8          {d4},     [r0,:64], r2  @ P1
+        vld1.8          {d5},     [r1,:64], r2  @ P1
+        vld1.8          {d6},     [r0,:64], r2  @ P0
+        vld1.8          {d7},     [r1,:64], r2  @ P0
+        vld1.8          {d8},     [r0,:64], r2  @ Q0
+        vld1.8          {d9},     [r1,:64], r2  @ Q0
+        vld1.8          {d10},    [r0,:64], r2  @ Q1
+        vld1.8          {d11},    [r1,:64], r2  @ Q1
+        vld1.8          {d12},    [r0,:64], r2  @ Q2
+        vld1.8          {d13},    [r1,:64], r2  @ Q2
+        vld1.8          {d14},    [r0,:64]      @ Q3
+        vld1.8          {d15},    [r1,:64]      @ Q3
+
+        vdup.8          q14, r3                 @ flim_E
+        vdup.8          q15, r12                @ flim_I
+        ldr             r12, [sp, #68]          @ hev_thresh
+
+        vp8_loop_filter inner=\inner
+
+        @ back up to P2:  u,v -= stride * 6
+        sub             r0,  r0,  r2,  lsl #2
+        sub             r1,  r1,  r2,  lsl #2
+        sub             r0,  r0,  r2,  lsl #1
+        sub             r1,  r1,  r2,  lsl #1
+
+        @ Store pixels:
+        vst1.8          {d2},     [r0,:64], r2  @ P2
+        vst1.8          {d3},     [r1,:64], r2  @ P2
+        vst1.8          {d4},     [r0,:64], r2  @ P1
+        vst1.8          {d5},     [r1,:64], r2  @ P1
+        vst1.8          {d6},     [r0,:64], r2  @ P0
+        vst1.8          {d7},     [r1,:64], r2  @ P0
+        vst1.8          {d8},     [r0,:64], r2  @ Q0
+        vst1.8          {d9},     [r1,:64], r2  @ Q0
+        vst1.8          {d10},    [r0,:64], r2  @ Q1
+        vst1.8          {d11},    [r1,:64], r2  @ Q1
+        vst1.8          {d12},    [r0,:64]      @ Q2
+        vst1.8          {d13},    [r1,:64]      @ Q2
+
+        vpop            {q4-q7}
+        bx              lr
+endfunc
+.endm
+
+vp8_v_loop_filter8uv
+vp8_v_loop_filter8uv _inner, inner=1
+
+.macro  vp8_h_loop_filter16 name, inner=0, simple=0
+function ff_vp8_h_loop_filter16\name\()_neon, export=1
+        vpush           {q4-q7}
+        sub             r0,  r0,  #4
+    .if !\simple
+        ldr             r12, [sp, #64]          @ hev_thresh
+    .endif
+
+        @ Load pixels:
+        vld1.8          {d0},     [r0], r1      @ load first 8-line src data
+        vld1.8          {d2},     [r0], r1
+        vld1.8          {d4},     [r0], r1
+        vld1.8          {d6},     [r0], r1
+        vld1.8          {d8},     [r0], r1
+        vld1.8          {d10},    [r0], r1
+        vld1.8          {d12},    [r0], r1
+        vld1.8          {d14},    [r0], r1
+        vld1.8          {d1},     [r0], r1      @ load second 8-line src data
+        vld1.8          {d3},     [r0], r1
+        vld1.8          {d5},     [r0], r1
+        vld1.8          {d7},     [r0], r1
+        vld1.8          {d9},     [r0], r1
+        vld1.8          {d11},    [r0], r1
+        vld1.8          {d13},    [r0], r1
+        vld1.8          {d15},    [r0], r1
+
+        transpose8x16matrix
+
+        vdup.8          q14, r2                 @ flim_E
+    .if !\simple
+        vdup.8          q15, r3                 @ flim_I
+    .endif
+
+        vp8_loop_filter inner=\inner, simple=\simple
+
+        sub             r0,  r0,  r1, lsl #4    @ backup 16 rows
+
+        transpose8x16matrix
+
+        @ Store pixels:
+        vst1.8          {d0},     [r0],     r1
+        vst1.8          {d2},     [r0],     r1
+        vst1.8          {d4},     [r0],     r1
+        vst1.8          {d6},     [r0],     r1
+        vst1.8          {d8},     [r0],     r1
+        vst1.8          {d10},    [r0],     r1
+        vst1.8          {d12},    [r0],     r1
+        vst1.8          {d14},    [r0],     r1
+        vst1.8          {d1},     [r0],     r1
+        vst1.8          {d3},     [r0],     r1
+        vst1.8          {d5},     [r0],     r1
+        vst1.8          {d7},     [r0],     r1
+        vst1.8          {d9},     [r0],     r1
+        vst1.8          {d11},    [r0],     r1
+        vst1.8          {d13},    [r0],     r1
+        vst1.8          {d15},    [r0]
+
+        vpop            {q4-q7}
+        bx              lr
+endfunc
+.endm
+
+vp8_h_loop_filter16
+vp8_h_loop_filter16 _inner,  inner=1
+vp8_h_loop_filter16 _simple, simple=1
+
+.macro  vp8_h_loop_filter8uv name, inner=0
+function ff_vp8_h_loop_filter8uv\name\()_neon, export=1
+        vpush           {q4-q7}
+        sub             r0,  r0,  #4
+        sub             r1,  r1,  #4
+        ldr             r12, [sp, #64]          @ flim_I
+
+        @ Load pixels:
+        vld1.8          {d0},     [r0], r2      @ load u
+        vld1.8          {d1},     [r1], r2      @ load v
+        vld1.8          {d2},     [r0], r2
+        vld1.8          {d3},     [r1], r2
+        vld1.8          {d4},     [r0], r2
+        vld1.8          {d5},     [r1], r2
+        vld1.8          {d6},     [r0], r2
+        vld1.8          {d7},     [r1], r2
+        vld1.8          {d8},     [r0], r2
+        vld1.8          {d9},     [r1], r2
+        vld1.8          {d10},    [r0], r2
+        vld1.8          {d11},    [r1], r2
+        vld1.8          {d12},    [r0], r2
+        vld1.8          {d13},    [r1], r2
+        vld1.8          {d14},    [r0], r2
+        vld1.8          {d15},    [r1], r2
+
+        transpose8x16matrix
+
+        vdup.8          q14, r3                 @ flim_E
+        vdup.8          q15, r12                @ flim_I
+        ldr             r12, [sp, #68]          @ hev_thresh
+
+        vp8_loop_filter inner=\inner
+
+        sub             r0,  r0,  r2, lsl #3    @ backup u 8 rows
+        sub             r1,  r1,  r2, lsl #3    @ backup v 8 rows
+
+        transpose8x16matrix
+
+        @ Store pixels:
+        vst1.8          {d0},     [r0], r2
+        vst1.8          {d1},     [r1], r2
+        vst1.8          {d2},     [r0], r2
+        vst1.8          {d3},     [r1], r2
+        vst1.8          {d4},     [r0], r2
+        vst1.8          {d5},     [r1], r2
+        vst1.8          {d6},     [r0], r2
+        vst1.8          {d7},     [r1], r2
+        vst1.8          {d8},     [r0], r2
+        vst1.8          {d9},     [r1], r2
+        vst1.8          {d10},    [r0], r2
+        vst1.8          {d11},    [r1], r2
+        vst1.8          {d12},    [r0], r2
+        vst1.8          {d13},    [r1], r2
+        vst1.8          {d14},    [r0]
+        vst1.8          {d15},    [r1]
+
+        vpop            {q4-q7}
+        bx              lr
+endfunc
+.endm
+
+vp8_h_loop_filter8uv
+vp8_h_loop_filter8uv _inner, inner=1
+
+function ff_put_vp8_pixels16_neon, export=1
+        ldr             r12, [sp, #0]           @ h
+1:
+        subs            r12, r12, #4
+        vld1.8          {q0},     [r2], r3
+        vld1.8          {q1},     [r2], r3
+        vld1.8          {q2},     [r2], r3
+        vld1.8          {q3},     [r2], r3
+        vst1.8          {q0},     [r0,:128], r1
+        vst1.8          {q1},     [r0,:128], r1
+        vst1.8          {q2},     [r0,:128], r1
+        vst1.8          {q3},     [r0,:128], r1
+        bgt             1b
+        bx              lr
+endfunc
+
+function ff_put_vp8_pixels8_neon, export=1
+        ldr             r12, [sp, #0]           @ h
+1:
+        subs            r12, r12, #4
+        vld1.8          {d0},     [r2], r3
+        vld1.8          {d1},     [r2], r3
+        vld1.8          {d2},     [r2], r3
+        vld1.8          {d3},     [r2], r3
+        vst1.8          {d0},     [r0,:64], r1
+        vst1.8          {d1},     [r0,:64], r1
+        vst1.8          {d2},     [r0,:64], r1
+        vst1.8          {d3},     [r0,:64], r1
+        bgt             1b
+        bx              lr
+endfunc
+
+function ff_put_vp8_pixels4_neon, export=1
+        ldr             r12, [sp, #0]           @ h
+        push            {r4-r6,lr}
+1:
+        subs            r12, r12, #4
+        ldr             r4,       [r2], r3
+        ldr             r5,       [r2], r3
+        ldr             r6,       [r2], r3
+        ldr             lr,       [r2], r3
+        str             r4,       [r0], r1
+        str             r5,       [r0], r1
+        str             r6,       [r0], r1
+        str             lr,       [r0], r1
+        bgt             1b
+        pop             {r4-r6,pc}
+endfunc
+
+/* 4/6-tap 8th-pel MC */
+
+.macro  vp8_epel8_h6    d,   a,   b
+        vext.8          d27, \a,  \b,  #1
+        vmovl.u8        q8,  \a
+        vext.8          d28, \a,  \b,  #2
+        vmovl.u8        q9,  d27
+        vext.8          d29, \a,  \b,  #3
+        vmovl.u8        q10, d28
+        vext.8          d30, \a,  \b,  #4
+        vmovl.u8        q11, d29
+        vext.8          d31, \a,  \b,  #5
+        vmovl.u8        q12, d30
+        vmul.u16        q10, q10, d0[2]
+        vmovl.u8        q13, d31
+        vmul.u16        q11, q11, d0[3]
+        vmls.u16        q10, q9,  d0[1]
+        vmls.u16        q11, q12, d1[0]
+        vmla.u16        q10, q8,  d0[0]
+        vmla.u16        q11, q13, d1[1]
+        vqadd.s16       q11, q10, q11
+        vqrshrun.s16    \d,  q11, #7
+.endm
+
+.macro  vp8_epel16_h6   d0,  d1,  s0,  s1,  s2,  q0,  q1
+        vext.8          q14, \q0, \q1, #3
+        vext.8          q15, \q0, \q1, #4
+        vmovl.u8        q11, d28
+        vmovl.u8        q14, d29
+        vext.8          q3,  \q0, \q1, #2
+        vmovl.u8        q12, d30
+        vmovl.u8        q15, d31
+        vext.8          q8,  \q0, \q1, #1
+        vmovl.u8        q10, d6
+        vmovl.u8        q3,  d7
+        vext.8          q2,  \q0, \q1, #5
+        vmovl.u8        q13, d4
+        vmovl.u8        q2,  d5
+        vmovl.u8        q9,  d16
+        vmovl.u8        q8,  d17
+        vmul.u16        q11, q11, d0[3]
+        vmul.u16        q10, q10, d0[2]
+        vmul.u16        q3,  q3,  d0[2]
+        vmul.u16        q14, q14, d0[3]
+        vmls.u16        q11, q12, d1[0]
+        vmovl.u8        q12, \s0
+        vmovl.u8        q1,  \s1
+        vmls.u16        q10, q9,  d0[1]
+        vmls.u16        q3,  q8,  d0[1]
+        vmls.u16        q14, q15, d1[0]
+        vmla.u16        q10, q12, d0[0]
+        vmla.u16        q11, q13, d1[1]
+        vmla.u16        q3,  q1,  d0[0]
+        vmla.u16        q14, q2,  d1[1]
+        vqadd.s16       q11, q10, q11
+        vqadd.s16       q14, q3,  q14
+        vqrshrun.s16    \d0, q11, #7
+        vqrshrun.s16    \d1, q14, #7
+.endm
+
+.macro  vp8_epel8_v6    d0,  s0,  s1,  s2,  s3,  s4,  s5
+        vmovl.u8        q10, \s2
+        vmovl.u8        q11, \s3
+        vmovl.u8        q9,  \s1
+        vmovl.u8        q12, \s4
+        vmovl.u8        q8,  \s0
+        vmovl.u8        q13, \s5
+        vmul.u16        q10, q10, d0[2]
+        vmul.u16        q11, q11, d0[3]
+        vmls.u16        q10, q9,  d0[1]
+        vmls.u16        q11, q12, d1[0]
+        vmla.u16        q10, q8,  d0[0]
+        vmla.u16        q11, q13, d1[1]
+        vqadd.s16       q11, q10, q11
+        vqrshrun.s16    \d0, q11, #7
+.endm
+
+.macro  vp8_epel8_v6_y2 d0, d1, s0, s1, s2, s3, s4, s5, s6
+        vmovl.u8        q10, \s0
+        vmovl.u8        q11, \s3
+        vmovl.u8        q14, \s6
+        vmovl.u8        q9,  \s1
+        vmovl.u8        q12, \s4
+        vmovl.u8        q8,  \s2
+        vmovl.u8        q13, \s5
+        vmul.u16        q10, q10, d0[0]
+        vmul.u16        q15, q11, d0[3]
+        vmul.u16        q11, q11, d0[2]
+        vmul.u16        q14, q14, d1[1]
+        vmls.u16        q10, q9,  d0[1]
+        vmls.u16        q15, q12, d1[0]
+        vmls.u16        q11, q8,  d0[1]
+        vmls.u16        q14, q13, d1[0]
+        vmla.u16        q10, q8,  d0[2]
+        vmla.u16        q15, q13, d1[1]
+        vmla.u16        q11, q9,  d0[0]
+        vmla.u16        q14, q12, d0[3]
+        vqadd.s16       q15, q10, q15
+        vqadd.s16       q14, q11, q14
+        vqrshrun.s16    \d0, q15, #7
+        vqrshrun.s16    \d1, q14, #7
+.endm
+
+.macro  vp8_epel8_h4    d,   a,   b
+        vext.8          d28, \a,  \b,  #1
+        vmovl.u8        q9,  \a
+        vext.8          d29, \a,  \b,  #2
+        vmovl.u8        q10, d28
+        vext.8          d30, \a,  \b,  #3
+        vmovl.u8        q11, d29
+        vmovl.u8        q12, d30
+        vmul.u16        q10, q10, d0[2]
+        vmul.u16        q11, q11, d0[3]
+        vmls.u16        q10, q9,  d0[1]
+        vmls.u16        q11, q12, d1[0]
+        vqadd.s16       q11, q10, q11
+        vqrshrun.s16    \d,  q11, #7
+.endm
+
+.macro  vp8_epel8_v4_y2 d0,  d1,  s0,  s1,  s2,  s3,  s4
+        vmovl.u8        q9,  \s0
+        vmovl.u8        q10, \s1
+        vmovl.u8        q11, \s2
+        vmovl.u8        q12, \s3
+        vmovl.u8        q13, \s4
+        vmul.u16        q8,  q10, d0[2]
+        vmul.u16        q14, q11, d0[3]
+        vmul.u16        q11, q11, d0[2]
+        vmul.u16        q15, q12, d0[3]
+        vmls.u16        q8,  q9,  d0[1]
+        vmls.u16        q14, q12, d1[0]
+        vmls.u16        q11, q10, d0[1]
+        vmls.u16        q15, q13, d1[0]
+        vqadd.s16       q8,  q8,  q14
+        vqadd.s16       q11, q11, q15
+        vqrshrun.s16    \d0, q8,  #7
+        vqrshrun.s16    \d1, q11, #7
+.endm
+
+function ff_put_vp8_epel16_v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        push            {r4,lr}
+        vpush           {d8-d15}
+
+        ldr             r4,  [sp, #80]          @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #72]          @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {d2-d3},  [r2], r3
+        vld1.8          {d4-d5},  [r2], r3
+        vld1.8          {d6-d7},  [r2], r3
+        vld1.8          {d8-d9},  [r2], r3
+        vld1.8          {d10-d11},[r2], r3
+        vld1.8          {d12-d13},[r2], r3
+        vld1.8          {d14-d15},[r2]
+        sub             r2,  r2,  r3,  lsl #2
+
+        vp8_epel8_v6_y2 d2,  d4,  d2,  d4,  d6,  d8,  d10, d12, d14
+        vp8_epel8_v6_y2 d3,  d5,  d3,  d5,  d7,  d9,  d11, d13, d15
+
+        vst1.8          {d2-d3},  [r0,:128], r1
+        vst1.8          {d4-d5},  [r0,:128], r1
+        subs            r12, r12, #2
+        bne             1b
+
+        vpop            {d8-d15}
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel16_h6_neon, export=1
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {d2-d4},  [r2], r3
+
+        vp8_epel16_h6   d2,  d3,  d2,  d3,  d4,  q1,  q2
+
+        vst1.8          {d2-d3}, [r0,:128], r1
+        subs            r12, r12, #1
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel16_h6v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+        vpush           {d8-d9}
+
+        @ first pass (horizontal):
+        ldr             r4,  [sp, #28]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #24]          @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #336+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #5
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {d2,d3,d4}, [r2], r3
+
+        vp8_epel16_h6   d2,  d3,  d2,  d3,  d4,  q1,  q2
+
+        vst1.8          {d2-d3}, [lr,:128]!
+        subs            r12, r12, #1
+        bne             1b
+
+        @ second pass (vertical):
+        ldr             r4,  [sp, #336+16+32]   @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #336+16+24]   @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d5},  [lr,:128]!
+        vld1.8          {d6-d9},  [lr,:128]!
+        vld1.8          {d28-d31},[lr,:128]
+        sub             lr,  lr,  #48
+
+        vp8_epel8_v6    d2, d2, d4, d6, d8, d28, d30
+        vp8_epel8_v6    d3, d3, d5, d7, d9, d29, d31
+
+        vst1.8          {d2-d3}, [r0,:128], r1
+        subs            r12, r12, #1
+        bne             2b
+
+        add             sp,  sp,  #336+16
+        vpop            {d8-d9}
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #16]          @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {d2},  [r2], r3
+        vld1.8          {d3},  [r2], r3
+        vld1.8          {d4},  [r2], r3
+        vld1.8          {d5},  [r2], r3
+        vld1.8          {d6},  [r2], r3
+        vld1.8          {d7},  [r2], r3
+        vld1.8          {d28}, [r2]
+
+        sub             r2,  r2,  r3,  lsl #2
+
+        vp8_epel8_v6_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6,  d7,  d28
+
+        vst1.8          {d2}, [r0,:64], r1
+        vst1.8          {d3}, [r0,:64], r1
+        subs            r12, r12, #2
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_h6_neon, export=1
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {d2,d3}, [r2], r3
+
+        vp8_epel8_h6    d2,  d2,  d3
+
+        vst1.8          {d2}, [r0,:64], r1
+        subs            r12, r12, #1
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_h6v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+
+        @ first pass (horizontal):
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #168+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #5
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {d2,d3}, [r2], r3
+
+        vp8_epel8_h6    d2,  d2,  d3
+
+        vst1.8          {d2}, [lr,:64]!
+        subs            r12, r12, #1
+        bne             1b
+
+        @ second pass (vertical):
+        ldr             r4,  [sp, #168+16+16]   @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #168+16+8]    @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d5},  [lr,:128]!
+        vld1.8          {d6-d7},  [lr,:128]!
+        vld1.8          {d30},    [lr,:64]
+        sub             lr,  lr,  #32
+
+        vp8_epel8_v6_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6,  d7,  d30
+
+        vst1.8          {d2}, [r0,:64], r1
+        vst1.8          {d3}, [r0,:64], r1
+        subs            r12, r12, #2
+        bne             2b
+
+        add             sp,  sp,  #168+16
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_v4_neon, export=1
+        sub             r2,  r2,  r3
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #16]          @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {d2},     [r2], r3
+        vld1.8          {d3},     [r2], r3
+        vld1.8          {d4},     [r2], r3
+        vld1.8          {d5},     [r2], r3
+        vld1.8          {d6},     [r2]
+        sub             r2,  r2,  r3,  lsl #1
+
+        vp8_epel8_v4_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6
+
+        vst1.8          {d2}, [r0,:64], r1
+        vst1.8          {d3}, [r0,:64], r1
+        subs            r12, r12, #2
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_h4_neon, export=1
+        sub             r2,  r2,  #1
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {d2,d3}, [r2], r3
+
+        vp8_epel8_h4    d2,  d2,  d3
+
+        vst1.8          {d2}, [r0,:64], r1
+        subs            r12, r12, #1
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_h4v4_neon, export=1
+        sub             r2,  r2,  r3
+        sub             r2,  r2,  #1
+        push            {r4,lr}
+
+        @ first pass (horizontal):
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #168+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #3
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {d2,d3}, [r2], r3
+
+        vp8_epel8_h4    d2,  d2,  d3
+
+        vst1.8          {d2}, [lr,:64]!
+        subs            r12, r12, #1
+        bne             1b
+
+        @ second pass (vertical):
+        ldr             r4,  [sp, #168+16+16]   @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #168+16+8]    @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d5},  [lr,:128]!
+        vld1.8          {d6},     [lr,:64]
+        sub             lr,  lr,  #16
+
+        vp8_epel8_v4_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6
+
+        vst1.8          {d2},     [r0,:64], r1
+        vst1.8          {d3},     [r0,:64], r1
+        subs            r12, r12, #2
+        bne             2b
+
+        add             sp,  sp,  #168+16
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_h6v4_neon, export=1
+        sub             r2,  r2,  r3
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+
+        @ first pass (horizontal):
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #168+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #3
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {d2,d3}, [r2], r3
+
+        vp8_epel8_h6    d2,  d2,  d3
+
+        vst1.8          {d2}, [lr,:64]!
+        subs            r12, r12, #1
+        bne             1b
+
+        @ second pass (vertical):
+        ldr             r4,  [sp, #168+16+16]   @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #168+16+8]    @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d5},  [lr,:128]!
+        vld1.8          {d6},     [lr,:64]
+        sub             lr,  lr,  #16
+
+        vp8_epel8_v4_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6
+
+        vst1.8          {d2},     [r0,:64], r1
+        vst1.8          {d3},     [r0,:64], r1
+        subs            r12, r12, #2
+        bne             2b
+
+        add             sp,  sp,  #168+16
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel8_h4v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        sub             r2,  r2,  #1
+        push            {r4,lr}
+
+        @ first pass (horizontal):
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #168+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #5
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {d2,d3}, [r2], r3
+
+        vp8_epel8_h4    d2,  d2,  d3
+
+        vst1.8          {d2}, [lr,:64]!
+        subs            r12, r12, #1
+        bne             1b
+
+        @ second pass (vertical):
+        ldr             r4,  [sp, #168+16+16]   @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #168+16+8]    @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d5},  [lr,:128]!
+        vld1.8          {d6-d7},  [lr,:128]!
+        vld1.8          {d30},    [lr,:64]
+        sub             lr,  lr,  #32
+
+        vp8_epel8_v6_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6,  d7,  d30
+
+        vst1.8          {d2}, [r0,:64], r1
+        vst1.8          {d3}, [r0,:64], r1
+        subs            r12, r12, #2
+        bne             2b
+
+        add             sp,  sp,  #168+16
+        pop             {r4,pc}
+endfunc
+
+.ltorg
+
+function ff_put_vp8_epel4_v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #16]          @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.32         {d2[]},   [r2], r3
+        vld1.32         {d3[]},   [r2], r3
+        vld1.32         {d4[]},   [r2], r3
+        vld1.32         {d5[]},   [r2], r3
+        vld1.32         {d6[]},   [r2], r3
+        vld1.32         {d7[]},   [r2], r3
+        vld1.32         {d28[]},  [r2]
+        sub             r2,  r2,  r3,  lsl #2
+        vld1.32         {d2[1]},  [r2], r3
+        vld1.32         {d3[1]},  [r2], r3
+        vld1.32         {d4[1]},  [r2], r3
+        vld1.32         {d5[1]},  [r2], r3
+        vld1.32         {d6[1]},  [r2], r3
+        vld1.32         {d7[1]},  [r2], r3
+        vld1.32         {d28[1]}, [r2]
+        sub             r2,  r2,  r3,  lsl #2
+
+        vp8_epel8_v6_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6,  d7,  d28
+
+        vst1.32         {d2[0]},  [r0,:32], r1
+        vst1.32         {d3[0]},  [r0,:32], r1
+        vst1.32         {d2[1]},  [r0,:32], r1
+        vst1.32         {d3[1]},  [r0,:32], r1
+        subs            r12, r12, #4
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel4_h6_neon, export=1
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {q1},     [r2], r3
+        vp8_epel8_h6    d2,  d2,  d3
+        vst1.32         {d2[0]},  [r0,:32], r1
+        subs            r12, r12, #1
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel4_h6v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #52+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #5
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {q1},     [r2], r3
+        vp8_epel8_h6    d2,  d2,  d3
+        vst1.32         {d2[0]},  [lr,:32]!
+        subs            r12, r12, #1
+        bne             1b
+
+        ldr             r4,  [sp, #52+16+16]    @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #52+16+8]     @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d3},  [lr,:128]!
+        vld1.8          {d6},     [lr,:64]!
+        vld1.32         {d28[]},  [lr,:32]
+        sub             lr,  lr,  #16
+        vld1.8          {d4-d5},  [lr]!
+        vld1.8          {d7},     [lr,:64]!
+        vld1.32         {d28[1]}, [lr,:32]
+        sub             lr,  lr,  #16
+        vtrn.32         q1,  q2
+        vtrn.32         d6,  d7
+        vp8_epel8_v6_y2 d2,  d3,  d2,  d4,  d3,  d5,  d6,  d7,  d28
+        vst1.32         {d2[0]},  [r0,:32], r1
+        vst1.32         {d3[0]},  [r0,:32], r1
+        vst1.32         {d2[1]},  [r0,:32], r1
+        vst1.32         {d3[1]},  [r0,:32], r1
+        subs            r12, r12, #4
+        bne             2b
+
+        add             sp,  sp,  #52+16
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel4_h4v6_neon, export=1
+        sub             r2,  r2,  r3,  lsl #1
+        sub             r2,  r2,  #1
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #52+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #5
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {d2},     [r2], r3
+        vp8_epel8_h4    d2,  d2,  d2
+        vst1.32         {d2[0]},  [lr,:32]!
+        subs            r12, r12, #1
+        bne             1b
+
+        ldr             r4,  [sp, #52+16+16]    @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #52+16+8]     @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d3},  [lr,:128]!
+        vld1.8          {d6},     [lr,:64]!
+        vld1.32         {d28[]},  [lr,:32]
+        sub             lr,  lr,  #16
+        vld1.8          {d4-d5},  [lr]!
+        vld1.8          {d7},     [lr,:64]!
+        vld1.32         {d28[1]}, [lr,:32]
+        sub             lr,  lr,  #16
+        vtrn.32         q1,  q2
+        vtrn.32         d6,  d7
+        vp8_epel8_v6_y2 d2,  d3,  d2,  d4,  d3,  d5,  d6,  d7,  d28
+        vst1.32         {d2[0]},  [r0,:32], r1
+        vst1.32         {d3[0]},  [r0,:32], r1
+        vst1.32         {d2[1]},  [r0,:32], r1
+        vst1.32         {d3[1]},  [r0,:32], r1
+        subs            r12, r12, #4
+        bne             2b
+
+        add             sp,  sp,  #52+16
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel4_h6v4_neon, export=1
+        sub             r2,  r2,  r3
+        sub             r2,  r2,  #2
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #44+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #3
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {q1},     [r2], r3
+        vp8_epel8_h6    d2,  d2,  d3
+        vst1.32         {d2[0]},  [lr,:32]!
+        subs            r12, r12, #1
+        bne             1b
+
+        ldr             r4,  [sp, #44+16+16]    @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #44+16+8]     @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d3},  [lr,:128]!
+        vld1.32         {d6[]},   [lr,:32]
+        sub             lr,  lr,  #8
+        vld1.8          {d4-d5},  [lr]!
+        vld1.32         {d6[1]},  [lr,:32]
+        sub             lr,  lr,  #8
+        vtrn.32         q1,  q2
+        vp8_epel8_v4_y2 d2,  d3,  d2,  d4,  d3,  d5,  d6
+        vst1.32         {d2[0]},  [r0,:32], r1
+        vst1.32         {d3[0]},  [r0,:32], r1
+        vst1.32         {d2[1]},  [r0,:32], r1
+        vst1.32         {d3[1]},  [r0,:32], r1
+        subs            r12, r12, #4
+        bne             2b
+
+        add             sp,  sp,  #44+16
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel4_h4_neon, export=1
+        sub             r2,  r2,  #1
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.8          {d2},     [r2], r3
+        vp8_epel8_h4    d2,  d2,  d2
+        vst1.32         {d2[0]},  [r0,:32], r1
+        subs            r12, r12, #1
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel4_v4_neon, export=1
+        sub             r2,  r2,  r3
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #16]          @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        vld1.16         {q0},     [r4,:128]
+1:
+        vld1.32         {d2[]},   [r2], r3
+        vld1.32         {d3[]},   [r2], r3
+        vld1.32         {d4[]},   [r2], r3
+        vld1.32         {d5[]},   [r2], r3
+        vld1.32         {d6[]},   [r2]
+        sub             r2,  r2,  r3,  lsl #1
+        vld1.32         {d2[1]},  [r2], r3
+        vld1.32         {d3[1]},  [r2], r3
+        vld1.32         {d4[1]},  [r2], r3
+        vld1.32         {d5[1]},  [r2], r3
+        vld1.32         {d6[1]},  [r2]
+        sub             r2,  r2,  r3,  lsl #1
+
+        vp8_epel8_v4_y2 d2,  d3,  d2,  d3,  d4,  d5,  d6
+
+        vst1.32         {d2[0]},  [r0,:32], r1
+        vst1.32         {d3[0]},  [r0,:32], r1
+        vst1.32         {d2[1]},  [r0,:32], r1
+        vst1.32         {d3[1]},  [r0,:32], r1
+        subs            r12, r12, #4
+        bne             1b
+
+        pop             {r4,pc}
+endfunc
+
+function ff_put_vp8_epel4_h4v4_neon, export=1
+        sub             r2,  r2,  r3
+        sub             r2,  r2,  #1
+        push            {r4,lr}
+
+        ldr             r4,  [sp, #12]          @ mx
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #8]           @ h
+        add             r4,  lr,  r4, lsl #4
+        sub             sp,  sp,  #44+16
+        vld1.16         {q0},     [r4,:128]
+        add             lr,  sp,  #15
+        add             r12, r12, #3
+        bic             lr,  lr,  #15
+1:
+        vld1.8          {d2},     [r2], r3
+        vp8_epel8_h4    d2,  d2,  d3
+        vst1.32         {d2[0]},  [lr,:32]!
+        subs            r12, r12, #1
+        bne             1b
+
+        ldr             r4,  [sp, #44+16+16]    @ my
+        movrel          lr,  subpel_filters-16
+        ldr             r12, [sp, #44+16+8]     @ h
+        add             r4,  lr,  r4, lsl #4
+        add             lr,  sp,  #15
+        vld1.16         {q0},     [r4,:128]
+        bic             lr,  lr,  #15
+2:
+        vld1.8          {d2-d3},  [lr,:128]!
+        vld1.32         {d6[]},   [lr,:32]
+        sub             lr,  lr,  #8
+        vld1.8          {d4-d5},  [lr]!
+        vld1.32         {d6[1]},  [lr,:32]
+        sub             lr,  lr,  #8
+        vtrn.32         q1,  q2
+        vp8_epel8_v4_y2 d2,  d3,  d2,  d4,  d3,  d5,  d6
+        vst1.32         {d2[0]},  [r0,:32], r1
+        vst1.32         {d3[0]},  [r0,:32], r1
+        vst1.32         {d2[1]},  [r0,:32], r1
+        vst1.32         {d3[1]},  [r0,:32], r1
+        subs            r12, r12, #4
+        bne             2b
+
+        add             sp,  sp,  #44+16
+        pop             {r4,pc}
+endfunc
+
+@ note: worst case sum of all 6-tap filter values * 255 is 0x7f80 so 16 bit
+@ arithmatic can be used to apply filters
+const   subpel_filters, align=4
+        .short     0,   6, 123,  12,   1,   0,   0,   0
+        .short     2,  11, 108,  36,   8,   1,   0,   0
+        .short     0,   9,  93,  50,   6,   0,   0,   0
+        .short     3,  16,  77,  77,  16,   3,   0,   0
+        .short     0,   6,  50,  93,   9,   0,   0,   0
+        .short     1,   8,  36, 108,  11,   2,   0,   0
+        .short     0,   1,  12, 123,   6,   0,   0,   0
+endconst
+
+/* Bilinear MC */
+
+function ff_put_vp8_bilin16_h_neon, export=1
+        ldr             r3,  [sp, #4]           @ mx
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r12, [sp]               @ h
+1:
+        subs            r12, r12, #2
+        vld1.8          {d2-d4},  [r2], r1
+        vext.8          q2,  q1,  q2,  #1
+        vmull.u8        q8,  d2,  d1
+        vmlal.u8        q8,  d4,  d0
+        vld1.8          {d18-d20},[r2], r1
+        vmull.u8        q3,  d3,  d1
+        vmlal.u8        q3,  d5,  d0
+        vext.8          q10, q9,  q10, #1
+        vmull.u8        q11, d18, d1
+        vmlal.u8        q11, d20, d0
+        vmull.u8        q12, d19, d1
+        vmlal.u8        q12, d21, d0
+        vrshrn.u16      d4,  q8,  #3
+        vrshrn.u16      d5,  q3,  #3
+        vrshrn.u16      d6,  q11, #3
+        vrshrn.u16      d7,  q12, #3
+        vst1.8          {q2},     [r0,:128], r1
+        vst1.8          {q3},     [r0,:128], r1
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin16_v_neon, export=1
+        ldr             r3,  [sp, #8]           @ my
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r12, [sp]               @ h
+        vld1.8          {q1},     [r2], r1
+1:
+        subs            r12, r12, #2
+        vld1.8          {q2},     [r2], r1
+        vmull.u8        q3,  d2,  d1
+        vmlal.u8        q3,  d4,  d0
+        vmull.u8        q8,  d3,  d1
+        vmlal.u8        q8,  d5,  d0
+        vld1.8          {q1},     [r2], r1
+        vmull.u8        q9,  d4,  d1
+        vmlal.u8        q9,  d2,  d0
+        vmull.u8        q10, d5,  d1
+        vmlal.u8        q10, d3,  d0
+        vrshrn.u16      d4,  q3,  #3
+        vrshrn.u16      d5,  q8,  #3
+        vrshrn.u16      d6,  q9,  #3
+        vrshrn.u16      d7,  q10, #3
+        vst1.8          {q2},     [r0,:128], r1
+        vst1.8          {q3},     [r0,:128], r1
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin16_hv_neon, export=1
+        ldr             r3,  [sp, #4]           @ mx
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r3,  [sp, #8]           @ my
+        rsb             r12, r3,  #8
+        vdup.8          d2,  r3
+        vdup.8          d3,  r12
+        ldr             r12, [sp]               @ h
+
+        vld1.8          {d4-d6},  [r2], r1
+        vext.8          q3,  q2,  q3,  #1
+        vmull.u8        q8,  d4,  d1
+        vmlal.u8        q8,  d6,  d0
+        vmull.u8        q9,  d5,  d1
+        vmlal.u8        q9,  d7,  d0
+        vrshrn.u16      d4,  q8,  #3
+        vrshrn.u16      d5,  q9,  #3
+1:
+        subs            r12, r12, #2
+        vld1.8          {d18-d20},[r2], r1
+        vext.8          q10, q9,  q10, #1
+        vmull.u8        q11, d18, d1
+        vmlal.u8        q11, d20, d0
+        vld1.8          {d26-d28},[r2], r1
+        vmull.u8        q12, d19, d1
+        vmlal.u8        q12, d21, d0
+        vext.8          q14, q13, q14, #1
+        vmull.u8        q8,  d26, d1
+        vmlal.u8        q8,  d28, d0
+        vmull.u8        q9,  d27, d1
+        vmlal.u8        q9,  d29, d0
+        vrshrn.u16      d6,  q11, #3
+        vrshrn.u16      d7,  q12, #3
+        vmull.u8        q12, d4,  d3
+        vmlal.u8        q12, d6,  d2
+        vmull.u8        q15, d5,  d3
+        vmlal.u8        q15, d7,  d2
+        vrshrn.u16      d4,  q8,  #3
+        vrshrn.u16      d5,  q9,  #3
+        vmull.u8        q10, d6,  d3
+        vmlal.u8        q10, d4,  d2
+        vmull.u8        q11, d7,  d3
+        vmlal.u8        q11, d5,  d2
+        vrshrn.u16      d24, q12, #3
+        vrshrn.u16      d25, q15, #3
+        vst1.8          {q12},    [r0,:128], r1
+        vrshrn.u16      d20, q10, #3
+        vrshrn.u16      d21, q11, #3
+        vst1.8          {q10},    [r0,:128], r1
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin8_h_neon, export=1
+        ldr             r3,  [sp, #4]           @ mx
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r12, [sp]               @ h
+1:
+        subs            r12, r12, #2
+        vld1.8          {q1},     [r2], r1
+        vext.8          d3,  d2,  d3,  #1
+        vmull.u8        q2,  d2,  d1
+        vmlal.u8        q2,  d3,  d0
+        vld1.8          {q3},     [r2], r1
+        vext.8          d7,  d6,  d7,  #1
+        vmull.u8        q8,  d6,  d1
+        vmlal.u8        q8,  d7,  d0
+        vrshrn.u16      d4,  q2,  #3
+        vrshrn.u16      d16, q8,  #3
+        vst1.8          {d4},     [r0,:64], r1
+        vst1.8          {d16},    [r0,:64], r1
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin8_v_neon, export=1
+        ldr             r3,  [sp, #8]           @ my
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r12, [sp]               @ h
+        vld1.8          {d2},     [r2], r1
+1:
+        subs            r12, r12, #2
+        vld1.8          {d3},     [r2], r1
+        vmull.u8        q2,  d2,  d1
+        vmlal.u8        q2,  d3,  d0
+        vld1.8          {d2},     [r2], r1
+        vmull.u8        q3,  d3,  d1
+        vmlal.u8        q3,  d2,  d0
+        vrshrn.u16      d4,  q2,  #3
+        vrshrn.u16      d6,  q3,  #3
+        vst1.8          {d4},     [r0,:64], r1
+        vst1.8          {d6},     [r0,:64], r1
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin8_hv_neon, export=1
+        ldr             r3,  [sp, #4]           @ mx
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r3,  [sp, #8]           @ my
+        rsb             r12, r3,  #8
+        vdup.8          d2,  r3
+        vdup.8          d3,  r12
+        ldr             r12, [sp]               @ h
+
+        vld1.8          {q2},     [r2], r1
+        vext.8          d5,  d4,  d5,  #1
+        vmull.u8        q9,  d4,  d1
+        vmlal.u8        q9,  d5,  d0
+        vrshrn.u16      d22, q9,  #3
+1:
+        subs            r12, r12, #2
+        vld1.8          {q3},     [r2], r1
+        vext.8          d7,  d6,  d7,  #1
+        vmull.u8        q8,  d6,  d1
+        vmlal.u8        q8,  d7,  d0
+        vld1.8          {q2},     [r2], r1
+        vext.8          d5,  d4,  d5,  #1
+        vmull.u8        q9,  d4,  d1
+        vmlal.u8        q9,  d5,  d0
+        vrshrn.u16      d16, q8,  #3
+        vmull.u8        q10, d22, d3
+        vmlal.u8        q10, d16, d2
+        vrshrn.u16      d22, q9,  #3
+        vmull.u8        q12, d16, d3
+        vmlal.u8        q12, d22, d2
+        vrshrn.u16      d20, q10, #3
+        vst1.8          {d20},    [r0,:64], r1
+        vrshrn.u16      d23, q12, #3
+        vst1.8          {d23},    [r0,:64], r1
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin4_h_neon, export=1
+        ldr             r3,  [sp, #4]           @ mx
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r12, [sp]               @ h
+1:
+        subs            r12, r12, #2
+        vld1.8          {d2},     [r2], r1
+        vext.8          d3,  d2,  d3,  #1
+        vld1.8          {d6},     [r2], r1
+        vext.8          d7,  d6,  d7,  #1
+        vtrn.32         q1,  q3
+        vmull.u8        q2,  d2,  d1
+        vmlal.u8        q2,  d3,  d0
+        vrshrn.u16      d4,  q2,  #3
+        vst1.32         {d4[0]},  [r0,:32], r1
+        vst1.32         {d4[1]}, [r0,:32], r1
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin4_v_neon, export=1
+        ldr             r3,  [sp, #8]           @ my
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r12, [sp]               @ h
+        vld1.32         {d2[]},   [r2], r1
+1:
+        vld1.32         {d3[]},   [r2]
+        vld1.32         {d2[1]},  [r2], r1
+        vld1.32         {d3[1]},  [r2], r1
+        vmull.u8        q2,  d2,  d1
+        vmlal.u8        q2,  d3,  d0
+        vtrn.32         d3,  d2
+        vrshrn.u16      d4,  q2,  #3
+        vst1.32         {d4[0]},  [r0,:32], r1
+        vst1.32         {d4[1]},  [r0,:32], r1
+        subs            r12, r12, #2
+        bgt             1b
+
+        bx              lr
+endfunc
+
+function ff_put_vp8_bilin4_hv_neon, export=1
+        ldr             r3,  [sp, #4]           @ mx
+        rsb             r12, r3,  #8
+        vdup.8          d0,  r3
+        vdup.8          d1,  r12
+        ldr             r3,  [sp, #8]           @ my
+        rsb             r12, r3,  #8
+        vdup.8          d2,  r3
+        vdup.8          d3,  r12
+        ldr             r12, [sp]               @ h
+
+        vld1.8          {d4},     [r2], r1
+        vext.8          d5,  d4,  d4,  #1
+        vmull.u8        q9,  d4,  d1
+        vmlal.u8        q9,  d5,  d0
+        vrshrn.u16      d22, q9,  #3
+1:
+        subs            r12, r12, #2
+        vld1.8          {d6},     [r2], r1
+        vext.8          d7,  d6,  d6,  #1
+        vld1.8          {d4},     [r2], r1
+        vext.8          d5,  d4,  d4,  #1
+        vtrn.32         q3,  q2
+        vmull.u8        q8,  d6,  d1
+        vmlal.u8        q8,  d7,  d0
+        vrshrn.u16      d16, q8,  #3
+        vmull.u8        q10, d16, d2
+        vtrn.32         d22, d16
+        vmlal.u8        q10, d22, d3
+        vrev64.32       d22, d16
+        vrshrn.u16      d20, q10, #3
+        vst1.32         {d20[0]}, [r0,:32], r1
+        vst1.32         {d20[1]}, [r0,:32], r1
+        bgt             1b
+
+        bx              lr
+endfunc
diff --git a/ffmpeg-mt/libavcodec/ass.c b/ffmpeg-mt/libavcodec/ass.c
index 7553bf0..beb1ba1 100644
--- a/ffmpeg-mt/libavcodec/ass.c
+++ b/ffmpeg-mt/libavcodec/ass.c
@@ -2,31 +2,46 @@
  * SSA/ASS common funtions
  * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avcodec.h"
 #include "ass.h"
 
-int ff_ass_subtitle_header(AVCodecContext *avctx,
-                           const char *font, int font_size,
-                           int color, int back_color,
-                           int bold, int italic, int underline,
-                           int alignment)
+/**
+ * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
+ *
+ * @param avctx pointer to the AVCodecContext
+ * @param font name of the default font face to use
+ * @param font_size default font size to use
+ * @param color default text color to use (ABGR)
+ * @param back_color default background color to use (ABGR)
+ * @param bold 1 for bold text, 0 for normal text
+ * @param italic 1 for italic text, 0 for normal text
+ * @param underline 1 for underline text, 0 for normal text
+ * @param alignment position of the text (left, center, top...), defined after
+ *                  the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top)
+ * @return >= 0 on success otherwise an error code <0
+ */
+static int ff_ass_subtitle_header(AVCodecContext *avctx,
+                                  const char *font, int font_size,
+                                  int color, int back_color,
+                                  int bold, int italic, int underline,
+                                  int alignment)
 {
     char header[512];
 
diff --git a/ffmpeg-mt/libavcodec/ass.h b/ffmpeg-mt/libavcodec/ass.h
index e04b4cc..d350cf3 100644
--- a/ffmpeg-mt/libavcodec/ass.h
+++ b/ffmpeg-mt/libavcodec/ass.h
@@ -2,20 +2,20 @@
  * SSA/ASS common funtions
  * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -40,27 +40,6 @@
 /** @} */
 
 /**
- * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
- *
- * @param avctx pointer to the AVCodecContext
- * @param font name of the default font face to use
- * @param font_size default font size to use
- * @param color default text color to use (ABGR)
- * @param back_color default background color to use (ABGR)
- * @param bold 1 for bold text, 0 for normal text
- * @param italic 1 for italic text, 0 for normal text
- * @param underline 1 for underline text, 0 for normal text
- * @param alignment position of the text (left, center, top...), defined after
- *                  the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top)
- * @return >= 0 on success otherwise an error code <0
- */
-int ff_ass_subtitle_header(AVCodecContext *avctx,
-                           const char *font, int font_size,
-                           int color, int back_color,
-                           int bold, int italic, int underline,
-                           int alignment);
-
-/**
  * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS
  * with default style.
  *
diff --git a/ffmpeg-mt/libavcodec/assdec.c b/ffmpeg-mt/libavcodec/assdec.c
index 0a7fd48..98f7be3 100644
--- a/ffmpeg-mt/libavcodec/assdec.c
+++ b/ffmpeg-mt/libavcodec/assdec.c
@@ -2,20 +2,20 @@
  * SSA/ASS decoder
  * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -52,7 +52,7 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
     return avpkt->size;
 }
 
-AVCodec ass_decoder = {
+AVCodec ff_ass_decoder = {
     .name         = "ass",
     .long_name    = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"),
     .type         = AVMEDIA_TYPE_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/assenc.c b/ffmpeg-mt/libavcodec/assenc.c
index c6f017c..b7836ff 100644
--- a/ffmpeg-mt/libavcodec/assenc.c
+++ b/ffmpeg-mt/libavcodec/assenc.c
@@ -2,20 +2,20 @@
  * SSA/ASS encoder
  * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -57,7 +57,7 @@ static int ass_encode_frame(AVCodecContext *avctx,
     return total_len;
 }
 
-AVCodec ass_encoder = {
+AVCodec ff_ass_encoder = {
     .name         = "ass",
     .long_name    = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"),
     .type         = AVMEDIA_TYPE_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/asv1.c b/ffmpeg-mt/libavcodec/asv1.c
index 6b1a093..cb07771 100644
--- a/ffmpeg-mt/libavcodec/asv1.c
+++ b/ffmpeg-mt/libavcodec/asv1.c
@@ -2,20 +2,20 @@
  * ASUS V1/V2 codec
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -613,7 +613,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec asv1_decoder = {
+AVCodec ff_asv1_decoder = {
     "asv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ASV1,
@@ -626,7 +626,7 @@ AVCodec asv1_decoder = {
     .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
 };
 
-AVCodec asv2_decoder = {
+AVCodec ff_asv2_decoder = {
     "asv2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ASV2,
@@ -640,7 +640,7 @@ AVCodec asv2_decoder = {
 };
 
 #if CONFIG_ASV1_ENCODER
-AVCodec asv1_encoder = {
+AVCodec ff_asv1_encoder = {
     "asv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ASV1,
@@ -654,7 +654,7 @@ AVCodec asv1_encoder = {
 #endif
 
 #if CONFIG_ASV2_ENCODER
-AVCodec asv2_encoder = {
+AVCodec ff_asv2_encoder = {
     "asv2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ASV2,
diff --git a/ffmpeg-mt/libavcodec/atrac.c b/ffmpeg-mt/libavcodec/atrac.c
index e398cee..2c39aad 100644
--- a/ffmpeg-mt/libavcodec/atrac.c
+++ b/ffmpeg-mt/libavcodec/atrac.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2008 Maxim Poliakovski
  * Copyright (c) 2006-2008 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,8 +32,8 @@
 #include "dsputil.h"
 #include "atrac.h"
 
-float sf_table[64];
-float qmf_window[48];
+float ff_atrac_sf_table[64];
+static float qmf_window[48];
 
 static const float qmf_48tap_half[24] = {
    -0.00001461907, -0.00009205479,-0.000056157569,0.00030117269,
@@ -54,9 +54,9 @@ void atrac_generate_tables(void)
     float s;
 
     /* Generate scale factors */
-    if (!sf_table[63])
+    if (!ff_atrac_sf_table[63])
         for (i=0 ; i<64 ; i++)
-            sf_table[i] = pow(2.0, (i - 15) / 3.0);
+            ff_atrac_sf_table[i] = pow(2.0, (i - 15) / 3.0);
 
     /* Generate the QMF window. */
     if (!qmf_window[47])
diff --git a/ffmpeg-mt/libavcodec/atrac.h b/ffmpeg-mt/libavcodec/atrac.h
index 0732da0..2223a5e 100644
--- a/ffmpeg-mt/libavcodec/atrac.h
+++ b/ffmpeg-mt/libavcodec/atrac.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Maxim Poliakovski
  * Copyright (c) 2009 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,9 +28,7 @@
 #ifndef AVCODEC_ATRAC_H
 #define AVCODEC_ATRAC_H
 
-
-extern float sf_table[64];
-extern float qmf_window[48];
+extern float ff_atrac_sf_table[64];
 
 void atrac_generate_tables(void);
 void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp);
diff --git a/ffmpeg-mt/libavcodec/atrac1.c b/ffmpeg-mt/libavcodec/atrac1.c
index 513ecc7..d6c7053 100644
--- a/ffmpeg-mt/libavcodec/atrac1.c
+++ b/ffmpeg-mt/libavcodec/atrac1.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Maxim Poliakovski
  * Copyright (c) 2009 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,6 +36,7 @@
 #include "get_bits.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "sinewin.h"
 
 #include "atrac.h"
 #include "atrac1data.h"
@@ -99,7 +100,7 @@ static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits,
         for (i = 0; i < transf_size / 2; i++)
             FFSWAP(float, spec[i], spec[transf_size - 1 - i]);
     }
-    ff_imdct_half(mdct_context, out, spec);
+    mdct_context->imdct_half(mdct_context, out, spec);
 }
 
 
@@ -141,7 +142,7 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q)
 
             /* overlap and window */
             q->dsp.vector_fmul_window(&q->bands[band_num][start_pos], prev_buf,
-                                      &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 0, 16);
+                                      &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 16);
 
             prev_buf = &su->spectrum[0][ref_pos+start_pos + 16];
             start_pos += block_size;
@@ -223,7 +224,7 @@ static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su,
 
             int num_specs = specs_per_bfu[bfu_num];
             int word_len  = !!idwls[bfu_num] + idwls[bfu_num];
-            float scale_factor = sf_table[idsfs[bfu_num]];
+            float scale_factor = ff_atrac_sf_table[idsfs[bfu_num]];
             bits_used += word_len * num_specs; /* add number of bits consumed by current BFU */
 
             /* check for bitstream overflow */
@@ -365,7 +366,7 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx) {
 }
 
 
-AVCodec atrac1_decoder = {
+AVCodec ff_atrac1_decoder = {
     .name = "atrac1",
     .type = AVMEDIA_TYPE_AUDIO,
     .id = CODEC_ID_ATRAC1,
diff --git a/ffmpeg-mt/libavcodec/atrac1data.h b/ffmpeg-mt/libavcodec/atrac1data.h
index ebebe4b..7d5dbeb 100644
--- a/ffmpeg-mt/libavcodec/atrac1data.h
+++ b/ffmpeg-mt/libavcodec/atrac1data.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Maxim Poliakovski
  * Copyright (c) 2009 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/atrac3.c b/ffmpeg-mt/libavcodec/atrac3.c
index 797e1f1..5633520 100644
--- a/ffmpeg-mt/libavcodec/atrac3.c
+++ b/ffmpeg-mt/libavcodec/atrac3.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2008 Maxim Poliakovski
  * Copyright (c) 2006-2008 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -146,7 +146,7 @@ static void IMLT(ATRAC3Context *q, float *pInput, float *pOutput, int odd_band)
         /**
         * Reverse the odd bands before IMDCT, this is an effect of the QMF transform
         * or it gives better compression to do it this way.
-        * FIXME: It should be possible to handle this in ff_imdct_calc
+        * FIXME: It should be possible to handle this in imdct_calc
         * for that to happen a modification of the prerotation step of
         * all SIMD code and C code is needed.
         * Or fix the functions before so they generate a pre reversed spectrum.
@@ -156,10 +156,10 @@ static void IMLT(ATRAC3Context *q, float *pInput, float *pOutput, int odd_band)
             FFSWAP(float, pInput[i], pInput[255-i]);
     }
 
-    ff_imdct_calc(&q->mdct_ctx,pOutput,pInput);
+    q->mdct_ctx.imdct_calc(&q->mdct_ctx,pOutput,pInput);
 
     /* Perform windowing on the output. */
-    dsp.vector_fmul(pOutput,mdct_window,512);
+    dsp.vector_fmul(pOutput, pOutput, mdct_window, 512);
 
 }
 
@@ -327,7 +327,7 @@ static int decodeSpectrum (GetBitContext *gb, float *pOut)
             readQuantSpectralCoeffs (gb, subband_vlc_index[cnt], codingMode, mantissas, subbWidth);
 
             /* Decode the scale factor for this subband. */
-            SF = sf_table[SF_idxs[cnt]] * iMaxQuant[subband_vlc_index[cnt]];
+            SF = ff_atrac_sf_table[SF_idxs[cnt]] * iMaxQuant[subband_vlc_index[cnt]];
 
             /* Inverse quantize the coefficients. */
             for (pIn=mantissas ; first<last; first++, pIn++)
@@ -400,7 +400,7 @@ static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent
                 coded_values = coded_values_per_component + 1;
                 coded_values = FFMIN(max_coded_values,coded_values);
 
-                scalefactor = sf_table[sfIndx] * iMaxQuant[quant_step_index];
+                scalefactor = ff_atrac_sf_table[sfIndx] * iMaxQuant[quant_step_index];
 
                 readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values);
 
@@ -1019,7 +1019,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
 }
 
 
-AVCodec atrac3_decoder =
+AVCodec ff_atrac3_decoder =
 {
     .name = "atrac3",
     .type = AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/atrac3data.h b/ffmpeg-mt/libavcodec/atrac3data.h
index b5aa71f..9076d3a 100644
--- a/ffmpeg-mt/libavcodec/atrac3data.h
+++ b/ffmpeg-mt/libavcodec/atrac3data.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2007 Maxim Poliakovski
  * Copyright (c) 2006-2007 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/audioconvert.c b/ffmpeg-mt/libavcodec/audioconvert.c
index b29b030..c5977b6 100644
--- a/ffmpeg-mt/libavcodec/audioconvert.c
+++ b/ffmpeg-mt/libavcodec/audioconvert.c
@@ -2,20 +2,20 @@
  * audio conversion
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 
 #include "libavutil/avstring.h"
 #include "libavutil/libm.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/samplefmt.h"
 #include "avcodec.h"
 #include "audioconvert.h"
 
diff --git a/ffmpeg-mt/libavcodec/audioconvert.h b/ffmpeg-mt/libavcodec/audioconvert.h
index be4867c..e9a78fe 100644
--- a/ffmpeg-mt/libavcodec/audioconvert.h
+++ b/ffmpeg-mt/libavcodec/audioconvert.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2008 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,6 +31,7 @@
 
 #include "libavutil/cpu.h"
 #include "avcodec.h"
+#include "libavutil/audioconvert.h"
 
 #if FF_API_OLD_SAMPLE_FMT
 /**
diff --git a/ffmpeg-mt/libavcodec/aura.c b/ffmpeg-mt/libavcodec/aura.c
index 8942cdd..e85e822 100644
--- a/ffmpeg-mt/libavcodec/aura.c
+++ b/ffmpeg-mt/libavcodec/aura.c
@@ -1,20 +1,20 @@
 /*
  * Aura 2 decoder
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -122,7 +122,7 @@ static av_cold int aura_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec aura2_decoder = {
+AVCodec ff_aura2_decoder = {
     "aura2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_AURA2,
diff --git a/ffmpeg-mt/libavcodec/avcodec.h b/ffmpeg-mt/libavcodec/avcodec.h
index cfd17b0..a650b64 100644
--- a/ffmpeg-mt/libavcodec/avcodec.h
+++ b/ffmpeg-mt/libavcodec/avcodec.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,61 +27,11 @@
  */
 
 #include <errno.h>
-#include "libavcore/samplefmt.h"
+#include "libavutil/samplefmt.h"
 #include "libavutil/avutil.h"
 #include "libavutil/cpu.h"
 
-#define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 108
-#define LIBAVCODEC_VERSION_MICRO  0
-
-#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-                                               LIBAVCODEC_VERSION_MINOR, \
-                                               LIBAVCODEC_VERSION_MICRO)
-#define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
-                                           LIBAVCODEC_VERSION_MINOR,    \
-                                           LIBAVCODEC_VERSION_MICRO)
-#define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
-
-#define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
-
-/**
- * Those FF_API_* defines are not part of public API.
- * They may change, break or disappear at any time.
- */
-#ifndef FF_API_PALETTE_CONTROL
-#define FF_API_PALETTE_CONTROL  (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_MM_FLAGS
-#define FF_API_MM_FLAGS         (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_OPT_SHOW
-#define FF_API_OPT_SHOW         (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_AUDIO_OLD
-#define FF_API_AUDIO_OLD        (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_VIDEO_OLD
-#define FF_API_VIDEO_OLD        (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_SUBTITLE_OLD
-#define FF_API_SUBTITLE_OLD     (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_USE_LPC
-#define FF_API_USE_LPC          (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_SET_STRING_OLD
-#define FF_API_SET_STRING_OLD   (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_INOFFICIAL
-#define FF_API_INOFFICIAL       (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_OLD_SAMPLE_FMT
-#define FF_API_OLD_SAMPLE_FMT   (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_OLD_AUDIOCONVERT
-#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53)
-#endif
+#include "libavcodec/version.h"
 
 #if LIBAVCODEC_VERSION_MAJOR < 53
 #   define FF_INTERNALC_MEM_TYPE unsigned int
@@ -260,6 +210,9 @@ enum CodecID {
     CODEC_ID_R10K,
     CODEC_ID_MXPEG,
     CODEC_ID_LAGARITH,
+    CODEC_ID_PRORES,
+    CODEC_ID_JV,
+    CODEC_ID_DFA,
 
     /* various PCM "codecs" */
     CODEC_ID_PCM_S16LE= 0x10000,
@@ -388,6 +341,7 @@ enum CodecID {
     CODEC_ID_BINKAUDIO_RDFT,
     CODEC_ID_BINKAUDIO_DCT,
     CODEC_ID_AAC_LATM,
+    CODEC_ID_QDMC,
 
     /* subtitle codecs */
     CODEC_ID_DVD_SUBTITLE= 0x17000,
@@ -435,7 +389,7 @@ enum CodecID {
 #endif
 
 #if FF_API_OLD_AUDIOCONVERT
-#include "libavcore/audioconvert.h"
+#include "libavutil/audioconvert.h"
 
 /* Audio channel masks */
 #define CH_FRONT_LEFT            AV_CH_FRONT_LEFT
@@ -593,6 +547,19 @@ enum AVLPCType {
     AV_LPC_TYPE_NB              , ///< Not part of ABI
 };
 
+enum AVAudioServiceType {
+    AV_AUDIO_SERVICE_TYPE_MAIN              = 0,
+    AV_AUDIO_SERVICE_TYPE_EFFECTS           = 1,
+    AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
+    AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED  = 3,
+    AV_AUDIO_SERVICE_TYPE_DIALOGUE          = 4,
+    AV_AUDIO_SERVICE_TYPE_COMMENTARY        = 5,
+    AV_AUDIO_SERVICE_TYPE_EMERGENCY         = 6,
+    AV_AUDIO_SERVICE_TYPE_VOICE_OVER        = 7,
+    AV_AUDIO_SERVICE_TYPE_KARAOKE           = 8,
+    AV_AUDIO_SERVICE_TYPE_NB                   , ///< Not part of ABI
+};
+
 typedef struct RcOverride{
     int start_frame;
     int end_frame;
@@ -1044,7 +1011,7 @@ typedef struct AVPanScan{
      * - encoding: Set by libavcodec.\
      * - decoding: Set by libavcodec.\
      */\
-    void *thread_opaque;
+    void *thread_opaque;\
 
 #define FF_QSCALE_TYPE_MPEG1 0
 #define FF_QSCALE_TYPE_MPEG2 1
@@ -1243,13 +1210,15 @@ typedef struct AVCodecContext {
      */
     enum PixelFormat pix_fmt;
 
+#if FF_API_RATE_EMU
     /**
      * Frame rate emulation. If not zero, the lower layer (i.e. format handler)
      * has to read frames at native frame rate.
      * - encoding: Set by user.
      * - decoding: unused
      */
-    int rate_emu;
+    attribute_deprecated int rate_emu;
+#endif
 
     /**
      * If non NULL, 'draw_horiz_band' is called by the libavcodec
@@ -1258,7 +1227,7 @@ typedef struct AVCodecContext {
      * beforehand.
      * When multithreading is used, it may be called from multiple threads
      * at the same time; threads might draw different parts of the same AVFrame,
-     * or multiple AVFrame, and there is no guarantee that slices will be drawn
+     * or multiple AVFrames, and there is no guarantee that slices will be drawn
      * in order.
      * The function is also used by hardware acceleration APIs.
      * It is called at least once during frame decoding to pass
@@ -1355,13 +1324,15 @@ typedef struct AVCodecContext {
 
     int b_frame_strategy;
 
+#if FF_API_HURRY_UP
     /**
      * hurry up amount
      * - encoding: unused
      * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
      * @deprecated Deprecated in favor of skip_idct and skip_frame.
      */
-    int hurry_up;
+    attribute_deprecated int hurry_up;
+#endif
 
     struct AVCodec *codec;
 
@@ -1514,7 +1485,7 @@ typedef struct AVCodecContext {
      * avcodec_default_get_buffer() instead of providing buffers allocated by
      * some other means.
      * If frame multithreading is used and thread_safe_callbacks is set,
-     * it may be called from a different thread, but not from more than at once.
+     * it may be called from a different thread, but not from more than one at once.
      * Does not need to be reentrant.
      * - encoding: unused
      * - decoding: Set by libavcodec, user can override.
@@ -1525,9 +1496,8 @@ typedef struct AVCodecContext {
      * Called to release buffers which were allocated with get_buffer.
      * A released buffer can be reused in get_buffer().
      * pic.data[*] must be set to NULL.
-     * May be called from a different thread if thread_type==FF_THREAD_FRAME
-     * is set, but not by more than one thread at once, so does not need to be
-     * reentrant.
+     * May be called from a different thread if frame multithreading is used,
+     * but not by more than one thread at once, so does not need to be reentrant.
      * - encoding: unused
      * - decoding: Set by libavcodec, user can override.
      */
@@ -1850,19 +1820,21 @@ typedef struct AVCodecContext {
      */
     uint64_t error[4];
 
+#if FF_API_MB_Q
     /**
      * minimum MB quantizer
      * - encoding: unused
      * - decoding: unused
      */
-    int mb_qmin;
+    attribute_deprecated int mb_qmin;
 
     /**
      * maximum MB quantizer
      * - encoding: unused
      * - decoding: unused
      */
-    int mb_qmax;
+    attribute_deprecated int mb_qmax;
+#endif
 
     /**
      * motion estimation comparison function
@@ -2183,16 +2155,19 @@ typedef struct AVCodecContext {
      */
     int error_rate;
 
+#if FF_API_ANTIALIAS_ALGO
     /**
      * MP3 antialias algorithm, see FF_AA_* below.
      * - encoding: unused
      * - decoding: Set by user.
      */
-    int antialias_algo;
+    attribute_deprecated int antialias_algo;
 #define FF_AA_AUTO    0
 #define FF_AA_FASTINT 1 //not implemented yet
 #define FF_AA_INT     2
 #define FF_AA_FLOAT   3
+#endif
+
     /**
      * quantizer noise shaping
      * - encoding: Set by user.
@@ -2278,6 +2253,7 @@ typedef struct AVCodecContext {
      */
      int profile;
 #define FF_PROFILE_UNKNOWN -99
+#define FF_PROFILE_RESERVED -100
 
 #define FF_PROFILE_AAC_MAIN 0
 #define FF_PROFILE_AAC_LOW  1
@@ -2290,14 +2266,34 @@ typedef struct AVCodecContext {
 #define FF_PROFILE_DTS_HD_HRA  50
 #define FF_PROFILE_DTS_HD_MA   60
 
-#define FF_PROFILE_H264_BASELINE    66
-#define FF_PROFILE_H264_MAIN        77
-#define FF_PROFILE_H264_EXTENDED    88
-#define FF_PROFILE_H264_HIGH        100
-#define FF_PROFILE_H264_HIGH_10     110
-#define FF_PROFILE_H264_HIGH_422    122
-#define FF_PROFILE_H264_HIGH_444    244
-#define FF_PROFILE_H264_CAVLC_444   44
+#define FF_PROFILE_MPEG2_422    0
+#define FF_PROFILE_MPEG2_HIGH   1
+#define FF_PROFILE_MPEG2_SS     2
+#define FF_PROFILE_MPEG2_SNR_SCALABLE  3
+#define FF_PROFILE_MPEG2_MAIN   4
+#define FF_PROFILE_MPEG2_SIMPLE 5
+
+#define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
+#define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
+
+#define FF_PROFILE_H264_BASELINE             66
+#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
+#define FF_PROFILE_H264_MAIN                 77
+#define FF_PROFILE_H264_EXTENDED             88
+#define FF_PROFILE_H264_HIGH                 100
+#define FF_PROFILE_H264_HIGH_10              110
+#define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_HIGH_422             122
+#define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_HIGH_444             144
+#define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
+#define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_CAVLC_444            44
+
+#define FF_PROFILE_VC1_SIMPLE   0
+#define FF_PROFILE_VC1_MAIN     1
+#define FF_PROFILE_VC1_COMPLEX  2
+#define FF_PROFILE_VC1_ADVANCED 3
 
     /**
      * level
@@ -2596,7 +2592,7 @@ typedef struct AVCodecContext {
      */
     int64_t timecode_frame_start;
 
-#if LIBAVCODEC_VERSION_MAJOR < 53
+#if FF_API_REQUEST_CHANNELS
     /**
      * Decoder should decode to this many channels if it can (0 for default)
      * - encoding: unused
@@ -2885,6 +2881,21 @@ typedef struct AVCodecContext {
      * - decoding: Set by user.
      */
     int thread_safe_callbacks;
+
+    /**
+     * VBV delay coded in the last frame (in periods of a 27 MHz clock).
+     * Used for compliant TS muxing.
+     * - encoding: Set by libavcodec.
+     * - decoding: unused.
+     */
+    uint64_t vbv_delay;
+
+    /**
+     * Type of service that the audio stream conveys.
+     * - encoding: Set by user.
+     * - decoding: Set by libavcodec.
+     */
+    enum AVAudioServiceType audio_service_type;
 } AVCodecContext;
 
 /**
@@ -3209,8 +3220,9 @@ typedef struct ReSampleContext ReSampleContext;
 attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels,
                                                           int output_rate, int input_rate);
 #endif
+
 /**
- *  Initialize audio resampling context
+ *  Initialize audio resampling context.
  *
  * @param output_channels  number of output channels
  * @param input_channels   number of input channels
@@ -3218,9 +3230,9 @@ attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, i
  * @param input_rate       input sample rate
  * @param sample_fmt_out   requested output sample format
  * @param sample_fmt_in    input sample format
- * @param filter_length    length of each FIR filter in the filterbank relative to the cutoff freq
+ * @param filter_length    length of each FIR filter in the filterbank relative to the cutoff frequency
  * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
- * @param linear           If 1 then the used FIR filter will be linearly interpolated
+ * @param linear           if 1 then the used FIR filter will be linearly interpolated
                            between the 2 closest, if 0 the closest will be used
  * @param cutoff           cutoff frequency, 1.0 corresponds to half the output sampling rate
  * @return allocated ReSampleContext, NULL if error occured
@@ -3233,6 +3245,13 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
                                         int linear, double cutoff);
 
 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
+
+/**
+ * Free resample context.
+ *
+ * @param s a non-NULL pointer to a resample context previously
+ *          created with av_audio_resample_init()
+ */
 void audio_resample_close(ReSampleContext *s);
 
 
@@ -3632,8 +3651,14 @@ int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
 
 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
+/**
+ * @deprecated Set s->thread_count before calling avcodec_open() instead of calling this.
+ */
+attribute_deprecated
 int avcodec_thread_init(AVCodecContext *s, int thread_count);
 void avcodec_thread_free(AVCodecContext *s);
+#endif
 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
 //FIXME func typedef
@@ -4223,7 +4248,7 @@ attribute_deprecated int av_parse_video_frame_rate(AVRational *frame_rate, const
 
 /**
  * Logs a generic warning message about a missing feature. This function is
- * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
+ * intended to be used internally by Libav (libavcodec, libavformat, etc.)
  * only, and would normally not be used by applications.
  * @param[in] avc a pointer to an arbitrary struct of which the first field is
  * a pointer to an AVClass struct
@@ -4237,7 +4262,7 @@ void av_log_missing_feature(void *avc, const char *feature, int want_sample);
 
 /**
  * Log a generic warning message asking for a sample. This function is
- * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
+ * intended to be used internally by Libav (libavcodec, libavformat, etc.)
  * only, and would normally not be used by applications.
  * @param[in] avc a pointer to an arbitrary struct of which the first field is
  * a pointer to an AVClass struct
@@ -4274,7 +4299,7 @@ enum AVLockOp {
  * lockmgr should store/get a pointer to a user allocated mutex. It's
  * NULL upon AV_LOCK_CREATE and != NULL for all other ops.
  *
- * @param cb User defined callback. Note: FFmpeg may invoke calls to this
+ * @param cb User defined callback. Note: Libav may invoke calls to this
  *           callback during the call to av_lockmgr_register().
  *           Thus, the application must be prepared to handle that.
  *           If cb is set to NULL the lockmgr will be unregistered.
diff --git a/ffmpeg-mt/libavcodec/avfft.c b/ffmpeg-mt/libavcodec/avfft.c
index 7d5d083..9ed06fb 100644
--- a/ffmpeg-mt/libavcodec/avfft.c
+++ b/ffmpeg-mt/libavcodec/avfft.c
@@ -1,24 +1,26 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/mem.h"
 #include "avfft.h"
 #include "fft.h"
+#include "rdft.h"
+#include "dct.h"
 
 /* FFT */
 
@@ -101,7 +103,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
 
 void av_rdft_calc(RDFTContext *s, FFTSample *data)
 {
-    ff_rdft_calc(s, data);
+    s->rdft_calc(s, data);
 }
 
 void av_rdft_end(RDFTContext *s)
@@ -128,7 +130,7 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
 
 void av_dct_calc(DCTContext *s, FFTSample *data)
 {
-    ff_dct_calc(s, data);
+    s->dct_calc(s, data);
 }
 
 void av_dct_end(DCTContext *s)
diff --git a/ffmpeg-mt/libavcodec/avfft.h b/ffmpeg-mt/libavcodec/avfft.h
index be2d9c7..91fe2f4 100644
--- a/ffmpeg-mt/libavcodec/avfft.h
+++ b/ffmpeg-mt/libavcodec/avfft.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/avpacket.c b/ffmpeg-mt/libavcodec/avpacket.c
index 82890c3..f6aef20 100644
--- a/ffmpeg-mt/libavcodec/avpacket.c
+++ b/ffmpeg-mt/libavcodec/avpacket.c
@@ -2,20 +2,20 @@
  * AVPacket functions for libavcodec
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/avr32/mathops.h b/ffmpeg-mt/libavcodec/avr32/mathops.h
index 85f42b5..528b7ad 100644
--- a/ffmpeg-mt/libavcodec/avr32/mathops.h
+++ b/ffmpeg-mt/libavcodec/avr32/mathops.h
@@ -2,20 +2,20 @@
  * Simple math operations
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/avs.c b/ffmpeg-mt/libavcodec/avs.c
index f65a25a..5520135 100644
--- a/ffmpeg-mt/libavcodec/avs.c
+++ b/ffmpeg-mt/libavcodec/avs.c
@@ -2,20 +2,20 @@
  * AVS video decoder.
  * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -150,7 +150,7 @@ static av_cold int avs_decode_init(AVCodecContext * avctx)
     return 0;
 }
 
-AVCodec avs_decoder = {
+AVCodec ff_avs_decoder = {
     "avs",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_AVS,
diff --git a/ffmpeg-mt/libavcodec/bethsoftvideo.c b/ffmpeg-mt/libavcodec/bethsoftvideo.c
index 0ba39e6..d294bbf 100644
--- a/ffmpeg-mt/libavcodec/bethsoftvideo.c
+++ b/ffmpeg-mt/libavcodec/bethsoftvideo.c
@@ -2,20 +2,20 @@
  * Bethesda VID video decoder
  * Copyright (C) 2007 Nicholas Tung
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -130,7 +130,7 @@ static av_cold int bethsoftvid_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec bethsoftvid_decoder = {
+AVCodec ff_bethsoftvid_decoder = {
     .name = "bethsoftvid",
     .type = AVMEDIA_TYPE_VIDEO,
     .id = CODEC_ID_BETHSOFTVID,
diff --git a/ffmpeg-mt/libavcodec/bethsoftvideo.h b/ffmpeg-mt/libavcodec/bethsoftvideo.h
index d5b5d0a..5cbbdfd 100644
--- a/ffmpeg-mt/libavcodec/bethsoftvideo.h
+++ b/ffmpeg-mt/libavcodec/bethsoftvideo.h
@@ -2,20 +2,20 @@
  * Bethesda VID video decoder
  * Copyright (C) 2007 Nicholas Tung
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bfi.c b/ffmpeg-mt/libavcodec/bfi.c
index ca72c1f..312921f 100644
--- a/ffmpeg-mt/libavcodec/bfi.c
+++ b/ffmpeg-mt/libavcodec/bfi.c
@@ -2,20 +2,20 @@
  * Brute Force & Ignorance (BFI) video decoder
  * Copyright (c) 2008 Sisir Koppaka
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -180,7 +180,7 @@ static av_cold int bfi_decode_close(AVCodecContext * avctx)
     return 0;
 }
 
-AVCodec bfi_decoder = {
+AVCodec ff_bfi_decoder = {
     .name = "bfi",
     .type = AVMEDIA_TYPE_VIDEO,
     .id = CODEC_ID_BFI,
diff --git a/ffmpeg-mt/libavcodec/bfin/config_bfin.h b/ffmpeg-mt/libavcodec/bfin/config_bfin.h
index f3a2c6e..0fee494 100644
--- a/ffmpeg-mt/libavcodec/bfin/config_bfin.h
+++ b/ffmpeg-mt/libavcodec/bfin/config_bfin.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 /*
diff --git a/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.c b/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.c
index a667deb..65d0308 100644
--- a/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.c
+++ b/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.c
@@ -4,20 +4,20 @@
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  * Copyright (c) 2006 Michael Benjamin <michael.benjamin at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.h b/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.h
index 7edcf97..f1a9b32 100644
--- a/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.h
+++ b/ffmpeg-mt/libavcodec/bfin/dsputil_bfin.h
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2007 Marc Hoffman <mmh at pleasantst.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bfin/fdct_bfin.S b/ffmpeg-mt/libavcodec/bfin/fdct_bfin.S
index 0eac7a3..4c32436 100644
--- a/ffmpeg-mt/libavcodec/bfin/fdct_bfin.S
+++ b/ffmpeg-mt/libavcodec/bfin/fdct_bfin.S
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 /*
diff --git a/ffmpeg-mt/libavcodec/bfin/idct_bfin.S b/ffmpeg-mt/libavcodec/bfin/idct_bfin.S
index 04f9159..b3dedd3 100644
--- a/ffmpeg-mt/libavcodec/bfin/idct_bfin.S
+++ b/ffmpeg-mt/libavcodec/bfin/idct_bfin.S
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 /*
diff --git a/ffmpeg-mt/libavcodec/bfin/mathops.h b/ffmpeg-mt/libavcodec/bfin/mathops.h
index a0e808c..db527bf 100644
--- a/ffmpeg-mt/libavcodec/bfin/mathops.h
+++ b/ffmpeg-mt/libavcodec/bfin/mathops.h
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2007 Marc Hoffman <mmhoffm at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVCODEC_BFIN_MATHOPS_H
diff --git a/ffmpeg-mt/libavcodec/bfin/mpegvideo_bfin.c b/ffmpeg-mt/libavcodec/bfin/mpegvideo_bfin.c
index 0373e22..ad68876 100644
--- a/ffmpeg-mt/libavcodec/bfin/mpegvideo_bfin.c
+++ b/ffmpeg-mt/libavcodec/bfin/mpegvideo_bfin.c
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2007 Marc Hoffman <mmh at pleasantst.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bfin/pixels_bfin.S b/ffmpeg-mt/libavcodec/bfin/pixels_bfin.S
index 69b493b..085ff46 100644
--- a/ffmpeg-mt/libavcodec/bfin/pixels_bfin.S
+++ b/ffmpeg-mt/libavcodec/bfin/pixels_bfin.S
@@ -2,20 +2,20 @@
  * Blackfin Pixel Operations
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "config_bfin.h"
diff --git a/ffmpeg-mt/libavcodec/bfin/vp3_bfin.c b/ffmpeg-mt/libavcodec/bfin/vp3_bfin.c
index dfe34c5..4b08042 100644
--- a/ffmpeg-mt/libavcodec/bfin/vp3_bfin.c
+++ b/ffmpeg-mt/libavcodec/bfin/vp3_bfin.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bfin/vp3_idct_bfin.S b/ffmpeg-mt/libavcodec/bfin/vp3_idct_bfin.S
index 21f732c..4c678f1 100644
--- a/ffmpeg-mt/libavcodec/bfin/vp3_idct_bfin.S
+++ b/ffmpeg-mt/libavcodec/bfin/vp3_idct_bfin.S
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 /*
diff --git a/ffmpeg-mt/libavcodec/bgmc.c b/ffmpeg-mt/libavcodec/bgmc.c
index b9041d0..b8aaa8d 100644
--- a/ffmpeg-mt/libavcodec/bgmc.c
+++ b/ffmpeg-mt/libavcodec/bgmc.c
@@ -2,20 +2,20 @@
  * Block Gilbert-Moore decoder
  * Copyright (c) 2010 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bgmc.h b/ffmpeg-mt/libavcodec/bgmc.h
index 9e386fd..3d5b490 100644
--- a/ffmpeg-mt/libavcodec/bgmc.h
+++ b/ffmpeg-mt/libavcodec/bgmc.h
@@ -2,20 +2,20 @@
  * Block Gilbert-Moore decoder
  * Copyright (c) 2010 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bink.c b/ffmpeg-mt/libavcodec/bink.c
index 0129403..34d4d10 100644
--- a/ffmpeg-mt/libavcodec/bink.c
+++ b/ffmpeg-mt/libavcodec/bink.c
@@ -1,25 +1,26 @@
 /*
  * Bink video decoder
  * Copyright (c) 2009 Konstantin Shishkov
+ * Copyright (C) 2011 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "binkdata.h"
@@ -34,6 +35,35 @@
 static VLC bink_trees[16];
 
 /**
+ * IDs for different data types used in old version of Bink video codec
+ */
+enum OldSources {
+    BINKB_SRC_BLOCK_TYPES = 0, ///< 8x8 block types
+    BINKB_SRC_COLORS,          ///< pixel values used for different block types
+    BINKB_SRC_PATTERN,         ///< 8-bit values for 2-colour pattern fill
+    BINKB_SRC_X_OFF,           ///< X components of motion value
+    BINKB_SRC_Y_OFF,           ///< Y components of motion value
+    BINKB_SRC_INTRA_DC,        ///< DC values for intrablocks with DCT
+    BINKB_SRC_INTER_DC,        ///< DC values for interblocks with DCT
+    BINKB_SRC_INTRA_Q,         ///< quantizer values for intrablocks with DCT
+    BINKB_SRC_INTER_Q,         ///< quantizer values for interblocks with DCT
+    BINKB_SRC_INTER_COEFS,     ///< number of coefficients for residue blocks
+
+    BINKB_NB_SRC
+};
+
+static const int binkb_bundle_sizes[BINKB_NB_SRC] = {
+    4, 8, 8, 5, 5, 11, 11, 4, 4, 7
+};
+
+static const int binkb_bundle_signed[BINKB_NB_SRC] = {
+    0, 0, 0, 1, 1, 0, 1, 0, 0, 0
+};
+
+static uint32_t binkb_intra_quant[16][64];
+static uint32_t binkb_inter_quant[16][64];
+
+/**
  * IDs for different data types used in Bink video codec
  */
 enum Sources {
@@ -85,7 +115,7 @@ typedef struct BinkContext {
     int            swap_planes;
     ScanTable      scantable;            ///< permutated scantable for DCT coeffs decoding
 
-    Bundle         bundle[BINK_NB_SRC];  ///< bundles for decoding all data types
+    Bundle         bundle[BINKB_NB_SRC]; ///< bundles for decoding all data types
     Tree           col_high[16];         ///< trees for decoding high nibble in "colours" data type
     int            col_lastval;          ///< value of last decoded high nibble in "colours" data type
 } BinkContext;
@@ -145,7 +175,7 @@ static av_cold void init_bundles(BinkContext *c)
     bh = (c->avctx->height + 7) >> 3;
     blocks = bw * bh;
 
-    for (i = 0; i < BINK_NB_SRC; i++) {
+    for (i = 0; i < BINKB_NB_SRC; i++) {
         c->bundle[i].data = av_malloc(blocks * 64);
         c->bundle[i].data_end = c->bundle[i].data + blocks * 64;
     }
@@ -159,7 +189,7 @@ static av_cold void init_bundles(BinkContext *c)
 static av_cold void free_bundles(BinkContext *c)
 {
     int i;
-    for (i = 0; i < BINK_NB_SRC; i++)
+    for (i = 0; i < BINKB_NB_SRC; i++)
         av_freep(&c->bundle[i].data);
 }
 
@@ -470,7 +500,7 @@ static int read_dcs(AVCodecContext *avctx, GetBitContext *gb, Bundle *b,
  */
 static inline int get_value(BinkContext *c, int bundle)
 {
-    int16_t ret;
+    int ret;
 
     if (bundle < BINK_SRC_X_OFF || bundle == BINK_SRC_RUN)
         return *c->bundle[bundle].cur_ptr++;
@@ -481,17 +511,77 @@ static inline int get_value(BinkContext *c, int bundle)
     return ret;
 }
 
+static void binkb_init_bundle(BinkContext *c, int bundle_num)
+{
+    c->bundle[bundle_num].cur_dec =
+    c->bundle[bundle_num].cur_ptr = c->bundle[bundle_num].data;
+    c->bundle[bundle_num].len = 13;
+}
+
+static void binkb_init_bundles(BinkContext *c)
+{
+    int i;
+    for (i = 0; i < BINKB_NB_SRC; i++)
+        binkb_init_bundle(c, i);
+}
+
+static int binkb_read_bundle(BinkContext *c, GetBitContext *gb, int bundle_num)
+{
+    const int bits = binkb_bundle_sizes[bundle_num];
+    const int mask = 1 << (bits - 1);
+    const int issigned = binkb_bundle_signed[bundle_num];
+    Bundle *b = &c->bundle[bundle_num];
+    int i, len;
+
+    CHECK_READ_VAL(gb, b, len);
+    if (bits <= 8) {
+        if (!issigned) {
+            for (i = 0; i < len; i++)
+                *b->cur_dec++ = get_bits(gb, bits);
+        } else {
+            for (i = 0; i < len; i++)
+                *b->cur_dec++ = get_bits(gb, bits) - mask;
+        }
+    } else {
+        int16_t *dst = (int16_t*)b->cur_dec;
+
+        if (!issigned) {
+            for (i = 0; i < len; i++)
+                *dst++ = get_bits(gb, bits);
+        } else {
+            for (i = 0; i < len; i++)
+                *dst++ = get_bits(gb, bits) - mask;
+        }
+        b->cur_dec = (uint8_t*)dst;
+    }
+    return 0;
+}
+
+static inline int binkb_get_value(BinkContext *c, int bundle_num)
+{
+    int16_t ret;
+    const int bits = binkb_bundle_sizes[bundle_num];
+
+    if (bits <= 8) {
+        int val = *c->bundle[bundle_num].cur_ptr++;
+        return binkb_bundle_signed[bundle_num] ? (int8_t)val : val;
+    }
+    ret = *(int16_t*)c->bundle[bundle_num].cur_ptr;
+    c->bundle[bundle_num].cur_ptr += 2;
+    return ret;
+}
+
 /**
  * Read 8x8 block of DCT coefficients.
  *
  * @param gb       context for reading bits
  * @param block    place for storing coefficients
  * @param scan     scan order table
- * @param is_intra tells what set of quantizer matrices to use
+ * @param quant_matrices quantization matrices
  * @return 0 for success, negative value in other cases
  */
 static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *scan,
-                           int is_intra)
+                           const uint32_t quant_matrices[16][64], int q)
 {
     int coef_list[128];
     int mode_list[128];
@@ -571,9 +661,14 @@ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *
         }
     }
 
-    quant_idx = get_bits(gb, 4);
-    quant = is_intra ? bink_intra_quant[quant_idx]
-                     : bink_inter_quant[quant_idx];
+    if (q == -1) {
+        quant_idx = get_bits(gb, 4);
+    } else {
+        quant_idx = q;
+    }
+
+    quant = quant_matrices[quant_idx];
+
     block[0] = (block[0] * quant[0]) >> 11;
     for (i = 0; i < coef_count; i++) {
         int idx = coef_idx[i];
@@ -673,6 +768,164 @@ static int read_residue(GetBitContext *gb, DCTELEM block[64], int masks_count)
     return 0;
 }
 
+/**
+ * Copy 8x8 block from source to destination, where src and dst may be overlapped
+ */
+static inline void put_pixels8x8_overlapped(uint8_t *dst, uint8_t *src, int stride)
+{
+    uint8_t tmp[64];
+    int i;
+    for (i = 0; i < 8; i++)
+        memcpy(tmp + i*8, src + i*stride, 8);
+    for (i = 0; i < 8; i++)
+        memcpy(dst + i*stride, tmp + i*8, 8);
+}
+
+static int binkb_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
+                              int is_key, int is_chroma)
+{
+    int blk;
+    int i, j, bx, by;
+    uint8_t *dst, *ref, *ref_start, *ref_end;
+    int v, col[2];
+    const uint8_t *scan;
+    int xoff, yoff;
+    LOCAL_ALIGNED_16(DCTELEM, block, [64]);
+    int coordmap[64];
+    int ybias = is_key ? -15 : 0;
+    int qp;
+
+    const int stride = c->pic.linesize[plane_idx];
+    int bw = is_chroma ? (c->avctx->width  + 15) >> 4 : (c->avctx->width  + 7) >> 3;
+    int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3;
+
+    binkb_init_bundles(c);
+    ref_start = c->pic.data[plane_idx];
+    ref_end   = c->pic.data[plane_idx] + (bh * c->pic.linesize[plane_idx] + bw) * 8;
+
+    for (i = 0; i < 64; i++)
+        coordmap[i] = (i & 7) + (i >> 3) * stride;
+
+    for (by = 0; by < bh; by++) {
+        for (i = 0; i < BINKB_NB_SRC; i++) {
+            if (binkb_read_bundle(c, gb, i) < 0)
+                return -1;
+        }
+
+        dst  = c->pic.data[plane_idx]  + 8*by*stride;
+        for (bx = 0; bx < bw; bx++, dst += 8) {
+            blk = binkb_get_value(c, BINKB_SRC_BLOCK_TYPES);
+            switch (blk) {
+            case 0:
+                break;
+            case 1:
+                scan = bink_patterns[get_bits(gb, 4)];
+                i = 0;
+                do {
+                    int mode, run;
+
+                    mode = get_bits1(gb);
+                    run = get_bits(gb, binkb_runbits[i]) + 1;
+
+                    i += run;
+                    if (i > 64) {
+                        av_log(c->avctx, AV_LOG_ERROR, "Run went out of bounds\n");
+                        return -1;
+                    }
+                    if (mode) {
+                        v = binkb_get_value(c, BINKB_SRC_COLORS);
+                        for (j = 0; j < run; j++)
+                            dst[coordmap[*scan++]] = v;
+                    } else {
+                        for (j = 0; j < run; j++)
+                            dst[coordmap[*scan++]] = binkb_get_value(c, BINKB_SRC_COLORS);
+                    }
+                } while (i < 63);
+                if (i == 63)
+                    dst[coordmap[*scan++]] = binkb_get_value(c, BINKB_SRC_COLORS);
+                break;
+            case 2:
+                c->dsp.clear_block(block);
+                block[0] = binkb_get_value(c, BINKB_SRC_INTRA_DC);
+                qp = binkb_get_value(c, BINKB_SRC_INTRA_Q);
+                read_dct_coeffs(gb, block, c->scantable.permutated, binkb_intra_quant, qp);
+                c->dsp.idct_put(dst, stride, block);
+                break;
+            case 3:
+                xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
+                yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
+                ref = dst + xoff + yoff * stride;
+                if (ref < ref_start || ref + 8*stride > ref_end) {
+                    av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
+                } else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
+                    c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
+                } else {
+                    put_pixels8x8_overlapped(dst, ref, stride);
+                }
+                c->dsp.clear_block(block);
+                v = binkb_get_value(c, BINKB_SRC_INTER_COEFS);
+                read_residue(gb, block, v);
+                c->dsp.add_pixels8(dst, block, stride);
+                break;
+            case 4:
+                xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
+                yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
+                ref = dst + xoff + yoff * stride;
+                if (ref < ref_start || ref + 8 * stride > ref_end) {
+                    av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
+                } else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
+                    c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
+                } else {
+                    put_pixels8x8_overlapped(dst, ref, stride);
+                }
+                c->dsp.clear_block(block);
+                block[0] = binkb_get_value(c, BINKB_SRC_INTER_DC);
+                qp = binkb_get_value(c, BINKB_SRC_INTER_Q);
+                read_dct_coeffs(gb, block, c->scantable.permutated, binkb_inter_quant, qp);
+                c->dsp.idct_add(dst, stride, block);
+                break;
+            case 5:
+                v = binkb_get_value(c, BINKB_SRC_COLORS);
+                c->dsp.fill_block_tab[1](dst, v, stride, 8);
+                break;
+            case 6:
+                for (i = 0; i < 2; i++)
+                    col[i] = binkb_get_value(c, BINKB_SRC_COLORS);
+                for (i = 0; i < 8; i++) {
+                    v = binkb_get_value(c, BINKB_SRC_PATTERN);
+                    for (j = 0; j < 8; j++, v >>= 1)
+                        dst[i*stride + j] = col[v & 1];
+                }
+                break;
+            case 7:
+                xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
+                yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
+                ref = dst + xoff + yoff * stride;
+                if (ref < ref_start || ref + 8 * stride > ref_end) {
+                    av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
+                } else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
+                    c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
+                } else {
+                    put_pixels8x8_overlapped(dst, ref, stride);
+                }
+                break;
+            case 8:
+                for (i = 0; i < 8; i++)
+                    memcpy(dst + i*stride, c->bundle[BINKB_SRC_COLORS].cur_ptr + i*8, 8);
+                c->bundle[BINKB_SRC_COLORS].cur_ptr += 64;
+                break;
+            default:
+                av_log(c->avctx, AV_LOG_ERROR, "Unknown block type %d\n", blk);
+                return -1;
+            }
+        }
+    }
+    if (get_bits_count(gb) & 0x1F) //next plane data starts at 32-bit boundary
+        skip_bits_long(gb, 32 - (get_bits_count(gb) & 0x1F));
+
+    return 0;
+}
+
 static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
                              int is_chroma)
 {
@@ -768,7 +1021,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
                 case INTRA_BLOCK:
                     c->dsp.clear_block(block);
                     block[0] = get_value(c, BINK_SRC_INTRA_DC);
-                    read_dct_coeffs(gb, block, c->scantable.permutated, 1);
+                    read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1);
                     c->dsp.idct(block);
                     c->dsp.put_pixels_nonclamped(block, ublock, 8);
                     break;
@@ -852,7 +1105,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
             case INTRA_BLOCK:
                 c->dsp.clear_block(block);
                 block[0] = get_value(c, BINK_SRC_INTRA_DC);
-                read_dct_coeffs(gb, block, c->scantable.permutated, 1);
+                read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1);
                 c->dsp.idct_put(dst, stride, block);
                 break;
             case FILL_BLOCK:
@@ -866,7 +1119,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
                 c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
                 c->dsp.clear_block(block);
                 block[0] = get_value(c, BINK_SRC_INTER_DC);
-                read_dct_coeffs(gb, block, c->scantable.permutated, 0);
+                read_dct_coeffs(gb, block, c->scantable.permutated, bink_inter_quant, -1);
                 c->dsp.idct_add(dst, stride, block);
                 break;
             case PATTERN_BLOCK:
@@ -902,12 +1155,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     int plane, plane_idx;
     int bits_count = pkt->size << 3;
 
-    if(c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
+    if (c->version > 'b') {
+        if(c->pic.data[0])
+            avctx->release_buffer(avctx, &c->pic);
 
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
+        if(avctx->get_buffer(avctx, &c->pic) < 0){
+            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+            return -1;
+        }
+    } else {
+        if(avctx->reget_buffer(avctx, &c->pic) < 0){
+            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+            return -1;
+        }
     }
 
     init_get_bits(&gb, pkt->data, bits_count);
@@ -923,8 +1183,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     for (plane = 0; plane < 3; plane++) {
         plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3);
 
-        if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0)
-            return -1;
+        if (c->version > 'b') {
+            if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0)
+                return -1;
+        } else {
+            if (binkb_decode_plane(c, &gb, plane_idx, !pkt->pts, !!plane) < 0)
+                return -1;
+        }
         if (get_bits_count(&gb) >= bits_count)
             break;
     }
@@ -933,24 +1198,67 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     *data_size = sizeof(AVFrame);
     *(AVFrame*)data = c->pic;
 
-    FFSWAP(AVFrame, c->pic, c->last);
+    if (c->version > 'b')
+        FFSWAP(AVFrame, c->pic, c->last);
 
     /* always report that the buffer was completely consumed */
     return pkt->size;
 }
 
+/**
+ * Caclulate quantization tables for version b
+ */
+static av_cold void binkb_calc_quant()
+{
+    uint8_t inv_bink_scan[64];
+    double s[64];
+    int i, j;
+
+    for (j = 0; j < 8; j++) {
+        for (i = 0; i < 8; i++) {
+            if (j && j != 4)
+               if (i && i != 4)
+                   s[j*8 + i] = cos(j * M_PI/16.0) * cos(i * M_PI/16.0) * 2.0;
+               else
+                   s[j*8 + i] = cos(j * M_PI/16.0) * sqrt(2.0);
+            else
+               if (i && i != 4)
+                   s[j*8 + i] = cos(i * M_PI/16.0) * sqrt(2.0);
+               else
+                   s[j*8 + i] = 1.0;
+        }
+    }
+
+    for (i = 0; i < 64; i++)
+        inv_bink_scan[bink_scan[i]] = i;
+
+    for (j = 0; j < 16; j++) {
+        for (i = 0; i < 64; i++) {
+            int k = inv_bink_scan[i];
+            if (s[i] == 1.0) {
+                binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] *
+                                          binkb_num[j]/binkb_den[j];
+                binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] *
+                                          binkb_num[j]/binkb_den[j];
+            } else {
+                binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] * s[i] *
+                                          binkb_num[j]/(double)binkb_den[j];
+                binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] * s[i] *
+                                          binkb_num[j]/(double)binkb_den[j];
+            }
+        }
+    }
+}
+
 static av_cold int decode_init(AVCodecContext *avctx)
 {
     BinkContext * const c = avctx->priv_data;
     static VLC_TYPE table[16 * 128][2];
+    static int binkb_initialised = 0;
     int i;
     int flags;
 
     c->version = avctx->codec_tag >> 24;
-    if (c->version < 'c') {
-        av_log(avctx, AV_LOG_ERROR, "Too old version '%c'\n", c->version);
-        return -1;
-    }
     if (avctx->extradata_size < 4) {
         av_log(avctx, AV_LOG_ERROR, "Extradata missing or too short\n");
         return -1;
@@ -984,6 +1292,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     init_bundles(c);
 
+    if (c->version == 'b') {
+        if (!binkb_initialised) {
+            binkb_calc_quant();
+            binkb_initialised = 1;
+        }
+    }
+
     return 0;
 }
 
@@ -1000,7 +1315,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec bink_decoder = {
+AVCodec ff_bink_decoder = {
     "binkvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_BINKVIDEO,
diff --git a/ffmpeg-mt/libavcodec/binkaudio.c b/ffmpeg-mt/libavcodec/binkaudio.c
index 62ff170..77ce6b9 100644
--- a/ffmpeg-mt/libavcodec/binkaudio.c
+++ b/ffmpeg-mt/libavcodec/binkaudio.c
@@ -1,22 +1,22 @@
 /*
  * Bink Audio decoder
- * Copyright (c) 2007-2010 Peter Ross (pross at xvid.org)
+ * Copyright (c) 2007-2011 Peter Ross (pross at xvid.org)
  * Copyright (c) 2009 Daniel Verkamp (daniel at drv.nu)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,7 +32,10 @@
 #define ALT_BITSTREAM_READER_LE
 #include "get_bits.h"
 #include "dsputil.h"
-#include "fft.h"
+#include "dct.h"
+#include "rdft.h"
+#include "fmtconvert.h"
+#include "libavutil/intfloat_readwrite.h"
 
 extern const uint16_t ff_wma_critical_freqs[25];
 
@@ -40,9 +43,10 @@ extern const uint16_t ff_wma_critical_freqs[25];
 #define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11)
 
 typedef struct {
-    AVCodecContext *avctx;
     GetBitContext gb;
     DSPContext dsp;
+    FmtConvertContext fmt_conv;
+    int version_b;          ///< Bink version 'b'
     int first;
     int channels;
     int frame_len;          ///< transform size (samples)
@@ -69,8 +73,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
     int i;
     int frame_len_bits;
 
-    s->avctx = avctx;
     dsputil_init(&s->dsp, avctx);
+    ff_fmt_convert_init(&s->fmt_conv, avctx);
 
     /* determine frame length */
     if (avctx->sample_rate < 22050) {
@@ -80,24 +84,25 @@ static av_cold int decode_init(AVCodecContext *avctx)
     } else {
         frame_len_bits = 11;
     }
-    s->frame_len = 1 << frame_len_bits;
 
-    if (s->channels > MAX_CHANNELS) {
-        av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
+    if (avctx->channels > MAX_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels);
         return -1;
     }
 
+    s->version_b = avctx->codec_tag == MKTAG('B','I','K','b');
+
     if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) {
         // audio is already interleaved for the RDFT format variant
         sample_rate  *= avctx->channels;
-        s->frame_len *= avctx->channels;
         s->channels = 1;
-        if (avctx->channels == 2)
-            frame_len_bits++;
+        if (!s->version_b)
+            frame_len_bits += av_log2(avctx->channels);
     } else {
         s->channels = avctx->channels;
     }
 
+    s->frame_len     = 1 << frame_len_bits;
     s->overlap_len   = s->frame_len / 16;
     s->block_size    = (s->frame_len - s->overlap_len) * s->channels;
     sample_rate_half = (sample_rate + 1) / 2;
@@ -113,10 +118,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
 
     /* populate bands data */
-    s->bands[0] = 1;
+    s->bands[0] = 2;
     for (i = 1; i < s->num_bands; i++)
-        s->bands[i] = ff_wma_critical_freqs[i - 1] * (s->frame_len / 2) / sample_rate_half;
-    s->bands[s->num_bands] = s->frame_len / 2;
+        s->bands[i] = (ff_wma_critical_freqs[i - 1] * s->frame_len / sample_rate_half) & ~1;
+    s->bands[s->num_bands] = s->frame_len;
 
     s->first = 1;
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
@@ -163,9 +168,13 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct)
 
     for (ch = 0; ch < s->channels; ch++) {
         FFTSample *coeffs = s->coeffs_ptr[ch];
-        q = 0.0f;
-        coeffs[0] = get_float(gb) * s->root;
-        coeffs[1] = get_float(gb) * s->root;
+        if (s->version_b) {
+            coeffs[0] = av_int2flt(get_bits(gb, 32)) * s->root;
+            coeffs[1] = av_int2flt(get_bits(gb, 32)) * s->root;
+        } else {
+            coeffs[0] = get_float(gb) * s->root;
+            coeffs[1] = get_float(gb) * s->root;
+        }
 
         for (i = 0; i < s->num_bands; i++) {
             /* constant is result of 0.066399999/log10(M_E) */
@@ -173,15 +182,15 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct)
             quant[i] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * s->root;
         }
 
-        // find band (k)
-        for (k = 0; s->bands[k] < 1; k++) {
-            q = quant[k];
-        }
+        k = 0;
+        q = quant[0];
 
         // parse coefficients
         i = 2;
         while (i < s->frame_len) {
-            if (get_bits1(gb)) {
+            if (s->version_b) {
+                j = i + 16;
+            } else if (get_bits1(gb)) {
                 j = i + rle_length_tab[get_bits(gb, 4)] * 8;
             } else {
                 j = i + 8;
@@ -193,11 +202,11 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct)
             if (width == 0) {
                 memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
                 i = j;
-                while (s->bands[k] * 2 < i)
+                while (s->bands[k] < i)
                     q = quant[k++];
             } else {
                 while (i < j) {
-                    if (s->bands[k] * 2 == i)
+                    if (s->bands[k] == i)
                         q = quant[k++];
                     coeff = get_bits(gb, width);
                     if (coeff) {
@@ -215,19 +224,15 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct)
 
         if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {
             coeffs[0] /= 0.5;
-            ff_dct_calc (&s->trans.dct,  coeffs);
+            s->trans.dct.dct_calc(&s->trans.dct,  coeffs);
             s->dsp.vector_fmul_scalar(coeffs, coeffs, s->frame_len / 2, s->frame_len);
         }
         else if (CONFIG_BINKAUDIO_RDFT_DECODER)
-            ff_rdft_calc(&s->trans.rdft, coeffs);
+            s->trans.rdft.rdft_calc(&s->trans.rdft, coeffs);
     }
 
-    if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        for (i = 0; i < s->channels; i++)
-            for (j = 0; j < s->frame_len; j++)
-                s->coeffs_ptr[i][j] = 385.0 + s->coeffs_ptr[i][j]*(1.0/32767.0);
-    }
-    s->dsp.float_to_int16_interleave(out, (const float **)s->coeffs_ptr, s->frame_len, s->channels);
+    s->fmt_conv.float_to_int16_interleave(out, (const float **)s->coeffs_ptr,
+                                          s->frame_len, s->channels);
 
     if (!s->first) {
         int count = s->overlap_len * s->channels;
@@ -286,7 +291,7 @@ static int decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-AVCodec binkaudio_rdft_decoder = {
+AVCodec ff_binkaudio_rdft_decoder = {
     "binkaudio_rdft",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_BINKAUDIO_RDFT,
@@ -298,7 +303,7 @@ AVCodec binkaudio_rdft_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)")
 };
 
-AVCodec binkaudio_dct_decoder = {
+AVCodec ff_binkaudio_dct_decoder = {
     "binkaudio_dct",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_BINKAUDIO_DCT,
diff --git a/ffmpeg-mt/libavcodec/binkdata.h b/ffmpeg-mt/libavcodec/binkdata.h
index 1ca34a6..db289ad 100644
--- a/ffmpeg-mt/libavcodec/binkdata.h
+++ b/ffmpeg-mt/libavcodec/binkdata.h
@@ -2,20 +2,20 @@
  * Bink video decoder
  * Copyright (C) 2009 Kostya Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -611,4 +611,45 @@ static const uint32_t bink_inter_quant[16][64] = {
 },
 };
 
+static const uint8_t binkb_runbits[64] = {
+    6, 6, 6, 6, 6, 6, 6, 6,
+    6, 6, 6, 6, 6, 6, 6, 6,
+    6, 6, 6, 6, 6, 6, 6, 6,
+    6, 6, 6, 6, 6, 6, 6, 6,
+    5, 5, 5, 5, 5, 5, 5, 5,
+    5, 5, 5, 5, 5, 5, 5, 5,
+    4, 4, 4, 4, 4, 4, 4, 4,
+    3, 3, 3, 3, 2, 2, 1, 0,
+};
+
+static const uint8_t binkb_intra_seed[64] = {
+    16, 16, 16, 19, 16, 19, 22, 22,
+    22, 22, 26, 24, 26, 22, 22, 27,
+    27, 27, 26, 26, 26, 29, 29, 29,
+    27, 27, 27, 26, 34, 34, 34, 29,
+    29, 29, 27, 27, 37, 34, 34, 32,
+    32, 29, 29, 38, 37, 35, 35, 34,
+    35, 40, 40, 40, 38, 38, 48, 48,
+    46, 46, 58, 56, 56, 69, 69, 83,
+};
+
+static const uint8_t binkb_inter_seed[64] = {
+    16, 17, 17, 18, 18, 18, 19, 19,
+    19, 19, 20, 20, 20, 20, 20, 21,
+    21, 21, 21, 21, 21, 22, 22, 22,
+    22, 22, 22, 22, 23, 23, 23, 23,
+    23, 23, 23, 23, 24, 24, 24, 25,
+    24, 24, 24, 25, 26, 26, 26, 26,
+    25, 27, 27, 27, 27, 27, 28, 28,
+    28, 28, 30, 30, 30, 31, 31, 33,
+};
+
+static const uint8_t binkb_num[16] = {
+    1, 4, 5, 2, 7, 8, 3, 7, 4, 9, 5, 6, 7, 8, 9, 10
+};
+
+static const uint8_t binkb_den[16] = {
+    1, 3, 3, 1, 3, 3, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1
+};
+
 #endif /* AVCODEC_BINKDATA_H */
diff --git a/ffmpeg-mt/libavcodec/binkidct.c b/ffmpeg-mt/libavcodec/binkidct.c
index 160926e..2326a61 100644
--- a/ffmpeg-mt/libavcodec/binkidct.c
+++ b/ffmpeg-mt/libavcodec/binkidct.c
@@ -2,20 +2,20 @@
  * Bink IDCT algorithm
  * Copyright (c) 2009 Kostya Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -62,7 +62,7 @@
 #define MUNGE_ROW(x) (((x) + 0x7F)>>8)
 #define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src)
 
-static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src)
+static inline void bink_idct_col(int *dest, const DCTELEM *src)
 {
     if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) {
         dest[0]  =
@@ -81,7 +81,7 @@ static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src)
 void ff_bink_idct_c(DCTELEM *block)
 {
     int i;
-    DCTELEM temp[64];
+    int temp[64];
 
     for (i = 0; i < 8; i++)
         bink_idct_col(&temp[i], &block[i]);
@@ -103,7 +103,7 @@ void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block)
 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block)
 {
     int i;
-    DCTELEM temp[64];
+    int temp[64];
     for (i = 0; i < 8; i++)
         bink_idct_col(&temp[i], &block[i]);
     for (i = 0; i < 8; i++) {
diff --git a/ffmpeg-mt/libavcodec/bitstream.c b/ffmpeg-mt/libavcodec/bitstream.c
index 83f30f9..329ec95 100644
--- a/ffmpeg-mt/libavcodec/bitstream.c
+++ b/ffmpeg-mt/libavcodec/bitstream.c
@@ -6,20 +6,20 @@
  *
  * alternative bitstream reader & writer by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bitstream_filter.c b/ffmpeg-mt/libavcodec/bitstream_filter.c
index 1a6ba39..b803ca4 100644
--- a/ffmpeg-mt/libavcodec/bitstream_filter.c
+++ b/ffmpeg-mt/libavcodec/bitstream_filter.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bmp.c b/ffmpeg-mt/libavcodec/bmp.c
index 0c9e973..fa4014c 100644
--- a/ffmpeg-mt/libavcodec/bmp.c
+++ b/ffmpeg-mt/libavcodec/bmp.c
@@ -2,20 +2,20 @@
  * BMP image format decoder
  * Copyright (c) 2005 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -335,7 +335,7 @@ static av_cold int bmp_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec bmp_decoder = {
+AVCodec ff_bmp_decoder = {
     "bmp",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_BMP,
diff --git a/ffmpeg-mt/libavcodec/bmp.h b/ffmpeg-mt/libavcodec/bmp.h
index b24a1fa..ab11523 100644
--- a/ffmpeg-mt/libavcodec/bmp.h
+++ b/ffmpeg-mt/libavcodec/bmp.h
@@ -2,20 +2,20 @@
  * internals for BMP codecs
  * Copyright (c) 2005 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/bmpenc.c b/ffmpeg-mt/libavcodec/bmpenc.c
index 12cb6de..3d4597c 100644
--- a/ffmpeg-mt/libavcodec/bmpenc.c
+++ b/ffmpeg-mt/libavcodec/bmpenc.c
@@ -3,24 +3,24 @@
  * Copyright (c) 2006, 2007 Michel Bardiaux
  * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/internal.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "bmp.h"
@@ -149,7 +149,7 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
     return n_bytes;
 }
 
-AVCodec bmp_encoder = {
+AVCodec ff_bmp_encoder = {
     "bmp",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_BMP,
diff --git a/ffmpeg-mt/libavcodec/bytestream.h b/ffmpeg-mt/libavcodec/bytestream.h
index b56f6ce..98f0087 100644
--- a/ffmpeg-mt/libavcodec/bytestream.h
+++ b/ffmpeg-mt/libavcodec/bytestream.h
@@ -2,20 +2,20 @@
  * Bytestream functions
  * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at free.fr>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/c93.c b/ffmpeg-mt/libavcodec/c93.c
index d713ff8..dc911b0 100644
--- a/ffmpeg-mt/libavcodec/c93.c
+++ b/ffmpeg-mt/libavcodec/c93.c
@@ -2,20 +2,20 @@
  * Interplay C93 video decoder
  * Copyright (c) 2007 Anssi Hannula <anssi.hannula at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -242,7 +242,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     return buf_size;
 }
 
-AVCodec c93_decoder = {
+AVCodec ff_c93_decoder = {
     "c93",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_C93,
diff --git a/ffmpeg-mt/libavcodec/cabac.c b/ffmpeg-mt/libavcodec/cabac.c
index 7b5e5b1..098cd6f 100644
--- a/ffmpeg-mt/libavcodec/cabac.c
+++ b/ffmpeg-mt/libavcodec/cabac.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cabac.h b/ffmpeg-mt/libavcodec/cabac.h
index 0af77e4..4708563 100644
--- a/ffmpeg-mt/libavcodec/cabac.h
+++ b/ffmpeg-mt/libavcodec/cabac.h
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cavs.c b/ffmpeg-mt/libavcodec/cavs.c
index 3958cf8..9a73e2a 100644
--- a/ffmpeg-mt/libavcodec/cavs.c
+++ b/ffmpeg-mt/libavcodec/cavs.c
@@ -2,20 +2,20 @@
  * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
  * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -353,7 +353,7 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
           || full_my < 0-extra_height
           || full_mx + 16/*FIXME*/ > pic_width + extra_width
           || full_my + 16/*FIXME*/ > pic_height + extra_height){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride,
                             16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
         src_y= s->edge_emu_buffer + 2 + 2*h->l_stride;
         emu=1;
@@ -365,14 +365,14 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
     }
 
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
                             9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
         src_cb= s->edge_emu_buffer;
     }
     chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7);
 
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride,
                             9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
         src_cr= s->edge_emu_buffer;
     }
diff --git a/ffmpeg-mt/libavcodec/cavs.h b/ffmpeg-mt/libavcodec/cavs.h
index dfa320f..29ba4d4 100644
--- a/ffmpeg-mt/libavcodec/cavs.h
+++ b/ffmpeg-mt/libavcodec/cavs.h
@@ -2,20 +2,20 @@
  * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
  * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cavs_parser.c b/ffmpeg-mt/libavcodec/cavs_parser.c
index 8e9c35b..2cc6566 100644
--- a/ffmpeg-mt/libavcodec/cavs_parser.c
+++ b/ffmpeg-mt/libavcodec/cavs_parser.c
@@ -2,20 +2,20 @@
  * Chinese AVS video (AVS1-P2, JiZhun profile) parser.
  * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -97,7 +97,7 @@ static int cavsvideo_parse(AVCodecParserContext *s,
     return next;
 }
 
-AVCodecParser cavsvideo_parser = {
+AVCodecParser ff_cavsvideo_parser = {
     { CODEC_ID_CAVS },
     sizeof(ParseContext1),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/cavsdata.h b/ffmpeg-mt/libavcodec/cavsdata.h
index 9e52fd5..caed4e8 100644
--- a/ffmpeg-mt/libavcodec/cavsdata.h
+++ b/ffmpeg-mt/libavcodec/cavsdata.h
@@ -2,20 +2,20 @@
  * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
  * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cavsdec.c b/ffmpeg-mt/libavcodec/cavsdec.c
index 9845fb4..fa12bc9 100644
--- a/ffmpeg-mt/libavcodec/cavsdec.c
+++ b/ffmpeg-mt/libavcodec/cavsdec.c
@@ -2,20 +2,20 @@
  * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
  * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -709,7 +709,7 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
     }
 }
 
-AVCodec cavs_decoder = {
+AVCodec ff_cavs_decoder = {
     "cavs",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CAVS,
diff --git a/ffmpeg-mt/libavcodec/cavsdsp.c b/ffmpeg-mt/libavcodec/cavsdsp.c
index 192e0f9..04e521b 100644
--- a/ffmpeg-mt/libavcodec/cavsdsp.c
+++ b/ffmpeg-mt/libavcodec/cavsdsp.c
@@ -5,20 +5,20 @@
  *
  * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cavsdsp.h b/ffmpeg-mt/libavcodec/cavsdsp.h
index d3fae69..de2f530 100644
--- a/ffmpeg-mt/libavcodec/cavsdsp.h
+++ b/ffmpeg-mt/libavcodec/cavsdsp.h
@@ -2,20 +2,20 @@
  * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
  * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cbrt_tablegen.c b/ffmpeg-mt/libavcodec/cbrt_tablegen.c
index e0a8e63..e92c0f1 100644
--- a/ffmpeg-mt/libavcodec/cbrt_tablegen.c
+++ b/ffmpeg-mt/libavcodec/cbrt_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cbrt_tablegen.h b/ffmpeg-mt/libavcodec/cbrt_tablegen.h
index 930e513..977450c 100644
--- a/ffmpeg-mt/libavcodec/cbrt_tablegen.h
+++ b/ffmpeg-mt/libavcodec/cbrt_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cdgraphics.c b/ffmpeg-mt/libavcodec/cdgraphics.c
index 8afbb27..2f8e98c 100644
--- a/ffmpeg-mt/libavcodec/cdgraphics.c
+++ b/ffmpeg-mt/libavcodec/cdgraphics.c
@@ -2,20 +2,20 @@
  * CD Graphics Video Decoder
  * Copyright (c) 2009 Michael Tison
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -367,7 +367,7 @@ static av_cold int cdg_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec cdgraphics_decoder = {
+AVCodec ff_cdgraphics_decoder = {
     "cdgraphics",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CDGRAPHICS,
diff --git a/ffmpeg-mt/libavcodec/celp_filters.c b/ffmpeg-mt/libavcodec/celp_filters.c
index 26a62ee..32eaff3 100644
--- a/ffmpeg-mt/libavcodec/celp_filters.c
+++ b/ffmpeg-mt/libavcodec/celp_filters.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/celp_filters.h b/ffmpeg-mt/libavcodec/celp_filters.h
index 145e3d3..03d481d 100644
--- a/ffmpeg-mt/libavcodec/celp_filters.h
+++ b/ffmpeg-mt/libavcodec/celp_filters.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/celp_math.c b/ffmpeg-mt/libavcodec/celp_math.c
index 09111da..4ab20ad 100644
--- a/ffmpeg-mt/libavcodec/celp_math.c
+++ b/ffmpeg-mt/libavcodec/celp_math.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/celp_math.h b/ffmpeg-mt/libavcodec/celp_math.h
index 4cf656f..9cd9ae2 100644
--- a/ffmpeg-mt/libavcodec/celp_math.h
+++ b/ffmpeg-mt/libavcodec/celp_math.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cga_data.c b/ffmpeg-mt/libavcodec/cga_data.c
index 160d77c..2c63ff2 100644
--- a/ffmpeg-mt/libavcodec/cga_data.c
+++ b/ffmpeg-mt/libavcodec/cga_data.c
@@ -1,20 +1,20 @@
 /*
  * CGA/EGA/VGA ROM data
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/cga_data.h b/ffmpeg-mt/libavcodec/cga_data.h
index 788b2b3..60f572f 100644
--- a/ffmpeg-mt/libavcodec/cga_data.h
+++ b/ffmpeg-mt/libavcodec/cga_data.h
@@ -1,20 +1,20 @@
 /*
  * CGA/EGA/VGA ROM data
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/chomp_bsf.c b/ffmpeg-mt/libavcodec/chomp_bsf.c
index e9ac8e8..9ed7496 100644
--- a/ffmpeg-mt/libavcodec/chomp_bsf.c
+++ b/ffmpeg-mt/libavcodec/chomp_bsf.c
@@ -2,20 +2,20 @@
  * Chomp bitstream filter
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -40,7 +40,7 @@ static int chomp_filter(AVBitStreamFilterContext *bsfc,
 /**
  * This filter removes a string of NULL bytes from the end of a packet.
  */
-AVBitStreamFilter chomp_bsf = {
+AVBitStreamFilter ff_chomp_bsf = {
     "chomp",
     0,
     chomp_filter,
diff --git a/ffmpeg-mt/libavcodec/cinepak.c b/ffmpeg-mt/libavcodec/cinepak.c
index 8e7aa5a..f325bdb 100644
--- a/ffmpeg-mt/libavcodec/cinepak.c
+++ b/ffmpeg-mt/libavcodec/cinepak.c
@@ -2,20 +2,20 @@
  * Cinepak Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -455,7 +455,7 @@ static av_cold int cinepak_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec cinepak_decoder = {
+AVCodec ff_cinepak_decoder = {
     "cinepak",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CINEPAK,
diff --git a/ffmpeg-mt/libavcodec/cljr.c b/ffmpeg-mt/libavcodec/cljr.c
index 96c9bdf..1da4d3b 100644
--- a/ffmpeg-mt/libavcodec/cljr.c
+++ b/ffmpeg-mt/libavcodec/cljr.c
@@ -2,20 +2,20 @@
  * Cirrus Logic AccuPak (CLJR) codec
  * Copyright (c) 2003 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -140,7 +140,7 @@ static av_cold int encode_init(AVCodecContext *avctx){
 }
 #endif
 
-AVCodec cljr_decoder = {
+AVCodec ff_cljr_decoder = {
     "cljr",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CLJR,
@@ -154,7 +154,7 @@ AVCodec cljr_decoder = {
 };
 
 #if CONFIG_CLJR_ENCODER
-AVCodec cljr_encoder = {
+AVCodec ff_cljr_encoder = {
     "cljr",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CLJR,
diff --git a/ffmpeg-mt/libavcodec/cook.c b/ffmpeg-mt/libavcodec/cook.c
index 2cbad5f..7717c4b 100644
--- a/ffmpeg-mt/libavcodec/cook.c
+++ b/ffmpeg-mt/libavcodec/cook.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Sascha Sommer
  * Copyright (c) 2005 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -53,6 +53,8 @@
 #include "dsputil.h"
 #include "bytestream.h"
 #include "fft.h"
+#include "libavutil/audioconvert.h"
+#include "sinewin.h"
 
 #include "cookdata.h"
 
@@ -752,7 +754,7 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
     int i;
 
     /* Inverse modified discrete cosine transform */
-    ff_imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
+    q->mdct_ctx.imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
 
     q->imlt_window (q, buffer1, gains_ptr, previous_buffer);
 
@@ -1274,7 +1276,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
     if (channel_mask)
         avctx->channel_layout = channel_mask;
     else
-        avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+        avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
 
 #ifdef COOKDEBUG
     dump_cook_context(q);
@@ -1283,7 +1285,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
 }
 
 
-AVCodec cook_decoder =
+AVCodec ff_cook_decoder =
 {
     .name = "cook",
     .type = AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/cookdata.h b/ffmpeg-mt/libavcodec/cookdata.h
index 15e8e95..e8d6ebf 100644
--- a/ffmpeg-mt/libavcodec/cookdata.h
+++ b/ffmpeg-mt/libavcodec/cookdata.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Sascha Sommer
  * Copyright (c) 2005 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/costablegen.c b/ffmpeg-mt/libavcodec/costablegen.c
index bfcd635..65c4926 100644
--- a/ffmpeg-mt/libavcodec/costablegen.c
+++ b/ffmpeg-mt/libavcodec/costablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,15 +29,34 @@
 #endif
 #define BITS 16
 #define FLOATFMT "%.18e"
+#define FIXEDFMT "%6d"
+
+static int clip_f15(int v)
+{
+    return v < -32767 ? -32767 :
+           v >  32767 ?  32767 :
+           v;
+}
+
+static void printval(double val, int fixed)
+{
+    if (fixed)
+        printf(" "FIXEDFMT",", clip_f15(lrint(val * (double)(1<<15))));
+    else
+        printf(" "FLOATFMT",", val);
+
+}
 
 int main(int argc, char *argv[])
 {
     int i, j;
-    int do_sin = argc == 2 && !strcmp(argv[1], "sin");
+    int do_sin = argc > 1 && !strcmp(argv[1], "sin");
+    int fixed  = argc > 2 && !strcmp(argv[2], "fixed");
     double (*func)(double) = do_sin ? sin : cos;
 
     printf("/* This file was generated by libavcodec/costablegen */\n");
-    printf("#include \"libavcodec/fft.h\"\n");
+    printf("#define CONFIG_FFT_FLOAT %d\n", !fixed);
+    printf("#include \"libavcodec/%s\"\n", do_sin ? "rdft.h" : "fft.h");
     for (i = 4; i <= BITS; i++) {
         int m = 1 << i;
         double freq = 2*M_PI/m;
@@ -46,11 +65,12 @@ int main(int argc, char *argv[])
             int idx = j > m/4 ? m/2 - j : j;
             if (do_sin && j >= m/4)
                 idx = m/4 - j;
-            printf(" "FLOATFMT",", func(idx*freq));
+            printval(func(idx*freq), fixed);
             if ((j & 3) == 3)
                 printf("\n   ");
         }
-        printf(" "FLOATFMT"\n};\n", func(do_sin ? -(m/4 - 1)*freq : freq));
+        printval(func(do_sin ? -(m/4 - 1)*freq : freq), fixed);
+        printf("\n};\n");
     }
     return 0;
 }
diff --git a/ffmpeg-mt/libavcodec/cscd.c b/ffmpeg-mt/libavcodec/cscd.c
index 00867a1..6e55c18 100644
--- a/ffmpeg-mt/libavcodec/cscd.c
+++ b/ffmpeg-mt/libavcodec/cscd.c
@@ -2,20 +2,20 @@
  * CamStudio decoder
  * Copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <stdio.h>
@@ -254,7 +254,7 @@ static av_cold int decode_end(AVCodecContext *avctx) {
     return 0;
 }
 
-AVCodec cscd_decoder = {
+AVCodec ff_cscd_decoder = {
     "camstudio",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CSCD,
diff --git a/ffmpeg-mt/libavcodec/cyuv.c b/ffmpeg-mt/libavcodec/cyuv.c
index db7e690..ecdec17 100644
--- a/ffmpeg-mt/libavcodec/cyuv.c
+++ b/ffmpeg-mt/libavcodec/cyuv.c
@@ -6,20 +6,20 @@
  *
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -178,7 +178,7 @@ static av_cold int cyuv_decode_end(AVCodecContext *avctx)
 }
 
 #if CONFIG_AURA_DECODER
-AVCodec aura_decoder = {
+AVCodec ff_aura_decoder = {
     "aura",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_AURA,
@@ -194,7 +194,7 @@ AVCodec aura_decoder = {
 #endif
 
 #if CONFIG_CYUV_DECODER
-AVCodec cyuv_decoder = {
+AVCodec ff_cyuv_decoder = {
     "cyuv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CYUV,
diff --git a/ffmpeg-mt/libavcodec/dca.c b/ffmpeg-mt/libavcodec/dca.c
index eda89aa..e3c6466 100644
--- a/ffmpeg-mt/libavcodec/dca.c
+++ b/ffmpeg-mt/libavcodec/dca.c
@@ -5,20 +5,20 @@
  * Copyright (C) 2006 Benjamin Larsson
  * Copyright (C) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,7 +29,7 @@
 #include "libavutil/common.h"
 #include "libavutil/intmath.h"
 #include "libavutil/intreadwrite.h"
-#include "libavcore/audioconvert.h"
+#include "libavutil/audioconvert.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "fft.h"
@@ -40,6 +40,7 @@
 #include "dca.h"
 #include "synth_filter.h"
 #include "dcadsp.h"
+#include "fmtconvert.h"
 
 //#define TRACE
 
@@ -98,6 +99,21 @@ enum DCAExtensionMask {
     DCA_EXT_EXSS_XLL   = 0x200, ///< lossless extension in ExSS
 };
 
+/* -1 are reserved or unknown */
+static const int dca_ext_audio_descr_mask[] = {
+    DCA_EXT_XCH,
+    -1,
+    DCA_EXT_X96,
+    DCA_EXT_XCH | DCA_EXT_X96,
+    -1,
+    -1,
+    DCA_EXT_XXCH,
+    -1,
+};
+
+/* extensions that reside in core substream */
+#define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96)
+
 /* Tables for mapping dts channel configurations to libavcodec multichannel api.
  * Some compromises have been made for special configurations. Most configurations
  * are never used so complete accuracy is not needed.
@@ -105,7 +121,7 @@ enum DCAExtensionMask {
  * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead.
  * S  -> side, when both rear and back are configured move one of them to the side channel
  * OV -> center back
- * All 2 channel configurations -> CH_LAYOUT_STEREO
+ * All 2 channel configurations -> AV_CH_LAYOUT_STEREO
  */
 
 static const int64_t dca_core_channel_layout[] = {
@@ -116,7 +132,7 @@ static const int64_t dca_core_channel_layout[] = {
     AV_CH_LAYOUT_STEREO,                                                     ///< 2, LT +RT (left and right total)
     AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER,                                  ///< 3, C+L+R
     AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER,                                   ///< 3, L+R+S
-    AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|CH_BACK_CENTER,                   ///< 4, C + L + R+ S
+    AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER,                ///< 4, C + L + R+ S
     AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT,                    ///< 4, L + R +SL+ SR
     AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 5, C + L + R+ SL+SR
     AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER,                    ///< 6, CL + CR + L + R + SL + SR
@@ -273,6 +289,7 @@ typedef struct {
 
     /* Primary audio coding header */
     int subframes;              ///< number of subframes
+    int is_channels_set;        ///< check for if the channel number is already set
     int total_channels;         ///< number of channels including extensions
     int prim_channels;          ///< number of primary audio channels
     int subband_activity[DCA_PRIM_CHANNELS_MAX];    ///< subband activity count
@@ -310,7 +327,6 @@ typedef struct {
     DECLARE_ALIGNED(16, float, raXin)[32];
 
     int output;                 ///< type of output
-    float add_bias;             ///< output bias
     float scale_bias;           ///< output scale
 
     DECLARE_ALIGNED(16, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8];
@@ -326,14 +342,12 @@ typedef struct {
     int current_subframe;
     int current_subsubframe;
 
+    int core_ext_mask;          ///< present extensions in the core substream
+
     /* XCh extension information */
-    int xch_present;
+    int xch_present;            ///< XCh extension present and valid
     int xch_base_channel;       ///< index of first (only) channel containing XCH data
 
-    /* Other detected extensions in the core substream */
-    int xxch_present;
-    int x96_present;
-
     /* ExSS header parser */
     int static_fields;          ///< static fields present
     int mix_metadata;           ///< mixing metadata present
@@ -347,6 +361,7 @@ typedef struct {
     FFTContext imdct;
     SynthFilterContext synth;
     DCADSPContext dcadsp;
+    FmtConvertContext fmt_conv;
 } DCAContext;
 
 static const uint16_t dca_vlc_offs[] = {
@@ -867,7 +882,7 @@ static int dca_subframe_header(DCAContext * s, int base_channel, int block_index
 
 static void qmf_32_subbands(DCAContext * s, int chans,
                             float samples_in[32][8], float *samples_out,
-                            float scale, float bias)
+                            float scale)
 {
     const float *prCoeff;
     int i;
@@ -896,7 +911,7 @@ static void qmf_32_subbands(DCAContext * s, int chans,
         s->synth.synth_filter_float(&s->imdct,
                               s->subband_fir_hist[chans], &s->hist_index[chans],
                               s->subband_fir_noidea[chans], prCoeff,
-                              samples_out, s->raXin, scale, bias);
+                              samples_out, s->raXin, scale);
         samples_out+= 32;
 
     }
@@ -904,8 +919,7 @@ static void qmf_32_subbands(DCAContext * s, int chans,
 
 static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
                                   int num_deci_sample, float *samples_in,
-                                  float *samples_out, float scale,
-                                  float bias)
+                                  float *samples_out, float scale)
 {
     /* samples_in: An array holding decimated samples.
      *   Samples in current subframe starts from samples_in[0],
@@ -930,7 +944,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
     /* Interpolation */
     for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
         s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor,
-                          scale, bias);
+                          scale);
         samples_in++;
         samples_out += 2 * decifactor;
     }
@@ -938,19 +952,19 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
 
 /* downmixing routines */
 #define MIX_REAR1(samples, si1, rs, coef) \
-     samples[i]     += (samples[si1] - add_bias) * coef[rs][0];  \
-     samples[i+256] += (samples[si1] - add_bias) * coef[rs][1];
+     samples[i]     += samples[si1] * coef[rs][0];  \
+     samples[i+256] += samples[si1] * coef[rs][1];
 
 #define MIX_REAR2(samples, si1, si2, rs, coef) \
-     samples[i]     += (samples[si1] - add_bias) * coef[rs][0] + (samples[si2] - add_bias) * coef[rs+1][0]; \
-     samples[i+256] += (samples[si1] - add_bias) * coef[rs][1] + (samples[si2] - add_bias) * coef[rs+1][1];
+     samples[i]     += samples[si1] * coef[rs][0] + samples[si2] * coef[rs+1][0]; \
+     samples[i+256] += samples[si1] * coef[rs][1] + samples[si2] * coef[rs+1][1];
 
 #define MIX_FRONT3(samples, coef) \
-    t = samples[i+c] - add_bias; \
-    u = samples[i+l] - add_bias; \
-    v = samples[i+r] - add_bias; \
-    samples[i]     = t * coef[0][0] + u * coef[1][0] + v * coef[2][0] + add_bias; \
-    samples[i+256] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1] + add_bias;
+    t = samples[i+c]; \
+    u = samples[i+l]; \
+    v = samples[i+r]; \
+    samples[i]     = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \
+    samples[i+256] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1];
 
 #define DOWNMIX_TO_STEREO(op1, op2) \
     for (i = 0; i < 256; i++){ \
@@ -960,7 +974,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
 
 static void dca_downmix(float *samples, int srcfmt,
                         int downmix_coef[DCA_PRIM_CHANNELS_MAX][2],
-                        const int8_t *channel_mapping, float add_bias)
+                        const int8_t *channel_mapping)
 {
     int c,l,r,sl,sr,s;
     int i;
@@ -1116,7 +1130,7 @@ static int dca_subsubframe(DCAContext * s, int base_channel, int block_index)
                         block[m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel);
                 }
 
-                s->dsp.int32_to_float_fmul_scalar(subband_samples[k][l],
+                s->fmt_conv.int32_to_float_fmul_scalar(subband_samples[k][l],
                                                   block, rscale, 8);
             }
 
@@ -1192,13 +1206,12 @@ static int dca_filter_channels(DCAContext * s, int block_index)
 /*        static float pcm_to_double[8] =
             {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/
          qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * s->channel_order_tab[k]],
-                            M_SQRT1_2*s->scale_bias /*pcm_to_double[s->source_pcm_res] */ ,
-                            s->add_bias );
+                         M_SQRT1_2*s->scale_bias /*pcm_to_double[s->source_pcm_res] */ );
     }
 
     /* Down mixing */
     if (s->avctx->request_channels == 2 && s->prim_channels > 2) {
-        dca_downmix(s->samples, s->amode, s->downmix_coef, s->channel_order_tab, s->add_bias);
+        dca_downmix(s->samples, s->amode, s->downmix_coef, s->channel_order_tab);
     }
 
     /* Generate LFE samples for this subsubframe FIXME!!! */
@@ -1206,7 +1219,7 @@ static int dca_filter_channels(DCAContext * s, int block_index)
         lfe_interpolation_fir(s, s->lfe, 2 * s->lfe,
                               s->lfe_data + 2 * s->lfe * (block_index + 4),
                               &s->samples[256 * dca_lfe_index[s->amode]],
-                              (1.0/256.0)*s->scale_bias,  s->add_bias);
+                              (1.0/256.0)*s->scale_bias);
         /* Outputs 20bits pcm samples */
     }
 
@@ -1356,7 +1369,9 @@ static int dca_exss_mask2count(int mask)
  */
 static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch)
 {
-    for (int i = 0; i < channels; i++) {
+    int i;
+
+    for (i = 0; i < channels; i++) {
         int mix_map_mask = get_bits(gb, out_ch);
         int num_coeffs = av_popcount(mix_map_mask);
         skip_bits_long(gb, num_coeffs * 6);
@@ -1500,21 +1515,15 @@ static int dca_exss_parse_asset_header(DCAContext *s)
 
     if (extensions_mask & DCA_EXT_EXSS_XLL)
         s->profile = FF_PROFILE_DTS_HD_MA;
-    else if (extensions_mask & DCA_EXT_EXSS_XBR)
+    else if (extensions_mask & (DCA_EXT_EXSS_XBR | DCA_EXT_EXSS_X96 |
+                                DCA_EXT_EXSS_XXCH))
         s->profile = FF_PROFILE_DTS_HD_HRA;
-    else if (extensions_mask & DCA_EXT_EXSS_X96)
-        s->profile = FF_PROFILE_DTS_96_24;
-    else if (extensions_mask & DCA_EXT_EXSS_XXCH)
-        s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES);
 
     if (!(extensions_mask & DCA_EXT_CORE))
         av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n");
-    if (!!(extensions_mask & DCA_EXT_XCH) != s->xch_present)
-        av_log(s->avctx, AV_LOG_WARNING, "DTS XCh detection mismatch.\n");
-    if (!!(extensions_mask & DCA_EXT_XXCH) != s->xxch_present)
-        av_log(s->avctx, AV_LOG_WARNING, "DTS XXCh detection mismatch.\n");
-    if (!!(extensions_mask & DCA_EXT_X96) != s->x96_present)
-        av_log(s->avctx, AV_LOG_WARNING, "DTS X96 detection mismatch.\n");
+    if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask)
+        av_log(s->avctx, AV_LOG_WARNING, "DTS extensions detection mismatch (%d, %d)\n",
+               extensions_mask & DCA_CORE_EXTS, s->core_ext_mask);
 
     return 0;
 }
@@ -1624,8 +1633,6 @@ static int dca_decode_frame(AVCodecContext * avctx,
 
 
     s->xch_present = 0;
-    s->x96_present = 0;
-    s->xxch_present = 0;
 
     s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer,
                                                DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE);
@@ -1653,11 +1660,24 @@ static int dca_decode_frame(AVCodecContext * avctx,
     /* record number of core channels incase less than max channels are requested */
     num_core_channels = s->prim_channels;
 
-    /* extensions start at 32-bit boundaries into bitstream */
-    skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
+    if (s->ext_coding)
+        s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr];
+    else
+        s->core_ext_mask = 0;
 
     core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8;
 
+    /* only scan for extensions if ext_descr was unknown or indicated a
+     * supported XCh extension */
+    if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) {
+
+        /* if ext_descr was unknown, clear s->core_ext_mask so that the
+         * extensions scan can fill it up */
+        s->core_ext_mask = FFMAX(s->core_ext_mask, 0);
+
+        /* extensions start at 32-bit boundaries into bitstream */
+        skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
+
     while(core_ss_end - get_bits_count(&s->gb) >= 32) {
         uint32_t bits = get_bits_long(&s->gb, 32);
 
@@ -1676,7 +1696,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
             /* skip length-to-end-of-frame field for the moment */
             skip_bits(&s->gb, 10);
 
-            s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES);
+            s->core_ext_mask |= DCA_EXT_XCH;
 
             /* extension amode should == 1, number of channels in extension */
             /* AFAIK XCh is not used for more channels */
@@ -1700,8 +1720,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
             /* XXCh: extended channels */
             /* usually found either in core or HD part in DTS-HD HRA streams,
              * but not in DTS-ES which contains XCh extensions instead */
-            s->xxch_present = 1;
-            s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES);
+            s->core_ext_mask |= DCA_EXT_XXCH;
             break;
 
         case 0x1d95f262: {
@@ -1714,8 +1733,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
             av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96);
             av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4));
 
-            s->x96_present = 1;
-            s->profile = FFMAX(s->profile, FF_PROFILE_DTS_96_24);
+            s->core_ext_mask |= DCA_EXT_X96;
             break;
         }
         }
@@ -1723,6 +1741,16 @@ static int dca_decode_frame(AVCodecContext * avctx,
         skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
     }
 
+    } else {
+        /* no supported extensions, skip the rest of the core substream */
+        skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb));
+    }
+
+    if (s->core_ext_mask & DCA_EXT_X96)
+        s->profile = FF_PROFILE_DTS_96_24;
+    else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH))
+        s->profile = FF_PROFILE_DTS_ES;
+
     /* check for ExSS (HD part) */
     if (s->dca_buffer_size - s->frame_size > 32
         && get_bits_long(&s->gb, 32) == DCA_HD_MARKER)
@@ -1774,7 +1802,15 @@ static int dca_decode_frame(AVCodecContext * avctx,
        unset. Ideally during the first probe for channels the crc should be checked
        and only set avctx->channels when the crc is ok. Right now the decoder could
        set the channels based on a broken first frame.*/
-    avctx->channels = channels;
+    if (s->is_channels_set == 0) {
+        s->is_channels_set = 1;
+        avctx->channels = channels;
+    }
+    if (avctx->channels != channels) {
+        av_log(avctx, AV_LOG_ERROR, "DCA decoder does not support number of "
+               "channels changing in stream. Skipping frame.\n");
+        return -1;
+    }
 
     if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
         return -1;
@@ -1792,12 +1828,12 @@ static int dca_decode_frame(AVCodecContext * avctx,
             float* rt_chan   = s->samples + s->channel_order_tab[s->xch_base_channel - 1] * 256;
             int j;
             for(j = 0; j < 256; ++j) {
-                lt_chan[j] -= (back_chan[j] - s->add_bias) * M_SQRT1_2;
-                rt_chan[j] -= (back_chan[j] - s->add_bias) * M_SQRT1_2;
+                lt_chan[j] -= back_chan[j] * M_SQRT1_2;
+                rt_chan[j] -= back_chan[j] * M_SQRT1_2;
             }
         }
 
-        s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
+        s->fmt_conv.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
         samples += 256 * channels;
     }
 
@@ -1830,26 +1866,20 @@ static av_cold int dca_decode_init(AVCodecContext * avctx)
     ff_mdct_init(&s->imdct, 6, 1, 1.0);
     ff_synth_filter_init(&s->synth);
     ff_dcadsp_init(&s->dcadsp);
+    ff_fmt_convert_init(&s->fmt_conv, avctx);
 
     for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++)
         s->samples_chanptr[i] = s->samples + i * 256;
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
 
-    if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        s->add_bias = 385.0f;
-        s->scale_bias = 1.0 / 32768.0;
-    } else {
-        s->add_bias = 0.0f;
-        s->scale_bias = 1.0;
+    s->scale_bias = 1.0;
 
-        /* allow downmixing to stereo */
-        if (avctx->channels > 0 && avctx->request_channels < avctx->channels &&
-                avctx->request_channels == 2) {
-            avctx->channels = avctx->request_channels;
-        }
+    /* allow downmixing to stereo */
+    if (avctx->channels > 0 && avctx->request_channels < avctx->channels &&
+        avctx->request_channels == 2) {
+        avctx->channels = avctx->request_channels;
     }
 
-
     return 0;
 }
 
@@ -1860,7 +1890,16 @@ static av_cold int dca_decode_end(AVCodecContext * avctx)
     return 0;
 }
 
-AVCodec dca_decoder = {
+static const AVProfile profiles[] = {
+    { FF_PROFILE_DTS,        "DTS"        },
+    { FF_PROFILE_DTS_ES,     "DTS-ES"     },
+    { FF_PROFILE_DTS_96_24,  "DTS 96/24"  },
+    { FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" },
+    { FF_PROFILE_DTS_HD_MA,  "DTS-HD MA"  },
+    { FF_PROFILE_UNKNOWN },
+};
+
+AVCodec ff_dca_decoder = {
     .name = "dca",
     .type = AVMEDIA_TYPE_AUDIO,
     .id = CODEC_ID_DTS,
@@ -1870,4 +1909,5 @@ AVCodec dca_decoder = {
     .close = dca_decode_end,
     .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
     .capabilities = CODEC_CAP_CHANNEL_CONF,
+    .profiles = NULL_IF_CONFIG_SMALL(profiles),
 };
diff --git a/ffmpeg-mt/libavcodec/dca.h b/ffmpeg-mt/libavcodec/dca.h
index 02c0a51..8ea6049 100644
--- a/ffmpeg-mt/libavcodec/dca.h
+++ b/ffmpeg-mt/libavcodec/dca.h
@@ -5,20 +5,20 @@
  * Copyright (C) 2006 Benjamin Larsson
  * Copyright (C) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dca_parser.c b/ffmpeg-mt/libavcodec/dca_parser.c
index 01c5597..70a3e98 100644
--- a/ffmpeg-mt/libavcodec/dca_parser.c
+++ b/ffmpeg-mt/libavcodec/dca_parser.c
@@ -5,20 +5,20 @@
  * Copyright (C) 2006 Benjamin Larsson
  * Copyright (C) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -125,7 +125,7 @@ static int dca_parse(AVCodecParserContext * s,
     return next;
 }
 
-AVCodecParser dca_parser = {
+AVCodecParser ff_dca_parser = {
     {CODEC_ID_DTS},
     sizeof(DCAParseContext),
     dca_parse_init,
diff --git a/ffmpeg-mt/libavcodec/dcadata.h b/ffmpeg-mt/libavcodec/dcadata.h
index fbd22ab..ed3ec4e 100644
--- a/ffmpeg-mt/libavcodec/dcadata.h
+++ b/ffmpeg-mt/libavcodec/dcadata.h
@@ -3,20 +3,20 @@
  * Copyright (C) 2004 Gildas Bazin
  * Copyright (c) 2006 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -60,4102 +60,4102 @@ static const uint8_t dca_bits_per_sample[7] =
 /* 16bits signed fractional Q13 binary codes */
 static const int16_t adpcm_vb[4096][4] =
 {
-  { 9928, -2618, -1093, -1263 },
-  { 11077, -2876, -1747, -308 },
-  { 10503, -1082, -1426, -1167 },
-  { 9337, -2403, -1495, 274 },
-  { 10698, -2529, -532, -1122 },
-  { 10368, -3974, -1264, -750 },
-  { 10070, -3667, 346, 863 },
-  { 10278, -3093, 311, -576 },
-  { 9894, -1330, -1428, -860 },
-  { 10544, -1923, -1058, -971 },
-  { 10996, -1632, -841, -1404 },
-  { 11832, -3465, 1658, -1990 },
-  { 10852, -688, -2658, -499 },
-  { 10546, -1749, -147, -1733 },
-  { 10801, -1004, -708, -1453 },
-  { 10588, -441, -2113, -952 },
-  { 10141, -3331, -582, -1432 },
-  { 9608, -2590, 383, 258 },
-  { 11422, -3265, 229, -1544 },
-  { 10460, -1338, -713, -1568 },
-  { 10306, -1721, -1660, -603 },
-  { 9580, -1812, -1235, -1061 },
-  { 11471, -2285, -1617, -607 },
-  { 10081, -2225, -1408, -868 },
-  { 10715, -2624, -1367, -704 },
-  { 10616, -1871, -2770, -35 },
-  { 9352, -2340, -1024, -1566 },
-  { 11065, -1458, -1926, -735 },
-  { 11334, -2056, -1041, -1144 },
-  { 9825, -2048, -794, -1536 },
-  { 11850, -2695, -1123, -867 },
-  { 10654, -2226, -1891, -373 },
-  { 10024, -1557, -808, -1069 },
-  { 11142, -1266, -3238, 128 },
-  { 11729, -3282, -514, -1011 },
-  { 11402, -2094, -2335, -189 },
-  { 10195, -3658, 181, -1875 },
-  { 11431, -2626, -404, -1377 },
-  { 11001, -3868, -619, -1077 },
-  { 10894, -2559, 274, -1758 },
-  { 9633, -1482, -2253, -773 },
-  { 11245, -3321, 830, -1972 },
-  { 9768, -2701, -199, -1859 },
-  { 10500, -2042, 525, -2043 },
-  { 11669, -4069, 293, -1468 },
-  { 9192, -1991, -583, -61 },
-  { 10057, -3220, -2015, -473 },
-  { 9497, -2315, -2490, -467 },
-  { 10455, -3069, -1194, -1007 },
-  { 9994, -1936, -60, -1225 },
-  { 9295, -2156, -1761, -1134 },
-  { 10085, -3748, -1026, 197 },
-  { 9334, -2360, 804, -351 },
-  { 11561, -2553, 1352, -2313 },
-  { 12837, -3998, 1195, -1958 },
-  { 10114, -1100, -2414, -394 },
-  { 9341, -2530, 315, 755 },
-  { 10131, -3164, 1411, -674 },
-  { 9535, -905, -1551, 579 },
-  { 11717, -1519, -3051, 91 },
-  { 9824, -2911, -2775, 192 },
-  { 9662, -2934, -561, 1450 },
-  { 11085, -3392, -1298, -659 },
-  { 8955, -2102, -1899, 703 },
-  { 8607, -1742, -4348, 814 },
-  { 7640, -2063, -3617, 52 },
-  { 7074, -826, -4325, 4375 },
-  { 7714, 584, -4238, 1927 },
-  { 6355, -952, -4912, 3127 },
-  { 7069, -660, -6413, 4087 },
-  { 8313, -132, -2964, -876 },
-  { 6952, -1422, -3962, -24 },
-  { 9299, -734, -3088, -263 },
-  { 9484, -574, -4513, 466 },
-  { 7246, -91, -3735, -704 },
-  { 8325, -1417, -3090, -530 },
-  { 6469, -1226, -4757, 829 },
-  { 6652, -368, -5682, 1393 },
-  { 7971, -1278, -2284, 1205 },
-  { 7229, -699, -3556, 1840 },
-  { 7994, 1284, -2729, 732 },
-  { 9005, -698, -4522, 2189 },
-  { 6963, 197, -2727, 380 },
-  { 8527, 135, -3991, -213 },
-  { 8840, 934, -3014, -567 },
-  { 10125, 418, -3284, -371 },
-  { 6367, 361, -2318, 2554 },
-  { 7892, 172, -5247, 4673 },
-  { 6674, 387, -5424, 4398 },
-  { 6240, 684, -4047, 1219 },
-  { 11170, -794, -5081, 1195 },
-  { 11765, -648, -6265, 2052 },
-  { 10845, -775, -3837, 366 },
-  { 12496, -689, -8260, 3562 },
-  { 7893, -1166, -4972, 988 },
-  { 8592, 1052, -5986, 3087 },
-  { 7277, 1874, -5685, 3579 },
-  { 6900, 2016, -4809, 3491 },
-  { 8530, -2405, -3250, 1986 },
-  { 9426, 494, -7067, 5038 },
-  { 10285, 564, -8210, 5370 },
-  { 8749, -2207, -3980, 2852 },
-  { 9653, -2686, -4300, 1400 },
-  { 9770, -2286, -5663, 4233 },
-  { 8490, -4, -7048, 4496 },
-  { 7697, -1209, -5328, 3183 },
-  { 6451, 801, -4324, -554 },
-  { 7387, 1806, -5265, 545 },
-  { 7450, -2302, -4445, 1418 },
-  { 8817, -1370, -5827, 2168 },
-  { 10324, -2406, -5629, 2579 },
-  { 8863, -2578, -3537, 467 },
-  { 6901, -1624, -3169, 3392 },
-  { 7846, 156, -6948, 3381 },
-  { 7928, -1115, -5972, 4816 },
-  { 6089, -599, -4368, -320 },
-  { 7833, 1246, -3960, -621 },
-  { 8931, 2521, -6768, 2052 },
-  { 8900, 1944, -4126, 40 },
-  { 7661, -34, -2855, 2480 },
-  { 5873, 474, -3262, 3712 },
-  { 7535, -234, -4699, 216 },
-  { 5856, 143, -5142, 73 },
-  { 8944, -106, -5874, 3663 },
-  { 7134, 426, -5879, 2895 },
-  { 10199, 1011, -4762, 369 },
-  { 8454, 264, -5971, 1291 },
-  { 7822, -2449, -4333, 4540 },
-  { 6200, -2758, -2632, 1497 },
-  { 6070, -4315, -2699, 414 },
-  { 7047, -3739, -3210, 1060 },
-  { 5675, -3801, -2717, -407 },
-  { 4789, -4063, -2628, -744 },
-  { 4023, -3366, -3133, -726 },
-  { 4296, -2407, -3381, -513 },
-  { 4388, -2931, -2820, 1512 },
-  { 4559, -4233, -1941, 1976 },
-  { 6702, -3208, -1755, 1680 },
-  { 4416, -3521, -1052, 2984 },
-  { 7154, -4266, -1203, 3732 },
-  { 3625, -4242, -3244, 1395 },
-  { 6518, -2856, -1304, 2887 },
-  { 6170, -1949, -3014, 3973 },
-  { 5189, -2451, -4020, 3477 },
-  { 6218, -2988, -1921, 3844 },
-  { 4827, -3688, -1928, 3343 },
-  { 6668, -3991, -2805, 3095 },
-  { 5297, -3115, -3684, 2390 },
-  { 5354, -4614, -2662, 1504 },
-  { 4196, -3091, -4147, 1135 },
-  { 3540, -2893, -4007, 100 },
-  { 5569, -1602, -4007, 1909 },
-  { 4341, -2091, -4272, 252 },
-  { 5559, -2878, -3832, 498 },
-  { 4548, -4479, -2898, -27 },
-  { 5176, -2494, -4635, 1476 },
-  { 3294, -3485, -3738, 716 },
-  { 4920, -1229, -4195, -365 },
-  { 3257, -3518, -3349, 2862 },
-  { 5286, -1948, -3485, -778 },
-  { 6502, -3051, -152, 2854 },
-  { 5864, -4192, -1076, 3451 },
-  { 4656, -3122, -3448, 179 },
-  { 5907, -754, -1596, 3116 },
-  { 7229, -3680, -1590, 2892 },
-  { 5107, -3888, -3364, 806 },
-  { 6764, -2635, -3450, 134 },
-  { 5258, -2827, -2844, -1052 },
-  { 5798, -1725, -4305, 205 },
-  { 5404, -1213, -3362, 449 },
-  { 6224, -2738, -3046, -581 },
-  { 4223, -2438, -2725, 3745 },
-  { 4751, -3411, -2123, 116 },
-  { 3868, -3000, -3954, 2297 },
-  { 6819, -2899, -4277, 2825 },
-  { 4207, -4754, -2808, 865 },
-  { 4804, -1494, -1997, 4688 },
-  { 5282, -2213, -548, 3559 },
-  { 5580, -1912, -566, 4370 },
-  { 6168, -2857, -672, 4053 },
-  { 6583, -4515, -2850, 1670 },
-  { 6511, -3093, -3988, 1421 },
-  { 4646, -1790, -1443, 3650 },
-  { 5915, -924, -2020, 896 },
-  { 7814, -4181, -3152, 2007 },
-  { 6190, -2238, -4817, 2279 },
-  { 4737, -4034, -3288, 1835 },
-  { 8161, -3633, -3423, 3137 },
-  { 7415, -2351, -2088, 4290 },
-  { 4106, -2517, -62, 2905 },
-  { 4909, -3145, -614, 4112 },
-  { 4938, -3281, -397, 1100 },
-  { -173, 919, 1589, -5363 },
-  { -13, 796, -295, -6655 },
-  { -1860, -829, 1141, -4555 },
-  { 2298, -838, -664, -5005 },
-  { -884, -1097, 2074, -4613 },
-  { -101, 281, 2846, -4535 },
-  { 1166, 453, 2429, -5910 },
-  { 879, -664, 2370, -5452 },
-  { 1415, -370, -1699, -4727 },
-  { -1413, 1277, -669, -6649 },
-  { 2133, 304, -968, -4624 },
-  { 380, 586, -2087, -4892 },
-  { 1336, 275, -82, -5789 },
-  { -2459, 1057, -34, -5416 },
-  { 2278, -1758, 866, -5653 },
-  { 1945, -2295, -149, -5302 },
-  { 1287, -3525, 996, -5255 },
-  { 2297, 803, 1177, -6067 },
-  { 187, -180, -619, -6202 },
-  { -793, -2537, 1554, -5057 },
-  { -2703, -204, -629, -5853 },
-  { -1007, -146, 313, -5582 },
-  { 830, 357, 869, -6363 },
-  { -228, -575, -3177, -4433 },
-  { -1001, -1553, -142, -5708 },
-  { -1644, 1683, 1721, -4533 },
-  { 893, 1924, -15, -5791 },
-  { 2195, 2061, -262, -5471 },
-  { 3031, 270, 311, -5096 },
-  { 1912, 1638, -1523, -4677 },
-  { -3142, -55, 253, -4914 },
-  { 356, -1680, 343, -6123 },
-  { -2241, -1734, -976, -5939 },
-  { -2196, -2893, 547, -4938 },
-  { -1245, 126, -1916, -5419 },
-  { -249, -3755, -1422, -5594 },
-  { 575, -2683, -1926, -4566 },
-  { -762, 1885, 192, -5880 },
-  { -811, -2562, -1068, -6013 },
-  { -2264, -3086, -976, -4775 },
-  { 70, -1215, 2880, -4410 },
-  { 714, -3760, 2916, -4691 },
-  { -244, -3404, 1740, -4493 },
-  { 684, -5137, -328, -5608 },
-  { -529, -3825, -1786, -4535 },
-  { -713, -4743, -1118, -5546 },
-  { 2718, -3788, 1798, -5708 },
-  { -1639, -3679, -1564, -6095 },
-  { 1693, -2642, -1389, -4539 },
-  { 505, -1573, -1651, -4878 },
-  { -835, -2256, -1941, -5352 },
-  { 1464, -411, 1993, -6441 },
-  { 493, -3184, -145, -6148 },
-  { -1413, 499, -1617, -6479 },
-  { -294, 1722, -1419, -5725 },
-  { -2937, -1528, -175, -4624 },
-  { -594, -5911, -56, -6146 },
-  { -300, -4275, 1156, -5947 },
-  { 552, -2643, 2669, -3959 },
-  { 905, -4158, 1789, -5809 },
-  { 1336, -2009, 2108, -5903 },
-  { 1555, -3600, 1110, -6759 },
-  { -1294, -3464, 77, -6084 },
-  { -1139, -4006, -1270, -4181 },
-  { -5094, -3296, 1092, -2847 },
-  { -5503, -2883, 1984, -2067 },
-  { -4671, -4218, -1417, -4132 },
-  { -3763, -3818, 1262, -3082 },
-  { -5132, -3430, 2928, -728 },
-  { -5957, -2877, 1251, -2446 },
-  { -4425, -2319, -212, -4276 },
-  { -6201, -1993, 1774, -2182 },
-  { -5500, -3836, 2201, -1396 },
-  { -6934, -2334, 2366, -1293 },
-  { -6124, -4140, 1337, -1977 },
-  { -6553, -4186, 1756, -1325 },
-  { -5126, -1258, 744, -3656 },
-  { -5167, -1390, 1581, -2895 },
-  { -4525, -3398, 2429, -1865 },
-  { -4076, -3183, 2027, -2510 },
-  { -6191, -3274, 1838, -1814 },
-  { -4454, -2753, 2723, -1185 },
-  { -6655, -4797, 251, -2595 },
-  { -6332, -2232, 1832, 217 },
-  { -5869, -1698, 134, 340 },
-  { -6614, -1045, 2126, -1932 },
-  { -4859, -2107, 2010, -2435 },
-  { -6274, -1622, 2808, -1374 },
-  { -3119, -3209, 521, -3988 },
-  { -5676, -2082, -420, -2711 },
-  { -7073, -3623, 696, -2343 },
-  { -5986, -4224, 572, -2454 },
-  { -4340, -4521, 882, -2771 },
-  { -6178, -1933, 535, -1444 },
-  { -4923, -4163, 1744, -2066 },
-  { -6410, -1519, 1058, -2683 },
-  { -5077, -1185, 856, -2216 },
-  { -7091, -2444, 687, -2597 },
-  { -5284, -2165, 3239, -993 },
-  { -4763, -1497, 197, -3179 },
-  { -4128, -4958, -396, -3578 },
-  { -5054, -3878, -647, -2672 },
-  { -7005, -3348, 1679, -1579 },
-  { -5767, -1017, 2582, -1915 },
-  { -7069, -2787, 1331, -2070 },
-  { -5532, -2296, 706, -2950 },
-  { -5059, -3543, -821, -3637 },
-  { -6639, -1835, 1016, -696 },
-  { -5611, -5220, -694, -3371 },
-  { -5994, -2803, 2933, -729 },
-  { -5948, -619, 1596, -2676 },
-  { -5486, -4419, 153, -3265 },
-  { -4329, -3440, 1646, -1439 },
-  { -4083, -3978, 177, -3569 },
-  { -4289, -2599, 1224, -3075 },
-  { -5707, -3253, 1912, -759 },
-  { -6606, -3437, 2562, -571 },
-  { -5254, -2444, 769, -352 },
-  { -6545, -3154, 582, -1103 },
-  { -5328, -2241, 2566, -1775 },
-  { -7216, -1936, 1538, -1983 },
-  { -3730, -2451, 426, -3869 },
-  { -5110, -1385, 2031, -1169 },
-  { -6470, -2715, 269, -3123 },
-  { -5806, -2480, -97, -3832 },
-  { -3683, -4916, -490, -4330 },
-  { -6341, -2083, -669, -115 },
-  { -4913, -4079, -837, -4673 },
-  { -3274, -2497, 2334, -2652 },
-  { -1286, -1731, 2550, -3756 },
-  { -3375, -877, 926, -3977 },
-  { -2525, -2079, 2879, -2625 },
-  { -5308, -504, 3111, -1607 },
-  { -4904, 460, 4093, -1232 },
-  { -1993, 1616, 4656, -1913 },
-  { -3481, -1176, 3119, -2236 },
-  { -4132, -1502, 2339, -2545 },
-  { -2542, 1151, 3569, -2550 },
-  { -4381, 430, 3147, -2082 },
-  { -3888, 867, 3899, -1657 },
-  { -2861, 1290, 4202, -1979 },
-  { -3893, -253, 2363, -2764 },
-  { -1705, 688, 3827, -2923 },
-  { -2223, 2312, 3700, -3148 },
-  { -1986, -720, 5021, -795 },
-  { -3177, 242, 1952, -3352 },
-  { -1854, 1509, 2528, -3815 },
-  { -3173, 97, 5019, -706 },
-  { -2689, -145, 1375, -3915 },
-  { -4838, -385, 2488, -2427 },
-  { -4557, -355, 1603, -3060 },
-  { -3522, 1832, 3292, -2674 },
-  { -3769, 780, 2378, -2704 },
-  { -4323, -1932, 3414, -1169 },
-  { -2740, 1158, 2729, -3273 },
-  { -3647, 210, 1464, -2892 },
-  { -2342, -2097, 1513, -3727 },
-  { -4422, -1242, 3130, -1833 },
-  { -1308, -1039, 4290, -1875 },
-  { -1754, -2535, 3298, -2314 },
-  { -4102, -186, 4037, -1094 },
-  { -1008, 1570, 3290, 171 },
-  { -3322, -2621, 2791, -1536 },
-  { -2539, -2597, 3442, -1672 },
-  { -3411, -2015, 3670, -1174 },
-  { -2097, 730, 5581, -1399 },
-  { -1510, -74, 4820, -2004 },
-  { -4086, -868, 4425, -771 },
-  { -956, -986, 3640, -2925 },
-  { -2087, -1250, 3464, -2458 },
-  { -3308, -2411, 1334, -3667 },
-  { -2264, -389, 4004, -1854 },
-  { -680, 239, 4058, -3388 },
-  { -1357, 30, 2993, -3658 },
-  { -3601, -552, 1177, -1136 },
-  { -2641, 442, 4374, -1625 },
-  { -2525, 770, 1640, -3895 },
-  { -3172, -891, 3893, -1608 },
-  { -2996, 13, 3277, -2414 },
-  { -899, 1055, 4470, -2501 },
-  { -422, -584, 3475, -3787 },
-  { -1978, -593, 2566, -3415 },
-  { -3150, -1280, 2362, -3047 },
-  { -3592, 224, 1026, -3932 },
-  { -4840, -1189, 3633, -879 },
-  { -3952, -2255, 2916, -1826 },
-  { -1695, 28, 1810, -349 },
-  { -745, -2484, 3308, -3293 },
-  { -1016, 1563, 5365, -1823 },
-  { -2172, -1787, 4266, -1287 },
-  { -1241, -1951, 3982, -2413 },
-  { -2009, -2639, 2330, -3480 },
-  { 5105, -1618, -2588, -2015 },
-  { 6497, -1523, -3218, -910 },
-  { 6526, -2305, -2029, -1790 },
-  { 5289, -99, -3436, -400 },
-  { 5781, -1623, -1577, -2617 },
-  { 5259, -670, -3125, -1700 },
-  { 6343, -1256, -331, -3222 },
-  { 7967, -678, -2195, -1462 },
-  { 6119, -695, -2988, -1538 },
-  { 6108, 494, -3359, -1548 },
-  { 5067, 969, -2328, -2707 },
-  { 7595, -435, -1497, -2056 },
-  { 6929, -719, -2420, -1665 },
-  { 5190, 584, -2982, -2103 },
-  { 6106, -444, -1411, -2739 },
-  { 5584, 289, -1804, -2803 },
-  { 5276, 227, -1180, -3361 },
-  { 7544, -1525, -1834, -1725 },
-  { 5986, -1470, -2606, -1701 },
-  { 5096, -765, -1712, -3006 },
-  { 5423, -149, -3933, -1157 },
-  { 7651, 26, -2445, -1507 },
-  { 4745, -464, -1735, -2362 },
-  { 5352, -1011, -1094, -1999 },
-  { 6300, -672, -542, -1950 },
-  { 6675, -1020, -1318, -1059 },
-  { 7218, -2036, -603, -2462 },
-  { 7755, -1514, -2430, -1229 },
-  { 5041, 449, -1056, -2405 },
-  { 6710, -2277, -1344, -2284 },
-  { 6824, -1347, -2254, 251 },
-  { 6068, -1857, -983, -1316 },
-  { 5603, -2177, -2730, -1477 },
-  { 5838, -1059, -3604, -970 },
-  { 5076, -789, -335, -2413 },
-  { 6191, -1634, -2000, -2129 },
-  { 5092, -1292, -2543, -1034 },
-  { 5305, 435, -1710, -1850 },
-  { 6140, 561, -2176, -2380 },
-  { 6752, 348, -2496, -1890 },
-  { 6405, 273, -1098, -2778 },
-  { 6942, -1340, -496, -1381 },
-  { 5238, -687, -2454, -2349 },
-  { 6959, -882, -1833, -2061 },
-  { 6292, -253, -2125, -2199 },
-  { 5838, -574, -759, -3215 },
-  { 6954, -1484, -640, -2771 },
-  { 7498, -1706, -1210, -2154 },
-  { 6772, -1003, -1235, -2532 },
-  { 6014, 228, -2154, -1108 },
-  { 6943, -2178, -2644, -1122 },
-  { 7262, -763, -3056, -1090 },
-  { 6273, -1478, -1072, 177 },
-  { 4734, 425, -2912, 357 },
-  { 7129, 168, -1537, -2327 },
-  { 7204, -434, -746, -2660 },
-  { 6879, 57, -3087, -1310 },
-  { 4623, -610, -718, -3459 },
-  { 6565, -543, -1998, -339 },
-  { 4752, -277, -2066, -1405 },
-  { 7435, -1416, -1904, -505 },
-  { 4076, 150, -1222, -3556 },
-  { 7082, -28, -1456, -1174 },
-  { 5941, -446, -1326, -1158 },
-  { 3870, -1648, -2474, -2589 },
-  { 858, 37, -3387, -3721 },
-  { 3557, -1503, -1664, -3383 },
-  { 3336, -1972, -3079, -2216 },
-  { 3186, 60, -4185, -863 },
-  { 3456, -773, -3066, -2457 },
-  { 4131, -913, -2060, -2601 },
-  { 4431, -691, -4114, -972 },
-  { 3461, -334, -3680, -1751 },
-  { 2006, -459, -2214, -3827 },
-  { 1322, 32, -2816, -3203 },
-  { 4425, -1897, -2791, -1946 },
-  { 4504, 23, -3421, -1909 },
-  { 3090, -885, -2366, -3264 },
-  { 3209, -2363, -3730, -834 },
-  { 3312, -1471, -3641, -1579 },
-  { 4184, -1669, -3323, -1248 },
-  { 2190, -931, -3302, -2944 },
-  { 2947, -229, -4791, -1195 },
-  { 2020, -1626, -2700, -3125 },
-  { 2214, -326, -4352, -1683 },
-  { 3286, -2619, -2412, -2458 },
-  { 1000, -2571, -4129, -2158 },
-  { 2496, -2627, -3611, -1433 },
-  { 2043, -2191, -2167, -3827 },
-  { 2571, -2544, -1915, -3222 },
-  { 2022, -1501, -3856, -2165 },
-  { 2685, -1180, -1461, -4038 },
-  { 1610, -2313, -4391, -1173 },
-  { 2340, -2490, -4215, -516 },
-  { 1742, -2615, -3632, -2146 },
-  { 523, -1293, -4246, -2442 },
-  { 3725, -2723, -3014, -1576 },
-  { 3554, -1381, -4200, -824 },
-  { 1291, -1594, -4777, -1430 },
-  { 1452, 515, -2960, -3830 },
-  { 4264, -894, -3305, -1826 },
-  { 2606, -1452, -4522, -966 },
-  { 1196, -830, -4807, -1816 },
-  { 1054, -775, -2616, -4071 },
-  { 4206, 415, -4344, -1132 },
-  { 3044, 491, -4126, -1934 },
-  { 988, -901, -3353, -3443 },
-  { 1729, -3063, -2267, -3370 },
-  { 3915, 912, -2989, -2387 },
-  { 3781, 300, -2457, -3050 },
-  { 2712, 924, -1350, -1206 },
-  { 4230, 405, -2343, 665 },
-  { 1878, -873, -225, -29 },
-  { 3510, 56, -1334, -3420 },
-  { 2850, 1447, -2651, -3150 },
-  { 1510, -706, -4125, -2483 },
-  { 3115, 793, -1692, -3894 },
-  { 2667, 213, -2973, -2786 },
-  { 1184, -2384, -3051, -3173 },
-  { 2139, 796, -2079, -3697 },
-  { 1464, -1483, -3726, -2754 },
-  { 2407, -1148, -3915, -1569 },
-  { 2612, -1779, -3217, -2271 },
-  { 2406, -2870, -2937, -2496 },
-  { 2140, 126, -3646, -2758 },
-  { 2952, -1036, 268, -1423 },
-  { 93, -1931, -3841, -3535 },
-  { 389, -2953, -3383, -3343 },
-  { 8652, -5511, -1662, 565 },
-  { 7427, -2791, -2535, -842 },
-  { 8541, -4253, -1407, -988 },
-  { 8018, -3203, -2998, 105 },
-  { 7231, -3926, -958, 1308 },
-  { 7331, -3690, -363, 2586 },
-  { 6803, -3646, -2226, -903 },
-  { 8163, -2811, -477, -2235 },
-  { 9356, -3818, -1685, -684 },
-  { 8466, -2854, -302, -698 },
-  { 8458, -3224, 517, 279 },
-  { 8074, -2619, -1326, 2596 },
-  { 8779, -2761, -2527, -441 },
-  { 6533, -2887, -899, -696 },
-  { 7394, -2305, -1642, -120 },
-  { 8281, -3780, -22, 1305 },
-  { 9158, -4413, -779, 901 },
-  { 9031, -5240, -1109, 1678 },
-  { 8717, -3650, 410, -1075 },
-  { 7317, -3197, -818, -2264 },
-  { 7934, -2385, -1214, -1886 },
-  { 8256, -4441, -291, -587 },
-  { 7358, -3395, 1090, -270 },
-  { 9446, -4910, -1343, -473 },
-  { 8187, -4726, -808, 1166 },
-  { 7504, -3845, -47, 267 },
-  { 8029, -2146, -1283, -383 },
-  { 7461, -2705, -853, 783 },
-  { 9367, -3636, -645, -354 },
-  { 8955, -3473, -308, -1947 },
-  { 8676, -2683, -2099, 1485 },
-  { 7481, -3003, -871, -444 },
-  { 8015, -2839, -1673, 1175 },
-  { 6947, -4643, -1527, -1047 },
-  { 7622, -2575, -137, -960 },
-  { 9388, -4279, -707, -1322 },
-  { 8382, -5259, -1283, -565 },
-  { 6856, -4138, -1030, 630 },
-  { 8659, -2571, -1124, -1666 },
-  { 8763, -3807, -537, 2543 },
-  { 8049, -3578, -2186, -604 },
-  { 8272, -2351, -1985, -1214 },
-  { 6855, -3796, -1527, -1631 },
-  { 7178, -2896, -1600, -1756 },
-  { 7040, -2888, -89, -1586 },
-  { 6261, -3403, -264, 998 },
-  { 7756, -4699, -1543, -834 },
-  { 7682, -4622, -758, -1721 },
-  { 8839, -4232, -2932, 1959 },
-  { 9363, -4679, -1956, 39 },
-  { 7883, -3616, -1414, -1432 },
-  { 8828, -3188, -1356, -1312 },
-  { 7746, -3987, -121, -2424 },
-  { 9262, -3256, -693, 818 },
-  { 7670, -3420, -148, 3504 },
-  { 7344, -3183, 608, 1595 },
-  { 8976, -4139, -1848, 1304 },
-  { 6708, -4131, 33, -852 },
-  { 7840, -4429, -2275, 79 },
-  { 8980, -3858, -2838, 453 },
-  { 7815, -4604, -2563, 944 },
-  { 8372, -4422, -1783, 3071 },
-  { 8623, -5128, -1754, 2888 },
-  { 7462, -3281, 889, 920 },
-  { 8416, -59, -1320, -1825 },
-  { 7928, -1488, -414, -2499 },
-  { 8110, -977, -1047, -2042 },
-  { 8278, -687, -1597, -1550 },
-  { 7988, -174, -977, -2106 },
-  { 8609, -1547, -1628, -1527 },
-  { 9000, -1798, -946, -1761 },
-  { 8954, -872, -1404, -1594 },
-  { 8939, 466, -748, -1212 },
-  { 9549, -329, -177, -1360 },
-  { 9411, -18, -1126, -1568 },
-  { 8859, -782, -488, -1338 },
-  { 8955, -218, -43, -1209 },
-  { 9131, -69, -453, -1001 },
-  { 9069, -1519, -1091, -1199 },
-  { 9247, -1309, -566, -1146 },
-  { 8528, -1617, -287, -1313 },
-  { 7763, -745, -149, -2040 },
-  { 8294, -343, 257, -2633 },
-  { 10149, -893, -552, -1649 },
-  { 9398, -915, 218, -2042 },
-  { 9703, -1194, -675, -1592 },
-  { 9586, -700, -427, -1710 },
-  { 8930, 497, -1445, -1218 },
-  { 9285, -1323, -163, -1552 },
-  { 8431, -1289, -985, -1404 },
-  { 8965, -655, 653, -1483 },
-  { 9542, -1001, -951, -1128 },
-  { 9205, -647, -37, -882 },
-  { 8603, -56, 514, -1793 },
-  { 9300, -12, -1324, -567 },
-  { 8773, 238, -184, -1456 },
-  { 9941, -1306, -69, -1792 },
-  { 9360, 279, -376, -1919 },
-  { 9180, -285, 95, -2170 },
-  { 9922, -501, -970, -1570 },
-  { 8341, -1493, -856, -2092 },
-  { 8780, -981, -850, -1014 },
-  { 9721, -548, -1504, -1094 },
-  { 9973, -1493, 482, -2105 },
-  { 8707, -333, -1027, -1087 },
-  { 9098, -469, -315, -1723 },
-  { 8879, -1050, -661, -2020 },
-  { 8857, 602, -866, -1918 },
-  { 8945, -1025, -2154, -1071 },
-  { 8484, -1930, -468, -2179 },
-  { 9177, -1903, -224, -2112 },
-  { 8652, -137, -2097, -1214 },
-  { 9063, -973, -1405, -772 },
-  { 9328, -456, 662, -2469 },
-  { 10101, -697, 127, -2113 },
-  { 9685, 811, -2359, -1024 },
-  { 8586, -94, -460, -1982 },
-  { 7924, -141, -509, -2513 },
-  { 7773, -669, -107, -2835 },
-  { 8636, -1064, -46, -2409 },
-  { 9748, 596, -1815, -1349 },
-  { 8924, 304, 547, -2614 },
-  { 9442, 746, -1153, -1679 },
-  { 9454, -278, -529, -1976 },
-  { 8488, 561, -32, -2160 },
-  { 10083, -63, -1544, -1364 },
-  { 9390, -1278, 568, -1131 },
-  { 9740, -49, -2253, -910 },
-  { 3636, -2391, -1115, -3614 },
-  { 6014, -3204, -1902, -1808 },
-  { 5787, -3497, -1116, -2590 },
-  { 4365, -3046, -1632, -2668 },
-  { 4733, -2192, -2029, -2468 },
-  { 5412, -2753, -1633, -2464 },
-  { 4455, -3375, -767, -3399 },
-  { 4456, -1644, -983, -2841 },
-  { 4039, -2523, 38, -3967 },
-  { 3406, -2662, 72, -4757 },
-  { 4279, -2005, 1055, -4399 },
-  { 4321, -1377, -860, -3786 },
-  { 3743, -5739, -651, -3047 },
-  { 3528, -5510, 361, -4060 },
-  { 6496, -4886, -136, -2689 },
-  { 4513, -5254, 551, -4010 },
-  { 6557, -3413, -92, -3063 },
-  { 4186, -2059, 187, 47 },
-  { 6210, -4117, -1256, -1985 },
-  { 6038, -4343, 351, -2124 },
-  { 4305, -4780, -2077, -1897 },
-  { 4480, -3815, -2228, -1533 },
-  { 5582, -3689, 1221, -3429 },
-  { 5532, -4874, 1195, -2765 },
-  { 6518, -2853, -905, -2568 },
-  { 5467, -2192, 470, -4115 },
-  { 4139, -1577, 240, -3493 },
-  { 5281, -1926, -729, -3340 },
-  { 5214, -2870, 1359, -4289 },
-  { 3046, -3510, -1536, -3214 },
-  { 5433, -2881, -1230, -1184 },
-  { 4861, -3932, -1071, -2791 },
-  { 5693, -4234, -1906, -1502 },
-  { 4004, -3935, -1804, -2383 },
-  { 3728, -3792, 681, -4773 },
-  { 3621, -3030, -1951, -2598 },
-  { 5133, -3903, 44, -3700 },
-  { 3561, -3451, 1183, -5301 },
-  { 5026, -2762, -2341, -1780 },
-  { 5841, -2492, -467, -3210 },
-  { 5591, -1791, 497, -2472 },
-  { 5054, -3898, -1822, -2097 },
-  { 5813, -2792, 83, -1469 },
-  { 4432, -4497, 1670, -5193 },
-  { 5338, -4653, -1109, -2200 },
-  { 3239, -4401, -648, -3655 },
-  { 2147, -3598, -1200, -4242 },
-  { 4417, -2271, -1552, -3210 },
-  { 6494, -4360, 852, -3565 },
-  { 2393, -6358, -856, -4524 },
-  { 4959, -4196, -847, -1403 },
-  { 4924, -5438, -226, -3026 },
-  { 4254, -5303, -1306, -2424 },
-  { 4121, -3126, -2334, -1981 },
-  { 3437, -4443, -1464, -2953 },
-  { 3203, -3459, -529, -4339 },
-  { 5896, -5945, 543, -3246 },
-  { 1987, -4733, -220, -4863 },
-  { 4358, -4431, -514, -3081 },
-  { 4583, -2416, -492, -2287 },
-  { 2943, -5035, 419, -4927 },
-  { 5358, -5129, 987, -4309 },
-  { 4460, -3392, 1752, -5634 },
-  { 3415, -4633, 1507, -5945 },
-  { 811, -4692, -445, 2333 },
-  { 1009, -5613, -1857, 1360 },
-  { 1338, -2712, -2720, 3036 },
-  { 1002, -3754, -2582, 2344 },
-  { 750, -4608, -2334, 714 },
-  { 2043, -3207, -2822, 2173 },
-  { -140, -4654, -2953, 357 },
-  { -54, -4026, -2376, 2695 },
-  { 1858, -5022, -717, 2287 },
-  { 2064, -3894, -722, 3255 },
-  { 2727, -4558, -332, 2603 },
-  { 1810, -5378, 283, 1826 },
-  { 3935, -4326, 762, 3383 },
-  { -767, -4697, -2510, 1922 },
-  { 2146, -4312, -3090, 1641 },
-  { 54, -5881, -2114, 921 },
-  { 1992, -5766, -640, 1574 },
-  { 1200, -5371, -1114, 1828 },
-  { 2973, -5337, 34, 2266 },
-  { 1531, -5018, -2817, 1192 },
-  { 3078, -4570, 117, 1990 },
-  { 924, -4286, -1388, 2713 },
-  { 142, -5058, -2848, 1487 },
-  { -106, -6180, -881, 842 },
-  { 673, -5433, -229, 1596 },
-  { 783, -5710, -2784, 562 },
-  { 1935, -5729, -2009, 856 },
-  { -410, -3375, -3326, 2734 },
-  { 234, -3000, -2628, 3260 },
-  { 733, -3405, -3806, 1589 },
-  { 771, -4285, -3544, 1314 },
-  { 1192, -3563, -3960, 2178 },
-  { 206, -5555, -1250, 1546 },
-  { -130, -3815, -1210, 3041 },
-  { 646, -3940, -393, 2992 },
-  { -184, -4931, -1767, 1925 },
-  { 2746, -5120, -2275, 1464 },
-  { 2440, -3731, -3352, 2729 },
-  { -490, -4942, -3779, 997 },
-  { 68, -2636, -4167, 3778 },
-  { 48, -3986, -4118, 2106 },
-  { -978, -5486, -1336, 1390 },
-  { 1126, -5297, -855, 640 },
-  { -472, -3975, -3622, 1557 },
-  { 2456, -5344, -1523, 1648 },
-  { -774, -5652, -2417, 1147 },
-  { 995, -6122, -812, 1132 },
-  { 3282, -4571, -1763, 2175 },
-  { 3655, -3862, -676, 3568 },
-  { 3038, -3647, -1672, 3381 },
-  { 2595, -2964, -2772, 3263 },
-  { 4176, -3353, -1148, 4354 },
-  { 1603, -3442, -1500, 3444 },
-  { 828, -6226, -1783, 678 },
-  { 1421, -3333, -3080, 3403 },
-  { 1121, -4727, -1924, 1984 },
-  { -186, -5083, -682, 1796 },
-  { 819, -2778, -3488, 530 },
-  { 421, -2873, -3832, 2596 },
-  { 2164, -4263, -1605, 2282 },
-  { 585, -4437, -682, -491 },
-  { -644, -4452, -1157, 2325 },
-  { 1991, -4299, 210, 2834 },
-  { 2135, -3632, -2113, 665 },
-  { -7482, -2724, -2662, -1380 },
-  { -6983, -2166, -3756, -3509 },
-  { -7085, -1439, -2397, -3112 },
-  { -7760, -3049, -3319, -2822 },
-  { -8413, -2760, -4406, -3298 },
-  { -5995, -3943, -1260, -3750 },
-  { -7879, -1554, -3464, -2606 },
-  { -6314, -2034, -3878, -1681 },
-  { -8849, -2084, -1399, -1231 },
-  { -7153, -2602, -1384, -817 },
-  { -8041, -2571, -407, -2785 },
-  { -7246, -2233, -1578, 260 },
-  { -7336, -3883, -4061, -1342 },
-  { -7619, -3908, -2342, 382 },
-  { -8684, -3724, -1662, -727 },
-  { -7850, -2922, -1770, -3449 },
-  { -6766, -2034, -1293, -1988 },
-  { -6895, -2116, -968, -3744 },
-  { -7136, -5147, -2618, -2809 },
-  { -8224, -3724, -2519, -1589 },
-  { -6711, -2750, -3021, -219 },
-  { -8059, -1638, -1102, -3175 },
-  { -8710, -4839, -3963, -3143 },
-  { -9363, -4965, -3257, -1002 },
-  { -6099, -1751, -3157, -395 },
-  { -6453, -3216, -4597, -483 },
-  { -7879, -5477, -839, -2638 },
-  { -7202, -4038, -526, -2856 },
-  { -8022, -1228, -1910, -1646 },
-  { -9117, -1393, -1582, -2535 },
-  { -9095, -2693, -636, -2605 },
-  { -9076, -2580, -3481, -2519 },
-  { -8327, -4859, -2422, 83 },
-  { -8368, -2129, -2324, -2173 },
-  { -8554, -4563, -3842, -2007 },
-  { -10462, -4261, -1934, -2084 },
-  { -9717, -3187, -2294, -1896 },
-  { -9625, -3889, -3020, -3224 },
-  { -9857, -4955, -4239, -2184 },
-  { -9752, -2351, -2277, -3129 },
-  { -7219, -1302, -2639, -1603 },
-  { -7477, -4360, -3718, -559 },
-  { -5680, -2033, -2326, -3078 },
-  { -10190, -5548, -4643, -3601 },
-  { -9431, -4121, -879, -2479 },
-  { -8365, -5450, -2020, -1439 },
-  { -6289, -5178, -1605, -3845 },
-  { -8319, -3866, -687, -2792 },
-  { -8131, -1031, -3608, -3947 },
-  { -10510, -2560, -1199, -2082 },
-  { -11015, -3640, -2748, -3041 },
-  { -8762, -5022, -5231, -1162 },
-  { -10153, -2715, -4648, -4859 },
-  { -7930, -5205, -1900, -3600 },
-  { -9561, -3548, -4812, -3722 },
-  { -7663, -4709, -1180, -1475 },
-  { -9073, -5707, -1815, -2980 },
-  { -8602, -2363, -2675, -3770 },
-  { -9967, -5614, -3575, -3838 },
-  { -8324, -1005, -2131, -3254 },
-  { -10331, -5737, -2550, -2940 },
-  { -8234, -3354, -3361, -4479 },
-  { -8140, -1951, -4526, -4545 },
-  { -6679, -2662, -2284, -4182 },
-  { -1122, -1514, -6427, -212 },
-  { 54, -1660, -5424, -1404 },
-  { 254, -2778, -5222, 846 },
-  { -267, -1661, -6577, 814 },
-  { -305, -2021, -5759, 1484 },
-  { -1791, -2446, -6867, -86 },
-  { -2929, -3158, -6603, -1799 },
-  { -1391, -3189, -5557, -1053 },
-  { -1602, -884, -6767, -1213 },
-  { -361, -318, -6219, -44 },
-  { -4078, -2635, -5523, -433 },
-  { -956, 478, -4382, 1470 },
-  { -3300, -2462, -6021, -2721 },
-  { 708, -2434, -5085, -540 },
-  { -2435, -3607, -5647, -2110 },
-  { -491, -1134, -4681, -2886 },
-  { 87, -3435, -4641, -1194 },
-  { -586, -2927, -4784, 366 },
-  { -1394, -2326, -6021, 350 },
-  { 97, -2519, -4678, -2120 },
-  { -1547, -1907, -5069, -2993 },
-  { 268, -3724, -4719, 127 },
-  { -827, -1190, -5912, 1144 },
-  { -3959, -2322, -6898, -1974 },
-  { -2728, -2228, -6426, -562 },
-  { -456, -666, -5785, -1609 },
-  { 531, -1096, -5731, -656 },
-  { -3569, -688, -3915, 110 },
-  { -4752, -1725, -4393, -377 },
-  { -3210, -3315, -6960, -840 },
-  { -688, -3416, -4971, 1221 },
-  { -1833, 77, -6491, -2434 },
-  { -239, -255, -6850, -886 },
-  { -2112, -1490, -6291, -2689 },
-  { -1544, -4579, -5198, -1261 },
-  { -2771, -4014, -5520, 683 },
-  { -1635, -2829, -5512, 1214 },
-  { -958, -2582, -4823, 2360 },
-  { -2077, -4566, -4642, 365 },
-  { -3112, -4214, -5960, -823 },
-  { -2467, -2510, -4858, 1467 },
-  { -1561, -3399, -5822, 211 },
-  { -775, -1081, -4424, 2636 },
-  { -1263, 25, -6378, -1392 },
-  { -3476, -366, -5417, -1393 },
-  { -3176, -1476, -4149, 1466 },
-  { -2479, 518, -4448, -257 },
-  { -2992, 158, -4660, -1279 },
-  { -1320, -3872, -4479, 1147 },
-  { -1475, -312, -5318, 539 },
-  { -3527, -1679, -5860, -1681 },
-  { -3397, -3438, -5593, 1866 },
-  { -4089, -2439, -4763, 1275 },
-  { -748, -4513, -4687, -48 },
-  { -2166, -4531, -4691, -2856 },
-  { -2385, -853, -6035, -627 },
-  { -1194, -4091, -4472, -1963 },
-  { -682, -3234, -4084, -3033 },
-  { -3255, -5015, -5328, -12 },
-  { -2313, -3436, -4601, -155 },
-  { -2792, -1038, -6947, -2019 },
-  { -1244, -1526, -5771, -1882 },
-  { -4679, -3731, -5506, 283 },
-  { -3062, -66, -3558, -758 },
-  { -4895, -1187, 4751, 3728 },
-  { -7600, -2752, 3320, 4613 },
-  { -5703, -2975, 3944, 2659 },
-  { -4972, -1257, -246, 2952 },
-  { -4221, -2487, 1702, 4295 },
-  { -2900, -1529, 2458, 4935 },
-  { -5061, 407, 2416, 4050 },
-  { -6931, -3478, 2761, 2213 },
-  { -6037, -3921, 3192, 1866 },
-  { -6113, -811, 2407, 3782 },
-  { -5878, -1716, 1207, 3478 },
-  { -5953, -2853, 2207, 2712 },
-  { -6807, -3223, 2749, 3595 },
-  { -3272, -3157, 1389, 3788 },
-  { -5368, -1904, 1980, 5077 },
-  { -7235, -1398, 3075, 4548 },
-  { -4765, -3487, 2755, 2796 },
-  { -7658, -4435, 2694, 2582 },
-  { -6997, -4282, 456, 3832 },
-  { -5563, -3115, -63, 3713 },
-  { -4244, -4220, 1450, 2767 },
-  { -3801, -2194, 190, 4303 },
-  { -5458, -4119, 1958, 2274 },
-  { -7300, -3469, 3514, 3193 },
-  { -4594, -2067, 775, 4752 },
-  { -3389, -1654, 1464, 5412 },
-  { -4845, -3483, 964, 3437 },
-  { -6007, -2818, 1666, 4659 },
-  { -8709, -5007, 1757, 3287 },
-  { -5833, -4389, 1025, 3171 },
-  { -5788, -1780, 3944, 3661 },
-  { -4430, -920, 1938, 4753 },
-  { -7066, -1857, 4591, 4538 },
-  { -3549, -513, 1427, 5317 },
-  { -7517, -1220, 2883, 3049 },
-  { -7605, -2687, 1874, 2735 },
-  { -8718, -4035, 2676, 3730 },
-  { -7990, -3907, 1185, 2607 },
-  { -6058, -1744, 3349, 5157 },
-  { -5954, 565, 3161, 3250 },
-  { -6478, -612, 1930, 2271 },
-  { -6535, -1445, -2, 1618 },
-  { -8963, -4151, 1192, 4044 },
-  { -7227, -3570, 1600, 4234 },
-  { -4674, 79, 595, 3015 },
-  { -3974, 430, 2727, 5137 },
-  { -5299, 9, 3714, 4779 },
-  { -6779, -2699, -8, 2436 },
-  { -7016, -1145, 1293, 2310 },
-  { -6955, -3312, 1534, 1801 },
-  { -4025, 740, 1850, 4054 },
-  { -9589, -3460, 4154, 5270 },
-  { -4404, -1181, 4298, 5173 },
-  { -7356, -4583, -18, 2644 },
-  { -6516, -1235, 4439, 6234 },
-  { -3453, -301, 4344, 4464 },
-  { -4643, 1530, 3315, 4340 },
-  { -4575, -2557, 3754, 3682 },
-  { -3643, -3501, 2051, 2997 },
-  { -5412, -2475, 2301, 1579 },
-  { -5846, 259, 1360, 2348 },
-  { -5258, -1358, 1050, 838 },
-  { -5542, -219, 6377, 5750 },
-  { -5713, -2952, 922, 899 },
-  { -2049, -1135, 5206, 1033 },
-  { -1693, -1886, 4835, -106 },
-  { -2344, -3504, 4232, -13 },
-  { -2475, -2334, 5043, 1126 },
-  { -787, -2549, 3880, 2138 },
-  { -3159, -2341, 4830, 2887 },
-  { -1780, -1009, 6240, 2061 },
-  { -4327, -3363, 2818, 886 },
-  { -3376, -2743, 4104, 207 },
-  { -3250, -4640, 2718, 1498 },
-  { -382, -1075, 4382, 3460 },
-  { -2416, -4168, 3530, 816 },
-  { -1756, -2708, 4861, 622 },
-  { -1879, -2097, 5156, 2889 },
-  { -2496, -2418, 3722, 2671 },
-  { -2717, -3252, 3341, 1944 },
-  { -4063, -4091, 3306, 267 },
-  { -3549, -3808, 3747, 842 },
-  { -2635, 546, 5794, 1894 },
-  { -1857, -1121, 4383, 3964 },
-  { -2226, -2166, 3489, 3678 },
-  { -3492, -660, 5323, 1063 },
-  { -3033, -3130, 4382, 1828 },
-  { -2703, -625, 6369, 2851 },
-  { -1656, -2842, 4584, -528 },
-  { -4781, -2622, 4390, 2097 },
-  { -413, -2045, 5081, 3035 },
-  { -3810, -2662, 4532, 1095 },
-  { -3144, -1858, 5215, 1880 },
-  { -3562, -1795, 4928, 670 },
-  { -4800, -1509, 5189, 1859 },
-  { -1085, -3832, 4169, 900 },
-  { -1969, -3270, 2857, 2878 },
-  { -4267, -4140, 3176, 1805 },
-  { -5145, -3727, 3524, 1168 },
-  { -1346, -1876, 5501, 1748 },
-  { -4998, -2945, 3699, 338 },
-  { -3458, -3096, 3406, -635 },
-  { -1751, -3209, 3508, 395 },
-  { -2507, 170, 5987, 705 },
-  { -3756, -1072, 5647, 3536 },
-  { -2870, -1439, 5026, 3212 },
-  { -3913, -3225, 3669, 2144 },
-  { -3739, 226, 5747, 764 },
-  { -2052, -820, 5266, 3093 },
-  { -3214, -3820, 2409, 2391 },
-  { -4398, -2588, 3501, -218 },
-  { -4484, -1763, 4180, -198 },
-  { -3368, -1525, 4362, -134 },
-  { -2407, 224, 4905, 3533 },
-  { -1369, -2937, 4728, 1788 },
-  { -4848, -1707, 4159, 851 },
-  { -3454, -1749, 4281, 3230 },
-  { -1990, -3853, 3487, 1735 },
-  { -3117, 92, 6155, 4075 },
-  { -2676, -2472, 4078, -589 },
-  { -1547, -2012, 2626, 1835 },
-  { -4275, -588, 4824, 725 },
-  { -601, -2249, 3736, 3548 },
-  { -4060, -61, 5333, 3097 },
-  { -4303, 7, 6551, 3054 },
-  { -5003, -1029, 5786, 3319 },
-  { -2810, -728, 5392, 199 },
-  { -1232, -200, 5228, 3121 },
-  { 2621, 165, -6255, 298 },
-  { 3669, 537, -6844, 1564 },
-  { 1598, -1190, -6235, 2523 },
-  { 2164, -32, -6894, 1383 },
-  { 853, -1597, -6069, 1449 },
-  { 1377, -1661, -5266, 108 },
-  { 2660, 48, -5172, -517 },
-  { 1903, -391, -5677, 1010 },
-  { 3792, 206, -5274, -11 },
-  { 1239, 2776, -2929, 2721 },
-  { 4071, 149, -7259, 3125 },
-  { 1436, -480, -6156, -196 },
-  { 1373, -1960, -5005, 3122 },
-  { 3413, -1271, -5176, 3283 },
-  { 3060, -68, -6495, 2238 },
-  { 2700, -2075, -4681, 91 },
-  { 2928, -1728, -5168, 1858 },
-  { 4424, 828, -4471, 88 },
-  { 2672, -2604, -4038, 2753 },
-  { 5223, -123, -6749, 2295 },
-  { 4237, -420, -5538, 1353 },
-  { 4744, -1281, -4097, 4708 },
-  { 1103, -2764, -4751, 2024 },
-  { 3747, -1913, -3911, 3960 },
-  { 2470, -1416, -5542, 615 },
-  { 4847, -1354, -5334, 1733 },
-  { 5336, 88, -7593, 4007 },
-  { 2388, -2880, -4807, 1037 },
-  { 4495, 1391, -5685, -139 },
-  { 5253, 1637, -6450, 1533 },
-  { 1199, 795, -5515, 1261 },
-  { 1397, -1259, -4252, 3838 },
-  { 746, 70, -6640, 604 },
-  { 1584, 166, -4972, 3072 },
-  { 380, -999, -5397, 2267 },
-  { 2974, 1707, -3242, 5360 },
-  { 5202, -403, -5453, 2832 },
-  { 3718, -1731, -4760, 714 },
-  { 4150, -975, -4792, 61 },
-  { 2925, -818, -4841, 15 },
-  { 5301, 577, -4006, 3259 },
-  { 5265, 1986, -5679, 3028 },
-  { 3752, 1928, -4509, 3729 },
-  { 3278, 1925, -6370, 1247 },
-  { 5107, 1721, -4853, 3127 },
-  { 3279, 2982, -2515, 4005 },
-  { 4622, 668, -6204, 759 },
-  { 6034, 317, -5763, 4818 },
-  { -558, 57, -3785, 2817 },
-  { 4476, 1616, -3965, 4536 },
-  { 5953, 2056, -8215, 2715 },
-  { 4387, 2613, -7463, 868 },
-  { 5834, 1088, -4736, 4924 },
-  { 6473, -856, -6991, 4172 },
-  { 4959, -293, -5162, 76 },
-  { 2731, -843, -6119, 3847 },
-  { 3245, 1202, -6833, 616 },
-  { 2553, 1383, -3829, 3859 },
-  { 4332, 2099, -3480, 3622 },
-  { 2110, 2683, -2728, 3990 },
-  { 876, 1167, -3290, 3466 },
-  { 3991, 1709, -2410, 4077 },
-  { 5105, 939, -2584, 3256 },
-  { 4719, 688, -1566, 3040 },
-  { -3632, 4335, 1266, -3303 },
-  { -4956, 3207, 1312, -2806 },
-  { -4669, 2627, 2663, -2435 },
-  { -4282, 3708, 2303, -3038 },
-  { -4536, 2297, -175, -3350 },
-  { -5234, 2503, -139, -880 },
-  { -3978, 1512, 1092, -3619 },
-  { -4519, 4649, 1363, -2455 },
-  { -5118, 3132, 1961, -1577 },
-  { -5196, 3379, -182, -1378 },
-  { -6420, 4486, 2397, -1993 },
-  { -5030, 5046, 1292, -1118 },
-  { -4559, 2573, -927, -1406 },
-  { -3501, 3730, 691, -4930 },
-  { -4364, 2758, 1007, -3909 },
-  { -4026, 2839, -1559, -2340 },
-  { -5037, 4053, 836, -1571 },
-  { -4727, 5136, 1110, -3588 },
-  { -5245, 2799, -999, -2164 },
-  { -4954, 1501, 422, -3963 },
-  { -5994, 2726, 1462, -2833 },
-  { -5621, 5159, 2038, -2512 },
-  { -4991, 2291, 1917, -3151 },
-  { -5469, 4382, -148, -2978 },
-  { -5858, 1983, 807, -2720 },
-  { -4709, 3556, 952, -467 },
-  { -2489, 2362, 1714, -4230 },
-  { -4717, 5004, -1180, -3672 },
-  { -5914, 3653, 1359, -1317 },
-  { -5506, 2995, 780, -1059 },
-  { -5287, 3945, 2480, -2293 },
-  { -3849, 4358, 322, -1770 },
-  { -3911, 3570, 252, -3185 },
-  { -3660, 5128, 158, -3719 },
-  { -4599, 3277, -503, -2727 },
-  { -3673, 3760, -1252, -3339 },
-  { -5161, 2337, 388, -1943 },
-  { -3529, 2216, 2156, -3080 },
-  { -4309, 4331, 1808, -1460 },
-  { -4782, 3820, 480, -2504 },
-  { -4166, 3544, -378, -1567 },
-  { -5572, 2466, -418, -2909 },
-  { -6096, 2930, 119, -1878 },
-  { -5963, 3554, 1011, -2233 },
-  { -6433, 4335, 935, -2930 },
-  { -5004, 3314, -1352, -3430 },
-  { -6042, 3463, -1008, -3940 },
-  { -4671, 2214, -640, -5040 },
-  { -2795, 3759, 1412, -3803 },
-  { -3647, 4436, 729, -515 },
-  { -3594, 1033, 56, -4148 },
-  { -2908, 3027, 2889, -3485 },
-  { -3338, 2234, 313, -4285 },
-  { -3825, 4497, -561, -2634 },
-  { -6167, 3012, -48, -3149 },
-  { -4828, 3515, -969, -4475 },
-  { -5789, 2757, -539, -4173 },
-  { -2452, 3067, 564, -4249 },
-  { -4921, 1358, 1331, -2889 },
-  { -3127, 4239, -1045, -1523 },
-  { -4780, 2326, -1118, -3446 },
-  { -3908, 5546, 152, -2622 },
-  { -6972, 2976, 337, -2809 },
-  { -4839, 4613, -35, -4077 },
-  { -1408, 4822, -1149, -4997 },
-  { -981, 4979, -912, -6304 },
-  { -2098, 5689, -888, -2878 },
-  { -3343, 4814, -657, -4434 },
-  { -2461, 3601, -967, -4869 },
-  { -2652, 3944, 87, -5520 },
-  { -1104, 6076, 174, -6407 },
-  { 355, 5370, -1721, -5869 },
-  { 1242, 4497, -1107, -5091 },
-  { -89, 4002, -1491, -5182 },
-  { 1059, 5693, -1591, -4905 },
-  { 1323, 4682, -2078, -4768 },
-  { 818, 3996, -549, -5468 },
-  { -287, 4529, 929, -5543 },
-  { -919, 5519, -2791, -2844 },
-  { -1407, 5679, -3289, -3974 },
-  { -189, 6530, -3547, -4002 },
-  { -900, 7039, -3371, -4855 },
-  { -2983, 7211, -363, -4835 },
-  { -814, 6503, -104, -5106 },
-  { -2386, 6896, 809, -4919 },
-  { 845, 4492, 352, -6621 },
-  { -1998, 7237, -1646, -4231 },
-  { -3380, 6251, 471, -4577 },
-  { -1908, 7059, 84, -5726 },
-  { -340, 6346, -803, -6265 },
-  { -2279, 5834, -47, -4633 },
-  { -1532, 5286, -1748, -1901 },
-  { -2757, 6188, -453, -3415 },
-  { -1255, 6405, -2043, -6357 },
-  { 918, 5581, -121, -5667 },
-  { 1840, 5336, -821, -5034 },
-  { -2475, 4992, -1825, -3104 },
-  { -2413, 5606, -1789, -4298 },
-  { 132, 5128, -2389, -4442 },
-  { 223, 6400, -2653, -4742 },
-  { -673, 5012, 680, -4582 },
-  { -1657, 6624, -349, -3596 },
-  { -755, 6289, -1860, -3978 },
-  { -572, 6894, -1946, -5207 },
-  { -1141, 4756, -2665, -5586 },
-  { -1073, 4269, -431, -4030 },
-  { 186, 5761, 916, -5868 },
-  { -1907, 4836, 1017, -5106 },
-  { -963, 3363, -1248, -6348 },
-  { -3262, 4774, -1818, -5858 },
-  { 847, 3812, -2538, -4302 },
-  { -1223, 5903, 1360, -5479 },
-  { -1094, 6923, -1244, -2381 },
-  { 267, 6276, -709, -2846 },
-  { -157, 5840, 1124, -4266 },
-  { 889, 3206, -910, -5305 },
-  { -1736, 3344, 582, -4838 },
-  { -2357, 5676, -2695, -6277 },
-  { -1916, 6901, -986, -5397 },
-  { -3062, 6028, -695, -5687 },
-  { 1836, 3566, -1357, -5226 },
-  { -2176, 4938, 646, -3872 },
-  { -2199, 3055, -208, -6124 },
-  { -236, 3032, -821, -5325 },
-  { -3989, 7277, -565, -3899 },
-  { -595, 4362, 74, -5975 },
-  { 684, 5874, -841, -4424 },
-  { -2731, 6305, -2389, -5465 },
-  { -5775, 1325, -56, -2528 },
-  { -7029, -534, -1890, -3278 },
-  { -5798, -15, -2734, -2210 },
-  { -5504, -1198, -353, -3659 },
-  { -5079, 960, -894, -4336 },
-  { -6073, -36, -133, -3014 },
-  { -5782, -259, -1025, -3986 },
-  { -6843, 1262, -807, -1639 },
-  { -5263, -918, -3290, -579 },
-  { -4840, 461, -2158, -533 },
-  { -6014, -50, -620, 504 },
-  { -5843, 241, -1359, -282 },
-  { -5898, 577, 769, -3271 },
-  { -6833, -946, -466, -3347 },
-  { -6026, 1459, -512, -729 },
-  { -7361, 747, -388, -1110 },
-  { -6391, 2142, -1160, -2513 },
-  { -6995, 304, 498, -2673 },
-  { -6757, 679, -386, -433 },
-  { -5222, 1688, -1093, -1032 },
-  { -5019, 575, 184, -3627 },
-  { -4237, 628, -3507, -1243 },
-  { -7479, -456, -1722, -1486 },
-  { -6464, 713, -1273, -1153 },
-  { -6255, 1682, -606, -3607 },
-  { -7033, 1497, -71, -1955 },
-  { -6694, 1556, -1721, -3214 },
-  { -6114, -356, 813, -2575 },
-  { -5308, 632, -1851, -1636 },
-  { -5742, -911, -1733, 383 },
-  { -6083, -387, -2313, -879 },
-  { -6535, -530, -1505, -2083 },
-  { -4896, 1223, -2750, -1816 },
-  { -6392, -463, -3247, -2093 },
-  { -5373, 1264, -2706, -3042 },
-  { -3894, -1390, -1020, -891 },
-  { -6179, 1168, -1966, -1922 },
-  { -5162, 1668, -1617, -1916 },
-  { -6453, 920, -1169, -2432 },
-  { -6130, 2005, -536, -1519 },
-  { -6552, -98, -518, -1938 },
-  { -7528, 355, -1101, -1772 },
-  { -5745, 610, -247, -1360 },
-  { -7003, 177, -2064, -1958 },
-  { -6956, -570, -2220, -4225 },
-  { -7830, 791, -1394, -2774 },
-  { -7634, 480, -3171, -4224 },
-  { -7913, 1154, -350, -2381 },
-  { -5063, 1704, -1804, -2977 },
-  { -4887, -524, -2703, 188 },
-  { -5551, 406, -1620, -3063 },
-  { -7109, 1342, 381, -3021 },
-  { -6846, 631, -458, -3398 },
-  { -4606, -605, 11, -3930 },
-  { -8134, -225, -1738, -2648 },
-  { -7043, 402, -2734, -3059 },
-  { -7417, 1825, -2545, -4389 },
-  { -6971, -236, -1031, -665 },
-  { -5752, 2111, -1632, -3808 },
-  { -7660, -78, -624, -3135 },
-  { -6358, 619, -1951, -3911 },
-  { -8134, 408, -1935, -3695 },
-  { -6335, 1911, -2368, -4505 },
-  { -7116, 2163, -344, -2753 },
-  { 2357, 4488, 2220, -5682 },
-  { 1385, 3206, 2300, -5305 },
-  { 1419, 2557, 5203, -3516 },
-  { 262, 4315, 3920, -1847 },
-  { 3316, 3187, 1612, -5609 },
-  { 1729, 2350, 1673, -6068 },
-  { 1603, 6126, 1467, -2839 },
-  { -1339, 3316, 3691, -3530 },
-  { -563, 4618, 3180, -4548 },
-  { 463, 4624, 3111, -5614 },
-  { 1246, 5455, 3356, -5720 },
-  { 480, 2149, 5422, -2893 },
-  { 1768, 4827, 913, -5579 },
-  { -149, 5381, 4366, -3297 },
-  { 985, 3672, 2644, -92 },
-  { -258, 2911, 5817, -2213 },
-  { 3428, 3289, 3351, -3541 },
-  { -666, 3295, 4727, -2869 },
-  { 35, 6641, 4160, -4052 },
-  { 623, 6787, 3156, -4560 },
-  { 2654, 4360, 4676, -4632 },
-  { 1386, 5246, 4834, -4497 },
-  { 3488, 4574, 3856, -5946 },
-  { 383, 4481, 4168, -4110 },
-  { 1753, 3652, 4288, -3326 },
-  { 1344, 4905, 2508, -4660 },
-  { 1580, 4106, 3104, -2224 },
-  { 2027, 5038, 1683, -1554 },
-  { 446, 3699, 5872, -3013 },
-  { 4637, 4087, 3578, -5018 },
-  { 2629, 3560, 5331, -4900 },
-  { 1527, 6674, 2523, -4131 },
-  { -1437, 2804, 2528, -4464 },
-  { -229, 3355, 2016, -5537 },
-  { 3666, 3418, 4374, -4581 },
-  { 1192, 3799, 923, -6596 },
-  { 2040, 2956, 448, -5322 },
-  { 2468, 5768, 4029, -5869 },
-  { 3438, 6516, 3529, -6667 },
-  { 2737, 5495, 680, -5535 },
-  { 3896, 5727, 1801, -4958 },
-  { 4988, 4957, 3592, -6518 },
-  { -542, 4416, 5794, -2787 },
-  { 4136, 4354, 2064, -4696 },
-  { 3067, 5936, 1207, -3396 },
-  { 2789, 4966, 2405, -3854 },
-  { 1731, 3270, 3251, -1063 },
-  { 1767, 5537, 2084, -2349 },
-  { 465, 3116, 4532, -837 },
-  { 1499, 2627, 4610, -2212 },
-  { 122, 3095, 3642, -3552 },
-  { 2542, 2866, 2705, -6402 },
-  { 3134, 4323, 698, -4785 },
-  { 731, 1859, 3112, -5242 },
-  { 2553, 2980, 3241, -4846 },
-  { 1329, 5310, 1607, -6624 },
-  { 2468, 1858, 3476, -1034 },
-  { -172, 4996, 2000, -5562 },
-  { 2621, 4220, 1574, -3386 },
-  { -333, 1832, 3362, -4117 },
-  { 2169, 6762, 3065, -6225 },
-  { 2844, 5528, 3223, -4765 },
-  { 526, 5175, 1644, -4267 },
-  { 2922, 4426, 2414, -2610 },
-  { 452, 1399, -4516, -2636 },
-  { 2872, 1720, -4667, -1435 },
-  { 1279, 702, -5424, -1984 },
-  { 2187, 870, -5021, -1341 },
-  { 583, -144, -4628, -2464 },
-  { 3, 2237, -5284, -2827 },
-  { -19, 1005, -5460, -1819 },
-  { 2897, 2084, -5885, -515 },
-  { -400, 3370, -5527, -2947 },
-  { 1505, 2593, -5518, -1802 },
-  { 1341, 4534, -5094, -1899 },
-  { 3241, 3670, -5493, -1252 },
-  { -1287, 921, -5994, -1675 },
-  { 627, 408, -6652, -364 },
-  { -260, 1127, -4849, -3247 },
-  { 371, 3400, -5976, -2285 },
-  { 1533, 1566, -6373, -610 },
-  { 2462, 4274, -6184, -1254 },
-  { 1782, 3363, -6222, -1381 },
-  { 572, 4650, -5673, -2754 },
-  { 2674, 3414, -4460, -2154 },
-  { 3614, 3820, -6883, -398 },
-  { 1136, -1, -5511, -1112 },
-  { -1773, 1137, -5647, -2377 },
-  { -753, 2104, -6085, -2565 },
-  { -204, 3025, -4731, -1418 },
-  { -1486, 1438, -4380, -216 },
-  { 302, 858, -5786, -264 },
-  { 3486, 1495, -5234, -783 },
-  { 888, 2327, -3423, -3720 },
-  { -259, 772, -6596, -1311 },
-  { -1197, 2073, -5174, -1826 },
-  { 1500, 3470, -4462, -2645 },
-  { 3072, 1960, -3277, -2264 },
-  { 1841, 952, -4324, -2340 },
-  { 1994, 2200, -3940, -2923 },
-  { -1782, 1699, -4667, -1075 },
-  { -1464, 2906, -3468, -375 },
-  { 366, 2380, -3747, 1467 },
-  { -545, 1645, -4619, 376 },
-  { 1724, 2350, -2374, -3512 },
-  { 3184, 2628, -2996, -3275 },
-  { 734, 2010, -6239, -1479 },
-  { 524, 3756, -4496, -3263 },
-  { 1492, 3570, -3494, -3600 },
-  { -932, 618, -5389, -2894 },
-  { -133, 2161, -4083, -3267 },
-  { 786, 774, -3279, -3731 },
-  { 1078, 803, -3843, -3007 },
-  { -332, 3405, -3347, 40 },
-  { -17, 6, -4005, -3690 },
-  { -189, 4372, -4488, -2561 },
-  { -450, 3846, -3790, -1370 },
-  { 362, 2212, -5272, -15 },
-  { -1529, 791, -6802, -2296 },
-  { 2145, 4241, -4474, 376 },
-  { 1813, 2426, -2932, -2726 },
-  { -542, 4557, -3140, -1080 },
-  { 1192, 3784, -4371, -20 },
-  { 2784, 5188, -6399, -1394 },
-  { 431, 4561, -3673, -1398 },
-  { 1382, 3096, -4083, 1253 },
-  { 1209, 4224, -2930, 1500 },
-  { 2798, 2684, -6676, -606 },
-  { -2396, 1510, -5381, -2713 },
-  { -2625, 2542, -4032, -2880 },
-  { -1231, 3967, -4098, -2886 },
-  { -1393, 2374, -3862, -4525 },
-  { -2495, 1665, -1637, -5445 },
-  { -3854, 1759, -1750, -4944 },
-  { -2373, 1668, -2856, -6251 },
-  { -2668, 1981, -886, -4557 },
-  { -2927, 4427, -3451, -6172 },
-  { -1925, 2596, -4696, -2527 },
-  { -3202, 2847, -3928, -5896 },
-  { -3332, 1665, -5025, -3412 },
-  { -3212, 3115, -4155, -4062 },
-  { -1013, 3205, -5133, -3751 },
-  { -2022, 4595, -3947, -5611 },
-  { -3556, 1755, -3715, -2300 },
-  { -1784, 4114, -2723, -1773 },
-  { -3586, 4081, -2733, -4942 },
-  { -1608, 3685, -4154, -4573 },
-  { -3368, 4042, -4452, -6227 },
-  { -1407, 3881, -5729, -3719 },
-  { -2751, 3281, -5077, -4999 },
-  { -3791, 2410, -4906, -5288 },
-  { -730, 2303, -4217, -3755 },
-  { -1812, 2311, -5492, -3709 },
-  { -610, 4336, -3915, -3783 },
-  { -2841, 4337, -4278, -4430 },
-  { -1662, 4666, -4661, -3964 },
-  { -589, 5209, -4923, -3682 },
-  { -4155, 2234, -4076, -4218 },
-  { -3951, 2770, -2665, -2805 },
-  { -2302, 3228, -3717, -1908 },
-  { -3129, 4373, -2264, -2851 },
-  { -447, 1363, -3578, -4323 },
-  { -2648, 4237, -3159, -3071 },
-  { -4072, 3241, -3541, -4605 },
-  { -4507, 3458, -2339, -3838 },
-  { -1646, 997, -4926, -3970 },
-  { -3025, 1614, -3940, -1242 },
-  { -1337, 1756, -3163, -5529 },
-  { -3203, 1865, -3282, -4354 },
-  { -1646, 2118, -2203, -6018 },
-  { 174, 1871, -2707, -4639 },
-  { -2607, 1485, -4778, -4750 },
-  { -2199, 3991, -3134, -4879 },
-  { -2962, 3323, -2816, -2419 },
-  { -5286, 2495, -4548, -5395 },
-  { -2810, 3710, -2274, -4211 },
-  { -330, 3006, -2993, -4678 },
-  { -1187, 2411, -2743, -5196 },
-  { -664, 4033, -3101, -5641 },
-  { -1458, 3602, -2816, -5371 },
-  { -4116, 4923, -3321, -5630 },
-  { -4165, 2528, -2592, -4798 },
-  { -2759, 3080, -2333, -5719 },
-  { -5157, 3011, -5526, -6348 },
-  { -3095, 2126, -5881, -4234 },
-  { -4377, 3849, -3600, -6099 },
-  { -1994, 4947, -5235, -4753 },
-  { -1067, 600, -3258, -5133 },
-  { -4992, 3302, -2208, -5051 },
-  { -3377, 2981, -1655, -4815 },
-  { -3325, 2446, -1787, -6116 },
-  { -2341, 2737, -3240, -6347 },
-  { -2258, -3732, 3710, -1235 },
-  { -1558, -3849, 2694, -3012 },
-  { -599, -4837, 3050, -2951 },
-  { -2246, -5433, 2798, -1910 },
-  { -2255, -4989, 3260, 270 },
-  { -3026, -5353, 2693, -1036 },
-  { -1151, -6097, 1097, -3782 },
-  { -3391, -6012, 2130, -1303 },
-  { -2850, -4422, 3375, -480 },
-  { -1138, -3779, 1491, -4162 },
-  { -551, -3892, 3787, -2082 },
-  { -3221, -3676, 3144, -1202 },
-  { -3023, -5196, 2650, 605 },
-  { -1756, -5729, 2646, 321 },
-  { -2693, -4409, 494, -4797 },
-  { -1913, -4573, 3372, -1730 },
-  { -1277, -3604, 4061, -993 },
-  { -420, -4993, 1351, -4796 },
-  { -3052, -5333, 1435, -1242 },
-  { -602, -5034, 3869, -1141 },
-  { -2436, -4680, 1665, -3019 },
-  { -2657, -3658, 1459, -3391 },
-  { -1220, -6246, 2749, -525 },
-  { -3838, -4844, 2265, -1735 },
-  { -1247, -5679, 3356, -1417 },
-  { -917, -5448, 3342, 105 },
-  { -1756, -6839, 2276, -2350 },
-  { -412, -5206, 1764, -3539 },
-  { -1439, -6915, 1442, -3750 },
-  { -1381, -4439, 3863, -282 },
-  { -3482, -4953, 2726, -336 },
-  { -1376, -5931, 1714, -1987 },
-  { -1716, -4405, 2608, 105 },
-  { -1590, -5191, 2652, -2704 },
-  { -2149, -6442, 2453, -1263 },
-  { -3426, -3832, 2334, -1829 },
-  { -2747, -5948, 2362, -173 },
-  { -2435, -3267, 2966, -1710 },
-  { -3979, -4282, 2705, -775 },
-  { -356, -4238, 2544, -4343 },
-  { -1363, -6471, 2817, -1836 },
-  { -2878, -5117, 218, -3149 },
-  { -3539, -5196, 1710, -2356 },
-  { -2888, -4537, 2746, -1701 },
-  { -1870, -4439, 1496, -4121 },
-  { -1486, -3388, 3349, -2145 },
-  { -3333, -4138, 1467, -2876 },
-  { -345, -5340, 1012, -1190 },
-  { -1672, -4992, 2289, -1029 },
-  { -2146, -5528, 3038, -635 },
-  { -316, -3656, 3426, -3152 },
-  { -2695, -5812, 2336, -2050 },
-  { -2067, -6052, 737, -3258 },
-  { -2664, -4205, -350, -1266 },
-  { -617, -5406, 80, -4853 },
-  { -2418, -3825, 1853, -1326 },
-  { -1961, -4339, 583, -4315 },
-  { -1495, -5141, -133, -5205 },
-  { -3208, -6440, 1691, -2069 },
-  { -2632, -3633, 2325, -2761 },
-  { -2624, -5670, 1252, -3676 },
-  { -3687, -5608, 687, -2833 },
-  { -3320, -5707, 16, -3877 },
-  { -2738, -6112, 84, -5135 },
-  { 2277, -5661, 3076, 843 },
-  { 1555, -5769, 2821, -5236 },
-  { 536, -6381, 603, -4910 },
-  { 734, -4609, 3314, -4092 },
-  { 1836, -4547, 3267, -4322 },
-  { -13, -5976, 3752, -1607 },
-  { 1423, -6318, 2336, 398 },
-  { 365, -7779, 1498, -534 },
-  { 2104, -8366, 2946, -1345 },
-  { 143, -5545, 1898, -3756 },
-  { 655, -6852, 1430, 148 },
-  { 4, -6653, 2397, -59 },
-  { 2346, -5996, 4562, -934 },
-  { 1229, -7104, 2963, -598 },
-  { -528, -7048, 2887, -1790 },
-  { 1451, -6857, 3900, -1637 },
-  { 554, -6018, 3336, 9 },
-  { 3278, -5758, 4034, 129 },
-  { 3541, -7145, 4905, -1575 },
-  { 2339, -6907, 3464, -301 },
-  { 2775, -7301, 1667, -3894 },
-  { 539, -7887, 991, -4156 },
-  { 2115, -7421, 3131, -3075 },
-  { 2803, -8546, 2564, -5836 },
-  { 2869, -5833, 1620, -4561 },
-  { 2591, -7281, 3215, -4719 },
-  { -1228, -8477, 706, -4782 },
-  { 1967, -5243, 4813, -1940 },
-  { 701, -7010, 2273, -3893 },
-  { 915, -8470, 1918, -5620 },
-  { -94, -6715, 156, -3873 },
-  { 1074, -5607, 4389, -1017 },
-  { 2739, -6551, 1227, -3521 },
-  { 725, -7835, 2701, -1291 },
-  { -493, -7475, 2263, -1075 },
-  { -412, -6508, 2984, -744 },
-  { 665, -5451, 3725, -2692 },
-  { 1499, -8129, 3564, -2072 },
-  { 2870, -6333, 4487, -2108 },
-  { 706, -5007, 3911, -152 },
-  { -482, -8660, 1483, -2900 },
-  { 2481, -6596, 2518, -1715 },
-  { 1403, -6414, 1398, -5387 },
-  { 652, -6267, 583, -5942 },
-  { 694, -7540, 646, -6272 },
-  { 2275, -7614, 256, -5015 },
-  { 1416, -9727, 1900, -3153 },
-  { 2760, -6433, 3875, -3771 },
-  { 2325, -11196, 2182, -5155 },
-  { 1223, -11061, 1377, -5097 },
-  { 108, -10603, 307, -4952 },
-  { -118, -8268, 1650, -1572 },
-  { 1839, -7943, 1755, -612 },
-  { 2501, -9056, 981, -2969 },
-  { 2902, -8476, 1491, -5780 },
-  { 1995, -11175, 1585, -3643 },
-  { 696, -8212, 828, -2474 },
-  { 1526, -8649, 1380, -1210 },
-  { 461, -7253, 3222, -2229 },
-  { 2966, -8641, 4121, -3271 },
-  { 833, -6039, 2361, -1086 },
-  { 3565, -7312, 1980, -5427 },
-  { 2850, -8671, 3760, -1846 },
-  { 2643, -7281, 2163, -173 },
-  { 3463, -3706, -3132, -923 },
-  { 1315, -3825, -3443, 2 },
-  { 2594, -4083, -3815, 670 },
-  { 1826, -4291, -2741, -155 },
-  { 868, -3749, -4175, -298 },
-  { 2008, -4237, -3897, -517 },
-  { 1242, -3493, -4335, -1335 },
-  { -88, -4142, -3390, -1529 },
-  { 2176, -3488, -3822, -975 },
-  { 1706, -5188, -3415, -637 },
-  { 2717, -6159, -2333, -882 },
-  { 1276, -3978, -4361, 537 },
-  { 2471, -5556, -2866, -208 },
-  { 799, -4673, -4086, 56 },
-  { 1901, -4786, -3533, 270 },
-  { 3036, -3902, -3606, -333 },
-  { 2249, -3317, -4319, -144 },
-  { 2594, -4207, -2105, -2930 },
-  { 4008, -4774, -2626, -902 },
-  { 1038, -3659, -3496, -2454 },
-  { 2725, -3597, -3298, -1535 },
-  { 1662, -5803, -2813, 175 },
-  { 705, -3757, -3441, -1484 },
-  { 1860, -5987, -2821, -886 },
-  { 3786, -4918, -2199, -1929 },
-  { 3683, -4235, -2547, -1287 },
-  { 2531, -4896, -2956, -1593 },
-  { 1005, -5585, -3324, -180 },
-  { 1625, -5229, -1756, -3642 },
-  { 1494, -5041, -2989, -2685 },
-  { 2718, -4655, -3224, -867 },
-  { 2374, -6640, -1745, -2975 },
-  { 2133, -6436, -2477, -1499 },
-  { 1833, -4418, -3523, -1512 },
-  { 1128, -4910, -2658, -1106 },
-  { 689, -4777, -2831, -2085 },
-  { 3593, -5280, -2627, -315 },
-  { 3264, -3771, -2673, -1861 },
-  { 3202, -5602, -2409, 402 },
-  { 552, -4618, -2221, -3002 },
-  { 3095, -5356, -2666, -1083 },
-  { 3401, -4609, -3146, 45 },
-  { 3051, -4662, -2192, -2232 },
-  { 2798, -5552, -2462, -1941 },
-  { 2354, -5815, -2223, -2619 },
-  { 192, -3708, -2807, -2658 },
-  { 1886, -4226, -1862, -3529 },
-  { 2526, -3976, -2819, -2332 },
-  { 1577, -3870, -2711, -2806 },
-  { 1288, -5588, -3382, -1403 },
-  { 2711, -5399, -1564, -3253 },
-  { 1459, -5492, -2222, -322 },
-  { 2823, -5091, -2886, 776 },
-  { 3559, -5821, -2109, -1360 },
-  { 1587, -6331, -2760, -1909 },
-  { 2139, -5213, -2874, -2120 },
-  { 1318, -4337, -3695, -2098 },
-  { 821, -4471, -1849, -565 },
-  { 3329, -4782, -1725, -89 },
-  { 582, -4914, -4105, -1119 },
-  { 417, -4144, -4072, -2529 },
-  { -199, -3803, -2765, -4042 },
-  { 2731, -4283, -2143, 1 },
-  { 2911, -6187, -1951, -2116 },
-  { 1573, -6094, -493, -2838 },
-  { 2081, -6927, -864, -3211 },
-  { 1058, -7826, 79, -364 },
-  { 3147, -5570, -684, -978 },
-  { 3572, -5856, 1060, 1824 },
-  { 1143, -6702, -1478, 338 },
-  { 2341, -7220, -88, 260 },
-  { 3639, -6861, 668, 815 },
-  { 2227, -6268, -1706, 446 },
-  { 3390, -6082, -353, 1302 },
-  { 1123, -7556, -1237, -430 },
-  { 1729, -7742, 729, -218 },
-  { 1457, -6774, 587, 579 },
-  { 505, -6919, -569, 371 },
-  { 1106, -7245, 78, 158 },
-  { 2755, -6745, -1122, 338 },
-  { 3069, -6040, -1415, 986 },
-  { 2174, -7064, -1430, -283 },
-  { 1390, -8626, -446, -3031 },
-  { 3534, -6890, -431, 547 },
-  { 2267, -9618, 475, -2994 },
-  { 3672, -7673, 75, -115 },
-  { 2131, -7560, -1206, -750 },
-  { 2972, -7477, -685, -262 },
-  { 1604, -6637, -672, 699 },
-  { 1666, -7577, -577, -240 },
-  { 1591, -6554, -2158, -94 },
-  { 2348, -6286, -353, 1123 },
-  { 2017, -8810, -412, -1805 },
-  { 2892, -6713, -1765, -554 },
-  { 2500, -6828, -1995, -1197 },
-  { 3877, -6639, -224, -1655 },
-  { 2392, -7872, -91, -333 },
-  { 3562, -7370, -532, -2836 },
-  { 2552, -7614, 164, -1805 },
-  { 990, -6104, 218, 438 },
-  { 910, -7861, 312, -1195 },
-  { 1472, -6327, 372, -640 },
-  { 1576, -7143, -1983, -843 },
-  { 422, -7625, -457, -278 },
-  { 1797, -8532, 405, -1011 },
-  { 1088, -7396, -238, -2277 },
-  { 3209, -6753, -1431, -2072 },
-  { 2617, -6839, 100, -2573 },
-  { 2575, -8573, -387, -3188 },
-  { 3618, -6971, -1190, -321 },
-  { 2205, -7361, -1695, -2008 },
-  { 2985, -6297, 1464, 1179 },
-  { 2804, -7310, 1053, 338 },
-  { 1362, -6074, -1163, -840 },
-  { 3336, -6325, -1794, 21 },
-  { 2836, -8109, 818, -329 },
-  { 2791, -5879, 560, 1546 },
-  { 2392, -6064, 135, 100 },
-  { 1838, -6194, 596, 1085 },
-  { 1926, -7515, -414, -4901 },
-  { 3225, -7298, -1202, -1189 },
-  { 3960, -7558, -659, -719 },
-  { 3442, -6647, -1692, -1095 },
-  { 3381, -6441, 262, -886 },
-  { 1431, -8150, -1186, -1406 },
-  { 340, -8498, -150, -899 },
-  { 3004, -8149, -260, -953 },
-  { 2749, -6611, 563, 873 },
-  { -6647, -1325, -4517, -4691 },
-  { -6005, -1657, -4089, -3797 },
-  { -3157, 588, -5213, -3068 },
-  { -3311, -1425, -6329, -3726 },
-  { -5866, -819, -3857, -2744 },
-  { -5001, -1799, -1075, -4621 },
-  { -5330, -2650, -2672, -4664 },
-  { -4930, -539, -2363, -4010 },
-  { -2984, 10, -3863, -5749 },
-  { -1055, -2106, -3713, -4267 },
-  { -5476, -502, -4279, -6504 },
-  { -5231, -1543, -5018, -6425 },
-  { -5134, -363, -3165, -5109 },
-  { -3953, -771, -4107, -6393 },
-  { -2159, -563, -3652, -5342 },
-  { -3888, -2321, -919, -5057 },
-  { -1236, -597, -4235, -4193 },
-  { -4053, 675, -3083, -6174 },
-  { -2793, -1089, -5396, -3460 },
-  { -3000, -44, -2209, -6575 },
-  { -3336, -1531, -4313, -5160 },
-  { -2127, 128, -4851, -3692 },
-  { -3321, 136, -2067, -5660 },
-  { -5215, 1404, -4374, -4356 },
-  { -2747, 400, -6340, -3691 },
-  { -3926, -599, -5361, -5006 },
-  { -2875, -2592, -5143, -4092 },
-  { -4991, -1958, -5322, -4891 },
-  { -4965, -1318, -6652, -5333 },
-  { -4920, -1691, -3388, -5561 },
-  { -3644, -3354, -2688, -5982 },
-  { -5076, -919, -4563, -2984 },
-  { -6114, 250, -3884, -3915 },
-  { -4014, 744, -3973, -1924 },
-  { -5543, -1041, -5557, -3847 },
-  { -4711, -1352, -5649, -2603 },
-  { -3362, 775, -5305, -4879 },
-  { -5001, 107, -3554, -2888 },
-  { -6258, -1651, -6356, -6566 },
-  { -4529, 407, -5003, -3865 },
-  { -5154, 550, -5278, -5465 },
-  { -4195, -467, -1894, -3129 },
-  { -5022, 1127, -3349, -3314 },
-  { -6075, 1250, -4313, -5641 },
-  { -2677, -2283, -2312, -5903 },
-  { -4113, 193, -1195, -4833 },
-  { -3940, -1048, -1389, -5079 },
-  { -3703, 917, -4043, -4451 },
-  { -3366, -4231, -1534, -5488 },
-  { -3326, -3583, -2091, -4903 },
-  { -5144, 1254, -2532, -4949 },
-  { -5982, -870, -2545, -4555 },
-  { -3925, -157, -5367, -2281 },
-  { -6419, -746, -5668, -4371 },
-  { -5787, 518, -7096, -5805 },
-  { -4258, 954, -6453, -4321 },
-  { -4771, -695, -4158, -1639 },
-  { -7078, -760, -5195, -5877 },
-  { -7348, 83, -4101, -4586 },
-  { -2430, 184, -2874, -1679 },
-  { -2284, -3943, -2924, -5034 },
-  { -1804, -1785, -3002, -4710 },
-  { -4399, -2772, -1815, -4637 },
-  { -6340, -2626, -2824, -5191 },
-  { -4998, -5168, -3480, 1905 },
-  { -3958, -5492, -1599, 1579 },
-  { -2471, -3755, -276, 3182 },
-  { -3033, -5779, -1063, 1554 },
-  { -2936, -4829, -1290, 2386 },
-  { -1835, -5073, -3051, 1299 },
-  { -1724, -3771, -3935, 2324 },
-  { -5070, -2550, -3692, 768 },
-  { -4326, -5333, -297, 1878 },
-  { -3472, -5619, -3094, 992 },
-  { -3027, -4384, -3038, 2265 },
-  { -3201, -5332, 67, 2200 },
-  { -1681, -4373, -1947, 2461 },
-  { -3221, -3329, -4238, 2564 },
-  { -1262, -2968, -2915, 3227 },
-  { -3419, -1878, -3373, 2110 },
-  { -2244, -5583, -2012, 1288 },
-  { -1971, -5266, -990, 1812 },
-  { -2975, -2778, -452, 4063 },
-  { -2198, -1165, -3298, 2965 },
-  { -4782, -4894, -4767, 664 },
-  { -6002, -3950, -2806, 2025 },
-  { -3142, -3162, -2859, 3295 },
-  { -3262, -3340, -4123, 1596 },
-  { -4014, -3918, -1955, 3361 },
-  { -1700, -3463, -1346, 3449 },
-  { -4245, -4445, -4743, 1644 },
-  { -4180, -3969, -401, 3281 },
-  { -2782, -5240, -4117, 1156 },
-  { -5744, -4040, -1439, 3470 },
-  { -5063, -4663, -323, 3172 },
-  { -4531, -3319, -844, 3988 },
-  { -6226, -5125, -2064, 2976 },
-  { -3115, -3267, -1531, 3898 },
-  { -4628, -4421, -2864, 2808 },
-  { -4559, -2989, -3442, 2024 },
-  { -1775, -4487, -656, 2477 },
-  { -2664, -1865, -1884, 4081 },
-  { -1828, -2575, -3894, 3378 },
-  { -6441, -3677, -2025, 1677 },
-  { -4141, -2156, -1191, 3474 },
-  { -4802, -1623, -1727, 2160 },
-  { -5474, -2745, -1475, 2498 },
-  { -3664, -1056, -1975, 2491 },
-  { -4672, -3062, -2235, 2933 },
-  { -4205, -5960, -2849, 1517 },
-  { -4995, -5708, -1739, 1805 },
-  { -4892, -6080, -4793, 872 },
-  { -4270, -4172, -4263, 2185 },
-  { -4687, -1470, -2905, 1023 },
-  { -6446, -5017, -3919, 1000 },
-  { -6046, -5538, -3943, 2006 },
-  { -6028, -3750, -3953, 771 },
-  { -5959, -4582, -5024, 824 },
-  { -5818, -2576, -2249, 1326 },
-  { -5659, -5345, -1119, 2500 },
-  { -3346, -4155, 606, 2749 },
-  { -5680, -4827, -2501, 1838 },
-  { -6193, -2543, -1295, 840 },
-  { -6871, -4925, -3512, 1801 },
-  { -5605, -1788, -1895, 779 },
-  { -3922, -5712, -4644, 510 },
-  { -4745, -3869, -4533, 99 },
-  { -2984, -4907, -399, 1497 },
-  { 1847, -478, 3061, -5812 },
-  { 4450, -1116, 3609, -6570 },
-  { 3139, 99, 3007, -5532 },
-  { 2590, -3782, 3138, -4770 },
-  { 1881, 1204, 5778, -3404 },
-  { 3631, 2060, 5566, -5038 },
-  { 3461, 1961, 5167, -3800 },
-  { 2947, 273, 4536, -4389 },
-  { 4453, -1730, 5788, -4370 },
-  { 4032, 1805, 2666, -4534 },
-  { 3487, -944, 2313, -6028 },
-  { 1313, 34, 4210, -4067 },
-  { 5632, -1502, 5825, -5855 },
-  { 7736, -547, 4879, -5476 },
-  { 4906, -1512, 4760, -5760 },
-  { 3843, 447, 1091, -4958 },
-  { 2982, -1135, 5442, -4386 },
-  { 3579, 271, 3031, -6770 },
-  { 3932, -211, 4688, -5507 },
-  { 4411, 1720, 2387, -5584 },
-  { 5379, -479, 4575, -6280 },
-  { 3613, -362, 2012, -4885 },
-  { 3744, -2013, 4493, -5073 },
-  { 5693, 109, 4379, -3362 },
-  { 5475, -621, 5317, -3985 },
-  { 6411, -673, 5708, -4752 },
-  { 4933, -796, 7262, -4290 },
-  { 2804, 444, 6276, -3655 },
-  { 4120, -517, 6078, -4531 },
-  { 5119, 841, 3486, -3910 },
-  { 4738, 1539, 3525, -2970 },
-  { 5086, 370, 5895, -5640 },
-  { 4235, 2716, 4589, -5044 },
-  { 3691, 682, 6199, -4700 },
-  { 6111, -570, 6271, -6528 },
-  { 2611, 1277, 3756, -4802 },
-  { 4395, 970, 3807, -5879 },
-  { 5225, 2299, 3242, -4333 },
-  { 5144, 1778, 4946, -5545 },
-  { 2989, -3016, 3247, -5495 },
-  { 2983, 920, 2071, -6059 },
-  { 5270, -903, 4434, -2350 },
-  { 6415, -585, 3970, -3554 },
-  { 3866, -197, 5216, -2884 },
-  { 3767, -1298, 6702, -3315 },
-  { 6299, 2620, 5284, -6824 },
-  { 6654, 646, 3653, -4927 },
-  { 4770, 3047, 5160, -6287 },
-  { 5364, 434, 2919, -5207 },
-  { 2998, 1344, 4801, -2456 },
-  { 3896, 1013, 3773, -1864 },
-  { 2115, 655, 2999, -6344 },
-  { 5170, -981, 2849, -4464 },
-  { 2735, -2159, 2717, -5776 },
-  { 2430, -1952, 4392, -4559 },
-  { 6143, -1180, 3659, -4746 },
-  { 4978, -1483, 1726, -4875 },
-  { 3486, -2383, 3306, -4301 },
-  { 1434, -1372, 4171, -4770 },
-  { 3354, -2627, 1525, -5093 },
-  { 6790, 2386, 3995, -5909 },
-  { 1475, -2674, 3451, -4204 },
-  { 1999, -3494, 3693, -5556 },
-  { 4764, -2848, 2856, -5589 },
-  { -3677, 5131, 2827, -2934 },
-  { -2844, 7078, 2852, -3580 },
-  { -3902, 6434, 4118, -1911 },
-  { -1769, 7530, 3492, -3541 },
-  { -1937, 5679, -447, -1127 },
-  { -2456, 4680, 4196, -2407 },
-  { -2778, 8241, 1698, -4288 },
-  { -2876, 6104, 5182, -2387 },
-  { -2802, 7341, 4463, -2938 },
-  { -1025, 6267, 4752, -3201 },
-  { -2349, 5413, 2041, -3794 },
-  { -2252, 8225, 2856, -4269 },
-  { -1465, 4967, 4976, -2500 },
-  { -636, 7565, 3517, -4233 },
-  { -1905, 5618, 3904, -2942 },
-  { -302, 6816, 3343, -3316 },
-  { -2210, 4156, 2817, -3511 },
-  { -717, 6568, 1863, -2951 },
-  { -3873, 5682, 2164, -575 },
-  { -2878, 5835, 440, -2597 },
-  { -3228, 7701, 2610, -2514 },
-  { -3608, 8888, 3377, -2468 },
-  { -2582, 9717, 2519, -3126 },
-  { -5238, 6202, 2866, -2831 },
-  { -3428, 7370, 3056, -335 },
-  { -1681, 8836, 1210, -2010 },
-  { -3276, 6724, 1156, -3930 },
-  { -894, 8149, 827, -1258 },
-  { -2965, 8631, 2549, -1320 },
-  { -3961, 6902, 3581, 55 },
-  { -1894, 7745, 1750, -841 },
-  { -821, 6844, 850, -676 },
-  { -608, 6948, -4, -1376 },
-  { 615, 6524, 1089, -1147 },
-  { -2972, 5668, 1091, -489 },
-  { -157, 4649, 2904, -413 },
-  { 673, 5121, 1498, -66 },
-  { -390, 5902, 1611, -245 },
-  { -2349, 5478, 4772, -1320 },
-  { 88, 6798, 1972, -1859 },
-  { -1213, 5120, 2991, 200 },
-  { -2347, 6040, 2839, 376 },
-  { -578, 5976, 3364, -1796 },
-  { -1391, 5872, 3002, -965 },
-  { -564, 4496, 3946, -1186 },
-  { -2299, 6386, 3135, -2176 },
-  { -2131, 5641, 2011, 1223 },
-  { -772, 5807, 1124, 895 },
-  { -2837, 6758, 2297, -740 },
-  { -3091, 6298, 1415, -2126 },
-  { -4197, 6036, 1843, -3022 },
-  { -41, 6459, 92, 344 },
-  { -2241, 6860, 2095, -4396 },
-  { -1931, 7088, 2117, -2135 },
-  { -2375, 4422, 1688, -3169 },
-  { -1742, 6674, 1538, -119 },
-  { -4818, 7749, 4192, -1577 },
-  { -2004, 5672, 193, -430 },
-  { -3825, 6042, 2128, -1898 },
-  { -1108, 8033, 2119, -3013 },
-  { -2370, 5453, 1721, 266 },
-  { -1570, 7134, 614, -2638 },
-  { -1519, 8752, 3503, -4330 },
-  { -2050, 3845, 2907, -1126 },
-  { 5085, 4412, -335, -1923 },
-  { 3618, 1423, -613, -4012 },
-  { 4481, 3729, 589, -4631 },
-  { 4270, 3216, -1763, -3168 },
-  { 4241, 1796, -1701, -2796 },
-  { 4787, 2338, -487, -3639 },
-  { 2915, 3429, -621, -4753 },
-  { 5175, 1660, -1265, -3223 },
-  { 4280, 4057, -684, -4079 },
-  { 4980, 4419, -1455, -2719 },
-  { 5436, 2464, 387, -4197 },
-  { 4507, 4018, 1121, -3314 },
-  { 6020, 2401, -413, -3201 },
-  { 4200, 3789, -333, -2813 },
-  { 5229, 2493, -1194, -1878 },
-  { 5851, 2695, -492, -2292 },
-  { 5743, 3288, -697, -1221 },
-  { 5692, 2612, 979, -2227 },
-  { 5085, 2067, 1046, -1214 },
-  { 3163, 2240, -2098, -3435 },
-  { 5228, 1898, 145, -2397 },
-  { 5860, 3976, -418, -2872 },
-  { 6008, 3399, 1027, -3506 },
-  { 4126, 2035, 1865, -893 },
-  { 5375, 3596, 511, -2362 },
-  { 1937, 1493, -852, -122 },
-  { 3473, 4849, 547, -2603 },
-  { 4631, 2977, 1141, -1768 },
-  { 6149, 3050, -71, -1886 },
-  { 4069, 4353, -289, -1429 },
-  { 2884, 1225, -1388, 365 },
-  { 5485, 2518, -235, -571 },
-  { 1216, 4375, 1443, 398 },
-  { 4988, 3106, 107, -1435 },
-  { 4511, 2801, 307, -444 },
-  { 3235, 4386, 327, -676 },
-  { 2055, 3708, 1657, -305 },
-  { 5839, 2374, 290, -1385 },
-  { 5110, 3305, 1936, -4206 },
-  { 6416, 2920, 338, -2736 },
-  { 3350, 2824, -1269, -3881 },
-  { 4840, 1815, 464, 186 },
-  { 2399, 3332, 238, 1238 },
-  { 3516, 1363, 1582, 688 },
-  { 3582, 1874, 154, -4770 },
-  { 3261, 2878, 886, 283 },
-  { 3877, 2658, -327, 884 },
-  { 4151, 3436, 2173, -2923 },
-  { 3592, 3674, 1281, -1295 },
-  { 4561, 3730, -1114, -1747 },
-  { 4595, 3625, -558, -575 },
-  { 2577, 2348, 2267, 120 },
-  { 5242, 3299, 32, -3412 },
-  { 4264, 3637, 709, -2320 },
-  { 6556, 3570, -838, -2472 },
-  { 5745, 4014, -940, -1973 },
-  { 5629, 4475, 477, -3328 },
-  { 5269, 3199, 1682, -3085 },
-  { 4432, 2416, 1145, -3299 },
-  { 4465, 2505, 2162, -2186 },
-  { 4643, 4941, -88, -2885 },
-  { 4568, 5231, 552, -3915 },
-  { 5667, 3075, -1406, -2963 },
-  { 5418, 5259, -771, -2818 },
-  { -256, -7875, 511, -471 },
-  { -1813, -7971, -424, -396 },
-  { -306, -7006, 862, 282 },
-  { -2306, -6422, -1440, 508 },
-  { -245, -6787, 375, -100 },
-  { -1309, -6065, -20, 779 },
-  { -1656, -6047, -641, 1307 },
-  { -1496, -6522, 964, 726 },
-  { -2291, -6588, -202, 795 },
-  { -762, -7522, 1454, -558 },
-  { -2270, -7004, -834, -580 },
-  { -1139, -7078, 259, 362 },
-  { -2535, -7568, -1040, 49 },
-  { -3786, -7280, 934, -476 },
-  { -3336, -6368, 606, 1056 },
-  { -3602, -6924, 52, 714 },
-  { -2278, -6550, 1674, 204 },
-  { -2855, -5765, 930, 1530 },
-  { -2889, -7325, -215, 305 },
-  { -2749, -6080, -237, 1452 },
-  { -985, -6667, 1577, 400 },
-  { -2036, -6083, 380, 1267 },
-  { -2077, -7460, 380, -30 },
-  { -1775, -7175, 1540, -386 },
-  { -3065, -6927, 989, 168 },
-  { -2836, -7602, 117, -3392 },
-  { -1058, -6396, 593, -3078 },
-  { -844, -6062, 999, -236 },
-  { -3261, -6951, 1491, -720 },
-  { -2186, -8484, 75, -1287 },
-  { -2882, -7756, 456, -510 },
-  { -1800, -6879, 960, -1183 },
-  { -2554, -7241, 1614, -1474 },
-  { -2608, -5305, 392, 851 },
-  { -2973, -6562, -859, 858 },
-  { -2640, -5989, 1031, -416 },
-  { -977, -8366, 705, -1434 },
-  { -1213, -7409, -77, -1390 },
-  { -1335, -6657, 2125, -123 },
-  { -2544, -6862, 1852, -737 },
-  { -3235, -6422, 1752, -103 },
-  { -1300, -7557, 939, -348 },
-  { -3476, -7579, 202, -109 },
-  { -2482, -6572, 753, 619 },
-  { -2554, -8136, -648, -429 },
-  { -1012, -7870, -3, -421 },
-  { -3604, -6247, 32, -3102 },
-  { -1486, -7271, 2013, -1021 },
-  { -578, -6799, -523, 405 },
-  { -2841, -5948, 1644, 911 },
-  { -2411, -7473, 1084, -484 },
-  { -2238, -6033, 294, -1059 },
-  { -3459, -6470, -201, -790 },
-  { -2027, -6009, 1833, 805 },
-  { -1433, -8047, 1531, -1754 },
-  { -3258, -7884, 763, -1422 },
-  { -1544, -6928, -729, 478 },
-  { -2314, -8415, 74, -3757 },
-  { -3201, -5684, 95, -2214 },
-  { -2423, -8694, 725, -3631 },
-  { -3545, -7071, 1162, -1798 },
-  { -294, -9662, 403, -2274 },
-  { -2290, -5460, 1196, 402 },
-  { -1603, -6713, 903, -2363 },
-  { 4121, 2491, -3142, -2482 },
-  { 4500, 3305, -3671, -1567 },
-  { 5973, 3172, -1348, -534 },
-  { 4830, 3379, -1549, 643 },
-  { 5214, 3938, -2641, -2302 },
-  { 4639, 4826, -5532, -847 },
-  { 5639, 2731, -2170, -963 },
-  { 6084, 3487, -3525, -1346 },
-  { 5971, 3154, -2190, -2316 },
-  { 5618, 4865, -6927, 116 },
-  { 5345, 3568, -7391, 709 },
-  { 5429, 5078, -3811, -1524 },
-  { 6960, 2037, -3515, -1096 },
-  { 7092, 2531, -4557, -588 },
-  { 6061, 4247, -5651, -478 },
-  { 4595, 3684, -4907, -827 },
-  { 7497, 3213, -3048, -424 },
-  { 5996, 2137, -3098, -1745 },
-  { 6198, 5199, -2223, -2274 },
-  { 6888, 2851, -2768, -1675 },
-  { 6114, 4210, -2316, -954 },
-  { 7127, 4242, -3041, -1408 },
-  { 6126, 3668, -1517, -1427 },
-  { 6245, 6129, -4225, -1186 },
-  { 6816, 3213, -2101, -964 },
-  { 5345, 5276, -2643, -847 },
-  { 6592, 4665, -4338, 484 },
-  { 6746, 3751, -3443, 124 },
-  { 5453, 1980, -2738, 2606 },
-  { 4662, 2179, -4226, -1059 },
-  { 5571, 3208, -3554, 174 },
-  { 5256, 4447, -1815, -1481 },
-  { 5400, 2570, -1210, 235 },
-  { 7056, 2549, -2674, 318 },
-  { 4574, 4340, -2892, -130 },
-  { 6203, 4587, -3273, -305 },
-  { 5103, 1925, -2715, -2137 },
-  { 3905, 4296, -1700, 247 },
-  { 4421, 4605, -3299, 811 },
-  { 5671, 1273, -3870, -924 },
-  { 5486, 1805, -4901, 133 },
-  { 6437, 2578, -1828, -106 },
-  { 5530, 5253, -5058, 1223 },
-  { 4816, 2025, -1215, 1443 },
-  { 3457, 3525, -2456, 3217 },
-  { 3316, 2595, -1108, 2459 },
-  { 3068, 3810, -2207, 1926 },
-  { 6351, 5436, -6470, 600 },
-  { 6324, 4240, -5365, 2416 },
-  { 4851, 4774, -4075, 1878 },
-  { 4900, 3679, -5198, 1078 },
-  { 8347, 3633, -4565, -171 },
-  { 5244, 5718, -3853, 173 },
-  { 3960, 3492, -2939, 2105 },
-  { 6070, 3473, -2351, 161 },
-  { 8228, 3034, -3360, -901 },
-  { 7006, 3985, -1940, -1926 },
-  { 7123, 4681, -4301, -878 },
-  { 5122, 4097, -1851, -449 },
-  { 6200, 2060, -2251, 1049 },
-  { 7106, 3844, -7209, 2625 },
-  { 7108, 3370, -6734, 533 },
-  { 6859, 2849, -3992, 1360 },
-  { 5458, 2278, -3253, 1131 },
-  { -1072, -2109, 4783, -1073 },
-  { -319, -2604, 4257, -2418 },
-  { 2466, 1300, 3476, -314 },
-  { 2847, -1502, 5296, -141 },
-  { 1667, -1273, 5559, -2725 },
-  { 2877, -3402, 6434, 204 },
-  { 53, -2637, 5275, -1181 },
-  { 1091, -2215, 5803, -1549 },
-  { 2397, -922, 4327, 1182 },
-  { 219, -3747, 4647, -1564 },
-  { -29, -2705, 4812, 1277 },
-  { 1499, -2608, 5648, 1407 },
-  { 2139, -2399, 4202, 2791 },
-  { -426, -2064, 5528, 151 },
-  { 2560, -2803, 6179, -2806 },
-  { 4537, -2479, 3797, 1095 },
-  { 888, -3357, 5341, -415 },
-  { 4460, -1814, 5388, -1227 },
-  { 3920, -3268, 6364, -703 },
-  { 3343, -4698, 4410, 784 },
-  { 309, -1897, 6306, 1223 },
-  { 958, -3318, 4254, -3167 },
-  { -99, 1596, 6018, -1983 },
-  { -429, -853, 6407, 878 },
-  { 1170, -1322, 6290, -417 },
-  { 2288, -505, 6303, -1999 },
-  { 3312, -1674, 6749, -2494 },
-  { -415, -3401, 4721, -371 },
-  { -189, -1210, 4844, -2002 },
-  { 888, -4142, 4377, 130 },
-  { 2469, -4381, 5398, -2492 },
-  { 2879, -2912, 5094, -2598 },
-  { -717, -617, 5650, -685 },
-  { 1470, -3863, 5352, -1684 },
-  { 3935, -96, 3823, -730 },
-  { 3769, -430, 3168, 694 },
-  { 2556, 385, 3539, 512 },
-  { 77, -1415, 5111, 2655 },
-  { 2724, -2158, 6715, -822 },
-  { 1832, 1001, 5385, -1900 },
-  { 900, 2198, 4464, -559 },
-  { 441, 69, 5921, -1743 },
-  { -1161, 738, 6732, -308 },
-  { 257, 2035, 4091, 736 },
-  { 1607, 1288, 4355, -23 },
-  { -13, 1316, 4180, 1672 },
-  { 1511, 1336, 3057, 1435 },
-  { 2189, -3813, 4530, 939 },
-  { 3632, -706, 2646, 1375 },
-  { 4266, -3761, 4241, 1077 },
-  { 3101, -427, 5273, -1202 },
-  { 2293, 276, 4810, -313 },
-  { 3430, -1851, 3101, 2045 },
-  { 3453, -2979, 5142, 942 },
-  { 1683, -3281, 4802, 2002 },
-  { 3954, -4715, 5611, 578 },
-  { 1272, -155, 5085, 454 },
-  { 128, -194, 5095, 1409 },
-  { 820, 880, 5797, -2658 },
-  { -1095, 656, 5774, 1095 },
-  { 813, -1669, 4320, -3251 },
-  { -119, 518, 6372, -651 },
-  { 2922, -4299, 6115, -877 },
-  { 4205, -4273, 4004, 2642 },
-  { -1211, -3892, 224, 3127 },
-  { -34, -4371, 1321, 2318 },
-  { 77, -6326, 1201, 828 },
-  { 3995, -3775, 1958, 3233 },
-  { 178, -3301, 1985, 3318 },
-  { 2330, -3801, 1033, 3195 },
-  { 1413, -5536, 826, 1709 },
-  { 2468, -3499, 3653, 3631 },
-  { 741, -4617, 1723, 2008 },
-  { 1246, -3043, 2978, 3949 },
-  { -343, -4308, 2258, 2189 },
-  { -682, -4640, 454, 2272 },
-  { 1236, -4829, 2491, 1642 },
-  { -512, -3766, 1182, 3052 },
-  { 119, -3939, 3712, 971 },
-  { -1145, -4624, 1360, 2281 },
-  { 101, -4746, 2866, 1255 },
-  { -1500, -5455, 539, 1637 },
-  { -969, -5909, 1414, 1128 },
-  { -1261, -4939, -231, 2022 },
-  { -226, -5345, 1207, 705 },
-  { 2712, -5109, 3205, 1866 },
-  { -476, -5913, 273, 1208 },
-  { -2039, -4464, 624, 2545 },
-  { -2351, -3930, 2019, 2673 },
-  { -2675, -4849, 1522, 1990 },
-  { -1524, -3461, 1446, 3204 },
-  { 477, -5314, 1710, 1577 },
-  { 656, -3729, 2346, 2511 },
-  { 550, -5917, 1975, 1040 },
-  { 1728, -4704, 3067, 1058 },
-  { -9, -5247, 506, 1760 },
-  { -574, -5135, 1675, 1672 },
-  { 2129, -3781, 3444, 2313 },
-  { 1144, -4439, 2214, 2529 },
-  { 1292, -4160, 3185, 1833 },
-  { 2445, -3262, 2534, 3227 },
-  { 2266, -4401, 2023, 2400 },
-  { -587, -3602, 3408, 2067 },
-  { -885, -4951, 3228, 1174 },
-  { -728, -2711, 2807, 3552 },
-  { 1019, -3043, 3195, 2954 },
-  { 1888, -4615, 1140, 2454 },
-  { 660, -5616, 754, 800 },
-  { -1975, -5371, 1649, 1585 },
-  { -1544, -5436, 2422, 1081 },
-  { -422, -5882, 2390, 750 },
-  { 1336, -5557, 2441, 1230 },
-  { 136, -4001, 267, 2854 },
-  { -522, -3289, 2226, 2728 },
-  { -971, -4580, 2471, 708 },
-  { 704, -5306, 3300, 1001 },
-  { 325, -3464, 3555, 2398 },
-  { 794, -3686, 848, 3169 },
-  { 660, -3017, 4584, 3242 },
-  { -1486, -3978, 2170, 1644 },
-  { -1615, -4650, 2688, 1844 },
-  { 750, -4578, 538, 2239 },
-  { 1668, -5849, 1455, 1031 },
-  { 3486, -4681, 2030, 2183 },
-  { 2642, -5429, 1696, 1761 },
-  { 4491, -4502, 3538, 2767 },
-  { 3545, -4528, 3514, 2982 },
-  { 3269, -3676, 2758, 3966 },
-  { 5572, 1146, 209, -3379 },
-  { 7459, 1053, 593, -1896 },
-  { 4480, 200, -310, -4259 },
-  { 5577, -939, 242, -3992 },
-  { 8142, 442, 1257, -3083 },
-  { 5442, 1261, 1424, -3236 },
-  { 6260, -183, 3125, -2532 },
-  { 7179, 889, 1618, -2548 },
-  { 6416, 932, 2379, -2487 },
-  { 7094, 2560, 961, -3392 },
-  { 7322, 463, 2732, -3735 },
-  { 6632, 1577, 1912, -3272 },
-  { 6312, 1349, 3028, -3460 },
-  { 6105, 386, 1213, -977 },
-  { 5478, 1158, 1114, -486 },
-  { 6493, 410, 1686, -2180 },
-  { 6378, 1881, 1333, -2240 },
-  { 5711, 812, 1958, -1300 },
-  { 6844, 877, 730, -1189 },
-  { 6824, -245, 2249, -2000 },
-  { 7515, 1521, 1251, -3058 },
-  { 6697, 1051, 1300, -1749 },
-  { 6476, 1425, 811, -2773 },
-  { 7350, 465, -76, -2849 },
-  { 6975, 2095, 567, -2492 },
-  { 4691, 1736, 2660, -2289 },
-  { 7837, 1456, 340, -2767 },
-  { 7930, 507, 838, -2074 },
-  { 6106, 1502, 766, -1110 },
-  { 4891, -659, 835, -3954 },
-  { 7250, 141, 1369, -1523 },
-  { 7651, 67, 1651, -2298 },
-  { 7364, -305, 601, -3132 },
-  { 7179, 193, 2491, -2871 },
-  { 6504, -272, 2167, -1322 },
-  { 4456, 983, 2300, -421 },
-  { 4817, 457, 1695, 371 },
-  { 6914, 555, 850, -3159 },
-  { 5904, 1030, 202, -1959 },
-  { 6258, 880, 2233, -4503 },
-  { 6029, 10, 2130, -3600 },
-  { 6449, 985, 1129, -3963 },
-  { 6616, -18, -111, -3285 },
-  { 4496, 775, 817, -4276 },
-  { 6134, 2338, 1470, -2973 },
-  { 6911, 152, 430, -1946 },
-  { 4053, 991, 3218, -1193 },
-  { 5435, 1285, 3124, -2412 },
-  { 5507, 1836, 1935, -1988 },
-  { 5240, 689, 2189, -2670 },
-  { 6638, 1719, 606, -1799 },
-  { 5556, -180, 129, -2595 },
-  { 5644, 1918, 1281, -4316 },
-  { 6410, 1088, -282, -3117 },
-  { 6503, 1841, 312, -3514 },
-  { 6947, 20, 1358, -3886 },
-  { 5464, 2109, 2398, -3194 },
-  { 5616, -407, 2140, -498 },
-  { 6121, 2707, 2379, -4096 },
-  { 7303, 1846, 2266, -4095 },
-  { 5444, 470, 2718, -1553 },
-  { 5817, -645, 3285, -1349 },
-  { 5625, 1427, 1103, -1991 },
-  { 6041, -806, 1196, -2943 },
-  { 3050, -5722, 4070, -5460 },
-  { 3420, -4386, 4078, -5155 },
-  { 6020, -3982, 7268, -2689 },
-  { 7502, -4317, 7894, -3973 },
-  { 4156, -3558, 5247, -4316 },
-  { 4725, -4401, 7290, -1540 },
-  { 6688, -5122, 8216, -3210 },
-  { 9176, -6576, 9276, -4963 },
-  { 8706, -5708, 7987, -4621 },
-  { 7060, -3535, 6532, -3308 },
-  { 5600, -2719, 5363, -1568 },
-  { 4661, -2803, 6263, -4716 },
-  { 3673, -3636, 6147, -3433 },
-  { 5305, -2585, 6073, -2638 },
-  { 7614, -1962, 6079, -5266 },
-  { 6760, -3366, 7382, -4322 },
-  { 6385, -3883, 4797, -1353 },
-  { 8182, -5120, 4298, -4641 },
-  { 9130, -6198, 4975, -3063 },
-  { 7421, -5436, 5576, -3713 },
-  { 3483, -4898, 5443, -2745 },
-  { 4907, -5643, 6390, -4105 },
-  { 8119, -7008, 7992, -6764 },
-  { 6528, -6122, 6967, -5590 },
-  { 5890, -4190, 6624, -5688 },
-  { 6815, -7934, 7275, -5456 },
-  { 5434, -4306, 5169, -5378 },
-  { 4364, -6436, 5376, -2604 },
-  { 8152, -3404, 5913, -5048 },
-  { 7983, -4863, 4262, -2461 },
-  { 8023, -6188, 6238, -5062 },
-  { 6753, -3692, 3935, -3723 },
-  { 6826, -4760, 3284, -4051 },
-  { 7224, -7423, 4492, -3875 },
-  { 6904, -2590, 6587, -6248 },
-  { 6106, -1944, 7345, -5506 },
-  { 4956, -2990, 7808, -3146 },
-  { 6908, -6885, 5949, -1288 },
-  { 7162, -6058, 3419, -3401 },
-  { 7015, -7080, 6907, -3018 },
-  { 6971, -6832, 5646, -3273 },
-  { 8014, -5546, 5471, -1544 },
-  { 6792, -2220, 5105, -2879 },
-  { 8494, -3974, 4408, -3999 },
-  { 9591, -4866, 6027, -4558 },
-  { 5264, -5161, 6101, -738 },
-  { 5803, -6141, 5197, -5231 },
-  { 4657, -6822, 3232, -5189 },
-  { 4791, -5135, 3809, -4665 },
-  { 6108, -5103, 2379, -3873 },
-  { 4680, -3909, 3234, -5093 },
-  { 5802, -3853, 3795, -4984 },
-  { 4360, -7483, 4802, -3877 },
-  { 5429, -7517, 5911, -3717 },
-  { 6866, -2280, 4880, -4634 },
-  { 10131, -4628, 4414, -4092 },
-  { 10811, -5189, 7746, -5337 },
-  { 5663, -8941, 5287, -5680 },
-  { 8023, -5991, 7403, -2796 },
-  { 9669, -6919, 6525, -4932 },
-  { 7275, -3796, 4962, -2547 },
-  { 8848, -4806, 5677, -3080 },
-  { 8128, -4308, 7749, -6569 },
-  { 4032, -5196, 2282, -6239 },
-  { 6593, 700, -229, 304 },
-  { 8260, 539, -66, -1259 },
-  { 6605, 176, -814, -109 },
-  { 8057, 0, -1, -136 },
-  { 7382, -38, -484, -1129 },
-  { 8373, -929, 682, -454 },
-  { 7674, 690, -1278, 546 },
-  { 7326, -517, 406, -1283 },
-  { 7612, -1715, -1167, 1175 },
-  { 8590, 441, -782, -710 },
-  { 8572, -1202, -291, 260 },
-  { 7308, -147, -1785, 414 },
-  { 6787, -353, -672, 934 },
-  { 5177, -133, 179, 82 },
-  { 4161, -34, 447, 1497 },
-  { 5997, -902, 1533, -121 },
-  { 5727, -871, -1370, 945 },
-  { 8386, -252, 293, -823 },
-  { 6573, -1354, 682, 616 },
-  { 7650, -2096, 725, 457 },
-  { 8122, 78, 636, -1400 },
-  { 8421, 428, -1620, 131 },
-  { 7341, -1292, -717, 186 },
-  { 7998, -49, -720, 266 },
-  { 5987, -351, 669, 844 },
-  { 7314, -1620, 250, -603 },
-  { 7219, -1562, -572, 1994 },
-  { 8682, -358, -290, -388 },
-  { 5810, 155, -178, 1199 },
-  { 7246, -12, 1042, -786 },
-  { 7357, -923, 1468, -475 },
-  { 7801, 621, -212, -724 },
-  { 5346, -514, 1210, 1356 },
-  { 8459, 36, -127, -779 },
-  { 6878, -2429, 854, 1750 },
-  { 7280, -1401, -1353, 2845 },
-  { 7579, -2148, -1463, 2087 },
-  { 6637, 946, -872, 750 },
-  { 4807, -1100, 1289, 2602 },
-  { 4495, 219, 1551, 1128 },
-  { 7639, 506, 446, -1107 },
-  { 6359, 188, 1009, -115 },
-  { 6641, -1820, 1655, 723 },
-  { 5394, -2382, 1604, 2542 },
-  { 6021, -2644, 2396, 1407 },
-  { 4698, 882, 245, 1525 },
-  { 8103, 573, -798, -349 },
-  { 8045, -519, 997, -1092 },
-  { 7571, -122, 227, -338 },
-  { 5347, -1200, 630, 1718 },
-  { 7070, 790, 218, -544 },
-  { 7440, 728, -527, -20 },
-  { 6402, -355, 197, -736 },
-  { 4031, 771, 866, 1895 },
-  { 6009, 896, 445, -31 },
-  { 5160, 1098, -856, 1784 },
-  { 7980, -886, -1293, 1396 },
-  { 6318, -1361, 2423, 252 },
-  { 7547, -699, 133, 506 },
-  { 8562, -2344, 940, 264 },
-  { 5890, 1187, -1425, 2194 },
-  { 6558, -645, -1311, 2621 },
-  { 4634, -1671, 2075, 1623 },
-  { 5614, 105, -816, 2376 },
-  { 6646, 1558, -1365, 630 },
-  { 6998, 1150, -2117, -990 },
-  { 6555, 2311, -1093, -1783 },
-  { 6682, 1430, -2391, -1940 },
-  { 7861, 1555, -2977, -1188 },
-  { 6745, 1723, -459, -2085 },
-  { 7504, 1229, -1666, -2060 },
-  { 7937, 671, -2128, -1529 },
-  { 7139, 991, -735, -2632 },
-  { 6867, 1592, -1303, -2324 },
-  { 6401, 2230, -1732, -2508 },
-  { 7201, 2184, -2169, -1988 },
-  { 6636, 2190, -995, -2840 },
-  { 7620, 2306, -2089, -651 },
-  { 7584, 1875, -1438, -631 },
-  { 9214, 1561, -2464, -1139 },
-  { 6154, 1318, -1237, -2917 },
-  { 7917, 2847, -1797, -1599 },
-  { 8309, 2029, -2555, -465 },
-  { 8204, 1282, -584, -2405 },
-  { 8440, 1035, -1147, -1137 },
-  { 7107, 1858, -60, -1568 },
-  { 6781, 2912, -873, -1463 },
-  { 7603, 1316, -319, -1249 },
-  { 7833, 1335, -78, -1849 },
-  { 7930, 1141, -1016, -695 },
-  { 7883, 1610, -1017, -1314 },
-  { 8069, 1409, -1811, -196 },
-  { 8319, 1031, -582, -1590 },
-  { 5948, 1537, -2153, -2373 },
-  { 8684, 1171, -1871, -850 },
-  { 8357, 2484, -2411, -1292 },
-  { 6516, 2092, -193, -1167 },
-  { 6112, 1697, 22, -525 },
-  { 7161, 703, -602, -1879 },
-  { 6047, 2351, -807, -219 },
-  { 8072, 1854, -1817, -1553 },
-  { 6956, 1304, 76, -1011 },
-  { 6607, 1481, -544, -162 },
-  { 6958, 2541, -265, -1938 },
-  { 6416, 2514, -777, -850 },
-  { 7272, 2110, -899, -1171 },
-  { 7741, 2153, -283, -2614 },
-  { 6482, 2041, -1758, -1221 },
-  { 6762, 940, -1862, -2281 },
-  { 5610, 1194, -1691, -1561 },
-  { 7833, 2164, -823, -1952 },
-  { 5460, 1438, -848, 1189 },
-  { 6011, 1377, -771, -1557 },
-  { 7679, 544, -1134, -2214 },
-  { 7209, 1292, -2714, -1564 },
-  { 5567, 1200, -404, -169 },
-  { 5853, 1461, -1465, -518 },
-  { 6782, 689, -844, -860 },
-  { 7330, 1337, -1152, -71 },
-  { 7189, 1506, -653, -685 },
-  { 6860, 2116, -1403, -240 },
-  { 8804, 1516, -1391, -1760 },
-  { 7210, 2689, -1498, -989 },
-  { 7030, 3022, -1441, -2083 },
-  { 5649, 1836, -407, 525 },
-  { 7451, 3099, -717, -2464 },
-  { 7384, 1656, -2007, 398 },
-  { 6504, 707, -1919, -134 },
-  { -1851, 3639, -2279, -695 },
-  { -4037, 1644, -77, 1329 },
-  { -4025, 1960, -1565, -567 },
-  { -3430, 2495, -795, 368 },
-  { -4771, 2480, 993, 756 },
-  { -3431, 2058, -2539, -971 },
-  { -3802, 3418, 380, 217 },
-  { -3074, 3350, -1652, -1056 },
-  { -3705, 326, -1650, 1535 },
-  { -3122, 1281, -1192, 1607 },
-  { -4601, 1367, -968, 53 },
-  { -3808, 958, 44, 2560 },
-  { -2079, 2530, -1485, 1166 },
-  { -3707, 343, -2889, 180 },
-  { -5249, 1431, -31, 688 },
-  { -4990, 125, -704, 1270 },
-  { -2771, 1334, -2446, 746 },
-  { -2292, 994, -1527, 2630 },
-  { -1261, 3070, -2519, 268 },
-  { -2544, 3890, -1057, -552 },
-  { -4421, 255, -1980, 530 },
-  { -2951, 454, -13, 3643 },
-  { -2262, 1815, -370, 2880 },
-  { -2383, 3657, -649, 576 },
-  { -3541, -161, -1389, 2550 },
-  { -4241, 1575, 1325, 2561 },
-  { -2767, 4037, 1221, 1578 },
-  { -3748, 2697, 1148, 1801 },
-  { -4686, 2385, -220, 0 },
-  { -1531, 1645, -2751, 1327 },
-  { -45, 4032, -799, 2298 },
-  { -2915, 2280, 709, 2495 },
-  { -1199, 3278, -406, 2346 },
-  { -2471, 116, -2706, 2060 },
-  { -2440, 2173, -2894, -344 },
-  { -3375, 2287, 1781, 3226 },
-  { -2153, 3568, 1827, 2918 },
-  { -862, 2267, -1626, 2527 },
-  { -2698, 1135, 301, 4239 },
-  { -2364, 2123, 1010, 3710 },
-  { -2447, 3281, -81, 1408 },
-  { -2660, 4735, 472, 258 },
-  { -1053, 3097, 2682, 2398 },
-  { -3366, -1037, -1152, -868 },
-  { -643, 4242, 2212, 1259 },
-  { 971, 3991, 934, 643 },
-  { -1617, 2002, 2139, 2195 },
-  { -4897, 972, 784, 1719 },
-  { -1275, 2992, 1039, 3821 },
-  { -392, 4973, -209, 1821 },
-  { -1028, 4718, -1479, -137 },
-  { 50, 3914, 553, 2210 },
-  { 678, 4364, 359, 1303 },
-  { -582, 4911, 514, 1671 },
-  { 1276, 3914, -1252, 2934 },
-  { -1496, 3984, 857, 2330 },
-  { 772, 4744, -655, 2332 },
-  { -799, 5283, -439, 624 },
-  { 1341, 2937, 650, 2027 },
-  { -1739, 4892, 1275, 1702 },
-  { -892, 2596, -151, 3951 },
-  { -3532, 1090, 1292, 32 },
-  { 321, 3146, 2647, 1475 },
-  { 264, 4199, -1591, 1317 },
-  { -452, -2357, 2266, 4192 },
-  { 3022, -1033, -2389, 5678 },
-  { -1162, -1342, 3543, 4990 },
-  { -474, -1477, -1223, 5016 },
-  { -699, -2857, 900, 3835 },
-  { -461, -2255, -117, 4626 },
-  { 1204, -2062, -1211, 4403 },
-  { 2192, -3035, -337, 3966 },
-  { 108, -831, 279, 5643 },
-  { 1457, -620, -2908, 5276 },
-  { -2527, -78, 1085, 5460 },
-  { -1978, -1918, -949, 4733 },
-  { 32, 367, -1904, 5166 },
-  { 1890, -1665, 440, 4752 },
-  { -518, -348, 2816, 4891 },
-  { 3695, -2490, -1374, 4603 },
-  { 246, -1965, 3549, 3969 },
-  { 1100, -3111, 656, 3737 },
-  { -1379, 870, -414, 4575 },
-  { 628, -357, -1227, 6179 },
-  { -1129, -1318, -2457, 4576 },
-  { -425, -98, -73, 6336 },
-  { 367, -887, 2990, 4207 },
-  { 2091, -1251, 2444, 3557 },
-  { -1759, -1610, 2046, 5273 },
-  { 3210, 1414, -20, 2616 },
-  { 3303, -2636, 1005, 4237 },
-  { -327, -3107, -640, 3687 },
-  { -197, 764, 572, 5486 },
-  { 646, -767, 1388, 5464 },
-  { 104, 2742, -228, 3907 },
-  { -236, 1829, -579, 4585 },
-  { -2150, -474, -1525, 4006 },
-  { -23, -2632, -2400, 3892 },
-  { -12, -1739, -2910, 4867 },
-  { -2310, -368, -102, 4583 },
-  { -1991, -2061, 533, 4531 },
-  { 3884, -1446, -153, 4393 },
-  { 1568, 14, -289, 5268 },
-  { -1376, -253, -2797, 3417 },
-  { 3193, -2577, 2475, 3566 },
-  { 3418, 617, 1350, 1857 },
-  { 3792, -24, -272, 3370 },
-  { 153, 1159, 2906, 2877 },
-  { 511, 2162, 1548, 2741 },
-  { 262, 819, -2791, 3734 },
-  { 4232, -2015, 1486, 3477 },
-  { 2943, -1110, -1014, 5480 },
-  { 2842, 369, 703, 3476 },
-  { 3011, 1634, -933, 3553 },
-  { 4412, -1548, -942, 5021 },
-  { -1405, 593, 2372, 5267 },
-  { 2093, 2129, 896, 2365 },
-  { 4845, -1980, 0, 3823 },
-  { -2140, 81, 3278, 5637 },
-  { 1484, 2665, -324, 3653 },
-  { 10, 192, 1620, 5291 },
-  { 2152, 738, -2269, 5000 },
-  { 2102, 2748, -1652, 4707 },
-  { 2855, -2131, -387, 5188 },
-  { 1173, 676, 1338, 3277 },
-  { 2340, -2329, -2064, 4095 },
-  { 861, -2024, 1296, 5055 },
-  { 2189, 3225, -695, 2626 },
-  { 6196, -7079, 1943, -822 },
-  { 4547, -4813, 3261, 1856 },
-  { 4243, -6904, 3443, 448 },
-  { 4581, -7503, 946, 506 },
-  { 6626, -7754, 3427, 470 },
-  { 3407, -9088, 3269, -1496 },
-  { 4079, -6464, 2304, 777 },
-  { 5621, -9336, 2684, -768 },
-  { 5351, -6464, 5238, -214 },
-  { 5961, -8007, 1724, -3091 },
-  { 4213, -8067, 603, -246 },
-  { 7208, -7403, 3168, -1738 },
-  { 6098, -7700, 329, -1379 },
-  { 6525, -6735, 4248, -1072 },
-  { 6073, -6241, 2167, -2378 },
-  { 4609, -9218, 3051, -1033 },
-  { 6813, -7283, 1581, -1897 },
-  { 6126, -6275, 2789, 681 },
-  { 4423, -6538, 1621, -1692 },
-  { 6272, -8298, 3167, -1855 },
-  { 6172, -8558, 4498, -1169 },
-  { 4844, -8588, 1647, -366 },
-  { 6209, -8807, 1581, -369 },
-  { 5389, -8059, 550, -192 },
-  { 6654, -9775, 2504, -1063 },
-  { 7103, -7998, 806, 530 },
-  { 5662, -6736, 1565, -3620 },
-  { 4165, -9564, 4191, -2131 },
-  { 4526, -7181, 576, -2875 },
-  { 4633, -8623, 2807, -4742 },
-  { 3709, -7794, 1815, 34 },
-  { 3634, -8622, 2313, -826 },
-  { 6991, -8447, 2063, -3198 },
-  { 7757, -9486, 2255, -558 },
-  { 4149, -7778, 4728, -1696 },
-  { 5767, -7427, 1113, 707 },
-  { 4592, -6261, 2329, 1864 },
-  { 3159, -10498, 1677, -4273 },
-  { 3534, -9010, 2437, -3565 },
-  { 4479, -10821, 2715, -4942 },
-  { 3207, -9805, 3054, -3886 },
-  { 4627, -8189, 3018, -2354 },
-  { 5527, -10566, 3244, -2749 },
-  { 4346, -10127, 3335, -3084 },
-  { 6132, -10085, 3316, -1308 },
-  { 5629, -9704, 2178, -3058 },
-  { 3603, -8538, 1246, -624 },
-  { 3737, -8488, 395, -3167 },
-  { 5465, -11414, 2810, -4640 },
-  { 5306, -7745, 2721, -3988 },
-  { 7000, -9111, 1695, -1409 },
-  { 6663, -7741, 2466, -4079 },
-  { 4083, -7175, 1836, -4831 },
-  { 3613, -9926, 1342, -3455 },
-  { 6588, -8033, 457, -258 },
-  { 4720, -8102, 17, -1209 },
-  { 7414, -8709, 1294, -344 },
-  { 5437, -10030, 4043, -1704 },
-  { 4862, -9281, 1558, -1431 },
-  { 6800, -6403, 5113, 862 },
-  { 4623, -8242, 2667, -228 },
-  { 5919, -5083, 3348, 2135 },
-  { 5985, -8889, 2733, -5105 },
-  { 5029, -5767, 4407, 719 },
-  { 354, -6158, -838, -3001 },
-  { 351, -5943, -2104, -1534 },
-  { -633, -7190, -25, -4798 },
-  { -1595, -7235, -3812, -1400 },
-  { 103, -6197, -2933, -78 },
-  { -1722, -5020, -3441, -4333 },
-  { -1963, -5644, -4365, -270 },
-  { -846, -5743, -3477, 196 },
-  { -191, -5348, -4054, -469 },
-  { -2515, -7754, -3495, -818 },
-  { -2090, -6710, -2701, 117 },
-  { -546, -7036, -1398, 163 },
-  { -278, -7091, -2662, -536 },
-  { -622, -7962, -2731, -1464 },
-  { -1555, -8118, -3612, -2057 },
-  { -1094, -6280, -2314, 505 },
-  { -2556, -8538, -4024, -2247 },
-  { 109, -7134, -3107, -1823 },
-  { -900, -6954, -3340, -717 },
-  { -605, -7113, -3656, -2154 },
-  { 837, -6263, -3211, -2177 },
-  { -417, -5810, -3871, -1469 },
-  { -1318, -5649, -4207, -3198 },
-  { 413, -6765, -2082, -33 },
-  { -3101, -6450, -4362, -766 },
-  { 755, -6489, -2967, -846 },
-  { 1117, -7106, -2452, -1352 },
-  { -1202, -8387, -3072, -2897 },
-  { -365, -4894, -3561, -2937 },
-  { -2372, -8776, -265, -4441 },
-  { -1224, -8678, -896, -5074 },
-  { -755, -10096, -600, -6623 },
-  { 300, -8206, -225, -4568 },
-  { -1176, -6824, -2633, -3527 },
-  { -2006, -5443, -1526, -5849 },
-  { -1115, -5540, -2363, -4785 },
-  { 1059, -6812, -2543, -2654 },
-  { -1976, -6861, -3062, -5508 },
-  { -379, -5328, -2321, -3624 },
-  { -2108, -5860, -4518, -1915 },
-  { -379, -7885, -1329, -594 },
-  { 774, -5389, -581, -5213 },
-  { -2601, -5083, -1849, -4921 },
-  { -176, -5580, 74, -5075 },
-  { -204, -6780, -190, -6232 },
-  { 418, -7594, -1987, -820 },
-  { -1873, -8529, -2926, -1609 },
-  { 1340, -6362, -919, -4975 },
-  { 577, -7990, -2044, -1873 },
-  { -2572, -7413, -1745, -2224 },
-  { -2037, -7030, -1461, -7138 },
-  { -2559, -8756, -2039, -5836 },
-  { -2079, -6764, -1209, -5669 },
-  { -1613, -7801, -2006, -685 },
-  { -1865, -6583, -722, -3529 },
-  { -589, -6358, -1377, -1003 },
-  { -540, -7514, -1331, -3542 },
-  { 419, -6192, -1677, -4927 },
-  { -2786, -8763, -2966, -5065 },
-  { -2172, -8411, -1726, -4675 },
-  { -3382, -9833, -3497, -5722 },
-  { -2433, -10169, -2077, -5775 },
-  { -424, -9451, -1096, -3658 },
-  { -537, -8522, -910, -1897 },
-  { -5550, 2807, 1683, -693 },
-  { -6395, 635, 3573, -1246 },
-  { -7544, 2280, 2140, 44 },
-  { -8751, 1136, 2951, -794 },
-  { -5605, 2709, 2052, 916 },
-  { -7650, 654, 869, 135 },
-  { -6939, 967, 1409, 870 },
-  { -7834, 2123, 3310, 974 },
-  { -6935, 2818, 1274, -1678 },
-  { -5605, 2233, 1013, 471 },
-  { -7095, 1849, 1648, 198 },
-  { -6636, 1634, 712, -37 },
-  { -7279, 978, 296, -315 },
-  { -7664, 3504, 3292, -216 },
-  { -7836, 1209, 1221, -257 },
-  { -7913, 2201, 1765, -1529 },
-  { -7077, 3783, 2632, -1407 },
-  { -5565, 1645, 1410, -622 },
-  { -6494, 2879, 1181, -759 },
-  { -7073, 3137, 3010, 550 },
-  { -7249, 1839, 847, -805 },
-  { -6630, 2197, 282, -1096 },
-  { -8836, 1573, 1988, -1090 },
-  { -7809, 1274, 836, -1198 },
-  { -7895, 2970, 3511, -1097 },
-  { -6960, 1664, 1356, -2442 },
-  { -6582, 2866, 2273, 307 },
-  { -7221, 821, 2851, -1435 },
-  { -6015, 1703, 2001, -2367 },
-  { -8082, 1034, 2103, 239 },
-  { -5952, 1912, 301, -465 },
-  { -6099, 841, 379, 567 },
-  { -6343, 50, 494, 658 },
-  { -6586, 983, 591, -893 },
-  { -5500, 869, 2187, -2479 },
-  { -6482, 60, 1545, -979 },
-  { -6705, 515, 1974, -53 },
-  { -6460, 1755, 1325, -1275 },
-  { -6093, 2617, 2465, -623 },
-  { -7330, 2161, 594, -2115 },
-  { -7324, 762, 1593, -2004 },
-  { -6385, 679, 1510, -2514 },
-  { -6159, 241, 2976, -1631 },
-  { -8583, 3030, 4045, -162 },
-  { -6299, 66, 2209, -2103 },
-  { -5428, 1279, 3267, -1846 },
-  { -6438, 1335, 2728, -1631 },
-  { -8012, 1070, 2428, -1151 },
-  { -6201, 2781, 2349, -1918 },
-  { -5918, 1139, 3121, -148 },
-  { -6314, 2481, 3137, -1808 },
-  { -7180, 1722, 2435, -1602 },
-  { -6750, 1829, 3763, -1145 },
-  { -6713, 1777, 2221, 1212 },
-  { -7479, 1835, 3627, -479 },
-  { -7299, 10, 2406, -1593 },
-  { -8249, 3129, 996, -2870 },
-  { -8374, 1534, 1333, -1882 },
-  { -7507, 3353, 1598, -2299 },
-  { -7379, 2701, 2326, -1167 },
-  { -8440, 2276, 2796, -542 },
-  { -10348, 1527, 2649, -1165 },
-  { -8184, 3614, 2574, -1738 },
-  { -5539, 1574, 1733, 1138 },
-  { 9404, -7652, 67, 79 },
-  { 8654, -3972, 1358, -60 },
-  { 8617, -4794, 117, 2318 },
-  { 7886, -4505, 1784, 1200 },
-  { 8636, -6125, 3879, -1003 },
-  { 9654, -6836, 1816, 205 },
-  { 9374, -6553, 913, 1875 },
-  { 8020, -6150, 1134, 2390 },
-  { 7786, -4970, 2078, -1857 },
-  { 8691, -6119, 711, 708 },
-  { 9039, -5568, 2944, -1902 },
-  { 9955, -5048, 1433, -601 },
-  { 8089, -6927, 3093, -2846 },
-  { 8487, -7024, 2415, 19 },
-  { 9388, -5287, 3577, -2655 },
-  { 8591, -7371, 2300, -996 },
-  { 9104, -4763, 1453, -2558 },
-  { 7615, -5457, 596, 164 },
-  { 9860, -7047, 3433, -614 },
-  { 8756, -4404, 2235, -964 },
-  { 9462, -4660, 299, -1822 },
-  { 10119, -5550, 2689, -1273 },
-  { 10915, -7471, 2705, -1007 },
-  { 11433, -7090, 1410, -1198 },
-  { 9882, -7431, 2965, -1895 },
-  { 7628, -5219, 769, -2661 },
-  { 8169, -5318, 2262, 70 },
-  { 8846, -6320, 1939, -754 },
-  { 7147, -5593, 1248, -971 },
-  { 10652, -5485, 935, 137 },
-  { 7778, -6533, 2564, -1932 },
-  { 8878, -5173, 1214, -361 },
-  { 9828, -4943, 282, 510 },
-  { 10042, -6134, 3895, -1914 },
-  { 7965, -6630, 3566, -433 },
-  { 8573, -4502, 3574, -1209 },
-  { 8398, -4801, 1031, -1347 },
-  { 10136, -7772, 2612, 1547 },
-  { 9890, -7280, 1768, -1083 },
-  { 8407, -6585, -706, -58 },
-  { 7976, -7582, 229, -131 },
-  { 10481, -8866, 1166, -147 },
-  { 10914, -4342, 3189, -2412 },
-  { 10440, -5198, -104, -1109 },
-  { 11227, -6530, 2381, -2449 },
-  { 8487, -8064, 1086, 230 },
-  { 9975, -6123, -857, -134 },
-  { 8339, -6498, 1232, -2337 },
-  { 11042, -4506, 1119, -2098 },
-  { 12563, -5592, 1837, -2062 },
-  { 11801, -5590, 632, -1296 },
-  { 10152, -5617, 1511, -1917 },
-  { 7800, -6473, 51, -1337 },
-  { 7941, -5560, 2438, -3270 },
-  { 6554, -3834, 2100, 1476 },
-  { 9065, -5520, -226, -1120 },
-  { 10794, -7120, -243, 122 },
-  { 10429, -6968, 272, -806 },
-  { 8942, -8914, 1442, -392 },
-  { 9969, -5051, 2033, -2953 },
-  { 7275, -4152, 3058, -64 },
-  { 11127, -5488, 4589, -3227 },
-  { 9626, -6666, 2739, -2958 },
-  { 6943, -5362, 4470, 1008 },
-  { -7456, -967, 2936, -1002 },
-  { -8622, -333, 6962, 2606 },
-  { -7486, -3392, 3668, 1287 },
-  { -8053, -827, 5148, 1097 },
-  { -6610, 454, 4952, 96 },
-  { -7701, -1982, 3161, -468 },
-  { -7307, -1132, 4071, -36 },
-  { -8125, -271, 5199, 3862 },
-  { -9182, -1950, 2813, 1878 },
-  { -9855, -952, 4794, 3010 },
-  { -7241, 1431, 4202, 2468 },
-  { -9646, 157, 4766, 1046 },
-  { -9371, 1230, 6009, 2958 },
-  { -11514, -64, 8630, 5248 },
-  { -6766, 565, 2766, 2140 },
-  { -8426, -9, 2852, 1271 },
-  { -11291, -1113, 5087, 2937 },
-  { -8297, 2092, 4495, 1264 },
-  { -9983, 735, 3809, -51 },
-  { -9048, -1000, 3191, -308 },
-  { -7331, -1987, 2655, 1391 },
-  { -7144, -21, 4333, 2161 },
-  { -6032, -1540, 3543, 896 },
-  { -7987, -1036, 1985, 1529 },
-  { -9264, 2004, 5194, 290 },
-  { -11308, -840, 5754, 1654 },
-  { -9130, -2398, 4292, 2973 },
-  { -6248, 838, 3563, 1223 },
-  { -6819, -2760, 3511, 119 },
-  { -7213, -2006, 4364, 762 },
-  { -5431, -1047, 4533, 166 },
-  { -7098, -641, 2021, 639 },
-  { -8628, -2249, 3588, 399 },
-  { -6352, -1498, 3560, -648 },
-  { -7033, -2190, 4870, 2562 },
-  { -7405, -46, 3772, -581 },
-  { -6104, 796, 5143, 1965 },
-  { -5787, 943, 5784, 3030 },
-  { -8367, 1465, 7192, 4097 },
-  { -8259, 789, 5694, 1963 },
-  { -10614, -1899, 5748, 2645 },
-  { -8258, -805, 3698, 2275 },
-  { -6877, -972, 6431, 3160 },
-  { -6483, 363, 7018, 3129 },
-  { -6283, -1358, 5191, 1524 },
-  { -8853, -3157, 4119, 1741 },
-  { -6086, -267, 3883, -835 },
-  { -7254, 1032, 6613, 4017 },
-  { -11470, -3350, 4649, 3426 },
-  { -6743, 481, 6148, 1239 },
-  { -5394, -166, 5309, 3165 },
-  { -7958, 1068, 4268, -240 },
-  { -10520, 2256, 7916, 2828 },
-  { -5132, -4, 5739, 1176 },
-  { -8643, 120, 3255, -629 },
-  { -9631, 1974, 8870, 4362 },
-  { -10663, -1221, 3733, 589 },
-  { -8224, -1843, 5806, 2655 },
-  { -8282, 1255, 8647, 3478 },
-  { -12311, -1505, 9043, 6256 },
-  { -11312, -856, 7136, 4681 },
-  { -11944, -722, 7941, 3309 },
-  { -7868, -463, 6846, 4196 },
-  { -8679, -241, 7410, 5347 },
-  { 6759, -4680, -508, 1220 },
-  { 5176, -6111, 944, 121 },
-  { 6843, -5667, -1368, -533 },
-  { 5616, -5884, -1471, -695 },
-  { 6030, -5089, -1808, -940 },
-  { 7444, -5463, -52, 1881 },
-  { 4207, -6079, -506, 1571 },
-  { 6785, -4410, -649, 3084 },
-  { 4838, -5214, 2026, 2998 },
-  { 4201, -5790, 645, 1811 },
-  { 6930, -5129, -1940, 1698 },
-  { 6332, -4627, 692, 3027 },
-  { 6285, -4314, -106, 3644 },
-  { 6255, -5450, -1975, 742 },
-  { 4199, -4676, -459, 1796 },
-  { 5592, -5500, 1345, 1300 },
-  { 4358, -5556, -2236, 114 },
-  { 4620, -5875, -1563, 888 },
-  { 4892, -7550, -327, -419 },
-  { 4734, -7085, 7, 613 },
-  { 3883, -5562, -1969, 1080 },
-  { 5610, -4990, -204, 834 },
-  { 4117, -6482, -1271, 341 },
-  { 6585, -5107, 892, 1169 },
-  { 6632, -3683, 302, 3002 },
-  { 6326, -5351, -983, -1250 },
-  { 4382, -7192, -730, -158 },
-  { 5227, -6540, -451, 1123 },
-  { 5468, -6472, -870, -1471 },
-  { 5191, -6402, -1365, -127 },
-  { 7407, -6317, -973, -336 },
-  { 4611, -6530, -820, -1980 },
-  { 4963, -5159, -2050, -966 },
-  { 4414, -5691, -211, -998 },
-  { 5954, -5873, 750, -1749 },
-  { 4394, -4796, -1268, 254 },
-  { 7161, -6214, -1010, 689 },
-  { 4965, -3598, 2372, 1711 },
-  { 6248, -6180, 981, 864 },
-  { 6473, -5336, 525, -600 },
-  { 4591, -6864, -1131, -900 },
-  { 6314, -6440, -1021, -375 },
-  { 5838, -6209, -1199, 944 },
-  { 5308, -5283, -2100, 1267 },
-  { 4342, -5860, -1637, -1356 },
-  { 5680, -4388, -1227, -104 },
-  { 4900, -4098, 1449, 4046 },
-  { 4677, -4284, -106, 3190 },
-  { 7574, -6173, -848, 1859 },
-  { 6493, -7207, -131, 726 },
-  { 5513, -5261, -2117, 4 },
-  { 6191, -7352, -193, -505 },
-  { 5885, -4333, 324, -134 },
-  { 6162, -6081, -312, -2044 },
-  { 4216, -6200, -1810, -572 },
-  { 5652, -7035, -696, -197 },
-  { 7131, -7189, -366, -60 },
-  { 5032, -4803, -1514, 2832 },
-  { 7386, -4610, -606, 3489 },
-  { 4211, -5031, 1221, 3047 },
-  { 4050, -4653, 1584, 1469 },
-  { 6852, -5302, -1861, 206 },
-  { 7736, -4816, -1794, 3359 },
-  { 6290, -3439, 1522, 2454 },
-  { 1768, 5990, -5560, -2594 },
-  { 3903, 5326, -1530, -1501 },
-  { 2472, 3738, -2117, -4240 },
-  { 3260, 5448, -904, -4733 },
-  { 1435, 7297, -3676, -4102 },
-  { 4096, 5951, -656, -3312 },
-  { 2178, 6009, -3146, -3724 },
-  { 3787, 5493, -5473, -1633 },
-  { 2998, 7286, -3334, -3571 },
-  { 2894, 6576, -4708, -2804 },
-  { 830, 6163, -4286, -3348 },
-  { 4755, 5569, -1730, -2739 },
-  { 4604, 6065, -3562, -2605 },
-  { 2749, 5141, -3986, -2775 },
-  { 3942, 4875, -2143, -3340 },
-  { 2819, 8517, -2004, -2724 },
-  { 2146, 6298, -689, -3093 },
-  { 5196, 6504, -3393, -1475 },
-  { 1851, 8386, -1748, -1420 },
-  { 3474, 8572, -3534, -2688 },
-  { 4503, 7560, -3561, -2245 },
-  { 4433, 6219, -2393, -1575 },
-  { 3506, 7248, -2275, -1977 },
-  { 3490, 7409, -3147, -604 },
-  { 4214, 6447, -3520, 516 },
-  { 619, 7034, -829, -1705 },
-  { 1732, 7395, -356, -2208 },
-  { 1226, 5204, -3294, -3732 },
-  { 2027, 5619, -1813, -4146 },
-  { 3078, 5877, 47, -2651 },
-  { 1654, 5458, 424, -682 },
-  { 3163, 5464, -2026, -270 },
-  { 2884, 5375, -685, -530 },
-  { 2950, 7286, -35, -2967 },
-  { 1986, 5066, -597, 482 },
-  { 3459, 4308, -3845, -2333 },
-  { 3155, 7037, -1346, -4345 },
-  { 2193, 6696, -717, -1319 },
-  { 3677, 5089, -3892, -487 },
-  { 2186, 5136, -4186, -1492 },
-  { 773, 5796, -917, 817 },
-  { 2489, 6546, -3570, -2117 },
-  { 1223, 6469, -1362, -33 },
-  { 271, 6061, -1466, -1725 },
-  { 2540, 5171, -1847, 1032 },
-  { 2548, 5251, -2697, 1677 },
-  { 771, 7600, -768, -632 },
-  { 4710, 6647, -4736, -1275 },
-  { 1369, 5917, -2971, -1056 },
-  { 163, 5239, -3499, -2275 },
-  { 2104, 4285, -3211, -3286 },
-  { 1107, 7411, -1972, -1671 },
-  { 2196, 7262, -2310, -1926 },
-  { -244, 6439, -1745, -839 },
-  { 3293, 3832, -2890, -3000 },
-  { 419, 6443, -379, -407 },
-  { 3077, 4930, -1156, -2869 },
-  { 2131, 5874, -2330, 224 },
-  { 690, 6538, -2212, -2841 },
-  { 1602, 4421, -2515, 1542 },
-  { 3318, 9373, -3032, -3477 },
-  { 5646, 7462, -5153, -1463 },
-  { 4139, 7137, -1539, -3321 },
-  { 3481, 9077, -1645, -3653 },
-  { -7747, 375, -106, -543 },
-  { -8587, -1379, -586, -461 },
-  { -10146, -892, 2094, 694 },
-  { -8103, 382, 504, -325 },
-  { -8548, -92, 94, -656 },
-  { -7460, 38, 152, 388 },
-  { -8266, -271, -459, -883 },
-  { -7935, -664, -1026, -802 },
-  { -8341, -109, 853, 161 },
-  { -8802, -1355, 1099, 630 },
-  { -8957, -6, 1108, -669 },
-  { -7260, -1520, -43, -407 },
-  { -7555, -174, 668, -2562 },
-  { -9014, -126, 227, -1191 },
-  { -8184, 769, 290, -1375 },
-  { -9476, 55, 962, -1528 },
-  { -8679, 541, 755, -1030 },
-  { -9842, -1626, 838, -1588 },
-  { -8513, -702, 788, -1998 },
-  { -10101, -1558, -366, -1841 },
-  { -8135, 78, 1479, -1813 },
-  { -9128, -454, 313, -1786 },
-  { -7554, -1084, 831, -2442 },
-  { -7576, -701, 2068, -1665 },
-  { -7791, -1481, 1587, -1808 },
-  { -6701, -596, -97, 802 },
-  { -7418, -15, 684, -963 },
-  { -7127, -477, -139, -426 },
-  { -8097, -110, -36, -264 },
-  { -7620, -1922, -590, -101 },
-  { -7647, -1201, 279, 660 },
-  { -7856, -1974, 758, -2271 },
-  { -8496, -167, 2232, -1143 },
-  { -8506, -1359, 624, -740 },
-  { -7274, -1052, 1062, -139 },
-  { -7800, -217, 91, -1794 },
-  { -7030, -1694, -955, 615 },
-  { -9020, -1864, 101, -2182 },
-  { -9400, -740, 598, -667 },
-  { -8448, -1184, 2024, -1272 },
-  { -8812, -570, -897, -2384 },
-  { -10559, -1286, 538, -1536 },
-  { -8728, -888, -1089, -1397 },
-  { -7080, -1185, 636, -1252 },
-  { -9880, 233, 2344, -782 },
-  { -7952, -1326, -378, -1947 },
-  { -7207, -378, 1408, -2237 },
-  { -8467, -1545, 902, -1987 },
-  { -9163, -1474, 924, -1739 },
-  { -8159, -992, -77, -2744 },
-  { -8343, 148, -423, -1573 },
-  { -9105, -649, -254, -1214 },
-  { -8939, 456, 281, -1905 },
-  { -8837, 179, -394, -2634 },
-  { -9145, 757, 1547, -1319 },
-  { -9775, -723, 441, -1680 },
-  { -8910, -686, 1529, -1525 },
-  { -9492, -1134, 2064, -938 },
-  { -6111, -943, 677, -31 },
-  { -7411, -613, -814, 46 },
-  { -9479, -922, -430, -2061 },
-  { -11298, -1268, 1318, -1117 },
-  { -8190, 832, 671, -2214 },
-  { -10453, -550, 1672, -886 },
-  { 1044, 9353, -1651, -5423 },
-  { 1034, 8149, -455, -6166 },
-  { 761, 8293, -3214, -4838 },
-  { 938, 8077, 164, -5130 },
-  { 1295, 8673, 2582, -5490 },
-  { -314, 7973, -2395, -5231 },
-  { -507, 9012, -2497, -5775 },
-  { 2396, 8314, -1022, -4673 },
-  { -1516, 8501, 1950, -4969 },
-  { -308, 7401, 1549, -4866 },
-  { -112, 8340, 3003, -4920 },
-  { -50, 9315, 1371, -5666 },
-  { -659, 9449, 2496, -5547 },
-  { 2573, 9148, -2270, -4783 },
-  { 830, 7104, -438, -3907 },
-  { 522, 10672, -677, -6483 },
-  { -1190, 10108, -510, -6518 },
-  { -427, 8271, -579, -6315 },
-  { 1602, 8113, -1927, -4418 },
-  { -2266, 8180, 448, -5190 },
-  { -1633, 8816, -226, -5771 },
-  { 759, 9481, -105, -5813 },
-  { 2254, 6679, -466, -5662 },
-  { -88, 6946, 895, -5958 },
-  { -1705, 10009, 1394, -5574 },
-  { 748, 7943, 540, -6692 },
-  { 1411, 7009, 232, -6145 },
-  { 697, 7290, -1221, -5342 },
-  { -1764, 10580, 1944, -3981 },
-  { -1334, 9124, 1195, -3903 },
-  { -905, 10067, 635, -5039 },
-  { 664, 10680, 49, -4625 },
-  { 1374, 9536, -777, -3591 },
-  { 252, 9698, -597, -2931 },
-  { 824, 9164, -1014, -2144 },
-  { 2438, 10569, -2289, -4424 },
-  { 2101, 7102, 507, -3614 },
-  { 294, 8051, -432, -1518 },
-  { -665, 10337, 547, -2852 },
-  { 1168, 11989, -492, -5427 },
-  { 1344, 6416, 302, -5061 },
-  { -1727, 12264, 1507, -4543 },
-  { 674, 10889, -902, -3605 },
-  { -582, 9504, 300, -3618 },
-  { 641, 7654, 689, -2109 },
-  { 2065, 9243, 508, -4367 },
-  { 1055, 8373, 688, -3144 },
-  { -641, 8185, 986, -3307 },
-  { 1120, 7426, 1785, -3757 },
-  { 1660, 8070, -593, -3104 },
-  { 2002, 9467, -1722, -3475 },
-  { 2361, 8368, 100, -3709 },
-  { -772, 7845, -613, -4988 },
-  { 1485, 7430, 1896, -6127 },
-  { -432, 7823, -947, -2882 },
-  { 313, 11122, -760, -4871 },
-  { 412, 8412, -283, -4231 },
-  { 1585, 10402, -1884, -3267 },
-  { 321, 6952, 773, -3016 },
-  { -105, 9014, 121, -2249 },
-  { 1585, 10313, -977, -4812 },
-  { 1619, 11869, 1306, -6876 },
-  { -1168, 8886, -81, -2500 },
-  { -395, 10886, 733, -6490 },
-  { -4949, 4274, 3992, -1054 },
-  { -4241, 5299, 4262, -1584 },
-  { -2710, 3862, 4552, -1673 },
-  { -4608, 2472, 3672, -1715 },
-  { -2843, 2816, 4003, -2326 },
-  { -5229, 2964, 5636, 90 },
-  { -4924, 3442, 5015, -1096 },
-  { -1281, 3313, 5537, -2066 },
-  { -3808, 1939, 4351, -919 },
-  { -1915, 2585, 4939, -1614 },
-  { -3470, 1843, 5562, -682 },
-  { -3800, 870, 5827, 144 },
-  { -4985, 1452, 4728, -709 },
-  { -3745, 2750, 7220, 259 },
-  { -1875, 1900, 6514, -826 },
-  { -4329, 1574, 7192, 1304 },
-  { -5408, 1444, 6208, 631 },
-  { -3327, 5312, 5707, -1541 },
-  { -6966, 3334, 4034, 1028 },
-  { -7484, 4245, 4218, -212 },
-  { -6567, 5839, 4539, -512 },
-  { -5715, 5935, 3747, -1186 },
-  { -6410, 4881, 3356, -1610 },
-  { -5146, 2590, 2850, 2172 },
-  { -5196, 4095, 2569, -373 },
-  { -5043, 6025, 4318, 692 },
-  { -5525, 4884, 3513, 370 },
-  { -6804, 7533, 5812, -488 },
-  { -5657, 2480, 4061, 1234 },
-  { -3155, 1472, 6071, 1188 },
-  { -3427, 5217, 3442, 858 },
-  { -4698, 3013, 5517, 2586 },
-  { -4449, 2226, 5418, 3580 },
-  { -6395, 3547, 5487, 2028 },
-  { -3500, 5019, 4787, 1 },
-  { -4038, 2578, 3073, 3151 },
-  { -2750, 1955, 4469, 3856 },
-  { -5696, 1659, 6118, 2469 },
-  { -4350, 1241, 6840, 3126 },
-  { -5565, 5058, 5196, 1314 },
-  { -1642, 4190, 3948, 607 },
-  { -1233, 4108, 4850, -640 },
-  { -997, 3428, 3239, 1378 },
-  { -6488, 2741, 6926, 2792 },
-  { -4188, 3763, 4235, 2018 },
-  { -3210, 3224, 5646, 1427 },
-  { -5526, 6909, 5070, -627 },
-  { -2815, 3994, 3425, 1903 },
-  { -2163, 2734, 5423, 145 },
-  { -4149, 4247, 2355, 734 },
-  { -410, 2521, 4138, -16 },
-  { -2411, 2385, 4927, 2105 },
-  { -6077, 3591, 3114, 594 },
-  { -4186, 4834, 5926, -1004 },
-  { -7315, 3369, 5966, 448 },
-  { -7042, 5721, 5771, 238 },
-  { -4466, 3907, 3535, -1751 },
-  { -2116, 3970, 6163, -1392 },
-  { -7239, 2143, 8407, 3630 },
-  { -5431, 4486, 6486, -42 },
-  { -1874, 1617, 6333, 519 },
-  { -6478, 2629, 4634, -505 },
-  { -7784, 2342, 7216, 1365 },
-  { -1154, 1432, 4831, 1544 },
-  { -4964, -5801, 1797, 506 },
-  { -4436, -6905, 1059, -1237 },
-  { -5400, -6886, 884, -290 },
-  { -6259, -7103, 523, -227 },
-  { -4819, -6450, 1412, -450 },
-  { -4056, -6213, 1725, -943 },
-  { -5642, -6091, 1357, 605 },
-  { -4196, -5678, 2187, -173 },
-  { -4726, -5126, 2470, 321 },
-  { -6642, -5091, 1507, -1005 },
-  { -5304, -5250, 1944, 1579 },
-  { -7179, -5520, 1468, -425 },
-  { -6033, -4895, 1876, -955 },
-  { -6595, -5143, 2207, 1291 },
-  { -4224, -4943, 1846, 1792 },
-  { -7128, -6950, 539, 724 },
-  { -4369, -4901, 2590, 1103 },
-  { -7413, -5696, 1712, 1440 },
-  { -5885, -6821, 418, 871 },
-  { -6828, -5599, 710, -1563 },
-  { -6123, -5817, 1358, 1631 },
-  { -5291, -5622, 578, 2138 },
-  { -7171, -6004, 347, 2208 },
-  { -6083, -5251, 2132, 425 },
-  { -4329, -5721, 407, -2993 },
-  { -5326, -5056, 1119, -1837 },
-  { -5485, -5856, 185, -2389 },
-  { -6529, -5178, 403, -697 },
-  { -6719, -4412, 2726, 871 },
-  { -5126, -5629, 1835, -771 },
-  { -5622, -4361, 2973, 858 },
-  { -5282, -5895, 45, -335 },
-  { -4357, -5656, 1696, -1558 },
-  { -7139, -6659, 627, -409 },
-  { -4415, -6328, 35, 1306 },
-  { -7639, -6110, 1134, 197 },
-  { -3626, -5592, 2019, 901 },
-  { -3547, -5064, 1176, 1738 },
-  { -5075, -3899, 2087, 266 },
-  { -4086, -6311, 1479, 360 },
-  { -6210, -5220, -199, -1477 },
-  { -3910, -5063, 1356, -15 },
-  { -7616, -4977, 461, 2401 },
-  { -6118, -6131, 1258, -563 },
-  { -6127, -4968, 1286, -27 },
-  { -4121, -5852, 1113, 1476 },
-  { -5157, -4881, 1162, -662 },
-  { -4637, -5031, 1179, 709 },
-  { -5509, -5452, -397, 1224 },
-  { -4597, -6861, 646, 467 },
-  { -6247, -4043, 468, 278 },
-  { -5336, -6465, 874, -1472 },
-  { -6998, -6346, 78, -1798 },
-  { -4915, -4530, 2756, -203 },
-  { -6048, -4373, 1468, 1052 },
-  { -4273, -7100, 942, -323 },
-  { -6552, -4287, 2351, 69 },
-  { -6954, -4613, 722, 1521 },
-  { -4201, -5361, 763, -1562 },
-  { -6881, -5596, -748, 669 },
-  { -6695, -3547, -34, 1299 },
-  { -3981, -5728, 84, 111 },
-  { -4663, -4809, 2173, -1031 },
-  { -6599, -6077, 1303, 256 },
-  { -7596, -4265, -5791, -4140 },
-  { -6610, -2758, -5288, -3936 },
-  { -5880, -3865, -6563, -3088 },
-  { -7228, -5510, -7677, -3912 },
-  { -8854, -6553, -8318, -5361 },
-  { -9362, -5249, -6413, -4319 },
-  { -4418, -3110, -6368, -4358 },
-  { -5544, -4203, -6863, -5013 },
-  { -3056, -4316, -5567, -3181 },
-  { -3078, -5999, -5051, -2657 },
-  { -5884, -6292, -5756, -4013 },
-  { -4825, -4549, -5535, -4053 },
-  { -4443, -6126, -5316, -1368 },
-  { -3972, -6341, -6098, -2686 },
-  { -5751, -2781, -5398, -6230 },
-  { -4466, -6135, -5570, -3679 },
-  { -4291, -5992, -3564, -5189 },
-  { -7189, -4429, -7279, -6082 },
-  { -5076, -4433, -2748, -5366 },
-  { -6225, -2825, -6833, -5663 },
-  { -2989, -4792, -3960, -4492 },
-  { -7836, -7773, -7722, -5741 },
-  { -6559, -5703, -5844, -5589 },
-  { -7612, -5438, -4136, -3774 },
-  { -4218, -4176, -6591, -2333 },
-  { -4837, -5063, -6581, 322 },
-  { -6590, -5990, -2980, -3847 },
-  { -5558, -2971, -5489, -1932 },
-  { -7001, -5323, -4975, -1697 },
-  { -4694, -2688, -6904, -3044 },
-  { -8511, -5379, -5767, -2549 },
-  { -7548, -5412, -6522, -2572 },
-  { -6597, -4973, -6423, -1274 },
-  { -6415, -4022, -5168, -1072 },
-  { -5528, -5530, -7218, -2345 },
-  { -4845, -4805, -5943, -1227 },
-  { -6049, -7150, -6744, -2161 },
-  { -9061, -7299, -8542, -4375 },
-  { -5010, -5546, -5416, -82 },
-  { -4135, -4205, -5109, -3373 },
-  { -3311, -5869, -4007, -5061 },
-  { -5993, -6472, -3962, -4718 },
-  { -2966, -5832, -2821, -6305 },
-  { -4851, -5152, -2067, -3930 },
-  { -3620, -4441, -3362, -5836 },
-  { -4469, -5221, -4534, -5592 },
-  { -4022, -6335, -4321, -6107 },
-  { -4899, -4503, -3084, -3725 },
-  { -4490, -8276, -4620, -6236 },
-  { -6591, -4342, -7365, -4063 },
-  { -6498, -5057, -5553, 485 },
-  { -6060, -2714, -7093, -4144 },
-  { -6199, -7774, -7094, -4057 },
-  { -7536, -6424, -6415, -4265 },
-  { -7439, -2454, -6348, -4827 },
-  { -5333, -7565, -4417, -4639 },
-  { -4353, -7103, -4197, -2689 },
-  { -5229, -6549, -5129, -6804 },
-  { -6129, -7701, -5236, -4836 },
-  { -6797, -3983, -3884, -4406 },
-  { -6624, -4467, -4745, -5052 },
-  { -3324, -7596, -2720, -6553 },
-  { -5473, -6284, -1704, -4511 },
-  { -4131, -7263, -3180, -5196 },
-  { -7116, -5565, -3469, 685 },
-  { -6002, -6021, -3858, 576 },
-  { -3144, -8203, -1291, -434 },
-  { -6096, -7027, -4004, 1353 },
-  { -3943, -7709, -2344, -36 },
-  { -4510, -6767, -2642, 631 },
-  { -3657, -11541, -2570, -3984 },
-  { -5959, -8854, -1333, -867 },
-  { -6699, -8866, -1606, -344 },
-  { -3836, -7961, -2334, -2028 },
-  { -3430, -8045, -3037, -672 },
-  { -3868, -9184, -3635, -1819 },
-  { -4258, -9060, -2621, -1008 },
-  { -3595, -8693, -2022, -752 },
-  { -4573, -8048, -3166, -2622 },
-  { -4852, -7903, -1405, 256 },
-  { -4591, -7057, -1560, 965 },
-  { -6963, -7655, -980, 808 },
-  { -5179, -6641, -3356, 1196 },
-  { -7102, -6941, -2798, 2123 },
-  { -6867, -5834, -3320, -770 },
-  { -5977, -7369, -2500, -778 },
-  { -6160, -6400, -934, -2543 },
-  { -6741, -7608, -355, -1289 },
-  { -6856, -6466, -1433, -1643 },
-  { -4786, -6292, -4970, 376 },
-  { -5407, -8866, -2255, -400 },
-  { -3814, -6506, -1387, -3620 },
-  { -4998, -6137, -1200, -4092 },
-  { -5123, -9557, -2849, -1306 },
-  { -4259, -6444, -4395, -338 },
-  { -5221, -6810, -883, 1225 },
-  { -6137, -6215, -2165, 554 },
-  { -3895, -6557, -3176, -1829 },
-  { -3886, -8188, -87, -954 },
-  { -7243, -6707, -2216, -316 },
-  { -5592, -7606, 85, -432 },
-  { -3957, -7945, -504, -144 },
-  { -4617, -7624, 218, -312 },
-  { -4797, -8737, -844, -1051 },
-  { -4478, -8516, -1401, -454 },
-  { -4557, -7058, -302, -2332 },
-  { -6623, -7736, -271, -50 },
-  { -3157, -7532, -1111, -2207 },
-  { -3590, -7300, -1271, 517 },
-  { -4442, -7306, -507, 590 },
-  { -6458, -7524, -2807, 666 },
-  { -4991, -8466, -3363, -785 },
-  { -7474, -7541, -1056, -1839 },
-  { -7501, -8316, -938, -180 },
-  { -5329, -7739, -579, -2341 },
-  { -4549, -7063, -176, -3539 },
-  { -5191, -8612, -1504, -4250 },
-  { -3083, -7058, -2251, 32 },
-  { -4003, -7043, -1093, -791 },
-  { -5523, -8093, -678, -114 },
-  { -3022, -10265, -2070, -3109 },
-  { -3905, -6274, -182, -3652 },
-  { -3269, -9217, -551, -2650 },
-  { -3138, -9314, -1726, -1704 },
-  { -4420, -10339, -1744, -3459 },
-  { -4163, -8609, -2298, -4113 },
-  { -5566, -6505, -1241, -463 },
-  { -3130, -9746, -2352, -4884 },
-  { -7825, -3439, 1451, -1468 },
-  { -8451, -3318, 2360, -435 },
-  { -8462, -4130, 1438, -1024 },
-  { -9425, -4564, 1328, -689 },
-  { -11014, -3202, 2278, 2080 },
-  { -8269, -2761, -146, -440 },
-  { -7497, -2618, -166, 413 },
-  { -8250, -3060, 522, -2133 },
-  { -8365, -5366, 1347, -451 },
-  { -8589, -3979, 2943, 714 },
-  { -8111, -2572, 1272, -1748 },
-  { -7830, -5193, 605, -1484 },
-  { -8119, -4736, 2141, 256 },
-  { -7724, -4769, 1463, -812 },
-  { -7363, -3911, 2540, 4 },
-  { -7974, -3397, 2363, 1366 },
-  { -7359, -4204, 1752, -958 },
-  { -7622, -3505, 660, 916 },
-  { -9934, -3665, 3165, 828 },
-  { -8721, -4162, 62, 1718 },
-  { -9433, -4768, 2722, 1234 },
-  { -7960, -4496, 138, 1528 },
-  { -8198, -3454, -443, 631 },
-  { -7756, -2246, 655, 1137 },
-  { -8841, -3145, 1113, 829 },
-  { -7817, -3298, 1251, 230 },
-  { -9413, -2733, 323, -1862 },
-  { -9408, -4168, 1270, 1549 },
-  { -9037, -3892, -942, 283 },
-  { -8255, -3849, 1301, 1762 },
-  { -9057, -3987, -41, -682 },
-  { -9441, -4187, 2019, -111 },
-  { -9740, -3178, 1602, -871 },
-  { -8344, -2474, 1461, 1506 },
-  { -9752, -2925, 1996, 1243 },
-  { -9199, -3796, 180, 537 },
-  { -9060, -2405, 1140, -1562 },
-  { -9348, -2376, 309, -162 },
-  { -10786, -3182, -5, -1500 },
-  { -8142, -4540, -434, -826 },
-  { -7528, -2341, 1104, -73 },
-  { -9360, -2658, 3062, 56 },
-  { -8267, -2335, 2000, -1193 },
-  { -12169, -3154, 1287, -640 },
-  { -11398, -2120, 946, -1163 },
-  { -8940, -4559, 328, -1696 },
-  { -11025, -4213, 2813, 840 },
-  { -9224, -3581, 2224, 2039 },
-  { -8943, -3337, 1248, -1298 },
-  { -7900, -4042, 485, -2080 },
-  { -9221, -1947, 2191, -880 },
-  { -10762, -1800, 2516, -324 },
-  { -10095, -2238, 981, -1335 },
-  { -11908, -2808, 3255, 645 },
-  { -10640, -4105, 1283, -595 },
-  { -7663, -2863, 2467, -797 },
-  { -10712, -3854, 3710, 1538 },
-  { -10823, -2893, 1408, -801 },
-  { -9874, -3832, 256, -1638 },
-  { -10394, -3391, 2315, -94 },
-  { -11525, -4079, 4153, 2122 },
-  { -9546, -2088, 1541, 481 },
-  { -8731, -2433, 1042, 2160 },
-  { -7852, -3977, -1370, 1677 },
-  { 7072, -3420, 1398, -1741 },
-  { 6180, -1976, 1280, -3557 },
-  { 7692, -1793, 2844, -1700 },
-  { 8363, -1773, 3104, -2679 },
-  { 9213, -3266, 3756, -3542 },
-  { 9650, -2644, 1426, -1318 },
-  { 7712, -2796, 3686, -1975 },
-  { 7316, -3517, 2821, -622 },
-  { 7434, -2594, 2305, -2264 },
-  { 7237, -1797, 255, -3114 },
-  { 8663, -1983, 1338, -3056 },
-  { 6616, -952, 4059, -2652 },
-  { 8823, -1327, 1362, -1356 },
-  { 9938, -1722, 1287, -2362 },
-  { 7207, -1057, 1913, -1315 },
-  { 7508, -1585, 870, -1982 },
-  { 8217, -3680, 1417, -3170 },
-  { 8329, -2541, 1684, -585 },
-  { 8062, -2335, 252, -2800 },
-  { 8204, -4108, 3097, -2569 },
-  { 7701, -3367, 576, -3008 },
-  { 7350, -786, 2414, -2129 },
-  { 6948, -2568, 1607, -225 },
-  { 7684, -2387, 1308, -3449 },
-  { 8306, -3458, 2394, -1454 },
-  { 8438, -2781, 1043, -1362 },
-  { 9175, -2076, 2144, -1987 },
-  { 8347, -2709, 3489, -4301 },
-  { 5696, -2377, 2870, 851 },
-  { 8825, -1243, 2219, -2603 },
-  { 8801, -1614, 584, -2513 },
-  { 8413, -384, 1421, -2244 },
-  { 9228, -3050, 3279, -2164 },
-  { 6342, -2698, 3547, -107 },
-  { 10053, -2476, 2837, -3168 },
-  { 7439, -604, 3177, -3991 },
-  { 7749, -1064, 4329, -4855 },
-  { 8655, -2177, 2252, -3519 },
-  { 8490, -228, 1958, -3233 },
-  { 10513, -2968, 1911, -2340 },
-  { 8146, -862, 1884, -1723 },
-  { 7788, -666, 3004, -2891 },
-  { 7785, -1620, 4133, -3417 },
-  { 10262, -3731, 3455, -2971 },
-  { 8570, -905, 4519, -4649 },
-  { 9129, -2562, 463, -2465 },
-  { 9451, -3587, 1904, -3056 },
-  { 6549, -2236, 3010, -4523 },
-  { 7175, -2684, 2967, -3458 },
-  { 9872, -3278, 1054, -2472 },
-  { 9153, -931, 1217, -2565 },
-  { 8789, -3469, 753, -2568 },
-  { 6683, -3791, 1797, -3968 },
-  { 6801, -1977, 2311, -452 },
-  { 6336, -1572, 2612, -3264 },
-  { 7996, -1008, 730, -2964 },
-  { 7521, -1059, 1573, -3694 },
-  { 8148, -3973, 2600, -3572 },
-  { 7765, -1532, 2528, -3856 },
-  { 7404, -3918, 4472, -143 },
-  { 8894, -1398, 3299, -3685 },
-  { 5768, -2041, 1487, -637 },
-  { 5131, -2865, 2463, -811 },
-  { 6439, -1568, 3500, -1550 },
-  { -8878, -6798, -5319, -1452 },
-  { -6332, -9713, -3112, -990 },
-  { -8444, -6316, -3694, -687 },
-  { -6123, -10840, -3637, -4358 },
-  { -4784, -9580, -4577, -2581 },
-  { -6108, -10515, -4859, -2524 },
-  { -7605, -7518, -2327, -2797 },
-  { -9662, -8775, -2467, -2010 },
-  { -6494, -7523, -4715, -118 },
-  { -8290, -8982, -1672, -317 },
-  { -8798, -11051, -3888, -1426 },
-  { -6273, -6623, -6791, -142 },
-  { -8313, -7668, -2141, -1275 },
-  { -6453, -8412, -3589, -4102 },
-  { -6747, -7750, -5690, -2498 },
-  { -7814, -6693, -3174, -2446 },
-  { -10383, -10130, -3931, -2364 },
-  { -10606, -8467, -5539, -2772 },
-  { -9475, -6671, -3305, -2271 },
-  { -8982, -9457, -5635, -4005 },
-  { -10111, -7965, -6515, -4180 },
-  { -7301, -6479, -5364, 720 },
-  { -9543, -8999, -7921, -912 },
-  { -9534, -8562, -3469, -384 },
-  { -7601, -10344, -3205, -1127 },
-  { -8088, -8620, -4954, -2888 },
-  { -8202, -8406, -7038, -3775 },
-  { -7312, -8324, -3334, -1775 },
-  { -8566, -9262, -8071, -4174 },
-  { -7068, -11300, -5573, -2907 },
-  { -8295, -8952, -4366, -1544 },
-  { -11104, -10210, -2285, -384 },
-  { -5213, -7520, -5008, -1339 },
-  { -5889, -7940, -5987, -1385 },
-  { -10816, -8201, -4153, -1485 },
-  { -10277, -8919, -6315, -1652 },
-  { -5888, -10320, -3821, -1733 },
-  { -10497, -7181, -6083, -3032 },
-  { -7721, -9724, -6591, -5336 },
-  { -5688, -7894, -3486, -2552 },
-  { -10014, -10500, -3247, -820 },
-  { -6301, -8765, -4506, -2923 },
-  { -8261, -7847, -6213, -1552 },
-  { -10212, -7481, -8113, -3954 },
-  { -6938, -10874, -6074, -4703 },
-  { -7183, -10968, -4446, -1773 },
-  { -7120, -9193, -1966, -2509 },
-  { -6234, -9263, -2313, -4284 },
-  { -8503, -9857, -2429, -608 },
-  { -9372, -7844, -8391, -2120 },
-  { -7951, -7157, -6535, -11 },
-  { -7256, -9473, -2172, -660 },
-  { -10063, -9612, -2515, -15 },
-  { -6684, -9134, -6109, -4206 },
-  { -8204, -11932, -5220, -2306 },
-  { -9710, -6706, -4115, -3275 },
-  { -6855, -7078, -2409, -4447 },
-  { -7344, -7673, -4479, -4116 },
-  { -8851, -6842, -4927, -2948 },
-  { -8927, -10452, -5633, -2194 },
-  { -8627, -9002, -7176, -1575 },
-  { -8209, -9722, -7021, -3324 },
-  { -3770, -10249, -3623, -4816 },
-  { -8183, -7465, -4090, 646 },
-  { -8163, -7149, 200, 498 },
-  { -8289, -6266, 686, -206 },
-  { -10030, -6241, -1032, -1864 },
-  { -8793, -8327, -773, -169 },
-  { -9149, -6215, 969, -15 },
-  { -8303, -5859, -7, 2006 },
-  { -9682, -7283, 255, 1322 },
-  { -9293, -7227, 71, -231 },
-  { -8525, -6215, 287, -837 },
-  { -10477, -5379, 1159, 1449 },
-  { -10726, -7856, -130, 102 },
-  { -8694, -7461, -1210, 690 },
-  { -9367, -5324, 1103, 3170 },
-  { -10686, -8055, -831, 1633 },
-  { -9201, -6873, -2704, 2258 },
-  { -8421, -5358, -1405, 226 },
-  { -9066, -5830, -307, -1571 },
-  { -11150, -7381, -2746, -900 },
-  { -9978, -5925, -2006, -437 },
-  { -9464, -4741, -273, 1061 },
-  { -10543, -6684, -1113, 1660 },
-  { -10073, -5576, 1083, -269 },
-  { -8826, -5763, 1600, 1486 },
-  { -10445, -9071, -1253, -64 },
-  { -12085, -5799, 2, 769 },
-  { -12939, -6663, 1650, 1437 },
-  { -10932, -6434, -1252, -649 },
-  { -11650, -7826, -2053, 710 },
-  { -12122, -6733, -1889, -731 },
-  { -9093, -6095, -2463, -842 },
-  { -10977, -4364, 469, 420 },
-  { -11488, -6908, -521, 893 },
-  { -9669, -5478, -842, 337 },
-  { -10606, -5203, -632, -1361 },
-  { -10198, -6284, 1662, 1277 },
-  { -10135, -5292, 2435, 3493 },
-  { -11027, -6561, 655, 56 },
-  { -10977, -5030, 1127, -358 },
-  { -12766, -3986, 1348, -335 },
-  { -14244, -7731, 264, 317 },
-  { -15124, -10309, -508, 1447 },
-  { -12821, -8638, -608, 137 },
-  { -13076, -8693, -2852, -431 },
-  { -11156, -5546, -2252, -1600 },
-  { -8692, -7366, -819, -1223 },
-  { -12507, -9816, -1714, -121 },
-  { -10712, -6666, 544, 3349 },
-  { -12462, -5890, -2491, -2318 },
-  { -12468, -7226, 437, 232 },
-  { -11300, -5226, 2068, 687 },
-  { -11994, -8320, -626, 2728 },
-  { -12222, -5476, 1142, 18 },
-  { -10277, -8122, -2418, 2003 },
-  { -13418, -6115, -3563, -2802 },
-  { -14759, -9834, -1243, 21 },
-  { -13699, -5665, 1525, 507 },
-  { -16269, -9476, -701, 163 },
-  { -12677, -5437, -247, -1019 },
-  { -11827, -4295, -181, -1243 },
-  { -12847, -4496, 2984, 1123 },
-  { -13860, -7915, -1166, -547 },
-  { -12276, -8145, -2290, -1527 },
-  { -11417, -4830, 2983, 1854 },
-  { -11793, -6002, 1163, 1940 },
-  { 11443, -4920, -3235, 3151 },
-  { 11300, -6616, -1506, 1175 },
-  { 9198, -4628, -2060, 2390 },
-  { 10532, -4027, -643, 912 },
-  { 9902, -3573, -1606, 1327 },
-  { 9653, -3536, -2240, 1869 },
-  { 9948, -5171, -423, 2662 },
-  { 12316, -4004, -1989, 281 },
-  { 12125, -4800, -1265, -163 },
-  { 10650, -2617, -2337, 1462 },
-  { 9909, -4968, -2376, 916 },
-  { 12944, -4647, -1958, 460 },
-  { 12988, -5283, -1141, 41 },
-  { 12321, -2915, -3621, 1025 },
-  { 11449, -2894, -2728, 351 },
-  { 12087, -3041, -2002, -32 },
-  { 11558, -4031, -1343, -399 },
-  { 12983, -3740, -3516, 1245 },
-  { 12099, -2515, -2752, 225 },
-  { 12515, -3465, -2701, 550 },
-  { 14683, -5022, -5272, 2996 },
-  { 12260, -3383, -1215, -528 },
-  { 13810, -5422, -2443, 1166 },
-  { 13421, -5378, -1886, 721 },
-  { 12961, -4259, -2594, 796 },
-  { 12266, -2104, -4768, 1591 },
-  { 13523, -4710, -3045, 1342 },
-  { 12437, -2099, -5610, 2117 },
-  { 11850, -2183, -3497, 661 },
-  { 12275, -3936, -597, -697 },
-  { 12459, -5253, -517, -544 },
-  { 12835, -4094, -1322, -168 },
-  { 14360, -5677, -3305, 1859 },
-  { 13905, -4552, -4309, 2117 },
-  { 11559, -3412, -1847, -81 },
-  { 13379, -3167, -5764, 2746 },
-  { 11910, -1634, -4342, 1052 },
-  { 12662, -4742, 71, -974 },
-  { 13057, -3254, -4424, 1705 },
-  { 15046, -5706, -4851, 3019 },
-  { 14162, -4142, -5514, 2843 },
-  { 12764, -1845, -6684, 2888 },
-  { 13714, -2374, -7838, 3857 },
-  { 13295, -1663, -8293, 4073 },
-  { 10032, -4152, -3403, 1421 },
-  { 10942, -5386, -2222, 950 },
-  { 10532, -6385, -1750, 1925 },
-  { 10273, -5972, -1534, 643 },
-  { 10605, -4782, -1695, 27 },
-  { 10988, -5153, -1123, -341 },
-  { 11629, -5884, -1060, 48 },
-  { 10441, -4045, -2431, 311 },
-  { 10788, -3595, -4171, 1807 },
-  { 12110, -5686, -2127, 976 },
-  { 11746, -4773, -2639, 891 },
-  { 11541, -5299, -3031, 1732 },
-  { 11416, -2559, -5359, 2198 },
-  { 11583, -5376, -704, 677 },
-  { 10416, -3214, -3516, 872 },
-  { 9651, -5435, -1618, 3255 },
-  { 9973, -5133, -996, 3923 },
-  { 11707, -4643, -430, -796 },
-  { 10994, -2709, -3587, 2302 },
-  { 10716, -5118, -645, 270 },
-  { 14100, -10314, 1095, 1531 },
-  { 12944, -8049, 1105, -741 },
-  { 13276, -7035, -511, 274 },
-  { 14008, -7254, -283, 139 },
-  { 11594, -6536, -91, 1671 },
-  { 11732, -8645, 746, 15 },
-  { 14613, -7085, -1578, 1183 },
-  { 13083, -6224, -750, -4 },
-  { 13988, -6256, -1592, 820 },
-  { 14678, -8683, 441, 126 },
-  { 15571, -8872, -521, 1139 },
-  { 15642, -9533, 341, 697 },
-  { 15960, -9586, -168, 1121 },
-  { 15464, -10239, 1433, -1 },
-  { 14934, -7887, -1046, 1080 },
-  { 15252, -7630, -1899, 1628 },
-  { 15485, -8384, -1234, 1484 },
-  { 15962, -8638, -1815, 1931 },
-  { 16501, -10664, 398, 1167 },
-  { 16146, -10145, 411, 918 },
-  { 14573, -7475, -697, 601 },
-  { 14302, -7996, 28, 257 },
-  { 14769, -6792, -2286, 1574 },
-  { 14144, -6137, -2169, 1257 },
-  { 14770, -6271, -3111, 1933 },
-  { 14110, -8312, 1083, -531 },
-  { 15235, -6991, -2993, 2174 },
-  { 13222, -5805, 547, -891 },
-  { 14796, -8762, 1254, -246 },
-  { 16040, -9181, -1005, 1551 },
-  { 16487, -10086, -373, 1420 },
-  { 15077, -9479, 966, 51 },
-  { 13026, -6468, 932, -1080 },
-  { 12703, -6152, -33, -573 },
-  { 15641, -6810, -4128, 2874 },
-  { 13282, -7673, 1583, -1283 },
-  { 12373, -7150, 1512, -917 },
-  { 12992, -7751, -678, 783 },
-  { 10907, -6858, -313, 2597 },
-  { 13026, -8963, 125, 2152 },
-  { 12770, -9946, 1957, -505 },
-  { 12482, -6849, -1268, 833 },
-  { 13790, -6181, -138, -279 },
-  { 12709, -8382, 2044, 227 },
-  { 12244, -6630, 203, -457 },
-  { 14209, -6816, -1032, 632 },
-  { 15134, -8267, -288, 640 },
-  { 13619, -6157, -1090, 356 },
-  { 14044, -7413, 725, -484 },
-  { 12958, -7753, 2585, -1980 },
-  { 13188, -8396, 2306, -1558 },
-  { 14379, -9980, 2132, -688 },
-  { 14275, -9857, 1162, 179 },
-  { 13690, -8648, 1621, -889 },
-  { 11770, -6829, -746, 278 },
-  { 12732, -8202, 286, 90 },
-  { 13630, -10146, 1867, -207 },
-  { 12072, -8740, 1299, -645 },
-  { 12852, -9492, 1226, 62 },
-  { 11792, -7382, -54, -116 },
-  { 13779, -9014, 487, 351 },
-  { 11951, -7729, 121, 834 },
-  { 11970, -9781, 2276, -4 },
-  { 12680, -7984, 2787, -787 },
-  { 13300, -14488, 6408, -1927 },
-  { 13635, -15355, 9153, -3073 },
-  { 12804, -13566, 5517, -1625 },
-  { 16624, -10854, 1690, 28 },
-  { 20387, -18532, 6162, -261 },
-  { 16515, -12642, 3392, -519 },
-  { 15800, -11095, 2151, -202 },
-  { 16824, -11790, 1651, 599 },
-  { 17604, -13213, 2563, 538 },
-  { 17892, -14177, 3562, 147 },
-  { 16987, -11399, 869, 1052 },
-  { 17003, -12456, 2442, 265 },
-  { 21657, -21806, 9198, -1250 },
-  { 16825, -13341, 3980, -686 },
-  { 17525, -12714, 1887, 805 },
-  { 16419, -11034, 1216, 617 },
-  { 20931, -19939, 7469, -684 },
-  { 18452, -15390, 4573, -191 },
-  { 14778, -10077, 2841, -1209 },
-  { 17402, -13319, 3042, 160 },
-  { 19365, -17922, 7087, -1061 },
-  { 16298, -11941, 2810, -351 },
-  { 19087, -16176, 4775, -84 },
-  { 17666, -12289, 938, 1224 },
-  { 18581, -15894, 5132, -430 },
-  { 19823, -16717, 4142, 545 },
-  { 19960, -19423, 8400, -1492 },
-  { 18973, -16817, 5906, -594 },
-  { 19079, -15431, 3528, 503 },
-  { 16667, -12485, 4467, -1302 },
-  { 19791, -17797, 6196, -529 },
-  { 20005, -17606, 5354, -20 },
-  { 20123, -18599, 6886, -728 },
-  { 19068, -14805, 2394, 1105 },
-  { 14443, -13723, 5631, -2029 },
-  { 14730, -14231, 5631, -1450 },
-  { 16089, -15959, 7271, -2029 },
-  { 13473, -11200, 3236, -924 },
-  { 14413, -10902, 2347, -267 },
-  { 17666, -18662, 11381, -3496 },
-  { 14749, -11042, 3305, -275 },
-  { 15304, -10486, 1869, -240 },
-  { 14809, -12126, 3369, -616 },
-  { 16896, -16561, 7307, -1845 },
-  { 15782, -14336, 5380, -1264 },
-  { 16395, -15520, 6415, -1588 },
-  { 13681, -11114, 2584, -320 },
-  { 14244, -12326, 4480, -1632 },
-  { 15247, -13119, 4265, -898 },
-  { 13987, -12091, 3469, -597 },
-  { 13941, -12770, 4240, -839 },
-  { 13771, -13627, 5252, -1384 },
-  { 15010, -16074, 7592, -2249 },
-  { 15852, -17226, 8619, -2655 },
-  { 18921, -16916, 6875, -1501 },
-  { 14909, -11678, 2768, -295 },
-  { 18988, -18353, 8424, -2070 },
-  { 15457, -15080, 6218, -1513 },
-  { 14916, -15512, 6949, -1883 },
-  { 18108, -14702, 4681, -701 },
-  { 17600, -15733, 5616, -775 },
-  { 14070, -13683, 6472, -2626 },
-  { 13832, -11914, 5201, -2232 },
-  { 18846, -19009, 9192, -1961 },
-  { -11981, -10994, -6324, -2264 },
-  { -10976, -9047, -6546, -3828 },
-  { -11288, -10532, -7014, -4191 },
-  { -10139, -10189, -7799, -2688 },
-  { -10555, -9988, -9181, -2040 },
-  { -11596, -11339, -10022, -2707 },
-  { -13400, -13395, -11306, -4206 },
-  { -9774, -12281, -7466, -4133 },
-  { -10842, -13125, -8777, -4956 },
-  { -11964, -15082, -9779, -5095 },
-  { -9382, -10188, -9053, -4927 },
-  { -11562, -11296, -3651, -985 },
-  { -9287, -10083, -7918, -4069 },
-  { -12821, -16556, -11410, -6195 },
-  { -12628, -8959, -4521, -1113 },
-  { -13845, -11581, -3649, -681 },
-  { -12685, -10269, -5483, -1275 },
-  { -14988, -12874, -5107, -1189 },
-  { -13761, -11367, -6202, -1804 },
-  { -13225, -11249, -7820, -3354 },
-  { -14809, -11992, -3202, -312 },
-  { -15620, -15519, -10210, -3433 },
-  { -12954, -10200, -3139, -611 },
-  { -11536, -9981, -5284, -923 },
-  { -13034, -12417, -4612, -1098 },
-  { -16911, -15505, -6123, -1352 },
-  { -17396, -17685, -8330, -2171 },
-  { -14120, -10764, -2265, -99 },
-  { -12598, -7367, -5406, -3530 },
-  { -14143, -12793, -10909, -5226 },
-  { -14692, -16871, -11626, -5554 },
-  { -12581, -11197, -9194, -3837 },
-  { -16752, -16726, -9746, -2808 },
-  { -10600, -10358, -6560, -1227 },
-  { -14573, -13312, -8957, -3393 },
-  { -10172, -8463, -8579, -3387 },
-  { -11418, -12421, -5522, -1842 },
-  { -11855, -14204, -6669, -2625 },
-  { -13308, -8191, -3941, -2194 },
-  { -10007, -12266, -5022, -1811 },
-  { -13532, -15771, -9497, -3175 },
-  { -11760, -11148, -10339, -5529 },
-  { -12149, -12763, -11198, -3697 },
-  { -12029, -12119, -8555, -1792 },
-  { -16995, -19957, -11447, -3471 },
-  { -13144, -14504, -9988, -3191 },
-  { -9938, -11064, -6139, -3162 },
-  { -8873, -11550, -8294, -6550 },
-  { -9303, -13010, -6150, -2711 },
-  { -15463, -10469, -1766, -170 },
-  { -15985, -11693, -3007, -650 },
-  { -17142, -10671, -1434, 47 },
-  { -16063, -13858, -4817, -1058 },
-  { -19446, -19599, -9594, -2464 },
-  { -20076, -18744, -8313, -1889 },
-  { -15047, -16085, -7590, -2250 },
-  { -13481, -16195, -8552, -2998 },
-  { -13829, -14869, -6704, -1932 },
-  { -16357, -18484, -9802, -2959 },
-  { -10551, -8393, -9303, -5070 },
-  { -11345, -9156, -5641, -3107 },
-  { -13217, -13449, -9270, -4541 },
-  { -11988, -13732, -9995, -6374 },
-  { -11007, -9519, -5168, -4107 },
-  { 9930, -7858, 8061, -4375 },
-  { 8274, -7867, 5992, -2096 },
-  { 9692, -9675, 7621, -3670 },
-  { 9589, -8110, 6509, -3010 },
-  { 12617, -11976, 10122, -5360 },
-  { 11867, -8895, 7948, -5323 },
-  { 10388, -10482, 9234, -4324 },
-  { 8188, -8220, 7810, -2737 },
-  { 10407, -8787, 4806, -1930 },
-  { 10348, -8845, 9233, -6614 },
-  { 9422, -7091, 4820, -2878 },
-  { 9758, -9796, 5584, -2256 },
-  { 10188, -7994, 5347, -3343 },
-  { 11133, -7455, 4015, -2306 },
-  { 10676, -10744, 6093, -2629 },
-  { 11522, -12184, 7848, -3375 },
-  { 8805, -9883, 5317, -3071 },
-  { 9498, -9654, 6555, -3592 },
-  { 10488, -8008, 4066, -1252 },
-  { 11261, -8930, 6068, -2738 },
-  { 12180, -10397, 5027, -1531 },
-  { 9138, -8531, 3601, -1959 },
-  { 8107, -8380, 4970, -2061 },
-  { 9737, -13248, 6438, -2617 },
-  { 11178, -10423, 2622, -522 },
-  { 9572, -12372, 5199, -2019 },
-  { 12057, -12144, 4147, -1099 },
-  { 9047, -9925, 2516, -665 },
-  { 10790, -8030, 5882, -4386 },
-  { 7199, -8426, 6337, -2841 },
-  { 7778, -8285, 3529, -3442 },
-  { 7559, -10569, 3484, -1332 },
-  { 9404, -8115, 7484, -5541 },
-  { 7792, -11976, 5546, -2573 },
-  { 9313, -10264, 7661, -5195 },
-  { 6701, -10725, 4370, -1784 },
-  { 4918, -11361, 4507, -4527 },
-  { 5147, -12305, 3978, -5556 },
-  { 6525, -9899, 4481, -3129 },
-  { 7538, -12855, 6060, -4826 },
-  { 8659, -12111, 7159, -4430 },
-  { 8440, -11304, 4547, -1747 },
-  { 9216, -10918, 3507, -1195 },
-  { 6165, -9254, 4771, -4677 },
-  { 9163, -11019, 5637, -4935 },
-  { 13441, -11509, 6676, -2434 },
-  { 7912, -9398, 6663, -4048 },
-  { 11723, -13745, 8131, -4148 },
-  { 6065, -10257, 5005, -6327 },
-  { 11618, -12417, 5336, -1894 },
-  { 8891, -13924, 8407, -6131 },
-  { 9622, -12563, 7908, -5109 },
-  { 11479, -10315, 8349, -3991 },
-  { 11676, -14103, 6611, -2330 },
-  { 11951, -8953, 3829, -1550 },
-  { 10486, -8044, 10493, -5920 },
-  { 11801, -10769, 9763, -5305 },
-  { 6109, -8676, 5827, -1346 },
-  { 7030, -9611, 5624, -5761 },
-  { 12808, -12886, 8683, -4148 },
-  { 13213, -10464, 6381, -3189 },
-  { 11796, -13681, 10703, -6075 },
-  { 9639, -7949, 9625, -3944 },
-  { 8538, -6997, 5309, 453 }
+  {   9928,  -2618,  -1093,  -1263 },
+  {  11077,  -2876,  -1747,   -308 },
+  {  10503,  -1082,  -1426,  -1167 },
+  {   9337,  -2403,  -1495,    274 },
+  {  10698,  -2529,   -532,  -1122 },
+  {  10368,  -3974,  -1264,   -750 },
+  {  10070,  -3667,    346,    863 },
+  {  10278,  -3093,    311,   -576 },
+  {   9894,  -1330,  -1428,   -860 },
+  {  10544,  -1923,  -1058,   -971 },
+  {  10996,  -1632,   -841,  -1404 },
+  {  11832,  -3465,   1658,  -1990 },
+  {  10852,   -688,  -2658,   -499 },
+  {  10546,  -1749,   -147,  -1733 },
+  {  10801,  -1004,   -708,  -1453 },
+  {  10588,   -441,  -2113,   -952 },
+  {  10141,  -3331,   -582,  -1432 },
+  {   9608,  -2590,    383,    258 },
+  {  11422,  -3265,    229,  -1544 },
+  {  10460,  -1338,   -713,  -1568 },
+  {  10306,  -1721,  -1660,   -603 },
+  {   9580,  -1812,  -1235,  -1061 },
+  {  11471,  -2285,  -1617,   -607 },
+  {  10081,  -2225,  -1408,   -868 },
+  {  10715,  -2624,  -1367,   -704 },
+  {  10616,  -1871,  -2770,    -35 },
+  {   9352,  -2340,  -1024,  -1566 },
+  {  11065,  -1458,  -1926,   -735 },
+  {  11334,  -2056,  -1041,  -1144 },
+  {   9825,  -2048,   -794,  -1536 },
+  {  11850,  -2695,  -1123,   -867 },
+  {  10654,  -2226,  -1891,   -373 },
+  {  10024,  -1557,   -808,  -1069 },
+  {  11142,  -1266,  -3238,    128 },
+  {  11729,  -3282,   -514,  -1011 },
+  {  11402,  -2094,  -2335,   -189 },
+  {  10195,  -3658,    181,  -1875 },
+  {  11431,  -2626,   -404,  -1377 },
+  {  11001,  -3868,   -619,  -1077 },
+  {  10894,  -2559,    274,  -1758 },
+  {   9633,  -1482,  -2253,   -773 },
+  {  11245,  -3321,    830,  -1972 },
+  {   9768,  -2701,   -199,  -1859 },
+  {  10500,  -2042,    525,  -2043 },
+  {  11669,  -4069,    293,  -1468 },
+  {   9192,  -1991,   -583,    -61 },
+  {  10057,  -3220,  -2015,   -473 },
+  {   9497,  -2315,  -2490,   -467 },
+  {  10455,  -3069,  -1194,  -1007 },
+  {   9994,  -1936,    -60,  -1225 },
+  {   9295,  -2156,  -1761,  -1134 },
+  {  10085,  -3748,  -1026,    197 },
+  {   9334,  -2360,    804,   -351 },
+  {  11561,  -2553,   1352,  -2313 },
+  {  12837,  -3998,   1195,  -1958 },
+  {  10114,  -1100,  -2414,   -394 },
+  {   9341,  -2530,    315,    755 },
+  {  10131,  -3164,   1411,   -674 },
+  {   9535,   -905,  -1551,    579 },
+  {  11717,  -1519,  -3051,     91 },
+  {   9824,  -2911,  -2775,    192 },
+  {   9662,  -2934,   -561,   1450 },
+  {  11085,  -3392,  -1298,   -659 },
+  {   8955,  -2102,  -1899,    703 },
+  {   8607,  -1742,  -4348,    814 },
+  {   7640,  -2063,  -3617,     52 },
+  {   7074,   -826,  -4325,   4375 },
+  {   7714,    584,  -4238,   1927 },
+  {   6355,   -952,  -4912,   3127 },
+  {   7069,   -660,  -6413,   4087 },
+  {   8313,   -132,  -2964,   -876 },
+  {   6952,  -1422,  -3962,    -24 },
+  {   9299,   -734,  -3088,   -263 },
+  {   9484,   -574,  -4513,    466 },
+  {   7246,    -91,  -3735,   -704 },
+  {   8325,  -1417,  -3090,   -530 },
+  {   6469,  -1226,  -4757,    829 },
+  {   6652,   -368,  -5682,   1393 },
+  {   7971,  -1278,  -2284,   1205 },
+  {   7229,   -699,  -3556,   1840 },
+  {   7994,   1284,  -2729,    732 },
+  {   9005,   -698,  -4522,   2189 },
+  {   6963,    197,  -2727,    380 },
+  {   8527,    135,  -3991,   -213 },
+  {   8840,    934,  -3014,   -567 },
+  {  10125,    418,  -3284,   -371 },
+  {   6367,    361,  -2318,   2554 },
+  {   7892,    172,  -5247,   4673 },
+  {   6674,    387,  -5424,   4398 },
+  {   6240,    684,  -4047,   1219 },
+  {  11170,   -794,  -5081,   1195 },
+  {  11765,   -648,  -6265,   2052 },
+  {  10845,   -775,  -3837,    366 },
+  {  12496,   -689,  -8260,   3562 },
+  {   7893,  -1166,  -4972,    988 },
+  {   8592,   1052,  -5986,   3087 },
+  {   7277,   1874,  -5685,   3579 },
+  {   6900,   2016,  -4809,   3491 },
+  {   8530,  -2405,  -3250,   1986 },
+  {   9426,    494,  -7067,   5038 },
+  {  10285,    564,  -8210,   5370 },
+  {   8749,  -2207,  -3980,   2852 },
+  {   9653,  -2686,  -4300,   1400 },
+  {   9770,  -2286,  -5663,   4233 },
+  {   8490,     -4,  -7048,   4496 },
+  {   7697,  -1209,  -5328,   3183 },
+  {   6451,    801,  -4324,   -554 },
+  {   7387,   1806,  -5265,    545 },
+  {   7450,  -2302,  -4445,   1418 },
+  {   8817,  -1370,  -5827,   2168 },
+  {  10324,  -2406,  -5629,   2579 },
+  {   8863,  -2578,  -3537,    467 },
+  {   6901,  -1624,  -3169,   3392 },
+  {   7846,    156,  -6948,   3381 },
+  {   7928,  -1115,  -5972,   4816 },
+  {   6089,   -599,  -4368,   -320 },
+  {   7833,   1246,  -3960,   -621 },
+  {   8931,   2521,  -6768,   2052 },
+  {   8900,   1944,  -4126,     40 },
+  {   7661,    -34,  -2855,   2480 },
+  {   5873,    474,  -3262,   3712 },
+  {   7535,   -234,  -4699,    216 },
+  {   5856,    143,  -5142,     73 },
+  {   8944,   -106,  -5874,   3663 },
+  {   7134,    426,  -5879,   2895 },
+  {  10199,   1011,  -4762,    369 },
+  {   8454,    264,  -5971,   1291 },
+  {   7822,  -2449,  -4333,   4540 },
+  {   6200,  -2758,  -2632,   1497 },
+  {   6070,  -4315,  -2699,    414 },
+  {   7047,  -3739,  -3210,   1060 },
+  {   5675,  -3801,  -2717,   -407 },
+  {   4789,  -4063,  -2628,   -744 },
+  {   4023,  -3366,  -3133,   -726 },
+  {   4296,  -2407,  -3381,   -513 },
+  {   4388,  -2931,  -2820,   1512 },
+  {   4559,  -4233,  -1941,   1976 },
+  {   6702,  -3208,  -1755,   1680 },
+  {   4416,  -3521,  -1052,   2984 },
+  {   7154,  -4266,  -1203,   3732 },
+  {   3625,  -4242,  -3244,   1395 },
+  {   6518,  -2856,  -1304,   2887 },
+  {   6170,  -1949,  -3014,   3973 },
+  {   5189,  -2451,  -4020,   3477 },
+  {   6218,  -2988,  -1921,   3844 },
+  {   4827,  -3688,  -1928,   3343 },
+  {   6668,  -3991,  -2805,   3095 },
+  {   5297,  -3115,  -3684,   2390 },
+  {   5354,  -4614,  -2662,   1504 },
+  {   4196,  -3091,  -4147,   1135 },
+  {   3540,  -2893,  -4007,    100 },
+  {   5569,  -1602,  -4007,   1909 },
+  {   4341,  -2091,  -4272,    252 },
+  {   5559,  -2878,  -3832,    498 },
+  {   4548,  -4479,  -2898,    -27 },
+  {   5176,  -2494,  -4635,   1476 },
+  {   3294,  -3485,  -3738,    716 },
+  {   4920,  -1229,  -4195,   -365 },
+  {   3257,  -3518,  -3349,   2862 },
+  {   5286,  -1948,  -3485,   -778 },
+  {   6502,  -3051,   -152,   2854 },
+  {   5864,  -4192,  -1076,   3451 },
+  {   4656,  -3122,  -3448,    179 },
+  {   5907,   -754,  -1596,   3116 },
+  {   7229,  -3680,  -1590,   2892 },
+  {   5107,  -3888,  -3364,    806 },
+  {   6764,  -2635,  -3450,    134 },
+  {   5258,  -2827,  -2844,  -1052 },
+  {   5798,  -1725,  -4305,    205 },
+  {   5404,  -1213,  -3362,    449 },
+  {   6224,  -2738,  -3046,   -581 },
+  {   4223,  -2438,  -2725,   3745 },
+  {   4751,  -3411,  -2123,    116 },
+  {   3868,  -3000,  -3954,   2297 },
+  {   6819,  -2899,  -4277,   2825 },
+  {   4207,  -4754,  -2808,    865 },
+  {   4804,  -1494,  -1997,   4688 },
+  {   5282,  -2213,   -548,   3559 },
+  {   5580,  -1912,   -566,   4370 },
+  {   6168,  -2857,   -672,   4053 },
+  {   6583,  -4515,  -2850,   1670 },
+  {   6511,  -3093,  -3988,   1421 },
+  {   4646,  -1790,  -1443,   3650 },
+  {   5915,   -924,  -2020,    896 },
+  {   7814,  -4181,  -3152,   2007 },
+  {   6190,  -2238,  -4817,   2279 },
+  {   4737,  -4034,  -3288,   1835 },
+  {   8161,  -3633,  -3423,   3137 },
+  {   7415,  -2351,  -2088,   4290 },
+  {   4106,  -2517,    -62,   2905 },
+  {   4909,  -3145,   -614,   4112 },
+  {   4938,  -3281,   -397,   1100 },
+  {   -173,    919,   1589,  -5363 },
+  {    -13,    796,   -295,  -6655 },
+  {  -1860,   -829,   1141,  -4555 },
+  {   2298,   -838,   -664,  -5005 },
+  {   -884,  -1097,   2074,  -4613 },
+  {   -101,    281,   2846,  -4535 },
+  {   1166,    453,   2429,  -5910 },
+  {    879,   -664,   2370,  -5452 },
+  {   1415,   -370,  -1699,  -4727 },
+  {  -1413,   1277,   -669,  -6649 },
+  {   2133,    304,   -968,  -4624 },
+  {    380,    586,  -2087,  -4892 },
+  {   1336,    275,    -82,  -5789 },
+  {  -2459,   1057,    -34,  -5416 },
+  {   2278,  -1758,    866,  -5653 },
+  {   1945,  -2295,   -149,  -5302 },
+  {   1287,  -3525,    996,  -5255 },
+  {   2297,    803,   1177,  -6067 },
+  {    187,   -180,   -619,  -6202 },
+  {   -793,  -2537,   1554,  -5057 },
+  {  -2703,   -204,   -629,  -5853 },
+  {  -1007,   -146,    313,  -5582 },
+  {    830,    357,    869,  -6363 },
+  {   -228,   -575,  -3177,  -4433 },
+  {  -1001,  -1553,   -142,  -5708 },
+  {  -1644,   1683,   1721,  -4533 },
+  {    893,   1924,    -15,  -5791 },
+  {   2195,   2061,   -262,  -5471 },
+  {   3031,    270,    311,  -5096 },
+  {   1912,   1638,  -1523,  -4677 },
+  {  -3142,    -55,    253,  -4914 },
+  {    356,  -1680,    343,  -6123 },
+  {  -2241,  -1734,   -976,  -5939 },
+  {  -2196,  -2893,    547,  -4938 },
+  {  -1245,    126,  -1916,  -5419 },
+  {   -249,  -3755,  -1422,  -5594 },
+  {    575,  -2683,  -1926,  -4566 },
+  {   -762,   1885,    192,  -5880 },
+  {   -811,  -2562,  -1068,  -6013 },
+  {  -2264,  -3086,   -976,  -4775 },
+  {     70,  -1215,   2880,  -4410 },
+  {    714,  -3760,   2916,  -4691 },
+  {   -244,  -3404,   1740,  -4493 },
+  {    684,  -5137,   -328,  -5608 },
+  {   -529,  -3825,  -1786,  -4535 },
+  {   -713,  -4743,  -1118,  -5546 },
+  {   2718,  -3788,   1798,  -5708 },
+  {  -1639,  -3679,  -1564,  -6095 },
+  {   1693,  -2642,  -1389,  -4539 },
+  {    505,  -1573,  -1651,  -4878 },
+  {   -835,  -2256,  -1941,  -5352 },
+  {   1464,   -411,   1993,  -6441 },
+  {    493,  -3184,   -145,  -6148 },
+  {  -1413,    499,  -1617,  -6479 },
+  {   -294,   1722,  -1419,  -5725 },
+  {  -2937,  -1528,   -175,  -4624 },
+  {   -594,  -5911,    -56,  -6146 },
+  {   -300,  -4275,   1156,  -5947 },
+  {    552,  -2643,   2669,  -3959 },
+  {    905,  -4158,   1789,  -5809 },
+  {   1336,  -2009,   2108,  -5903 },
+  {   1555,  -3600,   1110,  -6759 },
+  {  -1294,  -3464,     77,  -6084 },
+  {  -1139,  -4006,  -1270,  -4181 },
+  {  -5094,  -3296,   1092,  -2847 },
+  {  -5503,  -2883,   1984,  -2067 },
+  {  -4671,  -4218,  -1417,  -4132 },
+  {  -3763,  -3818,   1262,  -3082 },
+  {  -5132,  -3430,   2928,   -728 },
+  {  -5957,  -2877,   1251,  -2446 },
+  {  -4425,  -2319,   -212,  -4276 },
+  {  -6201,  -1993,   1774,  -2182 },
+  {  -5500,  -3836,   2201,  -1396 },
+  {  -6934,  -2334,   2366,  -1293 },
+  {  -6124,  -4140,   1337,  -1977 },
+  {  -6553,  -4186,   1756,  -1325 },
+  {  -5126,  -1258,    744,  -3656 },
+  {  -5167,  -1390,   1581,  -2895 },
+  {  -4525,  -3398,   2429,  -1865 },
+  {  -4076,  -3183,   2027,  -2510 },
+  {  -6191,  -3274,   1838,  -1814 },
+  {  -4454,  -2753,   2723,  -1185 },
+  {  -6655,  -4797,    251,  -2595 },
+  {  -6332,  -2232,   1832,    217 },
+  {  -5869,  -1698,    134,    340 },
+  {  -6614,  -1045,   2126,  -1932 },
+  {  -4859,  -2107,   2010,  -2435 },
+  {  -6274,  -1622,   2808,  -1374 },
+  {  -3119,  -3209,    521,  -3988 },
+  {  -5676,  -2082,   -420,  -2711 },
+  {  -7073,  -3623,    696,  -2343 },
+  {  -5986,  -4224,    572,  -2454 },
+  {  -4340,  -4521,    882,  -2771 },
+  {  -6178,  -1933,    535,  -1444 },
+  {  -4923,  -4163,   1744,  -2066 },
+  {  -6410,  -1519,   1058,  -2683 },
+  {  -5077,  -1185,    856,  -2216 },
+  {  -7091,  -2444,    687,  -2597 },
+  {  -5284,  -2165,   3239,   -993 },
+  {  -4763,  -1497,    197,  -3179 },
+  {  -4128,  -4958,   -396,  -3578 },
+  {  -5054,  -3878,   -647,  -2672 },
+  {  -7005,  -3348,   1679,  -1579 },
+  {  -5767,  -1017,   2582,  -1915 },
+  {  -7069,  -2787,   1331,  -2070 },
+  {  -5532,  -2296,    706,  -2950 },
+  {  -5059,  -3543,   -821,  -3637 },
+  {  -6639,  -1835,   1016,   -696 },
+  {  -5611,  -5220,   -694,  -3371 },
+  {  -5994,  -2803,   2933,   -729 },
+  {  -5948,   -619,   1596,  -2676 },
+  {  -5486,  -4419,    153,  -3265 },
+  {  -4329,  -3440,   1646,  -1439 },
+  {  -4083,  -3978,    177,  -3569 },
+  {  -4289,  -2599,   1224,  -3075 },
+  {  -5707,  -3253,   1912,   -759 },
+  {  -6606,  -3437,   2562,   -571 },
+  {  -5254,  -2444,    769,   -352 },
+  {  -6545,  -3154,    582,  -1103 },
+  {  -5328,  -2241,   2566,  -1775 },
+  {  -7216,  -1936,   1538,  -1983 },
+  {  -3730,  -2451,    426,  -3869 },
+  {  -5110,  -1385,   2031,  -1169 },
+  {  -6470,  -2715,    269,  -3123 },
+  {  -5806,  -2480,    -97,  -3832 },
+  {  -3683,  -4916,   -490,  -4330 },
+  {  -6341,  -2083,   -669,   -115 },
+  {  -4913,  -4079,   -837,  -4673 },
+  {  -3274,  -2497,   2334,  -2652 },
+  {  -1286,  -1731,   2550,  -3756 },
+  {  -3375,   -877,    926,  -3977 },
+  {  -2525,  -2079,   2879,  -2625 },
+  {  -5308,   -504,   3111,  -1607 },
+  {  -4904,    460,   4093,  -1232 },
+  {  -1993,   1616,   4656,  -1913 },
+  {  -3481,  -1176,   3119,  -2236 },
+  {  -4132,  -1502,   2339,  -2545 },
+  {  -2542,   1151,   3569,  -2550 },
+  {  -4381,    430,   3147,  -2082 },
+  {  -3888,    867,   3899,  -1657 },
+  {  -2861,   1290,   4202,  -1979 },
+  {  -3893,   -253,   2363,  -2764 },
+  {  -1705,    688,   3827,  -2923 },
+  {  -2223,   2312,   3700,  -3148 },
+  {  -1986,   -720,   5021,   -795 },
+  {  -3177,    242,   1952,  -3352 },
+  {  -1854,   1509,   2528,  -3815 },
+  {  -3173,     97,   5019,   -706 },
+  {  -2689,   -145,   1375,  -3915 },
+  {  -4838,   -385,   2488,  -2427 },
+  {  -4557,   -355,   1603,  -3060 },
+  {  -3522,   1832,   3292,  -2674 },
+  {  -3769,    780,   2378,  -2704 },
+  {  -4323,  -1932,   3414,  -1169 },
+  {  -2740,   1158,   2729,  -3273 },
+  {  -3647,    210,   1464,  -2892 },
+  {  -2342,  -2097,   1513,  -3727 },
+  {  -4422,  -1242,   3130,  -1833 },
+  {  -1308,  -1039,   4290,  -1875 },
+  {  -1754,  -2535,   3298,  -2314 },
+  {  -4102,   -186,   4037,  -1094 },
+  {  -1008,   1570,   3290,    171 },
+  {  -3322,  -2621,   2791,  -1536 },
+  {  -2539,  -2597,   3442,  -1672 },
+  {  -3411,  -2015,   3670,  -1174 },
+  {  -2097,    730,   5581,  -1399 },
+  {  -1510,    -74,   4820,  -2004 },
+  {  -4086,   -868,   4425,   -771 },
+  {   -956,   -986,   3640,  -2925 },
+  {  -2087,  -1250,   3464,  -2458 },
+  {  -3308,  -2411,   1334,  -3667 },
+  {  -2264,   -389,   4004,  -1854 },
+  {   -680,    239,   4058,  -3388 },
+  {  -1357,     30,   2993,  -3658 },
+  {  -3601,   -552,   1177,  -1136 },
+  {  -2641,    442,   4374,  -1625 },
+  {  -2525,    770,   1640,  -3895 },
+  {  -3172,   -891,   3893,  -1608 },
+  {  -2996,     13,   3277,  -2414 },
+  {   -899,   1055,   4470,  -2501 },
+  {   -422,   -584,   3475,  -3787 },
+  {  -1978,   -593,   2566,  -3415 },
+  {  -3150,  -1280,   2362,  -3047 },
+  {  -3592,    224,   1026,  -3932 },
+  {  -4840,  -1189,   3633,   -879 },
+  {  -3952,  -2255,   2916,  -1826 },
+  {  -1695,     28,   1810,   -349 },
+  {   -745,  -2484,   3308,  -3293 },
+  {  -1016,   1563,   5365,  -1823 },
+  {  -2172,  -1787,   4266,  -1287 },
+  {  -1241,  -1951,   3982,  -2413 },
+  {  -2009,  -2639,   2330,  -3480 },
+  {   5105,  -1618,  -2588,  -2015 },
+  {   6497,  -1523,  -3218,   -910 },
+  {   6526,  -2305,  -2029,  -1790 },
+  {   5289,    -99,  -3436,   -400 },
+  {   5781,  -1623,  -1577,  -2617 },
+  {   5259,   -670,  -3125,  -1700 },
+  {   6343,  -1256,   -331,  -3222 },
+  {   7967,   -678,  -2195,  -1462 },
+  {   6119,   -695,  -2988,  -1538 },
+  {   6108,    494,  -3359,  -1548 },
+  {   5067,    969,  -2328,  -2707 },
+  {   7595,   -435,  -1497,  -2056 },
+  {   6929,   -719,  -2420,  -1665 },
+  {   5190,    584,  -2982,  -2103 },
+  {   6106,   -444,  -1411,  -2739 },
+  {   5584,    289,  -1804,  -2803 },
+  {   5276,    227,  -1180,  -3361 },
+  {   7544,  -1525,  -1834,  -1725 },
+  {   5986,  -1470,  -2606,  -1701 },
+  {   5096,   -765,  -1712,  -3006 },
+  {   5423,   -149,  -3933,  -1157 },
+  {   7651,     26,  -2445,  -1507 },
+  {   4745,   -464,  -1735,  -2362 },
+  {   5352,  -1011,  -1094,  -1999 },
+  {   6300,   -672,   -542,  -1950 },
+  {   6675,  -1020,  -1318,  -1059 },
+  {   7218,  -2036,   -603,  -2462 },
+  {   7755,  -1514,  -2430,  -1229 },
+  {   5041,    449,  -1056,  -2405 },
+  {   6710,  -2277,  -1344,  -2284 },
+  {   6824,  -1347,  -2254,    251 },
+  {   6068,  -1857,   -983,  -1316 },
+  {   5603,  -2177,  -2730,  -1477 },
+  {   5838,  -1059,  -3604,   -970 },
+  {   5076,   -789,   -335,  -2413 },
+  {   6191,  -1634,  -2000,  -2129 },
+  {   5092,  -1292,  -2543,  -1034 },
+  {   5305,    435,  -1710,  -1850 },
+  {   6140,    561,  -2176,  -2380 },
+  {   6752,    348,  -2496,  -1890 },
+  {   6405,    273,  -1098,  -2778 },
+  {   6942,  -1340,   -496,  -1381 },
+  {   5238,   -687,  -2454,  -2349 },
+  {   6959,   -882,  -1833,  -2061 },
+  {   6292,   -253,  -2125,  -2199 },
+  {   5838,   -574,   -759,  -3215 },
+  {   6954,  -1484,   -640,  -2771 },
+  {   7498,  -1706,  -1210,  -2154 },
+  {   6772,  -1003,  -1235,  -2532 },
+  {   6014,    228,  -2154,  -1108 },
+  {   6943,  -2178,  -2644,  -1122 },
+  {   7262,   -763,  -3056,  -1090 },
+  {   6273,  -1478,  -1072,    177 },
+  {   4734,    425,  -2912,    357 },
+  {   7129,    168,  -1537,  -2327 },
+  {   7204,   -434,   -746,  -2660 },
+  {   6879,     57,  -3087,  -1310 },
+  {   4623,   -610,   -718,  -3459 },
+  {   6565,   -543,  -1998,   -339 },
+  {   4752,   -277,  -2066,  -1405 },
+  {   7435,  -1416,  -1904,   -505 },
+  {   4076,    150,  -1222,  -3556 },
+  {   7082,    -28,  -1456,  -1174 },
+  {   5941,   -446,  -1326,  -1158 },
+  {   3870,  -1648,  -2474,  -2589 },
+  {    858,     37,  -3387,  -3721 },
+  {   3557,  -1503,  -1664,  -3383 },
+  {   3336,  -1972,  -3079,  -2216 },
+  {   3186,     60,  -4185,   -863 },
+  {   3456,   -773,  -3066,  -2457 },
+  {   4131,   -913,  -2060,  -2601 },
+  {   4431,   -691,  -4114,   -972 },
+  {   3461,   -334,  -3680,  -1751 },
+  {   2006,   -459,  -2214,  -3827 },
+  {   1322,     32,  -2816,  -3203 },
+  {   4425,  -1897,  -2791,  -1946 },
+  {   4504,     23,  -3421,  -1909 },
+  {   3090,   -885,  -2366,  -3264 },
+  {   3209,  -2363,  -3730,   -834 },
+  {   3312,  -1471,  -3641,  -1579 },
+  {   4184,  -1669,  -3323,  -1248 },
+  {   2190,   -931,  -3302,  -2944 },
+  {   2947,   -229,  -4791,  -1195 },
+  {   2020,  -1626,  -2700,  -3125 },
+  {   2214,   -326,  -4352,  -1683 },
+  {   3286,  -2619,  -2412,  -2458 },
+  {   1000,  -2571,  -4129,  -2158 },
+  {   2496,  -2627,  -3611,  -1433 },
+  {   2043,  -2191,  -2167,  -3827 },
+  {   2571,  -2544,  -1915,  -3222 },
+  {   2022,  -1501,  -3856,  -2165 },
+  {   2685,  -1180,  -1461,  -4038 },
+  {   1610,  -2313,  -4391,  -1173 },
+  {   2340,  -2490,  -4215,   -516 },
+  {   1742,  -2615,  -3632,  -2146 },
+  {    523,  -1293,  -4246,  -2442 },
+  {   3725,  -2723,  -3014,  -1576 },
+  {   3554,  -1381,  -4200,   -824 },
+  {   1291,  -1594,  -4777,  -1430 },
+  {   1452,    515,  -2960,  -3830 },
+  {   4264,   -894,  -3305,  -1826 },
+  {   2606,  -1452,  -4522,   -966 },
+  {   1196,   -830,  -4807,  -1816 },
+  {   1054,   -775,  -2616,  -4071 },
+  {   4206,    415,  -4344,  -1132 },
+  {   3044,    491,  -4126,  -1934 },
+  {    988,   -901,  -3353,  -3443 },
+  {   1729,  -3063,  -2267,  -3370 },
+  {   3915,    912,  -2989,  -2387 },
+  {   3781,    300,  -2457,  -3050 },
+  {   2712,    924,  -1350,  -1206 },
+  {   4230,    405,  -2343,    665 },
+  {   1878,   -873,   -225,    -29 },
+  {   3510,     56,  -1334,  -3420 },
+  {   2850,   1447,  -2651,  -3150 },
+  {   1510,   -706,  -4125,  -2483 },
+  {   3115,    793,  -1692,  -3894 },
+  {   2667,    213,  -2973,  -2786 },
+  {   1184,  -2384,  -3051,  -3173 },
+  {   2139,    796,  -2079,  -3697 },
+  {   1464,  -1483,  -3726,  -2754 },
+  {   2407,  -1148,  -3915,  -1569 },
+  {   2612,  -1779,  -3217,  -2271 },
+  {   2406,  -2870,  -2937,  -2496 },
+  {   2140,    126,  -3646,  -2758 },
+  {   2952,  -1036,    268,  -1423 },
+  {     93,  -1931,  -3841,  -3535 },
+  {    389,  -2953,  -3383,  -3343 },
+  {   8652,  -5511,  -1662,    565 },
+  {   7427,  -2791,  -2535,   -842 },
+  {   8541,  -4253,  -1407,   -988 },
+  {   8018,  -3203,  -2998,    105 },
+  {   7231,  -3926,   -958,   1308 },
+  {   7331,  -3690,   -363,   2586 },
+  {   6803,  -3646,  -2226,   -903 },
+  {   8163,  -2811,   -477,  -2235 },
+  {   9356,  -3818,  -1685,   -684 },
+  {   8466,  -2854,   -302,   -698 },
+  {   8458,  -3224,    517,    279 },
+  {   8074,  -2619,  -1326,   2596 },
+  {   8779,  -2761,  -2527,   -441 },
+  {   6533,  -2887,   -899,   -696 },
+  {   7394,  -2305,  -1642,   -120 },
+  {   8281,  -3780,    -22,   1305 },
+  {   9158,  -4413,   -779,    901 },
+  {   9031,  -5240,  -1109,   1678 },
+  {   8717,  -3650,    410,  -1075 },
+  {   7317,  -3197,   -818,  -2264 },
+  {   7934,  -2385,  -1214,  -1886 },
+  {   8256,  -4441,   -291,   -587 },
+  {   7358,  -3395,   1090,   -270 },
+  {   9446,  -4910,  -1343,   -473 },
+  {   8187,  -4726,   -808,   1166 },
+  {   7504,  -3845,    -47,    267 },
+  {   8029,  -2146,  -1283,   -383 },
+  {   7461,  -2705,   -853,    783 },
+  {   9367,  -3636,   -645,   -354 },
+  {   8955,  -3473,   -308,  -1947 },
+  {   8676,  -2683,  -2099,   1485 },
+  {   7481,  -3003,   -871,   -444 },
+  {   8015,  -2839,  -1673,   1175 },
+  {   6947,  -4643,  -1527,  -1047 },
+  {   7622,  -2575,   -137,   -960 },
+  {   9388,  -4279,   -707,  -1322 },
+  {   8382,  -5259,  -1283,   -565 },
+  {   6856,  -4138,  -1030,    630 },
+  {   8659,  -2571,  -1124,  -1666 },
+  {   8763,  -3807,   -537,   2543 },
+  {   8049,  -3578,  -2186,   -604 },
+  {   8272,  -2351,  -1985,  -1214 },
+  {   6855,  -3796,  -1527,  -1631 },
+  {   7178,  -2896,  -1600,  -1756 },
+  {   7040,  -2888,    -89,  -1586 },
+  {   6261,  -3403,   -264,    998 },
+  {   7756,  -4699,  -1543,   -834 },
+  {   7682,  -4622,   -758,  -1721 },
+  {   8839,  -4232,  -2932,   1959 },
+  {   9363,  -4679,  -1956,     39 },
+  {   7883,  -3616,  -1414,  -1432 },
+  {   8828,  -3188,  -1356,  -1312 },
+  {   7746,  -3987,   -121,  -2424 },
+  {   9262,  -3256,   -693,    818 },
+  {   7670,  -3420,   -148,   3504 },
+  {   7344,  -3183,    608,   1595 },
+  {   8976,  -4139,  -1848,   1304 },
+  {   6708,  -4131,     33,   -852 },
+  {   7840,  -4429,  -2275,     79 },
+  {   8980,  -3858,  -2838,    453 },
+  {   7815,  -4604,  -2563,    944 },
+  {   8372,  -4422,  -1783,   3071 },
+  {   8623,  -5128,  -1754,   2888 },
+  {   7462,  -3281,    889,    920 },
+  {   8416,    -59,  -1320,  -1825 },
+  {   7928,  -1488,   -414,  -2499 },
+  {   8110,   -977,  -1047,  -2042 },
+  {   8278,   -687,  -1597,  -1550 },
+  {   7988,   -174,   -977,  -2106 },
+  {   8609,  -1547,  -1628,  -1527 },
+  {   9000,  -1798,   -946,  -1761 },
+  {   8954,   -872,  -1404,  -1594 },
+  {   8939,    466,   -748,  -1212 },
+  {   9549,   -329,   -177,  -1360 },
+  {   9411,    -18,  -1126,  -1568 },
+  {   8859,   -782,   -488,  -1338 },
+  {   8955,   -218,    -43,  -1209 },
+  {   9131,    -69,   -453,  -1001 },
+  {   9069,  -1519,  -1091,  -1199 },
+  {   9247,  -1309,   -566,  -1146 },
+  {   8528,  -1617,   -287,  -1313 },
+  {   7763,   -745,   -149,  -2040 },
+  {   8294,   -343,    257,  -2633 },
+  {  10149,   -893,   -552,  -1649 },
+  {   9398,   -915,    218,  -2042 },
+  {   9703,  -1194,   -675,  -1592 },
+  {   9586,   -700,   -427,  -1710 },
+  {   8930,    497,  -1445,  -1218 },
+  {   9285,  -1323,   -163,  -1552 },
+  {   8431,  -1289,   -985,  -1404 },
+  {   8965,   -655,    653,  -1483 },
+  {   9542,  -1001,   -951,  -1128 },
+  {   9205,   -647,    -37,   -882 },
+  {   8603,    -56,    514,  -1793 },
+  {   9300,    -12,  -1324,   -567 },
+  {   8773,    238,   -184,  -1456 },
+  {   9941,  -1306,    -69,  -1792 },
+  {   9360,    279,   -376,  -1919 },
+  {   9180,   -285,     95,  -2170 },
+  {   9922,   -501,   -970,  -1570 },
+  {   8341,  -1493,   -856,  -2092 },
+  {   8780,   -981,   -850,  -1014 },
+  {   9721,   -548,  -1504,  -1094 },
+  {   9973,  -1493,    482,  -2105 },
+  {   8707,   -333,  -1027,  -1087 },
+  {   9098,   -469,   -315,  -1723 },
+  {   8879,  -1050,   -661,  -2020 },
+  {   8857,    602,   -866,  -1918 },
+  {   8945,  -1025,  -2154,  -1071 },
+  {   8484,  -1930,   -468,  -2179 },
+  {   9177,  -1903,   -224,  -2112 },
+  {   8652,   -137,  -2097,  -1214 },
+  {   9063,   -973,  -1405,   -772 },
+  {   9328,   -456,    662,  -2469 },
+  {  10101,   -697,    127,  -2113 },
+  {   9685,    811,  -2359,  -1024 },
+  {   8586,    -94,   -460,  -1982 },
+  {   7924,   -141,   -509,  -2513 },
+  {   7773,   -669,   -107,  -2835 },
+  {   8636,  -1064,    -46,  -2409 },
+  {   9748,    596,  -1815,  -1349 },
+  {   8924,    304,    547,  -2614 },
+  {   9442,    746,  -1153,  -1679 },
+  {   9454,   -278,   -529,  -1976 },
+  {   8488,    561,    -32,  -2160 },
+  {  10083,    -63,  -1544,  -1364 },
+  {   9390,  -1278,    568,  -1131 },
+  {   9740,    -49,  -2253,   -910 },
+  {   3636,  -2391,  -1115,  -3614 },
+  {   6014,  -3204,  -1902,  -1808 },
+  {   5787,  -3497,  -1116,  -2590 },
+  {   4365,  -3046,  -1632,  -2668 },
+  {   4733,  -2192,  -2029,  -2468 },
+  {   5412,  -2753,  -1633,  -2464 },
+  {   4455,  -3375,   -767,  -3399 },
+  {   4456,  -1644,   -983,  -2841 },
+  {   4039,  -2523,     38,  -3967 },
+  {   3406,  -2662,     72,  -4757 },
+  {   4279,  -2005,   1055,  -4399 },
+  {   4321,  -1377,   -860,  -3786 },
+  {   3743,  -5739,   -651,  -3047 },
+  {   3528,  -5510,    361,  -4060 },
+  {   6496,  -4886,   -136,  -2689 },
+  {   4513,  -5254,    551,  -4010 },
+  {   6557,  -3413,    -92,  -3063 },
+  {   4186,  -2059,    187,     47 },
+  {   6210,  -4117,  -1256,  -1985 },
+  {   6038,  -4343,    351,  -2124 },
+  {   4305,  -4780,  -2077,  -1897 },
+  {   4480,  -3815,  -2228,  -1533 },
+  {   5582,  -3689,   1221,  -3429 },
+  {   5532,  -4874,   1195,  -2765 },
+  {   6518,  -2853,   -905,  -2568 },
+  {   5467,  -2192,    470,  -4115 },
+  {   4139,  -1577,    240,  -3493 },
+  {   5281,  -1926,   -729,  -3340 },
+  {   5214,  -2870,   1359,  -4289 },
+  {   3046,  -3510,  -1536,  -3214 },
+  {   5433,  -2881,  -1230,  -1184 },
+  {   4861,  -3932,  -1071,  -2791 },
+  {   5693,  -4234,  -1906,  -1502 },
+  {   4004,  -3935,  -1804,  -2383 },
+  {   3728,  -3792,    681,  -4773 },
+  {   3621,  -3030,  -1951,  -2598 },
+  {   5133,  -3903,     44,  -3700 },
+  {   3561,  -3451,   1183,  -5301 },
+  {   5026,  -2762,  -2341,  -1780 },
+  {   5841,  -2492,   -467,  -3210 },
+  {   5591,  -1791,    497,  -2472 },
+  {   5054,  -3898,  -1822,  -2097 },
+  {   5813,  -2792,     83,  -1469 },
+  {   4432,  -4497,   1670,  -5193 },
+  {   5338,  -4653,  -1109,  -2200 },
+  {   3239,  -4401,   -648,  -3655 },
+  {   2147,  -3598,  -1200,  -4242 },
+  {   4417,  -2271,  -1552,  -3210 },
+  {   6494,  -4360,    852,  -3565 },
+  {   2393,  -6358,   -856,  -4524 },
+  {   4959,  -4196,   -847,  -1403 },
+  {   4924,  -5438,   -226,  -3026 },
+  {   4254,  -5303,  -1306,  -2424 },
+  {   4121,  -3126,  -2334,  -1981 },
+  {   3437,  -4443,  -1464,  -2953 },
+  {   3203,  -3459,   -529,  -4339 },
+  {   5896,  -5945,    543,  -3246 },
+  {   1987,  -4733,   -220,  -4863 },
+  {   4358,  -4431,   -514,  -3081 },
+  {   4583,  -2416,   -492,  -2287 },
+  {   2943,  -5035,    419,  -4927 },
+  {   5358,  -5129,    987,  -4309 },
+  {   4460,  -3392,   1752,  -5634 },
+  {   3415,  -4633,   1507,  -5945 },
+  {    811,  -4692,   -445,   2333 },
+  {   1009,  -5613,  -1857,   1360 },
+  {   1338,  -2712,  -2720,   3036 },
+  {   1002,  -3754,  -2582,   2344 },
+  {    750,  -4608,  -2334,    714 },
+  {   2043,  -3207,  -2822,   2173 },
+  {   -140,  -4654,  -2953,    357 },
+  {    -54,  -4026,  -2376,   2695 },
+  {   1858,  -5022,   -717,   2287 },
+  {   2064,  -3894,   -722,   3255 },
+  {   2727,  -4558,   -332,   2603 },
+  {   1810,  -5378,    283,   1826 },
+  {   3935,  -4326,    762,   3383 },
+  {   -767,  -4697,  -2510,   1922 },
+  {   2146,  -4312,  -3090,   1641 },
+  {     54,  -5881,  -2114,    921 },
+  {   1992,  -5766,   -640,   1574 },
+  {   1200,  -5371,  -1114,   1828 },
+  {   2973,  -5337,     34,   2266 },
+  {   1531,  -5018,  -2817,   1192 },
+  {   3078,  -4570,    117,   1990 },
+  {    924,  -4286,  -1388,   2713 },
+  {    142,  -5058,  -2848,   1487 },
+  {   -106,  -6180,   -881,    842 },
+  {    673,  -5433,   -229,   1596 },
+  {    783,  -5710,  -2784,    562 },
+  {   1935,  -5729,  -2009,    856 },
+  {   -410,  -3375,  -3326,   2734 },
+  {    234,  -3000,  -2628,   3260 },
+  {    733,  -3405,  -3806,   1589 },
+  {    771,  -4285,  -3544,   1314 },
+  {   1192,  -3563,  -3960,   2178 },
+  {    206,  -5555,  -1250,   1546 },
+  {   -130,  -3815,  -1210,   3041 },
+  {    646,  -3940,   -393,   2992 },
+  {   -184,  -4931,  -1767,   1925 },
+  {   2746,  -5120,  -2275,   1464 },
+  {   2440,  -3731,  -3352,   2729 },
+  {   -490,  -4942,  -3779,    997 },
+  {     68,  -2636,  -4167,   3778 },
+  {     48,  -3986,  -4118,   2106 },
+  {   -978,  -5486,  -1336,   1390 },
+  {   1126,  -5297,   -855,    640 },
+  {   -472,  -3975,  -3622,   1557 },
+  {   2456,  -5344,  -1523,   1648 },
+  {   -774,  -5652,  -2417,   1147 },
+  {    995,  -6122,   -812,   1132 },
+  {   3282,  -4571,  -1763,   2175 },
+  {   3655,  -3862,   -676,   3568 },
+  {   3038,  -3647,  -1672,   3381 },
+  {   2595,  -2964,  -2772,   3263 },
+  {   4176,  -3353,  -1148,   4354 },
+  {   1603,  -3442,  -1500,   3444 },
+  {    828,  -6226,  -1783,    678 },
+  {   1421,  -3333,  -3080,   3403 },
+  {   1121,  -4727,  -1924,   1984 },
+  {   -186,  -5083,   -682,   1796 },
+  {    819,  -2778,  -3488,    530 },
+  {    421,  -2873,  -3832,   2596 },
+  {   2164,  -4263,  -1605,   2282 },
+  {    585,  -4437,   -682,   -491 },
+  {   -644,  -4452,  -1157,   2325 },
+  {   1991,  -4299,    210,   2834 },
+  {   2135,  -3632,  -2113,    665 },
+  {  -7482,  -2724,  -2662,  -1380 },
+  {  -6983,  -2166,  -3756,  -3509 },
+  {  -7085,  -1439,  -2397,  -3112 },
+  {  -7760,  -3049,  -3319,  -2822 },
+  {  -8413,  -2760,  -4406,  -3298 },
+  {  -5995,  -3943,  -1260,  -3750 },
+  {  -7879,  -1554,  -3464,  -2606 },
+  {  -6314,  -2034,  -3878,  -1681 },
+  {  -8849,  -2084,  -1399,  -1231 },
+  {  -7153,  -2602,  -1384,   -817 },
+  {  -8041,  -2571,   -407,  -2785 },
+  {  -7246,  -2233,  -1578,    260 },
+  {  -7336,  -3883,  -4061,  -1342 },
+  {  -7619,  -3908,  -2342,    382 },
+  {  -8684,  -3724,  -1662,   -727 },
+  {  -7850,  -2922,  -1770,  -3449 },
+  {  -6766,  -2034,  -1293,  -1988 },
+  {  -6895,  -2116,   -968,  -3744 },
+  {  -7136,  -5147,  -2618,  -2809 },
+  {  -8224,  -3724,  -2519,  -1589 },
+  {  -6711,  -2750,  -3021,   -219 },
+  {  -8059,  -1638,  -1102,  -3175 },
+  {  -8710,  -4839,  -3963,  -3143 },
+  {  -9363,  -4965,  -3257,  -1002 },
+  {  -6099,  -1751,  -3157,   -395 },
+  {  -6453,  -3216,  -4597,   -483 },
+  {  -7879,  -5477,   -839,  -2638 },
+  {  -7202,  -4038,   -526,  -2856 },
+  {  -8022,  -1228,  -1910,  -1646 },
+  {  -9117,  -1393,  -1582,  -2535 },
+  {  -9095,  -2693,   -636,  -2605 },
+  {  -9076,  -2580,  -3481,  -2519 },
+  {  -8327,  -4859,  -2422,     83 },
+  {  -8368,  -2129,  -2324,  -2173 },
+  {  -8554,  -4563,  -3842,  -2007 },
+  { -10462,  -4261,  -1934,  -2084 },
+  {  -9717,  -3187,  -2294,  -1896 },
+  {  -9625,  -3889,  -3020,  -3224 },
+  {  -9857,  -4955,  -4239,  -2184 },
+  {  -9752,  -2351,  -2277,  -3129 },
+  {  -7219,  -1302,  -2639,  -1603 },
+  {  -7477,  -4360,  -3718,   -559 },
+  {  -5680,  -2033,  -2326,  -3078 },
+  { -10190,  -5548,  -4643,  -3601 },
+  {  -9431,  -4121,   -879,  -2479 },
+  {  -8365,  -5450,  -2020,  -1439 },
+  {  -6289,  -5178,  -1605,  -3845 },
+  {  -8319,  -3866,   -687,  -2792 },
+  {  -8131,  -1031,  -3608,  -3947 },
+  { -10510,  -2560,  -1199,  -2082 },
+  { -11015,  -3640,  -2748,  -3041 },
+  {  -8762,  -5022,  -5231,  -1162 },
+  { -10153,  -2715,  -4648,  -4859 },
+  {  -7930,  -5205,  -1900,  -3600 },
+  {  -9561,  -3548,  -4812,  -3722 },
+  {  -7663,  -4709,  -1180,  -1475 },
+  {  -9073,  -5707,  -1815,  -2980 },
+  {  -8602,  -2363,  -2675,  -3770 },
+  {  -9967,  -5614,  -3575,  -3838 },
+  {  -8324,  -1005,  -2131,  -3254 },
+  { -10331,  -5737,  -2550,  -2940 },
+  {  -8234,  -3354,  -3361,  -4479 },
+  {  -8140,  -1951,  -4526,  -4545 },
+  {  -6679,  -2662,  -2284,  -4182 },
+  {  -1122,  -1514,  -6427,   -212 },
+  {     54,  -1660,  -5424,  -1404 },
+  {    254,  -2778,  -5222,    846 },
+  {   -267,  -1661,  -6577,    814 },
+  {   -305,  -2021,  -5759,   1484 },
+  {  -1791,  -2446,  -6867,    -86 },
+  {  -2929,  -3158,  -6603,  -1799 },
+  {  -1391,  -3189,  -5557,  -1053 },
+  {  -1602,   -884,  -6767,  -1213 },
+  {   -361,   -318,  -6219,    -44 },
+  {  -4078,  -2635,  -5523,   -433 },
+  {   -956,    478,  -4382,   1470 },
+  {  -3300,  -2462,  -6021,  -2721 },
+  {    708,  -2434,  -5085,   -540 },
+  {  -2435,  -3607,  -5647,  -2110 },
+  {   -491,  -1134,  -4681,  -2886 },
+  {     87,  -3435,  -4641,  -1194 },
+  {   -586,  -2927,  -4784,    366 },
+  {  -1394,  -2326,  -6021,    350 },
+  {     97,  -2519,  -4678,  -2120 },
+  {  -1547,  -1907,  -5069,  -2993 },
+  {    268,  -3724,  -4719,    127 },
+  {   -827,  -1190,  -5912,   1144 },
+  {  -3959,  -2322,  -6898,  -1974 },
+  {  -2728,  -2228,  -6426,   -562 },
+  {   -456,   -666,  -5785,  -1609 },
+  {    531,  -1096,  -5731,   -656 },
+  {  -3569,   -688,  -3915,    110 },
+  {  -4752,  -1725,  -4393,   -377 },
+  {  -3210,  -3315,  -6960,   -840 },
+  {   -688,  -3416,  -4971,   1221 },
+  {  -1833,     77,  -6491,  -2434 },
+  {   -239,   -255,  -6850,   -886 },
+  {  -2112,  -1490,  -6291,  -2689 },
+  {  -1544,  -4579,  -5198,  -1261 },
+  {  -2771,  -4014,  -5520,    683 },
+  {  -1635,  -2829,  -5512,   1214 },
+  {   -958,  -2582,  -4823,   2360 },
+  {  -2077,  -4566,  -4642,    365 },
+  {  -3112,  -4214,  -5960,   -823 },
+  {  -2467,  -2510,  -4858,   1467 },
+  {  -1561,  -3399,  -5822,    211 },
+  {   -775,  -1081,  -4424,   2636 },
+  {  -1263,     25,  -6378,  -1392 },
+  {  -3476,   -366,  -5417,  -1393 },
+  {  -3176,  -1476,  -4149,   1466 },
+  {  -2479,    518,  -4448,   -257 },
+  {  -2992,    158,  -4660,  -1279 },
+  {  -1320,  -3872,  -4479,   1147 },
+  {  -1475,   -312,  -5318,    539 },
+  {  -3527,  -1679,  -5860,  -1681 },
+  {  -3397,  -3438,  -5593,   1866 },
+  {  -4089,  -2439,  -4763,   1275 },
+  {   -748,  -4513,  -4687,    -48 },
+  {  -2166,  -4531,  -4691,  -2856 },
+  {  -2385,   -853,  -6035,   -627 },
+  {  -1194,  -4091,  -4472,  -1963 },
+  {   -682,  -3234,  -4084,  -3033 },
+  {  -3255,  -5015,  -5328,    -12 },
+  {  -2313,  -3436,  -4601,   -155 },
+  {  -2792,  -1038,  -6947,  -2019 },
+  {  -1244,  -1526,  -5771,  -1882 },
+  {  -4679,  -3731,  -5506,    283 },
+  {  -3062,    -66,  -3558,   -758 },
+  {  -4895,  -1187,   4751,   3728 },
+  {  -7600,  -2752,   3320,   4613 },
+  {  -5703,  -2975,   3944,   2659 },
+  {  -4972,  -1257,   -246,   2952 },
+  {  -4221,  -2487,   1702,   4295 },
+  {  -2900,  -1529,   2458,   4935 },
+  {  -5061,    407,   2416,   4050 },
+  {  -6931,  -3478,   2761,   2213 },
+  {  -6037,  -3921,   3192,   1866 },
+  {  -6113,   -811,   2407,   3782 },
+  {  -5878,  -1716,   1207,   3478 },
+  {  -5953,  -2853,   2207,   2712 },
+  {  -6807,  -3223,   2749,   3595 },
+  {  -3272,  -3157,   1389,   3788 },
+  {  -5368,  -1904,   1980,   5077 },
+  {  -7235,  -1398,   3075,   4548 },
+  {  -4765,  -3487,   2755,   2796 },
+  {  -7658,  -4435,   2694,   2582 },
+  {  -6997,  -4282,    456,   3832 },
+  {  -5563,  -3115,    -63,   3713 },
+  {  -4244,  -4220,   1450,   2767 },
+  {  -3801,  -2194,    190,   4303 },
+  {  -5458,  -4119,   1958,   2274 },
+  {  -7300,  -3469,   3514,   3193 },
+  {  -4594,  -2067,    775,   4752 },
+  {  -3389,  -1654,   1464,   5412 },
+  {  -4845,  -3483,    964,   3437 },
+  {  -6007,  -2818,   1666,   4659 },
+  {  -8709,  -5007,   1757,   3287 },
+  {  -5833,  -4389,   1025,   3171 },
+  {  -5788,  -1780,   3944,   3661 },
+  {  -4430,   -920,   1938,   4753 },
+  {  -7066,  -1857,   4591,   4538 },
+  {  -3549,   -513,   1427,   5317 },
+  {  -7517,  -1220,   2883,   3049 },
+  {  -7605,  -2687,   1874,   2735 },
+  {  -8718,  -4035,   2676,   3730 },
+  {  -7990,  -3907,   1185,   2607 },
+  {  -6058,  -1744,   3349,   5157 },
+  {  -5954,    565,   3161,   3250 },
+  {  -6478,   -612,   1930,   2271 },
+  {  -6535,  -1445,     -2,   1618 },
+  {  -8963,  -4151,   1192,   4044 },
+  {  -7227,  -3570,   1600,   4234 },
+  {  -4674,     79,    595,   3015 },
+  {  -3974,    430,   2727,   5137 },
+  {  -5299,      9,   3714,   4779 },
+  {  -6779,  -2699,     -8,   2436 },
+  {  -7016,  -1145,   1293,   2310 },
+  {  -6955,  -3312,   1534,   1801 },
+  {  -4025,    740,   1850,   4054 },
+  {  -9589,  -3460,   4154,   5270 },
+  {  -4404,  -1181,   4298,   5173 },
+  {  -7356,  -4583,    -18,   2644 },
+  {  -6516,  -1235,   4439,   6234 },
+  {  -3453,   -301,   4344,   4464 },
+  {  -4643,   1530,   3315,   4340 },
+  {  -4575,  -2557,   3754,   3682 },
+  {  -3643,  -3501,   2051,   2997 },
+  {  -5412,  -2475,   2301,   1579 },
+  {  -5846,    259,   1360,   2348 },
+  {  -5258,  -1358,   1050,    838 },
+  {  -5542,   -219,   6377,   5750 },
+  {  -5713,  -2952,    922,    899 },
+  {  -2049,  -1135,   5206,   1033 },
+  {  -1693,  -1886,   4835,   -106 },
+  {  -2344,  -3504,   4232,    -13 },
+  {  -2475,  -2334,   5043,   1126 },
+  {   -787,  -2549,   3880,   2138 },
+  {  -3159,  -2341,   4830,   2887 },
+  {  -1780,  -1009,   6240,   2061 },
+  {  -4327,  -3363,   2818,    886 },
+  {  -3376,  -2743,   4104,    207 },
+  {  -3250,  -4640,   2718,   1498 },
+  {   -382,  -1075,   4382,   3460 },
+  {  -2416,  -4168,   3530,    816 },
+  {  -1756,  -2708,   4861,    622 },
+  {  -1879,  -2097,   5156,   2889 },
+  {  -2496,  -2418,   3722,   2671 },
+  {  -2717,  -3252,   3341,   1944 },
+  {  -4063,  -4091,   3306,    267 },
+  {  -3549,  -3808,   3747,    842 },
+  {  -2635,    546,   5794,   1894 },
+  {  -1857,  -1121,   4383,   3964 },
+  {  -2226,  -2166,   3489,   3678 },
+  {  -3492,   -660,   5323,   1063 },
+  {  -3033,  -3130,   4382,   1828 },
+  {  -2703,   -625,   6369,   2851 },
+  {  -1656,  -2842,   4584,   -528 },
+  {  -4781,  -2622,   4390,   2097 },
+  {   -413,  -2045,   5081,   3035 },
+  {  -3810,  -2662,   4532,   1095 },
+  {  -3144,  -1858,   5215,   1880 },
+  {  -3562,  -1795,   4928,    670 },
+  {  -4800,  -1509,   5189,   1859 },
+  {  -1085,  -3832,   4169,    900 },
+  {  -1969,  -3270,   2857,   2878 },
+  {  -4267,  -4140,   3176,   1805 },
+  {  -5145,  -3727,   3524,   1168 },
+  {  -1346,  -1876,   5501,   1748 },
+  {  -4998,  -2945,   3699,    338 },
+  {  -3458,  -3096,   3406,   -635 },
+  {  -1751,  -3209,   3508,    395 },
+  {  -2507,    170,   5987,    705 },
+  {  -3756,  -1072,   5647,   3536 },
+  {  -2870,  -1439,   5026,   3212 },
+  {  -3913,  -3225,   3669,   2144 },
+  {  -3739,    226,   5747,    764 },
+  {  -2052,   -820,   5266,   3093 },
+  {  -3214,  -3820,   2409,   2391 },
+  {  -4398,  -2588,   3501,   -218 },
+  {  -4484,  -1763,   4180,   -198 },
+  {  -3368,  -1525,   4362,   -134 },
+  {  -2407,    224,   4905,   3533 },
+  {  -1369,  -2937,   4728,   1788 },
+  {  -4848,  -1707,   4159,    851 },
+  {  -3454,  -1749,   4281,   3230 },
+  {  -1990,  -3853,   3487,   1735 },
+  {  -3117,     92,   6155,   4075 },
+  {  -2676,  -2472,   4078,   -589 },
+  {  -1547,  -2012,   2626,   1835 },
+  {  -4275,   -588,   4824,    725 },
+  {   -601,  -2249,   3736,   3548 },
+  {  -4060,    -61,   5333,   3097 },
+  {  -4303,      7,   6551,   3054 },
+  {  -5003,  -1029,   5786,   3319 },
+  {  -2810,   -728,   5392,    199 },
+  {  -1232,   -200,   5228,   3121 },
+  {   2621,    165,  -6255,    298 },
+  {   3669,    537,  -6844,   1564 },
+  {   1598,  -1190,  -6235,   2523 },
+  {   2164,    -32,  -6894,   1383 },
+  {    853,  -1597,  -6069,   1449 },
+  {   1377,  -1661,  -5266,    108 },
+  {   2660,     48,  -5172,   -517 },
+  {   1903,   -391,  -5677,   1010 },
+  {   3792,    206,  -5274,    -11 },
+  {   1239,   2776,  -2929,   2721 },
+  {   4071,    149,  -7259,   3125 },
+  {   1436,   -480,  -6156,   -196 },
+  {   1373,  -1960,  -5005,   3122 },
+  {   3413,  -1271,  -5176,   3283 },
+  {   3060,    -68,  -6495,   2238 },
+  {   2700,  -2075,  -4681,     91 },
+  {   2928,  -1728,  -5168,   1858 },
+  {   4424,    828,  -4471,     88 },
+  {   2672,  -2604,  -4038,   2753 },
+  {   5223,   -123,  -6749,   2295 },
+  {   4237,   -420,  -5538,   1353 },
+  {   4744,  -1281,  -4097,   4708 },
+  {   1103,  -2764,  -4751,   2024 },
+  {   3747,  -1913,  -3911,   3960 },
+  {   2470,  -1416,  -5542,    615 },
+  {   4847,  -1354,  -5334,   1733 },
+  {   5336,     88,  -7593,   4007 },
+  {   2388,  -2880,  -4807,   1037 },
+  {   4495,   1391,  -5685,   -139 },
+  {   5253,   1637,  -6450,   1533 },
+  {   1199,    795,  -5515,   1261 },
+  {   1397,  -1259,  -4252,   3838 },
+  {    746,     70,  -6640,    604 },
+  {   1584,    166,  -4972,   3072 },
+  {    380,   -999,  -5397,   2267 },
+  {   2974,   1707,  -3242,   5360 },
+  {   5202,   -403,  -5453,   2832 },
+  {   3718,  -1731,  -4760,    714 },
+  {   4150,   -975,  -4792,     61 },
+  {   2925,   -818,  -4841,     15 },
+  {   5301,    577,  -4006,   3259 },
+  {   5265,   1986,  -5679,   3028 },
+  {   3752,   1928,  -4509,   3729 },
+  {   3278,   1925,  -6370,   1247 },
+  {   5107,   1721,  -4853,   3127 },
+  {   3279,   2982,  -2515,   4005 },
+  {   4622,    668,  -6204,    759 },
+  {   6034,    317,  -5763,   4818 },
+  {   -558,     57,  -3785,   2817 },
+  {   4476,   1616,  -3965,   4536 },
+  {   5953,   2056,  -8215,   2715 },
+  {   4387,   2613,  -7463,    868 },
+  {   5834,   1088,  -4736,   4924 },
+  {   6473,   -856,  -6991,   4172 },
+  {   4959,   -293,  -5162,     76 },
+  {   2731,   -843,  -6119,   3847 },
+  {   3245,   1202,  -6833,    616 },
+  {   2553,   1383,  -3829,   3859 },
+  {   4332,   2099,  -3480,   3622 },
+  {   2110,   2683,  -2728,   3990 },
+  {    876,   1167,  -3290,   3466 },
+  {   3991,   1709,  -2410,   4077 },
+  {   5105,    939,  -2584,   3256 },
+  {   4719,    688,  -1566,   3040 },
+  {  -3632,   4335,   1266,  -3303 },
+  {  -4956,   3207,   1312,  -2806 },
+  {  -4669,   2627,   2663,  -2435 },
+  {  -4282,   3708,   2303,  -3038 },
+  {  -4536,   2297,   -175,  -3350 },
+  {  -5234,   2503,   -139,   -880 },
+  {  -3978,   1512,   1092,  -3619 },
+  {  -4519,   4649,   1363,  -2455 },
+  {  -5118,   3132,   1961,  -1577 },
+  {  -5196,   3379,   -182,  -1378 },
+  {  -6420,   4486,   2397,  -1993 },
+  {  -5030,   5046,   1292,  -1118 },
+  {  -4559,   2573,   -927,  -1406 },
+  {  -3501,   3730,    691,  -4930 },
+  {  -4364,   2758,   1007,  -3909 },
+  {  -4026,   2839,  -1559,  -2340 },
+  {  -5037,   4053,    836,  -1571 },
+  {  -4727,   5136,   1110,  -3588 },
+  {  -5245,   2799,   -999,  -2164 },
+  {  -4954,   1501,    422,  -3963 },
+  {  -5994,   2726,   1462,  -2833 },
+  {  -5621,   5159,   2038,  -2512 },
+  {  -4991,   2291,   1917,  -3151 },
+  {  -5469,   4382,   -148,  -2978 },
+  {  -5858,   1983,    807,  -2720 },
+  {  -4709,   3556,    952,   -467 },
+  {  -2489,   2362,   1714,  -4230 },
+  {  -4717,   5004,  -1180,  -3672 },
+  {  -5914,   3653,   1359,  -1317 },
+  {  -5506,   2995,    780,  -1059 },
+  {  -5287,   3945,   2480,  -2293 },
+  {  -3849,   4358,    322,  -1770 },
+  {  -3911,   3570,    252,  -3185 },
+  {  -3660,   5128,    158,  -3719 },
+  {  -4599,   3277,   -503,  -2727 },
+  {  -3673,   3760,  -1252,  -3339 },
+  {  -5161,   2337,    388,  -1943 },
+  {  -3529,   2216,   2156,  -3080 },
+  {  -4309,   4331,   1808,  -1460 },
+  {  -4782,   3820,    480,  -2504 },
+  {  -4166,   3544,   -378,  -1567 },
+  {  -5572,   2466,   -418,  -2909 },
+  {  -6096,   2930,    119,  -1878 },
+  {  -5963,   3554,   1011,  -2233 },
+  {  -6433,   4335,    935,  -2930 },
+  {  -5004,   3314,  -1352,  -3430 },
+  {  -6042,   3463,  -1008,  -3940 },
+  {  -4671,   2214,   -640,  -5040 },
+  {  -2795,   3759,   1412,  -3803 },
+  {  -3647,   4436,    729,   -515 },
+  {  -3594,   1033,     56,  -4148 },
+  {  -2908,   3027,   2889,  -3485 },
+  {  -3338,   2234,    313,  -4285 },
+  {  -3825,   4497,   -561,  -2634 },
+  {  -6167,   3012,    -48,  -3149 },
+  {  -4828,   3515,   -969,  -4475 },
+  {  -5789,   2757,   -539,  -4173 },
+  {  -2452,   3067,    564,  -4249 },
+  {  -4921,   1358,   1331,  -2889 },
+  {  -3127,   4239,  -1045,  -1523 },
+  {  -4780,   2326,  -1118,  -3446 },
+  {  -3908,   5546,    152,  -2622 },
+  {  -6972,   2976,    337,  -2809 },
+  {  -4839,   4613,    -35,  -4077 },
+  {  -1408,   4822,  -1149,  -4997 },
+  {   -981,   4979,   -912,  -6304 },
+  {  -2098,   5689,   -888,  -2878 },
+  {  -3343,   4814,   -657,  -4434 },
+  {  -2461,   3601,   -967,  -4869 },
+  {  -2652,   3944,     87,  -5520 },
+  {  -1104,   6076,    174,  -6407 },
+  {    355,   5370,  -1721,  -5869 },
+  {   1242,   4497,  -1107,  -5091 },
+  {    -89,   4002,  -1491,  -5182 },
+  {   1059,   5693,  -1591,  -4905 },
+  {   1323,   4682,  -2078,  -4768 },
+  {    818,   3996,   -549,  -5468 },
+  {   -287,   4529,    929,  -5543 },
+  {   -919,   5519,  -2791,  -2844 },
+  {  -1407,   5679,  -3289,  -3974 },
+  {   -189,   6530,  -3547,  -4002 },
+  {   -900,   7039,  -3371,  -4855 },
+  {  -2983,   7211,   -363,  -4835 },
+  {   -814,   6503,   -104,  -5106 },
+  {  -2386,   6896,    809,  -4919 },
+  {    845,   4492,    352,  -6621 },
+  {  -1998,   7237,  -1646,  -4231 },
+  {  -3380,   6251,    471,  -4577 },
+  {  -1908,   7059,     84,  -5726 },
+  {   -340,   6346,   -803,  -6265 },
+  {  -2279,   5834,    -47,  -4633 },
+  {  -1532,   5286,  -1748,  -1901 },
+  {  -2757,   6188,   -453,  -3415 },
+  {  -1255,   6405,  -2043,  -6357 },
+  {    918,   5581,   -121,  -5667 },
+  {   1840,   5336,   -821,  -5034 },
+  {  -2475,   4992,  -1825,  -3104 },
+  {  -2413,   5606,  -1789,  -4298 },
+  {    132,   5128,  -2389,  -4442 },
+  {    223,   6400,  -2653,  -4742 },
+  {   -673,   5012,    680,  -4582 },
+  {  -1657,   6624,   -349,  -3596 },
+  {   -755,   6289,  -1860,  -3978 },
+  {   -572,   6894,  -1946,  -5207 },
+  {  -1141,   4756,  -2665,  -5586 },
+  {  -1073,   4269,   -431,  -4030 },
+  {    186,   5761,    916,  -5868 },
+  {  -1907,   4836,   1017,  -5106 },
+  {   -963,   3363,  -1248,  -6348 },
+  {  -3262,   4774,  -1818,  -5858 },
+  {    847,   3812,  -2538,  -4302 },
+  {  -1223,   5903,   1360,  -5479 },
+  {  -1094,   6923,  -1244,  -2381 },
+  {    267,   6276,   -709,  -2846 },
+  {   -157,   5840,   1124,  -4266 },
+  {    889,   3206,   -910,  -5305 },
+  {  -1736,   3344,    582,  -4838 },
+  {  -2357,   5676,  -2695,  -6277 },
+  {  -1916,   6901,   -986,  -5397 },
+  {  -3062,   6028,   -695,  -5687 },
+  {   1836,   3566,  -1357,  -5226 },
+  {  -2176,   4938,    646,  -3872 },
+  {  -2199,   3055,   -208,  -6124 },
+  {   -236,   3032,   -821,  -5325 },
+  {  -3989,   7277,   -565,  -3899 },
+  {   -595,   4362,     74,  -5975 },
+  {    684,   5874,   -841,  -4424 },
+  {  -2731,   6305,  -2389,  -5465 },
+  {  -5775,   1325,    -56,  -2528 },
+  {  -7029,   -534,  -1890,  -3278 },
+  {  -5798,    -15,  -2734,  -2210 },
+  {  -5504,  -1198,   -353,  -3659 },
+  {  -5079,    960,   -894,  -4336 },
+  {  -6073,    -36,   -133,  -3014 },
+  {  -5782,   -259,  -1025,  -3986 },
+  {  -6843,   1262,   -807,  -1639 },
+  {  -5263,   -918,  -3290,   -579 },
+  {  -4840,    461,  -2158,   -533 },
+  {  -6014,    -50,   -620,    504 },
+  {  -5843,    241,  -1359,   -282 },
+  {  -5898,    577,    769,  -3271 },
+  {  -6833,   -946,   -466,  -3347 },
+  {  -6026,   1459,   -512,   -729 },
+  {  -7361,    747,   -388,  -1110 },
+  {  -6391,   2142,  -1160,  -2513 },
+  {  -6995,    304,    498,  -2673 },
+  {  -6757,    679,   -386,   -433 },
+  {  -5222,   1688,  -1093,  -1032 },
+  {  -5019,    575,    184,  -3627 },
+  {  -4237,    628,  -3507,  -1243 },
+  {  -7479,   -456,  -1722,  -1486 },
+  {  -6464,    713,  -1273,  -1153 },
+  {  -6255,   1682,   -606,  -3607 },
+  {  -7033,   1497,    -71,  -1955 },
+  {  -6694,   1556,  -1721,  -3214 },
+  {  -6114,   -356,    813,  -2575 },
+  {  -5308,    632,  -1851,  -1636 },
+  {  -5742,   -911,  -1733,    383 },
+  {  -6083,   -387,  -2313,   -879 },
+  {  -6535,   -530,  -1505,  -2083 },
+  {  -4896,   1223,  -2750,  -1816 },
+  {  -6392,   -463,  -3247,  -2093 },
+  {  -5373,   1264,  -2706,  -3042 },
+  {  -3894,  -1390,  -1020,   -891 },
+  {  -6179,   1168,  -1966,  -1922 },
+  {  -5162,   1668,  -1617,  -1916 },
+  {  -6453,    920,  -1169,  -2432 },
+  {  -6130,   2005,   -536,  -1519 },
+  {  -6552,    -98,   -518,  -1938 },
+  {  -7528,    355,  -1101,  -1772 },
+  {  -5745,    610,   -247,  -1360 },
+  {  -7003,    177,  -2064,  -1958 },
+  {  -6956,   -570,  -2220,  -4225 },
+  {  -7830,    791,  -1394,  -2774 },
+  {  -7634,    480,  -3171,  -4224 },
+  {  -7913,   1154,   -350,  -2381 },
+  {  -5063,   1704,  -1804,  -2977 },
+  {  -4887,   -524,  -2703,    188 },
+  {  -5551,    406,  -1620,  -3063 },
+  {  -7109,   1342,    381,  -3021 },
+  {  -6846,    631,   -458,  -3398 },
+  {  -4606,   -605,     11,  -3930 },
+  {  -8134,   -225,  -1738,  -2648 },
+  {  -7043,    402,  -2734,  -3059 },
+  {  -7417,   1825,  -2545,  -4389 },
+  {  -6971,   -236,  -1031,   -665 },
+  {  -5752,   2111,  -1632,  -3808 },
+  {  -7660,    -78,   -624,  -3135 },
+  {  -6358,    619,  -1951,  -3911 },
+  {  -8134,    408,  -1935,  -3695 },
+  {  -6335,   1911,  -2368,  -4505 },
+  {  -7116,   2163,   -344,  -2753 },
+  {   2357,   4488,   2220,  -5682 },
+  {   1385,   3206,   2300,  -5305 },
+  {   1419,   2557,   5203,  -3516 },
+  {    262,   4315,   3920,  -1847 },
+  {   3316,   3187,   1612,  -5609 },
+  {   1729,   2350,   1673,  -6068 },
+  {   1603,   6126,   1467,  -2839 },
+  {  -1339,   3316,   3691,  -3530 },
+  {   -563,   4618,   3180,  -4548 },
+  {    463,   4624,   3111,  -5614 },
+  {   1246,   5455,   3356,  -5720 },
+  {    480,   2149,   5422,  -2893 },
+  {   1768,   4827,    913,  -5579 },
+  {   -149,   5381,   4366,  -3297 },
+  {    985,   3672,   2644,    -92 },
+  {   -258,   2911,   5817,  -2213 },
+  {   3428,   3289,   3351,  -3541 },
+  {   -666,   3295,   4727,  -2869 },
+  {     35,   6641,   4160,  -4052 },
+  {    623,   6787,   3156,  -4560 },
+  {   2654,   4360,   4676,  -4632 },
+  {   1386,   5246,   4834,  -4497 },
+  {   3488,   4574,   3856,  -5946 },
+  {    383,   4481,   4168,  -4110 },
+  {   1753,   3652,   4288,  -3326 },
+  {   1344,   4905,   2508,  -4660 },
+  {   1580,   4106,   3104,  -2224 },
+  {   2027,   5038,   1683,  -1554 },
+  {    446,   3699,   5872,  -3013 },
+  {   4637,   4087,   3578,  -5018 },
+  {   2629,   3560,   5331,  -4900 },
+  {   1527,   6674,   2523,  -4131 },
+  {  -1437,   2804,   2528,  -4464 },
+  {   -229,   3355,   2016,  -5537 },
+  {   3666,   3418,   4374,  -4581 },
+  {   1192,   3799,    923,  -6596 },
+  {   2040,   2956,    448,  -5322 },
+  {   2468,   5768,   4029,  -5869 },
+  {   3438,   6516,   3529,  -6667 },
+  {   2737,   5495,    680,  -5535 },
+  {   3896,   5727,   1801,  -4958 },
+  {   4988,   4957,   3592,  -6518 },
+  {   -542,   4416,   5794,  -2787 },
+  {   4136,   4354,   2064,  -4696 },
+  {   3067,   5936,   1207,  -3396 },
+  {   2789,   4966,   2405,  -3854 },
+  {   1731,   3270,   3251,  -1063 },
+  {   1767,   5537,   2084,  -2349 },
+  {    465,   3116,   4532,   -837 },
+  {   1499,   2627,   4610,  -2212 },
+  {    122,   3095,   3642,  -3552 },
+  {   2542,   2866,   2705,  -6402 },
+  {   3134,   4323,    698,  -4785 },
+  {    731,   1859,   3112,  -5242 },
+  {   2553,   2980,   3241,  -4846 },
+  {   1329,   5310,   1607,  -6624 },
+  {   2468,   1858,   3476,  -1034 },
+  {   -172,   4996,   2000,  -5562 },
+  {   2621,   4220,   1574,  -3386 },
+  {   -333,   1832,   3362,  -4117 },
+  {   2169,   6762,   3065,  -6225 },
+  {   2844,   5528,   3223,  -4765 },
+  {    526,   5175,   1644,  -4267 },
+  {   2922,   4426,   2414,  -2610 },
+  {    452,   1399,  -4516,  -2636 },
+  {   2872,   1720,  -4667,  -1435 },
+  {   1279,    702,  -5424,  -1984 },
+  {   2187,    870,  -5021,  -1341 },
+  {    583,   -144,  -4628,  -2464 },
+  {      3,   2237,  -5284,  -2827 },
+  {    -19,   1005,  -5460,  -1819 },
+  {   2897,   2084,  -5885,   -515 },
+  {   -400,   3370,  -5527,  -2947 },
+  {   1505,   2593,  -5518,  -1802 },
+  {   1341,   4534,  -5094,  -1899 },
+  {   3241,   3670,  -5493,  -1252 },
+  {  -1287,    921,  -5994,  -1675 },
+  {    627,    408,  -6652,   -364 },
+  {   -260,   1127,  -4849,  -3247 },
+  {    371,   3400,  -5976,  -2285 },
+  {   1533,   1566,  -6373,   -610 },
+  {   2462,   4274,  -6184,  -1254 },
+  {   1782,   3363,  -6222,  -1381 },
+  {    572,   4650,  -5673,  -2754 },
+  {   2674,   3414,  -4460,  -2154 },
+  {   3614,   3820,  -6883,   -398 },
+  {   1136,     -1,  -5511,  -1112 },
+  {  -1773,   1137,  -5647,  -2377 },
+  {   -753,   2104,  -6085,  -2565 },
+  {   -204,   3025,  -4731,  -1418 },
+  {  -1486,   1438,  -4380,   -216 },
+  {    302,    858,  -5786,   -264 },
+  {   3486,   1495,  -5234,   -783 },
+  {    888,   2327,  -3423,  -3720 },
+  {   -259,    772,  -6596,  -1311 },
+  {  -1197,   2073,  -5174,  -1826 },
+  {   1500,   3470,  -4462,  -2645 },
+  {   3072,   1960,  -3277,  -2264 },
+  {   1841,    952,  -4324,  -2340 },
+  {   1994,   2200,  -3940,  -2923 },
+  {  -1782,   1699,  -4667,  -1075 },
+  {  -1464,   2906,  -3468,   -375 },
+  {    366,   2380,  -3747,   1467 },
+  {   -545,   1645,  -4619,    376 },
+  {   1724,   2350,  -2374,  -3512 },
+  {   3184,   2628,  -2996,  -3275 },
+  {    734,   2010,  -6239,  -1479 },
+  {    524,   3756,  -4496,  -3263 },
+  {   1492,   3570,  -3494,  -3600 },
+  {   -932,    618,  -5389,  -2894 },
+  {   -133,   2161,  -4083,  -3267 },
+  {    786,    774,  -3279,  -3731 },
+  {   1078,    803,  -3843,  -3007 },
+  {   -332,   3405,  -3347,     40 },
+  {    -17,      6,  -4005,  -3690 },
+  {   -189,   4372,  -4488,  -2561 },
+  {   -450,   3846,  -3790,  -1370 },
+  {    362,   2212,  -5272,    -15 },
+  {  -1529,    791,  -6802,  -2296 },
+  {   2145,   4241,  -4474,    376 },
+  {   1813,   2426,  -2932,  -2726 },
+  {   -542,   4557,  -3140,  -1080 },
+  {   1192,   3784,  -4371,    -20 },
+  {   2784,   5188,  -6399,  -1394 },
+  {    431,   4561,  -3673,  -1398 },
+  {   1382,   3096,  -4083,   1253 },
+  {   1209,   4224,  -2930,   1500 },
+  {   2798,   2684,  -6676,   -606 },
+  {  -2396,   1510,  -5381,  -2713 },
+  {  -2625,   2542,  -4032,  -2880 },
+  {  -1231,   3967,  -4098,  -2886 },
+  {  -1393,   2374,  -3862,  -4525 },
+  {  -2495,   1665,  -1637,  -5445 },
+  {  -3854,   1759,  -1750,  -4944 },
+  {  -2373,   1668,  -2856,  -6251 },
+  {  -2668,   1981,   -886,  -4557 },
+  {  -2927,   4427,  -3451,  -6172 },
+  {  -1925,   2596,  -4696,  -2527 },
+  {  -3202,   2847,  -3928,  -5896 },
+  {  -3332,   1665,  -5025,  -3412 },
+  {  -3212,   3115,  -4155,  -4062 },
+  {  -1013,   3205,  -5133,  -3751 },
+  {  -2022,   4595,  -3947,  -5611 },
+  {  -3556,   1755,  -3715,  -2300 },
+  {  -1784,   4114,  -2723,  -1773 },
+  {  -3586,   4081,  -2733,  -4942 },
+  {  -1608,   3685,  -4154,  -4573 },
+  {  -3368,   4042,  -4452,  -6227 },
+  {  -1407,   3881,  -5729,  -3719 },
+  {  -2751,   3281,  -5077,  -4999 },
+  {  -3791,   2410,  -4906,  -5288 },
+  {   -730,   2303,  -4217,  -3755 },
+  {  -1812,   2311,  -5492,  -3709 },
+  {   -610,   4336,  -3915,  -3783 },
+  {  -2841,   4337,  -4278,  -4430 },
+  {  -1662,   4666,  -4661,  -3964 },
+  {   -589,   5209,  -4923,  -3682 },
+  {  -4155,   2234,  -4076,  -4218 },
+  {  -3951,   2770,  -2665,  -2805 },
+  {  -2302,   3228,  -3717,  -1908 },
+  {  -3129,   4373,  -2264,  -2851 },
+  {   -447,   1363,  -3578,  -4323 },
+  {  -2648,   4237,  -3159,  -3071 },
+  {  -4072,   3241,  -3541,  -4605 },
+  {  -4507,   3458,  -2339,  -3838 },
+  {  -1646,    997,  -4926,  -3970 },
+  {  -3025,   1614,  -3940,  -1242 },
+  {  -1337,   1756,  -3163,  -5529 },
+  {  -3203,   1865,  -3282,  -4354 },
+  {  -1646,   2118,  -2203,  -6018 },
+  {    174,   1871,  -2707,  -4639 },
+  {  -2607,   1485,  -4778,  -4750 },
+  {  -2199,   3991,  -3134,  -4879 },
+  {  -2962,   3323,  -2816,  -2419 },
+  {  -5286,   2495,  -4548,  -5395 },
+  {  -2810,   3710,  -2274,  -4211 },
+  {   -330,   3006,  -2993,  -4678 },
+  {  -1187,   2411,  -2743,  -5196 },
+  {   -664,   4033,  -3101,  -5641 },
+  {  -1458,   3602,  -2816,  -5371 },
+  {  -4116,   4923,  -3321,  -5630 },
+  {  -4165,   2528,  -2592,  -4798 },
+  {  -2759,   3080,  -2333,  -5719 },
+  {  -5157,   3011,  -5526,  -6348 },
+  {  -3095,   2126,  -5881,  -4234 },
+  {  -4377,   3849,  -3600,  -6099 },
+  {  -1994,   4947,  -5235,  -4753 },
+  {  -1067,    600,  -3258,  -5133 },
+  {  -4992,   3302,  -2208,  -5051 },
+  {  -3377,   2981,  -1655,  -4815 },
+  {  -3325,   2446,  -1787,  -6116 },
+  {  -2341,   2737,  -3240,  -6347 },
+  {  -2258,  -3732,   3710,  -1235 },
+  {  -1558,  -3849,   2694,  -3012 },
+  {   -599,  -4837,   3050,  -2951 },
+  {  -2246,  -5433,   2798,  -1910 },
+  {  -2255,  -4989,   3260,    270 },
+  {  -3026,  -5353,   2693,  -1036 },
+  {  -1151,  -6097,   1097,  -3782 },
+  {  -3391,  -6012,   2130,  -1303 },
+  {  -2850,  -4422,   3375,   -480 },
+  {  -1138,  -3779,   1491,  -4162 },
+  {   -551,  -3892,   3787,  -2082 },
+  {  -3221,  -3676,   3144,  -1202 },
+  {  -3023,  -5196,   2650,    605 },
+  {  -1756,  -5729,   2646,    321 },
+  {  -2693,  -4409,    494,  -4797 },
+  {  -1913,  -4573,   3372,  -1730 },
+  {  -1277,  -3604,   4061,   -993 },
+  {   -420,  -4993,   1351,  -4796 },
+  {  -3052,  -5333,   1435,  -1242 },
+  {   -602,  -5034,   3869,  -1141 },
+  {  -2436,  -4680,   1665,  -3019 },
+  {  -2657,  -3658,   1459,  -3391 },
+  {  -1220,  -6246,   2749,   -525 },
+  {  -3838,  -4844,   2265,  -1735 },
+  {  -1247,  -5679,   3356,  -1417 },
+  {   -917,  -5448,   3342,    105 },
+  {  -1756,  -6839,   2276,  -2350 },
+  {   -412,  -5206,   1764,  -3539 },
+  {  -1439,  -6915,   1442,  -3750 },
+  {  -1381,  -4439,   3863,   -282 },
+  {  -3482,  -4953,   2726,   -336 },
+  {  -1376,  -5931,   1714,  -1987 },
+  {  -1716,  -4405,   2608,    105 },
+  {  -1590,  -5191,   2652,  -2704 },
+  {  -2149,  -6442,   2453,  -1263 },
+  {  -3426,  -3832,   2334,  -1829 },
+  {  -2747,  -5948,   2362,   -173 },
+  {  -2435,  -3267,   2966,  -1710 },
+  {  -3979,  -4282,   2705,   -775 },
+  {   -356,  -4238,   2544,  -4343 },
+  {  -1363,  -6471,   2817,  -1836 },
+  {  -2878,  -5117,    218,  -3149 },
+  {  -3539,  -5196,   1710,  -2356 },
+  {  -2888,  -4537,   2746,  -1701 },
+  {  -1870,  -4439,   1496,  -4121 },
+  {  -1486,  -3388,   3349,  -2145 },
+  {  -3333,  -4138,   1467,  -2876 },
+  {   -345,  -5340,   1012,  -1190 },
+  {  -1672,  -4992,   2289,  -1029 },
+  {  -2146,  -5528,   3038,   -635 },
+  {   -316,  -3656,   3426,  -3152 },
+  {  -2695,  -5812,   2336,  -2050 },
+  {  -2067,  -6052,    737,  -3258 },
+  {  -2664,  -4205,   -350,  -1266 },
+  {   -617,  -5406,     80,  -4853 },
+  {  -2418,  -3825,   1853,  -1326 },
+  {  -1961,  -4339,    583,  -4315 },
+  {  -1495,  -5141,   -133,  -5205 },
+  {  -3208,  -6440,   1691,  -2069 },
+  {  -2632,  -3633,   2325,  -2761 },
+  {  -2624,  -5670,   1252,  -3676 },
+  {  -3687,  -5608,    687,  -2833 },
+  {  -3320,  -5707,     16,  -3877 },
+  {  -2738,  -6112,     84,  -5135 },
+  {   2277,  -5661,   3076,    843 },
+  {   1555,  -5769,   2821,  -5236 },
+  {    536,  -6381,    603,  -4910 },
+  {    734,  -4609,   3314,  -4092 },
+  {   1836,  -4547,   3267,  -4322 },
+  {    -13,  -5976,   3752,  -1607 },
+  {   1423,  -6318,   2336,    398 },
+  {    365,  -7779,   1498,   -534 },
+  {   2104,  -8366,   2946,  -1345 },
+  {    143,  -5545,   1898,  -3756 },
+  {    655,  -6852,   1430,    148 },
+  {      4,  -6653,   2397,    -59 },
+  {   2346,  -5996,   4562,   -934 },
+  {   1229,  -7104,   2963,   -598 },
+  {   -528,  -7048,   2887,  -1790 },
+  {   1451,  -6857,   3900,  -1637 },
+  {    554,  -6018,   3336,      9 },
+  {   3278,  -5758,   4034,    129 },
+  {   3541,  -7145,   4905,  -1575 },
+  {   2339,  -6907,   3464,   -301 },
+  {   2775,  -7301,   1667,  -3894 },
+  {    539,  -7887,    991,  -4156 },
+  {   2115,  -7421,   3131,  -3075 },
+  {   2803,  -8546,   2564,  -5836 },
+  {   2869,  -5833,   1620,  -4561 },
+  {   2591,  -7281,   3215,  -4719 },
+  {  -1228,  -8477,    706,  -4782 },
+  {   1967,  -5243,   4813,  -1940 },
+  {    701,  -7010,   2273,  -3893 },
+  {    915,  -8470,   1918,  -5620 },
+  {    -94,  -6715,    156,  -3873 },
+  {   1074,  -5607,   4389,  -1017 },
+  {   2739,  -6551,   1227,  -3521 },
+  {    725,  -7835,   2701,  -1291 },
+  {   -493,  -7475,   2263,  -1075 },
+  {   -412,  -6508,   2984,   -744 },
+  {    665,  -5451,   3725,  -2692 },
+  {   1499,  -8129,   3564,  -2072 },
+  {   2870,  -6333,   4487,  -2108 },
+  {    706,  -5007,   3911,   -152 },
+  {   -482,  -8660,   1483,  -2900 },
+  {   2481,  -6596,   2518,  -1715 },
+  {   1403,  -6414,   1398,  -5387 },
+  {    652,  -6267,    583,  -5942 },
+  {    694,  -7540,    646,  -6272 },
+  {   2275,  -7614,    256,  -5015 },
+  {   1416,  -9727,   1900,  -3153 },
+  {   2760,  -6433,   3875,  -3771 },
+  {   2325, -11196,   2182,  -5155 },
+  {   1223, -11061,   1377,  -5097 },
+  {    108, -10603,    307,  -4952 },
+  {   -118,  -8268,   1650,  -1572 },
+  {   1839,  -7943,   1755,   -612 },
+  {   2501,  -9056,    981,  -2969 },
+  {   2902,  -8476,   1491,  -5780 },
+  {   1995, -11175,   1585,  -3643 },
+  {    696,  -8212,    828,  -2474 },
+  {   1526,  -8649,   1380,  -1210 },
+  {    461,  -7253,   3222,  -2229 },
+  {   2966,  -8641,   4121,  -3271 },
+  {    833,  -6039,   2361,  -1086 },
+  {   3565,  -7312,   1980,  -5427 },
+  {   2850,  -8671,   3760,  -1846 },
+  {   2643,  -7281,   2163,   -173 },
+  {   3463,  -3706,  -3132,   -923 },
+  {   1315,  -3825,  -3443,      2 },
+  {   2594,  -4083,  -3815,    670 },
+  {   1826,  -4291,  -2741,   -155 },
+  {    868,  -3749,  -4175,   -298 },
+  {   2008,  -4237,  -3897,   -517 },
+  {   1242,  -3493,  -4335,  -1335 },
+  {    -88,  -4142,  -3390,  -1529 },
+  {   2176,  -3488,  -3822,   -975 },
+  {   1706,  -5188,  -3415,   -637 },
+  {   2717,  -6159,  -2333,   -882 },
+  {   1276,  -3978,  -4361,    537 },
+  {   2471,  -5556,  -2866,   -208 },
+  {    799,  -4673,  -4086,     56 },
+  {   1901,  -4786,  -3533,    270 },
+  {   3036,  -3902,  -3606,   -333 },
+  {   2249,  -3317,  -4319,   -144 },
+  {   2594,  -4207,  -2105,  -2930 },
+  {   4008,  -4774,  -2626,   -902 },
+  {   1038,  -3659,  -3496,  -2454 },
+  {   2725,  -3597,  -3298,  -1535 },
+  {   1662,  -5803,  -2813,    175 },
+  {    705,  -3757,  -3441,  -1484 },
+  {   1860,  -5987,  -2821,   -886 },
+  {   3786,  -4918,  -2199,  -1929 },
+  {   3683,  -4235,  -2547,  -1287 },
+  {   2531,  -4896,  -2956,  -1593 },
+  {   1005,  -5585,  -3324,   -180 },
+  {   1625,  -5229,  -1756,  -3642 },
+  {   1494,  -5041,  -2989,  -2685 },
+  {   2718,  -4655,  -3224,   -867 },
+  {   2374,  -6640,  -1745,  -2975 },
+  {   2133,  -6436,  -2477,  -1499 },
+  {   1833,  -4418,  -3523,  -1512 },
+  {   1128,  -4910,  -2658,  -1106 },
+  {    689,  -4777,  -2831,  -2085 },
+  {   3593,  -5280,  -2627,   -315 },
+  {   3264,  -3771,  -2673,  -1861 },
+  {   3202,  -5602,  -2409,    402 },
+  {    552,  -4618,  -2221,  -3002 },
+  {   3095,  -5356,  -2666,  -1083 },
+  {   3401,  -4609,  -3146,     45 },
+  {   3051,  -4662,  -2192,  -2232 },
+  {   2798,  -5552,  -2462,  -1941 },
+  {   2354,  -5815,  -2223,  -2619 },
+  {    192,  -3708,  -2807,  -2658 },
+  {   1886,  -4226,  -1862,  -3529 },
+  {   2526,  -3976,  -2819,  -2332 },
+  {   1577,  -3870,  -2711,  -2806 },
+  {   1288,  -5588,  -3382,  -1403 },
+  {   2711,  -5399,  -1564,  -3253 },
+  {   1459,  -5492,  -2222,   -322 },
+  {   2823,  -5091,  -2886,    776 },
+  {   3559,  -5821,  -2109,  -1360 },
+  {   1587,  -6331,  -2760,  -1909 },
+  {   2139,  -5213,  -2874,  -2120 },
+  {   1318,  -4337,  -3695,  -2098 },
+  {    821,  -4471,  -1849,   -565 },
+  {   3329,  -4782,  -1725,    -89 },
+  {    582,  -4914,  -4105,  -1119 },
+  {    417,  -4144,  -4072,  -2529 },
+  {   -199,  -3803,  -2765,  -4042 },
+  {   2731,  -4283,  -2143,      1 },
+  {   2911,  -6187,  -1951,  -2116 },
+  {   1573,  -6094,   -493,  -2838 },
+  {   2081,  -6927,   -864,  -3211 },
+  {   1058,  -7826,     79,   -364 },
+  {   3147,  -5570,   -684,   -978 },
+  {   3572,  -5856,   1060,   1824 },
+  {   1143,  -6702,  -1478,    338 },
+  {   2341,  -7220,    -88,    260 },
+  {   3639,  -6861,    668,    815 },
+  {   2227,  -6268,  -1706,    446 },
+  {   3390,  -6082,   -353,   1302 },
+  {   1123,  -7556,  -1237,   -430 },
+  {   1729,  -7742,    729,   -218 },
+  {   1457,  -6774,    587,    579 },
+  {    505,  -6919,   -569,    371 },
+  {   1106,  -7245,     78,    158 },
+  {   2755,  -6745,  -1122,    338 },
+  {   3069,  -6040,  -1415,    986 },
+  {   2174,  -7064,  -1430,   -283 },
+  {   1390,  -8626,   -446,  -3031 },
+  {   3534,  -6890,   -431,    547 },
+  {   2267,  -9618,    475,  -2994 },
+  {   3672,  -7673,     75,   -115 },
+  {   2131,  -7560,  -1206,   -750 },
+  {   2972,  -7477,   -685,   -262 },
+  {   1604,  -6637,   -672,    699 },
+  {   1666,  -7577,   -577,   -240 },
+  {   1591,  -6554,  -2158,    -94 },
+  {   2348,  -6286,   -353,   1123 },
+  {   2017,  -8810,   -412,  -1805 },
+  {   2892,  -6713,  -1765,   -554 },
+  {   2500,  -6828,  -1995,  -1197 },
+  {   3877,  -6639,   -224,  -1655 },
+  {   2392,  -7872,    -91,   -333 },
+  {   3562,  -7370,   -532,  -2836 },
+  {   2552,  -7614,    164,  -1805 },
+  {    990,  -6104,    218,    438 },
+  {    910,  -7861,    312,  -1195 },
+  {   1472,  -6327,    372,   -640 },
+  {   1576,  -7143,  -1983,   -843 },
+  {    422,  -7625,   -457,   -278 },
+  {   1797,  -8532,    405,  -1011 },
+  {   1088,  -7396,   -238,  -2277 },
+  {   3209,  -6753,  -1431,  -2072 },
+  {   2617,  -6839,    100,  -2573 },
+  {   2575,  -8573,   -387,  -3188 },
+  {   3618,  -6971,  -1190,   -321 },
+  {   2205,  -7361,  -1695,  -2008 },
+  {   2985,  -6297,   1464,   1179 },
+  {   2804,  -7310,   1053,    338 },
+  {   1362,  -6074,  -1163,   -840 },
+  {   3336,  -6325,  -1794,     21 },
+  {   2836,  -8109,    818,   -329 },
+  {   2791,  -5879,    560,   1546 },
+  {   2392,  -6064,    135,    100 },
+  {   1838,  -6194,    596,   1085 },
+  {   1926,  -7515,   -414,  -4901 },
+  {   3225,  -7298,  -1202,  -1189 },
+  {   3960,  -7558,   -659,   -719 },
+  {   3442,  -6647,  -1692,  -1095 },
+  {   3381,  -6441,    262,   -886 },
+  {   1431,  -8150,  -1186,  -1406 },
+  {    340,  -8498,   -150,   -899 },
+  {   3004,  -8149,   -260,   -953 },
+  {   2749,  -6611,    563,    873 },
+  {  -6647,  -1325,  -4517,  -4691 },
+  {  -6005,  -1657,  -4089,  -3797 },
+  {  -3157,    588,  -5213,  -3068 },
+  {  -3311,  -1425,  -6329,  -3726 },
+  {  -5866,   -819,  -3857,  -2744 },
+  {  -5001,  -1799,  -1075,  -4621 },
+  {  -5330,  -2650,  -2672,  -4664 },
+  {  -4930,   -539,  -2363,  -4010 },
+  {  -2984,     10,  -3863,  -5749 },
+  {  -1055,  -2106,  -3713,  -4267 },
+  {  -5476,   -502,  -4279,  -6504 },
+  {  -5231,  -1543,  -5018,  -6425 },
+  {  -5134,   -363,  -3165,  -5109 },
+  {  -3953,   -771,  -4107,  -6393 },
+  {  -2159,   -563,  -3652,  -5342 },
+  {  -3888,  -2321,   -919,  -5057 },
+  {  -1236,   -597,  -4235,  -4193 },
+  {  -4053,    675,  -3083,  -6174 },
+  {  -2793,  -1089,  -5396,  -3460 },
+  {  -3000,    -44,  -2209,  -6575 },
+  {  -3336,  -1531,  -4313,  -5160 },
+  {  -2127,    128,  -4851,  -3692 },
+  {  -3321,    136,  -2067,  -5660 },
+  {  -5215,   1404,  -4374,  -4356 },
+  {  -2747,    400,  -6340,  -3691 },
+  {  -3926,   -599,  -5361,  -5006 },
+  {  -2875,  -2592,  -5143,  -4092 },
+  {  -4991,  -1958,  -5322,  -4891 },
+  {  -4965,  -1318,  -6652,  -5333 },
+  {  -4920,  -1691,  -3388,  -5561 },
+  {  -3644,  -3354,  -2688,  -5982 },
+  {  -5076,   -919,  -4563,  -2984 },
+  {  -6114,    250,  -3884,  -3915 },
+  {  -4014,    744,  -3973,  -1924 },
+  {  -5543,  -1041,  -5557,  -3847 },
+  {  -4711,  -1352,  -5649,  -2603 },
+  {  -3362,    775,  -5305,  -4879 },
+  {  -5001,    107,  -3554,  -2888 },
+  {  -6258,  -1651,  -6356,  -6566 },
+  {  -4529,    407,  -5003,  -3865 },
+  {  -5154,    550,  -5278,  -5465 },
+  {  -4195,   -467,  -1894,  -3129 },
+  {  -5022,   1127,  -3349,  -3314 },
+  {  -6075,   1250,  -4313,  -5641 },
+  {  -2677,  -2283,  -2312,  -5903 },
+  {  -4113,    193,  -1195,  -4833 },
+  {  -3940,  -1048,  -1389,  -5079 },
+  {  -3703,    917,  -4043,  -4451 },
+  {  -3366,  -4231,  -1534,  -5488 },
+  {  -3326,  -3583,  -2091,  -4903 },
+  {  -5144,   1254,  -2532,  -4949 },
+  {  -5982,   -870,  -2545,  -4555 },
+  {  -3925,   -157,  -5367,  -2281 },
+  {  -6419,   -746,  -5668,  -4371 },
+  {  -5787,    518,  -7096,  -5805 },
+  {  -4258,    954,  -6453,  -4321 },
+  {  -4771,   -695,  -4158,  -1639 },
+  {  -7078,   -760,  -5195,  -5877 },
+  {  -7348,     83,  -4101,  -4586 },
+  {  -2430,    184,  -2874,  -1679 },
+  {  -2284,  -3943,  -2924,  -5034 },
+  {  -1804,  -1785,  -3002,  -4710 },
+  {  -4399,  -2772,  -1815,  -4637 },
+  {  -6340,  -2626,  -2824,  -5191 },
+  {  -4998,  -5168,  -3480,   1905 },
+  {  -3958,  -5492,  -1599,   1579 },
+  {  -2471,  -3755,   -276,   3182 },
+  {  -3033,  -5779,  -1063,   1554 },
+  {  -2936,  -4829,  -1290,   2386 },
+  {  -1835,  -5073,  -3051,   1299 },
+  {  -1724,  -3771,  -3935,   2324 },
+  {  -5070,  -2550,  -3692,    768 },
+  {  -4326,  -5333,   -297,   1878 },
+  {  -3472,  -5619,  -3094,    992 },
+  {  -3027,  -4384,  -3038,   2265 },
+  {  -3201,  -5332,     67,   2200 },
+  {  -1681,  -4373,  -1947,   2461 },
+  {  -3221,  -3329,  -4238,   2564 },
+  {  -1262,  -2968,  -2915,   3227 },
+  {  -3419,  -1878,  -3373,   2110 },
+  {  -2244,  -5583,  -2012,   1288 },
+  {  -1971,  -5266,   -990,   1812 },
+  {  -2975,  -2778,   -452,   4063 },
+  {  -2198,  -1165,  -3298,   2965 },
+  {  -4782,  -4894,  -4767,    664 },
+  {  -6002,  -3950,  -2806,   2025 },
+  {  -3142,  -3162,  -2859,   3295 },
+  {  -3262,  -3340,  -4123,   1596 },
+  {  -4014,  -3918,  -1955,   3361 },
+  {  -1700,  -3463,  -1346,   3449 },
+  {  -4245,  -4445,  -4743,   1644 },
+  {  -4180,  -3969,   -401,   3281 },
+  {  -2782,  -5240,  -4117,   1156 },
+  {  -5744,  -4040,  -1439,   3470 },
+  {  -5063,  -4663,   -323,   3172 },
+  {  -4531,  -3319,   -844,   3988 },
+  {  -6226,  -5125,  -2064,   2976 },
+  {  -3115,  -3267,  -1531,   3898 },
+  {  -4628,  -4421,  -2864,   2808 },
+  {  -4559,  -2989,  -3442,   2024 },
+  {  -1775,  -4487,   -656,   2477 },
+  {  -2664,  -1865,  -1884,   4081 },
+  {  -1828,  -2575,  -3894,   3378 },
+  {  -6441,  -3677,  -2025,   1677 },
+  {  -4141,  -2156,  -1191,   3474 },
+  {  -4802,  -1623,  -1727,   2160 },
+  {  -5474,  -2745,  -1475,   2498 },
+  {  -3664,  -1056,  -1975,   2491 },
+  {  -4672,  -3062,  -2235,   2933 },
+  {  -4205,  -5960,  -2849,   1517 },
+  {  -4995,  -5708,  -1739,   1805 },
+  {  -4892,  -6080,  -4793,    872 },
+  {  -4270,  -4172,  -4263,   2185 },
+  {  -4687,  -1470,  -2905,   1023 },
+  {  -6446,  -5017,  -3919,   1000 },
+  {  -6046,  -5538,  -3943,   2006 },
+  {  -6028,  -3750,  -3953,    771 },
+  {  -5959,  -4582,  -5024,    824 },
+  {  -5818,  -2576,  -2249,   1326 },
+  {  -5659,  -5345,  -1119,   2500 },
+  {  -3346,  -4155,    606,   2749 },
+  {  -5680,  -4827,  -2501,   1838 },
+  {  -6193,  -2543,  -1295,    840 },
+  {  -6871,  -4925,  -3512,   1801 },
+  {  -5605,  -1788,  -1895,    779 },
+  {  -3922,  -5712,  -4644,    510 },
+  {  -4745,  -3869,  -4533,     99 },
+  {  -2984,  -4907,   -399,   1497 },
+  {   1847,   -478,   3061,  -5812 },
+  {   4450,  -1116,   3609,  -6570 },
+  {   3139,     99,   3007,  -5532 },
+  {   2590,  -3782,   3138,  -4770 },
+  {   1881,   1204,   5778,  -3404 },
+  {   3631,   2060,   5566,  -5038 },
+  {   3461,   1961,   5167,  -3800 },
+  {   2947,    273,   4536,  -4389 },
+  {   4453,  -1730,   5788,  -4370 },
+  {   4032,   1805,   2666,  -4534 },
+  {   3487,   -944,   2313,  -6028 },
+  {   1313,     34,   4210,  -4067 },
+  {   5632,  -1502,   5825,  -5855 },
+  {   7736,   -547,   4879,  -5476 },
+  {   4906,  -1512,   4760,  -5760 },
+  {   3843,    447,   1091,  -4958 },
+  {   2982,  -1135,   5442,  -4386 },
+  {   3579,    271,   3031,  -6770 },
+  {   3932,   -211,   4688,  -5507 },
+  {   4411,   1720,   2387,  -5584 },
+  {   5379,   -479,   4575,  -6280 },
+  {   3613,   -362,   2012,  -4885 },
+  {   3744,  -2013,   4493,  -5073 },
+  {   5693,    109,   4379,  -3362 },
+  {   5475,   -621,   5317,  -3985 },
+  {   6411,   -673,   5708,  -4752 },
+  {   4933,   -796,   7262,  -4290 },
+  {   2804,    444,   6276,  -3655 },
+  {   4120,   -517,   6078,  -4531 },
+  {   5119,    841,   3486,  -3910 },
+  {   4738,   1539,   3525,  -2970 },
+  {   5086,    370,   5895,  -5640 },
+  {   4235,   2716,   4589,  -5044 },
+  {   3691,    682,   6199,  -4700 },
+  {   6111,   -570,   6271,  -6528 },
+  {   2611,   1277,   3756,  -4802 },
+  {   4395,    970,   3807,  -5879 },
+  {   5225,   2299,   3242,  -4333 },
+  {   5144,   1778,   4946,  -5545 },
+  {   2989,  -3016,   3247,  -5495 },
+  {   2983,    920,   2071,  -6059 },
+  {   5270,   -903,   4434,  -2350 },
+  {   6415,   -585,   3970,  -3554 },
+  {   3866,   -197,   5216,  -2884 },
+  {   3767,  -1298,   6702,  -3315 },
+  {   6299,   2620,   5284,  -6824 },
+  {   6654,    646,   3653,  -4927 },
+  {   4770,   3047,   5160,  -6287 },
+  {   5364,    434,   2919,  -5207 },
+  {   2998,   1344,   4801,  -2456 },
+  {   3896,   1013,   3773,  -1864 },
+  {   2115,    655,   2999,  -6344 },
+  {   5170,   -981,   2849,  -4464 },
+  {   2735,  -2159,   2717,  -5776 },
+  {   2430,  -1952,   4392,  -4559 },
+  {   6143,  -1180,   3659,  -4746 },
+  {   4978,  -1483,   1726,  -4875 },
+  {   3486,  -2383,   3306,  -4301 },
+  {   1434,  -1372,   4171,  -4770 },
+  {   3354,  -2627,   1525,  -5093 },
+  {   6790,   2386,   3995,  -5909 },
+  {   1475,  -2674,   3451,  -4204 },
+  {   1999,  -3494,   3693,  -5556 },
+  {   4764,  -2848,   2856,  -5589 },
+  {  -3677,   5131,   2827,  -2934 },
+  {  -2844,   7078,   2852,  -3580 },
+  {  -3902,   6434,   4118,  -1911 },
+  {  -1769,   7530,   3492,  -3541 },
+  {  -1937,   5679,   -447,  -1127 },
+  {  -2456,   4680,   4196,  -2407 },
+  {  -2778,   8241,   1698,  -4288 },
+  {  -2876,   6104,   5182,  -2387 },
+  {  -2802,   7341,   4463,  -2938 },
+  {  -1025,   6267,   4752,  -3201 },
+  {  -2349,   5413,   2041,  -3794 },
+  {  -2252,   8225,   2856,  -4269 },
+  {  -1465,   4967,   4976,  -2500 },
+  {   -636,   7565,   3517,  -4233 },
+  {  -1905,   5618,   3904,  -2942 },
+  {   -302,   6816,   3343,  -3316 },
+  {  -2210,   4156,   2817,  -3511 },
+  {   -717,   6568,   1863,  -2951 },
+  {  -3873,   5682,   2164,   -575 },
+  {  -2878,   5835,    440,  -2597 },
+  {  -3228,   7701,   2610,  -2514 },
+  {  -3608,   8888,   3377,  -2468 },
+  {  -2582,   9717,   2519,  -3126 },
+  {  -5238,   6202,   2866,  -2831 },
+  {  -3428,   7370,   3056,   -335 },
+  {  -1681,   8836,   1210,  -2010 },
+  {  -3276,   6724,   1156,  -3930 },
+  {   -894,   8149,    827,  -1258 },
+  {  -2965,   8631,   2549,  -1320 },
+  {  -3961,   6902,   3581,     55 },
+  {  -1894,   7745,   1750,   -841 },
+  {   -821,   6844,    850,   -676 },
+  {   -608,   6948,     -4,  -1376 },
+  {    615,   6524,   1089,  -1147 },
+  {  -2972,   5668,   1091,   -489 },
+  {   -157,   4649,   2904,   -413 },
+  {    673,   5121,   1498,    -66 },
+  {   -390,   5902,   1611,   -245 },
+  {  -2349,   5478,   4772,  -1320 },
+  {     88,   6798,   1972,  -1859 },
+  {  -1213,   5120,   2991,    200 },
+  {  -2347,   6040,   2839,    376 },
+  {   -578,   5976,   3364,  -1796 },
+  {  -1391,   5872,   3002,   -965 },
+  {   -564,   4496,   3946,  -1186 },
+  {  -2299,   6386,   3135,  -2176 },
+  {  -2131,   5641,   2011,   1223 },
+  {   -772,   5807,   1124,    895 },
+  {  -2837,   6758,   2297,   -740 },
+  {  -3091,   6298,   1415,  -2126 },
+  {  -4197,   6036,   1843,  -3022 },
+  {    -41,   6459,     92,    344 },
+  {  -2241,   6860,   2095,  -4396 },
+  {  -1931,   7088,   2117,  -2135 },
+  {  -2375,   4422,   1688,  -3169 },
+  {  -1742,   6674,   1538,   -119 },
+  {  -4818,   7749,   4192,  -1577 },
+  {  -2004,   5672,    193,   -430 },
+  {  -3825,   6042,   2128,  -1898 },
+  {  -1108,   8033,   2119,  -3013 },
+  {  -2370,   5453,   1721,    266 },
+  {  -1570,   7134,    614,  -2638 },
+  {  -1519,   8752,   3503,  -4330 },
+  {  -2050,   3845,   2907,  -1126 },
+  {   5085,   4412,   -335,  -1923 },
+  {   3618,   1423,   -613,  -4012 },
+  {   4481,   3729,    589,  -4631 },
+  {   4270,   3216,  -1763,  -3168 },
+  {   4241,   1796,  -1701,  -2796 },
+  {   4787,   2338,   -487,  -3639 },
+  {   2915,   3429,   -621,  -4753 },
+  {   5175,   1660,  -1265,  -3223 },
+  {   4280,   4057,   -684,  -4079 },
+  {   4980,   4419,  -1455,  -2719 },
+  {   5436,   2464,    387,  -4197 },
+  {   4507,   4018,   1121,  -3314 },
+  {   6020,   2401,   -413,  -3201 },
+  {   4200,   3789,   -333,  -2813 },
+  {   5229,   2493,  -1194,  -1878 },
+  {   5851,   2695,   -492,  -2292 },
+  {   5743,   3288,   -697,  -1221 },
+  {   5692,   2612,    979,  -2227 },
+  {   5085,   2067,   1046,  -1214 },
+  {   3163,   2240,  -2098,  -3435 },
+  {   5228,   1898,    145,  -2397 },
+  {   5860,   3976,   -418,  -2872 },
+  {   6008,   3399,   1027,  -3506 },
+  {   4126,   2035,   1865,   -893 },
+  {   5375,   3596,    511,  -2362 },
+  {   1937,   1493,   -852,   -122 },
+  {   3473,   4849,    547,  -2603 },
+  {   4631,   2977,   1141,  -1768 },
+  {   6149,   3050,    -71,  -1886 },
+  {   4069,   4353,   -289,  -1429 },
+  {   2884,   1225,  -1388,    365 },
+  {   5485,   2518,   -235,   -571 },
+  {   1216,   4375,   1443,    398 },
+  {   4988,   3106,    107,  -1435 },
+  {   4511,   2801,    307,   -444 },
+  {   3235,   4386,    327,   -676 },
+  {   2055,   3708,   1657,   -305 },
+  {   5839,   2374,    290,  -1385 },
+  {   5110,   3305,   1936,  -4206 },
+  {   6416,   2920,    338,  -2736 },
+  {   3350,   2824,  -1269,  -3881 },
+  {   4840,   1815,    464,    186 },
+  {   2399,   3332,    238,   1238 },
+  {   3516,   1363,   1582,    688 },
+  {   3582,   1874,    154,  -4770 },
+  {   3261,   2878,    886,    283 },
+  {   3877,   2658,   -327,    884 },
+  {   4151,   3436,   2173,  -2923 },
+  {   3592,   3674,   1281,  -1295 },
+  {   4561,   3730,  -1114,  -1747 },
+  {   4595,   3625,   -558,   -575 },
+  {   2577,   2348,   2267,    120 },
+  {   5242,   3299,     32,  -3412 },
+  {   4264,   3637,    709,  -2320 },
+  {   6556,   3570,   -838,  -2472 },
+  {   5745,   4014,   -940,  -1973 },
+  {   5629,   4475,    477,  -3328 },
+  {   5269,   3199,   1682,  -3085 },
+  {   4432,   2416,   1145,  -3299 },
+  {   4465,   2505,   2162,  -2186 },
+  {   4643,   4941,    -88,  -2885 },
+  {   4568,   5231,    552,  -3915 },
+  {   5667,   3075,  -1406,  -2963 },
+  {   5418,   5259,   -771,  -2818 },
+  {   -256,  -7875,    511,   -471 },
+  {  -1813,  -7971,   -424,   -396 },
+  {   -306,  -7006,    862,    282 },
+  {  -2306,  -6422,  -1440,    508 },
+  {   -245,  -6787,    375,   -100 },
+  {  -1309,  -6065,    -20,    779 },
+  {  -1656,  -6047,   -641,   1307 },
+  {  -1496,  -6522,    964,    726 },
+  {  -2291,  -6588,   -202,    795 },
+  {   -762,  -7522,   1454,   -558 },
+  {  -2270,  -7004,   -834,   -580 },
+  {  -1139,  -7078,    259,    362 },
+  {  -2535,  -7568,  -1040,     49 },
+  {  -3786,  -7280,    934,   -476 },
+  {  -3336,  -6368,    606,   1056 },
+  {  -3602,  -6924,     52,    714 },
+  {  -2278,  -6550,   1674,    204 },
+  {  -2855,  -5765,    930,   1530 },
+  {  -2889,  -7325,   -215,    305 },
+  {  -2749,  -6080,   -237,   1452 },
+  {   -985,  -6667,   1577,    400 },
+  {  -2036,  -6083,    380,   1267 },
+  {  -2077,  -7460,    380,    -30 },
+  {  -1775,  -7175,   1540,   -386 },
+  {  -3065,  -6927,    989,    168 },
+  {  -2836,  -7602,    117,  -3392 },
+  {  -1058,  -6396,    593,  -3078 },
+  {   -844,  -6062,    999,   -236 },
+  {  -3261,  -6951,   1491,   -720 },
+  {  -2186,  -8484,     75,  -1287 },
+  {  -2882,  -7756,    456,   -510 },
+  {  -1800,  -6879,    960,  -1183 },
+  {  -2554,  -7241,   1614,  -1474 },
+  {  -2608,  -5305,    392,    851 },
+  {  -2973,  -6562,   -859,    858 },
+  {  -2640,  -5989,   1031,   -416 },
+  {   -977,  -8366,    705,  -1434 },
+  {  -1213,  -7409,    -77,  -1390 },
+  {  -1335,  -6657,   2125,   -123 },
+  {  -2544,  -6862,   1852,   -737 },
+  {  -3235,  -6422,   1752,   -103 },
+  {  -1300,  -7557,    939,   -348 },
+  {  -3476,  -7579,    202,   -109 },
+  {  -2482,  -6572,    753,    619 },
+  {  -2554,  -8136,   -648,   -429 },
+  {  -1012,  -7870,     -3,   -421 },
+  {  -3604,  -6247,     32,  -3102 },
+  {  -1486,  -7271,   2013,  -1021 },
+  {   -578,  -6799,   -523,    405 },
+  {  -2841,  -5948,   1644,    911 },
+  {  -2411,  -7473,   1084,   -484 },
+  {  -2238,  -6033,    294,  -1059 },
+  {  -3459,  -6470,   -201,   -790 },
+  {  -2027,  -6009,   1833,    805 },
+  {  -1433,  -8047,   1531,  -1754 },
+  {  -3258,  -7884,    763,  -1422 },
+  {  -1544,  -6928,   -729,    478 },
+  {  -2314,  -8415,     74,  -3757 },
+  {  -3201,  -5684,     95,  -2214 },
+  {  -2423,  -8694,    725,  -3631 },
+  {  -3545,  -7071,   1162,  -1798 },
+  {   -294,  -9662,    403,  -2274 },
+  {  -2290,  -5460,   1196,    402 },
+  {  -1603,  -6713,    903,  -2363 },
+  {   4121,   2491,  -3142,  -2482 },
+  {   4500,   3305,  -3671,  -1567 },
+  {   5973,   3172,  -1348,   -534 },
+  {   4830,   3379,  -1549,    643 },
+  {   5214,   3938,  -2641,  -2302 },
+  {   4639,   4826,  -5532,   -847 },
+  {   5639,   2731,  -2170,   -963 },
+  {   6084,   3487,  -3525,  -1346 },
+  {   5971,   3154,  -2190,  -2316 },
+  {   5618,   4865,  -6927,    116 },
+  {   5345,   3568,  -7391,    709 },
+  {   5429,   5078,  -3811,  -1524 },
+  {   6960,   2037,  -3515,  -1096 },
+  {   7092,   2531,  -4557,   -588 },
+  {   6061,   4247,  -5651,   -478 },
+  {   4595,   3684,  -4907,   -827 },
+  {   7497,   3213,  -3048,   -424 },
+  {   5996,   2137,  -3098,  -1745 },
+  {   6198,   5199,  -2223,  -2274 },
+  {   6888,   2851,  -2768,  -1675 },
+  {   6114,   4210,  -2316,   -954 },
+  {   7127,   4242,  -3041,  -1408 },
+  {   6126,   3668,  -1517,  -1427 },
+  {   6245,   6129,  -4225,  -1186 },
+  {   6816,   3213,  -2101,   -964 },
+  {   5345,   5276,  -2643,   -847 },
+  {   6592,   4665,  -4338,    484 },
+  {   6746,   3751,  -3443,    124 },
+  {   5453,   1980,  -2738,   2606 },
+  {   4662,   2179,  -4226,  -1059 },
+  {   5571,   3208,  -3554,    174 },
+  {   5256,   4447,  -1815,  -1481 },
+  {   5400,   2570,  -1210,    235 },
+  {   7056,   2549,  -2674,    318 },
+  {   4574,   4340,  -2892,   -130 },
+  {   6203,   4587,  -3273,   -305 },
+  {   5103,   1925,  -2715,  -2137 },
+  {   3905,   4296,  -1700,    247 },
+  {   4421,   4605,  -3299,    811 },
+  {   5671,   1273,  -3870,   -924 },
+  {   5486,   1805,  -4901,    133 },
+  {   6437,   2578,  -1828,   -106 },
+  {   5530,   5253,  -5058,   1223 },
+  {   4816,   2025,  -1215,   1443 },
+  {   3457,   3525,  -2456,   3217 },
+  {   3316,   2595,  -1108,   2459 },
+  {   3068,   3810,  -2207,   1926 },
+  {   6351,   5436,  -6470,    600 },
+  {   6324,   4240,  -5365,   2416 },
+  {   4851,   4774,  -4075,   1878 },
+  {   4900,   3679,  -5198,   1078 },
+  {   8347,   3633,  -4565,   -171 },
+  {   5244,   5718,  -3853,    173 },
+  {   3960,   3492,  -2939,   2105 },
+  {   6070,   3473,  -2351,    161 },
+  {   8228,   3034,  -3360,   -901 },
+  {   7006,   3985,  -1940,  -1926 },
+  {   7123,   4681,  -4301,   -878 },
+  {   5122,   4097,  -1851,   -449 },
+  {   6200,   2060,  -2251,   1049 },
+  {   7106,   3844,  -7209,   2625 },
+  {   7108,   3370,  -6734,    533 },
+  {   6859,   2849,  -3992,   1360 },
+  {   5458,   2278,  -3253,   1131 },
+  {  -1072,  -2109,   4783,  -1073 },
+  {   -319,  -2604,   4257,  -2418 },
+  {   2466,   1300,   3476,   -314 },
+  {   2847,  -1502,   5296,   -141 },
+  {   1667,  -1273,   5559,  -2725 },
+  {   2877,  -3402,   6434,    204 },
+  {     53,  -2637,   5275,  -1181 },
+  {   1091,  -2215,   5803,  -1549 },
+  {   2397,   -922,   4327,   1182 },
+  {    219,  -3747,   4647,  -1564 },
+  {    -29,  -2705,   4812,   1277 },
+  {   1499,  -2608,   5648,   1407 },
+  {   2139,  -2399,   4202,   2791 },
+  {   -426,  -2064,   5528,    151 },
+  {   2560,  -2803,   6179,  -2806 },
+  {   4537,  -2479,   3797,   1095 },
+  {    888,  -3357,   5341,   -415 },
+  {   4460,  -1814,   5388,  -1227 },
+  {   3920,  -3268,   6364,   -703 },
+  {   3343,  -4698,   4410,    784 },
+  {    309,  -1897,   6306,   1223 },
+  {    958,  -3318,   4254,  -3167 },
+  {    -99,   1596,   6018,  -1983 },
+  {   -429,   -853,   6407,    878 },
+  {   1170,  -1322,   6290,   -417 },
+  {   2288,   -505,   6303,  -1999 },
+  {   3312,  -1674,   6749,  -2494 },
+  {   -415,  -3401,   4721,   -371 },
+  {   -189,  -1210,   4844,  -2002 },
+  {    888,  -4142,   4377,    130 },
+  {   2469,  -4381,   5398,  -2492 },
+  {   2879,  -2912,   5094,  -2598 },
+  {   -717,   -617,   5650,   -685 },
+  {   1470,  -3863,   5352,  -1684 },
+  {   3935,    -96,   3823,   -730 },
+  {   3769,   -430,   3168,    694 },
+  {   2556,    385,   3539,    512 },
+  {     77,  -1415,   5111,   2655 },
+  {   2724,  -2158,   6715,   -822 },
+  {   1832,   1001,   5385,  -1900 },
+  {    900,   2198,   4464,   -559 },
+  {    441,     69,   5921,  -1743 },
+  {  -1161,    738,   6732,   -308 },
+  {    257,   2035,   4091,    736 },
+  {   1607,   1288,   4355,    -23 },
+  {    -13,   1316,   4180,   1672 },
+  {   1511,   1336,   3057,   1435 },
+  {   2189,  -3813,   4530,    939 },
+  {   3632,   -706,   2646,   1375 },
+  {   4266,  -3761,   4241,   1077 },
+  {   3101,   -427,   5273,  -1202 },
+  {   2293,    276,   4810,   -313 },
+  {   3430,  -1851,   3101,   2045 },
+  {   3453,  -2979,   5142,    942 },
+  {   1683,  -3281,   4802,   2002 },
+  {   3954,  -4715,   5611,    578 },
+  {   1272,   -155,   5085,    454 },
+  {    128,   -194,   5095,   1409 },
+  {    820,    880,   5797,  -2658 },
+  {  -1095,    656,   5774,   1095 },
+  {    813,  -1669,   4320,  -3251 },
+  {   -119,    518,   6372,   -651 },
+  {   2922,  -4299,   6115,   -877 },
+  {   4205,  -4273,   4004,   2642 },
+  {  -1211,  -3892,    224,   3127 },
+  {    -34,  -4371,   1321,   2318 },
+  {     77,  -6326,   1201,    828 },
+  {   3995,  -3775,   1958,   3233 },
+  {    178,  -3301,   1985,   3318 },
+  {   2330,  -3801,   1033,   3195 },
+  {   1413,  -5536,    826,   1709 },
+  {   2468,  -3499,   3653,   3631 },
+  {    741,  -4617,   1723,   2008 },
+  {   1246,  -3043,   2978,   3949 },
+  {   -343,  -4308,   2258,   2189 },
+  {   -682,  -4640,    454,   2272 },
+  {   1236,  -4829,   2491,   1642 },
+  {   -512,  -3766,   1182,   3052 },
+  {    119,  -3939,   3712,    971 },
+  {  -1145,  -4624,   1360,   2281 },
+  {    101,  -4746,   2866,   1255 },
+  {  -1500,  -5455,    539,   1637 },
+  {   -969,  -5909,   1414,   1128 },
+  {  -1261,  -4939,   -231,   2022 },
+  {   -226,  -5345,   1207,    705 },
+  {   2712,  -5109,   3205,   1866 },
+  {   -476,  -5913,    273,   1208 },
+  {  -2039,  -4464,    624,   2545 },
+  {  -2351,  -3930,   2019,   2673 },
+  {  -2675,  -4849,   1522,   1990 },
+  {  -1524,  -3461,   1446,   3204 },
+  {    477,  -5314,   1710,   1577 },
+  {    656,  -3729,   2346,   2511 },
+  {    550,  -5917,   1975,   1040 },
+  {   1728,  -4704,   3067,   1058 },
+  {     -9,  -5247,    506,   1760 },
+  {   -574,  -5135,   1675,   1672 },
+  {   2129,  -3781,   3444,   2313 },
+  {   1144,  -4439,   2214,   2529 },
+  {   1292,  -4160,   3185,   1833 },
+  {   2445,  -3262,   2534,   3227 },
+  {   2266,  -4401,   2023,   2400 },
+  {   -587,  -3602,   3408,   2067 },
+  {   -885,  -4951,   3228,   1174 },
+  {   -728,  -2711,   2807,   3552 },
+  {   1019,  -3043,   3195,   2954 },
+  {   1888,  -4615,   1140,   2454 },
+  {    660,  -5616,    754,    800 },
+  {  -1975,  -5371,   1649,   1585 },
+  {  -1544,  -5436,   2422,   1081 },
+  {   -422,  -5882,   2390,    750 },
+  {   1336,  -5557,   2441,   1230 },
+  {    136,  -4001,    267,   2854 },
+  {   -522,  -3289,   2226,   2728 },
+  {   -971,  -4580,   2471,    708 },
+  {    704,  -5306,   3300,   1001 },
+  {    325,  -3464,   3555,   2398 },
+  {    794,  -3686,    848,   3169 },
+  {    660,  -3017,   4584,   3242 },
+  {  -1486,  -3978,   2170,   1644 },
+  {  -1615,  -4650,   2688,   1844 },
+  {    750,  -4578,    538,   2239 },
+  {   1668,  -5849,   1455,   1031 },
+  {   3486,  -4681,   2030,   2183 },
+  {   2642,  -5429,   1696,   1761 },
+  {   4491,  -4502,   3538,   2767 },
+  {   3545,  -4528,   3514,   2982 },
+  {   3269,  -3676,   2758,   3966 },
+  {   5572,   1146,    209,  -3379 },
+  {   7459,   1053,    593,  -1896 },
+  {   4480,    200,   -310,  -4259 },
+  {   5577,   -939,    242,  -3992 },
+  {   8142,    442,   1257,  -3083 },
+  {   5442,   1261,   1424,  -3236 },
+  {   6260,   -183,   3125,  -2532 },
+  {   7179,    889,   1618,  -2548 },
+  {   6416,    932,   2379,  -2487 },
+  {   7094,   2560,    961,  -3392 },
+  {   7322,    463,   2732,  -3735 },
+  {   6632,   1577,   1912,  -3272 },
+  {   6312,   1349,   3028,  -3460 },
+  {   6105,    386,   1213,   -977 },
+  {   5478,   1158,   1114,   -486 },
+  {   6493,    410,   1686,  -2180 },
+  {   6378,   1881,   1333,  -2240 },
+  {   5711,    812,   1958,  -1300 },
+  {   6844,    877,    730,  -1189 },
+  {   6824,   -245,   2249,  -2000 },
+  {   7515,   1521,   1251,  -3058 },
+  {   6697,   1051,   1300,  -1749 },
+  {   6476,   1425,    811,  -2773 },
+  {   7350,    465,    -76,  -2849 },
+  {   6975,   2095,    567,  -2492 },
+  {   4691,   1736,   2660,  -2289 },
+  {   7837,   1456,    340,  -2767 },
+  {   7930,    507,    838,  -2074 },
+  {   6106,   1502,    766,  -1110 },
+  {   4891,   -659,    835,  -3954 },
+  {   7250,    141,   1369,  -1523 },
+  {   7651,     67,   1651,  -2298 },
+  {   7364,   -305,    601,  -3132 },
+  {   7179,    193,   2491,  -2871 },
+  {   6504,   -272,   2167,  -1322 },
+  {   4456,    983,   2300,   -421 },
+  {   4817,    457,   1695,    371 },
+  {   6914,    555,    850,  -3159 },
+  {   5904,   1030,    202,  -1959 },
+  {   6258,    880,   2233,  -4503 },
+  {   6029,     10,   2130,  -3600 },
+  {   6449,    985,   1129,  -3963 },
+  {   6616,    -18,   -111,  -3285 },
+  {   4496,    775,    817,  -4276 },
+  {   6134,   2338,   1470,  -2973 },
+  {   6911,    152,    430,  -1946 },
+  {   4053,    991,   3218,  -1193 },
+  {   5435,   1285,   3124,  -2412 },
+  {   5507,   1836,   1935,  -1988 },
+  {   5240,    689,   2189,  -2670 },
+  {   6638,   1719,    606,  -1799 },
+  {   5556,   -180,    129,  -2595 },
+  {   5644,   1918,   1281,  -4316 },
+  {   6410,   1088,   -282,  -3117 },
+  {   6503,   1841,    312,  -3514 },
+  {   6947,     20,   1358,  -3886 },
+  {   5464,   2109,   2398,  -3194 },
+  {   5616,   -407,   2140,   -498 },
+  {   6121,   2707,   2379,  -4096 },
+  {   7303,   1846,   2266,  -4095 },
+  {   5444,    470,   2718,  -1553 },
+  {   5817,   -645,   3285,  -1349 },
+  {   5625,   1427,   1103,  -1991 },
+  {   6041,   -806,   1196,  -2943 },
+  {   3050,  -5722,   4070,  -5460 },
+  {   3420,  -4386,   4078,  -5155 },
+  {   6020,  -3982,   7268,  -2689 },
+  {   7502,  -4317,   7894,  -3973 },
+  {   4156,  -3558,   5247,  -4316 },
+  {   4725,  -4401,   7290,  -1540 },
+  {   6688,  -5122,   8216,  -3210 },
+  {   9176,  -6576,   9276,  -4963 },
+  {   8706,  -5708,   7987,  -4621 },
+  {   7060,  -3535,   6532,  -3308 },
+  {   5600,  -2719,   5363,  -1568 },
+  {   4661,  -2803,   6263,  -4716 },
+  {   3673,  -3636,   6147,  -3433 },
+  {   5305,  -2585,   6073,  -2638 },
+  {   7614,  -1962,   6079,  -5266 },
+  {   6760,  -3366,   7382,  -4322 },
+  {   6385,  -3883,   4797,  -1353 },
+  {   8182,  -5120,   4298,  -4641 },
+  {   9130,  -6198,   4975,  -3063 },
+  {   7421,  -5436,   5576,  -3713 },
+  {   3483,  -4898,   5443,  -2745 },
+  {   4907,  -5643,   6390,  -4105 },
+  {   8119,  -7008,   7992,  -6764 },
+  {   6528,  -6122,   6967,  -5590 },
+  {   5890,  -4190,   6624,  -5688 },
+  {   6815,  -7934,   7275,  -5456 },
+  {   5434,  -4306,   5169,  -5378 },
+  {   4364,  -6436,   5376,  -2604 },
+  {   8152,  -3404,   5913,  -5048 },
+  {   7983,  -4863,   4262,  -2461 },
+  {   8023,  -6188,   6238,  -5062 },
+  {   6753,  -3692,   3935,  -3723 },
+  {   6826,  -4760,   3284,  -4051 },
+  {   7224,  -7423,   4492,  -3875 },
+  {   6904,  -2590,   6587,  -6248 },
+  {   6106,  -1944,   7345,  -5506 },
+  {   4956,  -2990,   7808,  -3146 },
+  {   6908,  -6885,   5949,  -1288 },
+  {   7162,  -6058,   3419,  -3401 },
+  {   7015,  -7080,   6907,  -3018 },
+  {   6971,  -6832,   5646,  -3273 },
+  {   8014,  -5546,   5471,  -1544 },
+  {   6792,  -2220,   5105,  -2879 },
+  {   8494,  -3974,   4408,  -3999 },
+  {   9591,  -4866,   6027,  -4558 },
+  {   5264,  -5161,   6101,   -738 },
+  {   5803,  -6141,   5197,  -5231 },
+  {   4657,  -6822,   3232,  -5189 },
+  {   4791,  -5135,   3809,  -4665 },
+  {   6108,  -5103,   2379,  -3873 },
+  {   4680,  -3909,   3234,  -5093 },
+  {   5802,  -3853,   3795,  -4984 },
+  {   4360,  -7483,   4802,  -3877 },
+  {   5429,  -7517,   5911,  -3717 },
+  {   6866,  -2280,   4880,  -4634 },
+  {  10131,  -4628,   4414,  -4092 },
+  {  10811,  -5189,   7746,  -5337 },
+  {   5663,  -8941,   5287,  -5680 },
+  {   8023,  -5991,   7403,  -2796 },
+  {   9669,  -6919,   6525,  -4932 },
+  {   7275,  -3796,   4962,  -2547 },
+  {   8848,  -4806,   5677,  -3080 },
+  {   8128,  -4308,   7749,  -6569 },
+  {   4032,  -5196,   2282,  -6239 },
+  {   6593,    700,   -229,    304 },
+  {   8260,    539,    -66,  -1259 },
+  {   6605,    176,   -814,   -109 },
+  {   8057,      0,     -1,   -136 },
+  {   7382,    -38,   -484,  -1129 },
+  {   8373,   -929,    682,   -454 },
+  {   7674,    690,  -1278,    546 },
+  {   7326,   -517,    406,  -1283 },
+  {   7612,  -1715,  -1167,   1175 },
+  {   8590,    441,   -782,   -710 },
+  {   8572,  -1202,   -291,    260 },
+  {   7308,   -147,  -1785,    414 },
+  {   6787,   -353,   -672,    934 },
+  {   5177,   -133,    179,     82 },
+  {   4161,    -34,    447,   1497 },
+  {   5997,   -902,   1533,   -121 },
+  {   5727,   -871,  -1370,    945 },
+  {   8386,   -252,    293,   -823 },
+  {   6573,  -1354,    682,    616 },
+  {   7650,  -2096,    725,    457 },
+  {   8122,     78,    636,  -1400 },
+  {   8421,    428,  -1620,    131 },
+  {   7341,  -1292,   -717,    186 },
+  {   7998,    -49,   -720,    266 },
+  {   5987,   -351,    669,    844 },
+  {   7314,  -1620,    250,   -603 },
+  {   7219,  -1562,   -572,   1994 },
+  {   8682,   -358,   -290,   -388 },
+  {   5810,    155,   -178,   1199 },
+  {   7246,    -12,   1042,   -786 },
+  {   7357,   -923,   1468,   -475 },
+  {   7801,    621,   -212,   -724 },
+  {   5346,   -514,   1210,   1356 },
+  {   8459,     36,   -127,   -779 },
+  {   6878,  -2429,    854,   1750 },
+  {   7280,  -1401,  -1353,   2845 },
+  {   7579,  -2148,  -1463,   2087 },
+  {   6637,    946,   -872,    750 },
+  {   4807,  -1100,   1289,   2602 },
+  {   4495,    219,   1551,   1128 },
+  {   7639,    506,    446,  -1107 },
+  {   6359,    188,   1009,   -115 },
+  {   6641,  -1820,   1655,    723 },
+  {   5394,  -2382,   1604,   2542 },
+  {   6021,  -2644,   2396,   1407 },
+  {   4698,    882,    245,   1525 },
+  {   8103,    573,   -798,   -349 },
+  {   8045,   -519,    997,  -1092 },
+  {   7571,   -122,    227,   -338 },
+  {   5347,  -1200,    630,   1718 },
+  {   7070,    790,    218,   -544 },
+  {   7440,    728,   -527,    -20 },
+  {   6402,   -355,    197,   -736 },
+  {   4031,    771,    866,   1895 },
+  {   6009,    896,    445,    -31 },
+  {   5160,   1098,   -856,   1784 },
+  {   7980,   -886,  -1293,   1396 },
+  {   6318,  -1361,   2423,    252 },
+  {   7547,   -699,    133,    506 },
+  {   8562,  -2344,    940,    264 },
+  {   5890,   1187,  -1425,   2194 },
+  {   6558,   -645,  -1311,   2621 },
+  {   4634,  -1671,   2075,   1623 },
+  {   5614,    105,   -816,   2376 },
+  {   6646,   1558,  -1365,    630 },
+  {   6998,   1150,  -2117,   -990 },
+  {   6555,   2311,  -1093,  -1783 },
+  {   6682,   1430,  -2391,  -1940 },
+  {   7861,   1555,  -2977,  -1188 },
+  {   6745,   1723,   -459,  -2085 },
+  {   7504,   1229,  -1666,  -2060 },
+  {   7937,    671,  -2128,  -1529 },
+  {   7139,    991,   -735,  -2632 },
+  {   6867,   1592,  -1303,  -2324 },
+  {   6401,   2230,  -1732,  -2508 },
+  {   7201,   2184,  -2169,  -1988 },
+  {   6636,   2190,   -995,  -2840 },
+  {   7620,   2306,  -2089,   -651 },
+  {   7584,   1875,  -1438,   -631 },
+  {   9214,   1561,  -2464,  -1139 },
+  {   6154,   1318,  -1237,  -2917 },
+  {   7917,   2847,  -1797,  -1599 },
+  {   8309,   2029,  -2555,   -465 },
+  {   8204,   1282,   -584,  -2405 },
+  {   8440,   1035,  -1147,  -1137 },
+  {   7107,   1858,    -60,  -1568 },
+  {   6781,   2912,   -873,  -1463 },
+  {   7603,   1316,   -319,  -1249 },
+  {   7833,   1335,    -78,  -1849 },
+  {   7930,   1141,  -1016,   -695 },
+  {   7883,   1610,  -1017,  -1314 },
+  {   8069,   1409,  -1811,   -196 },
+  {   8319,   1031,   -582,  -1590 },
+  {   5948,   1537,  -2153,  -2373 },
+  {   8684,   1171,  -1871,   -850 },
+  {   8357,   2484,  -2411,  -1292 },
+  {   6516,   2092,   -193,  -1167 },
+  {   6112,   1697,     22,   -525 },
+  {   7161,    703,   -602,  -1879 },
+  {   6047,   2351,   -807,   -219 },
+  {   8072,   1854,  -1817,  -1553 },
+  {   6956,   1304,     76,  -1011 },
+  {   6607,   1481,   -544,   -162 },
+  {   6958,   2541,   -265,  -1938 },
+  {   6416,   2514,   -777,   -850 },
+  {   7272,   2110,   -899,  -1171 },
+  {   7741,   2153,   -283,  -2614 },
+  {   6482,   2041,  -1758,  -1221 },
+  {   6762,    940,  -1862,  -2281 },
+  {   5610,   1194,  -1691,  -1561 },
+  {   7833,   2164,   -823,  -1952 },
+  {   5460,   1438,   -848,   1189 },
+  {   6011,   1377,   -771,  -1557 },
+  {   7679,    544,  -1134,  -2214 },
+  {   7209,   1292,  -2714,  -1564 },
+  {   5567,   1200,   -404,   -169 },
+  {   5853,   1461,  -1465,   -518 },
+  {   6782,    689,   -844,   -860 },
+  {   7330,   1337,  -1152,    -71 },
+  {   7189,   1506,   -653,   -685 },
+  {   6860,   2116,  -1403,   -240 },
+  {   8804,   1516,  -1391,  -1760 },
+  {   7210,   2689,  -1498,   -989 },
+  {   7030,   3022,  -1441,  -2083 },
+  {   5649,   1836,   -407,    525 },
+  {   7451,   3099,   -717,  -2464 },
+  {   7384,   1656,  -2007,    398 },
+  {   6504,    707,  -1919,   -134 },
+  {  -1851,   3639,  -2279,   -695 },
+  {  -4037,   1644,    -77,   1329 },
+  {  -4025,   1960,  -1565,   -567 },
+  {  -3430,   2495,   -795,    368 },
+  {  -4771,   2480,    993,    756 },
+  {  -3431,   2058,  -2539,   -971 },
+  {  -3802,   3418,    380,    217 },
+  {  -3074,   3350,  -1652,  -1056 },
+  {  -3705,    326,  -1650,   1535 },
+  {  -3122,   1281,  -1192,   1607 },
+  {  -4601,   1367,   -968,     53 },
+  {  -3808,    958,     44,   2560 },
+  {  -2079,   2530,  -1485,   1166 },
+  {  -3707,    343,  -2889,    180 },
+  {  -5249,   1431,    -31,    688 },
+  {  -4990,    125,   -704,   1270 },
+  {  -2771,   1334,  -2446,    746 },
+  {  -2292,    994,  -1527,   2630 },
+  {  -1261,   3070,  -2519,    268 },
+  {  -2544,   3890,  -1057,   -552 },
+  {  -4421,    255,  -1980,    530 },
+  {  -2951,    454,    -13,   3643 },
+  {  -2262,   1815,   -370,   2880 },
+  {  -2383,   3657,   -649,    576 },
+  {  -3541,   -161,  -1389,   2550 },
+  {  -4241,   1575,   1325,   2561 },
+  {  -2767,   4037,   1221,   1578 },
+  {  -3748,   2697,   1148,   1801 },
+  {  -4686,   2385,   -220,      0 },
+  {  -1531,   1645,  -2751,   1327 },
+  {    -45,   4032,   -799,   2298 },
+  {  -2915,   2280,    709,   2495 },
+  {  -1199,   3278,   -406,   2346 },
+  {  -2471,    116,  -2706,   2060 },
+  {  -2440,   2173,  -2894,   -344 },
+  {  -3375,   2287,   1781,   3226 },
+  {  -2153,   3568,   1827,   2918 },
+  {   -862,   2267,  -1626,   2527 },
+  {  -2698,   1135,    301,   4239 },
+  {  -2364,   2123,   1010,   3710 },
+  {  -2447,   3281,    -81,   1408 },
+  {  -2660,   4735,    472,    258 },
+  {  -1053,   3097,   2682,   2398 },
+  {  -3366,  -1037,  -1152,   -868 },
+  {   -643,   4242,   2212,   1259 },
+  {    971,   3991,    934,    643 },
+  {  -1617,   2002,   2139,   2195 },
+  {  -4897,    972,    784,   1719 },
+  {  -1275,   2992,   1039,   3821 },
+  {   -392,   4973,   -209,   1821 },
+  {  -1028,   4718,  -1479,   -137 },
+  {     50,   3914,    553,   2210 },
+  {    678,   4364,    359,   1303 },
+  {   -582,   4911,    514,   1671 },
+  {   1276,   3914,  -1252,   2934 },
+  {  -1496,   3984,    857,   2330 },
+  {    772,   4744,   -655,   2332 },
+  {   -799,   5283,   -439,    624 },
+  {   1341,   2937,    650,   2027 },
+  {  -1739,   4892,   1275,   1702 },
+  {   -892,   2596,   -151,   3951 },
+  {  -3532,   1090,   1292,     32 },
+  {    321,   3146,   2647,   1475 },
+  {    264,   4199,  -1591,   1317 },
+  {   -452,  -2357,   2266,   4192 },
+  {   3022,  -1033,  -2389,   5678 },
+  {  -1162,  -1342,   3543,   4990 },
+  {   -474,  -1477,  -1223,   5016 },
+  {   -699,  -2857,    900,   3835 },
+  {   -461,  -2255,   -117,   4626 },
+  {   1204,  -2062,  -1211,   4403 },
+  {   2192,  -3035,   -337,   3966 },
+  {    108,   -831,    279,   5643 },
+  {   1457,   -620,  -2908,   5276 },
+  {  -2527,    -78,   1085,   5460 },
+  {  -1978,  -1918,   -949,   4733 },
+  {     32,    367,  -1904,   5166 },
+  {   1890,  -1665,    440,   4752 },
+  {   -518,   -348,   2816,   4891 },
+  {   3695,  -2490,  -1374,   4603 },
+  {    246,  -1965,   3549,   3969 },
+  {   1100,  -3111,    656,   3737 },
+  {  -1379,    870,   -414,   4575 },
+  {    628,   -357,  -1227,   6179 },
+  {  -1129,  -1318,  -2457,   4576 },
+  {   -425,    -98,    -73,   6336 },
+  {    367,   -887,   2990,   4207 },
+  {   2091,  -1251,   2444,   3557 },
+  {  -1759,  -1610,   2046,   5273 },
+  {   3210,   1414,    -20,   2616 },
+  {   3303,  -2636,   1005,   4237 },
+  {   -327,  -3107,   -640,   3687 },
+  {   -197,    764,    572,   5486 },
+  {    646,   -767,   1388,   5464 },
+  {    104,   2742,   -228,   3907 },
+  {   -236,   1829,   -579,   4585 },
+  {  -2150,   -474,  -1525,   4006 },
+  {    -23,  -2632,  -2400,   3892 },
+  {    -12,  -1739,  -2910,   4867 },
+  {  -2310,   -368,   -102,   4583 },
+  {  -1991,  -2061,    533,   4531 },
+  {   3884,  -1446,   -153,   4393 },
+  {   1568,     14,   -289,   5268 },
+  {  -1376,   -253,  -2797,   3417 },
+  {   3193,  -2577,   2475,   3566 },
+  {   3418,    617,   1350,   1857 },
+  {   3792,    -24,   -272,   3370 },
+  {    153,   1159,   2906,   2877 },
+  {    511,   2162,   1548,   2741 },
+  {    262,    819,  -2791,   3734 },
+  {   4232,  -2015,   1486,   3477 },
+  {   2943,  -1110,  -1014,   5480 },
+  {   2842,    369,    703,   3476 },
+  {   3011,   1634,   -933,   3553 },
+  {   4412,  -1548,   -942,   5021 },
+  {  -1405,    593,   2372,   5267 },
+  {   2093,   2129,    896,   2365 },
+  {   4845,  -1980,      0,   3823 },
+  {  -2140,     81,   3278,   5637 },
+  {   1484,   2665,   -324,   3653 },
+  {     10,    192,   1620,   5291 },
+  {   2152,    738,  -2269,   5000 },
+  {   2102,   2748,  -1652,   4707 },
+  {   2855,  -2131,   -387,   5188 },
+  {   1173,    676,   1338,   3277 },
+  {   2340,  -2329,  -2064,   4095 },
+  {    861,  -2024,   1296,   5055 },
+  {   2189,   3225,   -695,   2626 },
+  {   6196,  -7079,   1943,   -822 },
+  {   4547,  -4813,   3261,   1856 },
+  {   4243,  -6904,   3443,    448 },
+  {   4581,  -7503,    946,    506 },
+  {   6626,  -7754,   3427,    470 },
+  {   3407,  -9088,   3269,  -1496 },
+  {   4079,  -6464,   2304,    777 },
+  {   5621,  -9336,   2684,   -768 },
+  {   5351,  -6464,   5238,   -214 },
+  {   5961,  -8007,   1724,  -3091 },
+  {   4213,  -8067,    603,   -246 },
+  {   7208,  -7403,   3168,  -1738 },
+  {   6098,  -7700,    329,  -1379 },
+  {   6525,  -6735,   4248,  -1072 },
+  {   6073,  -6241,   2167,  -2378 },
+  {   4609,  -9218,   3051,  -1033 },
+  {   6813,  -7283,   1581,  -1897 },
+  {   6126,  -6275,   2789,    681 },
+  {   4423,  -6538,   1621,  -1692 },
+  {   6272,  -8298,   3167,  -1855 },
+  {   6172,  -8558,   4498,  -1169 },
+  {   4844,  -8588,   1647,   -366 },
+  {   6209,  -8807,   1581,   -369 },
+  {   5389,  -8059,    550,   -192 },
+  {   6654,  -9775,   2504,  -1063 },
+  {   7103,  -7998,    806,    530 },
+  {   5662,  -6736,   1565,  -3620 },
+  {   4165,  -9564,   4191,  -2131 },
+  {   4526,  -7181,    576,  -2875 },
+  {   4633,  -8623,   2807,  -4742 },
+  {   3709,  -7794,   1815,     34 },
+  {   3634,  -8622,   2313,   -826 },
+  {   6991,  -8447,   2063,  -3198 },
+  {   7757,  -9486,   2255,   -558 },
+  {   4149,  -7778,   4728,  -1696 },
+  {   5767,  -7427,   1113,    707 },
+  {   4592,  -6261,   2329,   1864 },
+  {   3159, -10498,   1677,  -4273 },
+  {   3534,  -9010,   2437,  -3565 },
+  {   4479, -10821,   2715,  -4942 },
+  {   3207,  -9805,   3054,  -3886 },
+  {   4627,  -8189,   3018,  -2354 },
+  {   5527, -10566,   3244,  -2749 },
+  {   4346, -10127,   3335,  -3084 },
+  {   6132, -10085,   3316,  -1308 },
+  {   5629,  -9704,   2178,  -3058 },
+  {   3603,  -8538,   1246,   -624 },
+  {   3737,  -8488,    395,  -3167 },
+  {   5465, -11414,   2810,  -4640 },
+  {   5306,  -7745,   2721,  -3988 },
+  {   7000,  -9111,   1695,  -1409 },
+  {   6663,  -7741,   2466,  -4079 },
+  {   4083,  -7175,   1836,  -4831 },
+  {   3613,  -9926,   1342,  -3455 },
+  {   6588,  -8033,    457,   -258 },
+  {   4720,  -8102,     17,  -1209 },
+  {   7414,  -8709,   1294,   -344 },
+  {   5437, -10030,   4043,  -1704 },
+  {   4862,  -9281,   1558,  -1431 },
+  {   6800,  -6403,   5113,    862 },
+  {   4623,  -8242,   2667,   -228 },
+  {   5919,  -5083,   3348,   2135 },
+  {   5985,  -8889,   2733,  -5105 },
+  {   5029,  -5767,   4407,    719 },
+  {    354,  -6158,   -838,  -3001 },
+  {    351,  -5943,  -2104,  -1534 },
+  {   -633,  -7190,    -25,  -4798 },
+  {  -1595,  -7235,  -3812,  -1400 },
+  {    103,  -6197,  -2933,    -78 },
+  {  -1722,  -5020,  -3441,  -4333 },
+  {  -1963,  -5644,  -4365,   -270 },
+  {   -846,  -5743,  -3477,    196 },
+  {   -191,  -5348,  -4054,   -469 },
+  {  -2515,  -7754,  -3495,   -818 },
+  {  -2090,  -6710,  -2701,    117 },
+  {   -546,  -7036,  -1398,    163 },
+  {   -278,  -7091,  -2662,   -536 },
+  {   -622,  -7962,  -2731,  -1464 },
+  {  -1555,  -8118,  -3612,  -2057 },
+  {  -1094,  -6280,  -2314,    505 },
+  {  -2556,  -8538,  -4024,  -2247 },
+  {    109,  -7134,  -3107,  -1823 },
+  {   -900,  -6954,  -3340,   -717 },
+  {   -605,  -7113,  -3656,  -2154 },
+  {    837,  -6263,  -3211,  -2177 },
+  {   -417,  -5810,  -3871,  -1469 },
+  {  -1318,  -5649,  -4207,  -3198 },
+  {    413,  -6765,  -2082,    -33 },
+  {  -3101,  -6450,  -4362,   -766 },
+  {    755,  -6489,  -2967,   -846 },
+  {   1117,  -7106,  -2452,  -1352 },
+  {  -1202,  -8387,  -3072,  -2897 },
+  {   -365,  -4894,  -3561,  -2937 },
+  {  -2372,  -8776,   -265,  -4441 },
+  {  -1224,  -8678,   -896,  -5074 },
+  {   -755, -10096,   -600,  -6623 },
+  {    300,  -8206,   -225,  -4568 },
+  {  -1176,  -6824,  -2633,  -3527 },
+  {  -2006,  -5443,  -1526,  -5849 },
+  {  -1115,  -5540,  -2363,  -4785 },
+  {   1059,  -6812,  -2543,  -2654 },
+  {  -1976,  -6861,  -3062,  -5508 },
+  {   -379,  -5328,  -2321,  -3624 },
+  {  -2108,  -5860,  -4518,  -1915 },
+  {   -379,  -7885,  -1329,   -594 },
+  {    774,  -5389,   -581,  -5213 },
+  {  -2601,  -5083,  -1849,  -4921 },
+  {   -176,  -5580,     74,  -5075 },
+  {   -204,  -6780,   -190,  -6232 },
+  {    418,  -7594,  -1987,   -820 },
+  {  -1873,  -8529,  -2926,  -1609 },
+  {   1340,  -6362,   -919,  -4975 },
+  {    577,  -7990,  -2044,  -1873 },
+  {  -2572,  -7413,  -1745,  -2224 },
+  {  -2037,  -7030,  -1461,  -7138 },
+  {  -2559,  -8756,  -2039,  -5836 },
+  {  -2079,  -6764,  -1209,  -5669 },
+  {  -1613,  -7801,  -2006,   -685 },
+  {  -1865,  -6583,   -722,  -3529 },
+  {   -589,  -6358,  -1377,  -1003 },
+  {   -540,  -7514,  -1331,  -3542 },
+  {    419,  -6192,  -1677,  -4927 },
+  {  -2786,  -8763,  -2966,  -5065 },
+  {  -2172,  -8411,  -1726,  -4675 },
+  {  -3382,  -9833,  -3497,  -5722 },
+  {  -2433, -10169,  -2077,  -5775 },
+  {   -424,  -9451,  -1096,  -3658 },
+  {   -537,  -8522,   -910,  -1897 },
+  {  -5550,   2807,   1683,   -693 },
+  {  -6395,    635,   3573,  -1246 },
+  {  -7544,   2280,   2140,     44 },
+  {  -8751,   1136,   2951,   -794 },
+  {  -5605,   2709,   2052,    916 },
+  {  -7650,    654,    869,    135 },
+  {  -6939,    967,   1409,    870 },
+  {  -7834,   2123,   3310,    974 },
+  {  -6935,   2818,   1274,  -1678 },
+  {  -5605,   2233,   1013,    471 },
+  {  -7095,   1849,   1648,    198 },
+  {  -6636,   1634,    712,    -37 },
+  {  -7279,    978,    296,   -315 },
+  {  -7664,   3504,   3292,   -216 },
+  {  -7836,   1209,   1221,   -257 },
+  {  -7913,   2201,   1765,  -1529 },
+  {  -7077,   3783,   2632,  -1407 },
+  {  -5565,   1645,   1410,   -622 },
+  {  -6494,   2879,   1181,   -759 },
+  {  -7073,   3137,   3010,    550 },
+  {  -7249,   1839,    847,   -805 },
+  {  -6630,   2197,    282,  -1096 },
+  {  -8836,   1573,   1988,  -1090 },
+  {  -7809,   1274,    836,  -1198 },
+  {  -7895,   2970,   3511,  -1097 },
+  {  -6960,   1664,   1356,  -2442 },
+  {  -6582,   2866,   2273,    307 },
+  {  -7221,    821,   2851,  -1435 },
+  {  -6015,   1703,   2001,  -2367 },
+  {  -8082,   1034,   2103,    239 },
+  {  -5952,   1912,    301,   -465 },
+  {  -6099,    841,    379,    567 },
+  {  -6343,     50,    494,    658 },
+  {  -6586,    983,    591,   -893 },
+  {  -5500,    869,   2187,  -2479 },
+  {  -6482,     60,   1545,   -979 },
+  {  -6705,    515,   1974,    -53 },
+  {  -6460,   1755,   1325,  -1275 },
+  {  -6093,   2617,   2465,   -623 },
+  {  -7330,   2161,    594,  -2115 },
+  {  -7324,    762,   1593,  -2004 },
+  {  -6385,    679,   1510,  -2514 },
+  {  -6159,    241,   2976,  -1631 },
+  {  -8583,   3030,   4045,   -162 },
+  {  -6299,     66,   2209,  -2103 },
+  {  -5428,   1279,   3267,  -1846 },
+  {  -6438,   1335,   2728,  -1631 },
+  {  -8012,   1070,   2428,  -1151 },
+  {  -6201,   2781,   2349,  -1918 },
+  {  -5918,   1139,   3121,   -148 },
+  {  -6314,   2481,   3137,  -1808 },
+  {  -7180,   1722,   2435,  -1602 },
+  {  -6750,   1829,   3763,  -1145 },
+  {  -6713,   1777,   2221,   1212 },
+  {  -7479,   1835,   3627,   -479 },
+  {  -7299,     10,   2406,  -1593 },
+  {  -8249,   3129,    996,  -2870 },
+  {  -8374,   1534,   1333,  -1882 },
+  {  -7507,   3353,   1598,  -2299 },
+  {  -7379,   2701,   2326,  -1167 },
+  {  -8440,   2276,   2796,   -542 },
+  { -10348,   1527,   2649,  -1165 },
+  {  -8184,   3614,   2574,  -1738 },
+  {  -5539,   1574,   1733,   1138 },
+  {   9404,  -7652,     67,     79 },
+  {   8654,  -3972,   1358,    -60 },
+  {   8617,  -4794,    117,   2318 },
+  {   7886,  -4505,   1784,   1200 },
+  {   8636,  -6125,   3879,  -1003 },
+  {   9654,  -6836,   1816,    205 },
+  {   9374,  -6553,    913,   1875 },
+  {   8020,  -6150,   1134,   2390 },
+  {   7786,  -4970,   2078,  -1857 },
+  {   8691,  -6119,    711,    708 },
+  {   9039,  -5568,   2944,  -1902 },
+  {   9955,  -5048,   1433,   -601 },
+  {   8089,  -6927,   3093,  -2846 },
+  {   8487,  -7024,   2415,     19 },
+  {   9388,  -5287,   3577,  -2655 },
+  {   8591,  -7371,   2300,   -996 },
+  {   9104,  -4763,   1453,  -2558 },
+  {   7615,  -5457,    596,    164 },
+  {   9860,  -7047,   3433,   -614 },
+  {   8756,  -4404,   2235,   -964 },
+  {   9462,  -4660,    299,  -1822 },
+  {  10119,  -5550,   2689,  -1273 },
+  {  10915,  -7471,   2705,  -1007 },
+  {  11433,  -7090,   1410,  -1198 },
+  {   9882,  -7431,   2965,  -1895 },
+  {   7628,  -5219,    769,  -2661 },
+  {   8169,  -5318,   2262,     70 },
+  {   8846,  -6320,   1939,   -754 },
+  {   7147,  -5593,   1248,   -971 },
+  {  10652,  -5485,    935,    137 },
+  {   7778,  -6533,   2564,  -1932 },
+  {   8878,  -5173,   1214,   -361 },
+  {   9828,  -4943,    282,    510 },
+  {  10042,  -6134,   3895,  -1914 },
+  {   7965,  -6630,   3566,   -433 },
+  {   8573,  -4502,   3574,  -1209 },
+  {   8398,  -4801,   1031,  -1347 },
+  {  10136,  -7772,   2612,   1547 },
+  {   9890,  -7280,   1768,  -1083 },
+  {   8407,  -6585,   -706,    -58 },
+  {   7976,  -7582,    229,   -131 },
+  {  10481,  -8866,   1166,   -147 },
+  {  10914,  -4342,   3189,  -2412 },
+  {  10440,  -5198,   -104,  -1109 },
+  {  11227,  -6530,   2381,  -2449 },
+  {   8487,  -8064,   1086,    230 },
+  {   9975,  -6123,   -857,   -134 },
+  {   8339,  -6498,   1232,  -2337 },
+  {  11042,  -4506,   1119,  -2098 },
+  {  12563,  -5592,   1837,  -2062 },
+  {  11801,  -5590,    632,  -1296 },
+  {  10152,  -5617,   1511,  -1917 },
+  {   7800,  -6473,     51,  -1337 },
+  {   7941,  -5560,   2438,  -3270 },
+  {   6554,  -3834,   2100,   1476 },
+  {   9065,  -5520,   -226,  -1120 },
+  {  10794,  -7120,   -243,    122 },
+  {  10429,  -6968,    272,   -806 },
+  {   8942,  -8914,   1442,   -392 },
+  {   9969,  -5051,   2033,  -2953 },
+  {   7275,  -4152,   3058,    -64 },
+  {  11127,  -5488,   4589,  -3227 },
+  {   9626,  -6666,   2739,  -2958 },
+  {   6943,  -5362,   4470,   1008 },
+  {  -7456,   -967,   2936,  -1002 },
+  {  -8622,   -333,   6962,   2606 },
+  {  -7486,  -3392,   3668,   1287 },
+  {  -8053,   -827,   5148,   1097 },
+  {  -6610,    454,   4952,     96 },
+  {  -7701,  -1982,   3161,   -468 },
+  {  -7307,  -1132,   4071,    -36 },
+  {  -8125,   -271,   5199,   3862 },
+  {  -9182,  -1950,   2813,   1878 },
+  {  -9855,   -952,   4794,   3010 },
+  {  -7241,   1431,   4202,   2468 },
+  {  -9646,    157,   4766,   1046 },
+  {  -9371,   1230,   6009,   2958 },
+  { -11514,    -64,   8630,   5248 },
+  {  -6766,    565,   2766,   2140 },
+  {  -8426,     -9,   2852,   1271 },
+  { -11291,  -1113,   5087,   2937 },
+  {  -8297,   2092,   4495,   1264 },
+  {  -9983,    735,   3809,    -51 },
+  {  -9048,  -1000,   3191,   -308 },
+  {  -7331,  -1987,   2655,   1391 },
+  {  -7144,    -21,   4333,   2161 },
+  {  -6032,  -1540,   3543,    896 },
+  {  -7987,  -1036,   1985,   1529 },
+  {  -9264,   2004,   5194,    290 },
+  { -11308,   -840,   5754,   1654 },
+  {  -9130,  -2398,   4292,   2973 },
+  {  -6248,    838,   3563,   1223 },
+  {  -6819,  -2760,   3511,    119 },
+  {  -7213,  -2006,   4364,    762 },
+  {  -5431,  -1047,   4533,    166 },
+  {  -7098,   -641,   2021,    639 },
+  {  -8628,  -2249,   3588,    399 },
+  {  -6352,  -1498,   3560,   -648 },
+  {  -7033,  -2190,   4870,   2562 },
+  {  -7405,    -46,   3772,   -581 },
+  {  -6104,    796,   5143,   1965 },
+  {  -5787,    943,   5784,   3030 },
+  {  -8367,   1465,   7192,   4097 },
+  {  -8259,    789,   5694,   1963 },
+  { -10614,  -1899,   5748,   2645 },
+  {  -8258,   -805,   3698,   2275 },
+  {  -6877,   -972,   6431,   3160 },
+  {  -6483,    363,   7018,   3129 },
+  {  -6283,  -1358,   5191,   1524 },
+  {  -8853,  -3157,   4119,   1741 },
+  {  -6086,   -267,   3883,   -835 },
+  {  -7254,   1032,   6613,   4017 },
+  { -11470,  -3350,   4649,   3426 },
+  {  -6743,    481,   6148,   1239 },
+  {  -5394,   -166,   5309,   3165 },
+  {  -7958,   1068,   4268,   -240 },
+  { -10520,   2256,   7916,   2828 },
+  {  -5132,     -4,   5739,   1176 },
+  {  -8643,    120,   3255,   -629 },
+  {  -9631,   1974,   8870,   4362 },
+  { -10663,  -1221,   3733,    589 },
+  {  -8224,  -1843,   5806,   2655 },
+  {  -8282,   1255,   8647,   3478 },
+  { -12311,  -1505,   9043,   6256 },
+  { -11312,   -856,   7136,   4681 },
+  { -11944,   -722,   7941,   3309 },
+  {  -7868,   -463,   6846,   4196 },
+  {  -8679,   -241,   7410,   5347 },
+  {   6759,  -4680,   -508,   1220 },
+  {   5176,  -6111,    944,    121 },
+  {   6843,  -5667,  -1368,   -533 },
+  {   5616,  -5884,  -1471,   -695 },
+  {   6030,  -5089,  -1808,   -940 },
+  {   7444,  -5463,    -52,   1881 },
+  {   4207,  -6079,   -506,   1571 },
+  {   6785,  -4410,   -649,   3084 },
+  {   4838,  -5214,   2026,   2998 },
+  {   4201,  -5790,    645,   1811 },
+  {   6930,  -5129,  -1940,   1698 },
+  {   6332,  -4627,    692,   3027 },
+  {   6285,  -4314,   -106,   3644 },
+  {   6255,  -5450,  -1975,    742 },
+  {   4199,  -4676,   -459,   1796 },
+  {   5592,  -5500,   1345,   1300 },
+  {   4358,  -5556,  -2236,    114 },
+  {   4620,  -5875,  -1563,    888 },
+  {   4892,  -7550,   -327,   -419 },
+  {   4734,  -7085,      7,    613 },
+  {   3883,  -5562,  -1969,   1080 },
+  {   5610,  -4990,   -204,    834 },
+  {   4117,  -6482,  -1271,    341 },
+  {   6585,  -5107,    892,   1169 },
+  {   6632,  -3683,    302,   3002 },
+  {   6326,  -5351,   -983,  -1250 },
+  {   4382,  -7192,   -730,   -158 },
+  {   5227,  -6540,   -451,   1123 },
+  {   5468,  -6472,   -870,  -1471 },
+  {   5191,  -6402,  -1365,   -127 },
+  {   7407,  -6317,   -973,   -336 },
+  {   4611,  -6530,   -820,  -1980 },
+  {   4963,  -5159,  -2050,   -966 },
+  {   4414,  -5691,   -211,   -998 },
+  {   5954,  -5873,    750,  -1749 },
+  {   4394,  -4796,  -1268,    254 },
+  {   7161,  -6214,  -1010,    689 },
+  {   4965,  -3598,   2372,   1711 },
+  {   6248,  -6180,    981,    864 },
+  {   6473,  -5336,    525,   -600 },
+  {   4591,  -6864,  -1131,   -900 },
+  {   6314,  -6440,  -1021,   -375 },
+  {   5838,  -6209,  -1199,    944 },
+  {   5308,  -5283,  -2100,   1267 },
+  {   4342,  -5860,  -1637,  -1356 },
+  {   5680,  -4388,  -1227,   -104 },
+  {   4900,  -4098,   1449,   4046 },
+  {   4677,  -4284,   -106,   3190 },
+  {   7574,  -6173,   -848,   1859 },
+  {   6493,  -7207,   -131,    726 },
+  {   5513,  -5261,  -2117,      4 },
+  {   6191,  -7352,   -193,   -505 },
+  {   5885,  -4333,    324,   -134 },
+  {   6162,  -6081,   -312,  -2044 },
+  {   4216,  -6200,  -1810,   -572 },
+  {   5652,  -7035,   -696,   -197 },
+  {   7131,  -7189,   -366,    -60 },
+  {   5032,  -4803,  -1514,   2832 },
+  {   7386,  -4610,   -606,   3489 },
+  {   4211,  -5031,   1221,   3047 },
+  {   4050,  -4653,   1584,   1469 },
+  {   6852,  -5302,  -1861,    206 },
+  {   7736,  -4816,  -1794,   3359 },
+  {   6290,  -3439,   1522,   2454 },
+  {   1768,   5990,  -5560,  -2594 },
+  {   3903,   5326,  -1530,  -1501 },
+  {   2472,   3738,  -2117,  -4240 },
+  {   3260,   5448,   -904,  -4733 },
+  {   1435,   7297,  -3676,  -4102 },
+  {   4096,   5951,   -656,  -3312 },
+  {   2178,   6009,  -3146,  -3724 },
+  {   3787,   5493,  -5473,  -1633 },
+  {   2998,   7286,  -3334,  -3571 },
+  {   2894,   6576,  -4708,  -2804 },
+  {    830,   6163,  -4286,  -3348 },
+  {   4755,   5569,  -1730,  -2739 },
+  {   4604,   6065,  -3562,  -2605 },
+  {   2749,   5141,  -3986,  -2775 },
+  {   3942,   4875,  -2143,  -3340 },
+  {   2819,   8517,  -2004,  -2724 },
+  {   2146,   6298,   -689,  -3093 },
+  {   5196,   6504,  -3393,  -1475 },
+  {   1851,   8386,  -1748,  -1420 },
+  {   3474,   8572,  -3534,  -2688 },
+  {   4503,   7560,  -3561,  -2245 },
+  {   4433,   6219,  -2393,  -1575 },
+  {   3506,   7248,  -2275,  -1977 },
+  {   3490,   7409,  -3147,   -604 },
+  {   4214,   6447,  -3520,    516 },
+  {    619,   7034,   -829,  -1705 },
+  {   1732,   7395,   -356,  -2208 },
+  {   1226,   5204,  -3294,  -3732 },
+  {   2027,   5619,  -1813,  -4146 },
+  {   3078,   5877,     47,  -2651 },
+  {   1654,   5458,    424,   -682 },
+  {   3163,   5464,  -2026,   -270 },
+  {   2884,   5375,   -685,   -530 },
+  {   2950,   7286,    -35,  -2967 },
+  {   1986,   5066,   -597,    482 },
+  {   3459,   4308,  -3845,  -2333 },
+  {   3155,   7037,  -1346,  -4345 },
+  {   2193,   6696,   -717,  -1319 },
+  {   3677,   5089,  -3892,   -487 },
+  {   2186,   5136,  -4186,  -1492 },
+  {    773,   5796,   -917,    817 },
+  {   2489,   6546,  -3570,  -2117 },
+  {   1223,   6469,  -1362,    -33 },
+  {    271,   6061,  -1466,  -1725 },
+  {   2540,   5171,  -1847,   1032 },
+  {   2548,   5251,  -2697,   1677 },
+  {    771,   7600,   -768,   -632 },
+  {   4710,   6647,  -4736,  -1275 },
+  {   1369,   5917,  -2971,  -1056 },
+  {    163,   5239,  -3499,  -2275 },
+  {   2104,   4285,  -3211,  -3286 },
+  {   1107,   7411,  -1972,  -1671 },
+  {   2196,   7262,  -2310,  -1926 },
+  {   -244,   6439,  -1745,   -839 },
+  {   3293,   3832,  -2890,  -3000 },
+  {    419,   6443,   -379,   -407 },
+  {   3077,   4930,  -1156,  -2869 },
+  {   2131,   5874,  -2330,    224 },
+  {    690,   6538,  -2212,  -2841 },
+  {   1602,   4421,  -2515,   1542 },
+  {   3318,   9373,  -3032,  -3477 },
+  {   5646,   7462,  -5153,  -1463 },
+  {   4139,   7137,  -1539,  -3321 },
+  {   3481,   9077,  -1645,  -3653 },
+  {  -7747,    375,   -106,   -543 },
+  {  -8587,  -1379,   -586,   -461 },
+  { -10146,   -892,   2094,    694 },
+  {  -8103,    382,    504,   -325 },
+  {  -8548,    -92,     94,   -656 },
+  {  -7460,     38,    152,    388 },
+  {  -8266,   -271,   -459,   -883 },
+  {  -7935,   -664,  -1026,   -802 },
+  {  -8341,   -109,    853,    161 },
+  {  -8802,  -1355,   1099,    630 },
+  {  -8957,     -6,   1108,   -669 },
+  {  -7260,  -1520,    -43,   -407 },
+  {  -7555,   -174,    668,  -2562 },
+  {  -9014,   -126,    227,  -1191 },
+  {  -8184,    769,    290,  -1375 },
+  {  -9476,     55,    962,  -1528 },
+  {  -8679,    541,    755,  -1030 },
+  {  -9842,  -1626,    838,  -1588 },
+  {  -8513,   -702,    788,  -1998 },
+  { -10101,  -1558,   -366,  -1841 },
+  {  -8135,     78,   1479,  -1813 },
+  {  -9128,   -454,    313,  -1786 },
+  {  -7554,  -1084,    831,  -2442 },
+  {  -7576,   -701,   2068,  -1665 },
+  {  -7791,  -1481,   1587,  -1808 },
+  {  -6701,   -596,    -97,    802 },
+  {  -7418,    -15,    684,   -963 },
+  {  -7127,   -477,   -139,   -426 },
+  {  -8097,   -110,    -36,   -264 },
+  {  -7620,  -1922,   -590,   -101 },
+  {  -7647,  -1201,    279,    660 },
+  {  -7856,  -1974,    758,  -2271 },
+  {  -8496,   -167,   2232,  -1143 },
+  {  -8506,  -1359,    624,   -740 },
+  {  -7274,  -1052,   1062,   -139 },
+  {  -7800,   -217,     91,  -1794 },
+  {  -7030,  -1694,   -955,    615 },
+  {  -9020,  -1864,    101,  -2182 },
+  {  -9400,   -740,    598,   -667 },
+  {  -8448,  -1184,   2024,  -1272 },
+  {  -8812,   -570,   -897,  -2384 },
+  { -10559,  -1286,    538,  -1536 },
+  {  -8728,   -888,  -1089,  -1397 },
+  {  -7080,  -1185,    636,  -1252 },
+  {  -9880,    233,   2344,   -782 },
+  {  -7952,  -1326,   -378,  -1947 },
+  {  -7207,   -378,   1408,  -2237 },
+  {  -8467,  -1545,    902,  -1987 },
+  {  -9163,  -1474,    924,  -1739 },
+  {  -8159,   -992,    -77,  -2744 },
+  {  -8343,    148,   -423,  -1573 },
+  {  -9105,   -649,   -254,  -1214 },
+  {  -8939,    456,    281,  -1905 },
+  {  -8837,    179,   -394,  -2634 },
+  {  -9145,    757,   1547,  -1319 },
+  {  -9775,   -723,    441,  -1680 },
+  {  -8910,   -686,   1529,  -1525 },
+  {  -9492,  -1134,   2064,   -938 },
+  {  -6111,   -943,    677,    -31 },
+  {  -7411,   -613,   -814,     46 },
+  {  -9479,   -922,   -430,  -2061 },
+  { -11298,  -1268,   1318,  -1117 },
+  {  -8190,    832,    671,  -2214 },
+  { -10453,   -550,   1672,   -886 },
+  {   1044,   9353,  -1651,  -5423 },
+  {   1034,   8149,   -455,  -6166 },
+  {    761,   8293,  -3214,  -4838 },
+  {    938,   8077,    164,  -5130 },
+  {   1295,   8673,   2582,  -5490 },
+  {   -314,   7973,  -2395,  -5231 },
+  {   -507,   9012,  -2497,  -5775 },
+  {   2396,   8314,  -1022,  -4673 },
+  {  -1516,   8501,   1950,  -4969 },
+  {   -308,   7401,   1549,  -4866 },
+  {   -112,   8340,   3003,  -4920 },
+  {    -50,   9315,   1371,  -5666 },
+  {   -659,   9449,   2496,  -5547 },
+  {   2573,   9148,  -2270,  -4783 },
+  {    830,   7104,   -438,  -3907 },
+  {    522,  10672,   -677,  -6483 },
+  {  -1190,  10108,   -510,  -6518 },
+  {   -427,   8271,   -579,  -6315 },
+  {   1602,   8113,  -1927,  -4418 },
+  {  -2266,   8180,    448,  -5190 },
+  {  -1633,   8816,   -226,  -5771 },
+  {    759,   9481,   -105,  -5813 },
+  {   2254,   6679,   -466,  -5662 },
+  {    -88,   6946,    895,  -5958 },
+  {  -1705,  10009,   1394,  -5574 },
+  {    748,   7943,    540,  -6692 },
+  {   1411,   7009,    232,  -6145 },
+  {    697,   7290,  -1221,  -5342 },
+  {  -1764,  10580,   1944,  -3981 },
+  {  -1334,   9124,   1195,  -3903 },
+  {   -905,  10067,    635,  -5039 },
+  {    664,  10680,     49,  -4625 },
+  {   1374,   9536,   -777,  -3591 },
+  {    252,   9698,   -597,  -2931 },
+  {    824,   9164,  -1014,  -2144 },
+  {   2438,  10569,  -2289,  -4424 },
+  {   2101,   7102,    507,  -3614 },
+  {    294,   8051,   -432,  -1518 },
+  {   -665,  10337,    547,  -2852 },
+  {   1168,  11989,   -492,  -5427 },
+  {   1344,   6416,    302,  -5061 },
+  {  -1727,  12264,   1507,  -4543 },
+  {    674,  10889,   -902,  -3605 },
+  {   -582,   9504,    300,  -3618 },
+  {    641,   7654,    689,  -2109 },
+  {   2065,   9243,    508,  -4367 },
+  {   1055,   8373,    688,  -3144 },
+  {   -641,   8185,    986,  -3307 },
+  {   1120,   7426,   1785,  -3757 },
+  {   1660,   8070,   -593,  -3104 },
+  {   2002,   9467,  -1722,  -3475 },
+  {   2361,   8368,    100,  -3709 },
+  {   -772,   7845,   -613,  -4988 },
+  {   1485,   7430,   1896,  -6127 },
+  {   -432,   7823,   -947,  -2882 },
+  {    313,  11122,   -760,  -4871 },
+  {    412,   8412,   -283,  -4231 },
+  {   1585,  10402,  -1884,  -3267 },
+  {    321,   6952,    773,  -3016 },
+  {   -105,   9014,    121,  -2249 },
+  {   1585,  10313,   -977,  -4812 },
+  {   1619,  11869,   1306,  -6876 },
+  {  -1168,   8886,    -81,  -2500 },
+  {   -395,  10886,    733,  -6490 },
+  {  -4949,   4274,   3992,  -1054 },
+  {  -4241,   5299,   4262,  -1584 },
+  {  -2710,   3862,   4552,  -1673 },
+  {  -4608,   2472,   3672,  -1715 },
+  {  -2843,   2816,   4003,  -2326 },
+  {  -5229,   2964,   5636,     90 },
+  {  -4924,   3442,   5015,  -1096 },
+  {  -1281,   3313,   5537,  -2066 },
+  {  -3808,   1939,   4351,   -919 },
+  {  -1915,   2585,   4939,  -1614 },
+  {  -3470,   1843,   5562,   -682 },
+  {  -3800,    870,   5827,    144 },
+  {  -4985,   1452,   4728,   -709 },
+  {  -3745,   2750,   7220,    259 },
+  {  -1875,   1900,   6514,   -826 },
+  {  -4329,   1574,   7192,   1304 },
+  {  -5408,   1444,   6208,    631 },
+  {  -3327,   5312,   5707,  -1541 },
+  {  -6966,   3334,   4034,   1028 },
+  {  -7484,   4245,   4218,   -212 },
+  {  -6567,   5839,   4539,   -512 },
+  {  -5715,   5935,   3747,  -1186 },
+  {  -6410,   4881,   3356,  -1610 },
+  {  -5146,   2590,   2850,   2172 },
+  {  -5196,   4095,   2569,   -373 },
+  {  -5043,   6025,   4318,    692 },
+  {  -5525,   4884,   3513,    370 },
+  {  -6804,   7533,   5812,   -488 },
+  {  -5657,   2480,   4061,   1234 },
+  {  -3155,   1472,   6071,   1188 },
+  {  -3427,   5217,   3442,    858 },
+  {  -4698,   3013,   5517,   2586 },
+  {  -4449,   2226,   5418,   3580 },
+  {  -6395,   3547,   5487,   2028 },
+  {  -3500,   5019,   4787,      1 },
+  {  -4038,   2578,   3073,   3151 },
+  {  -2750,   1955,   4469,   3856 },
+  {  -5696,   1659,   6118,   2469 },
+  {  -4350,   1241,   6840,   3126 },
+  {  -5565,   5058,   5196,   1314 },
+  {  -1642,   4190,   3948,    607 },
+  {  -1233,   4108,   4850,   -640 },
+  {   -997,   3428,   3239,   1378 },
+  {  -6488,   2741,   6926,   2792 },
+  {  -4188,   3763,   4235,   2018 },
+  {  -3210,   3224,   5646,   1427 },
+  {  -5526,   6909,   5070,   -627 },
+  {  -2815,   3994,   3425,   1903 },
+  {  -2163,   2734,   5423,    145 },
+  {  -4149,   4247,   2355,    734 },
+  {   -410,   2521,   4138,    -16 },
+  {  -2411,   2385,   4927,   2105 },
+  {  -6077,   3591,   3114,    594 },
+  {  -4186,   4834,   5926,  -1004 },
+  {  -7315,   3369,   5966,    448 },
+  {  -7042,   5721,   5771,    238 },
+  {  -4466,   3907,   3535,  -1751 },
+  {  -2116,   3970,   6163,  -1392 },
+  {  -7239,   2143,   8407,   3630 },
+  {  -5431,   4486,   6486,    -42 },
+  {  -1874,   1617,   6333,    519 },
+  {  -6478,   2629,   4634,   -505 },
+  {  -7784,   2342,   7216,   1365 },
+  {  -1154,   1432,   4831,   1544 },
+  {  -4964,  -5801,   1797,    506 },
+  {  -4436,  -6905,   1059,  -1237 },
+  {  -5400,  -6886,    884,   -290 },
+  {  -6259,  -7103,    523,   -227 },
+  {  -4819,  -6450,   1412,   -450 },
+  {  -4056,  -6213,   1725,   -943 },
+  {  -5642,  -6091,   1357,    605 },
+  {  -4196,  -5678,   2187,   -173 },
+  {  -4726,  -5126,   2470,    321 },
+  {  -6642,  -5091,   1507,  -1005 },
+  {  -5304,  -5250,   1944,   1579 },
+  {  -7179,  -5520,   1468,   -425 },
+  {  -6033,  -4895,   1876,   -955 },
+  {  -6595,  -5143,   2207,   1291 },
+  {  -4224,  -4943,   1846,   1792 },
+  {  -7128,  -6950,    539,    724 },
+  {  -4369,  -4901,   2590,   1103 },
+  {  -7413,  -5696,   1712,   1440 },
+  {  -5885,  -6821,    418,    871 },
+  {  -6828,  -5599,    710,  -1563 },
+  {  -6123,  -5817,   1358,   1631 },
+  {  -5291,  -5622,    578,   2138 },
+  {  -7171,  -6004,    347,   2208 },
+  {  -6083,  -5251,   2132,    425 },
+  {  -4329,  -5721,    407,  -2993 },
+  {  -5326,  -5056,   1119,  -1837 },
+  {  -5485,  -5856,    185,  -2389 },
+  {  -6529,  -5178,    403,   -697 },
+  {  -6719,  -4412,   2726,    871 },
+  {  -5126,  -5629,   1835,   -771 },
+  {  -5622,  -4361,   2973,    858 },
+  {  -5282,  -5895,     45,   -335 },
+  {  -4357,  -5656,   1696,  -1558 },
+  {  -7139,  -6659,    627,   -409 },
+  {  -4415,  -6328,     35,   1306 },
+  {  -7639,  -6110,   1134,    197 },
+  {  -3626,  -5592,   2019,    901 },
+  {  -3547,  -5064,   1176,   1738 },
+  {  -5075,  -3899,   2087,    266 },
+  {  -4086,  -6311,   1479,    360 },
+  {  -6210,  -5220,   -199,  -1477 },
+  {  -3910,  -5063,   1356,    -15 },
+  {  -7616,  -4977,    461,   2401 },
+  {  -6118,  -6131,   1258,   -563 },
+  {  -6127,  -4968,   1286,    -27 },
+  {  -4121,  -5852,   1113,   1476 },
+  {  -5157,  -4881,   1162,   -662 },
+  {  -4637,  -5031,   1179,    709 },
+  {  -5509,  -5452,   -397,   1224 },
+  {  -4597,  -6861,    646,    467 },
+  {  -6247,  -4043,    468,    278 },
+  {  -5336,  -6465,    874,  -1472 },
+  {  -6998,  -6346,     78,  -1798 },
+  {  -4915,  -4530,   2756,   -203 },
+  {  -6048,  -4373,   1468,   1052 },
+  {  -4273,  -7100,    942,   -323 },
+  {  -6552,  -4287,   2351,     69 },
+  {  -6954,  -4613,    722,   1521 },
+  {  -4201,  -5361,    763,  -1562 },
+  {  -6881,  -5596,   -748,    669 },
+  {  -6695,  -3547,    -34,   1299 },
+  {  -3981,  -5728,     84,    111 },
+  {  -4663,  -4809,   2173,  -1031 },
+  {  -6599,  -6077,   1303,    256 },
+  {  -7596,  -4265,  -5791,  -4140 },
+  {  -6610,  -2758,  -5288,  -3936 },
+  {  -5880,  -3865,  -6563,  -3088 },
+  {  -7228,  -5510,  -7677,  -3912 },
+  {  -8854,  -6553,  -8318,  -5361 },
+  {  -9362,  -5249,  -6413,  -4319 },
+  {  -4418,  -3110,  -6368,  -4358 },
+  {  -5544,  -4203,  -6863,  -5013 },
+  {  -3056,  -4316,  -5567,  -3181 },
+  {  -3078,  -5999,  -5051,  -2657 },
+  {  -5884,  -6292,  -5756,  -4013 },
+  {  -4825,  -4549,  -5535,  -4053 },
+  {  -4443,  -6126,  -5316,  -1368 },
+  {  -3972,  -6341,  -6098,  -2686 },
+  {  -5751,  -2781,  -5398,  -6230 },
+  {  -4466,  -6135,  -5570,  -3679 },
+  {  -4291,  -5992,  -3564,  -5189 },
+  {  -7189,  -4429,  -7279,  -6082 },
+  {  -5076,  -4433,  -2748,  -5366 },
+  {  -6225,  -2825,  -6833,  -5663 },
+  {  -2989,  -4792,  -3960,  -4492 },
+  {  -7836,  -7773,  -7722,  -5741 },
+  {  -6559,  -5703,  -5844,  -5589 },
+  {  -7612,  -5438,  -4136,  -3774 },
+  {  -4218,  -4176,  -6591,  -2333 },
+  {  -4837,  -5063,  -6581,    322 },
+  {  -6590,  -5990,  -2980,  -3847 },
+  {  -5558,  -2971,  -5489,  -1932 },
+  {  -7001,  -5323,  -4975,  -1697 },
+  {  -4694,  -2688,  -6904,  -3044 },
+  {  -8511,  -5379,  -5767,  -2549 },
+  {  -7548,  -5412,  -6522,  -2572 },
+  {  -6597,  -4973,  -6423,  -1274 },
+  {  -6415,  -4022,  -5168,  -1072 },
+  {  -5528,  -5530,  -7218,  -2345 },
+  {  -4845,  -4805,  -5943,  -1227 },
+  {  -6049,  -7150,  -6744,  -2161 },
+  {  -9061,  -7299,  -8542,  -4375 },
+  {  -5010,  -5546,  -5416,    -82 },
+  {  -4135,  -4205,  -5109,  -3373 },
+  {  -3311,  -5869,  -4007,  -5061 },
+  {  -5993,  -6472,  -3962,  -4718 },
+  {  -2966,  -5832,  -2821,  -6305 },
+  {  -4851,  -5152,  -2067,  -3930 },
+  {  -3620,  -4441,  -3362,  -5836 },
+  {  -4469,  -5221,  -4534,  -5592 },
+  {  -4022,  -6335,  -4321,  -6107 },
+  {  -4899,  -4503,  -3084,  -3725 },
+  {  -4490,  -8276,  -4620,  -6236 },
+  {  -6591,  -4342,  -7365,  -4063 },
+  {  -6498,  -5057,  -5553,    485 },
+  {  -6060,  -2714,  -7093,  -4144 },
+  {  -6199,  -7774,  -7094,  -4057 },
+  {  -7536,  -6424,  -6415,  -4265 },
+  {  -7439,  -2454,  -6348,  -4827 },
+  {  -5333,  -7565,  -4417,  -4639 },
+  {  -4353,  -7103,  -4197,  -2689 },
+  {  -5229,  -6549,  -5129,  -6804 },
+  {  -6129,  -7701,  -5236,  -4836 },
+  {  -6797,  -3983,  -3884,  -4406 },
+  {  -6624,  -4467,  -4745,  -5052 },
+  {  -3324,  -7596,  -2720,  -6553 },
+  {  -5473,  -6284,  -1704,  -4511 },
+  {  -4131,  -7263,  -3180,  -5196 },
+  {  -7116,  -5565,  -3469,    685 },
+  {  -6002,  -6021,  -3858,    576 },
+  {  -3144,  -8203,  -1291,   -434 },
+  {  -6096,  -7027,  -4004,   1353 },
+  {  -3943,  -7709,  -2344,    -36 },
+  {  -4510,  -6767,  -2642,    631 },
+  {  -3657, -11541,  -2570,  -3984 },
+  {  -5959,  -8854,  -1333,   -867 },
+  {  -6699,  -8866,  -1606,   -344 },
+  {  -3836,  -7961,  -2334,  -2028 },
+  {  -3430,  -8045,  -3037,   -672 },
+  {  -3868,  -9184,  -3635,  -1819 },
+  {  -4258,  -9060,  -2621,  -1008 },
+  {  -3595,  -8693,  -2022,   -752 },
+  {  -4573,  -8048,  -3166,  -2622 },
+  {  -4852,  -7903,  -1405,    256 },
+  {  -4591,  -7057,  -1560,    965 },
+  {  -6963,  -7655,   -980,    808 },
+  {  -5179,  -6641,  -3356,   1196 },
+  {  -7102,  -6941,  -2798,   2123 },
+  {  -6867,  -5834,  -3320,   -770 },
+  {  -5977,  -7369,  -2500,   -778 },
+  {  -6160,  -6400,   -934,  -2543 },
+  {  -6741,  -7608,   -355,  -1289 },
+  {  -6856,  -6466,  -1433,  -1643 },
+  {  -4786,  -6292,  -4970,    376 },
+  {  -5407,  -8866,  -2255,   -400 },
+  {  -3814,  -6506,  -1387,  -3620 },
+  {  -4998,  -6137,  -1200,  -4092 },
+  {  -5123,  -9557,  -2849,  -1306 },
+  {  -4259,  -6444,  -4395,   -338 },
+  {  -5221,  -6810,   -883,   1225 },
+  {  -6137,  -6215,  -2165,    554 },
+  {  -3895,  -6557,  -3176,  -1829 },
+  {  -3886,  -8188,    -87,   -954 },
+  {  -7243,  -6707,  -2216,   -316 },
+  {  -5592,  -7606,     85,   -432 },
+  {  -3957,  -7945,   -504,   -144 },
+  {  -4617,  -7624,    218,   -312 },
+  {  -4797,  -8737,   -844,  -1051 },
+  {  -4478,  -8516,  -1401,   -454 },
+  {  -4557,  -7058,   -302,  -2332 },
+  {  -6623,  -7736,   -271,    -50 },
+  {  -3157,  -7532,  -1111,  -2207 },
+  {  -3590,  -7300,  -1271,    517 },
+  {  -4442,  -7306,   -507,    590 },
+  {  -6458,  -7524,  -2807,    666 },
+  {  -4991,  -8466,  -3363,   -785 },
+  {  -7474,  -7541,  -1056,  -1839 },
+  {  -7501,  -8316,   -938,   -180 },
+  {  -5329,  -7739,   -579,  -2341 },
+  {  -4549,  -7063,   -176,  -3539 },
+  {  -5191,  -8612,  -1504,  -4250 },
+  {  -3083,  -7058,  -2251,     32 },
+  {  -4003,  -7043,  -1093,   -791 },
+  {  -5523,  -8093,   -678,   -114 },
+  {  -3022, -10265,  -2070,  -3109 },
+  {  -3905,  -6274,   -182,  -3652 },
+  {  -3269,  -9217,   -551,  -2650 },
+  {  -3138,  -9314,  -1726,  -1704 },
+  {  -4420, -10339,  -1744,  -3459 },
+  {  -4163,  -8609,  -2298,  -4113 },
+  {  -5566,  -6505,  -1241,   -463 },
+  {  -3130,  -9746,  -2352,  -4884 },
+  {  -7825,  -3439,   1451,  -1468 },
+  {  -8451,  -3318,   2360,   -435 },
+  {  -8462,  -4130,   1438,  -1024 },
+  {  -9425,  -4564,   1328,   -689 },
+  { -11014,  -3202,   2278,   2080 },
+  {  -8269,  -2761,   -146,   -440 },
+  {  -7497,  -2618,   -166,    413 },
+  {  -8250,  -3060,    522,  -2133 },
+  {  -8365,  -5366,   1347,   -451 },
+  {  -8589,  -3979,   2943,    714 },
+  {  -8111,  -2572,   1272,  -1748 },
+  {  -7830,  -5193,    605,  -1484 },
+  {  -8119,  -4736,   2141,    256 },
+  {  -7724,  -4769,   1463,   -812 },
+  {  -7363,  -3911,   2540,      4 },
+  {  -7974,  -3397,   2363,   1366 },
+  {  -7359,  -4204,   1752,   -958 },
+  {  -7622,  -3505,    660,    916 },
+  {  -9934,  -3665,   3165,    828 },
+  {  -8721,  -4162,     62,   1718 },
+  {  -9433,  -4768,   2722,   1234 },
+  {  -7960,  -4496,    138,   1528 },
+  {  -8198,  -3454,   -443,    631 },
+  {  -7756,  -2246,    655,   1137 },
+  {  -8841,  -3145,   1113,    829 },
+  {  -7817,  -3298,   1251,    230 },
+  {  -9413,  -2733,    323,  -1862 },
+  {  -9408,  -4168,   1270,   1549 },
+  {  -9037,  -3892,   -942,    283 },
+  {  -8255,  -3849,   1301,   1762 },
+  {  -9057,  -3987,    -41,   -682 },
+  {  -9441,  -4187,   2019,   -111 },
+  {  -9740,  -3178,   1602,   -871 },
+  {  -8344,  -2474,   1461,   1506 },
+  {  -9752,  -2925,   1996,   1243 },
+  {  -9199,  -3796,    180,    537 },
+  {  -9060,  -2405,   1140,  -1562 },
+  {  -9348,  -2376,    309,   -162 },
+  { -10786,  -3182,     -5,  -1500 },
+  {  -8142,  -4540,   -434,   -826 },
+  {  -7528,  -2341,   1104,    -73 },
+  {  -9360,  -2658,   3062,     56 },
+  {  -8267,  -2335,   2000,  -1193 },
+  { -12169,  -3154,   1287,   -640 },
+  { -11398,  -2120,    946,  -1163 },
+  {  -8940,  -4559,    328,  -1696 },
+  { -11025,  -4213,   2813,    840 },
+  {  -9224,  -3581,   2224,   2039 },
+  {  -8943,  -3337,   1248,  -1298 },
+  {  -7900,  -4042,    485,  -2080 },
+  {  -9221,  -1947,   2191,   -880 },
+  { -10762,  -1800,   2516,   -324 },
+  { -10095,  -2238,    981,  -1335 },
+  { -11908,  -2808,   3255,    645 },
+  { -10640,  -4105,   1283,   -595 },
+  {  -7663,  -2863,   2467,   -797 },
+  { -10712,  -3854,   3710,   1538 },
+  { -10823,  -2893,   1408,   -801 },
+  {  -9874,  -3832,    256,  -1638 },
+  { -10394,  -3391,   2315,    -94 },
+  { -11525,  -4079,   4153,   2122 },
+  {  -9546,  -2088,   1541,    481 },
+  {  -8731,  -2433,   1042,   2160 },
+  {  -7852,  -3977,  -1370,   1677 },
+  {   7072,  -3420,   1398,  -1741 },
+  {   6180,  -1976,   1280,  -3557 },
+  {   7692,  -1793,   2844,  -1700 },
+  {   8363,  -1773,   3104,  -2679 },
+  {   9213,  -3266,   3756,  -3542 },
+  {   9650,  -2644,   1426,  -1318 },
+  {   7712,  -2796,   3686,  -1975 },
+  {   7316,  -3517,   2821,   -622 },
+  {   7434,  -2594,   2305,  -2264 },
+  {   7237,  -1797,    255,  -3114 },
+  {   8663,  -1983,   1338,  -3056 },
+  {   6616,   -952,   4059,  -2652 },
+  {   8823,  -1327,   1362,  -1356 },
+  {   9938,  -1722,   1287,  -2362 },
+  {   7207,  -1057,   1913,  -1315 },
+  {   7508,  -1585,    870,  -1982 },
+  {   8217,  -3680,   1417,  -3170 },
+  {   8329,  -2541,   1684,   -585 },
+  {   8062,  -2335,    252,  -2800 },
+  {   8204,  -4108,   3097,  -2569 },
+  {   7701,  -3367,    576,  -3008 },
+  {   7350,   -786,   2414,  -2129 },
+  {   6948,  -2568,   1607,   -225 },
+  {   7684,  -2387,   1308,  -3449 },
+  {   8306,  -3458,   2394,  -1454 },
+  {   8438,  -2781,   1043,  -1362 },
+  {   9175,  -2076,   2144,  -1987 },
+  {   8347,  -2709,   3489,  -4301 },
+  {   5696,  -2377,   2870,    851 },
+  {   8825,  -1243,   2219,  -2603 },
+  {   8801,  -1614,    584,  -2513 },
+  {   8413,   -384,   1421,  -2244 },
+  {   9228,  -3050,   3279,  -2164 },
+  {   6342,  -2698,   3547,   -107 },
+  {  10053,  -2476,   2837,  -3168 },
+  {   7439,   -604,   3177,  -3991 },
+  {   7749,  -1064,   4329,  -4855 },
+  {   8655,  -2177,   2252,  -3519 },
+  {   8490,   -228,   1958,  -3233 },
+  {  10513,  -2968,   1911,  -2340 },
+  {   8146,   -862,   1884,  -1723 },
+  {   7788,   -666,   3004,  -2891 },
+  {   7785,  -1620,   4133,  -3417 },
+  {  10262,  -3731,   3455,  -2971 },
+  {   8570,   -905,   4519,  -4649 },
+  {   9129,  -2562,    463,  -2465 },
+  {   9451,  -3587,   1904,  -3056 },
+  {   6549,  -2236,   3010,  -4523 },
+  {   7175,  -2684,   2967,  -3458 },
+  {   9872,  -3278,   1054,  -2472 },
+  {   9153,   -931,   1217,  -2565 },
+  {   8789,  -3469,    753,  -2568 },
+  {   6683,  -3791,   1797,  -3968 },
+  {   6801,  -1977,   2311,   -452 },
+  {   6336,  -1572,   2612,  -3264 },
+  {   7996,  -1008,    730,  -2964 },
+  {   7521,  -1059,   1573,  -3694 },
+  {   8148,  -3973,   2600,  -3572 },
+  {   7765,  -1532,   2528,  -3856 },
+  {   7404,  -3918,   4472,   -143 },
+  {   8894,  -1398,   3299,  -3685 },
+  {   5768,  -2041,   1487,   -637 },
+  {   5131,  -2865,   2463,   -811 },
+  {   6439,  -1568,   3500,  -1550 },
+  {  -8878,  -6798,  -5319,  -1452 },
+  {  -6332,  -9713,  -3112,   -990 },
+  {  -8444,  -6316,  -3694,   -687 },
+  {  -6123, -10840,  -3637,  -4358 },
+  {  -4784,  -9580,  -4577,  -2581 },
+  {  -6108, -10515,  -4859,  -2524 },
+  {  -7605,  -7518,  -2327,  -2797 },
+  {  -9662,  -8775,  -2467,  -2010 },
+  {  -6494,  -7523,  -4715,   -118 },
+  {  -8290,  -8982,  -1672,   -317 },
+  {  -8798, -11051,  -3888,  -1426 },
+  {  -6273,  -6623,  -6791,   -142 },
+  {  -8313,  -7668,  -2141,  -1275 },
+  {  -6453,  -8412,  -3589,  -4102 },
+  {  -6747,  -7750,  -5690,  -2498 },
+  {  -7814,  -6693,  -3174,  -2446 },
+  { -10383, -10130,  -3931,  -2364 },
+  { -10606,  -8467,  -5539,  -2772 },
+  {  -9475,  -6671,  -3305,  -2271 },
+  {  -8982,  -9457,  -5635,  -4005 },
+  { -10111,  -7965,  -6515,  -4180 },
+  {  -7301,  -6479,  -5364,    720 },
+  {  -9543,  -8999,  -7921,   -912 },
+  {  -9534,  -8562,  -3469,   -384 },
+  {  -7601, -10344,  -3205,  -1127 },
+  {  -8088,  -8620,  -4954,  -2888 },
+  {  -8202,  -8406,  -7038,  -3775 },
+  {  -7312,  -8324,  -3334,  -1775 },
+  {  -8566,  -9262,  -8071,  -4174 },
+  {  -7068, -11300,  -5573,  -2907 },
+  {  -8295,  -8952,  -4366,  -1544 },
+  { -11104, -10210,  -2285,   -384 },
+  {  -5213,  -7520,  -5008,  -1339 },
+  {  -5889,  -7940,  -5987,  -1385 },
+  { -10816,  -8201,  -4153,  -1485 },
+  { -10277,  -8919,  -6315,  -1652 },
+  {  -5888, -10320,  -3821,  -1733 },
+  { -10497,  -7181,  -6083,  -3032 },
+  {  -7721,  -9724,  -6591,  -5336 },
+  {  -5688,  -7894,  -3486,  -2552 },
+  { -10014, -10500,  -3247,   -820 },
+  {  -6301,  -8765,  -4506,  -2923 },
+  {  -8261,  -7847,  -6213,  -1552 },
+  { -10212,  -7481,  -8113,  -3954 },
+  {  -6938, -10874,  -6074,  -4703 },
+  {  -7183, -10968,  -4446,  -1773 },
+  {  -7120,  -9193,  -1966,  -2509 },
+  {  -6234,  -9263,  -2313,  -4284 },
+  {  -8503,  -9857,  -2429,   -608 },
+  {  -9372,  -7844,  -8391,  -2120 },
+  {  -7951,  -7157,  -6535,    -11 },
+  {  -7256,  -9473,  -2172,   -660 },
+  { -10063,  -9612,  -2515,    -15 },
+  {  -6684,  -9134,  -6109,  -4206 },
+  {  -8204, -11932,  -5220,  -2306 },
+  {  -9710,  -6706,  -4115,  -3275 },
+  {  -6855,  -7078,  -2409,  -4447 },
+  {  -7344,  -7673,  -4479,  -4116 },
+  {  -8851,  -6842,  -4927,  -2948 },
+  {  -8927, -10452,  -5633,  -2194 },
+  {  -8627,  -9002,  -7176,  -1575 },
+  {  -8209,  -9722,  -7021,  -3324 },
+  {  -3770, -10249,  -3623,  -4816 },
+  {  -8183,  -7465,  -4090,    646 },
+  {  -8163,  -7149,    200,    498 },
+  {  -8289,  -6266,    686,   -206 },
+  { -10030,  -6241,  -1032,  -1864 },
+  {  -8793,  -8327,   -773,   -169 },
+  {  -9149,  -6215,    969,    -15 },
+  {  -8303,  -5859,     -7,   2006 },
+  {  -9682,  -7283,    255,   1322 },
+  {  -9293,  -7227,     71,   -231 },
+  {  -8525,  -6215,    287,   -837 },
+  { -10477,  -5379,   1159,   1449 },
+  { -10726,  -7856,   -130,    102 },
+  {  -8694,  -7461,  -1210,    690 },
+  {  -9367,  -5324,   1103,   3170 },
+  { -10686,  -8055,   -831,   1633 },
+  {  -9201,  -6873,  -2704,   2258 },
+  {  -8421,  -5358,  -1405,    226 },
+  {  -9066,  -5830,   -307,  -1571 },
+  { -11150,  -7381,  -2746,   -900 },
+  {  -9978,  -5925,  -2006,   -437 },
+  {  -9464,  -4741,   -273,   1061 },
+  { -10543,  -6684,  -1113,   1660 },
+  { -10073,  -5576,   1083,   -269 },
+  {  -8826,  -5763,   1600,   1486 },
+  { -10445,  -9071,  -1253,    -64 },
+  { -12085,  -5799,      2,    769 },
+  { -12939,  -6663,   1650,   1437 },
+  { -10932,  -6434,  -1252,   -649 },
+  { -11650,  -7826,  -2053,    710 },
+  { -12122,  -6733,  -1889,   -731 },
+  {  -9093,  -6095,  -2463,   -842 },
+  { -10977,  -4364,    469,    420 },
+  { -11488,  -6908,   -521,    893 },
+  {  -9669,  -5478,   -842,    337 },
+  { -10606,  -5203,   -632,  -1361 },
+  { -10198,  -6284,   1662,   1277 },
+  { -10135,  -5292,   2435,   3493 },
+  { -11027,  -6561,    655,     56 },
+  { -10977,  -5030,   1127,   -358 },
+  { -12766,  -3986,   1348,   -335 },
+  { -14244,  -7731,    264,    317 },
+  { -15124, -10309,   -508,   1447 },
+  { -12821,  -8638,   -608,    137 },
+  { -13076,  -8693,  -2852,   -431 },
+  { -11156,  -5546,  -2252,  -1600 },
+  {  -8692,  -7366,   -819,  -1223 },
+  { -12507,  -9816,  -1714,   -121 },
+  { -10712,  -6666,    544,   3349 },
+  { -12462,  -5890,  -2491,  -2318 },
+  { -12468,  -7226,    437,    232 },
+  { -11300,  -5226,   2068,    687 },
+  { -11994,  -8320,   -626,   2728 },
+  { -12222,  -5476,   1142,     18 },
+  { -10277,  -8122,  -2418,   2003 },
+  { -13418,  -6115,  -3563,  -2802 },
+  { -14759,  -9834,  -1243,     21 },
+  { -13699,  -5665,   1525,    507 },
+  { -16269,  -9476,   -701,    163 },
+  { -12677,  -5437,   -247,  -1019 },
+  { -11827,  -4295,   -181,  -1243 },
+  { -12847,  -4496,   2984,   1123 },
+  { -13860,  -7915,  -1166,   -547 },
+  { -12276,  -8145,  -2290,  -1527 },
+  { -11417,  -4830,   2983,   1854 },
+  { -11793,  -6002,   1163,   1940 },
+  {  11443,  -4920,  -3235,   3151 },
+  {  11300,  -6616,  -1506,   1175 },
+  {   9198,  -4628,  -2060,   2390 },
+  {  10532,  -4027,   -643,    912 },
+  {   9902,  -3573,  -1606,   1327 },
+  {   9653,  -3536,  -2240,   1869 },
+  {   9948,  -5171,   -423,   2662 },
+  {  12316,  -4004,  -1989,    281 },
+  {  12125,  -4800,  -1265,   -163 },
+  {  10650,  -2617,  -2337,   1462 },
+  {   9909,  -4968,  -2376,    916 },
+  {  12944,  -4647,  -1958,    460 },
+  {  12988,  -5283,  -1141,     41 },
+  {  12321,  -2915,  -3621,   1025 },
+  {  11449,  -2894,  -2728,    351 },
+  {  12087,  -3041,  -2002,    -32 },
+  {  11558,  -4031,  -1343,   -399 },
+  {  12983,  -3740,  -3516,   1245 },
+  {  12099,  -2515,  -2752,    225 },
+  {  12515,  -3465,  -2701,    550 },
+  {  14683,  -5022,  -5272,   2996 },
+  {  12260,  -3383,  -1215,   -528 },
+  {  13810,  -5422,  -2443,   1166 },
+  {  13421,  -5378,  -1886,    721 },
+  {  12961,  -4259,  -2594,    796 },
+  {  12266,  -2104,  -4768,   1591 },
+  {  13523,  -4710,  -3045,   1342 },
+  {  12437,  -2099,  -5610,   2117 },
+  {  11850,  -2183,  -3497,    661 },
+  {  12275,  -3936,   -597,   -697 },
+  {  12459,  -5253,   -517,   -544 },
+  {  12835,  -4094,  -1322,   -168 },
+  {  14360,  -5677,  -3305,   1859 },
+  {  13905,  -4552,  -4309,   2117 },
+  {  11559,  -3412,  -1847,    -81 },
+  {  13379,  -3167,  -5764,   2746 },
+  {  11910,  -1634,  -4342,   1052 },
+  {  12662,  -4742,     71,   -974 },
+  {  13057,  -3254,  -4424,   1705 },
+  {  15046,  -5706,  -4851,   3019 },
+  {  14162,  -4142,  -5514,   2843 },
+  {  12764,  -1845,  -6684,   2888 },
+  {  13714,  -2374,  -7838,   3857 },
+  {  13295,  -1663,  -8293,   4073 },
+  {  10032,  -4152,  -3403,   1421 },
+  {  10942,  -5386,  -2222,    950 },
+  {  10532,  -6385,  -1750,   1925 },
+  {  10273,  -5972,  -1534,    643 },
+  {  10605,  -4782,  -1695,     27 },
+  {  10988,  -5153,  -1123,   -341 },
+  {  11629,  -5884,  -1060,     48 },
+  {  10441,  -4045,  -2431,    311 },
+  {  10788,  -3595,  -4171,   1807 },
+  {  12110,  -5686,  -2127,    976 },
+  {  11746,  -4773,  -2639,    891 },
+  {  11541,  -5299,  -3031,   1732 },
+  {  11416,  -2559,  -5359,   2198 },
+  {  11583,  -5376,   -704,    677 },
+  {  10416,  -3214,  -3516,    872 },
+  {   9651,  -5435,  -1618,   3255 },
+  {   9973,  -5133,   -996,   3923 },
+  {  11707,  -4643,   -430,   -796 },
+  {  10994,  -2709,  -3587,   2302 },
+  {  10716,  -5118,   -645,    270 },
+  {  14100, -10314,   1095,   1531 },
+  {  12944,  -8049,   1105,   -741 },
+  {  13276,  -7035,   -511,    274 },
+  {  14008,  -7254,   -283,    139 },
+  {  11594,  -6536,    -91,   1671 },
+  {  11732,  -8645,    746,     15 },
+  {  14613,  -7085,  -1578,   1183 },
+  {  13083,  -6224,   -750,     -4 },
+  {  13988,  -6256,  -1592,    820 },
+  {  14678,  -8683,    441,    126 },
+  {  15571,  -8872,   -521,   1139 },
+  {  15642,  -9533,    341,    697 },
+  {  15960,  -9586,   -168,   1121 },
+  {  15464, -10239,   1433,     -1 },
+  {  14934,  -7887,  -1046,   1080 },
+  {  15252,  -7630,  -1899,   1628 },
+  {  15485,  -8384,  -1234,   1484 },
+  {  15962,  -8638,  -1815,   1931 },
+  {  16501, -10664,    398,   1167 },
+  {  16146, -10145,    411,    918 },
+  {  14573,  -7475,   -697,    601 },
+  {  14302,  -7996,     28,    257 },
+  {  14769,  -6792,  -2286,   1574 },
+  {  14144,  -6137,  -2169,   1257 },
+  {  14770,  -6271,  -3111,   1933 },
+  {  14110,  -8312,   1083,   -531 },
+  {  15235,  -6991,  -2993,   2174 },
+  {  13222,  -5805,    547,   -891 },
+  {  14796,  -8762,   1254,   -246 },
+  {  16040,  -9181,  -1005,   1551 },
+  {  16487, -10086,   -373,   1420 },
+  {  15077,  -9479,    966,     51 },
+  {  13026,  -6468,    932,  -1080 },
+  {  12703,  -6152,    -33,   -573 },
+  {  15641,  -6810,  -4128,   2874 },
+  {  13282,  -7673,   1583,  -1283 },
+  {  12373,  -7150,   1512,   -917 },
+  {  12992,  -7751,   -678,    783 },
+  {  10907,  -6858,   -313,   2597 },
+  {  13026,  -8963,    125,   2152 },
+  {  12770,  -9946,   1957,   -505 },
+  {  12482,  -6849,  -1268,    833 },
+  {  13790,  -6181,   -138,   -279 },
+  {  12709,  -8382,   2044,    227 },
+  {  12244,  -6630,    203,   -457 },
+  {  14209,  -6816,  -1032,    632 },
+  {  15134,  -8267,   -288,    640 },
+  {  13619,  -6157,  -1090,    356 },
+  {  14044,  -7413,    725,   -484 },
+  {  12958,  -7753,   2585,  -1980 },
+  {  13188,  -8396,   2306,  -1558 },
+  {  14379,  -9980,   2132,   -688 },
+  {  14275,  -9857,   1162,    179 },
+  {  13690,  -8648,   1621,   -889 },
+  {  11770,  -6829,   -746,    278 },
+  {  12732,  -8202,    286,     90 },
+  {  13630, -10146,   1867,   -207 },
+  {  12072,  -8740,   1299,   -645 },
+  {  12852,  -9492,   1226,     62 },
+  {  11792,  -7382,    -54,   -116 },
+  {  13779,  -9014,    487,    351 },
+  {  11951,  -7729,    121,    834 },
+  {  11970,  -9781,   2276,     -4 },
+  {  12680,  -7984,   2787,   -787 },
+  {  13300, -14488,   6408,  -1927 },
+  {  13635, -15355,   9153,  -3073 },
+  {  12804, -13566,   5517,  -1625 },
+  {  16624, -10854,   1690,     28 },
+  {  20387, -18532,   6162,   -261 },
+  {  16515, -12642,   3392,   -519 },
+  {  15800, -11095,   2151,   -202 },
+  {  16824, -11790,   1651,    599 },
+  {  17604, -13213,   2563,    538 },
+  {  17892, -14177,   3562,    147 },
+  {  16987, -11399,    869,   1052 },
+  {  17003, -12456,   2442,    265 },
+  {  21657, -21806,   9198,  -1250 },
+  {  16825, -13341,   3980,   -686 },
+  {  17525, -12714,   1887,    805 },
+  {  16419, -11034,   1216,    617 },
+  {  20931, -19939,   7469,   -684 },
+  {  18452, -15390,   4573,   -191 },
+  {  14778, -10077,   2841,  -1209 },
+  {  17402, -13319,   3042,    160 },
+  {  19365, -17922,   7087,  -1061 },
+  {  16298, -11941,   2810,   -351 },
+  {  19087, -16176,   4775,    -84 },
+  {  17666, -12289,    938,   1224 },
+  {  18581, -15894,   5132,   -430 },
+  {  19823, -16717,   4142,    545 },
+  {  19960, -19423,   8400,  -1492 },
+  {  18973, -16817,   5906,   -594 },
+  {  19079, -15431,   3528,    503 },
+  {  16667, -12485,   4467,  -1302 },
+  {  19791, -17797,   6196,   -529 },
+  {  20005, -17606,   5354,    -20 },
+  {  20123, -18599,   6886,   -728 },
+  {  19068, -14805,   2394,   1105 },
+  {  14443, -13723,   5631,  -2029 },
+  {  14730, -14231,   5631,  -1450 },
+  {  16089, -15959,   7271,  -2029 },
+  {  13473, -11200,   3236,   -924 },
+  {  14413, -10902,   2347,   -267 },
+  {  17666, -18662,  11381,  -3496 },
+  {  14749, -11042,   3305,   -275 },
+  {  15304, -10486,   1869,   -240 },
+  {  14809, -12126,   3369,   -616 },
+  {  16896, -16561,   7307,  -1845 },
+  {  15782, -14336,   5380,  -1264 },
+  {  16395, -15520,   6415,  -1588 },
+  {  13681, -11114,   2584,   -320 },
+  {  14244, -12326,   4480,  -1632 },
+  {  15247, -13119,   4265,   -898 },
+  {  13987, -12091,   3469,   -597 },
+  {  13941, -12770,   4240,   -839 },
+  {  13771, -13627,   5252,  -1384 },
+  {  15010, -16074,   7592,  -2249 },
+  {  15852, -17226,   8619,  -2655 },
+  {  18921, -16916,   6875,  -1501 },
+  {  14909, -11678,   2768,   -295 },
+  {  18988, -18353,   8424,  -2070 },
+  {  15457, -15080,   6218,  -1513 },
+  {  14916, -15512,   6949,  -1883 },
+  {  18108, -14702,   4681,   -701 },
+  {  17600, -15733,   5616,   -775 },
+  {  14070, -13683,   6472,  -2626 },
+  {  13832, -11914,   5201,  -2232 },
+  {  18846, -19009,   9192,  -1961 },
+  { -11981, -10994,  -6324,  -2264 },
+  { -10976,  -9047,  -6546,  -3828 },
+  { -11288, -10532,  -7014,  -4191 },
+  { -10139, -10189,  -7799,  -2688 },
+  { -10555,  -9988,  -9181,  -2040 },
+  { -11596, -11339, -10022,  -2707 },
+  { -13400, -13395, -11306,  -4206 },
+  {  -9774, -12281,  -7466,  -4133 },
+  { -10842, -13125,  -8777,  -4956 },
+  { -11964, -15082,  -9779,  -5095 },
+  {  -9382, -10188,  -9053,  -4927 },
+  { -11562, -11296,  -3651,   -985 },
+  {  -9287, -10083,  -7918,  -4069 },
+  { -12821, -16556, -11410,  -6195 },
+  { -12628,  -8959,  -4521,  -1113 },
+  { -13845, -11581,  -3649,   -681 },
+  { -12685, -10269,  -5483,  -1275 },
+  { -14988, -12874,  -5107,  -1189 },
+  { -13761, -11367,  -6202,  -1804 },
+  { -13225, -11249,  -7820,  -3354 },
+  { -14809, -11992,  -3202,   -312 },
+  { -15620, -15519, -10210,  -3433 },
+  { -12954, -10200,  -3139,   -611 },
+  { -11536,  -9981,  -5284,   -923 },
+  { -13034, -12417,  -4612,  -1098 },
+  { -16911, -15505,  -6123,  -1352 },
+  { -17396, -17685,  -8330,  -2171 },
+  { -14120, -10764,  -2265,    -99 },
+  { -12598,  -7367,  -5406,  -3530 },
+  { -14143, -12793, -10909,  -5226 },
+  { -14692, -16871, -11626,  -5554 },
+  { -12581, -11197,  -9194,  -3837 },
+  { -16752, -16726,  -9746,  -2808 },
+  { -10600, -10358,  -6560,  -1227 },
+  { -14573, -13312,  -8957,  -3393 },
+  { -10172,  -8463,  -8579,  -3387 },
+  { -11418, -12421,  -5522,  -1842 },
+  { -11855, -14204,  -6669,  -2625 },
+  { -13308,  -8191,  -3941,  -2194 },
+  { -10007, -12266,  -5022,  -1811 },
+  { -13532, -15771,  -9497,  -3175 },
+  { -11760, -11148, -10339,  -5529 },
+  { -12149, -12763, -11198,  -3697 },
+  { -12029, -12119,  -8555,  -1792 },
+  { -16995, -19957, -11447,  -3471 },
+  { -13144, -14504,  -9988,  -3191 },
+  {  -9938, -11064,  -6139,  -3162 },
+  {  -8873, -11550,  -8294,  -6550 },
+  {  -9303, -13010,  -6150,  -2711 },
+  { -15463, -10469,  -1766,   -170 },
+  { -15985, -11693,  -3007,   -650 },
+  { -17142, -10671,  -1434,     47 },
+  { -16063, -13858,  -4817,  -1058 },
+  { -19446, -19599,  -9594,  -2464 },
+  { -20076, -18744,  -8313,  -1889 },
+  { -15047, -16085,  -7590,  -2250 },
+  { -13481, -16195,  -8552,  -2998 },
+  { -13829, -14869,  -6704,  -1932 },
+  { -16357, -18484,  -9802,  -2959 },
+  { -10551,  -8393,  -9303,  -5070 },
+  { -11345,  -9156,  -5641,  -3107 },
+  { -13217, -13449,  -9270,  -4541 },
+  { -11988, -13732,  -9995,  -6374 },
+  { -11007,  -9519,  -5168,  -4107 },
+  {   9930,  -7858,   8061,  -4375 },
+  {   8274,  -7867,   5992,  -2096 },
+  {   9692,  -9675,   7621,  -3670 },
+  {   9589,  -8110,   6509,  -3010 },
+  {  12617, -11976,  10122,  -5360 },
+  {  11867,  -8895,   7948,  -5323 },
+  {  10388, -10482,   9234,  -4324 },
+  {   8188,  -8220,   7810,  -2737 },
+  {  10407,  -8787,   4806,  -1930 },
+  {  10348,  -8845,   9233,  -6614 },
+  {   9422,  -7091,   4820,  -2878 },
+  {   9758,  -9796,   5584,  -2256 },
+  {  10188,  -7994,   5347,  -3343 },
+  {  11133,  -7455,   4015,  -2306 },
+  {  10676, -10744,   6093,  -2629 },
+  {  11522, -12184,   7848,  -3375 },
+  {   8805,  -9883,   5317,  -3071 },
+  {   9498,  -9654,   6555,  -3592 },
+  {  10488,  -8008,   4066,  -1252 },
+  {  11261,  -8930,   6068,  -2738 },
+  {  12180, -10397,   5027,  -1531 },
+  {   9138,  -8531,   3601,  -1959 },
+  {   8107,  -8380,   4970,  -2061 },
+  {   9737, -13248,   6438,  -2617 },
+  {  11178, -10423,   2622,   -522 },
+  {   9572, -12372,   5199,  -2019 },
+  {  12057, -12144,   4147,  -1099 },
+  {   9047,  -9925,   2516,   -665 },
+  {  10790,  -8030,   5882,  -4386 },
+  {   7199,  -8426,   6337,  -2841 },
+  {   7778,  -8285,   3529,  -3442 },
+  {   7559, -10569,   3484,  -1332 },
+  {   9404,  -8115,   7484,  -5541 },
+  {   7792, -11976,   5546,  -2573 },
+  {   9313, -10264,   7661,  -5195 },
+  {   6701, -10725,   4370,  -1784 },
+  {   4918, -11361,   4507,  -4527 },
+  {   5147, -12305,   3978,  -5556 },
+  {   6525,  -9899,   4481,  -3129 },
+  {   7538, -12855,   6060,  -4826 },
+  {   8659, -12111,   7159,  -4430 },
+  {   8440, -11304,   4547,  -1747 },
+  {   9216, -10918,   3507,  -1195 },
+  {   6165,  -9254,   4771,  -4677 },
+  {   9163, -11019,   5637,  -4935 },
+  {  13441, -11509,   6676,  -2434 },
+  {   7912,  -9398,   6663,  -4048 },
+  {  11723, -13745,   8131,  -4148 },
+  {   6065, -10257,   5005,  -6327 },
+  {  11618, -12417,   5336,  -1894 },
+  {   8891, -13924,   8407,  -6131 },
+  {   9622, -12563,   7908,  -5109 },
+  {  11479, -10315,   8349,  -3991 },
+  {  11676, -14103,   6611,  -2330 },
+  {  11951,  -8953,   3829,  -1550 },
+  {  10486,  -8044,  10493,  -5920 },
+  {  11801, -10769,   9763,  -5305 },
+  {   6109,  -8676,   5827,  -1346 },
+  {   7030,  -9611,   5624,  -5761 },
+  {  12808, -12886,   8683,  -4148 },
+  {  13213, -10464,   6381,  -3189 },
+  {  11796, -13681,  10703,  -6075 },
+  {   9639,  -7949,   9625,  -3944 },
+  {   8538,  -6997,   5309,    453 }
 };
 
 /* quantization tables */
@@ -4226,2054 +4226,2054 @@ static const float lossless_quant_d[32] = {
 
 static const int8_t high_freq_vq[1024][32] =
 {
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22,
-    2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9 },
-  { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9,
-    -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15 },
-  { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0,
-    8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4 },
-  { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6,
-    -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14 },
-  { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1,
-    3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8 },
-  { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14,
-    -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2 },
-  { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3,
-    -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20 },
-  { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1,
-    -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2 },
-  { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24,
-    18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4 },
-  { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15,
-    -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5 },
-  { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13,
-    -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14 },
-  { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4,
-    -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 },
-  { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27,
-    18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 },
-  { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7,
-    -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3 },
-  { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2,
-    -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2 },
-  { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6,
-    -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4 },
-  { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15,
-    -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 },
-  { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11,
-    29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 },
-  { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1,
-    -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3 },
-  { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10,
-    -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 },
-  { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4,
-    24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 },
-  { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0,
-    0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1 },
-  { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3,
-    -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 },
-  { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0,
-    -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6 },
-  { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3,
-    13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0 },
-  { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3,
-    -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0 },
-  { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1,
-    0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7 },
-  { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5,
-    1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4 },
-  { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2,
-    45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1 },
-  { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4,
-    34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 },
-  { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38,
-    15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1 },
-  { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1,
-    2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 },
-  { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6,
-    -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19 },
-  { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10,
-    2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 },
-  { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10,
-    -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14 },
-  { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0,
-    8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9 },
-  { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0,
-    8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10 },
-  { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8,
-    -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 },
-  { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4,
-    -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8 },
-  { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2,
-    -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15 },
-  { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1,
-    0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23 },
-  { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1,
-    0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16 },
-  { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10,
-    -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 },
-  { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7,
-    -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 },
-  { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10,
-    -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4 },
-  { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6,
-    -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1 },
-  { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9,
-    -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7 },
-  { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3,
-    -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 },
-  { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1,
-    -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2 },
-  { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2,
-    -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1 },
-  { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1,
-    -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4 },
-  { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21,
-    4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 },
-  { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4,
-    0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18 },
-  { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1,
-    8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 },
-  { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2,
-    5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0 },
-  { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1,
-    3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10 },
-  { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7,
-    -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 },
-  { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6,
-    -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1 },
-  { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5,
-    -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21 },
-  { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0,
-    -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10 },
-  { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6,
-    13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16 },
-  { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5,
-    -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3 },
-  { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1,
-    -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5 },
-  { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7,
-    -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 },
-  { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5,
-    -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1 },
-  { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8,
-    -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 },
-  { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3,
-    4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 },
-  { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9,
-    -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 },
-  { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10,
-    -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2 },
-  { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5,
-    -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 },
-  { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2,
-    -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 },
-  { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2,
-    3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 },
-  { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5,
-    3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 },
-  { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22,
-    2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11 },
-  { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2,
-    6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 },
-  { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4,
-    1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18 },
-  { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15,
-    -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 },
-  { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4,
-    6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 },
-  { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1,
-    2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5 },
-  { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7,
-    11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 },
-  { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8,
-    -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 },
-  { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10,
-    -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5 },
-  { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4,
-    0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 },
-  { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3,
-    6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 },
-  { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8,
-    0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 },
-  { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14,
-    13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 },
-  { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4,
-    -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 },
-  { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2,
-    -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 },
-  { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1,
-    7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 },
-  { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1,
-    6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1 },
-  { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5,
-    -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17 },
-  { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4,
-    -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 },
-  { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4,
-    2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 },
-  { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5,
-    -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 },
-  { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5,
-    -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 },
-  { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1,
-    -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19 },
-  { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22,
-    8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11 },
-  { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3,
-    -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16 },
-  { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2,
-    16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2 },
-  { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4,
-    12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5 },
-  { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1,
-    1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9 },
-  { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3,
-    7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13 },
-  { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1,
-    0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7 },
-  { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4,
-    3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3 },
-  { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1,
-    11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2 },
-  { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11,
-    3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2 },
-  { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2,
-    0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27 },
-  { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5,
-    3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4 },
-  { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8,
-    -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10 },
-  { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2,
-    1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8 },
-  { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2,
-    -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8 },
-  { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6,
-    -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12 },
-  { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7,
-    18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9 },
-  { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5,
-    -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1 },
-  { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7,
-    6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6 },
-  { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0,
-    -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1 },
-  { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3,
-    -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11 },
-  { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4,
-    -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2 },
-  { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2,
-    4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1 },
-  { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3,
-    -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8 },
-  { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8,
-    7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6 },
-  { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6,
-    3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4 },
-  { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3,
-    9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12 },
-  { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1,
-    0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7 },
-  { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2,
-    4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5 },
-  { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1,
-    8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18 },
-  { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4,
-    1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12 },
-  { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5,
-    8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10 },
-  { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11,
-    2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9 },
-  { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9,
-    22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8 },
-  { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18,
-    -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1 },
-  { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6,
-    -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6 },
-  { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17,
-    37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3 },
-  { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6,
-    2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3 },
-  { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9,
-    -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5 },
-  { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7,
-    -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1,
-    -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4,
-    -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1,
-    15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 },
-  { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33,
-    10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2 },
-  { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1,
-    11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
-    2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0 },
-  { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10,
-    -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3 },
-  { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1,
-    -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 },
-  { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18,
-    -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4 },
-  { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5,
-    2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 },
-  { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5,
-    8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28 },
-  { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18,
-    4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5 },
-  { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0,
-    -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1 },
-  { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9,
-    -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8 },
-  { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9,
-    -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9 },
-  { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9,
-    0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8 },
-  { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12,
-    12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5 },
-  { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3,
-    27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12 },
-  { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28,
-    2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8 },
-  { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27,
-    14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
-    5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1,
-    4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1,
-    6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6 },
-  { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1,
-    10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 },
-  { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0,
-    11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3 },
-  { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3,
-    -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6 },
-  { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14,
-    4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 },
-  { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9,
-    -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1 },
-  { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17,
-    16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 },
-  { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10,
-    -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 },
-  { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7,
-    6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4 },
-  { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3,
-    0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 },
-  { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3,
-    -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10 },
-  { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11,
-    -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3 },
-  { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7,
-    4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2 },
-  { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1,
-    -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5 },
-  { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4,
-    -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 },
-  { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4,
-    -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0 },
-  { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4,
-    -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 },
-  { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15,
-    -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3 },
-  { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4,
-    0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 },
-  { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7,
-    -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1 },
-  { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3,
-    6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 },
-  { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6,
-    -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2 },
-  { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4,
-    -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1 },
-  { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7,
-    -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 },
-  { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3,
-    6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 },
-  { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15,
-    -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0 },
-  { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7,
-    7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1 },
-  { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1,
-    -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4 },
-  { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13,
-    -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 },
-  { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10,
-    -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7 },
-  { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15,
-    4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7 },
-  { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15,
-    -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 },
-  { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7,
-    -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 },
-  { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9,
-    -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5 },
-  { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4,
-    10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4 },
-  { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19,
-    0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3 },
-  { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12,
-    -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2 },
-  { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3,
-    6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0 },
-  { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9,
-    1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9 },
-  { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1,
-    3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 },
-  { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7,
-    5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1 },
-  { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7,
-    1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1 },
-  { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5,
-    4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3 },
-  { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11,
-    16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1 },
-  { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4,
-    -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 },
-  { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0,
-    4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 },
-  { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5,
-    7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16 },
-  { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7,
-    9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4 },
-  { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8,
-    1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2 },
-  { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0,
-    2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10 },
-  { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4,
-    13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8 },
-  { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21,
-    2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8 },
-  { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1,
-    27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3 },
-  { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4,
-    5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10 },
-  { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0,
-    1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2 },
-  { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8,
-    2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3 },
-  { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8,
-    -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14 },
-  { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2,
-    2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7 },
-  { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2,
-    -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 },
-  { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6,
-    -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 },
-  { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11,
-    5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3 },
-  { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4,
-    0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 },
-  { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3,
-    3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2 },
-  { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2,
-    -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 },
-  { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6,
-    1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 },
-  { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5,
-    -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 },
-  { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3,
-    -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0 },
-  { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0,
-    3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 },
-  { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10,
-    -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 },
-  { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6,
-    11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 },
-  { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18,
-    1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7 },
-  { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2,
-    4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9 },
-  { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9,
-    2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 },
-  { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11,
-    9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4 },
-  { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8,
-    3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 },
-  { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1,
-    -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 },
-  { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4,
-    6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 },
-  { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4,
-    -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 },
-  { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0,
-    -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 },
-  { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2,
-    -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10 },
-  { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2,
-    -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7 },
-  { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6,
-    10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10 },
-  { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2,
-    2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1 },
-  { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9,
-    -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 },
-  { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12,
-    15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 },
-  { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17,
-    11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3 },
-  { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5,
-    12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1 },
-  { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4,
-    -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4 },
-  { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4,
-    -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 },
-  { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16,
-    13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 },
-  { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4,
-    -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 },
-  { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6,
-    3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 },
-  { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6,
-    -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 },
-  { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14,
-    2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 },
-  { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7,
-    5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 },
-  { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4,
-    -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3 },
-  { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10,
-    12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 },
-  { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3,
-    14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1 },
-  { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18,
-    11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 },
-  { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2,
-    4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 },
-  { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7,
-    7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 },
-  { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11,
-    9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4 },
-  { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11,
-    -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2 },
-  { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4,
-    13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1 },
-  { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18,
-    16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12 },
-  { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20,
-    14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 },
-  { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10,
-    16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4 },
-  { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17,
-    7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12 },
-  { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9,
-    2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4 },
-  { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3,
-    6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 },
-  { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25,
-    3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0 },
-  { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0,
-    11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4 },
-  { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10,
-    3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11 },
-  { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21,
-    8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 },
-  { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10,
-    -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 },
-  { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13,
-    5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4 },
-  { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7,
-    -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 },
-  { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4,
-    1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 },
-  { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18,
-    -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4 },
-  { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4,
-    -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 },
-  { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11,
-    4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6 },
-  { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10,
-    1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 },
-  { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21,
-    7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 },
-  { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17,
-    16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13 },
-  { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16,
-    23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 },
-  { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26,
-    5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 },
-  { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4,
-    32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7 },
-  { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51,
-    4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 },
-  { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8,
-    11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4 },
-  { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6,
-    -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9 },
-  { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9,
-    -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 },
-  { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25,
-    7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5 },
-  { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15,
-    5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6 },
-  { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8,
-    -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1 },
-  { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15,
-    -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7 },
-  { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18,
-    0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 },
-  { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4,
-    -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16 },
-  { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7,
-    6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 },
-  { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7,
-    0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 },
-  { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3,
-    -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18 },
-  { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1,
-    4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 },
-  { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7,
-    -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11 },
-  { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19,
-    -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5 },
-  { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1,
-    15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 },
-  { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4,
-    -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4 },
-  { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3,
-    -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7 },
-  { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1,
-    4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2 },
-  { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4,
-    8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5 },
-  { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4,
-    3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 },
-  { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1,
-    -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7 },
-  { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10,
-    -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 },
-  { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7,
-    -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 },
-  { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10,
-    -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18 },
-  { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4,
-    4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 },
-  { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3,
-    -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 },
-  { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8,
-    0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 },
-  { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5,
-    32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 },
-  { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6,
-    -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7 },
-  { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10,
-    -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 },
-  { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5,
-    -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 },
-  { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12,
-    -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3 },
-  { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2,
-    11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5 },
-  { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1,
-    1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1 },
-  { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2,
-    -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8 },
-  { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3,
-    -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1,
-    0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 },
-  { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18,
-    15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0,
-    -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1 },
-  { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1,
-    -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 },
-  { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4,
-    -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0 },
-  { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0,
-    3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2 },
-  { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3,
-    56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 },
-  { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8,
-    2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9 },
-  { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16,
-    -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5 },
-  { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25,
-    -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4 },
-  { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1,
-    -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2 },
-  { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11,
-    10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28 },
-  { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0,
-    -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3 },
-  { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1,
-    1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2 },
-  { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2,
-    -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2 },
-  { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11,
-    -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12 },
-  { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7,
-    -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
-    3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
-    13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
-    3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
-    13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
-  { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13,
-    -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7 },
-  { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8,
-    -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17 },
-  { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7,
-    36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11 },
-  { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11,
-    8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6 },
-  { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8,
-    30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2 },
-  { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5,
-    -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5 },
-  { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15,
-    24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 },
-  { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0,
-    24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1 },
-  { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4,
-    10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 },
-  { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1,
-    -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 },
-  { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1,
-    10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 },
-  { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19,
-    3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17 },
-  { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2,
-    8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5 },
-  { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
-    -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
-  { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
-    -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
-  { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
-    -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
-  { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
-    7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
-  { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
-    0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
-  { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
-    -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
-    11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
-  { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
-    -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
-  { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
-    -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
-  { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
-    -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
-  { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
-    7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
-  { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
-    0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
-  { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
-    -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
-    11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
-  { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4,
-    3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 },
-  { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7,
-    0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2 },
-  { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4,
-    3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 },
-  { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17,
-    -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 },
-  { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8,
-    -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7 },
-  { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4,
-    4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 },
-  { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1,
-    12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4 },
-  { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1,
-    0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 },
-  { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2,
-    8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0 },
-  { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0,
-    -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5 },
-  { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5,
-    3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 },
-  { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17,
-    9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 },
-  { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6,
-    -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2 },
-  { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16,
-    3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1 },
-  { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15,
-    6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 },
-  { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4,
-    2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1 },
-  { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9,
-    24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 },
-  { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19,
-    2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9 },
-  { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14,
-    7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10 },
-  { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9,
-    8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 },
-  { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5,
-    10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2 },
-  { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4,
-    8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 },
-  { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8,
-    7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 },
-  { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9,
-    4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 },
-  { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12,
-    7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1 },
-  { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4,
-    -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3 },
-  { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0,
-    6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 },
-  { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12,
-    7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 },
-  { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2,
-    16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14 },
-  { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11,
-    -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11 },
-  { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8,
-    -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13 },
-  { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2,
-    -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 },
-  { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5,
-    -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 },
-  { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5,
-    -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 },
-  { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4,
-    -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10 },
-  { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2,
-    -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3 },
-  { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3,
-    1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10 },
-  { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12,
-    -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3 },
-  { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9,
-    -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 },
-  { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30,
-    2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1 },
-  { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16,
-    0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10 },
-  { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5,
-    -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5 },
-  { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3,
-    4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6 },
-  { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13,
-    8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6 },
-  { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1,
-    -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1 },
-  { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1,
-    -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 },
-  { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3,
-    -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4 },
-  { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1,
-    -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 },
-  { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11,
-    -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5 },
-  { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6,
-    -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4 },
-  { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4,
-    5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6 },
-  { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6,
-    -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4 },
-  { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7,
-    6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1 },
-  { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3,
-    -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 },
-  { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15,
-    -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 },
-  { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4,
-    7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2 },
-  { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9,
-    -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 },
-  { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14,
-    -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2 },
-  { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1,
-    -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 },
-  { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4,
-    -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1 },
-  { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9,
-    0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6 },
-  { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4,
-    2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8 },
-  { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16,
-    0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6 },
-  { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13,
-    13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3 },
-  { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4,
-    -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 },
-  { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17,
-    3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 },
-  { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5,
-    -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 },
-  { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7,
-    -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3 },
-  { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7,
-    -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 },
-  { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1,
-    -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 },
-  { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4,
-    -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7 },
-  { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7,
-    16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6 },
-  { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1,
-    10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12 },
-  { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6,
-    7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11 },
-  { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4,
-    -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 },
-  { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0,
-    -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 },
-  { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6,
-    3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 },
-  { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1,
-    2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7 },
-  { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2,
-    0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12 },
-  { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15,
-    18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 },
-  { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2,
-    -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6 },
-  { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11,
-    11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7 },
-  { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8,
-    7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 },
-  { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3,
-    -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16 },
-  { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12,
-    -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13 },
-  { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0,
-    5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 },
-  { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14,
-    9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6 },
-  { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2,
-    17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7 },
-  { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6,
-    -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6 },
-  { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6,
-    -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 },
-  { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2,
-    3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 },
-  { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16,
-    -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1 },
-  { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19,
-    6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4 },
-  { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11,
-    -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 },
-  { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13,
-    9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5 },
-  { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2,
-    -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6 },
-  { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11,
-    5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3 },
-  { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7,
-    21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 },
-  { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8,
-    23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,
-    35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0,
-    41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0 },
-  { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7,
-    10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7 },
-  { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7,
-    23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5,
-    -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 },
-  { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40,
-    10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1 },
-  { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0,
-    4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 },
-  { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
-    1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
-  { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
-    -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
-  { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
-    -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
-  { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
-    10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
-  { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
-    -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
-    6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
-  { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
-    22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
-  { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
-    -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
-  { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
-    37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
-    1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
-  { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
-    -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
-  { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
-    -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
-  { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
-    10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
-  { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
-    -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
-    6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
-  { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
-    22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
-  { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
-    -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
-  { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
-    37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5,
-    0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 },
-  { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7,
-    -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11 },
-  { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5,
-    9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 },
-  { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12,
-    -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 },
-  { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2,
-    -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 },
-  { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1,
-    -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15 },
-  { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7,
-    -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5 },
-  { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9,
-    8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 },
-  { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4,
-    -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 },
-  { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12,
-    -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0 },
-  { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17,
-    -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4 },
-  { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2,
-    0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11 },
-  { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7,
-    11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 },
-  { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5,
-    -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12 },
-  { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9,
-    9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 },
-  { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2,
-    0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 },
-  { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5,
-    5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 },
-  { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14,
-    -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7 },
-  { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7,
-    -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 },
-  { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0,
-    -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2 },
-  { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8,
-    4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 },
-  { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1,
-    1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 },
-  { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1,
-    7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 },
-  { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1,
-    8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16 },
-  { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8,
-    -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 },
-  { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16,
-    0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 },
-  { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8,
-    -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 },
-  { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4,
-    10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1 },
-  { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6,
-    8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6 },
-  { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1,
-    2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 },
-  { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3,
-    3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7 },
-  { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4,
-    0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 },
-  { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2,
-    -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 },
-  { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6,
-    -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4 },
-  { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2,
-    13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1 },
-  { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2,
-    8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4 },
-  { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3,
-    14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2 },
-  { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4,
-    7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 },
-  { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4,
-    -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 },
-  { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4,
-    -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 },
-  { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3,
-    3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 },
-  { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7,
-    -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1 },
-  { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0,
-    -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11 },
-  { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12,
-    -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5 },
-  { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2,
-    0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5 },
-  { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13,
-    -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10 },
-  { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3,
-    17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2 },
-  { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0,
-    -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13 },
-  { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5,
-    5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 },
-  { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10,
-    1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2 },
-  { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21,
-    3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 },
-  { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5,
-    12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0 },
-  { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5,
-    -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6 },
-  { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3,
-    -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4 },
-  { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2,
-    -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13 },
-  { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10,
-    -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 },
-  { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4,
-    1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 },
-  { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13,
-    8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5 },
-  { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19,
-    3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4 },
-  { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2,
-    -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 },
-  { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8,
-    7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 },
-  { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7,
-    -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 },
-  { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6,
-    -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 },
-  { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11,
-    -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 },
-  { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8,
-    -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 },
-  { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6,
-    7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 },
-  { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1,
-    0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 },
-  { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1,
-    1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 },
-  { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7,
-    5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 },
-  { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1,
-    2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 },
-  { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3,
-    -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 },
-  { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12,
-    -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 },
-  { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14,
-    -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10 },
-  { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2,
-    4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3 },
-  { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11,
-    3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 },
-  { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12,
-    -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7 },
-  { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2,
-    9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 },
-  { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4,
-    0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 },
-  { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2,
-    -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 },
-  { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5,
-    -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5 },
-  { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9,
-    9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 },
-  { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5,
-    -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0 },
-  { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1,
-    4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7 },
-  { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2,
-    1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11 },
-  { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0,
-    5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9 },
-  { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8,
-    -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 },
-  { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4,
-    6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9 },
-  { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4,
-    -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7 },
-  { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11,
-    0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12 },
-  { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8,
-    -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 },
-  { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6,
-    -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7 },
-  { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8,
-    3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12 },
-  { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6,
-    -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2 },
-  { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2,
-    9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6 },
-  { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3,
-    1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8 },
-  { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1,
-    -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 },
-  { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2,
-    -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 },
-  { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7,
-    6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16 },
-  { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5,
-    -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 },
-  { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10,
-    -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3 },
-  { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3,
-    1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8 },
-  { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5,
-    2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4 },
-  { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14,
-    0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 },
-  { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3,
-    1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 },
-  { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2,
-    6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6 },
-  { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11,
-    0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5 },
-  { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25,
-    0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 },
-  { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16,
-    12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 },
-  { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0,
-    0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0 },
-  { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14,
-    -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12 },
-  { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2,
-    0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 },
-  { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5,
-    3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 },
-  { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12,
-    1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 },
-  { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0,
-    0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 },
-  { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0,
-    6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6 },
-  { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4,
-    5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1 },
-  { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13,
-    16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14 },
-  { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7,
-    26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16 },
-  { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17,
-    7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 },
-  { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1,
-    9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3 },
-  { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7,
-    10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3 },
-  { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0,
-    7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10 },
-  { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1,
-    1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3 },
-  { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9,
-    -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 },
-  { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9,
-    -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 },
-  { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8,
-    9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17 },
-  { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3,
-    1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 },
-  { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7,
-    12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 },
-  { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5,
-    -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 },
-  { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20,
-    7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4 },
-  { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2,
-    -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 },
-  { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7,
-    -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 },
-  { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7,
-    4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4 },
-  { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7,
-    -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3 },
-  { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2,
-    -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5 },
-  { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2,
-    3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 },
-  { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2,
-    6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 },
-  { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6,
-    -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 },
-  { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5,
-    7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 },
-  { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1,
-    9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 },
-  { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10,
-    -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4 },
-  { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4,
-    -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3 },
-  { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6,
-    11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1 },
-  { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7,
-    -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1 },
-  { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13,
-    -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8 },
-  { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5,
-    -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 },
-  { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6,
-    22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8 },
-  { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4,
-    -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 },
-  { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4,
-    6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4 },
-  { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7,
-    -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11 },
-  { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15,
-    -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6 },
-  { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1,
-    -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1 },
-  { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7,
-    -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6 },
-  { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3,
-    -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 },
-  { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1,
-    -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4 },
-  { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1,
-    3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 },
-  { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7,
-    1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 },
-  { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3,
-    -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 },
-  { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1,
-    -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7 },
-  { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5,
-    5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3 },
-  { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26,
-    -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4 },
-  { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3,
-    -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 },
-  { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5,
-    7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 },
-  { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18,
-    3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 },
-  { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2,
-    5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 },
-  { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2,
-    4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 },
-  { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3,
-    -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10 },
-  { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5,
-    -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 },
-  { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2,
-    -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1 },
-  { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3,
-    -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 },
-  { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12,
-    9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3 },
-  { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4,
-    4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 },
-  { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6,
-    -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 },
-  { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9,
-    8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8 },
-  { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7,
-    4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5 },
-  { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4,
-    -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1 },
-  { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3,
-    -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 },
-  { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2,
-    1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10 },
-  { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2,
-    -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1 },
-  { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10,
-    -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 },
-  { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8,
-    -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15 },
-  { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8,
-    8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 },
-  { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3,
-    -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 },
-  { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5,
-    5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 },
-  { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15,
-    2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7 },
-  { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9,
-    1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 },
-  { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7,
-    -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 },
-  { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4,
-    4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5 },
-  { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1,
-    2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2 },
-  { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9,
-    9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2 },
-  { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6,
-    5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3 },
-  { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15,
-    -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 },
-  { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0,
-    1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5 },
-  { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4,
-    -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 },
-  { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3,
-    -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7 },
-  { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18,
-    8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 },
-  { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9,
-    14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9 },
-  { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2,
-    3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 },
-  { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6,
-    -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 },
-  { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7,
-    8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 },
-  { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7,
-    18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 },
-  { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5,
-    -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 },
-  { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10,
-    1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 },
-  { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0,
-    5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28 },
-  { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3,
-    1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1 },
-  { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19,
-    1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10 },
-  { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2,
-    22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16 },
-  { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6,
-    10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 },
-  { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2,
-    -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 },
-  { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1,
-    10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 },
-  { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4,
-    8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11 },
-  { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6,
-    16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 },
-  { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1,
-    11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 },
-  { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3,
-    29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 },
-  { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5,
-    16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1 },
-  { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10,
-    0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 },
-  { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2,
-    5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 },
-  { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8,
-    2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 },
-  { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4,
-    6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3 },
-  { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8,
-    -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 },
-  { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1,
-    0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15 },
-  { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2,
-    -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3 },
-  { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4,
-    4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5 },
-  { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0,
-    8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6 },
-  { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10,
-    6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4 },
-  { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6,
-    -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 },
-  { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4,
-    -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 },
-  { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3,
-    8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 },
-  { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1,
-    -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 },
-  { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10,
-    3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 },
-  { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5,
-    8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 },
-  { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3,
-    -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 },
-  { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8,
-    -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 },
-  { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17,
-    -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 },
-  { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5,
-    0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 },
-  { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10,
-    -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6 },
-  { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18,
-    7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 },
-  { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6,
-    -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4 },
-  { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10,
-    -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 },
-  { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2,
-    -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5 },
-  { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6,
-    -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8 },
-  { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1,
-    6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1 },
-  { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1,
-    12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 },
-  { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10,
-    10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 },
-  { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0,
-    2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 },
-  { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2,
-    0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11 },
-  { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12,
-    9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 },
-  { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6,
-    -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 },
-  { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5,
-    -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 },
-  { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22,
-    6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 },
-  { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7,
-    5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 },
-  { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7,
-    -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5 },
-  { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3,
-    -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2 },
-  { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6,
-    -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14 },
-  { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11,
-    -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 },
-  { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1,
-    -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 },
-  { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0,
-    -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50 },
-  { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9,
-    -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26 },
-  { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1,
-    -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27 },
-  { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5,
-    0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26 },
-  { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11,
-    9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29 },
-  { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1,
-    2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27 },
-  { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6,
-    -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29 },
-  { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4,
-    3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31 },
-  { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27,
-    -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21 },
-  { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1,
-    -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17 },
-  { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2,
-    -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36 },
-  { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1,
-    -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28 },
-  { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2,
-    16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20 },
-  { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4,
-    3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32 },
-  { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9,
-    -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24 },
-  { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8,
-    0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33 },
-  { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13,
-    -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30 },
-  { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5,
-    -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40 },
-  { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5,
-    9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24 },
-  { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2,
-    11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29 },
-  { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2,
-    3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35 },
-  { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18,
-    9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26 },
-  { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4,
-    1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38 },
-  { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1,
-    -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28 },
-  { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18,
-    -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30 },
-  { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3,
-    -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26 },
-  { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5,
-    0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25 },
-  { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8,
-    20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23 },
-  { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6,
-    8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43 },
-  { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10,
-    -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30 },
-  { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9,
-    0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28 },
-  { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1,
-    -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70 },
-  { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15,
-    -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1 },
-  { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10,
-    8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13 },
-  { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0,
-    9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15 },
-  { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1,
-    -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9 },
-  { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5,
-    2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6 },
-  { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4,
-    -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3 },
-  { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7,
-    -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14 },
-  { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1,
-    -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2 },
-  { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1,
-    -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0 },
-  { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6,
-    5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3 },
-  { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5,
-    -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6 },
-  { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1,
-    -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5 },
-  { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2,
-    1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12 },
-  { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1,
-    -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2 },
-  { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3,
-    8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1 },
-  { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1,
-    0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2 },
-  { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2,
-    -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4 },
-  { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2,
-    9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1 },
-  { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0,
-    -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5 },
-  { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12,
-    -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5 },
-  { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2,
-    0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4 },
-  { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2,
-    9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6 },
-  { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6,
-    -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4 },
-  { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6,
-    2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4 },
-  { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1,
-    -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6 },
-  { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11,
-    -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4 },
-  { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11,
-    3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1 },
-  { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7,
-    4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11 },
-  { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4,
-    -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4 },
-  { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4,
-    -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5 },
-  { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31,
-    2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2 },
-  { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13,
-    -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4 },
-  { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9,
-    -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 },
-  { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15,
-    -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11 },
-  { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21,
-    -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15 },
-  { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8,
-    -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12 },
-  { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17,
-    3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 },
-  { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15,
-    -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12 },
-  { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3,
-    -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7 },
-  { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4,
-    8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7 },
-  { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16,
-    -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12 },
-  { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2,
-    -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5 },
-  { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10,
-    -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15 },
-  { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18,
-    -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10 },
-  { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1,
-    2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1 },
-  { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1,
-    -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5 },
-  { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20,
-    5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 },
-  { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5,
-    -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 },
-  { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16,
-    -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3 },
-  { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3,
-    -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 },
-  { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7,
-    3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7 },
-  { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0,
-    -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12 },
-  { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1,
-    -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9 },
-  { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25,
-    14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 },
-  { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12,
-    -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2 },
-  { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3,
-    -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3 },
-  { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21,
-    7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 },
-  { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23,
-    -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 },
-  { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5,
-    5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7 },
-  { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13,
-    -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 },
-  { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15,
-    -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 },
-  { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45,
-    -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3 },
-  { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6,
-    5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 },
-  { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17,
-    -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6 },
-  { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5,
-    -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1 },
-  { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1,
-    -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4 },
-  { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4,
-    -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3 },
-  { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6,
-    -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7 },
-  { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5,
-    -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1 },
-  { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0,
-    -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 },
-  { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5,
-    -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 },
-  { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5,
-    -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2 },
-  { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11,
-    -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 },
-  { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13,
-    -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1 },
-  { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0,
-    -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8 },
-  { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6,
-    -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10 },
-  { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3,
-    1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 },
-  { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6,
-    -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2 },
-  { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4,
-    -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7 },
-  { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6,
-    -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9 },
-  { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27,
-    -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5 },
-  { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7,
-    -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 },
-  { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0,
-    -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1 },
-  { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2,
-    -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4 },
-  { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26,
-    -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 },
-  { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3,
-    -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7 },
-  { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20,
-    -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10 },
-  { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7,
-    -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0 },
-  { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14,
-    -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13 },
-  { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8,
-    -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 },
-  { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13,
-    -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13 },
-  { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17,
-    -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1 },
-  { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9,
-    -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 },
-  { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8,
-    -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4 },
-  { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7,
-    -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2 },
-  { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4,
-    -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2 },
-  { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19,
-    -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3 },
-  { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8,
-    -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 },
-  { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1,
-    -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 },
-  { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9,
-    -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1 },
-  { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2,
-    -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1 },
-  { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6,
-    -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11 },
-  { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9,
-    7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2 },
-  { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4,
-    -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5 },
-  { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0,
-    11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2 },
-  { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12,
-    -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3 },
-  { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1,
-    3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15 },
-  { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21,
-    -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6 },
-  { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9,
-    -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 },
-  { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9,
-    -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11 },
-  { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6,
-    -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10 },
-  { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1,
-    18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6 },
-  { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7,
-    6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7 },
-  { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10,
-    16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1 },
-  { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17,
-    -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 },
-  { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5,
-    -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3 },
-  { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15,
-    6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 },
-  { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2,
-    -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1 },
-  { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28,
-    2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 },
-  { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5,
-    -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7 },
-  { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0,
-    -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3 },
-  { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3,
-    1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2 },
-  { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8,
-    -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 },
-  { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4,
-    -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 },
-  { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2,
-    14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3 },
-  { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28,
-    -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 },
-  { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3,
-    -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3 },
-  { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28,
-    0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 },
-  { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6,
-    -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34 },
-  { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1,
-    0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26 },
-  { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3,
-    7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24 },
-  { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8,
-    25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 },
-  { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14,
-    2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30 },
-  { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14,
-    7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 },
-  { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1,
-    6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55 },
-  { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5,
-    0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31 },
-  { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1,
-    5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31 },
-  { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2,
-    -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 },
-  { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3,
-    5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24 },
-  { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13,
-    8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25 },
-  { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4,
-    4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24 },
-  { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1,
-    1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 },
-  { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0,
-    1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41 },
-  { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3,
-    -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27 },
-  { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12,
-    -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28 },
-  { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9,
-    22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23 },
-  { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1,
-    13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23 },
-  { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6,
-    15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29 },
-  { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7,
-    -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37 },
-  { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5,
-    -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33 },
-  { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4,
-    3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40 },
-  { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9,
-    18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 },
-  { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4,
-    1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28 },
-  { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2,
-    2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32 },
-  { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1,
-    2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30 },
-  { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3,
-    2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 },
-  { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3,
-    4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32 },
-  { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2,
-    -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21 },
-  { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2,
-    0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29 },
-  { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2,
-    -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19 },
-  { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1,
-    2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13 },
-  { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6,
-    -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19 },
-  { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12,
-    17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9 },
-  { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0,
-    1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27 },
-  { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2,
-    -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15 },
-  { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7,
-    -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5 },
-  { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6,
-    -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8 },
-  { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11,
-    2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16 },
-  { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0,
-    6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1 },
-  { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4,
-    12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16 },
-  { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2,
-    2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21 },
-  { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3,
-    -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2 },
-  { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13,
-    17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11 },
-  { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6,
-    7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3 },
-  { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10,
-    10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14 },
-  { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1,
-    8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14 },
-  { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5,
-    1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11 },
-  { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1,
-    -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2 },
-  { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4,
-    -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4 },
-  { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10,
-    -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12 },
-  { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9,
-    2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15 },
-  { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1,
-    -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8 },
-  { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4,
-    -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2 },
-  { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6,
-    20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3 },
-  { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7,
-    10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2 },
-  { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9,
-    -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2 },
-  { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5,
-    -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12 },
-  { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9,
-    5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9 },
-  { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2,
-    -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6 },
-  { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4,
-    8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12 },
-  { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3,
-    2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4 },
-  { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15,
-    -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2 },
-  { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4,
-    1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16 },
-  { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7,
-    1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17 },
-  { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7,
-    0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26 },
-  { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2,
-    -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12 },
-  { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0,
-    3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11 },
-  { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4,
-    -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17 },
-  { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2,
-    -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11 },
-  { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7,
-    4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7 },
-  { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2,
-    6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23 },
-  { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2,
-    -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9 },
-  { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11,
-    -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6 },
-  { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4,
-    4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14 },
-  { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4,
-    -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22 },
-  { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6,
-    -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11 },
-  { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7,
-    -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12 },
-  { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6,
-    -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17 },
-  { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11,
-    7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12 },
-  { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3,
-    -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5 },
-  { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3,
-    7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6 },
-  { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6,
-    9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5 },
-  { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10,
-    -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11 },
-  { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7,
-    8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13 },
-  { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14,
-    6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13 },
-  { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11,
-    1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9 },
-  { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6,
-    9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7 },
-  { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10,
-    15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16 },
-  { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4,
-    0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16 },
-  { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0,
-    0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10 },
-  { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2,
-    1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46 },
-  { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10,
-    13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1 },
-  { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2,
-    7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 },
-  { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5,
-    4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5 }
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
+  { -4, -2,  2,  1,-16,-10,  1,  3,  1,  0,  6,  1, -3,  7,  1,-22,
+     2, -4, -3, 11, 14,  6, -1,  1,-13, 29,-28, 10, 10, -8,  0, -9 },
+  { -8,  8, -7, 10, -3,-12, -5, -8,  1, -2,  9, -2, -5,-18,  1,  9,
+    -8, -8,  3, 41,  7, -9, -9, 22,-42,-29, 14,-18,-14,-32,  1,-15 },
+  {-16,  8, 15, 16,-16,  5,  2,  7, -6,-16, -7,  1,  1, -3, -2,  0,
+     8, 20,-26,-11,  2,-17,  0, -3,-34,-37, 10, 44, -2, 22,  2, -4 },
+  {  7, 14,  5,  6, 15, -1,  3, -3, -9,-23, -5,-14,  8, -1,-14, -6,
+    -5, -8, 54, 31, -6, 18,  2,-19, -2,-11,-30, -6,-19,  2, -2,-14 },
+  {  1,  2, -2, -1, -3, -3,  1, -5,  1, -3, -4, -8,  5, -4,  0,  1,
+     3,  7, -5, -4, -3,-12,  3, -2, -3, 12,-53,-51,  6, -1,  6,  8 },
+  {  0, -1,  5,  1, -6, -8,  7,  5,-18, -4, -1,  1,  0, -3, -3,-14,
+    -1, -6,  0,-14, -1, -1,  5, -3,-11,  1,-20, 10,  2, 19, -2, -2 },
+  {  2,  4,  3,  0,  5,  0,  3,  1, -2,  0, -6, -3, -4, -5, -3, -3,
+    -7,  0,-34,  4,-43, 17,  0,-53,-13, -7, 24, 14,  5,-18,  9,-20 },
+  {  1,  0, -3,  2,  3, -5, -2,  7,-21,  5,-25, 23, 11,-28,  2,  1,
+   -11,  9, 13, -6,-12,  5,  7,  2,  4,-11, -6, -1,  8,  0,  1, -2 },
+  {  2, -4, -6, -4,  0, -5,-29, 13, -6,-22, -3,-43, 12,-41,  5, 24,
+    18, -9,-36, -6,  4, -7, -4, 13,  4,-15, -1, -5,  1,  2, -5,  4 },
+  {  0, -1, 13, -6, -5,  1,  0, -3,  1, -5, 19,-22, 31,-27,  4,-15,
+    -6, 15,  9,-13,  1, -9, 10,-17,  4, -1, -1,  4,  2,  0, -3, -5 },
+  { -7,  3, -8, 13, 19,-12,  8,-19, -3, -2,-24, 31, 14,  0,  7,-13,
+   -18,  0,  3,  6, 13, -2,  1,-12,-21,  9, -2, 30, 21,-14,  2,-14 },
+  { -3, -7,  8, -1, -2, -9,  6,  1, -7,  7, 13,  3, -1,-10, 30,  4,
+   -10, 12,  5,  6,-13, -7, -4, -2, -2,  7, -3, -6,  3,  4,  1,  2 },
+  { -8,  9,  2, -3, -5,  2,  0,  9,  3,  7, -4,-16,-13,  3, 23,-27,
+    18, 46,-38,  6,  4, 43, -1,  0,  8, -7, -4, -1, 11, -7,  6, -3 },
+  {  1,  1, 18, -8, -6,  0,  3,  4, 22, -3, -4, -2, -4,-11, 40, -7,
+    -3,-13,-14, -7,-10, 14,  7,  5,-14, 11, -5,  7, 21, -2,  9, -3 },
+  {  0,  0, -2,  4, -2,  0,  2,  0, -1,  2, -1,  0,  0,  2,  2,  2,
+    -1,  1, -3, -1,-15, -2,-63,-27,-21,-47,-14,  1,-14, 10,  0,  2 },
+  {  1,  0, -4,  0, -3, -9,  4,  2,  6, -6,  0, -5, 11, -7,-15,  6,
+    -7, -6,  3,  7,-15, -5, 23,-13, -6, 12, -8,  9,  2, -3,  3,  4 },
+  {  6,  0,  3,  0, -2, -4,  2,  1,  1, -1,  1, -2, -1, -4,-22,-15,
+   -46,-66, 10, 20,  2,-17, 12, -6,  1, -2, -2,  0,  1, -5,  1,  2 },
+  { -1,  0,  0,  1,  0, -4,  0,  1,-10, -3, -8,  5,  7,-11,  2,-11,
+    29,-25, 11, 10,  0, -1,  5, -7, -2, -5, -2,  4,  4, -3,  5, -2 },
+  {  1, -1, -1, -3, -2,  1, -8, -3,  2, -2,  4, -5, -1, -7, -2,  1,
+   -14, -7,  3,-30,-15,-14,  3, -4, -1,  3,-13, -1, -3,  1,  2,  3 },
+  { -1, -2, -3,  2,  2, -3,  3,  1, -3,  2,  0, -4,  6,  5, -5, 10,
+   -57,  3, 22,-50,  1, -2, -5, -6, -1,  5,  1,  2,  2,  1, -2,  2 },
+  {  2,  0, -1, -7,  2,  1,  3,  2,  0,  4,  3, -2,  3, -3,  4, -4,
+    24,-35, -3, 38, -6, -5, 15, 20,  3, 16, -7, -5,  0, -4, -5,  0 },
+  {  0,  1,  0,  0,  0, -1, -1,  1,  1, -1,  1, -2,  0,  0,  0,  0,
+     0, -1, -2, -1, -5, -2,-43, -3, 46,-52,-10,  7, -8, 11, -2, -1 },
+  {  0,  0, -1,  0, -1,  2,-41, 33,-44,-48,-15,-26, -9,  6,  3,  3,
+    -3,  2,  2,  2,  2, -1, -1, -2,  1,  3,  0,  0,  5,  2,  3,  1 },
+  { -4,  1,  6,  1, -6, -1, -2,  1,-14, -4,  0, -5, -2,  2, -2,  0,
+    -6,  1,  0,  8,-21, 32, -3,-36, -6, -2, -1, -7,  3,  0,  1, -6 },
+  { -3, -2,  3,  0,  2,  2,  8, -4, -4,  6,  2,  1,  3, -6,  4,  3,
+    13,  0,-12, -1, 25,-20, -2,-23,-15,  7, -3,-11, -3,  6, -1,  0 },
+  {  0,  0, -3, -1,  0,  0, -2, -1, -2, -2,  1, -1,  0,  0, 10,  3,
+    -2,  3,  3, -7, -6, -5,  0, -4,-60,-16, -6, 38,  5,  6, -5,  0 },
+  {  0,  1,  0,  0,  0,  0,  0,  0,  1, -1, -1,  0,  1,  0,  0,  1,
+     0,  0, -1,  0, -8,  2, -9, 10, 40, 31,-56,-21,  4, 20, -4,  7 },
+  { -2, -2,  0,  4, -3, -1,  7,  3,  1,  3, -8,  0,  3,  1,  2,  5,
+     1, -2, 14,  5,  4,  5,  5,  5, -5,  9,-66,  0,-20, -2, -8,  4 },
+  { -2, -1,  4, -1, -8, -2, -4, -1, -3, -3,  2, -7, -3,  5,  7, -2,
+    45, 31,-17,-16, -2, -2, -1,-22,  1, -1, -3,  3,  5, -3,  5, -1 },
+  { -4,  0,  7,  5,  8,  7,  2,  9, -9, -9, -7,-11, -3, -8, 17, -4,
+    34, 32, 18, 22,  1,  2,  1, -7, -5,  6, -1,  6,  4, 10, -2, -7 },
+  {  6,  0, 14,  9,  6, -1, -2, -3,  4, -6, -8,  4,  7, -1, 28, 38,
+    15, -1, 16,-11,  5,  8,  4,-10,  3,-10,-17,  5,  3,  3,  3,  1 },
+  {  1,  1,  2, -1,  2,  1,  0,  0, -1,  0,  0, -2,  1, -3,  0,  1,
+     2, -2, -4, -2,  0, -1,  1, -3,  1,  1,  1, -1,  8,  8, 66, 33 },
+  { -5,  2, -3, -7,  2, -8, -4, 10, 17,-18, -7,  4, -4, -7, -6, -6,
+    -5,  5,-12,  2,  0,  6,  8, -2,  1,  4,-11,  2,  1,  8, 31, 19 },
+  {  6,  9, 16, -6, -6, -1, -2, -3,-11, -2,  7,  7, 17,  3,  4, 10,
+     2,  5,-13,  8,  7,  1,  4,  5,  7,  6,  7, -8,  9, -8, 33,  6 },
+  {  3, -1,  1,  0, -7, -5,  0, 14, -7,  1, -7,  1,  2, -4,  7, 10,
+   -16, 12,  1, -6,  3,  8, -1, 10,-13, -6,-12,-23, 12, -3, 30, 14 },
+  { -2,-15,  0,  8,  3,-19,  5, -3,  2,  3, 13,  7, 14, -3,-10,  0,
+     8,  5, -6,-16, -8, -8, 14,  2, -1,  1, -9,-11, 11, -5, 27,  9 },
+  { -8,  6, -4,  4, -4, -1,  5,  4,  1, -7, -5, -4,-15,  1,  9,  0,
+     8,  4,  1,-17, 11, -2,-19, -1, -6, -8,  3,-12,  3,-17, 33,-10 },
+  { -3, -1,  2,  7,  7, -2,  9,  8,-18, -1,-13,-10, -3, -3, 11,  8,
+    -2,-12, -8,  1,  4,  9, 14, 10, -3,  0,  2,  1, -2,  3, 31, 10 },
+  { -3,-10,  8, -1, -5,-11,  7, -5,  3,  6,  1,  4,-16, 10,  5, -4,
+    -2,-10, -1, 13,  6, -5, -7, 12,  7, -3,-17,  1, 12, -4, 29,  8 },
+  {  1,  2,  5,  2, -6, -7,  0, -1,  6, -1, 10,  6, -4,  5,  2,  2,
+    -2, -8, -6,-11, 14,-13, 27,  3, -2,-12,  5,-16,  2,-26, 20, 15 },
+  { -1, -3, -5, -3, -3,  6, -1,  3, -5,  1,  7,  2,  1,  0, -1, -1,
+     0, -1,  9,  7, -6, -3,  4, -5, -4,  8, -8,-25, -8, -4, 34, 23 },
+  { -1, -2,  1,  1, -1, -2, -1,  1, -1,  0,  0,  0,  0, -2, -1,  1,
+     0,  2,  1, -1,  4,  0,  0,  1, -1,  0,  5,  3, 12, -9, 68,-16 },
+  { 10,  0, -8, 14, -6,  1,-12,  0,  0, -3, -5,-11, -6, 12,  9,-10,
+    -3,  5,  0,  7, 11,  2,  4, -3, -8, -3,  7,  4,  3, -3, 34,  4 },
+  {-12, 13, -5,  7,-11, -2, -1,  1, -4,-14,-21,  3, -3, -3, -4, -7,
+    -9, -4,  3,-17, -2,-13, 10, -2, 12, -4,  0, -9,  1, -5, 31, 10 },
+  {-10,  6,  5,  6,  4, -7, 10,  0,-28, -3,  0,-11, -1, -5, 16,-10,
+   -16,  7, 20,  2, -4,  2, -5,  0, 15,  6,  5,-10,  7, -9, 20,  4 },
+  {  1, -7, -2, -7,  4, -3, -2, -7, -1,-14,  6,-16,  4, -5, -4, -6,
+    -5,  0, -2,  2, -6,  9, -5,  4,-18,  8,-10,  8, 15,  0, 32,  1 },
+  { -5,  7, -3,  7, 15, -4,  0,-16,  9,  5, -5,  5,  4, -3,-12, -9,
+   -18, 10,  2,  2, -3,  7,  3, -1,  6, -9,-10,  3, 15, -4, 35, -7 },
+  { -1,-10,  2,  2, -4, -2, 10,  2, -1,  2, -2,  1, -1,-14,-11,  3,
+    -8,  5, -8, -2,  6, -1, -7,  1,  7,  5,  7,  8, 30, -4, 30, 14 },
+  {  2, -2,  1,  2,  3, -8,  3,  0, -2,  0, -9,  2,  1,  4, -6, -1,
+    -2,  5,  0,  1, -2, 12,  6, -3,  9, -3,  4,-12, 21,-39, 24, -2 },
+  {  3,  5,  1, -2, -2, -2, -3,  6, -8, -2,-11, -8, -1,  4,  2,  2,
+    -4,-10, 12, -5,-11,  1,-15,-34,-11, -7,-11, -1,  7,-14, 38, -1 },
+  { -4,  4,  8,  9,  8,  1, -5, -9,  4, -2, 15, -4, 11,-15, 20, -1,
+    -1, -3,  4, -9, -2, -2, -2,  8,  6, 12, -5,  0, 11,-12, 27, -4 },
+  {  0,  8, -4,  3,-11,  6,-11,  2,  3,  0,  5, -8, -7, -6, -9,-21,
+     4,-11, -1,-16, -7, 16, -3,  7, -7,  4, -5,  0, 11, -7, 31,  3 },
+  {  1,  3,  4, 11,-11, -2, -3, -6,  6,  5,  0,  3, -9, -6,  4, -4,
+     0,  4, -8, 13, -6,-13, -1, -5, -1,  4,  0,  0,  9,-22, 24, 18 },
+  { -7,  3, 10,-13, -6,  6, -6,  6, 22,  1,  0,-14,  2,  3,  7, -1,
+     8, 20, -1,  5, -4, 13,  9, -9, -9,  6,  0, -4,  0, -8, 31, -4 },
+  { -3, -4,  0,  1,  7,  3, -7,  0,  5, -2,  1,  3,  3,  1, -5, -2,
+     5,  2,-11,  4,  0, -1, 12,  0, -3,-13, 15,  8, -6,-27, 34,  0 },
+  { -3, -3, 10, -4,  2, -1, -3,  0, -1, -1, -4,  2,  6, -2, 12,  1,
+     3, -6, -7, -6, -5,  4,-19, -6, -8,-34, -4, -8, 10, -7, 23, 10 },
+  { -7,  0, -1, -6,  8,  4, -4,  2, -5, -8, -7, -9, -8,  5,  9,  7,
+    -6,  1,-12,-12, -1,-16,  5,  0, 16,  3, -7, -8, 27, -4, 23, 15 },
+  { -8,  4,  8,  5,  6, 11, -3,  5,  3, -1,-11,  6, -5,  0,  2, -6,
+    -3, -6,  4, -1,  5, -5,-12, -6,  7, -5,  9,  3,  6, -7, 29,  1 },
+  {  1,  3, -2, -2, -6, -2,  1,  6, -6, -3,  1,  2,  3,  4,  1,  5,
+    -1,  0,  4,  2, 11,  6,  2, -3, 13, -9,-19, 18,-15,-10, 36, 21 },
+  { -3, -3,  2, -1, -7,  6, -4,  1, -3, -1, -2,  2,  3, -7, -3,  0,
+    -2,  0, -2,  6,-19,  3, -8,  2, -6,  7, -1,  0, 29, -6, 28,-10 },
+  { -5,  1, -3, -7,-12, -4,  1,  1, -1, 13,-10, -1, -9, -5,-13,  6,
+    13,  3, -4,  2,  3, 11,  2,  6,-25,-16, -6,  0, 14, -1, 27, 16 },
+  { -6, -1, -7, -5, -2, -5, -5, -1,  9,  1,  0,  3, -8,-12, -6,  5,
+    -6,  5,  3, -9,  1,  4, -7,-10, -9, -7,-17, -5,-15,-23, 25,  3 },
+  { -8, -2,  9, -3, -4,  3, -1,  8, -7, -7, -5, -4, -2,  9,  4, -1,
+    -7, -4, -5,-16,  3, -6, 18,-13, -9, 16,-15,  8, 15,-10, 24,  5 },
+  {  1,-38,  2, 34,  9, 10, 11,  2,  2, -6,  3,  2, -2,  5,  4, -7,
+    -1,  1,  4,  0,  3,  1, -8, -1, -6,  5,  4,  2, -4,  5,  2, -1 },
+  {  1,-22, 15, 18, -2, 10,-16, -9, -8,-11,  8,  4,  0,  7,-14, -5,
+    -1, -7, 12, 17,  9,  5, -7, -4,-12, -6,  7,  0,  7,  2, -2,  1 },
+  {-11,-29,  7, 10, 19, -1, -8, -9,  7,  1,  9,  6,  8, -7,-14,  8,
+    -3,-11,-13,  0, -7,-23, -2, -8, 12,  9,  2, 14, 19,  1, -1,  5 },
+  {-24,-27,-11, 36,  2,  6, -3,  4, -6,  8,  0, 12, -1, -4, -6,  3,
+     4, -1,  2, -3, -2,  3,  2, -1, -2, -4,  0, -1, -2,  7,  2,  3 },
+  { -9,-24, 11, 13,-10,-12, 12, -2,  7,  4,  8, 13, -3, -3,  2,  9,
+    -3, -4,  4, 13,  5, 13, -6, -3,  1, 15,  7, -3,  0, 19, -2, -9 },
+  { -8,-15,  7, 14, -4, -5,  2,-18,-19, -2,  2, 17, 16,  6,-10, 10,
+    -9, 14, -1, -5, -1, -6, -7,  2,  9, 11, 13,  6, -5,-12,  3,  2 },
+  {-10,-37, 13,  1,  3,-14,  0,-20,  4, -3,  8,  2, -2, -3, -9, -5,
+    -3,-17, -1, 13,-11,  2, -6,  4,  4,  0,  3,  1, -9, -4, -5, -4 },
+  { -2,-22, -5, 46, -8,  5,  9,-11,  8,  7,  7, -1, -1, -2, -7,  2,
+    -3,  3, -1, -2,  7,  0,  2, -1,  1, -2, -2, -3,  6,  0, -4, -6 },
+  {-16,-27, 15, 16, -4, 14, -7,-26,  2, -2,  6,  5, -3, 11,  0,  2,
+     3,  9, -7, -1,  2, -4, -4, -1,  6, 10,  1,  1, -3, -2,  3,  0 },
+  { -3,-22, 10, 26,  1,  2, -3,  3, 17, -3, -7,  9,  1,-21, -4,  5,
+     3,  0, -7, -6,  3,  3, -8, -7, -9,  3,  7,  1, -8, 12,  6, -7 },
+  { -9,-25,  3, 18,  9, -6,-11,  0, -5,-12,  9, -8, -7, -6, -6, 22,
+     2, -6, -3, 15,  3,  2, -2,  9, 14,-10, -7, 15, 13,  6, -2, 11 },
+  {  5,-20, -5, 28, 11, 10, -4, -4,  0, -7,  3,  5,  2, -5, -8,  2,
+     6, 10,  9, -9,-18,  3, 14,  1,  3, -3, -1, -6,  7,  7,  2, -1 },
+  { -8,-30,  7, 12, 10,  8,  7,-13,-16,  0,  1, -1, -6,-11,-15,  4,
+     1, -2, 10,-15,  1, 11, -2,  8,  9, -7, -7,  9, -5,  2,  7,-18 },
+  {-10,-32, 10, 11,  3, -1,  3, -5,  5,  2, 14, -6,  3,  1,  5,-15,
+   -11,  6, 20,  4,  0,-12, -7,  3,  1, -1, 10,  6, -1, -9, -4, -1 },
+  {  1,-25,-14, 12,-11,  9,  9,-16,-24,-17, 22, -9, 11,-30, -3, -4,
+     6, -7,  9,  2, -1, -5, -6,  2, -1, -1, 10,  1, -3,  3,  4,  8 },
+  {-14,-26, -6,  9,  8, 17,-11,-24, -7, -4, -8, -2, 10,  2,  2, -1,
+     2, 13, 12, -7,  4, -6,-10,  6,  6,-13,-11, -7,-16,  0, -2,  5 },
+  { -4,-30,-13, 12, 16, -6, 12,-16,-13,  5, 15, -2, -2,-10, -7,  7,
+    11, -1, -4, -2, -4,  7,  4, -8,  1,  3,  0, 11,  3, -2, -5,  4 },
+  { -4,-21, 20, 22,  2, 20, -8,  1,-12, -5, -9,  4,-10,-17, -3, -8,
+    -3,  3,-12,  1, -3,  0,  7,  4,  7,  7, -3,  7,  5,  3,  1, -5 },
+  {-12,-20,  2, 29, 11, -6,  9, -7, -6, -4,  0,  6, 17,-13, -2,-10,
+   -17, -1,-18,  2,  0, 14, -6,  1,  0,  3,  2,-10,  1, -5, -2,  5 },
+  { 16,-37, -1, 26, -2,-14,  1, -5,-14,  2,  2,  3,  6,  1,  1,  4,
+     0, -1,  0, -2, -2,  4,  9, -6,  0, -2, 10, -7, -2,  4,  1,  0 },
+  { -9,-24,-12,  5,  5,  3,-17,-14,  4,  3,  2, -4, 10,-22, -8, -3,
+     6,  1, 12, -8,  4,  1,  9, -1, 18, -3,  6,  5,  3, -5,  9, -5 },
+  {-14,-33, -2, 20,-13,-10,  2, -7, -1, 11, -9, -8, 18, -3,  1,  8,
+     0, -2, 10,  7, -2,-13,  9, -3, -4,  5, -2, -2, -1, -5,  1, -7 },
+  {-10,-23,  8, 14,  1,  7,  1, -3, -7,  4,  1,  1,  8, -7, 15,-14,
+    13, 14,  2,  5,-13, -5, -8, -1,  6,  3,  6,  9,  6, 15, 14,  5 },
+  {-13,-25,-10, 13,-17,-24, -7,-13, -6,-10, -8,  2,  0,-13,-10, -4,
+    -8,  4, -9,  9, -4,  4, -3, -3,  3,  3, -5, -9,  1, -2, 11,  2 },
+  {-12,-23,  1, 18,-11, -2,  5,  9, -5,  5, 14, -9, -3, -2, -6,  2,
+    -2, 11,-13,  1, -3, 11, -9, -4, -2, -6,  8, 10,  1,  4,  2,  1 },
+  { -5,-18, 16, 22,  2,  0,  8, -6, -9, -7, 10,-16, 23, 10,-11, -1,
+     7,  2,  7,  2,  1, -5,  6,  1,  0, -4,  9,  2, -3,  1,  0, -4 },
+  { -3,-26, 14, 11,  2, -9, 17, -2, -1, -5,-16, -9, -5, 10,-13,  1,
+     6, 12, 10, 11,  0,  0, -3,-14,  6, -2,  0,  4, -5, -1, -7, -1 },
+  {-10,-33,  1,  8, 11, -5,  1, -6,  7,  4,  5,  6,  1, -2,-10, -5,
+    -6, 12,-11,  5,-10,  4, 12, -1, -1, -3,  4, -1,  9,  0, 16,-17 },
+  {-14,-37,  7,  7, -2,  5, -8,-11,  2,-13,  4,-19,  1,  8,  8,  4,
+    -9,  2, -4,  3, 12,  2,  4, -4, -8,  8,  1,  4,  8, -1,  6, -2 },
+  { -6,-30, 18, 17,  1,-22, -3,  4, -7,-10,  7,  0, -8,  8, -1,  4,
+     2,  8,  6, -2,  2,  7,  4,  4,  3, -6,  2,  1, -3,  1, -1, -5 },
+  {-17,-18, -3, 22, -8,  1,  9, -2,-17, 20, -5, -5,-12, -5,  4, -5,
+    -9,  8, -2, 16, -3,  0, 19, -8,  8,  1,  2, -4,  0, 11,  0, -3 },
+  { -9,-23,  3, 10,  4,  4, -3, -2, -2, -2,  1,-22, 11,  0, -2,  5,
+    -2, 14, -9,-11, -4,  7,  5, 32,  1, -3, -7,  0, 21, -9,  7, -6 },
+  {  0,  0,  0,  2, -1,  1,  0,  1,  3,  0,  0,  1,  0,  1,  0,  1,
+    -3,  0, -1, -2,  0, -1, -1, -3, -1,  1, -4,  1, -1, -5,-69,-19 },
+  { -3, -5, -8,-12,  4, -3,-19,-11, -5,  0,-14,  7, 18, -6,  7, 22,
+     8, 14, 15, 10,  3, -1, -3,  5, -1,  7, -7,  1, -6,  3,-26,-11 },
+  { -1, -6,  4, -4, -5,-16,  0, -6, -3, 11,  1,  0,  9,  5, 16,  3,
+    -4,-33, -4,  4, -7,  0,  1,  6,-11, -2,-13, -2,-18, 20,-25,-16 },
+  {  4,  0, -1,  0, -5,  1,  0,  2,  0, 11,-10,  4,-10,  7, 16,  2,
+    16, 15,  2, -1,  2,  9,  2,  8, -3, -5, -2,  0, -3,  0,-33, -2 },
+  { -3,-15, 10, 10, -9, -1,  7,  3,  5, -5, -8, -8, -3, 15, -9,  4,
+    12, 13,-13,-14, 10, -6,  9, 22,-27, 23, -1,  5,-24,  2,-30,  5 },
+  {  0, -2,  7, -5, -5,  3,  5,  3, -3, -5,  2,  1, -4,  3, -3, -1,
+     1, -2, 10, 22, -3, -4, -2, -2, -7,  3,  8,  1, 14,  4,-37,  9 },
+  { -3, -4, -1,  1, -4,  0,  6,  2,  6, -7,-10,-10, -1, -4, 11, -3,
+     7, -6,  4,-12, -1,  5,  1, -7, 10, -6, 17, -4,  8,  3,-40, 13 },
+  {  2, 12,  4, -7, 14, -3, 16, -2, 18,  2, 13,  5,  5,  1, 11, -1,
+     0,  9,  2, -6, -1,  2, -6,  2, -5,  3,  5,  1, -1,  1,-32, -7 },
+  {-16, 11,  7, -4,  2, -5, -9,  9, 11, 11, 15,-13,-11, 11,  9,  4,
+     3, -8,-10, 12, 12,  0,  0,-16, -9, 13,  2,  9,  4,-13,-33,  3 },
+  {  6,  4,  5,  4,  3, -1,  5,  6,  4,  2,-11, -1,-15,-11, -1,  1,
+    11, -3, -2, 24, -4, -6,-25,-10,-15, -8,  0,  0, -5,  4,-30,  2 },
+  { 10, -3, -6,  1, -9, -5,  6,  9,-10, -3,  8, -1,  4, -1, 11,-11,
+     3,  9, 11, -3,  6,-17,  5, -8,-33,  9,-13, 19, -2,  9,-25,  2 },
+  {  0,  0, -1, -3,  0, -2,  1,  0,  0,  2,  1,  0, -2,  0, -1,  2,
+     0, -1,  4, -1,  2, -3,  4, -2,  3,  3,  1,  0,-15, 12,-63, 27 },
+  { -2, 14,  9, -1,  3,  0,  1,  1,-19, 15,  3,  4,  0,-10,  1, -5,
+     3,  0, -5,-10,  2,-16, -4,  8,-12, -6,  7, -5,-10, -1,-33, -4 },
+  {  0,  3,  1,  3,  1,  2,  4,  4,  9, -6, -8, -5,  1,-12,  3,  8,
+   -10,  6, -1,  1, 13, -5, -5,  2, -4, 13,-18,-10, -7, -9,-33, 10 },
+  { -6, -3,-12,  5, -1, 11, -6,  0, -2,  1,  2, -7,  3,  1,  3, -2,
+     1,  8,-10,  7, -1, -3,  3,  0, 13,  1,  6,  7,-16, -7,-39,  8 },
+  { -6, -1, 11,  6, -3,  8,  3, -5,  3,  0, -5, -2, -6, -3, -4,  2,
+    -3, 13,-11,  1,  7,  5, 19, -5, -3,-15, -1,  7, -1,  6,-33,  8 },
+  { -7,  3, -4, -3, -4,  1,  6, -5, -5,  6, -8, -1, -7,  4, -1, -6,
+    -2,  1,  7,  0,  1,  1, -5,  2, -2,  0,-13, -2,-31,-14,-39,-12 },
+  {-10,  9,  0, -3,  1, -1, -1,  0,  1, -5, -1, -4, -2,  5,  2, -7,
+    18, -8, -2,-19, -7, -7,-12,-14,-11, -1, -9,-13, -7,-12,-31, -9 },
+  { -3,-16, 10,  9,  1,-10,-12,  2, -2,  2,  7, -3, -3,  1, -4, -5,
+    -9,  5,  7,  3, -1,  4,-11, -8,  4, 13,-10, 13, 10, -4,-36,  1 },
+  { -7,-12,  4,-20, -7, -7,  2, 11, -1, -2,  3,-12,  1,  0, -6, -7,
+     6,  4, 13,  3, -3,  4,  3, -6,-12,  5, -5,-22,-13, -8,-37, -6 },
+  { -7,  5,  3,  5,  7,  9,-14, -3, 10, 17, -1,  1,-12,  5, -6,  0,
+    -4, -9,  0,-11,-14,  3, 13,  6,-25, -8,-12,  4,-10, 18,-30, -1 },
+  {-10,  6,-10,  6,  6,  1,-10,  0, -7,  5, -2, 17,-18, -4,  0, -3,
+   -16, -6, -3, -8,  5,  1, -4,  6, -7, 16,  6, 10, -1,  0,-32,-11 },
+  { -1,  9,  9, -5,  4,  9,  6,  9, -4, -2,  7, 11,  4,  2, -5, -4,
+    -6,  0,  2, -3, -1,  5, 10,  0, 12,-10,-18, -3, -1, 14,-33,  2 },
+  {  4, -8,-18, -4, -5,-11,  4,-10, -4,  9, 13,-12,  1, -6,  1,  2,
+     4, -9,  8,  3, -6, 21, 13, -1, -2,  1, -2,  6, -7,  0,-30,  1 },
+  {  6, -1,  2, -3, -1, -4,  6, -4,  0,  4,  2,  2, -9,  2,  6,  3,
+    -2,  4, -1,  9, -6,  0,  7, -8,  5, 19, -2,  9, -5,  2,-33, -8 },
+  {  2,  1, 12, -5, -8,  8,  3, -2, -4,  1, -2,  5, -4, -9, -8, -8,
+     7,-11, -4,  6,-10,  7, -1, -1, -2, -1, 16, 32, -7, 20,-33, -6 },
+  {-18,  2,  6, 13,  9,  9, -1,  3,-17, 24, -2, -6, 28,  8, -2,  6,
+     3,-10,-34,-16,-13, -4,-15,-11,-12, -3,-10,  4, -8,  4,-31, -4 },
+  {-11,  0, 18,  2,-16, -9,-13, -2, -2,-12, -3,-22, 30,  0,  8,  3,
+     9, -4,-16,  1,  0,-11, 15, -2, -4,  6, -5,  6,  1,  2,-25,-12 },
+  { 14, -1,  5,  7,  3,-15, -8,  1,  5, -2, 12, 13, 11,-25,  3,  1,
+     0, -2, -4,-16,-23,  0, -5,-17,  7,  5, -9,  6, -5,  2,-32, -7 },
+  {  3, -1,  6, 14,  2,-12, -9, -9,  4,  7,  4,  6,  5, -8,  4,  2,
+     4,  5, -2,  8,  8, -6,  0, 10,-20, -1,  3, -1,  8, 23,-33, -5 },
+  { -3, 11, -6,  3, -4,  5,  7,  3,  4,  5, -2,  3, -1, 30,  6,  1,
+     8, -6,  0,  0, -9,  6, -9,  4,  2,  9, -6,  1,-12,  0,-34, 18 },
+  {-17, 13,  0,  1,  9, -4,-11,  0,  7,  0,-10, -4, -1,  6, -6,  4,
+     1,  6, -9,  3, -5, -6,-11,  2, -4, 14, 23, -3,  2,  5,-30, 12 },
+  {-14,  5,-27,  2,  0,  7,  1,  4, 30,  8,  7,  5,  1, -1,  0,  5,
+     8,-10, 48,-11, 12, 33,  6,  8,-15, 20, -2, -5, 32,  5,-19, 10 },
+  {-16, -4,-12, -7, -2,  0,  8, -6,-20,-18, 16, -3,  0, 31, -2, 11,
+     2, -9, 49,-19,-12,-23, 10, 26, 16, -2,  4,-21,-14, 13,-11, -9 },
+  { -5, -9, -1,  3, -5,-21,  2, 10,  0,  0, 10,-21, -7,  7,-26, -9,
+    22, 32, 58, 11, -3, 11, -5, -8,-13,  6, -5, -9,  1, 10, 14, -8 },
+  {  7,  7, 10,  3, -2, -1,-11,-11, -6,-43, -3, 14,-19,-18, 19, 18,
+   -32, 10, 45, -6,  6, 21,-20,-12,  2,  4,  6,  6, -4,  3,  3,  1 },
+  { 21, 22, -3, -2,-11, -6, -1, -2,  8,  8, 32,-21,  7, 28, -4, -6,
+    -3, -2, 50,  2,  2, 27, -5, -8, 12,  7, -5, -1, -4,-17, 27,  6 },
+  { 13,  7,  2, -6,-12,  2,-10, -5,-17, 11,  4, 17,-12, -2,  5,-17,
+    37,-16, 48,-14,-18, 29,  8, 24, 11, -5, -9, 11, -1,  1,-13, -3 },
+  {  1,  1, -1,  2,  0,  0,  0, -1,  1, -1,  7,  2, -3,  3,  0,  6,
+     2, 10, 54,-25,  7, 54, -5, -6, -1,-15,  9, 13,-24,-15,-12,  3 },
+  { 21,  5,  8,  3, -3, -4, -2, -4,  3,-11, -5, -8,  9, 16,  8, -9,
+   -10, -3, 46,-46,  2,  1,-10, 10, 17, 11,-20,-36, 10, 14,  0, -5 },
+  {  7,-13, -6, -9,-24, 45,  2,  8,  8,  0, 17, 20, 12,-24,  1, -7,
+   -15, -3, 46,-13, -2, 20,  1,-13,-11,-13,  2, 15,  1, 10, -1,  3 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,  0, -2, -1,
+   -16, -9, 31,-69,-34, 26,  7, 17, -1, -6, -1,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -4,
+    -5,-20, 18,-82, 22,  3, -7,  9,  4,  6,  2, -4, -1,  0, -2,  2 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  4, -1,
+    15, -5, 62,-36,  4, 52, -7,  5,  0,  6,  1,  2,  1,  1, -1,  0 },
+  {  3,-19, 19,-20, 13, -4,-11,  8,  8,-16, 10,  1,-14, 30,  1,-33,
+    10,-11, 45,-30,  3, -4, -3,-13,  7, 12,  3,-22,  3, -2, -4, -2 },
+  { -1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  1,
+    11,  8, 70, 48,-10, 21,  4,  9, -9, -9, -4, -6,  0, -1,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,
+     2, -1, 80,  2,-15,-36,-10, -5, -2,  8, -2,  2,  0,  0,  0,  0 },
+  { 10,  8, -8, -8,-24, 12, -1,  0, 20,  9, -1, -2,  2, -2, 12,-10,
+    -2,-13, 35,-43, 44, 15,-10,-25,  4, 10, -3, -5, -5,  7, -1,  3 },
+  {  1,  1,  1,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, -2, -1,
+   -18,  9, 49,-72,  7, -8,  7, -5,  2,  3,  2, -2,  1, -2, -3,  1 },
+  { -1,  4, -3, 10, 19,  4,  3, 20,  6,-24,  6,  9,  8, 15, 18, 18,
+   -36, 19, 57,-11,  4, -3,  8,  7,  2, -3, -2, -9,-15, -2, 12, -4 },
+  { 20,  3, 11, -9, -4, 22, 42,-25,  1,  5,-10,-19,  0,  9,-16,  5,
+     2, 10, 44,-29, 17, -3, -9, -2, -1,  8, 14, -7, -1, 16, -5,  1 },
+  { -7, 16,-11, 12,  6, 33,-15, 14,-23,  2,-26,  8,  2, 10,  0, -5,
+     8, -8, 38,-38, -4,  5,  5,  5,  1, 22,-15,  7,  6,  0,  4, 28 },
+  { -1,-12,  2, 10, -2,  0,  7, 17, 12, 22, -4, 10, 25, 29,  5, 18,
+     4,  1, 27,-39, 31, 17,  2,  2, 22,-23, 13, 16,  1, -7, -4, -5 },
+  {  0,  1,  0,  0,  0,  0,  0,  0,  0,  0, -1,  0, -2,  0,-14,  0,
+    -7,-11, 49,-22, -4, 19, 17,-39,  4,-29, 10,  2, 36, -4, 23, -1 },
+  { -2, -2, -2, -2,  1, 15, -5, -7,-16, -8,-19, 16, -3,-20, 36, -9,
+    -3, 20, 39,-20,  0,  2, 27,-16, 10, 10,-14,-22,-16, -3, 13, -8 },
+  {  5, -9,  6,-25,  7, 37, 13,-10, -5,  3, -5,  7, 18,-22, -7,  9,
+    -5, -4, 50,-11, -4, -5, -5,  8, -4, -2, -4,-27, 14, 20,  7, -9 },
+  {  0,-14,-10,-27,-14,-17, -6, 26, 10,  2, 14,-12, -5,  0,  8,  9,
+     0,-28, 55, -7,-12, -7,  4,-10, 10,  7,-12, 11,  3,  5,  9, -8 },
+  {  2, 23,  4, -2, -1,-20, -2, 14, 10, -9, -9,-24, 10,  0, 11,-12,
+    12, 11, 49,-25, -2, 29,  7,-13, 21,-10, 11,-17,  3,  1, -8,  5 },
+  {  3,  0,-14, -6, 18, -2, 17, -9,-19,  9, -5,  9, 14,  6, 19, -3,
+    27,  1, 41,-21, 20,-15, 33,  0, 26, 14,  7, 10,  3, 20, -3,-12 },
+  { -1, 16, 15, -8,  3, -8, -8, 21, -5,-16,-29,  4,  1, -6, -4,-28,
+     2, 31, 37,-26, -2, 13, 24,  8, -9, -6,-29, 10,  7,  2,  7,  8 },
+  {-10,-10, 11, 13,-32,  2, 16,  9, 14, 23,-15,-13, 24, 13,  4,-27,
+    14, 12, 31,-18, 17, 23, -2, -7,-14,  9,-17, -6,-10, 20,  9,  6 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,
+     5,  1, 89,  8, 10, -6,  2, -1,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -1,
+     4, -7, 64,-50,  7, 37,  2,  5,  0,  0,  0,  0,  0,  0,  0,  0 },
+  { -2,  5,  3, -4, -4, -3,  2, -3,  3, -3,  5,  4,  1, -6, -1,  1,
+     6, -2, 50,-35, -7, 43,  7, -7, -5,-26, 24, 21,  3,-15,  5,  6 },
+  { -8, 21,-19, 33, -8, 22,-11, 17,  3,  0,  0, -2,  1, -3,  6, -1,
+    10, -8,  4,-11, -4, -5,  0,  8, -4,  3,  1, -4,  4,  2,  8,  4 },
+  { -7,  5,-20,  9,-22,  3,-14,  1,  6, 13, 23, -2, -4, -7,  2,  0,
+    11,  4,  6,  3, -7,-11, -7,  4,  5,  5,-12,  8,  2,  4,  7, -3 },
+  { -7,  6, -4, 20,-20, 16, -2,  7,  6, 16, 11, 12, -7, -7,  5,  3,
+    -9, -4,  1,  2,  5,  2,  1, -9, -2,-17, -4,  6,-10,  7, -7, -6 },
+  { -9, 18,-17, 12,-24,  1, -1,  4, 14,  9,  4,  3,  2,  8,-12,-14,
+     4, -8, -4,  7,  7,  6, -1, 13, -9, -4, -1,  1,  0, -4, 15,  8 },
+  {-25,  2,-11,  6, -5, 24,-28, -5,  8, 12, -2,  6,  8, -3,  8, -9,
+    -1, -5, -1, -5,  6, -1, -1, -1, -4,  8,-12, -2,-13,  7,  2,  1 },
+  {-14, 14,-18, 20,-10, 12, -2,  9,  1,  0, 12, -2, 15,-10, 26,-17,
+    16,-11, 10,-10,  9, -2,  4, -8,  2, -3,  4,  4,  2, -3, -5,  1 },
+  {-18, 12,-18, 21, -6, 12, -6, 13,-25, 18,  1, 11, -9, -5,  0, 10,
+    -5,  3, -3,  8, -9,  7,  4,  2, -9,  0,  5,  0,  2, -3,  9, -8 },
+  { -4, 16,  1, 18,-30,  9,  1,  6, -8, 13, 13,-12, -6, -1, 13,  7,
+     6,  2,-15, -3,  5,  5,  1, -6,  1, -5,  0,  2,-16,  0,  3, -4 },
+  {-21,  1, -2,  6,-43, 18, -1,  5, -1,  4,  6, -2, -1, -3, -1, -3,
+     0,  1,  2, -9,  0, -1,  0, -2,  0, -1, -1, -2,  6,  0,  1, -2 },
+  {-23, 10,  4,  7,-32,-11,-18,  2, -2, -7, -6, -3, -3,-12, 19,  3,
+    -5, -6, 16, -6, 16,  2, 16, 16,  8, -2, 13,  8,-15,-11,  2, 10 },
+  { -8,  2,-13,  2,-29, 24,-20, 19,  1, 10, -4, 10,  1,  2, -9, 11,
+    -1, -2,  9, -5, 19, -7, 16, -9, -2,-18, 11,  1,  1,  0,  7, -3 },
+  { -6,  3,  4, 13,-26, 10,-10, 28, -7, 28,  1,  7,  0,-14,  5,  7,
+     4, -4,  3, -2,  3,  3,-11,  7,  6,  4,  0, -1,  2, -1, -3,  2 },
+  { -6, 16,-31, 13,-10, 17, -6,  4,-14,  4,  4, -1,-10, 12, -5,  1,
+   -14, 15,  0, -8,  1, -5,  3,  3,  9, -5,  7,-20,  7,  4, 11, -5 },
+  {-19,  3,-17, 14,-12, 16,-22, 18, 14,  8, -2,  4, 10, 12,-14,  4,
+    -3,  2,  3,  7, -7,  7, -6,  2, -2, -4, -5,  0, -5, -2,  2,  1 },
+  { -9, -7,-11, 24,-36, -9,-11,  5,  7,-12,-13, 18, -2, 20,  1, -4,
+    -1,-10, 15, -6, 14,  1,  0,  2,  1,  2, -9,-16,-11,  7, 13,  0 },
+  {-24, 24,-18, 18,-22, 14,-11, 13,-12, 11,-10, 11, -7, 11, -5, -4,
+    -1,  1,  5,  2,  3, -1,  1, -5,  7, -4,  5, -6,  8, -7,  8, -6 },
+  { -6, 18,-22, 22,  5, 11, -1,  6, 19, 22,  8,  4, -8, 20, -2, 15,
+    -6,-18,  0,-33, -9,-12, -1,  6,  5,  2,  5,  5, -5,-17, -3, -3 },
+  {  1, 11,-16,  9,-18, 11, -4, 18, 20, 26,-10,  8,  1,-11,  8, -4,
+     0,  7,  3,  5,  2,  2, 10, -2, -4,  4, -4, -2,  1, -4, -5, -1 },
+  {-10,  6, -1, 18,-17, 27, -3, 10, -2, 12, -7, -9,  1,  1, -1,  7,
+   -12, -1, -7, -6, -1,  8,  3,-15,  8,  9,  3, -7,  4, -1,  1, -1 },
+  {-14,  6,-16, 22,  2,  5,  0,  5,-18, 11,  6, -3, 22,-20, -9, -3,
+     6, -6, -7,-15,  1, 15, -8, 11,  8, -3, -8,  1, -8,  2,  6, -2 },
+  {-21,  5,-19, 19, -7,  4, -7,  0, -8,  6, 12,  5, -3,-22,-13, -6,
+    -1, -3, -2,-14,  6, -3,  1, -8, -7, -5, -6, 11, -3,-10, -5,  2 },
+  { -1,  9,-12, 15, -6,  6,-19, 14, -9, 11,  3, 12,-17, -3,  8, -4,
+    -3, -4,  1, -5,  4,  5, -7,-15, -7, 15, -6, -5,  1, -5, -3,  1 },
+  {-12, 20,-15, 20,-14,  3,-14,  9, -6, 33,-13,  6, -2,  8, -6,  7,
+    -5, -6, -3, -3,  0,  8, -3, -3,  1, -2,  2,  2,  6, -5, -5, -2 },
+  { -7, 12,-18, 12,-18, 10, -4,  8,  2,  4,  8,  9,  0,  3, -8,  3,
+     6,-12, -4,  1, 25, -5, -9,  6, -7,  0, -9, -7,  3, -5, -4, -4 },
+  {-18, 12,-10, 11,-22,  0,-15,  5, -2,  2, -3,  6, -4, -4, -3,-15,
+    -2, -3, 21,  6,-12,-11, 19,  3,  3,-14,  7,  0,-11,-22,-10,  0 },
+  {-15,  2,-30, 15,-17, 13,-16,  8, -7, 10, -8,  2, 11,  3, 10, -7,
+     7,-22, 12,-10,  3,-12,  6,-10, 12,-10,  7, -8,  5,  2,  9,  1 },
+  { -9, 11,-14,  6,-10, 21,  5, 12, -5,  5,  7, 21,  6,  2, -2, -1,
+    -1,  4,  2,-20,-18, -1,-14,  3, -1,  4, -7, 10,  1, 11,  4, -4 },
+  {-22,  8,-30, 13,-21, -4,  4, -1, 12,  9, -2, -3,  2, -6,  4,-13,
+    -2,  8,  8,  1, -7,  3, -4, -5, -1, -7, -2,  8,  8,  7,  8,  0 },
+  { -6, -4,-35, 16,-13, 15,-11, 14, -7,  9, -1, 11,  7,  0, 13, 10,
+    -1,  8,  1,  1, -2,  8, -1,  2,  2,  3,-10, -1,  7,-13, -3, -7 },
+  {-15,  7,-16, 14,-18, 17, -6, 14,  3,  4,  7, -3, 10,-22,  5,-15,
+     4, -4,-11, 15,-15, 11,-11, 20,  1,  0,  2,  1, 11, -3, 11, -7 },
+  {-12,  3,  5, 16,-37, -1, 15, 15,-15, 10,  3,-10,  1, 15,  7,-15,
+   -13,  8,  9, -3,  2, 12, -8,  2, -5,  0, -3,  4,  5, -9, -4,  5 },
+  {-16, 26, -4, 14,-22, 26,  6, -3, -8,  4, 21,  6, 16, -4,-11,  7,
+   -10,  3,  3,  7, -4,  2, -9,  8, -2,  2,  5, -2, -4, -2,  7, -1 },
+  { -7,-10,  4,  3,  2, -4,-12,-10, -4, -5, 16, 19,-16,  1,  2, -9,
+   -10,  0,  9,  7, -8,  3, 12,  8, -6,-11,-13, -1, -3,-20,  6, -5 },
+  {-14,-17,  3, -5, 14,-12,-12,  8, -6,-25, 21, 21, 10, -8,-12,  4,
+    10, -4,  3, -9, 11,  9,  0,  4,  2,-15,  1,-14,  4,  1,  0, -4 },
+  { -4, -9, -3, -1,  6,  3, -6,  6,-10, -4, 14,  8,  2, -3,-12,-19,
+     0, 11,-20,  1,  6, -2,-27, -6, 10,-17,-14,-17, -9,  8, -8,  3 },
+  {-12,-13, 16, -4, -2, 12, -7,-11,  2,-13,  3,  7,-16,-18, -1,-12,
+    -2,  1,-12, -9, -2, -6,  2,  9,-22, -3, -4,-14, -7,  7, -1,  2 },
+  { -7, -8, -8, 15, 15, 18, 15, 16, -4,-37, 11, 15,-12, -1, -3,  3,
+     6,  6,  0, -5, -3, -5,  9,  1,  1,-11, -1, -8, -6,  2,  3,  0 },
+  { -6,  7, -5,-12, 13, 10,-18, -4, -3,-21,  6, 16,-15, -7,-12, -9,
+     1,-12, -1, 10, -2, -1, -3,  4, -4,  1,-16, -1, 12, -9,  5,  9 },
+  {-14, -5,  9,  3,  4, 26,-28,  3, -6,-24,  4,  5,  3, 13,  5, -1,
+     3, -1,  3,  1,  1, -5,  3,  0, -7, -8, -7, -3,  3, -5,  4,  0 },
+  { -4,  2,-10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3,  2, -7,
+     5, 14,  9, -1,  0,-12,  4, -4,-10,  1, -3,  3, -2, -2, -6, -1 },
+  {-10,  8,-15,-10, 19, 17, -8,  0, -3, -7,  7,  5,-13, -1,  7, -7,
+     1, 13,-12,-13, 17,-12,  1, 26,-18, -3, -5, -6,  4,  5,  8,  1 },
+  {  2, -5,  3,  0,  0,  0,  2, -3, -2, -5,  7, 13, -4,  9,  0, -5,
+     4, -1,-11, -8, -4,  0,-13,  2,-47,-23, -8,-11, -4,  4, -2, -3 },
+  {-18, -4,  4,  5, -1, 17,-12, -8,  1,-12,  7, 20,-12,  3, -2,-11,
+    16, 12, -6,  1,-13,-16, -6, -3, -3, -5,  4,-12, -5, -9, 10,  1 },
+  {-11,  0,  4,  7,  7,  8,  3, -1,  3,-19, 32,  8,-19, -8,  2,  4,
+   -12, 15,-16,  3,  1,  9, -2,  1, -2,  8,  5,  6, -4, -1, 11, -8 },
+  {  3, -1,  4, -2, 14, 32, -9,-23,-10,-12, 22, 15, -1, -2, 10,  0,
+     4,  6, -8,  4,-15, -2, -1, -4,  0, -8,  4,  1, -8,  3,  4,  1 },
+  {-17,-12,  6, -8, 16, 13,-20, -8, -1,-16, 10, 21,-19, 11, -9, -5,
+     7, 18, -6,  7, -7,-18, 13,  2, -2,  8,-12, -9,  2,  4, -5, 16 },
+  {  4,  0, 17,-11, 12,  7,-12,  5, -1,-25, 30, -8, -7, -6, -4, -7,
+     9,  8,  7,  3,  3,-16,  8,  0, -2, -2,-18, -3, -4, -5,  1,  4 },
+  { -3, -6,  6,-16, 17,  6, -3,  2, -9,-17, 12, 11, 11,  2,-20,  8,
+     1,  1,  0,  2, -2, -6,-21,-13, -9,-15, -1, -8, -6, -8,  0, -2 },
+  {-11, -7,  6, -9,  3,  6,  8, 16,  4, -5, 23, 26,-10, -3,  4,  0,
+     2,  2, -4,  4, -2,-12, 12, 10,-11,  0,-10,-16,  3,  0,  0,-10 },
+  { -5,-16, 10, -6, 27, 13, -3,  4, -2,-13, 15,  5,  2,  5,  3, -4,
+    13, 12,-11, -7,  0,  1, 11, 12,  2, 13,-15, -8,  9, -2,  3,  8 },
+  { -5, -8,  4,  3,  9,  3,-11, 10, 14,-25, 14,  8, -2,  5,-12,-21,
+     2, 10, -7,  2, -3,  2,  0,  2, -1, -3, -5, -6, -1,-16,  2,  8 },
+  { -1,  5,  1,-11,  5,  9, -7,  8,-13,-12,  4, 12, -4,  1, -1, -1,
+    27, 29, 10, 15,  2, -6, -3,  4,-21, 10, -9,-11, -6, -1, -9, -3 },
+  { -6, -3, -1, -6, 11, -5,  0, -2, -5,-31, 11,  3, -1,  5, -3,  4,
+     5,  7,-10,  5,-10,-13,  4, 12,-15, -2,  2, -7,  1, -9, -3,-10 },
+  { -3, -7, 17, -8, -5, 36,  8, -7, -8,-20, 12,  8,  1, -1,  3,  0,
+     1,  4,-10,  3,  1,  4, -2, -3, -2, -3,-10,  4, -1, -7,  3,  2 },
+  {-13, -3, -5,  9, 22,  6,-23,  3,-10, -7, 17, 17, 18,-14, -8, -8,
+     2,  4, -8,  2, -3, -8,  6,  4, -1,  7,  0,  0, -3,  0,-12, -3 },
+  { -3,-10,-15, -3,  9,  3,-23, -9,-13,-18, 12, 13, -2,  0,  1,  8,
+    -1,  2, -7,-12, -5, 14,  2,  1,-22,  6,-10, -8, -9, 28, -7,-14 },
+  { -3,  1,  2, -1, 13,  7, -2, -7,  1, -3,  6,  9, -3, -2,  4, -2,
+     2,  1,-10, -2, -2,-22, -2, -7,-10, -5,-11,-27,-12,-16,  4, -7 },
+  {  2, -6, -3,  1,  8,  0, -2, 12, -3, -4, 58, 15,-10, -4, -2,  2,
+    -2,  0, -2, -6,  2,  4, -1,  1, -4,  1, -1, -5, -4, -3,  3,  1 },
+  { 10, -1,  0,  5, 21,  7,-14,  6, -3,-16, 15, 17,-16, 13,  3, -6,
+    -4,  6,-12, -5,  1, -4, -7, -8,  2,  3, -6,  6, -1, -8,  5,  4 },
+  { -6, -2, -8,-11, 15, 10,  0,  8, -6,-15, 33,  8, -2, 18,-15,-11,
+     5, -1,  0, 15,-15, -4, -4, -1, 10,  7,-13,  4, -4,  0,  8,  3 },
+  { -7, -2,  0, -2,  0, -2, -4, -5,-14,-16, 12, 38,  7, 12,  6, -4,
+     0, -1,  0,  3, -2, -6,  0,  2, -9,  1,  0, -1,  0, -2,  4,  1 },
+  { -8, -4, 18,  1, 14,  5,-12, -3, 20,-17,  5, 19,-11, -8, 11, -3,
+     3,  9, -7, -8,  9,-17,  2, 15,-10,-11,  5, -5,  7, 15, -6, -2 },
+  { -7,  2, 38,  5, 19, 16, -5,  4,-13,-20,  0,  4, -4,  6,  4,  2,
+    -7,  6, -8, -2, -5, -7,  6,  3, -4, -3, -2, -3,  7, -6, -4,  0 },
+  {-11,-12,  8,-15, -3, 14, -7,-22,-11,  2, 22, 14,-19,  2,-19, -6,
+     1,  3,-18, 14,  2, -6, -2, -8, -3, -6,  5, -7, -8, -4,  1,  1 },
+  {  8,  7, 25,-21, 12, -6, -5, -4,-10,  6,  0, 10,  1,-12, 18, -5,
+   -15,  4,  1, 14, -1,  5,  8, -7,  1, -7, -3,  9, 10,  1, -1,  0 },
+  {  9, 10, 32,-15,  8,  2, 11, -7,-18, -8,  2, -6, -9,-16, -3,  3,
+    -1,  3,  1, -5,  4, -2,  1, -8,  0, -6, -3,-11,  1,  5,  0,  0 },
+  { 14,  0, 23,-25, 22,  3,  7, 10,  0, -2,  7,  8,  0, 10,  0,  0,
+     3,  2,  3,-10,  0, 10,  0, -7,  0, 10, -1, -5, -7,  1, -1,  2 },
+  { 12,  0, 25,-18, -5, -4, 13,-10,  3, -6,  7, 21,  0,-16,  3,-10,
+    -6,  5, -7, -3,  2,  5,  3, -6,  4,  9, -8, 12, -2,  3,  2,  4 },
+  { 31, 15, 27,-20, 10, -7, 15,-10,  9, -8,  4, -5,  3, -3,  5,  6,
+    11, -2,-12, -2,  6, -2,  1,  2, -1, -1,  1,  1,  3,  1,  1,  2 },
+  { 12, -4, 13,-23, 12, -6,  2,  4, -3, 13,  6, -7,  5,-19, -7, 18,
+     1, -7,  7,  1, 16, -7,  3,  0,  3,  0,-12,  8,-11,  9,  4,  7 },
+  { 29,  1,  3,-22, -5,  6,  0, 12,-14, 11,  1,  6, -3,  4,  6, -2,
+     4,-13, 12,  1,  1,  3,-11,  9,-10, -1, -7, 16,-11, -1,  3,  9 },
+  {  4,  4, 36,-23, -5, -8,-15,  1, -6,  3, 13, -1, -5, -7,  4,  9,
+     2,-11, -3,  5,  1,  3, -6, -1, -4, -4, -2,  2,  3, -1, -5, -2 },
+  { 19, 10,  6,-17,  2, -4, -2, -4, -3, 13,  2,  2,-13, -7, -3,-11,
+     9, -6,  1, -9, -5,  4, -5, -9,-18, -7,-11,  9,  4,-11,  8,  4 },
+  { 16, -3,  9,-16, 18, -2,-12,-16,-11, 11,-18, 16,-13,  6,  2,  8,
+     3,  8, -4,-16, 10,-11, -1, -3, -8,  5, -9, -4,  9, -4,  0, -3 },
+  { 14, 15,  3,-23, -5,  7, -8, -6,  2, 17,  2, 12, -8,-12, 13, -1,
+    -9,  3,  1,  1, 19, 15,  4, -1,  1,  2, -3,  2, -3,  1,  5,  3 },
+  { 32,  5,-10,-47, -5, -1,  4, 11, -7,  0,  2, -2,  1, -7,  6, -4,
+     6,  2, -4, -2,  2, -2,  0, -4,  1, -6, -5,  2, -2, -1, -3, -4 },
+  { 20,  8, 10,-21, -7, -9,-16, 12,  1,  4,  6, -5,  9,-11, -7,  4,
+   -11, 28, -3,  2,  4, -6, 10, -8, -5, -5, -9,  9, -2, -1,  6, -5 },
+  { 38,  3, 23,-25, -6,-18,  3,-10, -8,  6,-10,  1,-10,  2,  2,  0,
+    -7,  2, -4,  5, -1,  8, -3,  0,  3,  3, -1,  1,  0, -4, -4,  0 },
+  { 20,  5, 16,-22, 24,-18,  2,-12,-14, -7, -3, 10,  2,  7,-10,  2,
+    -8,  1,  8, -1,  4,  1,  4, -2,  5, -9,-18, -8,-13,  5,-11, 10 },
+  { 14,  8,-12,-16,  9,-11, -3, -6,-25, -7,  6,  5, -7,-16, 10,  2,
+    -7, -1, -9, -3, 16,  4,  3,  3, -3, -3,-15, 13, -3,  4, 13, -7 },
+  { 16, -9, 19,-23,  7,-19, -3, -5,-15, 11,-21, 21,-16, 18, -1,  6,
+    10,-10, 18,-14, 16,-15,  6, -5, -9,  5,-17, 13,-10, 13,  0, 10 },
+  {  8, -4,  4,-24,  8,-21,-18,  9,-11,  4, -6, 17,  5, -9, -2, -2,
+     2, 15, -2, -3, -2,  1,  7,-13, 15,-10, -8,-11,  3,  3, -1, -1 },
+  { 14, 17,  6,-32,  5,-17, -2,  0, 15, -1, -5, 16,  1, -5, -2,  9,
+    -3,  8,  4, -2, -2, -4, -3,  1,  0,  7, -3,  4, -5,  0, -7,  2 },
+  { 24,  6, 22,-12,  8,  3,-14,  4, -7,  8,  6,  5,  6,  1,  6,-12,
+    15, 10,  4, 11,  9,  6, -7, -4, 10, -9,  2, -1, -5, 11, 15,  3 },
+  { 17, 12,  3,-23,  5, -1, -2,  1, -9, -1, -3,  1,  8,  1, -5, 17,
+    11,  0, -2,-11,  7,  4,  0,-27, -7,  1,  2, -8,  9,  7,  5,  3 },
+  { 12, 10, 12,-10, -4,  5, -1,  2,-24,  5, -8,  2,  6,-17, 19,  5,
+    12, -2, 16, -7, -6,-14,  4,  1, -3, 13,-16,  5, -1,  4,  1,  1 },
+  { 31,  9, 11,-17, 10, -3, -7,  7,  1,  2,  2,  4, -3, -1, 11,  4,
+    -5, -8,  1,  4, 15, -6,-28,  1,  8,  3, -6,  5, 17, -2,  2, -4 },
+  { 11, 19, 16,-26,  0, -7, -7,  2,-13,-15,-12,  9, -3, 27,  8,  4,
+    -6,  1,  4, -6, 11, -1, -6, -7, -3,  0, -6,  4, -6, -7, -3, -1 },
+  { 10, 18, 16,-32, 19, -9, -4, -3, -7,  8,  8, -3,-11, -2, -6,-16,
+    13, 13, -6, -1, 10, -2, -2, -9,  0, -3,  9,  4, 11, -2, -6,  6 },
+  {  9,  4, 19,-33,  4,  7,-12, 36, -3, -1,  8, -2,  2, -8, -9, -4,
+    -8,  0,  1, -1,  0, -4, -4,  3,  0,  3,  6,  0, -6,  2,  0, -2 },
+  { 25,  7, 15,-12,  2,-24, -1, 24, -4,  4,  9,  0, -2, -9,  4,  6,
+     3, 13, -3,  1,  5, -1, -3, -5, -1,  7, -2,  3,  4,  4,  1,  0 },
+  { 19,  6,  8,-20,  9, -9,  5, -4,-13,  7, 11, -3,  5,-13, -9,  6,
+   -11, -1,  0,  4, 11, 26,  3,  6, -7, 12,  6, -3,  1, -9,  7,  1 },
+  { 15,  6, 19,-23, -3, -9,  3, 16, -6, -4,  6, -5,-10,  1, 16,-14,
+     2,  0,  2,-13, -3,  8, -6,  3,  1,  1,  2, -5, 12, -4, -8, -3 },
+  { 14,  4, 16,-20,  1, 12,  0,  6, -3,  9,  4, 16, 10,-16,  5,  7,
+     5, -4, -4,-18, -3,-11, -4,  4, -7,  3, 13,  7,  3,  3,  2, -7 },
+  { 22,  3, -1,-30, 18, -3, -9,  9, -2, 11,-16, -2,-14, 12,  0,  4,
+    -5,  4, -1,  3,-20, 12,  4,-10, -2, -2,-12,-12, 10,  6, 11, -3 },
+  { 15,  7,  2,-21,  5,  4,  9, -9,-33,  7,  7,  3, -6,-14, -8, 10,
+    12,  0,  2, -1,  5,  4, -2,  0, -7,  0,  2,  4,  0,  1, -3,  8 },
+  { -7,  0, 12,  3,  0, -6,  8, -4,  0,  2, 14,-15,  2, -7,-31, -3,
+    14,  0, 14,-15, -1, -4,-15, 10,  1, -3,  1,  2,  5,  2, -8,  1 },
+  { -2,  5,  1,  0, -3,  3,  3, -6, -1,  2, -4,  1,-19,  0,-11, 18,
+    11, 10, 21,  5,  6,  2, 10,  3, -6,  0, -2, 13,  5, -1, -2,  9 },
+  { -9,  1, -5,  0,  0,-15,  8,  4,  8,  3,  8, 12,-13, -2,-39, -2,
+     4, -4,  5, -3, -4,  3, -3,  3, 10,  5,  3,  2, -3,  5, -2,  8 },
+  { -9,  6,  6, -8, 12,-12, 23,-18,  4,-15, -5,  2,-20, 13, -7,  7,
+     7,-12, 14,-12,  6,  1,  1, -3, -8,  9,  0,  1, -7,  3,  7, -6 },
+  {-18, 13,  4,  3,-10,-30,-10, -6,-14,  1, -7, -4,-35,  5,-25, 11,
+     9,  8, 19, -4, -7, -3,-18, -8,  1,  5, 10, -4,-14, -9,  3, -4 },
+  { -6, -1,  4, -9, -9,  4, 20,  0,  0,  3, 11,  7,-16,-17,-20, 11,
+    -6,-14,  1,  4, 19,  2, -8,  6,-15,  3,  6, -5,-14,  3,  7,  2 },
+  {  1,  6, -2, -8, -5, -3,  3, -8, 21,  1,  3, 16,-14, -2, -9, -4,
+    13, -2, 18, 14, 14, 19,-13,  5,-10,  2, -3,  3,  5,  5,  1, -1 },
+  { -1, -5, -6, -2,-11, -7,  5, -4,  5, -1,  0,  3, -3,  2,-19, 18,
+    16,  4, 14,-22, -2,-11,-22,  1, -1, 11,  1,  2, 11,-10,  7,-12 },
+  {  1,  4,  5, -1, -9, -5,  1, 12,  5,  6, 12,  9,-24, 23,  1, 20,
+    14,-11, 13,  5, -2, -2,  5,  6,  2,  1, -9,  6, 10,  5, -4, 11 },
+  { -1, -1,  1,  7, -3, -4,  8,-16, 15, -1, -7,  9,-22,-11,-11, 10,
+    16,  9, -2,  4, 13, 10,  6, 16,  4,  7,  1, -8, -7,-14, -7,  4 },
+  {  1,  3, -6,  0, 15, -9, -4,  0,  4,  6, 12,  9, -6, -5,-22, 17,
+     7,-11, 15, -5,  1,  3,-19,  0,-15, -3, 16,  5,  5, -7,-11, 12 },
+  { -2, -1, 13,  2,  4,-24, 37, -5, -2, -6, 12,  7, -2,-23, -4,  9,
+     2, -3,  3,  2,  3,  3,-14, 11,  0, -4, -2, -2,  3, 10,-10,  4 },
+  {  2,  9,  8, -6,-28, 14, 28,-11, 18,-11,  0,  2, -2,  4,-12,  3,
+     6,  0,  7, -7, -6,  2,  5, -1, -1, -1,  5,  2,  3,  0, -3,  9 },
+  { -7, 14,  5,-10, -3,  7,  4, -5,  7, -8, -7,  4,-12, 14,-16, 25,
+     3,  0,  1, -5, 12,-10,  0,-10,  0, 12, 12, 17, 12, 10, -1,  0 },
+  { -4, -2,  5, -2,-17, -3,  5, -5,  7,-17,  1,  5, -4,  4,-20,  0,
+    11,-15, 13, -8, 10,  1,  1,  5,-12,  9, -8,  0,  6, -1,-11,  4 },
+  { -3, 12, 13,-15, -7, -7,  0,  5, 33,  3,  3, -6,-13, -7,-15, 10,
+     3,  3,  3, -5,  2,  7, -1,  0,-12,  2, 11, -6, -9,  0,  5, 11 },
+  { -8,  5, 10, -7,-14, -4, 13,  0, 18, -3, -6,  7,  1, -6,  0, 21,
+     8, -7, 10, -8, -3, 17, -9,  0, -5,  1,  4,  8, -3, 11, -5,  0 },
+  { -8,  8, -3, -8,  8,-11, 16,-16, 17,  0,  8, 16,-17, 10,-16, 10,
+    -8,  6, 11,  0, 10,  7,  4,  5,  7, -5, -5, -6, -7, -5, -1, 16 },
+  { -6,  0,  6,  1, -8, -8,  8, -7, -5,-10,-11,  8,-19,  6, -7, 13,
+     5, -3,  4, -8,  7, -1,-18,  9,  0, -5,  6, 26,  3,  8,  2,  4 },
+  { -2, -2, 23, -2,-20,  2,  7, -7, -6,-15,  3,  9,-19, -2,-10,  7,
+    -2,  7,  9, 11,  0,  4, -4,  6,  9, -2,  4, -3,  4,  3,  2,  8 },
+  { -6, 12, 10,-10, -7,  4, 17, 11, -6,  1, 12, 11,-18,  8,-12,  4,
+     1, 13,  6,-13, 23,  9, -5,  8, -2, -5,  1,  3,  0, -2, -4,  4 },
+  {  7,  1,  7,-17, -8,  8, -1, -7,  5, -6,  4, -3,-16,  9,-24, 18,
+    -3, 10, 13,-11, -6,-11, -4, 10,  0, 11,  8,  2,  6, -5,-11,  4 },
+  { -4,  1, -5,-10,  0, -3,  9, -2,  4, -1,  1,  5,-41,-10, -7,  4,
+    -3,  3,  1,  0,-12,  4, -3,  0,  2, -1, -2, -5,  3,  2, -7,  5 },
+  { -2,  1,  4,  4, -3, -6,  1,  0, 12, -5, 11,  0,-17, -3, -1, 11,
+     4,  1, 27,-12,  0,-14,  2,-15, -3, -9,  0, -7, -3, 15, -8,  6 },
+  { -6,  4,  9,  2,  4,  3,  7,-10, 28,  1, -2, 48,  7,  0,-10, 10,
+     1, -9,  2, -1,  0,  3, -5,  5, -4, -2,  7,  7,  1,  3,  2,  5 },
+  { -3,  3, -1,  3, -9,  0, -1,  3,  2, -6, 39,-14,-12,  5,-19, 21,
+     7, -6,  4, -1, -4,  0, -4,  1,  0, -9,  1, 10,  0, -2,  0,  7 },
+  {  4,  2,-29, 12,  5, -3, 16, -6, 15,-13, -4, -1,-13, 22,-16, 17,
+    16,  4,  9, -4,  4, -6, -4, 11, -8,  7,  8,  4,  3, -3, -7,-13 },
+  {  0,  3,  3, -6, -4,  0,  9,  0,  5,  0, 10, 10,  4,-13,-12, 16,
+    23, -4,-12, -6, -4, 20,  2,  0, -4, 23,  1,  8, 11, -4, -5, 15 },
+  { -6,  4,-15, -9, -1,-19, 12,-30,-17, -4,  1,-13,-13,  4, -3, 26,
+     5,-25, 11,-14, -6,-13,  0, -7,  9,  2,  8, -1, -8,  1, -8, 13 },
+  {  1,  6,  1, -4, -4,  1,  2,  0, -3,  2, 10,  6, -6, -2,-11,  4,
+    32, 15, 15,-47, -8,  3,-12,  4, -5,  4, -1,  0, -5,  5,  1, -7 },
+  {  2, -1,  0,  0, -1, -6,  0, -6,  4, -4,  5,  9, -5,  1, -3, 51,
+     4, -5,  4,-14, -1, -4, -3,  1, -4, -1,  0,  2, -8,  0,  1,  2 },
+  {  0,  4, -2, -7, -2, -9,  6, -8, 11, -3, -6,  3,-11, -8,-12,  8,
+    11,  5, 19,  3,-24, 19,-14, 11, -5,-18, -8,-12, -5, -4, -1,  4 },
+  { 16,  9, 10, 14,-18, -2,-18,-27, 10, -5, 12, 14,  4,  0, -2, -6,
+   -12, -7, -1,  3,  4,  7, 11, 10,  5, -5, -7,-16, -3, -6,  6,  9 },
+  {  7, 15, -9, 10,-19,  4, -5,-37, -2, -4,  8,  2,  4, -1,  1,  9,
+    -5, -5,-12,  1, -1, -8,  3, -3,  4,  6,  9,  3,  3, -1,  2,  4 },
+  { 13, 17,  3,  9, -7, -7,-15,-17, -8,-13, -4, -8, 19,  2, 16, 25,
+     7, 15,  2, 16, -5, -6,-10, -9, -7, -6, -2, -7,  7,  2,  4,  5 },
+  { 24,  7,  9,  8,-13, -2,  0, -4,  1,-13,  3,  6,  7, 10, -4, 15,
+     5,  7, -4,  5, -5,  3, 13, -7,  5, 15,-11, -2,  7,  5,  8,  6 },
+  { 17,  6,-15, 23, -2, -1, -6, -2,  0, -4, 11, -3, 12, 15,  6, -8,
+   -15, 10, -9,  7, -1,-11,  2, -8, -4,  3,  4,-10,  4,  4, 11,  1 },
+  { 21, 12, -3,  6, -8,  8,-11, -8, -5, -5,  3,  7, -1, -5, 12, 15,
+   -10,-11,  3, 15,  8,  4,  2,-15,  0, 14,  1, -8, -1,  3, 10, -7 },
+  { 16, 12,  5, 13, -6, 15,-23,  0,-17, -9,  0,  4, -9, 13,  6, 18,
+     0,  0, -4, -1,  0, 14,  5, -1,  8, -4, -8, -6,  5, -2, -2,  0 },
+  { 14, 16, -1, 12,-15, -9, -6,-20,  4,  6,  8,  9,  3,  1, -9, -4,
+    -1,-11,  9, 11,-12,  1,-14, -7,  2, -8, 11,  9, -4, 10,  4,-16 },
+  { 13, 10,  3,  7,  0, -8,-33, -6,  4, -4, 19, -2, 14,  6,  5,  7,
+     6, -3, -1,-10,-10, -9,  4, -3,  5,  9,  2,  2, 10,  9, -2, -3 },
+  { 11, 10, 25, 18, -1, -6,-21,-21,-11,-16,  6,  5, 14,  4,  8,  7,
+     0,-10, -7, -9, -5, -4,  3, -1,  1,  6, -1,  6, -2,  2, -3, -9 },
+  { 15,  9,  5, 22,-17, 15, -9,  7,  7, -9, 13,  9, 10, -1,  8, -3,
+    -2,  6,  1, 17,  8,-14,  7, -3, 12,  9,  1,  0,  1, -5, 17,-18 },
+  { 25, 19,-17, 12, -4,-10,  1,-13,-19, -7, -3,  9,  6, -2,  3,  1,
+     4, -2,-11,-14, -1, -7, -5, -9,  7, -1, -3,  4, -5,  1,  0, -1 },
+  { 20,  8, -3,-10,-24,  3, -6, -2,  0,-12, 14,  6,  7, 11,  4,  7,
+   -12, -5, -8,-10,  5, -1, -4,  4, 16,  7,-14,  6, -1, -2, -7,-11 },
+  { 16, 18, 17,  1,-15, -6, -5, -3, -1,-19,  8, -2,  2,  8, 12,-19,
+   -12,  8,  0, -3, -1, -1,  4,-14,  9, -1,-12, -1, -7, 10, -3,  5 },
+  { 18, 12, -7,  7,  0, -3,-13,  0, -1, -4,  9, -2,  6, -1,  0,  1,
+    15,-21,  1, -8, 25,-19, 13, -9,  2, 12,  5, -7, -3, -1, -3,  1 },
+  { 13, 16, -4,  9, -2,  2, -1,-19, -7, -4, 18, -6, 14, 18, -5,  4,
+    -6, -3,-19,-14, -1,-12, 10,  6,  7, 17,-12,-13,-10, -4,  5,  4 },
+  { 27, 17,  4, 14, -9, -2, -4, -8,  0, -6, 14,-11, -7,  2, -3, -3,
+    -2, -3,-13, 12, 16,  1, -5, -9,-10,-11, -2,  3, -7,  5, 11, -7 },
+  {  7, 17,-16, -2,-14,-28, -7, -8, 15,-10,  7, 15,  8, 17, 13, -1,
+     4, -7,-12,-11,  0,  0,  2,  3, -3,  7, -6,  6,  1,-16,  1, -2 },
+  { 23, 11, -9, 15,-23, -4, -6, -4,  2, -9, -7,  9, -8,  3,-13, -4,
+     8, 18, -6, -2,  1, -5,  6,-14, -5, -2, -6, -5, -3, -2,  4, -5 },
+  { 12, 13, 18, 18,-35,  2,  7,-17,  3,-11,  6,  9, -3, -2, 10, -4,
+     3,  3, -2, -7,  0,  2, -4,  0, -4,  0, -6,  5, 10,  4, -3, -1 },
+  { 19, 11,  1, 20,-14,  4, -9,-13, -2, 11,  0, 17, -1, -1, -1, -1,
+    -5, -8,  0,  5, -1, -8,  5, -1,  3,  2,-12, 21, -2,-24,  5,  7 },
+  { 15, 15,-15, 17,-14,-22,  3, -4,-11, -3, -7,  1, 18, 10,  1, 10,
+    -6, -3,  8,  2, -7,  0, -2,  1,  1,  2, -9, -2,  1,  2, -3,  4 },
+  { 45, 13,  8, 17, -5,  2,-16,  2,  8, -2,  8,-15,  4,  5, -1,  7,
+    -6, -2, -6,  2, -3,  0,  0, -9, -1,  7,  2,  3, -3, -3, -1,  5 },
+  {  1, 18, -8, 18,-12,-10,  3,  4,-22,-12, 20,  8, -3,  9,  2, 10,
+   -10, -3,  9,  3,  6, -3, 10, -1, -3,  2, -2,  4,  2,  3, -3,-18 },
+  {  9, 10, -5,  9,-35,-21,-18,-16, -1,-12, -6, -7,-15,-19, 12,  4,
+     4,  9, -7,  2, 14,  1,  4,  0, -1,  6, -7,  2,  1,  1, -4,  4 },
+  { 31,  8,-17, 35, -8,  1, -5, -6, -7, -6, 10, -2, -3,  6,  9,  3,
+    -6, -2,  3,  3,  5, -3,  0,  6,  0,  1, -5, -3, -2, -4, -1,  0 },
+  { 18,  4, -8,  7, -8,-15, -1,-16, 12, 18,  3, 19,  2,  4,  8,  8,
+     0, -5, -8,-12, 10, -5,  0,  1,  0,  4, -3, 16, 11, 11, -2, -6 },
+  { 27, 15,-17,-10,-23,-22, -1,-14, -4, -7, 20, -2, -7,  6, 15, -5,
+    32,  4,  9,-11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 },
+  { 22,  4, -7,  2,-15,-11,-17,-10,  2,  0, 15, 11,  7, 12, -8,  6,
+   -10,-18, -6,-12,  7,  3, 22,  3, -7, 14, -5, -2,-13, -7, -1, -7 },
+  { 18, 13,  9, 24, -4,-19, -9,-11, 13,  8,  2,  4, -1,  8, 14, 10,
+   -12,  0,  0,  5, 10,  5,  4, -1,  5,  1, -1, 11,  2, -4,  0, -9 },
+  { 15, 19, -5,  1, -4,-10, -8,-27,  6,  8,  5, 10,  4, 11,  5, -5,
+   -11,  0,-11,-14, -4, -9, -8, -8,  6, -9,  4, -5, -1,  1,  5, -4 },
+  { 18,  1,-13, 14,-14,  9,-15, -7, 12,  1, 13, -4,-20, 12, 10, 12,
+   -12,  7,  1,-13, 10, -6,  5, -3,  4,  8, 10,-13, -3, -6,  9, -3 },
+  { 19,-14,  5, -8, -6,  2, -5,  5, -3, -1,-28, 11, 18, -6, -4, -2,
+    11, 14,-43,-42,  9,  2, 20,-23,  6, 32,  0,  5,  0,  6,  9,  5 },
+  {  8, 11,-14, -1,  7, 12, -7,  2,-16,  2, 10, -3, -1, -7, -7, -1,
+     1,-10,-60,-23,-18, 42,-13,  9, 18,-11,  0,  1,  0,  2, -5,  1 },
+  { -5, -1,  2,  0,  3, -3,  3, -2, -6,  0, -3, -3,  7,  2,  0, -2,
+    -2,  3,-34,-15, 37, 47, 10, 20,  9,  1,  3,-21,-25,-33,-14,  8 },
+  {  5,  6,  2, -2, -2, -2,  6,  5, -5,  7, -3,  1, -5,-13,  9,  3,
+   -17,-19, -2,-79,-12, -7, -8, -6, -2, -2, -1, -1, -7,-13,  6, -1 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, -1,
+     0,  3,  4,-87,  6,-11, 16, -9, -1,  8,  0,  5,  0,  1,  2,  1 },
+  { -5,  6,  2,-24,  5, -9, -7,  0,  7,  3, -3, 16,-14,-16,  0, 18,
+    15, -9,-14,-28,-17, 53, 14, -6,-28, -1, -3,-10, -7,-14, 19,-15 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -3,  0,
+   -13,  0,-53,  3,-22, 63, 19, 16,  1,-11,  0, -3,  0, -3,  0,  1 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,
+    -1, -6,-43,-43, -2, 65,-13, -4,  9,  1,  1,  2,  1,  0,  0,  1 },
+  {  0,  1,  0,  0, -1,  0,  1,  1,  0,  0,  1,  2, -1, -1, -3, -1,
+   -23,  1,-61,-55,  3,-28, -6, -4, -4,  8,  2,  1,  1, -1,  0,  0 },
+  {  0,  1, -1,  1, -1,  0, -1,  0,  1, -1,  0,  1, -1,  0, -9, -4,
+   -48,-19,-52,-46, 11,-12,  5,-14,  0,-10,  0,  0, -1, -2, -1,  0 },
+  {  0, -3, -1, -4,  2, -1, -7,  3,  1,  3, -1,  1, -3,  0, -7,  0,
+     3, -7,-61,-51, -4,-21,-16,-21,-11, 14, -7,  8,  3, -5,  1,  2 },
+  {  0,  0,  0,  1,  0,  0, -1,  0,  0,  0,  0,  0,  1, -1,  9, -3,
+    56,-11, -6,-67, -1, 13,  0,  7,  1, -9, -1, -1,  0,  0,  1,  0 },
+  { 14,  9, -2, 14,-10,-10,  9, -5,  1, -8,-23, 30,  8, -7, 23,  8,
+     2, 10, -1,-27,-17, 57, 22,  4, -5,  2,-12, -6,  2, -7, -4, -9 },
+  {  1,  5, 12, -2, -2, -3,  2, -3,  6,  0,  4, -2, -8, -6,  0, 16,
+   -15, 29,-55,-29,-24, 29,  3, 10,  6, 13, 10, -5, 21, 11,-14,  5 },
+  {  4,  2, 26, -6, 10, 11,-23,-10,-27,-20,  3,-24,-11,-10,-13, 25,
+   -10,  5, -9,-36, -7, 43,  3,-13,  6, 13, -2,  0,  1,  3, -3, -4 },
+  { -1,  0, -1,  0,  0,  0,  0, -1,  1,  0, -1,  0,  0,  0, -1,  1,
+   -12, 12,-26,-64,-15, 29, 37, -7, -3,-12, -5, 14,  8, -8,-10, -2 },
+  { 19, -4,-11,-16,  8, 14,  5, 19,  3, 22,-11,-21, -1, -6,-11, 11,
+    10,-24,-23,-40, -8, 20, 17,  5, 13, -6,  3, 14,-20, -8,  3, 28 },
+  {  2,-12, 10,-14,-18, 26,-22,  4, -2,  5,-21,  8,  3,  1, 19,  0,
+   -12, 24,-14,-40, 15, 29,-15,  6, 15,  1,-19,  2,  4,  7,-12, -3 },
+  {  0, 17, 13,  7, -5,-11,  2,-19,  3, 38,-21, -3, -6, -4,  7,  1,
+     1, -5,-40,-10, -2, 35,  8,  8,-10, -8, -9, 33,  4,  4,  0, -2 },
+  { -2,-12,  7, 29,-24,  2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2,
+   -37, 15,-22,-40,-11, 33, 10, -1,  8, 10,  6,  8,  9,  0,-12,  2 },
+  { 15, -8, -9, -2,  7,-17,  7, 19, 14,  4, 12, 27, 11, 10,  4, 11,
+   -15, 14,-13,-48,  5, 18,  0, -9,-36,-11,  2,  4,  5,  5,-15,-12 },
+  {-12,  0,  3,  4,  7, -5,  5,-14,-24,-18, -6,-15, -8,-20,  1, -7,
+   -33,-28,-40,-38,-18,-10, -5, 17,-12,  4,  3, -5,  5,-13,  4, -7 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,
+    -3, -9,-49,-60, -5, 45, -1,  6,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,
+    -3, -9,-49,-60, -5, 45, -1,  6,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, -1,  0,  0,  0,
+     3, -2,  9,-29,-11, 55,  8, 32,-36,-13, -7, 37,  4, 11,  0,  3 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+     4, -1,-39, -4,-30, 63, 28,-17, -6, 10,  7,-14, -9, 11,  9,  7 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,
+    13, -2,-50,-32, 22, 51,  4,  7,  6, 11,-20,-13,  9, -5, 21, -4 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,
+    -3, -9,-49,-60, -5, 45, -1,  6,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,
+    -3, -9,-49,-60, -5, 45, -1,  6,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, -1,  0,  0,  0,
+     3, -2,  9,-29,-11, 55,  8, 32,-36,-13, -7, 37,  4, 11,  0,  3 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+     4, -1,-39, -4,-30, 63, 28,-17, -6, 10,  7,-14, -9, 11,  9,  7 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,
+    13, -2,-50,-32, 22, 51,  4,  7,  6, 11,-20,-13,  9, -5, 21, -4 },
+  { -8,  2,  1, 22,-31, -6,-25, -3, -3,  1,-15,-11, -2, -3,  4,-13,
+    -9, 15,-18, 37, -7,-37, 12,-13,-11,-25,-10,-11,-22,  7, 16,  7 },
+  { 14, 10,  4,-10, -1, -5, -7, -3, 16, 13, -5,-15,  5, 11, -1,  8,
+   -27,  7,-12, 49, 17,-22,  9, -2, -9, -1,  2,-15, -1, 41,-18,-17 },
+  { -4, -9,-15, -3,  3,  4,  4,  2,  7, -3, -7, -8, -5, 17,-19, -7,
+    36, -9,-38, 17,  1,-48, 11,-18,-13, -2, -8,  4,-10, -5, 21, 11 },
+  { 15,-13,  4,  2,  1, -5, -2,  1,-10,  7, -1,  3, -6,  0, 11,-11,
+     8, 20,-17, 51,-17,-41,  2, 15,  4,  8, -2, 16,-32, -1, 17,  6 },
+  { -8,  8,-18, -5,  4,  6, -3,  8,  0, -4,  2,  0, -1, -4,  5,  8,
+    30, 30, -8, 70,  2,  8,  2,  0,  7,  1, 13, -1, -6, -7,-11,  2 },
+  { -8, -7,  9,-10,-13,  6,-11,-14, 13, 25,-26,  5,  2, -5, -5,  5,
+    -8,  4,  0, 33, 12,-38, -4,  6, 13,  6, 25, 34, -1, 25,-19, -5 },
+  { 18,  3,-17,  4, -8,  7, 20,  1, -1,  5, -5, -2, -8,  8,-35, 15,
+    24, 43, -5, 51,  5,-12, -3,  1, -2,  3, -3, -3, -9,  8, -9,  2 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
+     2, 10, 24, 76, -2,-22, 11, -1,  4, 33,  4,  1, -1,  1,  2,  0 },
+  {  0, -1,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,  2,  0,
+    24, 13, 32, 70, 26,  5,-21, -9, -6,-15,  2, -2,  2,  4,  1,  1 },
+  {  5, -4,-11,  4, -4, 22, 10, -2, 13,-11, -4,-21,-17,  0, -7,  4,
+    10,-34, 11, 52,  2,-46, -5,  0,  0, -1,  2,  4, -9,  1,  1, -7 },
+  {  0,  1,  1,  0, -1,  0,  1,  0,  1,  1,  0,  1,  0,  0, -3,  1,
+    -8,  9, -1, 64,-13,-61, -3,  3, -5, 10,  1,  3, -1, -1, -1, -1 },
+  {  0,  1,  0, -1,  0, -1,  0,  0,  1,  0,  0,  0,  1,  1,  2,  1,
+    10, -2,-31, 79,-10, 27,  0, -1,  3,  8,  1,  1,  0, -1,  0, -1 },
+  {  3, 12, 10, 26,-19, 10, -9,  6, -4,-15, 10,  3,-16,  6, 11,-19,
+     3, 10, 18, 44,  5,-30,  5, -9, 21,  4, 20, 10, 14,-25,  8,-17 },
+  {  0,  0,  0,  1, -1,  0, -1,  0,  1,  0,  1,  1,  0,  0, -6, -2,
+     8, -8, 13, 69, 26,-19,-25,-17, 16,  6,-12, 22,  2, -6,  9,  5 },
+  {  0, -1,  0,  1,  0, -1, -1,  0,  0,  1, -2,  1,  0,  0, -4, -1,
+   -34,-15,-33, 56,  9,-42,  9, 10,  6,  9, -8,-11,  0, -6, 15,  5 },
+  { 10,  2,-14, -3,-15,-35, -1,  7,-18, 14,  8, -1,-15,-26,  6,-15,
+   -18, 22,  9, 33,  0,-32, -9,  3,-11,  7,  4, -1,  5, 30,  9,  1 },
+  {  4, 15,  0,  6, -5,-11,  9,  6,  6,  6, 14,  2, -1, 10,-24,-25,
+    -2, -4, -1, 37,  2,-29, 14, -9, 22, 17, -2, 33, 10,-25, 11,-11 },
+  {  0,  5,  2, 18,-12, 21, 22, 33, -7, 21, -9, -7,  7,-15, -7, 16,
+     7,  0,-14, 44, 10,-25,  5, -4, 15, -8, 10, -4,  5,  9, -1, 16 },
+  {  3, 13, 12, 12,  8, 25,-23,  8,-22, -3,-18, -8, 15, 12,  9, 19,
+     0,  0, -9, 49,-27,-15, -9,-15, 12, -8,-16, -7, 13,  5, 13,  2 },
+  { 12, -6,  7, -2, 20, -9,-14, 12, 13, -5,-17, 22, -8, -4,  2,  7,
+   -13, -2,-15, 43, -5,-30, 27,  4, 10,-27,  5, 27,-10,-10,-18,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
+    -1, 10,-18, 70, -2,-52, -1, -7,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
+    -1, 10,-18, 70, -2,-52, -1, -7,  0,  0,  0,  0,  0,  0,  0,  0 },
+  { 15,-13,-20, 16,  2, 13,  5,-11, -8, -5, -3,  2, 24,-23, 30, -7,
+    11, 30,-15, 43,  5,-15, 15, -3,-14,  1,-23,  8,  3,  9,  4,-11 },
+  {  0, -1,  0,  1,  0, -1, -1,  0,  0,  1, -2,  1,  0,  0, -4, -1,
+   -34,-15,-33, 56,  9,-42,  9, 10,  6,  9, -8,-11,  0, -6, 15,  5 },
+  { 10,  2,-14, -3,-15,-35, -1,  7,-18, 14,  8, -1,-15,-26,  6,-15,
+   -18, 22,  9, 33,  0,-32, -9,  3,-11,  7,  4, -1,  5, 30,  9,  1 },
+  {  4, 15,  0,  6, -5,-11,  9,  6,  6,  6, 14,  2, -1, 10,-24,-25,
+    -2, -4, -1, 37,  2,-29, 14, -9, 22, 17, -2, 33, 10,-25, 11,-11 },
+  {  0,  5,  2, 18,-12, 21, 22, 33, -7, 21, -9, -7,  7,-15, -7, 16,
+     7,  0,-14, 44, 10,-25,  5, -4, 15, -8, 10, -4,  5,  9, -1, 16 },
+  {  3, 13, 12, 12,  8, 25,-23,  8,-22, -3,-18, -8, 15, 12,  9, 19,
+     0,  0, -9, 49,-27,-15, -9,-15, 12, -8,-16, -7, 13,  5, 13,  2 },
+  { 12, -6,  7, -2, 20, -9,-14, 12, 13, -5,-17, 22, -8, -4,  2,  7,
+   -13, -2,-15, 43, -5,-30, 27,  4, 10,-27,  5, 27,-10,-10,-18,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
+    -1, 10,-18, 70, -2,-52, -1, -7,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
+    -1, 10,-18, 70, -2,-52, -1, -7,  0,  0,  0,  0,  0,  0,  0,  0 },
+  { 15,-13,-20, 16,  2, 13,  5,-11, -8, -5, -3,  2, 24,-23, 30, -7,
+    11, 30,-15, 43,  5,-15, 15, -3,-14,  1,-23,  8,  3,  9,  4,-11 },
+  { 16,-18,  7, -4, 31,-15, -9,-13, 20,-12, -6,  0, 12, -6, -2,  4,
+     3, -3, -1,  0,  1,  3,  3, -2,  1,  6,  4,  0, -3,  2, -5,  1 },
+  { 38, -5,-13, -4,  8,-15, 11,  1,  2, -4, -1,  9, 13,  4,-12, -7,
+     0, -2,  7,  2, -6, -2, -3, -2,  3, -4,  6, 15,  1,  1,-11, -2 },
+  { 47,-22,  9,-26,  3, -5,  2, -7,  4, -2,  2, -2,  3,  0,  3, -4,
+     3, -3,  2, -3,  7, -3, -1,  1,  1, -5,  5,  0,  2, -5, -3, -2 },
+  { 14,-16,  2, -6,  7, -2, -7, -4, -4, -7, 14, -3,  7,-19,-14,-17,
+   -29,  6, 26, 16, -5, 13, -4, -1, 21, 14,  1,  3, -6,  0, -7, -1 },
+  { 29,-11,  5, -3,  4, 11,  4,-10,  1,-22, -3,-10,  5,  4,  2,  8,
+    -2, -7,-12,-12, -8, -3,-18, -2, -9, -5, -1, -3,  2,-14,-14,  7 },
+  { 28,-12,  5,  3,  9, -7,  0, -2,  2,  1,  4,  0, -7, -3, -2,  4,
+     4, 14,  8, -1, -4, 14, -7, 17, -2, -2, -9,  2, 19, -7,  9, -8 },
+  { 31,-18,-22,  8, 15, -5,-10,-15,  1, 10,  6,  7,  6, -8,  2, -1,
+    12, -3,  3, -1,  1,  5, -6, -4,  0,  1,  7,-10, -2,  4, -3, -4 },
+  { 53,-30, -4, 12,  2,  3, -3, -3,  0,  1,  6,  5, -5, -4, -7,  1,
+     0,  2,  1,  3,  1,  5,  0,  2,  2, -1,  0,  4,  2,  0, -2,  0 },
+  { 27,-18, -3, -2,  4, -8,  3, -2,-11,  2, 10, -8, -8, -4,  0, -2,
+     8,  0,  9,  0,-16, 11,  1, -6, 13, -3,-10,-13,-15, 25,  1,  0 },
+  { 35, -5, -1, -8, 23, 11,-14, -3,  2, -2,  8, -6, 17, -2,  7,  0,
+    -2, 10,-17, 13, -2, -2, 11, 11,-14,  2, -2, -3, -8, -1,-12, -5 },
+  { 29, -9,  7,  3,  2,-10,  0,  3,  9,  0, -3,  5,  1,-10, 10, -5,
+     3,  6,-20, -9, -6, -4,  1,  0, 12, 17, -8,  9,  3, -1, -9,  0 },
+  { 15,-16, 18,-19, 16,-15, 17,-18, 13,-16, 17,-14, 15, -9, 13,-17,
+     9, -7,  4, -5,  3, -4, -3,  0, -6,  7, -9,  7, -2,  7, -9,  9 },
+  { 21,-10,  7, -2, 12, -7, 13,-17, 11, -2, 20,  3,  5,-11, -6, -6,
+   -15,  0, -9,  5,-11,  7, -1,  7,  8,-10, -9,  3, -5,  9, -8, -2 },
+  { 23,-22, 15, -5, 16, -4, -3,-12,  9,  3, -1, -2, -8,  2, -2,-16,
+     3,  4, -2, -6, -7, 12, -8,  2,-14,  2, -7, 11, -2,  6, -4, -1 },
+  { 34,-17, -4,  8,  4, -6,  1,  8,  4, 16,  3,  6, 12, -1, -1,-15,
+     6,  4, -7, -6,  6,  0,  2,  1, -2,  2,  3,  3, -3, -2,  8, -6 },
+  { 18,-18,  2, -2, 10,  1, 18,-23, -3,-10,  0,  4, 20,-19, -3, -4,
+     2,  8,  6,  1, -3,  1,  1,  3,  5, -1,-11,  3, -7,  5, -1,  1 },
+  { 15,-14,  2,  3, 10, -8, 12,-13, 13,-15,  6, -8, -4,-10, 14, -9,
+    24,  2, -7,-18, 13,-11,  8, 14, -6, -2,  3, -1, -4,  7, -7, -4 },
+  { 20,-12, 13,  5, -1,-10, 15, -6,  8, -1, -3,-10, 17,  0, -6,-19,
+     2, -1,  8, -3,-16,  0, -3,  2, -2,  0,  8, -9,  0,  1,-10, -9 },
+  { 32,  0, -9, -5, -1,  5, 13,-11,  8,  3, 11,-11,  0, -8, -2,-14,
+     7, 10,  6, -5,  1, 10,  2, 12,-10,  4,  4,  6,  4,  0, -7,-10 },
+  { 16,-14, 10, -7, 11,-11, 11,-11, 18,-13,  8,-15, 16,-11, 13, -9,
+     8, -7, 12,-11,  7, -6,  3, -5,  9, -5,  4, -1,  7, -4,  8, -3 },
+  { 24,-27, -1,  5,  8, -5, 12,  7,  4, -3,  3, -1, -9,-11,-13, -5,
+    10,  0,-13,  7,  1, -5,  4, -9,  7, -3, 13,  2, -5, -3,-17, -2 },
+  { 23,-19, 15,  1,-10,-18,-12, -6,  8, -3, 12,  0,-12,-10, -4, -4,
+     8,-10,  4,  2, -2, -8, 13, -3, -2, -6,  2, -3,  5, -2,  2, 11 },
+  { 25,-12,  4,  2, 24, -3,  3, -6, 14, 11,  0,-21, -3, -3,  1, -8,
+     7,  0,  0,  3,  3, -6, -7,  6,  2,  1, -4,  5, -1, 10, -2,  9 },
+  { 24, -8, -6,  7, 16,-12, 13, -1, 11,-21,  2, -6,  3,-12,  0,  9,
+     4, 11, -7,  1,  4,  1, -8,  3,  3, -6,  3,  3,  0, -8,  8,  4 },
+  { 25,-21, 13, 14, 13,-18,  4, -3,  0, -5, -4,  5, -3,  0,  4, 12,
+     7,  3,  5, -5,  2, -2,  3,-10,  2, -9,-15,  6,  1,  7, -5,  1 },
+  { 23,-16, -2, 10,  4, -1,  3,  1, 32,  3, -5, -2,  9, 10, -1, -4,
+    -6,  2,  9, -1, 14, 12, -6, -1,-17, -2, -4, -9, -7, -6, -8,  3 },
+  { 50, -8,  5,  2,-11, 10,  0,  0,  6, -3,  7,  0, -3, -2, -3,  0,
+     6, -4,  2, -5, -9,  0,  3, 10,  1, -7, -2, -3, -6, -9,  1, -2 },
+  { 28,-17,  0, -2,  2, -9,  1,  5, -4, -1,  0,  0, 19,-27,  5,-12,
+     7,-14, -3, -6, 10, -2, -4, -2,  4, -5, -2, -7,  1,  7, -9,  4 },
+  { 22,-19, -6, -6,  3,-22,  3,  5, 20, -8,-14, -5,  1,  1, 20,  2,
+    16,  6,  3, 14,  4,  3,  5,  1,  5, -7,-10, -6,  3, -6,  1,-14 },
+  { 29,-14, -8, 13,  8,-10, -6,  4,  4, -6,  5, -7,  1, 12, 14, 11,
+    -7,  1,  2, -9,-11, -9,  0,  4, -1,  7, 10,  4,  4, 20, -1,-11 },
+  { 18, -9,  4,  1,  7,-29, 12,  1, -1, -9, -2, -1, -2,  2,  9, -8,
+   -13,  5,  4,-13, -4,  2, -5, -7, -6, 14,-10,-34, -3,  1, -3,-13 },
+  { 38, -9, 24,  8, 11,  4, -6,-11, -2,-12,  1,  1,-11, -8, -5, -2,
+   -15, -8,  8,  0,  1, -7,  5,  4, -1,  8, -2, 11, -3, -1, -5, -5 },
+  {-20, 11, -4, 24,-11,  1, 15,  4,  0,-28,-10, -1, 10, 10, -6,  5,
+    -6,  2,  7, -2,  1, -2, -6, -3, -7,  1,  2, 12, -1,  7,  0, -2 },
+  { -9, 10,-23, 27, -4,-17, 20, -6, 14,-17,  5, -1,  5, -9, -7,  5,
+    -6,  4, -2,  9,  0,  8,  0,  1, -3, -3, -5, -8,  5, -2, -2, 12 },
+  {-10, 19,  4,  9,  1,-16, 17, -2,  9,-29,-16,-11, -4,  7, -5,  4,
+    -1, -3,  3,  2,  3, -4,  5,-12, -2,  6,  5, -4,  4,  1,  4, 10 },
+  {-20, 10,-24, 14, -5, 11,  9,  0, 16,-20, 10, -5, -6, -6, -1,  2,
+    -4,  5,-16,  8, -2,  5,  5,-11,  9,-11,  4,-11, -1, -1,  4,  3 },
+  { -9, 11,  3, 19, 24,  4,  5,-14, 30,-17, -4, -2,-17,  7,  2,  3,
+     1,  3, -7, -4,  2, -3,  1,  4, -1, -1,  3,-12, -2,  3, -3, 10 },
+  {-19, 18, 11, 19, 19, 19, 10,  4, 13,  6,  5,  4,  8,  3, -2, 12,
+    -6, -2,  7, -6, 15, 12, 16, 16, 18, -3, -4,-20,  0, 10, -9, -3 },
+  {-21,  9, 20, 12,  0, -3,  5, -9, 15,-13,  5, -5, -6, 24,  2,  9,
+    -5,  2, -7,  2,  5,  7, -5,  2, 15,  3,  1, -1, -4, -2,  7,  0 },
+  {-18, 16, 13, 15,  2,-10, 14,-11,  4,-11,  5, 12, 12, 20,  8, 30,
+     2, 11, -9,  7,  0, -3,-16, -5, -6,  5, -4,-21,  0,  5,  6,  1 },
+  {-26,  8,-13,  9,  6,-10,  2,-11,  7, -4,  6,-19,-11, -6,-12, 16,
+     0,  5, -7,  8,  5,  6, 17, -9, 10,-10,  5, -3,-11,  2,  4, 10 },
+  {-11, 17, -3, 22, -5, 18,  3,  1,  4, -5, 14,-27,  5, -7, -4, -5,
+   -10, 11,  1, 15,  1,  1, -6, -5, 10,-22, -7, -7,-15, 13, -4,  5 },
+  {-17, 14, -7, 13,  3,  0, 13, -6,  9,-14,-22, -1,  1, 19, 14, -3,
+     4,-13,-13,  2, -4,  8, -2, -2, 13,-12, 13,-12, -7, -5, -3,  6 },
+  {-17, 17, -1, 33,  6,  3,  9,-16,  3,-14, -8,  6,-17,  8,  3, 13,
+     8, -6,  3,  1, -2,  0, -2,  8,  4,  9, 13,-10,  4,-17,  0, -6 },
+  {-20,  7,  7, 21,  1, -3,  7, -3, -2,-12,  9, -7,  2, -3, 14,  1,
+    -1, -7, 12,-10,  5,-20, 11, -2,  0,-24,-17,  6,  6, -4,  3, -1 },
+  { -8, 10,  6,  7, -1, -6, 28, -6, 10,-33,  1,-20,  0,-12, 10,  1,
+    -6,  8, -3, -1,-10,  8,  5,  0, 10, -2,  8, 16, -5, -3, -7,  4 },
+  {-17, 13,  3, 15,  1, -5, 27, -5,  6, -6, 12,  2, -4,  8, -1, -3,
+    -2, 12,-15,  3,  4,  1,  2, -9,  0,-16,-21,  2, -4, 16, -7,  4 },
+  {-15, 20,  8, 17,  5,-14, 15,-11, 21,-11, 13,-13,  2,-15,-13,  1,
+    -5,  5,  2, 10, -9,  4, -1,  3,  2, -4, 13, -5,  1, -4,  5, -3 },
+  {-21,  8,  2, 16, -1,  2, 15,-16, 13,-12,-12, -7, -8,  2, -7, 11,
+    -8,  5,  2, -7, 16, -4,  1, -7,  3,-15,  6, -5, -8,  2, -8,  5 },
+  {-15, 17, -6,  3, -3,  3,  9, -7, 14,-23, 11,  1, -1,  4,  7,  6,
+    -1,-14,  7,  6, -8,  5,  1,-15, 10, -9,  2, -3, -1,  4,-10, -4 },
+  {-10, 18,  3, 11,  1,  4, 14,-14,  7, -4, 15,-10, 10,-11, 10, -4,
+     5,-14, 10,  4, 15,-12, 15,-13, 20,-15, 14,-15,  8,-11,  4, -6 },
+  { -7, 23,  2, 20,  7,  8, 19, -5,  9,-16, -8,-17, -5,  1,  5, -6,
+    -8,  1, -6, -4, 10,  6,  6,  2,-11, -4,  0,  2,  4,  7,  9, -4 },
+  {-15, 20, -5, 22, 11, -8,  9, -5, 10,-13, -8,  8,  2, -2, -3,  7,
+     6, 10,  1,  2, -5, -9,  1, 10, 16,-22, -7,  0,  7,  7,  6,  1 },
+  {-26, 19, -5,  3,  5, 25, 18, -5,  9,-14, -8, -6, -2, -6,  2,  3,
+    -8, -2, -7,  7, -3,  7,  3,  4, -8,  0,  1, -8, -4, -2, -2,  1 },
+  {-20, 14,-10,  6, -3,  7,  8,-32, -2, -7, -2,-10, 16,-12, -9, 15,
+    -2, -5, -6,  2, -7,  5,  9,  1,  6, -7, -1,  0, -2, -4, -7,  3 },
+  {-14, 16,  4, 11, -8,  1, 23, -4, 17,-13,-10,  1, 12,  9, 12, -4,
+     7, -1, -1,  5, -8, -6,  3,  3, -6, -3,-18,  0, 18, 20,  4, -2 },
+  {-33, 19,-10, 30, 15,  2, -3, -1, -4,-14,  7, -7, -1,  7, -8,  9,
+    -1, -3, -5,  2,  2,  4,  0,  5,  0,  0,  2,  3,  3, -3, -3,  4 },
+  { -6, 20,  0,  5, 17,-10, 18,-17,  9,-16,  4,-13, -6,  2,-14, 14,
+   -28,  9,-12, 25, -4,  7,  7, -8,  6, -6, -2,-10,  2,-11, -1,  2 },
+  {-12, 14, 12, 52, -3,  5, -5,  4,  8,-13,  2, -5, -4,  2, -2, -1,
+    -2,  3,  3,  5,  2,  3,  0,  1, -5,  2, -4, -3,  1, -5, -2,  0 },
+  {-13,  6,  9, 24,  0,  8, 14,-15, 18, -9,-11, -8,  3, 15, -2, -4,
+    -9,  4, -3, 12, 14,-13, 11, -4,  2, -4,  0, -6, -6, -6,-14, -1 },
+  {-10, 28,  3, 12,  9,  3, 11,-28,  6,-11, -7,  4,  0,  7,  8, -9,
+     0, -6,  0,-16,  4,  7,  4,  4,  7,  3,  4, -7,  0, -3,-10,  6 },
+  {-11, 14, -2, 19, -1, -1,  7,  9, -2,-27, 10,-14, 15, -4, 12, -4,
+     2, -2, -6, 12, -6,  0, -5, -4, -5,  1,  3,-11,  5, -9,  3, -8 },
+  {-18,  7, 13, 16, -4,  3,  9,-10, 10,-10, -3,-22, -4,-12,  3,-16,
+     0, -3,-16,  8,-11,  1, 10, -7, 15,  3,  0, -1,-13,  8,  1,  6 },
+  {-20, 10,-10, 10,  8, -1,  6,  0, 16,-12,  9,-10, -1, -5, -4,-13,
+    13, 16, -8, 12, -2, 14, 18, 13,  0,-16,  2, -5, -5, -5, -4,  3 },
+  {-14,  5, -7,-17,  5,-13, 23, 20, -4, -1,  1, -6, 13,  5, -1,  4,
+   -14, -2, -7,  8,  3,  2,  2, -7,  2, -1,  4,  7,  3, -9, -1, -5 },
+  {-19,  3,-24,-28, -9, -7, 19,  3,  2, 19,  7,  5,-13,  8,-15,-17,
+     3,-11,  4, 13,  3,  2, -1, -3, -4, -4,  2,  0, -5, -6,  6,  2 },
+  {-17, 18,-30,-20, -2, -3,  1, 15, -1,-11,  6, -4, 11, 11, -4, -5,
+   -10,  0,  0,  1,  3, -7,  8,  2,  5,  1,  5, -5,  1,  6,  4,  1 },
+  { -6,  1,-30,-25, -1, -8, -2, -9,-17, 16,  3, -1, -2, -9, -6, -7,
+    -3, 12,  6, -4,-10,  0, 10, -8, -6, -5, -3,-11, -4,  0, -1, -3 },
+  { -1, -1,-34,-28,  1,-10,  2,  9,  4, 16,  2,  6, 14, 17,  0,  7,
+    -4,  4,  4,  4,  0,  1, -1, -5,  8,  1, -4,  1, -9, -2,  5,  6 },
+  {-11, 14,  1,-31, -7,-24,  9,  7,  6,  5,-13,  1, -1,  3,  4, -1,
+    -2, -8, -6,  3,  5, -4, -6,  7, -2,  5,  3,  3,  0,  0, -5,  2 },
+  {-25,  8,-11,-18,  1, -4,  8, -3, -4, 15,  6, -5,  8,  2,  3,  4,
+    -4,  5,  6,  8, -7,  6,  1,-11,-15,-13,  9, -4,-14, 10, 12,  7 },
+  {-20, 11,-15,-25,  3,  4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7,
+    16,  5, -4, -5, -7, -2, -3, -9, 11, -2,  0, -7,-17, -6,-11,  6 },
+  {-11, 18, -5,-20,-15, -3,  9, 11,-20, 12,  5,  5, 11, -3,  7,  1,
+    10, -6, -3, -3,  3,  3, 14, -7, 10,-17,  9,-11, -2, -6,  7,-12 },
+  {-20,  8,-14,-17, -9,-13, -3,  0,-27,-14, -3,-14,  4,  3,  6, -6,
+     7,  4, 23,  9, 11,  9,  3, -4,  9,  2,  4, -1, -6,  1, -8,-11 },
+  { -9, 14,  2,-37, -7, 13,  6,-11, -6,  9, 18,-11, -6,  2, 12,  4,
+    -1,  3,  1, -2, -2,  1, -9, -4, -2, -3,  3,  5, -6,  0, -2, -8 },
+  {-29,  8, -1,-13, -2,  8, 23,  2,-10,  7, 13, -6, -5, 11, 13,  0,
+   -10,-13, 11,-12,-10,  6,  4,  6,  4,  3,  6, -5, -9, -2, -1,  3 },
+  {-18,  6,-10,-55, -4,-11, -2,  0,  1, -3, -9, -6,  3, -2, -1,  6,
+     3, -1,  3,  1, -4, -7, -2,  6,  3, -2, -1, -3, -2,  0,  4,  1 },
+  {-14,  5,  3,-21, -8,-16, -4, -2,-11, 27, 15,-20,  3,  0,  1,  1,
+     2, -5, -5,  4,  1, -9,  5, -3,  3,  0, -4, -2,-11, -4, -3,  7 },
+  {-17, -1, -9,-17, -8,-18, 12,-13, -9, 13, -3,  3,  3, -3,  1, -2,
+     0, 16, -9,  6, 12,  9,  5, 11,  2,-15,  1, -4,-16,  7, -4,-12 },
+  {-18,  8, -6,-11, -8, -7, 13,  7,  1,  6,  8, -1, 21, -4, 14, 15,
+    18, -4, -3, 15,  0,  9,  4,  7,  3, -1,  9, -2,  0,  7, -8,  2 },
+  {-10,  7,-18,-29,  3, 12, 12,  9, 11,  4, -1,-15,  1, -1,  8, -2,
+    -2, 10,-15, -1,  0,  6, 12, -6, -1, 10, -6, -3,-11, -4,  9, -6 },
+  {-14, 14, -9,-21,-12, -2, -1, -7, -5,-10,  5, -8,  0,  6,  9,-11,
+    11, -3, -5,  3,  8, 15, -2, -4,-22,  4, -6, 12,  2, 13,  6, -7 },
+  {-12, 11, -5,-29,-25,  4, 12,-13,-11, -7,  4,  2,  2, -5,  5,  8,
+     7, -5, -5,  6,  3,-10,  1, -6,  6, -6, -5, -1, -2, -4,  7,  6 },
+  {-15, 11, -5,-16,  0,-13, 26,-23, -6, -3,  5, -2, -2, 21, -6, -3,
+    -5, -1,  6, -1,  0,-13,  2, -3, -9, -1, -4, -3,  5, -4, 12,-16 },
+  { -9,  9, -1,-17, -3, -6, 12,  6,-18, -2, 11,-14, -6,  3, 14,-12,
+   -11, -5, 14,  2,  5, -8, -4,-11,  2, -5, 16,  6, -7, -4,  8, 13 },
+  {-13,  5,  3,-28,-14,  0,  6, 23,  5,  4, -1,-17,  1, -3,  0,  0,
+     5,  4,  0,-18, 14, 10,  4,  2,  5, -2,  4, -3,  2,  0,  2,  0 },
+  {-15,  4,-13,-16, -3,-12, -2,  2,  7, 10,  9,  3, 11,  4, 23, 14,
+     9, 16,  4,  1,-12, -3,  4, -7,-15, -7,-10,-14, -6, -8, -1, -6 },
+  { -7, 10, -5,-10, -3,-13, 16, -1,-12,  7, -3,-12,  2, 13, 13,  2,
+    17, 15,-13,  1, -5, -2,  3, -1,  1, -3,  6, -3,-12,-16,  7, -7 },
+  {-11, -5,-12,-30, -6,-22,  1,  4, -6, -3, 12,  6,  7,  0, 16,  6,
+    -2,  0,-22, -2, -9,  2,-13,  8,  6, -8,  4, -7, -1, -6,  4,  6 },
+  {-14,  5,  1,-27, -4,  2,  1, 14,-11, -7, -8, -4,  1,  8,  0, -6,
+   -13, 11,-12, -7, -5,  1, 10,  7,  3, -2,  0,  6, -8,  2, 10, -1 },
+  {-10, 10,-25,-13,-20, -4, 19,  3, 13,  5,  5,  7, -8,  2,  4,  2,
+     3, -1, -1, -9, 14, 10,  9, 14,  3,  3, -6,  0, -5,  4,  1, -1 },
+  { -9, 15,-18,-17,  4,-11,  6,  7,-12,  8, -1,-11,  2,  3,  7, 16,
+    -3, -9,  7,-12, 23,  0,  6,  7,-14, -9,  8,  1, -2,  6, -2, -1 },
+  { -6,  9,-16,-26,-14,-11,  9, -6,  5, -2, 13, 17, 21,  7, 18,-19,
+     6,-23, -2,-15, -2,  2,-10, -8,  2,  1, -2,  4, -3, -4, -5, -4 },
+  {  0,  6, -5,-28,-17,-32,  2,-10, 11,  3, -5,  9, 10,  3, 11, 11,
+    -3, 12, -2,  2,  4, -6,  9, -4, -4, -4, -4, -9,  2,  0,  2,  4 },
+  {  0, -8,-18,-34, -9, -7, -4,-11, 10, 15, 11, -1, -8, 15,  6,-13,
+     9,  2, -4,-12,  0, -1, 19, 12,  6,  5,  0, -3,-10,-12,  3, -5 },
+  {-10,  6, -9,-17,-12,-11,  9, -6, 11, 11, 18, -7,  0, 16,  4,  2,
+    -6,  3,-12, -1,  0,  1, -5,-22, -2,-12,  0,  6, 17,  5,  5,  6 },
+  { 12, -5,  7,  1, -5, -2, -1,  2,  2, -4, -3, -3, -3, -2,-29, 11,
+     5,-13,-73, 24, 12,  4,-14,-10,  5,  1,  0,-11, -7, -7,  7,  3 },
+  { 10, -3, -1, -3,  4,-11, -5, -2, -8,  7,  9,  2, -8, -6,  6,  7,
+    21, 17,-54, 47,-14,-10, 14, 19, 13, 21, -4,  3,  1,  2, -4,  2 },
+  {-12,  4,-16,-12,  5, -9, -4, 19, -7,-22,-22,-17,  3,  0, -6,  8,
+    23, -4,-55,-28,  2,-26,  2,  1,  4,  0,-13,  6,  0, 10, -7,-11 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, -1,
+    35, -1,-67,-35,-24,-24, -6,  2,  2, -2,  1,  3,  2,  0, -1,  1 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  5,  0,
+    41, -4,-73,-15, 18,  4, 17,  8, -1,-16, -1, -2,  1,  0,  0,  0 },
+  { -4, -4,  4,  6, -1,  2,-16,-10,-15,-10, 21, -2, -6, -2, 14, -7,
+    10, -5,-55, 34,-12, 11,-13, -2,  2, 28,-26,  0,  7,  4, 21, -7 },
+  {  2,  1, 15,-22, 10, -3, 14, -6, -2, 15, -2, -7, 20,  6,-15, -7,
+    23, 10,-60,  8, -4, 29,-22,  2,-13,  9,-10, 12, -1, -3,  4,  7 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1,  0, -1, -2, 11, -5,
+   -21,-11,-60,-27,-17,-39,  6, 36,  0, -8,  2,  2,  0,  0, -2,  3 },
+  {  2, -5,  9,-17, -1,  2, -3, -6,  8, 12,  7, -6,-33,-11,-14,-40,
+    10, 36,-46,  0,-19,  5,  0,-10,  3, 12, -6, -8,  6,-12, -7,  1 },
+  {  1,  1,  0,  0,  0,  0,  1,  0,  0,  0, -1,  0,  1,  0, -2,  0,
+     4, -2,-87, -3, -2,  2, -2, 20,  2,  6, -1,  6,  0,  0,  2, -1 },
+  {  1,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0,  0, -1,  0,  0,  1,
+     1,  7,-76, 41, -7,-24,  0, -6,  3,  6,  0, -2, -1,  1,  0,  0 },
+  {  0, -3,  4,  2,  3,  2,  2,  0,  3, -1,  4,  0, -1,  4, -2, -4,
+   -32,-11,-64,-29, -9,-43,  2,-11, -1, -7,  0, -4, -2, -2, -2,  2 },
+  { 10,-20,  3, -3, 13, 13,  0, -4,  2,  7, -8,  7, -2,  2,-20,-20,
+   -19,  3,-47,-18,-16, -6,-15,-42,-17, 14, -6,  8, 12,-10, 11,-12 },
+  { -3, -2, -2, -1, -1,  4, -3, -1, -6, -2,  3,  2, -3,  6, -1, -9,
+    10, 13,-68, -9, 26,  3,  5,  3,-21, 10,-15, 21,-22, 19, 11,-14 },
+  {  1,  5, 18,-19,-29,-13, -2, 18,-10, 20,  2, 10,-10, 11,  1,  8,
+   -16,-17,-41, 10,-14,-25,  0,-14,-19, 17,  7,-12, 14,-11, 14,  5 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, -1,-43,  5,
+     6,-12,-48, 19,  8,-38, -8, -3, 22,-21,-10, 15, 20, -9, -5,  8 },
+  {  0,  0,  0,  0, -1,  1, -1,  0,  0,  0,  0,  0,  0,  0,  6, -3,
+    22,-14,-71,-24, -2,-33, 23,  7, -8,  7, -3,  2, -4,  1, -8, -2 },
+  {  1,  0, -1,  2,  0, -2,  0,  0, -1,  0,  4,  0, 26, -1, 10,-11,
+   -17,-32,-58, 14,-14,-11, -2, 15,  2, -8, 12, 10, -9, 13,-33,-14 },
+  { 15,-17,-19,  7, -8,-15,-32,-22,  7, 12, 18,  0,  0,-15, -4, 16,
+    37, -2,-46, 11,  2, -8,-10, -8, 14,  9, -4,  5,  7,-17,  4,  3 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -2,  0,
+    -5,  3,-85, 23, -9,-17, -2, -2,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -2,  0,
+    -5,  3,-85, 23, -9,-17, -2, -2,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  1,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0,  0, -1,  0,  0,  1,
+     1,  7,-76, 41, -7,-24,  0, -6,  3,  6,  0, -2, -1,  1,  0,  0 },
+  {  0, -3,  4,  2,  3,  2,  2,  0,  3, -1,  4,  0, -1,  4, -2, -4,
+   -32,-11,-64,-29, -9,-43,  2,-11, -1, -7,  0, -4, -2, -2, -2,  2 },
+  { 10,-20,  3, -3, 13, 13,  0, -4,  2,  7, -8,  7, -2,  2,-20,-20,
+   -19,  3,-47,-18,-16, -6,-15,-42,-17, 14, -6,  8, 12,-10, 11,-12 },
+  { -3, -2, -2, -1, -1,  4, -3, -1, -6, -2,  3,  2, -3,  6, -1, -9,
+    10, 13,-68, -9, 26,  3,  5,  3,-21, 10,-15, 21,-22, 19, 11,-14 },
+  {  1,  5, 18,-19,-29,-13, -2, 18,-10, 20,  2, 10,-10, 11,  1,  8,
+   -16,-17,-41, 10,-14,-25,  0,-14,-19, 17,  7,-12, 14,-11, 14,  5 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, -1,-43,  5,
+     6,-12,-48, 19,  8,-38, -8, -3, 22,-21,-10, 15, 20, -9, -5,  8 },
+  {  0,  0,  0,  0, -1,  1, -1,  0,  0,  0,  0,  0,  0,  0,  6, -3,
+    22,-14,-71,-24, -2,-33, 23,  7, -8,  7, -3,  2, -4,  1, -8, -2 },
+  {  1,  0, -1,  2,  0, -2,  0,  0, -1,  0,  4,  0, 26, -1, 10,-11,
+   -17,-32,-58, 14,-14,-11, -2, 15,  2, -8, 12, 10, -9, 13,-33,-14 },
+  { 15,-17,-19,  7, -8,-15,-32,-22,  7, 12, 18,  0,  0,-15, -4, 16,
+    37, -2,-46, 11,  2, -8,-10, -8, 14,  9, -4,  5,  7,-17,  4,  3 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -2,  0,
+    -5,  3,-85, 23, -9,-17, -2, -2,  0,  0,  0,  0,  0,  0,  0,  0 },
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -2,  0,
+    -5,  3,-85, 23, -9,-17, -2, -2,  0,  0,  0,  0,  0,  0,  0,  0 },
+  { 16, 65, -2, -2,  4,  3,  0, -7,  3,  1,  3,  1,  0,  5,  1, -5,
+     0,  2, -1,  3,  0,  0, -1, -2,  6,  0, -2,  0,  0, -1,  1,  1 },
+  {  5, 37, -4,  8, -4, -1,  9, 17,  6, -7,  5, -1, 11,  6, -4,  7,
+    -2,  4,  1, -3, 11,  3,  3, -9,  6,  0, -2, -4, -5,  4,-12,-11 },
+  { 15, 24,-14,  2,  6, 17, 26,  5,  8, 11, -9, -7, -6, -8,  3, -5,
+     9, 10, -3, 10,  0,  1,  4, -9,  4,  9,  3,  0,  4,  0, -5,  3 },
+  {  9, 36, -9, -8,  7,  7,  4,  3, -1,-16, -2,  7, -5, -6,  6, 12,
+   -11,-12,  9, -1, -3, -9, 12,  6, -6,  2,  2,  5,  0,  5,  6, -6 },
+  { 25, 39, -5, 24,  3, 10,  3, -6, 13, -8,  3, -7,  2,-10, -5,  2,
+    -2,  3,  5, -2,  1,  5, -2,  3, -4,  1, -5, -4,  0,  1, -2,  0 },
+  { 16, 27, -1,  0,-14,  6,  4, -5,  7, -2, -6,  0, -3, -5,  2, -1,
+    -1,-19,  5, -8,  0, 11, 12,  5,  0,  3, 10,  6,-14, 14,-13,-15 },
+  { 12, 23,-14,  2,  1,  4, -3, 16,  7, -8,  2, -8,  8,  6, -8, -7,
+    -3,  0,  2,  8,-13,  7, 13, -6, -4,  6,-13,-16, 14, 11, -7,  5 },
+  { 16, 28, -7, -1,  6, -3,  9,  0, -7,  3,  0,  3,-12, 20,  8,  9,
+     8, 23,  8,-13, -2,  4,  9,  3, -5, 13,  5, -2, 12, 14,  5, -1 },
+  { 19, 37, 19,  5,  7,  5, 10,  5, 19, 10, 14,  0,  2,  5,  1, -4,
+    -4,  2,  2, -5, -2, -1,  2, -6, -4, -4, -5, -3,  2, -2, -2, -2 },
+  { 24, 21,  1,-11,-10, 17,-14, 14,  6, -1, -6, -1,  0,-13, -1,-12,
+    -2, -5,  6, -4,-12, 14,  5, -2, -8, -8, 15, -7,-30,-12,  4,  0 },
+  { 11, 26, -3,  3,  5, -1, -2,  3, -2, 10, 15, -4, 10,-28, 10,-17,
+    -8,  1,  2, -7, -1, -6,-15, -1,  4,  5, -7,  9,  0, -5, -4,  4 },
+  { 18, 32,  1,  2, -7,  4, 15,  2, -9, -2, 12,-11,  7, 11, 13,  2,
+     0,  5,  9,-10, 16,  3, -3,  5, -9,-23,  2, -2, -1,  5,  2, 11 },
+  { 35, 24,-20,  2,  4, -1,  5, 14,-10, -9,  8, -7,  0,  5, -7, -7,
+    11,  1,  5,  3,  2,  0, -2,  3,  0,  1,  4,  0, -2, -8,  0, -4 },
+  {  9, 35, -1,  2, -1,-19, -3, 12, -1,  8,  8,-13, -1, -2,  2,  5,
+    -8, -1, 13, -2, 11,  1,  0,-10,  0, -3, -7,  2,  1,-12,  3, 12 },
+  { 20, 27,-12,-12,  7,  4, -1,-13, -1, -9,  2, 13,-11,  5,  7, -9,
+     9,  1,  1,  8, -9,  0, -6,  7,  4,  2, -2,  7,  3, -2,  1, -9 },
+  {  8, 37,-20, -5,  0,-21, 10, -8,  3, 19, -9,  7, -3, -8, 10, -2,
+     0,  5,  6, -4, -2, -1,  0, -7,  6,  1,  0,  4, -5,  6, -8,  2 },
+  {  8, 27,  1, -3, -5,  1,  6,  0, 15,  2, 17, -1,  3,-17, 10,  5,
+     5, -6, -6,  6,-10, 18, -5,  0,  0, 13,  7, 10, -5, -6, -2, -4 },
+  { 14, 29,-20, -4, -3,  1, -5, -1,  2, 12,-10, -3,  4,-18,  4, 14,
+    -4, -1, -9, 15, -2,  2, -5, -3,  2,  9, -2,-14, -3,  4, -4, -7 },
+  { 23, 23,-23,-11, 27,  4,  4, -1,  7,  0, -5,  9,  2,-11,  3,  7,
+    -2, -5,  2, -7, -7, 13, -3, -6,  2,  3,  3, -4, -1, -8,  5, -2 },
+  { 16, 26, -6,  8, -9, -1, -2, -1, -8,  4, -2,  0,-12,  9, -1,  0,
+   -17, -9, 30, -5,-15,-16,-13,  0, 10,-11, -7, -3, -1,  0,-11, -2 },
+  { 12, 32, -4, -5, 10, 19,-10,  4,-12,  5, -6,  9,-12, -6, -6, -8,
+     4,  1,  3,  0,  8,  0, -3, -4, -7, -4, 10,  8,  6,  5, -1,  4 },
+  { 46, 42, -3,-14, -2, -6,  6, -2, -5, -1, -3, -3,  1, -1,  3,  1,
+     1,  4, -1,  2,  3,  1, -2,  6,  0, -1, -2,  4, -2, -1,  2,  2 },
+  {  9, 33,-13,  4,-11,  3, -8, 22, 12, -2,  4,  0,-16,  5,  4, -1,
+     7, -6, -9,  1,  7,  5,  0, -5,  5, -1, 10,  3, -2, -1,  3, -2 },
+  {  9, 30,  6, -3,  6,  1, -7,  5, 11, 14,  7,  1,  0,  2,  2, -1,
+     8,  7, -6,-13,-10, -2,  1, -6, 10,  7,  6,  5, -2, -5, -1,-16 },
+  {  9, 28,-11,-10,  9,-10, 15,  8,  4,  9, -4, -7,  0, -5,  9,  8,
+    -7,  2,-15,-23,  4, -4,  4, 16, -8, -3,  0, -8, 14,  5, -3, 15 },
+  { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2,  4, -7, -8, -5, -4, 16,
+     0,  0, -7, -2,-13, -5, -2,  3, 12,  1,  3, -5,  2,  2,  0, -1 },
+  { 11, 37,  7,-23,  6, -1, 15, 13,  4, -9,  7,  5,  3, -3, -5, -8,
+    -2,  3, -5, -1, -8,  7,  2, 13,  1,  3,  0, -3, -1,  2,  0, -2 },
+  { 21, 33,  7, 20, 21,-10,  6, -5, -5, -6, -9,  2, 10,  0,  8, -4,
+    10,  2, -2, -2,  0,-10, -6, -2,  0, -5,  3,-11,  3, -9, -3,  1 },
+  {  6, 30,-15, -8, 16,  1,  4,  6,  4,  5,  8, -3,  8, -9, -1, -6,
+     8,  2, -2,  4, -2,  5, 11,-21,  3,-10, 16,-11, 24, 10, 14, -6 },
+  { 15, 36, -3, -9,-20, 12,  0, -7,-18, -4, -8, -9,  9, -7, -3, -1,
+     2,  7, -5, -8,  6,  2,  2, -1,  7,  1,  1, -3,  3, -4, -8,  1 },
+  { 16, 34, 21,  3, -9, 10,  7,  9, -7,  1, -4, -9, -4, -5, -5,  3,
+     3,-19,  1,  5,  4, -2, -6, -5,-10,-11, -8, -2,  2, -5, -8, -7 },
+  { 28, 29, -3, 18, -2,  0, -6, 12, -2, 10,-11, -4,-13,-12, -6, -4,
+     0,  4, -1, -8,  6,  4, 12, 11, 10, 10, -3, -6,  1,  2,  1,  7 },
+  {  3,  8, 22, -8,  3, 36, -8, -1,  9,  6,-13,-14,  8, -1,  1,  2,
+    -2, -8,  0,  3,  1,  2, -1,  5, -1, -8,  0, -2,  2,  2, -1,  1 },
+  {  0,  6,  0,  0,  4, 13, -7,-16, -6, 15,-14,-21, -9,-10,-10, -6,
+   -21,  5,  4,  2, 12,  4, 12, 11, -4, -6, -6,-10, -7,-18,  1,  4 },
+  { -1,  3, 10,  1, -1, 15,  4, -7,-16,  3,  0,-22, 10,  2, -3, -2,
+    13,  5, -8, 16, -5,  4,  0,-11,-10,-22,  0, -4,-17,  5,  2,  1 },
+  { 12,  8, -4, -9, 14, 40,-21,  0,  1,-15,-10,-12, 12,  6,-10,  2,
+     8,  6,-12,-10,-11,  1,  0,-11,  2,  1, 13,  0,  6,  3,  8,  4 },
+  {-10,  3,  5, -4, -3,  3,  0, -9,  2,  8,-22,-23, 17,  8,-17, -3,
+    14, -8, -4,  1, -8,  3,  0,  5, -1, -3, -2, -4,  1,-10,  0, -2 },
+  {  0, -1,  5, -7,  4, 12, -2,  0, -7,  2,-16,-15, 12, 21, -7, -4,
+     7, -7,-11,-15, -7, -9, -5, -8,  0, -6,  8, -3, -8, 22, -7, -9 },
+  {  7, 19,  4, -9, 24, 22,  2, -6,  8, 13,-14,-20, -4, 11,  8, -4,
+    -1,  2,  0, -7,  5,-17, -3,  3, -6,  5,  3,  4, -5, -7, -3, 14 },
+  { -2,  6,  2,  8, -2,  5, -4, -2,-10,  3,-45,-30, -3, -3,-12, -4,
+    -3, -3, -1,  9, -6, -6,  5, -4,  0,  5, -1, -2, -1,  0, -6, -1 },
+  { -3, 14,-16,-10, 10,  0, -2,-40, -9, 12,  2,-19, 15, -4,  4,  3,
+     3, -4,  7,  1, -4, -5,  0,  4, -1,  0, -9, -2, -4, -1, -2,  0 },
+  {  7, 16,  2, -7,  8,  2,  0,  1,  5, 21,-10,-26,  7,  2, -9, -7,
+    -3,-16,  8,  5,  5, -6, 10,  4,-14, -6,  5,  3, -2, -2, -4,  1 },
+  { -9, 14, -1,  3,  3, 11,  1, -5, -3, 13,-16,-18, 20,  6, -5,  0,
+    -3,  2,  8,  4,-19, -9, 12,  0, -8,  2,  2,  1,  6, 13, -7,-11 },
+  {  2,  5, 16, -4, 19, 15,  4,  0,-11,  7,-10,-10,-16, 18,-11,-12,
+    -9, -4,  7, -4, -4,-17,  1,  1, -8, -3, -3,  5, -2, -6,-11, -5 },
+  {  2, 12,  0, -9,-10, 14,  6,  2, -3,  2,-12,-28, 12,  1, -1,  2,
+     0, -3, -4,  7, 16,  5, -7,  8, -4, -3, -1,  3,-12,  4,-17, -5 },
+  { -4,  7, 11,  6,  1, 14, -4, -6,  5,  5, -6,-24, 23, -9,-15, 13,
+    -7, -9,-15, 10, -1,  8, -5,  1, 12,  6,  2,  0,  4, -2,  9,-10 },
+  {  1,  5, 11,  3,  6, 12, -3,  8,-21,  5, -7,-20, 12, -2, -9, -3,
+    17, -7, -8, -9,-14,  3,-13, 18, -8,  9,  2, -8,  4, -8, -5, -2 },
+  { -3, -3, -1,  5, -2, 15,  3,  2,  1, -8,  1,-39, -6, 13,-13,  0,
+    -2, -5, -6, -3,  0, -5, -2, 15, -9,  5, -3, -6, -2,  7,  0,-13 },
+  {  2,  8,  5,-12,-13, 22,  8,-16, 11,  5, -2,-32, -2, -4, 11,  5,
+     5, -6,  1,  3,  1,  5,  3,  6, -5,  4,  4, -8,  8,  4,  1,  3 },
+  { 13,  9,  5, -4,  9, 18,-11,  2, -1, 15,-10,-19, -2, 14,  0,-10,
+     1,  1,-18,  3,  2, -6, -8, 20,  7, -8, 16,  9,  9,-13, -3, -2 },
+  {-13, 11, 11, -9,-10, 13, -3,-18,  2, 10,  5,-21,  6, 15,-11,-21,
+     3, 14,  0,-12,  9, -1, -2, -4,  3, -3, -9, -8, -5, -2, -8,  2 },
+  {  3,  3, 11,  4,  0, 13,  1, -8, 10, 13, -6,-26,  2, 12, -3, -5,
+    12, -2,  1,  8, -7,-17,-19,  5, 10,  7, -3,  2, -3,  0,  5,  0 },
+  {  5,  0,  3, -3, -9,  5,-15, -5, -5, 17, -5,-31,  0, 13, 13,  5,
+    -1, -6,-14,  7, -8,  9,-14, -2,-16, -4, -4, -6,  6, -6,-10,  6 },
+  { 13,  3,  1,  7, -3,  4, -1, -2, -1,  4, -8,-32, -1, -4,  0,  3,
+   -10,  7, 10,-10,  4, -1,  6,  2,-16, -9,  4,  3, 13,-23, -3, -4 },
+  {  4, 11, -4, -9,  4, 11,-12,-12,-12,  6,  1,-28, -3, 14, 18, -2,
+   -12,  7, 15, -3, -5, -7, -3,  2, -6,  4,  4, -2, -5, -3,  2,-13 },
+  {  8,  7, -7,  0, 13,  7, -8, -7,  8, 36,-10,-22,  3, 23, -3,-10,
+    -3, 11,  1, -7,  3,  3, -1, -7, -4,  2,  3,  2,  5,  3, -4, -1 },
+  { -1,  1, 13,  1, -6, -1, -6, -9,-18, 17, -5,-37, -1, -1, -6, -4,
+     1, -6,-15,  2, 17, -9,  0, -3,  0,  4,  0, -5,  0,  4,  1, -5 },
+  {  0, 14,  5,  0, -7,  2, -6, 17, -6, -9,  7,-16, -5, 23,-14,-13,
+     8,-15, 11, 10,-11,-13,-33, -5, -2,  1,  6,  8,  0,-13, -9,  5 },
+  { 11,  7, -2, -8,  9, 11, 25,-14,  7,  3, -1,-33, 14,  8, -6,-19,
+     3,  3,  2, -1, -3, -1, -2,-10, -3,  1,  2,  1,  4,  2, -3,  4 },
+  { -2,  8,  4, -2,  9, 13, -4, -2,-15, -3, 19,-37,  9, 25, -9,  2,
+    -5, -2, -2, -4,  4,  2,  2,  0,  3,  3,  3,  5, -2, -3, -4, -3 },
+  { 10, 13, -1,-15,  4,  6,-18, -4, 25,  1,-23,-17, 15, 13, -8, -8,
+     7,  4, -5,  3,  6,  9, -7,  6,  0, -5,  8,  0, -6, -1, -2, -2 },
+  {  1,  3,  9, -5, 27, 15, -9,-31, -1, 23, -2, -9,  1,  8, -1, -7,
+    -2, -8, -4, -4, -2, -1,  3,  5,  0,  0, -1,  1, -7,  7, -3, -3 },
+  { -8,  7,  3, -6,  8,  3,-11, -2, 36, 14,  1,-30,  6, 10,-12, -6,
+    -6, -2, -4, -3, -5,  0,  9,  4, -5, -5, -8, 12,  4, -3,  1, -8 },
+  { -2,  9, 33,  0, 12, -3, -7, -4, -4, -1,  6,-25, 11, -6, -9,-11,
+    -2, -4, -2,  6, -1, -3, -6, 15, -6,  3, 10, -4,  1,  0,  5,  8 },
+  {-22,-21, -9,-19, -5, -7,-12,-15, -8,  9,-19, 14, -7, -4,  5, -8,
+    -2,  7,  1, -3,  4, -4,  6, 11,  2,  6, -3, -5,  2, -2,  0, -3 },
+  {-32,-13,  3,-24,  3, -8,  4,  1,-10, 14,-15,  0,  4,  6, -1,  6,
+     7, -1,  6,  4, -3,-17,  1,  4, -6, -1,  1,  0,  3,  3, -7, -4 },
+  {-32,-11,  7, -8,-12, 13, -5,-22, -4, 12,-16,  2,  0,  4,  0,  1,
+     0,  6, -5, -8,  2,  6,  5,  0, -3, -6,  5,  6,  5,  5, 13, -4 },
+  {-44,-33,  6, -4,  2,  0, -9, 10,  3,  4,  7,  0, -1,  7,  5,  1,
+     1, -3,  1,  6, -1,  0,  2,  3, -4,  0,  0,  1,  0, -1, -2, -1 },
+  {-30,-18,-24, -8,  5,  0, -2, 14,  7,  0,  1, 12,  6,  4, -9,  7,
+     5,  7,-11, -5,  1, -8, -1,  2,  2, -9,  7, -1,  7,  5,  6,  6 },
+  {-22,-20,-13, -9, 20, -3, 10, -8,  6, -4,  2, -7, 10,  8,  0, -1,
+     2, -3,  6,-19,  2,  4,  3,  3, -7,  2, -1, -6,  1,  1,  6, -2 },
+  {-27, -8, -1,  3, -1,-11, 24,  4, -1,  1, -8,  8,  5,-11, 15, -3,
+   -15, -1, -1,-13, -1,  1, -5,  5,  2,  3, -9,  0,  4,  3, -7,  6 },
+  {-33,-16, -1, -8, 10,-23,  6, 13, -1, -3, -9,  0,  5, -7, -5,-12,
+    -2,  3,  3,  6, -2, -3,  2, -3,  9, -6, -3, -2,  0,  5, -3, -4 },
+  {-22,-17, 11, -3,  3,  1, -1, -5, 17,  2,-15, -2, 10, -9,  6, 14,
+   -16,-12, 20, -1, -7,  6, -3,-12,  1, 10,-10, -1,  7, -3, -1, 10 },
+  {-28,-13,  1, -3, -1, -1,  0,  3,  3,  5,  1, 10,-10, -3,  7,  2,
+     4, 19, -1, -1, 10,  5, -8,  1, 11,-15, -4, -3, -5,  4,-13,  3 },
+  {-22,-13, 42,-20,  5,-13,  7,-11,  1,  1, -1,  1,  6,  3,  6,-11,
+     3,  3, -2,  0, -4,  4, -3, -1, -5,  2,  0,  0, -9, -1,  4,  4 },
+  {-26,-15, -2, -6, -4, -2, 16,  8, 21,  8,  1, -3,-10,  7, -8,-12,
+    -5, 12, -9,  3, -2, -3, 18,  1,-12,-15, -4,  5, -3,  0, 12,  7 },
+  {-26,-16,  5,  6, 14, -3, 15,  6,  1, -7,-13, 16,-15,  5, 11, -2,
+     9, -7, -4, -2,  0,  0, -2,  7, -8, -6, -5,  2,  7, -3,  2, 12 },
+  {-31,-17, -8,-30,  4, 14,  6, -6,  6,-11,  0,  3, -4,  0,  0, -4,
+     0, -4,  1,  4,  3,  4,  0, -5,  3,  2,  2,  0,  2,  1,  3,  5 },
+  {-61,-10,  4, 10,  4,  7,  0, -3,  0,  1,  0, -3,  0,  1,  0, -2,
+    -1,  1,  2, -2,  4, -3,  1,  1, -1,  1, -2, -4, -4,  4,  0,  0 },
+  {-28,-13, -8, -4,  3, -3,  2,  1, 11, 14,  3,  9,  1, 13,  3,  5,
+    -3, -2, -2,-12,-14, -9,-11,-15,-12, -5, -4,-12,  3, -3,  0, -5 },
+  {-41,  0, 12,-24, 13,  4,  5, 16, -5, -4,  0,  0, 13, -4,  1, -9,
+     9, -6, -1,  6, -2,  5,  2,  9,  6, -9, -8,  8, -2, -3, -6, -4 },
+  {-26,-19, -2,-15,  4,-14,  6,  0, 26, 20,  8,  9,  9,  3, -4, -5,
+    -8,  1,  0, -1,  5,  9,  3,  4,  4,  7,  1,  3, -2, -2,-10,  0 },
+  {-29,-18,  9, -4,  1, -5,-14,-12,  5,-10, -5,  4, -5,  0, -1, -1,
+     4, -5,  7,-16,-11,  2,  7,-15,  2, -4,  6, -4, -6,  7, -3,  7 },
+  {-27,-16,  9,-14,  3, -8,  9,  0,  7, -4, -3, -7,  0,-10, -1,  2,
+     1, -2, 15,-10, 14,  7,  6, 17,  3, -4,  3,-10,  8, -8,  3, 11 },
+  {-21,-20, -8, -8,  4,  5, -3, -2,  0, -5, 14,-10, 11, -4, 13,  0,
+     5,-11, 19,-18, 18,  3, -5, -3, -4, -8, 11,-10, 10,  3,  4, -9 },
+  {-35,-15, 13,-12,  4,  0, -2, -4,-12, -3, -8,-24, -7,  1,  7,  8,
+    -3,  0, -2, -1,  3, -2, -2, -6,  8,  1,  0,  1, -6, -1,  2, -6 },
+  {-19,-14, 13,-10,  9, -1,  1,  3,-12,  5,-16,  7, 13,  9,  4, -4,
+     6, -5,  4,  9, -3, 17, -4, 12,-11, -6, -5, -6, 13,  2,  7, -9 },
+  {-34, -8, -4,  1,  2, -1,  3,  6,-20,-11,  8, -1,  4,  2, -9,  4,
+    -4, -5, 16, 10, -4, 14,-13,  1, -6,  0,  2,-10,  0, -3, -3,  7 },
+  {-36,-10, -8, -3,  2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15,-11,
+     0,  2,  3, -1,  4,  0,  8, -1,  0, 18,-11, -5, 15, -5, 13,-12 },
+  {-22,-13, 14,-20, 15, 25, 16, 10,  8, -2,-10, -5, -1, -8, 11,  8,
+    -1, -2, -4,  1,  2, -1, -7,  0,  0,  0, -3,  0,  2, -1,  0,  2 },
+  {-31,-22,  7,  6, -2,  5,-20, 14, -6,  7,  0, 14,  3, -7,  3, -6,
+    -2,  1, -3, -5,  1,-10,  1,-24,  6, -2,  3, -7,  1, -7,  8,  7 },
+  {-25,-20, -3, -9, 10,  6, 12,  7,  5,  4, -3,  6, -1, -5, -6, -8,
+     3,  5,  6,  5,-10, 10, -4,-15,-15, -2, -9,  2, 18,  1,  8, 12 },
+  {-24,-19, -2, -4, -7, 11,  6,  9, 16,  2, -7, 18,  6, -7,  6,  6,
+    -2, -9,  3, 12, -2,  3, -1,  6,  7,  8,  0,  8,-11,  8,  4,  2 },
+  {-26,-20,-12,-12, -2, -3,  1, -5, -1, -2,  0,  3,  7,  9, -2,  2,
+     9, 22, 13,  4, -4, -1, -2,-14,  5, 15, -8, -5, -7,-11,-14, -6 },
+  {-21,-18, -1, -4,  0,  3,  7, -2, 10,  8, -8, -1, 15,  1, -9,  3,
+     1,  3, -5, -2,  2,  4,  0, -1, 10,  2,-19, -8,  8, 30, -7,  8 },
+  {-25, -6, 26,  4, -8,  4, -2, 21,  5, -4,-16,  5, 13,  4,-10, -1,
+    -6, -2,  2,-10,-13,  1,  3, -3, -6, -8,  2, 11,  1, -7,  0,  5 },
+  {  0, -1, -2, 19,-12,-48, -6, 11,  8, -2, -4, -2, -7,  5, -3,  2,
+    -2, -1, -1, -7,  0, -3, -3, -4, -4,  4,  1,  3, -3, -1, -2, -5 },
+  {-11, -8,-28, 18, 16,-24, -8, 19,  4,  8,-12,  9, -4, -2,  4, -7,
+     6,  2,  3,  3, -4,  0,  1, -6, -4, -2,  2,  6,  0, -3,  1,-16 },
+  { -9, -5,-26,  7, -3,-37,-16, -2,  2, -7,  4,-13,  0, -4, -6, -5,
+    -6, -4,  0,  3,  4, -3, -4, -4,  4, -3,  9, -4, -2,  2,  7, -4 },
+  {  2,  9,-18,  7, 29,-24, -1,  7, 14, 10,  3, -3, -2, -5,  6,-10,
+    -6, -3, -8,  0,  5,  1,  4,  3,-12,  2,  6,  1,  3,  4,  1, -3 },
+  {-20,  2,  8, 20, -9,-24, -4, 18,  3, 11, -1,-11,  6,  9, -1, -3,
+     1, -1,-15,  3, 15,  9,  3,  2,-13,  2, -8,  8,  1, -1,  1, -8 },
+  {-12,  5,-11,  6, 19,-26,-17, -6,  4, 14,  6, -8,  9,  5, -6, -5,
+     2, -1, 20,  1,-11,-10,-18, 20, -7,  0, -3,  4,  2,  0, 10,  4 },
+  {-15,  1, -2, 13, -8,-21,-22,  4,  4,  3,  3, -7,-31,  4,-10,-14,
+     0,  8,  4,  5,  8, 11,  2, -8,  6,  7,  0, -2,  6,  8,  8,  7 },
+  {-13,-10, -9, 12, 19,-16, -3, -2,  9,  2, 11,-29, -1,  9,  4, -3,
+     1,-10,-10, 16,  1,  7, -7, -6, -4, -1, -5,  3,  6,  0,  3,  1 },
+  {-17, -1, -5, 19, 12, -9,-21, -5,  2, 12, -7, -7, -3,  8,  7, -2,
+     6, -9, -9,  1, -4,  1,  1,  3,-14,  2, -8,  0, 10,  1,-12, -6 },
+  {-13, -5,  8, 15,  0,-20, -2, 20,  8, -8,  8,-19, 12, 10,  2,-11,
+     0, 12,  1,-11,  0,-11,-15,  5,-11,  2,  4, -4,-11,  5, -4, -5 },
+  {  3,-11, -7,  8,  0,-17,-26, 15, 19, -7, 10, -9, -5, -5, 14,-25,
+     0, -8,  2, -9, -3,  9,  1, -6,  4, -4,  3, -9, -1,  6,  2,  2 },
+  {-12,  5,  5,  9, 14,-18,-19,  4,  2, 16, 14,-21,-15, -9, -1, 16,
+    12,-11,-10, -5, -7,  4, 15, -8, -5, -1,  1, 14, 13, -7, -1, -4 },
+  {-10, -5, -1,  8,  7,-23,-10, 14,  6, 11, 10,-16, -3, 16,  6,  0,
+     0,  9,  6, -2, -7,  1, 22,  5,  3, -8,  0,  3, -2,-10,  3,  0 },
+  { -2,-14,  2, 16, 15,-17,-17,  6, 19,  4,-10,-15, -1, 15, 11,-14,
+    -8,  5,  8,  8, -2, -8,-11, 10, 10, -8,-14,  2, 13,  4, -2,-12 },
+  {-10,  3,  6,  4, 19,-23,-19,  1,  4, -9,-30,  3, -6, 18,  0,  2,
+     0,-11,  0,  3,  7, -2,  8,  5,  2, -3,  6, -9,  1, -4,  7, -6 },
+  {  9,  5, -2, 21, 20,-33,-13,  7,-10,  8,  8,-15, -6, -4,  1,  5,
+     3,  7, -2, -9, -1,  4, -6,  1,  0,  9, -1, -5,  2,  1, -3,  3 },
+  { -9, -3,  3, 15, -3,-30, -7, -7,-25,  6,  2, -6,  1, 19,  1,-12,
+     1, -8,-13,  9, 13,  1,  8,  2,  5, 15, -2,  3, -9,  0, -4,  4 },
+  { -6,-12,-17, 25, 22,-13,-10,  9,  2, 11, -7,-16,  4,  6,  1,  0,
+     0, 18, -4, -5,  4, -2, -1, -5,  0, -4,  6,  1,  6, -1,  7,  0 },
+  { -1,  0,-10,  8,  8,-27,  0, -2, 29, 16, -2, -4,  9, -1,  2,  0,
+     6, 10,  6,  4,  2, -7,  9,-18,  3,  3,  3,-10, 17, 10,  9, -6 },
+  { -3,-12, -6, 11, 20,-32,  5, 21,  3, -4, -9,  2,-10,  1,  7, -4,
+     5,  0,  0, -1, -8, -9, -7,  4,-10,  5,  0,  2, -5,  4,  9,  1 },
+  { -5, -1, -5,  1,  2,-19,-13,  1,  6, 12,  2,-16,-17, 11, 10, 13,
+    16,-12,-11,  3, -6,  0,  6,  4, -3,  1,  8,  2,  5,-11,  3,-14 },
+  {-19,  5, 10, 11,  2,-23, -9, 16, -2,  7,  0,-11, -7, 10,  6, -7,
+    26,-15, -4,  8,  6, -4,  7, -9,-15,  1,  8, -4,  4,  2,-12, 16 },
+  {-11,  1, 11, -4,  1,-31,-13, -1,  8,  5,  4, -2,  0, 13,  7,-17,
+     7,-10, -6,  1,  4, -1,  2, -9, -4,  9,  3,  3, -4, -5,  3,  4 },
+  { -3,  1, 10, -1,  0,-15,-22,  4, 40,-11, -4, -3,-14,  9, 11, -1,
+     9, -1, -6,  6,  3, -6,  0,  0,-12,  7, -2,  0,  9,  3,  1,  3 },
+  { -1, -1, -1, 14,  8,-24,-14, -8,  5,  8,  5,-12,-17,  8,  2,  7,
+    10, -8,  0,  4, -6, -6,-10,  8,  4,-12,  3, -9,-12,  5,  4, -3 },
+  { -5,  1,-11,  8,  9,-24,  0,  2,  2, 14,-12,-13,  1,  6,  7,  0,
+     7, -6,  9, 26, 11,-14,  8, 10,  1,  9,  0, 11, -2,  6,  2,-10 },
+  {-13,  1,  4, 34, 19,-17,-15,  0,  3, -2, -7, -1,  0, -3, -3, -1,
+     1, -1,-10,  8,  5,  0, -8,  4,-17,  9, -2,  0,  0,  6,  2, -3 },
+  { -6, -4,  1,  2,  2,-14,-29,  0,  9, 34, -3, -5,-14,  6,-10, -9,
+    -5, -1,  0,  3,  3,  0,  1, -1, -2, -1, -1, -3, -3, -4,  3, -3 },
+  { -4,  6,  3, 14, 14, -8,-29, 31, 11, 14, -4, -5, -6, 10,  6, -9,
+    -1,-11, -7,  1,  7,  4,  1, -6,  4,  0, 10, -7, -5, -1,  2,  4 },
+  { -4, -4, -2, 14,  6,-32, -6,-14, 14, -5,-11, 10,-18, -4,  6, -8,
+     9,  5, -4,  1, -4,  5, -2, -9,  3,  5,  2,-10, -6,-17,  3, 17 },
+  {-16,  9, 21, 19,  4,-20,-17, 14,  9, 15, -6,-17, -1,  1,  6, -3,
+     1,  1,  8, -3, -6,  6,  9,  4,  9, -9, -5,  1, -1,  0, -1,  2 },
+  { -7, -5,  3, 19,  1,-20, -9, 14, 21, -7,-18, -9, 26, -7,-17, -7,
+    12,  6,  0, -9, -6, 14,  9, -9, -8,  4, 15, -7, -9, -1,  9,  1 },
+  {-20, 30, -6, 11, 24, -4,  0, -6, -2,  8, -4, 12, -8,-17,  0,  5,
+    -4,  1, -1,  3, -3,  5,  3,  3,  7, -2, -3, -2,  4,  0,  0, -1 },
+  {-35, 17,  6,  1, -9, -1,-16,  3,-20,-13,  8,  7, -4, -7, -4,-20,
+     7, 12, -5,  5, -5,-11, 12, -1, 15, -9, -6, 16, -4, -9,-13,  4 },
+  {-21, 36,-19,  9,  0, -7, -8,  9, -4, -3,  3,  0,  7, -8, -2, -2,
+   -11, 13, -1,  5, -3,  7,  2,  3, -1, -2, -5,  1, -1, -2, -5, -3 },
+  {-12, 33, -4,  1,-12, -9,  0,-13, -1,  2, -8,  4,-10,  6,-16, -7,
+    -1, -4,-10, 15, -1,  0, -5, -8,  5,  5, -3,  0,  2, -7,  1, -7 },
+  {-14, 32,  5, -7,-15,  3, -5,  8, 14,  5,  9, 13,  3, 18, -3,  7,
+     4,-10,-10, 10, -1,  2,  0, -2,-11,  5, -3, -4,  2,  2,  7,  4 },
+  {-14, 34,  1, 20, -1,-12,  0, -3, -7, -4,  7, 18,  9, -3, 14, -7,
+    -9,-20, -7, -4,-13, 12,  1, 12,  5, -6,  2, -4,  0,-15,  1,  3 },
+  {-21, 23,  7, -8,  3,-13, -3,  0, -6, -2, -7,  6,-12,  9, -6, -2,
+    -2, -4, -1,  6,  9,  5, -9, 15,  0,  8, -8,  7,  6,-15,  3, -5 },
+  {-27, 32, -1, -4, -2,  4,-10, 12, -3,  8, 13,  7,  0,-15,  4, -2,
+     3,  5,  7, -4,  9,-12, -1, -2, -1, -4,  0, -4,  2, -5,  6, -6 },
+  {-17, 29, 15,  0, -1, -4,-10, 13, 12, -1, -8,-10,-10,  4,  7, -2,
+     6, -5,-13, 19,  6,  1, -7,  2, -9, -2, 12, -4, -8, -3,  2,  4 },
+  {-38, 27, 16,-15, -6,  3, -7, -4,  0, -1,  6, -2, -3, -6,  6, -6,
+    -3,  0,  2,  0, -4,  6,  1, -1,  0,  4, -1,  3,  4,  1, -2,  5 },
+  {-33, 40, -4,  2,  1,  0,  0,-10,-14,  0, -7,  4, -1,  3, -2,  5,
+     7,  6, -1,  4,  1,  3,  1, -7,  1, -4,  5,  7,  0,  4,  3, -4 },
+  {-20, 25, 12, -4, 16, -4,  2,  2,-14, -2, -3, 29, -1,  1,  3,  1,
+     9, -5,  2, -8, -3,  1, -7, -2, -7,  1,  0,  4, 16, -2, -1, -1 },
+  {-10, 30, 17,  3, -5, -2,  0, -5,-22,  4,  5,  5, -3,-18, -6, 10,
+    -5, -7,  2,  8,  7, -7,-11, -2,  0, -3,  3,  2, 11, -4,  4, -4 },
+  {-11, 30, 11,  4, -3, -8,  1, -2,  4, 18,  3,  1, -1,  0, -8, -4,
+    -3, 10, 13, 14,  5, -5,  1,  1,-10,  2, 15,  4,  9, -1, -5, -3 },
+  {-17, 32, 18,-18, -3, -5,  6, 10,  1,-15, -5,  9,  8,-12,-10, -6,
+    11,  9, -5, -8, -7, 10,  5,-10,-14, -4, -3,  1,  9,-11,  2,  1 },
+  {-13, 28,-11, -1,  2,-16, -2,  7,-24,  0,  3,  6,  3, -1, -8, -7,
+   -12,  2,  2,-20, 10,  4,  0,-13, -2, -2,  1,  8,-14,  0,  4,  1 },
+  {-14, 23, 12,  8,  8,-26,  2, -4,-14, 13,-14, 15,  3, -9, -1,-13,
+   -10, -2,-10,  6,-16, 12,  8,  0,  9,-10, -7, -4, -4,  7, -8,  8 },
+  {-20, 45, 10,-14,  4, 16,  8, -9,  1, -8, 10,  5, -7, -2,  2, -5,
+    -1,  0, -5,  4, -6, -2,  4,  1,  3,  4, -4,  2, -2, -2,  5,  1 },
+  {-20, 26, -4,  1,  7,  4, -8,  1, -5,-13,  2, 13, -7, -3,  6, -6,
+    22,  0,  5, 11, -4,-11,  8, -9,  2, -2, -4, -2,  2,-13, -4, -8 },
+  {-28, 18, 17,  3, -8,-23,-16, -6,  5,-10, 14, 10,  5, -1, -8,  4,
+    -2, 13, -3, -2,  3,  4,  3, -2, -3, -4,  0,  1,  3,  4,  0,  4 },
+  {-12, 32, -6,-16, 18, 12,-16,  0,  7, 13, -4,  5, -8, -1, -3,  4,
+     6, -2, -1,-13,  4, -1,  3, 12, -3,-10,  1,  6,  8,-11, -2,  4 },
+  {-18, 26,  2,  5,  0, -9,-17, 14,  5,  1,  7, -3, -8, -3, 11,  7,
+    -5,-12, -8,  7,  0, -7,  2,-12, -9, 13,-11,  9,  6,-11, -5, 11 },
+  {-24, 22,-15, -9,  8,  1, -7,-12, -9,  3, 11, 15, 14,-11, 12,-15,
+    -5,  7, -2,  0, -8,  3,  3, -1,  2, 11,-11, 14, -6, 13,  1, -6 },
+  {-20, 28, 18, -4, -6, -5, 12, 14,  2, 10,-13, -6, -8, -6,-13, -1,
+   -26, 22, -3,-14,  6,  0, 10,-15,-13, -9,  6, -7,  1, -5, -4, -1 },
+  {-19, 26, -8, -3,-14, -6, -9, -4, -8, 15, -8,  3,-12, -4, -2, -7,
+    -5,  3, 13, -3, -4,-25,  4, -1,  5,-12, -1,-13,  5,  2,  0,  6 },
+  {-18, 43, 14, -8,  1,-23, -2, -2,  1,  3, -7,  0,  0,  8, -1, -3,
+    -5,  1,  5,  2,  0, -2, -2, -2,  1, -1, -1, -7,  0,  3, -3,  9 },
+  {-11, 30, 10,-14,  3,  1, 10,-11,  1, -7, -4, 14,  2,  1, -9,  1,
+   -11, -2, -7,  5,-11,  1,  3, 14,  1,-16, -8,  3, -5,  7, -4,  4 },
+  {-18, 24,  6,  3,  8,  7,-22, -7, -7,  3, -8,  4, 23,  9,  3, -1,
+     3,  6,  7, -1, -7,  6,  4,  1, -3,  1, -6, -1,  2, -7,  3,  3 },
+  {-15, 38, -7, -1,-11,  2,-17,-24, 24,  8,  7, -4, -5,  2,  2, -7,
+     1,  4,  0, -9,  5,  0, -1,  1, -1, -5, -6,  3,  0,  7,  8, -3 },
+  {-14, 22,  1, -5,  9,-12, -9, -5, -6,  5,  7,  8, -1, -4, -9, -3,
+   -33,-16, -9, -1, 12,-11, 17, -7, -3, -1, -7,  3,  2, -3, 16, -4 },
+  {-14, 20,  6,  4,-10, -4, -4, -4,  1, -7,  2,  6,  8,-12,  4,  1,
+    -1, 12, 10,  3,-14,-10, -3, 18, -2, 33, -5,-17, 17, -5,  9,  7 },
+  {-12, 23, 13,  0,-11, -8,-11, 12, -5, -9,-16, 11,  6,  4, 12, -5,
+     5,-13,  7,-12, -3,  1,  2, 12,  1, -4, -1,  5,  4, 11,-12, -3 },
+  { 15,  2, 14,  7,  1,  2,  1, 12, 10, 23,  4,  6,-20,-10,  4, 26,
+    -6, 13,  4,  3,  2,-11,  5, -7,-10,  4,  9,  1, 10, -4, 11,  4 },
+  { 17, 15, 31, 17, 18, 16, 11, 24,  2,  4,  2,  3, -8, -3,  7, -3,
+    -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6,  2, -1,  4, -2 },
+  { 16,  8, 15, 14,  3,  7, 21,  9,  8, 15, 21,  6,  8, 12,  5, -5,
+     7, -3, 10,  2, -3,  8,  6,  0,  5,  5,  6, -3,  2,  4,  0, -5 },
+  {  5, -4,  6, 12,  6, 13, 24, 17, -5, 17, -1, -6, -7,-10, -8,-18,
+     3, -2,  2,  7,-15,-11, 12, -3, -2, -2, -4, -7,  2,  0,  5,  5 },
+  { 10, -6,  8, 11, 12, 20, 22,-11, -3, 15, -3, 15, -2, -2,  0,  2,
+     5, -8,  4, -5, -9, -4, -1,  2, -1, -3,  1,  3, 13, -1,  9,  7 },
+  { -5,  8,  5, 11, 14, -5, 14, -9,  2, 35,  8, 15,  1, -2,  2, -2,
+     4, -9, -3,-14,-12, -2, -2, -4, -2, -8, -3,  1, -6,  3, 10,  0 },
+  { 16,  0, -6, 15, -3,  4,  4,  3,  3, 20,  5, -4, 10,  9, -9, -3,
+   -10, -2, -7, 11,-11,-10, 17, -1,  3,-15,  2,  9,-15,-10, 16, 10 },
+  { 14,  4, -7, 19,  3,  0, 19,  8, 16, 34, -9,  6,-13, -1,  6,  5,
+    -1, -2,  4,  3,  2,  1,  1, -1,  0, -7,  2, -1,  1,  0,  6, -1 },
+  {  1,  6,  9, 13,  9, 10, 15, 16, 10, 18, 13, 17,  3, -1, -7,  2,
+   -15,-11,-10, -4,-13, -6,-17,-13, -6,-14,  1,-10,  6,  4, -1, -1 },
+  { 13,  1,  7, 10, 14, 13, -7,  5,  5, 28, 14, 14, -2,  2,  3, -3,
+   -13, -4, 10, -9, 19, -4, -3,  4, -5, -5,  0,  5, -5,  0,  3, -4 },
+  {  1,  0,  6, 22,  9, 18, 18, -3,  5, 10, 12, -2,  1, -3, -8,-12,
+     9,-10, -7,  1, -1, 19,  0,  2, -8,-11,-10,  9,  6, 11,  0,  3 },
+  { 10, 11, 19, 44,  0, 14,  1, -7,  6, 22,  2, -1,  9,  2,  0, -4,
+     4,  0, -6, -6,  3,  0,  0, -2,  2, -5,  1, -2,  0,  1,  1,  1 },
+  {  5,  7,  0, 32, 30, 26,  5,  4, -7, -3, 15, -6,  3,-10,  7,  6,
+    -8, -7,  2,-13, -5, -1, -3,  7,  3, -2, -8,  0,  6,  4,  5,  0 },
+  {  9,  8, -2,  4,  2, 11,  4, 29, -5, 14,  8, -5,-14,  8,  0,  9,
+     8,-10,  5,-15, -6, -9,  9, -1, 18,-16,  9,-21, -3,-13, -2,  8 },
+  { 25,  7, -9, 23, 20, 18,  6, 16, -9,  8,  8, -5, 11, 13, -8,  7,
+     4, 10, -2, -1, -7, -9, -7, -9, -4,  1,  1, -5,-10,  8,  4, -5 },
+  {  9,  2, 16, 14, -5, 14,  1,  0,-21, 17, -1,  9, 12, -3, -3,  4,
+    -4, 14, 10,  3,  0,-10,  7,  4,  4,-11,  2,  4, -1, -3,  9, -1 },
+  { 17,  8, 11, 26, 15, -3, 14, -1, 12,  9, 10, -8,  8,-18,-11, -3,
+   -14, -7,  7, -3, -3, -4,  1, -7, -3,  2, -3, 16, 10,  0,  9,  6 },
+  {  9,  8,  3,  8, 18, 14, 11,  1, 10,  6,  1, -4,-16, -2, 14, -2,
+     1,  8, 12, 14,  3, -3,  8,  8, 12,-15,  3, -3,  3, -2, 14, 10 },
+  { 22, -3,-11, 13, -7, 11,  4, 11,  3, 14,  0, -6, -2, -9,  4,  2,
+    -2,  0, -5,-27,-10,  3, -1,  5,  8,-24, -3,-11, -3,  2, 11, -1 },
+  { 19,  2,  8, 36,  5, -6,  3, 15, -3, -4, -5, 14,-10,  1,-12,-10,
+    -3, -4,  3, -2,  1, -8,  4,  3,  5, -3,  0,  4,  8, -2,  8,  4 },
+  {  8, 14, 15,  9, -4, 10,  5, 11,  9, 10,  8,  9,-15, 15,  6, -8,
+   -10,-13,  5, -8,-20,-13, -6,-11, -1, -3, -6, -4, -1,  0, 13, 15 },
+  { -2, -1,  9, 12,  2,  2, 13,  3,-23, 33, 15,  2, -4, -1,  3,  8,
+     8,  6,  6, -7,  8,  6,  9, -1,  3, -8,  0, -4,  1, -8, 11, -1 },
+  {  6,  5, -6, 16,  2, -3, 31, 21, -9, 12,  0, -1, -4,  1,-12,  3,
+   -13,-18,  2,-11, -9,  2, -8, -6, 11, -3, -1,  0, -1,  0, 13,  5 },
+  {  5, -1,  2,  0, 25,  5, 10, 16, -5, 21, 14, 12, 13,  2, -5,  5,
+     5, -3, -2,-14,  0,-12,  7, 11, -1, -7, 19, -1, -1, -1,  8, -1 },
+  { 10,  7,  3, 11,  0,  8, 22,  3,  3, 19, -4, 12, 15,  9,  5, 15,
+     2,  1,  2,-10,-10,  0,  2, -1,  0,  1,-12, -1, 21, 16,  9, -7 },
+  { 11, -4, -5, 24, -7, 11, 20, 11,-15, 18,  5,-13,-15,  0, -5,  9,
+     1,  0, -1, -9,  4, -8,  6, -8,  1, -2, -7, 20,  9,  3,  9,  3 },
+  { 20,  0,-12, -6,  9, 31,  9, 12,  8, 27, 15,  7,-16,  5, -3, -7,
+    -1, -9, -2, -7, -3,  4, -8, -3,  3, -6, -2, -2, -3, -6, -1,  2 },
+  {  6, -6, 48,  8, -3, 19, 12, 11, -7,  2,  3,  0, -1,  1,  8, -4,
+     4, -6,  0, -4, -4, -3,  3,  6,  3,-13, -8,  5, -3, -7,  8,  5 },
+  {  7, -2,  6, 11, 12,  2, 14,  4, -5, 12,  2,  9,  4,  2,  0, -1,
+     2,  0,-15, -9,-16, -2,  8,-17, -5,-22,-19, -5, -1,-10,  1, -2 },
+  { 11, -9,  3, 12,  6,  6,  1, 17, -6, 19, 14,  7, -7, -1, -1, -9,
+     9,-11,-17,  0, -6, 16,  0,  1,  9,-24,  3,  3, -9, -3,  3, -2 },
+  {  9,  0,  1,  8,  1,  7,  2, -5, -3,  8, -1,  7,  2,  6, -3, -6,
+     5, -2,  6, -2, -4, -3,  0, -3, 13,-50,  1, -2,  2,  4,  4,  3 },
+  {  7,  0, 26, 21, -4,  2, 17,  8,  7, 11, -7,  1, -1,-15, -1,-15,
+   -11, -4,-17, -4,  1, -7,  3,  6,  3, -9,  2,  3,  6, 10,  6, 12 },
+  {  1, -2,  2, -1,-10, -4,  6, -3, -5, -2, -8,  2,  2,  2,  8,  0,
+     1,  1,  6,  0, 11, 13,  3,  4,  0,-12, 11, -5, 19, 20,  2,  5 },
+  {  5,  3,-13, -2,  1,-12, 11, -7,-12,  7, 10,  0,  7,  0, -2,  4,
+    -6, -9,-11,-12,-23, 12, 10, -3,  0,  6, 19, -1, 24, 18,  9, 12 },
+  {  6, -3,  2,  5,  2,  2, -2, -5, -8,-11, -4,  3, -8, -4,  5, -3,
+   -16, -4,  3,-12, -4,  3, 32,  7,  2,  8, 32,-18, -1, 12,  1,  7 },
+  {  0, -8, -1,  0, -8,  7, -8, -1, -1,  4,-12, -1,  3,  0,  1,-18,
+     8,  8,-14,-10,-11, 19,  9,  5, -7,  6,  8, -4, 26, 12, -1,  6 },
+  {  3,  5,-14,  7, 14,  8, 20,-13,-16,-10, -2, 17, -7,  4, -8, -9,
+    14, -5,  3, -4,-12,  7, 14,-10,-19,-20, 35,  8, 13, 14, -2,  9 },
+  { -2, -4, -1,  1, -3,  0, -1,  1,  2,  2,  6,  0,  0,  4,  5, -2,
+     3,  3,  3, -2, -7, -3, -3, -1,  6, -2, 29, 22, 13, 34,  0, 14 },
+  { -3, -9,  3,  1,  5, -4,  2,  0,  7, -9,  0,  2, -5, -3,  0,  6,
+    -1, -1, -1,  2,  2,  4,  8,  7, 20, -6,  7, 16, 33, 20,  6, -1 },
+  {-11,  1, -3, -3,-11,  3, -9,-25, -1,-16,  4, -8, 15,  1, -2,  7,
+     8, 23,  2, 18,-13, 16,  3, -7,  6,  3, 16, -8, 12, 16,  3,  4 },
+  {  0,  5,  5, -5,  1, -1,  2, -3, -2,  1,-13,  2,  2, 10,  6,  7,
+    18, 18,  7,  9,  8,  9, 21, 14,  7, 12, 15, 14, 15, 12, 11,  5 },
+  {  1, -5, 11, -2, 17,  8,  3,  0, -1,  6, 11, -7,  6,  6,  7,  5,
+   -15, 14,  1, 11,  4, 10, 12,  1,  2,  4, 30,  1, 11,  1,  6, 13 },
+  {  2,  4,  3, -7,  5,  8,-11,  7, -5,  9,-10,  6,  8,-10, -3, 10,
+     1,-29, -4,-26,  5, -8, 13,  4,  3,  6, 35,  1,  3,  6,  3,  0 },
+  { -2,  1,  0,  0, -1, -3, -7, -3, -9, -3, -1, -6,  3,  4,  4,  0,
+     5, -1, -2, -2, -1, -4,-10,  8,  0, -6, 10, -4, 46, 12,  2, 28 },
+  {  4, -1,  4,  1,  0,  4, -2, -2, -2, -1,  2, -4,  1,  5,  0, -3,
+     1,  1, -2,  0,  1, -2, -1, -1,  3, -6, 35,-11, 13, 53, -3, -1 },
+  { -5, -2,  0,-13,-16,  5,-12,-11,  1,-30,  3,-18,-24, -8, -5,-19,
+     1, -3, -8,  7, -7, -8, 15,-19,  4, 10, 30, 24,  6,  1, -9, 10 },
+  { -4,  8, -7, -4, -6, 12, -1, -9, -4,  2, -9,  3,  2, -2,  4,  2,
+    22,  9,  4, -5,  0,  5, -2, -9, -3,  1, 18,-12, 18, 16,  4, 16 },
+  { -5, -8, -3, -5, -3,  6, -7, -3, -2, -5, -3,  1,  2,  2,  4, -6,
+    10,  3, 12, -3, 20,  0, 27, -4, 16,  5, 18, -3, 23,  4, 12, 11 },
+  {  0,  1,  0,  1, -2,  1,  2,  1, -1,  0, -2,  2, -2, -4,  1, -2,
+    -2, -1, -5, -2,  0,  0, -2,  2,  9,  7, 63,  5, 12, -1,  1,  0 },
+  {  4, -3, -7, -5,-11, -5,-12,-10,-10,-12,-15,-12,-14,-14,  1,  1,
+    10,-10, 16,  6,  2,  9, 11,  9,  9,  8, 12, -1, 13, 12,  6,  3 },
+  {  7, -3, -2,  4,  6, -8,  2, -3,-12, -5, -9, -8,-10, 15, -2, -4,
+     8,  9,  7,-13,-18, 34, -5,  7, 12, 22, 16,-11, 13, 25,-15,-11 },
+  { -3, -2,  0, -4,  1,  0, -3,-13, -7, 13, 12, -7,-10, 13, 19,  6,
+    16, 15,-12,-15, -3, 34,  1,  5,  1, -9, 11, 21,  8, 17, -5, -6 },
+  {  3, -5,  0, -4,  0,  4,-11,  4, -7, -3, -1, -8,  3, -2,  2,  1,
+    11,  5,  6, 14, -3,  2, -4, -7,  0, 31, 15, -2, 24, 11,  5,  4 },
+  { -1, -4, -9,  5, -8,-18, -4, -9,-20,-18,  7,-14,-16,  3,  8, -3,
+    29, 11,-13,-13,  7,  1, 17,  6,  6, 21, 11,  1, 14, -8,  2,  5 },
+  { -3,  8,-10, -6, 12,  2,  1,  3,  3,  3,  3, -6, -8,-14, 15, -5,
+    16,  4, 16,  0,  7, -1,  0, 16,  2,  1, 22,  4, 19, 13,-11,  1 },
+  {  2, -3, 10, 20, -4, -1, -8,  5, -8, -9, -6, -2, -4, -7,  8,-10,
+     0,  8, -6,  1, -8, 14, 13,  5, 17, -6, 26, -1,  7, -1,  0, 12 },
+  { -4, -7,-31, -2, -7, -1,  5, -5, -5,-12,  4, -7, -6,  3, 15, -2,
+     5, -2,  7, -1, 10,  7,  8, -1, 14, 20, 14,  9, 16, 16,  8, 24 },
+  { -7,  0, -3, -6,  1,  3,-13, -6, -4, -4, -5, -9, -1,-10, -4, -8,
+     2,  0, -1,  1, 24, 24, 21, 31,  5,  2, 11, 12,  7,  4,  3,  6 },
+  { -3, -5,  6, -4, -3, -1,  2, -1, -2,  1,  0, -8, -1,  2,  0, -4,
+     6, 22, -1, -5,  8, 12, -1, -2, 28, 27, 20,-27, 14,  1,  2, -3 },
+  {  1, -5, -2, -2,  6, -2,  9,  1, -2, -5,  3,  4, 11,  5,  2,  8,
+    -3, -1,  1, -2, -3, -5,  5,  8, 49, 12,  8, -3,  9, 20, 12, 17 },
+  { -6,  0,  1,  7,  0,  9, -2, -4,  8,  0, -2,-10,  0,  7, 21, -1,
+     0,  1, 17, -7, -5,  2,  4, 16, -2, 17, 14,-20, 15, 14,  4, 15 },
+  {  0,  3, -4,  9, -4,  0,  6,  4, -6, -6, -5, -7,  2, -9,-10, -2,
+    -5,  0, -3,-21,  9, 14,-11, 13, 29,  2, 25,  4, 22, -1,  2, -3 },
+  {  2, 12,-11,  2, 16,  9, -4,  7,  1,-10,-15, 11, -4,  3, -2,  4,
+     4, -5,-10,  1,  4, 19,-15,  6, -4, -2, 30, -7, 11, 21,-12,  5 },
+  { -2, -3, -2,  4, -1, -5, -3, -7, -5,  1,  0, -6,  1, -6,  7,  0,
+     8, -7, -3, -2,  2, 14,  2, -3,-26, -1, 26, 22, 32,  1, -2,  6 },
+  {  1,-38, -1,-20, -2, -3, -6, -4,  2,  2,  7,  0,  3,  5,  3, 10,
+     6,  1, -3, -5,  7,  5, -5, -4,  8,  3,  1,-14, -1, -9, -5, -4 },
+  { -5,-26, -7,-19,-10, -5,-11,  5,-11,-25, -8,-14, -9,-16, -8, -6,
+   -17,-14, -1, -1,  6,  2,  2,  2,  3,  0,  2,  8, -8,  3,  0, -3 },
+  { 17,-49, -3,-23, -1, 11,  7,  3,  4, -4,  0,  0, -1,  4,  2,  4,
+    -2, -4,  2, -2, -1, -2,  2,  0,  0, -1,  0,  0,  1,  2,  0,  0 },
+  {  4,-34, -6, -9,  1, 21, -7,  3, -2, -1, -3, 18,  2,-16,  7, -3,
+     8,  7, -5,  7,  2,  4,  8, -6, -7, -2, -5, -1,  4,  1,  2, -4 },
+  {  5,-29, 13, -2,-14,  3,  1, 18,-15,  4, -8,  8,-10,  8,  2,  1,
+    -8, 15,  3,-10, -4, -4, -2,  0, -3, -4,  2, -3, -4, -3, 12, -6 },
+  { 13,-20,  3,-18,-17,  4,-14, 13, 28, 11, -8, -6, 16,  6,  0, 10,
+     3,  4, -9, 13,  5, -7, 12, -5,  0, -7,  5,  1,  3,  3,  2,  1 },
+  {  3,-27, -5,-11,-21,-11,-12,  0, -5,  7,-22,  1,  3,  5,  0, -5,
+     8,  7,  1, -5, -7,  2, -5,  4,  1,  3, -8, -2,  0,  4, -2,  6 },
+  { 31,-45,  0, -1,-12,  1,  2, -6,  4,  3, -1,  3,  3,  0,  5,  3,
+    -5, 12,  4,  6,  2,  1, -2,  1,  3,  2,  5,  2,  2,  2,  3, -1 },
+  {  9,-45,  6,  5, -1,-17, -2, 18, -3,  2,  0,  1,  0, -1, 10,  8,
+    -7, -2, -5, -8,  6, -1,  0,  4,  6, -3, 12, -1, -2,  0,  5, -7 },
+  {  3,-26, -2,-12,-12,  2,-10, 16, -3, 12,  4,  5, 11,  8,-16,-17,
+    -2, -3, -3,  2,  5, -9, 13,  1, 10, 11,  3,  5, -2,  2,  2, -7 },
+  {  8,-26, 32, -7, -5, 22,  2, 14,-10, -8, -7,  3,  3,  7,  0, -5,
+     0, -1, -3,  0,  8,  4, -5, -7,  6, -1,  4,  8,  1,  1,  7, -6 },
+  {  4,-31,  2,-14,  2,  0,  1,  8, -6, -1, 17, -3, 13, -6,  5,-10,
+    -2,-10, -2,-10, -3,  7,  1,  5, -8,  8,-14, -3,-15,  7,-10, -6 },
+  { 16,-27, 13, -4,-23,  7, -9,  6, -7,  5,  4,  2, -1, -3, 23,-18,
+     7,  0, -3,  4, -3,  9, -6, -2, -1,  8, -6,  2,  6, -3,  2, -2 },
+  { -1,-35, -2, -8, 11, -1, -7, -3, -2, 11,  7,  6, -6,-10,  9,  6,
+    -3, -5, -6, -3,  9, 16,-16, -9,-20, 12,  3,  5, -3,  1, -9,  4 },
+  {  2,-24,  1,-12,-16,  5, -4,  3, -4, -1,-11,-11, -8,-14, 14, 10,
+    -8, 20,  8, -3,-11,  1,  1, -4, -4, -7, -3, 15,  2, -6, -2,  7 },
+  {  9,-21,  2,-19, -7, -5, -8, 25,  3, 17,  5, -3,  9,-12,  8,  2,
+    -4,  3,  3,  1, 11, -9, -4, -3,  4,  3,-22,  6,  4,  6, 11, -5 },
+  { 16,-23, 13,-17,-21,-12,  5,  9,-20,  7,  6, -6,  0,  2, -9,  6,
+    -6,-13, -7, -1,  5, -3,  5, -7,-10,  1,  0,  8, -9, 11,  0, -8 },
+  { 10,-26, -9, -7,-19, -4,  6, 16, -7,  5, -4,  4,  8,  0,  4, -1,
+     6, -7,  1, -8,-11, 10,-14,  0,-16,  6, -3,  5, -1, 14, 12,  1 },
+  {  8,-27, 12,-14, -1, -1,-19, 10,-11, 21,-14,  9, -8, -3,  8, -1,
+    12,-13,  3, -4, -2,  0, -9,  0, -7,  2, -3, 12,  1, -3,  3,  1 },
+  { 18,-20,-14,-14,-16, -3,-24,  6,-17,  2, -3,-11,  2, -3, 12, 10,
+    10,  1, 10,  7,  8,  5,  5,  4, -1,  7,  2,  2,  0,  4,  7,  0 },
+  {  0,-30,  9,-16,-18, 15, 12, -3,  4, -4, -5,-11, -4,-12,-10,  0,
+     2, -2, -4, -1,  2,  0, -1, -6,  2, -3,  4, -5,  7,  3,  5,  7 },
+  { 25,-24, -1, -6, -9,  6,-13, -2,  3, 15, -3, 11,  4, -8,-11,  2,
+     0, -9, -2,  7,  4,  8,  5, -8,  5,  6, -1,-11,-15, -5,  0, 11 },
+  {  0,-34, -7,-11, -7,  9, -3, 19,  4, -8,  3,-11, 11, -3, -9, 12,
+     9,  9,  2,  1, -7,  1, -3,  0, -6, -2, -1,  3,  0, -7, -2, -5 },
+  {  6,-34, -4, -5, -3, -9,  2,  9, -1,  9, -5, -3,-26,-12,  8, -6,
+    -7, 11, -8,  4,  4,  1, -1,  0,  8,  9, -4,  7, -1,  1, -3, -1 },
+  {  3,-30,  5,  6,-10,  3, -7,  6,  3,  3,-26,-19, -3,  1,  7,  5,
+    -4, -5,  6, 10, 13,-10,  4, -7, -4,  5, -3,  9, -6,  3,  9,  5 },
+  {  4,-24,  9,-19,  2, -4, -5,  8, -3,  2,  0,-15, -1,  9, -4, 22,
+     6,  9,  3,  7, 11, -9,  0, -3,  4,  5, -5, 10, -8,  5, -7, -3 },
+  {  8,-27,  7, -3, -1,  2, -9, 13,  7, 12, -4, -6, -6,  5,  0,  7,
+     5,  1, 15, -3, -4,  0, -5, -2,  7, -5, -7,  1, -2, 13, -8, 13 },
+  { 17,-22,-15,-11, -8, 16,-14, 18,  2, -1, 14, -7, 14, -6, -6, -7,
+    -8, 17,  6,  4,  4, -7, -5, -9,-14, -6, -1,  9, -3,  1,  6, -5 },
+  { 25,-30,  2,-12,-13, 18,-18, 16,  8, -3, 10, -8, -3, -1, -6,  3,
+    -5, -7,  4,  6,  7,  1,  1,-11, -5,  6,  2, -4,  9, -1, -5, -2 },
+  {  7,-23,  7,-15, -1, -3, -1,  0,-10, 12,  2,  5, -4,  0,  4,  6,
+    -1,  5, -9, -1, -1, -7,  1, 17,  9,-17,-16,  8,  4,-14, 11, 14 },
+  {  0,-31,  7,-13,  3,-11, -7,  6,  1,-11,  8, -7, 15, -3, 16,-11,
+    -1,-15, 16, -3,  5,  0, -2, -2, -6, 11,  5,  6,  5, -5,  6,  3 },
+  { 13,-24, -2,-20,-10,  7, -3, -1, 15,  2,  6, -5, -7,-10,-20,  1,
+    -4, 14,  8, -2,  3,-13, -3,  1, -4,  1, -3,  2,  8, -7, 16, -4 },
+  {  1, -2, -2, -3, -4, -7,  0,  3,  6,  7,  3,  2,  1, -2, -1,  0,
+    -6,  4,  2, -4, -3, -4,  5,  9,  5,  0, -3, -3, -4, -7,-31,-50 },
+  { -1, -3,  7,  2, -1,  2,  4,  6,  0, 10, -2,  0,-20, -6, -3,  9,
+   -20,-22, -1, -1, 15,  9,-12, 10,-13,-20, 12,  3,  5,  6, -7,-26 },
+  {  0,  4, -2,-14,-12,  6,-13, 11,-10,  3, 22,  6, 16, -2, -5,  1,
+    -3,-11,  0, -7,  5, -5,  0,  1, -1, -6,  8,  8, 10,  9, -5,-27 },
+  { -5, 10, -2,  7,  9, -9,  5, -9,  5,  4,-15, 14,  1,  3,-10,  5,
+     0, -2,  7,  3,-13,  6,  9, -6,  5,-14,-17, -1, 11, 14, -2,-26 },
+  {  0,  6, -3,  0, -8,  6,  0,  1,  4, -8,  2, -5,  4,  7, 15, 11,
+     9, 19, -2, 14, -8,  7, -1,  3, -3, -3,-10, -2, 12, -2,-12,-29 },
+  {-12, -5,  0, -3, -2,  6,  3, -3,  2, -2,  1, 11,  2, -7,  5,  1,
+     2, -2,-14,  0, -1, -5,  3,  8,-28,-26,  6, -6,  3,  8,-10,-27 },
+  { -1, -3,  6,  2,  4, 15,  1,  0,  2, -2, -2, 13,  3,  6,  0,  6,
+    -1, -4, -1, -5,  8, -1,  5, -5,-15, 11, -8, -5, 14, -6,-14,-29 },
+  { -5, -6,  0,  1,  0,  6, -3,  2, -5, -1,  5, -3,  2,-10,  3,  4,
+     3,  0, 13, -3, -1,  4, -4, -6,  2,  9,  8,  2, -3, 28,-11,-31 },
+  {  1, -4,-10, -9, -4, -3,-15, -6,  1,  5, -3, -6,  5, -6,-22, 27,
+   -13,  5,  3, -7, -4, 20, -7,-12, -1,-24, -4,-13, -8,-11,-15,-21 },
+  { -6, -4, 19, -6,  2, 11, -6,  1, -3,-10,  9, -9, 12,-10,  2,  1,
+    -9,  1, 15,  7, -5,  5,-29,-35,  4,-30,  9,  9, 19, 17,  2,-17 },
+  { -3,  3, -3,  1,  2,  5, -1,  5, -2, -3,  1, -3, -8,  3, -4, -2,
+    -4, -1, 12,  0,  2, -8, -6, -4, 16, -1,-14, -2, 25, -6,-15,-36 },
+  {  0, -1,  3, -4, -4, -1,  7, -4,  8,  0, 10,  9, -4,  1, 10, -1,
+    -3,-13, -5, -4, -1, -4,  8, 11, 14, -7, -5, 16, 12, 13, -1,-28 },
+  {  1, -2,  2, -3, -8, 10,  4,  9, 12,  3,  5,  0,  8, -3, -6,  2,
+    16,-11, 11,  0,  1,  6,  1, 18,-10,-16, -1, -4,  5,-14,-15,-20 },
+  {  1,-12,  5,  4, -7,  8, -1,-17, -2, -9,-14,-11,  6, -9,  5, -4,
+     3, -2,  7, 18, -5,  5,  6, -1,-11, -2,-10, -3,  8, -3, -2,-32 },
+  {-12,  5, 20, -5, -6,-11, -6, -6,-13,  4, -6, 19, -8,  2,  3, -9,
+    -4, -4, -1,  9, -1, 21, -1,  7, 15,-10, -1, -3,  9, -3,  2,-24 },
+  {  0, -3,  2, -6,  4, -1, -9, -2, -1, -3,  6, -1, -5, -6, -5, -8,
+     0, -2, -6,  9, -4,  3,  2,-13,  1, -7, 23,-13,  4, -3,-15,-33 },
+  { -7,  2,-15, 11,-10, 14,  0,-11,  3, -1, 12, -4, -4,  9, 11,-13,
+   -13, -3,-14,  1,  3,  6, -5,  8,  0,  5,  5,-10,  4,  5, -6,-30 },
+  { -6,  4,  0, -5,  4,  1, -1, -1,  3,  6,  5, -2, -5,  0, -2,  5,
+    -4, -2, -4, -2,  4,  7, -7, -1,  1, -4, -3,-19, 37, 12, 10,-40 },
+  { -7,  2, -7,-12, 17, 11, -7,  2,  2,  3,  1, -1,  3,  4, -2, -5,
+     9, -9,  6,  4,  9, 12, 11, -5,  2, -1,  0,  9,  5, -7, -2,-24 },
+  { -7,  6,  1,  3,  1,  0,  6,  0,  4,-12, -2, -2,  1, -9, 10, -2,
+    11, -1, 21,-12, 15, -5, 10, -5,  5, -5, 14, -6,  5, -7, -3,-29 },
+  { -2,  0, -5, -2, -3,  1, -3,  0,  4,  2,  3,  0,  2, -2,  7, -2,
+     3, -5,  2, -1,  6, -4,  0, -3,  8,-11, 19, -8, 22,-34, 13,-35 },
+  { -1, -3, -1,  9, 11, -3, -3, -1,  7, 18, 11, -5,  2,-12,-11, 18,
+     9, -5,  1, -6, -9, 12,  1, -3, -3, -9,-14,  9,  9,  8, -6,-26 },
+  {  0,  5, -5, -1, -1, -2,  4,  6,  8,  2, -1, -2,  5,  1, -5, -4,
+     1,  1, 18,  1,  7,-10,  3, -2, 12, -1,-15,  9, 12,-14, 13,-38 },
+  {  3,  0, -8, -1,  0,  8, -9, -3, -8, 16,  3, 16, -5, -9,  0, -1,
+    -7, -1, -4, 13,  7,  0,  1,  2, -1,-16,  0, -2,  1,  8, -8,-28 },
+  {  7,  9, -5, -3, -2,  2,  0,  3, 11, -6, -4, -2, -2, -5, 28,-18,
+    -6,  2, 15,-10,-15,-10, -2,  0, -2, -2,  4, -3,  7, 11,  5,-30 },
+  {  9,  0, -7, -1, -4, -7,  2,  2,  9, -2,  2,  3, -8, -6, -6,  3,
+   -10,  4, 10,  5, 21, -4, 14,-18,  1,  3,-10, -2,  6, 14, -8,-26 },
+  {-14, -1,  2,  3, -3,  7,  1,-22, -1, -1,  0,  1, 12,-14,  3, -5,
+     0, 10, -3,  1, -5, 12, -3, 10, -8,-22,-11,-13, -7,-10,-13,-25 },
+  { -2, -5, -4, -4, -9,-18,  9, -3, -5, 17, 13,  5,  6, 11,  3,  8,
+    20,  4,  2,  9,  8,  5,  6,  1,  7, -7, -6, -2, -7,  0,-17,-23 },
+  { -5, -5,  2,  0,  6,  2, -2,  2, -3,  4,  4,  0, -5, -2, -4,  6,
+     8, 10, -1,  1, -5,  5,-14, -2,-11,  8,  6, 25,  7, -1,  0,-43 },
+  { -4,  0,  4, -2,  7,  0,  3, 17,  5,  2, -5,  1, 21,  3, -2,-10,
+   -16, -9,  7,-12,  9, -8,  2,  5, -5,-10, -2,-11, -5, -1, -9,-30 },
+  { -2,  3,  1, -4, -1,  0,  8,  1, 12,  4, -1, -1,  3,-17, 13,  9,
+     0,  7, -6, -5,  9,  1,  5,  4,-10,-18,  0, 14, 11, -4,-16,-28 },
+  { -1,  0,  2, -1,  4,  1, -1,  1, -1, -2, -1, -2,  3,  0,  0, -1,
+    -1,  1,  2, -2,  3,  3, -2,  4, -2, -1, -6,  1, -1, -1,  6,-70 },
+  {  7,  3,-11, -1, 12, -4,-14,  4,  4, -4,  4, -2,  2,-12, -4, 15,
+   -17, -4, -3,  6,  8, -5, 22,-22,  5,-11, 15, -4,  4, -1,-21, -1 },
+  { 10, -2,-13, 11,  4, 14,  4,  9,  8,  8, 19, 15, 14, 15,  5, 10,
+     8, 15, -5,  4, 14, -8,  1,  1,  2,  1, -1, -3, 21,  8,-29, 13 },
+  { -6,  0, -6,  6, -1,  2,  8, -4, -5,  4, -4, -5,  0, -2, -4,  0,
+     9, -2,  1, -2, 26,-19, 21,-10,  4,  1, -8,  5, 22,-10,-13, 15 },
+  { 11, -5,  1,  0,  6,  3,  7, -2, -2, -3, -5, -1, -2, -6,  1,  1,
+    -8, -5,-13, 13, -2, -3, -1, -9,-28,  4,  2,-11, 18,-20,-24,  9 },
+  {  7,  4, -3,  6,  6, -6, -7, -5, -7, -4, -4,  0, -7, -5, -6, -5,
+     2,-13,-12,  2,  0,  5, 18, 15,-13, -7, 13,-20, 16,-10,-19,  6 },
+  {  5, -8, -1,  5, 10,  2, -1,-10,-11, 23,  8, -5, -8,  4, -5, -4,
+    -5, -5,-11, -8,  5,  1,  7, -9, -9, -6, 12, 14, 17,-12,-22,  3 },
+  { -5, -8, -3,  3, 12, -1,  0, -4, -5,  1,  1,  6,  1,  5, -5,  7,
+    -2,  7,  1,  6,  6,  2,  0, -5, 17, -4, -5,-24, 13,-20,-27, 14 },
+  { -1,  2, -3,  1, -3,  1, -3,  0, -2,  3, -2,  1,  2, -1, -2, -1,
+    -2, -5,  5, -2,  0, -7,  1, -6,  8,  8, 11, -5, 24,-43,-13,  2 },
+  { -2,  4,  7, -3, -4,  4, 13, -4,  0,  0, -2,  9,  0, -3, -6,  1,
+    -7,  1, -1, 10,  0,  5, -1,-24, 25,-15,  7,  2, 22,-10,-21,  0 },
+  { -5,  2,  6, -2, 13,  3,  5,-12,-11, 16,  6, 10, -5,  0, -3,  6,
+     5, -5, -5, 10, 12, 10, 11, -7,  8,-14,  2,-15, 13,-14, -8, -3 },
+  {  5,  6, -7, -5,  5,  2,  9,  5,  0, -1, -4,  2,  8,  0,  3,  5,
+   -12,  3, -3, -6,  2, -1, -5, 14, 11,-20,-21,-25, 24, -1,-10,  6 },
+  { -5,  5, -2,  9,  4, -4, -1, -6, 11, -6,  5,  0,  2, -3,  6, -1,
+   -17,-18, -4,-13,  9, -1,  9, -7, -4, -8,  2, -3, 12,-31,-18,  5 },
+  { -7,-11,  6, -8,  4, -3,-12,  0, -1, -6, -3,  0,  5,  9,  7,  2,
+     1, -8, -6,  8,  2, -5,  7, -1, 16,-10, 16,-12, 18, -1,-25,-12 },
+  {  3,-12,  1,  2, -2,-18, -8,-15,-10, -9,  2, -7, 11,-11,  2, -1,
+    -1, -1, -9, -6,  3,-14, -2, -1,  2,-13, -7, -9, 19, -5,-17,  2 },
+  {  7,  1, -8,  7, 17,-13,-10,  5,  7,  1, -6,  4,  9, -4,  0,  3,
+     8,  1,-14, -9,  4,  7, -9,  0,  6, -5,-12, -2, 25, -2,-19,  1 },
+  {  7, -3,  6, -3,  1,  6, -7,  0, 10,  0,  4, -5,-17, -4,  4, -1,
+     0, -3, -7, 19, 24, -1, 21,  8, 10,  9,  8, -1, 23, -2,-18, -2 },
+  {  3, -3,  0,  5,  8, -2, -9,  2,  9,  6, 19,  8,  2,  6, -9, -2,
+    -4, -3, -8,  7, -7, -8,  5,  4, 26, -6,  7, 18, 24,  0,-13,  4 },
+  {  0,-13,-11, -1,  3, -9,  5,  4, -7,  3,  0,  2, -1,  4, -5,  2,
+     9, -2,-11, 15,  1,-21,  1, -1,  0,  4,-14, -4, 24,-16,-13,  1 },
+  {  1, -9, -8,  0,  0, -4, 11, -1, 14, 16,  0, 17, -2, -9,-12,  0,
+    -1,-14, -9,-14,  0, -2, 19,  4,  6,  4,  4,-11,  8,-17,-19, -5 },
+  { -3,  1,  2, 12, -4,-18, -1, -4, -7, 14, -3,  2,  0, -7, -8, 12,
+    -5, -9, 14, 12, -9, -2,  4, -6,  4, 18, -1,-25, 22,  2,-23, -5 },
+  { -2,  0,  0,  0,  1,  3,  5, -1,  5, -2, -2,  2, -3,  0,  1,  2,
+     0, -1,  2, -1, -9, -6, -7, -4, -2,  4, -7, -5, 64, -3,-25,  4 },
+  { 12, -2, -3,  0,  8, -9, 13, -7,  6, -3,-12, 12, 15, -9, -4,  2,
+     9, -4,-12,  3, 14,  1,  7,-15, 15,  0, -6,-12,  0, -3,-20,  6 },
+  {  2, -1, -4,  5,  9,  6, -7,  2, -2, -7, -2,  0, -1,-18, -4, -6,
+   -15, -5, 11,  5,-10, -1,  2,  7, 12,-19, -7,  8, 21, -4,-15,  4 },
+  {  4,  2,  5,  5, -5,  1,  3,  2, -8, 13,  0, -5, -2,-14,-11,  6,
+     2, 17,  8,-13, 26, -2,  5,-15, -4,-14, 12, -9, 13,-21,-23, -4 },
+  {  2, -3, -2, -3,  3, -2,  6,  9, -9, 13,  4,  2, 12, -3, -3,  1,
+   -17,-22, -3,  4,  3, -2,  1, -9,  1, -6, 11,-13, 14,  0,-15,  6 },
+  {-16, -4, 17, -2,-20,-11, 11, 10,  5, -8, 16,  2,-17,-14, 11, 11,
+    -6,-11, -7, 12, 12,-10, -6,  5,  8, -4, -2, -5, 28,  3,-13,  4 },
+  {  0, -3,  3, -7,  6,  8,-12, 20,-19, 18,-11, 10, -5,  0, -9, 11,
+     3,  0, -2,  9, -7, -5, 18,  3, -2,-16,  1,  6, 12, -7,-16,  1 },
+  {  4,  1,  5, -5, 15,  2, -8,  3,  5,-11, 15, -3,  8, -8, -1,  7,
+     4,  7, -2,  6, -9,  5, 12,  2, 33, -2, -6,-18,  4,  0,-18, 11 },
+  {  3, -1,  1, -1,  0,  1,  4, -1, -5,  0,  1,  0,  4,  2, -1,  4,
+    -3,  2,  0, -2,  4,  6, -1,  6, 42, 19, -4,-37, 19,  1,-15, -4 },
+  {  2,  0, -5,  0, 10,  0,  0, -5,  3,  0,  0, -3, -3,  0,  2, -4,
+   -10,  2, -6,  4,  4,  1, 27, -7, 17,-34,  5, -9, 15,-16, -7, -5 },
+  { -2,  7,  7, -2,  9, -2,-15, 11, 11,  7,  5,  1, 15,  1, -9, 31,
+     2,-15,  2,  4,  3,  4, -1, -8,  2, -7,  6,-17, 11,-14,-11,  2 },
+  {  1,  1,-11,  9,  9, -6,-14,-11,-10,  8, -3, 11, 16, -9, -8,-13,
+    -8,  9,  0,  6,  6, -2, 13, -8, -2,  3, 13, -3, 10, -6,-17,  4 },
+  { 14,  5,  4, -6,-12, 10, -7,  8, 21, -8,-30, 15, -2,  1, 11, -9,
+    -5,  1,  0, -1, -1, -6, -2,  3, -5,  7,  9,  5, -5,  2,  0,  1 },
+  { -1,  2, 20,-17,-15,  3,  3,  7, 11,-17,-13, -6, -3, 18, 17,-15,
+    -4, -4, -5, 22, 14,-14, -2,-10, -7, 11,  8, -7, -3,  0, -7, 11 },
+  {  7,-11, -7, -8,-14, 22,  5,  2,  6, 13,-12, -2, 10,  3,  0,-21,
+    -4, 20,  3, 10, 21,-10,-12,  8, 11,  2, -5,  2,  1,  3, -1, 15 },
+  { -1, -2, -1, -2,-13,  8, -4,  0,  7, -2,-17,  8, 18,  5,  3,  8,
+    -8, -2,  3, -4, 14,-18,-13, 14, 15,-13, -1, -2,  4, 11,  1, 12 },
+  { 13, -6, -4,-16,-17, 16, 21, -2,  5,-11, -9, 19, 21,-17, -3,-17,
+     3, 12,  8,-12, -6,  1, -7,  9,  9, -7, -5, -1, -3,  5, -6, -4 },
+  { 11,  5, 12,-20, -6, 10,  4, 12,  8, -5,-10, 15, 13, 14, 10,-15,
+   -13,  1,  6, 14, 15,-17,-13,  4, -5, 10,  7, -6, -8, -3, -4, 12 },
+  { 25, -1,  7, -5, -7, 11,  1, 17, 13,-15,-14, -4,  5,  3,  8, -3,
+    -2,  2,  0,  6, 16,-12, -6, -4,  4, -3,  7,-10, -3, -7,-13,  7 },
+  { -8, 10, -3,-13,  5,  2,  4,  9,  9,-17,-13,  2, 11,  1,  6, -4,
+     8,-10,  4,  1, 19,-15, -4, 12, 31,  7, -5,-17, -4,  9, -2,  7 },
+  { 14, -6, -6, -6,-14, 13, 17, -5,  4,-14, -9,  7,  7, -9,  3,-16,
+   -15, 11, 11,  6,  4,-11,-19,  3,  5,  8, 13,-14,-14,  3, -4, 12 },
+  { -2, -4, 10, -4, -7, -1, 27,  5,  2,-16,-18,  4, 12, -2, -3, -2,
+    -1,  1, -8,-12,  3, -4,  8, 15,  2,  4,  9,-13,-14,  9, -7,  5 },
+  {  4,  2,-10, -5, -7,  2,  1,  4, -1, -6,-15,  6,  1, 10,  5,-10,
+    -9, -1, 13, -3,  5,-21,-11,  8,  8,  5, 27,-21,-18, -5, -1, 15 },
+  { 11,  1,-16, -8,-11,  0,  5, -8,-12,-13,-17, 22,  4, -6, -1,-18,
+   -10,  0, 19,  2, -2, -8, -7, -3,  2, -2, -9,-17, -5,  4,  4, 10 },
+  {  8, -6,-19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12,  0, -1,
+     2,  4,  7,  9, 16,-16,-14,  9, -4,  3,  1,  0, -2, 10, -1, -1 },
+  { 12, -8, 12, -9,  0, 25,  7,  9,  2,-31, -9, -4, 15,  4, -5,  1,
+   -10, 11,  8, 10,  0, -6,  5, 11, -1, -6,  4,-10, -9,  6,  4,  5 },
+  { 14,  6,-17, -2, 17, 12, -9,  2,  0,-25,-14,  5, 20, 14,  8,-20,
+     5,  2, -2, -3,  9,-13, -3, -1, -6,  3,  7, -6,  0,  2,  3,  1 },
+  {  8,  4,-15, -3, 10, 18, -4, 13,  8,-22,-10,  9, 19,-15,  7, -5,
+   -13, 12, -4,  9,  2, -9, -6,  0,  2,  1, -9, -6,  6,  1, -1, 11 },
+  {  4,  1,  4, -5,-10, 18,  7,  2, -4, -9,-11,  0, 32, -7,  4,-16,
+    -1,  0,  6,  3,  6, -3,-14, 16,  9, -2,  7, -1,  0, -5,  5, -3 },
+  { -3,  2,  3, -8, -6,  4,  6,  2,  4,-12,-15,  2,  8,  8,  9, -3,
+   -18,  6, 34, 11, 12,-15, -1,  2,  9,  2, -4, -4,  2,  4,  2, -3 },
+  { 18, -6,-12, -8, -1, 15, 20, -4, -1,-11, -5,  6,  6,-11,-15, -7,
+     3,  7, 10,  2,  8,-10, -5,  8, 15, -5,  5,-17,-13, 13, 11,  7 },
+  {  8, -4, -6, -1,-14, -3,  6, -2,  1, -5, -1, 10, 10,-15,  5,  0,
+   -10, -4, -3,  7, -4,-19,-15, 27, 11, 18,  3,-19, -2,  6,  0, 12 },
+  { 12,  0, -5,  0,  4, -5,  1,  5, 10, -7,-11, 21, 29,  1, -2,  1,
+    -4,-11, -1, 13, 11,-20, -1,  4,  4,  4, -5,  6,-13, -2, 11,  9 },
+  {  2, -7, -7, -3,-10, -1, 20, 12,  1,-19,-19, -1,  5,  4, -7,-25,
+    14,  1, -3,  2, 12, -4, -3, -3, -2,  6,  1,  0,  3,  2,  5, -1 },
+  { 12, -8,  3,-12,-10, 10, 13,  0, 23,-14,-18, 10,  0, 15,  3,-12,
+    -3, -5,  5, -4,  2,-14,-10,  8,  2,  9, -1,-11, -3,  5, 13,  2 },
+  {  9, -6,  7, -7,-30, 17,  6, 13,  1,-14,  0, -1,  6, -9,  8,  3,
+    -4,  0, -1, -7, -5,-13,-19, -3, -4,  4, -6, -2,-13,  1, -2,  3 },
+  { 10,  1,  3,-18,-26, 17,  4,-16,  4, -3,-13, -4, -6,-11, -4,-21,
+     7,  8,  2,  5, 13, -6,  1,  5,  8,  7,  9, -6, -6,  1, -1,  2 },
+  { -3, -1,  0, -2, -2,  0, -1,  3,  4,-14, -8, -9, 13,  2, 50,-23,
+    -8,  8,  7, 11, 16,  3, -7,  0, -2,  6,  5, -1,  1, -2,  4,  3 },
+  {  1,  3,  1,  1, -6,  3,  6,  6,  2, -2, -3, 10,  2, -8, -5, -5,
+     5,  4,  4, -2, 10, -8,-40, -1, 21,  8,  3, -4, -1, 13,  4,  7 },
+  {  2,  0, -4, -8,  5,  2,  7, -5,  5, -8, -4, -1, 12,  2, 12,-13,
+    -9,  0,  1,-12,  9,-43,  1, -5, 12,  1,  3,  6,  1, -1,  3, -2 },
+  {  6, -2, -1,  1,  0,  4,  8, 14,  4, -7,-23, -5, 23,-17, -6,-15,
+    -8,  7, 10, -1,  7,-16,  4, -6,  2,  3, -3, -3, -1,  8, -1,  4 },
+  { 10,  4, -4,  1,  7, -3,  2, 11,  4, -6, -3,  8,  5,  4,  1,-45,
+    -6, -4,  4,  2,  1,-14,-10,  1,  1,  6,  2, -8, -1, -3,  3,  3 },
+  {  1, -1,  2, -3, -8,  9,  3,  3, -2, -5, -8,  8,  7, -7, -4, -6,
+     5, -9, 11, -2, 46, -5, -1,  9, -2,  0,  3, -5, -3, -5,  7,  0 },
+  { -4,  1, -2, -1,-11, 11,  8, -3, -2,-10,  0,  4,  9,  9,-17,-17,
+   -34, -4, -5, -7, -3,-12, -3, 11, 18,  3, -2, -5,-18, -5, -3,  6 },
+  {  7, -5, -3,  1, -4, -3, -5, -1,  2,  5, -2,  3,-10, 12,-18, -5,
+   -10, 12, -9,  4, -6,  2,  0, 16,-17, 15, 14,-12,-10, -2, -9, -1 },
+  {  4, -5, -3, -5, -3, -1,  7, 18, -7, 12,  3,  5, -8, -4,-20,  1,
+   -25,  1, -8, 13,-10,  8,-19, -1, -8, 10,  6, -9, -1,  0, 12,  4 },
+  { -4,  5,  0, -1,  2,  5, -8, -2, -6,  4, -8,  9,  3,  2, -7,  4,
+   -25, 13,-23, 10, 14, 15,-11,  3,-18,  4, 16, -4,  1,-10,-10,  3 },
+  {  5, -3, -1, -3,  4,  1, -3, -4, -5,  1,-12, 14, -7, 11,-15,  6,
+    -6, 24, -4, 13, -1, 15,-13,  8,  3,  7, -5,  2,  2,  0,  3, -7 },
+  { -3,  1,  0,  8,  6, -1,  6,  5, -5, -2,-12,  4,  0, -2, -3,  5,
+    -6,  0, -8,  9,-10,  4,-28, 12,-20, 11,-13,  7,-18,  1,-11,  1 },
+  {  1, -4,-15,  5,  0,-13, -5, 13,-11,  4, -4, -5,  5,-14,-16,  0,
+   -14,  5,-20, 12, 10, -7, -5,  6,  6, 22,  6, -4, -2,  3,  8, 11 },
+  { 13,-11, -2, 16, 16, -7,  0, 20, -7, -1,  0,  5, -9, 12, -2, -5,
+   -22,  5,-10, 12, -6, 11,  9, 21, -8, 15,  4,  0, -8, -4, -4, 10 },
+  { 18, -4,-13,  0,  1,-15, -1, -3,  2, 10, -1,  6,  1, -4,-20, -5,
+    -8,  6, -8, 17, -5,  5,-10,  8,-22,  6, -5, -2,  8,-17,  8,  2 },
+  {  1, -2, -9,  6,-31, -8, -8,  8,  0,  5, -9, -4,  2,  3,-12, 11,
+   -18, 10, -5,  3,-11, 13, -6, 11, -3, 12, -7,  3, -9, -1,  2, 11 },
+  { -9, -6, 21, -8,-15,  4,-11, 12,-11, 17, -1,  2, -6,  0,-15, 13,
+   -12, 19,  0,  2, -6, -3, -9, 10,  3, 17, -2,  5,-10, -3,  0,  1 },
+  {  4, -6,  5,-10,  1, -5,  1,  0,  0,  0,  2,  7, -2,  2, -2,  0,
+    -4,  3, -4,  1,-12,  6,-49, 16,-10, 13,  0, -2,  8,  6,  1,  8 },
+  {  5, -8, -7,  9, 13, -5,  7,  0, 10, 11, -4, -3, -1, 13,-14,  6,
+   -15, -6,-14, 16, 15,  1,-18, -4,-20, 20, -7, -1, -9, -2,-10, 10 },
+  {-12,  4,  0, 10,  0,  3,  8,  4,-27, -1, -2, 19, -4,  2,-13,  3,
+     1,  9,-12,  1,-22, 19, -5,  4, -9, 12,  2, -9, -8, 11, -3,  7 },
+  {  4, -5, 11, -6, 17,-17,  5, -4, -2, -6,  1, -5,  2,  4,-14,  6,
+   -20, 19,-20, 12,-21,  5,-14, 13, -2, 11,  4, -3,  0,-10, -4, -2 },
+  { -2, -1, -3,  8, -9, -7,-22, -3,-24, 13, -2, 10,-15,  5, -9,  4,
+    -7,  0, -5, 15, -8, 11,-13,  6, -4, 19, -8, 12, -4,  6,  9,  7 },
+  {  2, -3,  2, -1,  0,  3,  1,  2,  1, -4, -2, -3,  1,  5,-12,  6,
+   -16, 14,-23, 10,-14, 17,-15, 16, -2,  9,-25,  9,-10, 16,  4,  9 },
+  { -3,  7, -8, -3,  2,  2, -4, -8, -9, 10,  3,-11, 25,-10,-28, 27,
+    -9,  7,-13,  9, -2,  4,-12, -8,-14,  6,  7,-10,  3,  3, -3,  5 },
+  { -8, -3,  1,-10,  8, -3, -9, -4, 13,  7,  2,  4,-10,  4,  3,  7,
+   -18,  2,-22, 15,  4, 20, -7,  5, -6, 13, -1,  4, -7, -6,  6, 13 },
+  { -2,  3,  0,  2, -4, -2,  0,  0,  1,  2, -2, -5,  0,  1, -4,  0,
+    -2, -3,  1,  2, -1,  2, -8, -1,-24, 68, -3,  8,  3,  3, -1, -1 },
+  {-15, -2, -9, -7, -1,  8,-14,  8,  3,  6,  0, -1, -8,  8,-23,  2,
+   -14, 17,-15,  8, -4,  7,-18,  0, -8, -3, -1, -4,-10,  4, -1,  4 },
+  {  8,  0,  2, -7,  0,  5,  1,  3,-11,  4, -8, 14,  3, 20,  1, 26,
+   -11, 13,-13, 20, -2,  0, -8,  2, -6,  6, -1,  9,  3, -6, -3, 10 },
+  {  5,  0, -1, -7, 10,  1, -3,  5,  4,  7, -5, -1, -3, -1, 12, -3,
+   -15,  7, -9, 22,-19,  8, -9,  4,-23, 13,-14,  6, -6,-14, -4,  7 },
+  { 14, -5, -8,-10, 25,  3,-23, -7,-28,  0, -1, -9,  4,  1,-13, 20,
+    -8, 10,-16,  8, 12,-13,-21,  5,-13, 11, -2,  1, 12, -7,  2,-10 },
+  { -5, -4,  9,  5, -6, 35, -7,  8, 15,  2, -1, -9, -6,  2,-18,  7,
+   -15,  6, -3,  2,  8, 12,-30,  7, -4, 20,  2,  6, 13, -6, -4,  0 },
+  {  1,  8, -9,  9, -5, 12, -9, 16, -9, 16,-17, 14,-13, 15,-18, 14,
+   -15, 17,-12, 14,-13,  7,-16, 13, -9,  5,-11, 10, -9,  6,-12, 13 },
+  {-10, -4,  5,  3,  1,  6,  8,-14, -5, 15,  7,  4,  8,  7,-22,  8,
+    -7, -8,-15, 26,  1, 13, -3, 17, -5,  9, -2,  4, -6,  3, -8,  9 },
+  {  8, -3,  2,  3,  3,  1, -2, -1,-11,  8, -4,  0, -6, -5, -1, 13,
+   -37,  9,  1, -6,-10, -2,-10, 11,  8, 13, -3, -2, -6,  8, -4, 13 },
+  {  3,  2, -3, -4, -4,  7, -8,  9, -8,  9,-20, 12,-19, 15,-18, 17,
+   -15,  7, -1, 20,-11,  6, -6,  3,  1,  9,  2,-14, -2, -2,  2,  1 },
+  { -7,  1, -1, -3, -6,  4,  4, -3,  3, -1,  5, -4,  3,  2, -1,  9,
+   -59,  5, -4, 30,  3,  3, -2, -3, -1,  2,  2,  1, -1, -1, -2,  1 },
+  {  0, -3,  2,  0, -1, -8,  0,  2, -3,  4, -4,  1, 10,  6, -6,  8,
+    -7,  4, 10, 11,-41, 27,-20,  3, -3,  8,  1, 11, -5, -8,  0,  4 },
+  {  5,  1,  4, -2,  1,  2, -1,  6, -7,  2, 11,  4,  0,  0, -8,  7,
+   -10,  0,  0,  8,  2, 10, -1,  1, -2, 44, -2,-21,-12, -3, -1,  2 },
+  { -4,  4, -2, -2,  6, -8,  2,  1,-10, 14,  8,  6,  5,  1, -2,  4,
+   -13,  4,  2,  5, 10, -2,-21, 32, -3, 18,  9, -6, -9, -9, 10,  2 },
+  {  9,-16, -6, -2,  1,  4, 22,  2, -2,  1, -3, -2, -9,  3, 16, 19,
+   -24, -6, -6, -5, -8, -7,  8, -7, -1,-12,  5, -3,  0,  4,  2, -3 },
+  { 10,  3,-16, -4, -1, 13,  4,  4,  1, -3,  1, -6,-14, 18,  3,  8,
+    -8,-28,-16,  4,  4,  2, 12,  7,  9, -4, -4,  5, -1, -1,  2,  2 },
+  { -5,-13,-22, -3, -8, 21, -2, -9, 21, -4, -9,  5, -8, 15,  5,  1,
+    -5, -9, -7, -2, -5, -5, -1, -5, -5, -5,  3, 10, -4,  0, -7, -2 },
+  {  5,-10,-18,  2, 20,  4, 13,-10,  8,-15,-11, -3, -1, 16, 10,  9,
+    -8,  6,  7, -5,  6, 11,  5, 17, -4,  7,-11,  5, -3, -6,  2,  1 },
+  {  3, -5,-19,  1,  1, -3, -2,-25,-11,-17,  0,-13, -4, 10, 10,  2,
+    -5,  4,  0,  3, -3, -5,-10, -2, 13,-22,  0,  3,-11, -5,  7, -1 },
+  { 12,-14,-29,  6, -1, 10,  7,-17,-12, 14,  3,  9, -9,  9,  7,  6,
+    -3,-13,  0,  5,  3, -1, -6, -1,  0,  2,  4,-12, -5, -1,  2, 11 },
+  { 12,-15, -7, -2,-12, 17, 20,-16, -2,-12, -6, 15, -6, 12, 11,  9,
+     7, -6,  7, -4,-19,  6,  2,  2,  3,-11,-10, -4, -5, -3,  3,  2 },
+  { 11,-22, -6,  0,  8, 18,  3,-11, -4, -7,-15,-17,-12,  6, 16,  4,
+    -9,  4, -5,  3,  6,-16, 10, -7, -7, -3,  5,  0,  1,-15, -4,  5 },
+  { 12,-22,-16,  5, -6,  8, 12, -4, -9,-17,-11,  3,  5,  8,-17,  0,
+    11, -4,-13, -6,  2, -1, -1,  3,  3,-11,-12, -1,  1,  1, 12, -2 },
+  {  8,-10,-33, -5, -3, -6,  1, -7, -8, -4, -6, -1,  5, -4, -6,-12,
+   -16, -8, 11,  8,-14,  7, 12, 11,  4,-14, -3,  6, -7, -5, -3,  3 },
+  {  0, -8, -7,  2, -4, 24,  2, -9,-11, -3, -7, 11,-12, 17,  1, -1,
+     3, -5, -7, 12,  4, 11,  0,  3,  2,-18, -3,  4,  7, -6,  3, 15 },
+  { 10,-15,-16, -2, -4, -9,  7,-15, -6,  2,-16, 13, -8,  7, 19,-21,
+    -4,-12, -9, -3, -3,  6, 11, -3, -1,-19,  3, -7, -9, -4,  3, -6 },
+  { -5,-10,-21,  0, -3, -7, 18,-21, 15, -5,-12, -4,-13,  2,  6, -9,
+    -9,-11, -4, 13, -3,  6,  4, -1,  7, -9, -4,  9,  5,  2,  6,  3 },
+  { 15, -1,-27, -2, 10,  3,  7, -8,  9, -2,  7,  1, -2, -5, 18,  9,
+   -11,-17, -2,  7, -9, 11, 10,  0, -8,  6,-16, -3,  2, -7,  3, 11 },
+  {  4, -9,-39, 19,  6,-13, 13, -5, -5,-15, -2,  9,  0,  4, 14,  6,
+   -10, -4, -5,  2, -4, -2,  5,-11,  3,  3, -2, -2, -7,  9,  7,-10 },
+  {  5,-11, -8, 10, -2, 12, 16,  0, 12, -2, -6,  8, 14,  8,  7,  1,
+    18,-30,  4, 10, -4, -6,  2,-11,  9,-10, -8,  5,  0,  0, -7,  6 },
+  { -1,-16,-10, 11,  0, 13, 12, -4, -4, -5,-21, 12,  4, 13, 14, -7,
+     6,-16,-13,  8,  2,  9, 15,-12,  1, -9,-22, 10, -9,  9,  9, -7 },
+  {  4,-12,-27,  1, -2, 11, 15,  3, 14,-14, -9,  0, -9, 16, 22, 10,
+    16,-10,  5, -5, -9,  1,  1,  6,  6, -4,  2,-17, -5, -6,-15, -1 },
+  {  7,-12,-17,  1, -9,  5, 20, -7,  3, 23, -8, -8, -8, -1, 13, 17,
+    -7,-13,  4, -4,  7, 14,  8, 11, -3, -3,  4,  0,  4,  6, -1, -9 },
+  {  7,-15,-15, -4, 10, 12,  3,-13,  6, 14,  9, -8,-15, 14, 23, -5,
+   -10, -5,  1, 15,-10, -7,  1,  9,  4,-13,-10, 10,  7, -3,  2,  3 },
+  {  4,-10,-14,  0,  3,  4,  0, -9, -3, -4,-11,  2,-17,  8,  2, 15,
+     6,-12,-12, 15, -5, 17, 18,  3, -3, -3, -4, -6, -8, 13,  4, 10 },
+  { -2,-18,-26, 10, -4, 10, 13,  4, -4,-16, -7,-17, -3,  5, -4,  2,
+   -15,-10, -1, -8, -7, -3,  2,  2,  8,-10, -7,  2,  2, -4,  4, -1 },
+  {  4,-19, -5, -1, -1, -6,  2, -8, 10,-16,-28, -6,  8, -1, 11, 28,
+     2,-10, -4,  6, -6,  6, 11, 15, -4, -2,  7,  3,  7, -7,  4,  1 },
+  { -3, -6,-10, -5, 13, 18, 10,-15, -5, -3,-13,  5,  1,  2, 18, -5,
+   -10,-10, -7,  4,  2,  1,  5,  4,  2,  5,  4,  8, -9,-17,  7,  7 },
+  { 20,-12, -2, -4,  5, 14,  7,-11, -1,-16, -6, -4,-11, 17, 14,  0,
+    -8,-10, -8, 10,  3,  5, 10,-16,  3, -8,-14, 10,  3,  9,  0,  3 },
+  { 12,-10,-36,  0,  7, 15,  2,-16,  2, -1,  0, -1,  5,  4,  5, -3,
+     1,-10,  5, -1,-15, -3,-12, 12,  2,  5, -1,  5,  6, -3, -2,  2 },
+  { 17,-15,-31, 23, -4, 15, -2, -3,  6, -7, -5,  1,-12,  4,  6,  8,
+   -10,  8,  3,  5, -4,  1,  5,  3, -1, -4, -3,  1, 10, -4, -2, -2 },
+  {  6,-18, -5, 12, 10, 12, 14,-11, 15,  2, -9, -6, -5, -2, -9,  4,
+    -5,-28, -4, 14,  0,-16,  9, 14, -1,  3, -4, -4,  2,  1,  0,  4 },
+  { -5,-14,-31,  8, 16,  7, 13,-13,  5,  6,-16, 10, -5,  2, -2,  2,
+    14, -5,  8, -5,  7,-16,  6,-13, -5,  0, -5,  8, -3, -1,  4,  3 },
+  {  1, -2, -1,  0,  6,  5,  2, -4, -3, -1,  0,  1,  4,  2, 43, 28,
+   -12,-35, -2, -2, -7, -1,  0,  2, -1, -2, -2,  1, -4,  0, -2,  3 },
+  {  2, -9,-22, 12,  3,  3, -7, -4,-19,-22,-14, -4, -1, 21,  9, -3,
+   -15,-16,-13,  1,-11,  4, -9,  1, -7, -1, -1,  0, -2,  9,-13, -3 },
+  { -1, -3,-23,  0,  2, 12,  3, -9, -4,  7,  3,  9,-10,  1, 27, 28,
+     0,  9,-15, -2, -2,  1,  6,  8, -8,  7, -3, 20,  0,  0, -1, -6 },
+  { -1, 11,  8, -2,  1,  5, -6, -1,  4,  2, -4,  0, -1, -5,  4, -6,
+   -10,-12, 19,  1, -7,  9, -8, -9,-16,-11, -2, 12, 14,  4,  4, 34 },
+  { 17,  7, -6,  1,  4,-10, -5,  4,-11,  3,-18,  4, 14,-13, -3,  1,
+     0,  0,-11,  0,  7,-17, -4,  4,-11, -6, -8, 18,  0,  0,  0, 26 },
+  { -6, -7, -1, -1, 11, -8,  1,  3,  2, 11, -6, -6, 10, -3,  1, -3,
+     7,  4,-12, -8,  0, -9,  8,-22, -5,  0, -6, 22, -2, 11,-13, 24 },
+  { -3,  4,  0,  3,  9, 10, -1,  3, -9,-12,  1, -5, 18,  0, -3,  8,
+    25, 15, -8,  2,  2, -2,  4,  8,  9, -1, -5, 10, -3,  1, -1, 23 },
+  { -5,  2, -9, -1, -3,  0,  3, -1,-10, -4,  0,-13, 16,  9, -1,-14,
+     2,  6, -2, -6, -5, -2, -7,  7,  5,  3, 11, -2,-14,  0, -9, 30 },
+  {  4,  6,  6,  5, -3, -1,  4,  5, 10,  0,  5, -4,  7,-11, 14, 14,
+     7, 34, -9,  0,-10, 22, -7, -1,  7, -9,  2, -8,  0, -7, -5, 29 },
+  { -4,  3, -1, -4, -3,  5,  1, -4,  0,  2,  4,  2,  1, -1,-10,  1,
+     6, -6, -4,  1,  4, -3, -3, -5,  0,  3,  7,-12,  0, -2,-10, 55 },
+  {  5,  9, -1,  0,  4,  9,-21, -9,  4,  2,  6, -7, 11, -7,  1, -5,
+     0, -4,  2, -3,-13, -8,  0, -9, -4,  2, 16, -2,-15, -7,-11, 31 },
+  {  8,  2, -1,  0,  3, -5, -5,  5,  1, -1, -9,  1,  0, -6, -2, -1,
+     5,  2,  0,  0, 12, 20,-19,  1,  8,-12,-11,  0,  6, -5,  2, 31 },
+  { -1, -1, -2,  1, -1,  3, -9, -5,  8, -2,  5, -1,  0, -2,  4, -2,
+    -3,-12,  0, -2,  3,  0,  9,  4, -1, 21, -8,  3, -4,  9, -6, 30 },
+  { -4,  0, -7, 17, 10,-12, -2,-10,-12, -3, 10,  0, 11, -4,-13, -3,
+     5,  6, 10,  7, -8,  0, -7,-13,  1,  0, -2,  7,-12,  4, -3, 24 },
+  {-13,  9,  4, -2,  2, -4,-14, -1, -3, -5,-10,  4, 13, -2,  5, 13,
+     8,  3, -2,  1,  5, -6,  7,-18,-10,  1, -1,  5,  4,  1,  0, 25 },
+  { -5, -1, 18, 12,  8,  8,-16, -1,  1,  1,  1, -4, -5,  3,  3,  4,
+     4,-11,-12,-16, -6,  2, 12,-13,  0,  9,  7,  9, -9,  0,-10, 24 },
+  { -4,  1, -3,  0,  2, -4,  4,  1,  5,  0, -3,  2, -3, -2,  2, -1,
+     1,  4, -1, -2, -2,  1, -1, -1, -4, -1, -4, -2, -6,  6, 12, 69 },
+  {  8,  5, 11,  0,-15, -4, 13,  6,  0, -4,  9,  1, -5, -3, 15,  0,
+     1,  6, -5,  0,  1,  6,  5,  8,  0,  7,  1, -1, -4,-11, -9, 41 },
+  { -4, -9, 32, -6,  0,  7, -4,  6, -6,  1, -6, -2,  4, -8, -5, -3,
+   -16, -1, -2, -6,  1, 15,  0, 21,  3, -3, -4,  3,-12, 16,  2, 27 },
+  { -6, -5,  1, -9, -5,  3,  7, -3,  5,  5, 14, 13, 20, -7, -1, 12,
+    -1, 10,-11,-11, -7, -4,-14,  7,-14, 13, 22, 18, -1,  0, 14, 28 },
+  { -8,  3, -2,  0,  5,  6, -1, -4,  1,  3, -7,  3,  1,-15,  4, -9,
+    22,-10, -9, -4,  1,  8, -4,  9,-15,  2, -6, -4,-16, 12,-10, 23 },
+  {  0,  0,  2,  0, -1,  3, -3, -1,  3, -5,  7,  1,  5, -5, -8,  1,
+    13,-15, -5, -7, 12, -6, -2,  3, 10, -5, -8, 17, -5,-11,-14, 23 },
+  { -7, -4,  6, -4,  5, -6, -5,  2, -4, 11,  9, -4,  2, -2, -4,  6,
+    15,  3, -3, 18,-15, -2, -6,  3,  3,-20, 17, 11, -4,  2,  3, 29 },
+  {  6,  1, -6,  2,  3,  0,  0, -3,  3,  3, -1,  3, -4, -6, -6, -7,
+    -3, -2, -7, -2, -4,  5,  3, -5,-20,-13, -4, 10,-14,-29, 14, 37 },
+  {  3,  4,  3, -6, -4,  5,  0,  3,  2,  3,  0, -2,  4,  0, -3, -5,
+    -4,  4, -4,  4,  4,  3,  1, -4, -4, -9,-14, 20,-30,  3,-18, 33 },
+  {  0,  2,  5, -2, -4, -2, -1,  2, -6, -3, -2, -2,  2, -5, -1,  4,
+     3,  2, -3,  0, -1, -1,-10, -7,  2, -4,-18,  2,-37, -1, 12, 40 },
+  { -7,  2, -1,  0, -2,  4, -8,  1, -4, 12,  7,  4, 15, -7,  1, -9,
+    18,  0, 12,-17, -3, -1,  0,  0,  0,  2, -6,  0, -4, -3, -1, 26 },
+  { -6,  4,  8, -5, -6, -2,  2, -1,  1, -1,-15,  8,  7, -1,-17, -4,
+     1,  5,  6,-11, -6, 14, 17, -5,-15, 11,  8,  0, -3,-15, -6, 28 },
+  { -1,  0,  0,  0,  1,  0, -1,  0,  1,  3,  2, -2,  3, -1, -1,  2,
+     2, -1, -1, -7,  1,  2, -9,  0, -1, -4,-18,  7,-10, 49,-13, 32 },
+  { -1, -3,  4,  1,  2, -5,  1, -7, -1,  5, -9,  4,  4, 25,  1, -1,
+     2, -5,  2, -7, 17, -2, 10, -5,  0,  2,-15,  3, -9,  7, -9, 30 },
+  { -5, -1,  0,  2,  1, -1,  2,  5,-33,  3, -5, 14, 11,  7,  5, -3,
+     2, -8, -4, -2, -7, -6,  4, -8, -1, -8,  2, -2, -8, -1, -4, 27 },
+  { -1,  0, -1, -2,  1, -1, -2, -1,  2,  0,  1,  2,  2,  4,  1,  3,
+     4,  2,  1, -7, -4,  1, -3, -4,-35,-25, 17, 10, -3,-26, -7, 32 },
+  { -5,  1,  6, -2,  6,  6, -9,  3, -1, -4,  5, -4, -2, -2, -9,  2,
+    -5,  2,  2,  4,  3,  5, -5,-16,-31,-12,-11,  2,-19, 20, -2, 21 },
+  { -5,  2,  7, -7, -7,  5, -7,  2,  0,  0, -4,  3, -1,  0, -1, -2,
+     0, -3,  5,-11, -8, -3, -7, -7, 28,-11, -7,  0,-16,-11, -4, 29 },
+  {  2,  1, -3, -2, -1,  3,  4,  0,  1,  0, -1, -5,  4, -5,-12,  2,
+    -2, -5,-22, -2, -1, 11,  8, -7,-12,  0,-34,  6, -5, 11, -8, 19 },
+  { -1, -3,  5, 11, 18, -2, -2, -5, -2,  4, -1,  8,  5, -6,  1, -1,
+     2,  8,  4, -5, -8, -2,  5,-18,  7, 12,  7, 19,-18,  2, -6,-13 },
+  {  9,  0,  0,  5,  4,  3, -6,  4,  1, -4,  5, -1, -4,  8,  8,  6,
+    -8, -6,  0,  6, -3,  3,  5, -3, 17, 31, 16, 10,-13,  0, -9,-19 },
+  { 12,-10,  2, -2, -2, -1, -3,  6,-12, -5, -2, 14,-16,  4, 12, 12,
+    17,  4,  7,-16,  7, -6, 11,  7,  7,  2,-25, 23,-24,  5, -7, -9 },
+  { 10,  4, 13, 10, 10,  3, -6,  3,  3,  2, -1, -6,  8,  4, 10,  0,
+     1,  2, -4,  2, -3, -8,  0, -1,  9,  9,-10, -3,-29,  1, -1,-27 },
+  {  2,  2,  0,  7,  9, -2,-10, -1, -1,  1, -9, -5,  8,  4,  1,  2,
+   -10,  1, 13, 12, -3, 15, -9,  2, -7,  1,-10, 23,-20,-18, -9,-15 },
+  { -3, -5, -1,  8,  0, -5, -1,  4,  7, -1, -7,  2, -8, -5, 11,  7,
+    -6,  3, -3, -9,  7,  9,-22,  1,  6, -4, 14, 27,-25,-14,  3, -5 },
+  {  1,  3,  8,  4,  7,  6, 12,-17,-15,  1, -8,-10,  7,-14, -8,  6,
+    -2, -2,-11,-11, -7, 13, -2, -2,  4,  5, -5, 13,-23, -6,-17, -8 },
+  { -5,  4,-14, -5, -4, -5,  6,  5, -8, -5, -2,-11, -7,-12,  3,-11,
+     2, -6,  4,-10, -5, -7, 14,  5, 23, 11,  7, 12,-16, -6, -4,-16 },
+  {  5,  6,  2,  5, -2, -5, -5, -6, -5,-19,-13, -1, -3,-13,  5,  0,
+     6, -2, -2, -6, -7, -7, -1, -9,  4, 14, 17,-12,-27,  3,  0, -1 },
+  {  7, -1,  9,-10,  8,  2, -7, -2,  5,  2, -3, -7,  3,  0,  6,  4,
+    12,  5, 11, 14,-13, -1,  8,  1, 13,  9, 12, 12,-18,-14,-11,-16 },
+  { -7, -5, -6, -5,  0, -1, -3,  2,  2,  1,  4,  9,  2,  3,  5, -2,
+     2,  1,  8,  0,  3,  0, -2,  2,  1,  7, 29,  0,-36, -5, -9,-21 },
+  { 14, -6, -9,  0, -1, -8, -8,-11,  2,  2, -9,-12, 12, -4,  5,  3,
+    -5, -9, 11, -1, -3, 12,-21, -3, 12,  5,  3, 11,-18,-15,  1, -2 },
+  { -1,  3, -9, -3,  7, -7,-18,  2,  4, 12,-10,  2,  8, -3,-14, 13,
+    17, -5,  5, -9, 13, -3, -7,-18, 17, -2,  5,  7,-20, -3, -6,-11 },
+  { -3,  3,  3, -1,  1, -6, -5,  1,  5, -3,-14, -6, -5, -8, 14, -6,
+     7, -1,  5,  1, 15, -1, -7, -4,  6,-11,  9, -2,-37, 16, -7, -3 },
+  { -1,  0,  6,  1, -3, -9,  0, 11, -8,  2, -2,  0,  5,  2, 12,-10,
+    10, 13,  2,  7, -6,  2,-10,-10, 21, -5,  5,  5,-12,-23,  3,-14 },
+  {  6,  0, -2,  1,  0,  1,  0, -4,  1,  1,  8, -2,  2, -5, -2,  1,
+     8, -4, -1, -1,  4, -1,  2,  6, 32,  1, -5,-20,-40, -4,-18,-14 },
+  {  2,  2, -7, -2,  4,  4, -1,  2,  0, -2, -4, -7,  3,  5,  0, -5,
+     1,  2, -6,  4, -1, -2, -1,-15,  8,  3,  9, 46, -7,-18,  6,-11 },
+  {  5,  5, 16, 21,  3,-11, -4, 11,-12,  2,  4,-12, -1, 11,  8,  1,
+    -4, 11,-11,-21,  1,  1,-11,  3, 13,  1,  5, 12,-25,  1, -3, -2 },
+  {  1,  6, -7,  4,  2,  3,  1, -5,  8,  9,-15,  3, -3,-14, 17,  4,
+    -8, 14, -2, -8, -4,  5,  8, -7,  8,  9,  7,  6,-29,-17,  8,  4 },
+  { -7, -7,  4,  0, 13,  1,  0,  4,  4,-16,-10, -7,  5,  9,-15,-10,
+   -10,  8, -4, -1,-11, -1,-10,-15,  3,  3, 14, 10,-19,  2,-18,-12 },
+  { -4,  0,  2,  0,  5, -2, -9,  0,  4, -4,  2, -1, -2,  2, -4,  9,
+     2, -6, -4, -2, -1, -3, -3, -1,  2,  5, -1, 11,-24,-44, -9,-15 },
+  { -1,-10,  6, 21, 11, 15, -7, 10,-14, -9, -8, -8,  4,  6, 19,  1,
+    -6,  1, -5,-17, -8,-10,  9,  5, 11, 18, -1, 10,-16, -7, -9, -8 },
+  {  3, -5,  0,  0, -2, -2, -6,  4, -4,  1, -1,  0,  7, -3,  4, -4,
+    -7,  7, 17,-20,  6,  4,  1, -6,-12, 31, 13, 19,-14,-10, -7, -2 },
+  { -2,  6,-10,  3,  9,  6,-14, 15,  2, -5,  2,-11,  9, -8,  4,  6,
+    20,-15, -3, -3, -1, 32,-21,  6,  1,  9, 11, 17,-19,  6, -1, -3 },
+  {  8, 10, -2,  0, -8,-16,  7,  7,  6, 10,  4,-14,  7, -6, 21, -7,
+    10,  5,  5,  0, -7,  2, -6,  0, -7, 11, -9, 15,-20, -7,-11,  2 },
+  {  0, -7,  5,  2,  0, -3, -6, -4, -2, -1, -4, -5,-13, -1, 27, -9,
+    -6,-11, -7,  1, 11, -4, -4,-14, -2, 11,  6, 10,-19, -6,-15,  2 },
+  {  0,  7, -1,  2, -7,-15, -2, -3, 13, -5, -5, 12,  3,  0,  5, -5,
+   -22,  2,  7, 22, 13,  0, -1,  2,  3,  2, -7,  7,-27, -4, -4,-12 },
+  { 11,  1,-16,  6,-15,  1,  3,  2,  0,  2, -3,  2,  5, -2, -5,  9,
+     5, -3,  3, -2,-11,  3,  9,  6,  9,  3, -1, 12,-41,  8, -6,  9 },
+  {  3, -7,  3,  2,  5,  5,  0, -1,  1,  3, -5, -2,-13,  7, -1, -2,
+    -2, -6,  4, -6,  0,  2, -2,  2,  4,  1, -4,  1,-47,-21,  7, -6 },
+  {  3, 16, -7, 13, -4, -2, 10, -3, -1, 18,-13,  7,-13, -4,  8,  4,
+     8,  9, -5, 13,  8, -5,  3, -6,  7, 18, -8, 10,-25, -3,-12,-12 },
+  {  1, -1, -1,  0,  2,  5, -5, -3,  0, -5, -1,  0, -4, -8, -2,  3,
+     2, -2,-17, -6, -4,  1, 33, -6,-20, -6,  8, 31,-26, -8, -1, -4 },
+  {  3, -3, -3,  5, -3, -2,  1,  7,  0,  3,  6,  3,  6, -2,  9, 15,
+   -10, -3,-15, -5, -3, -4, -6,-30, 17, -8, -2,  2,-20,  0, -8, -2 },
+  { -2, -1, -1, -1,  3, -5, -2, -3,  4, -2,  0,  5,  8, -3,  1, -4,
+     1,  1, -3,  4,  4,-14,  3, 11, -5,  3, -3,  7, -3, 13, 23,-16 },
+  {  2, -6,  1, -3,  5,  0, -6,-11, -7, -4, -1,  2, -7, -1, -1,  7,
+     1, -2,  6, 12, -6,  8,-13, 17, 25,-23,-19, -7,-12,  9, 16,-17 },
+  {  9,  4,  4,  4, -3, -1,  6, -2, -3,  0, 13, -4, -7, 14,  1, -7,
+     0, -5,  3,-19, -3,  5,  3,  9, -1,  9,-13, 13,-17,  4, 21,-26 },
+  {  0, -5,  0,  0, -4, -5,  2, -6, -4,  5, -7, 10,  0,  2,  0, -2,
+    -2,  0,  4, -6,  7, -2,  6,  5, -5,  2,-12,  1,-29, 29, 27, 12 },
+  {  9,-10,-22,  6, -1, -1,  9,-14,-12, -2,  1, -1, 10,-11,-16,  0,
+     3, 11, 13,-14, -9, -2, -1,  6,  4,-14,  0,-10, -2, 16, 17,-11 },
+  {  2,  0, -1, -2,  4,  3, -6, -2,  1, -1,  1,  3, -4,  1,  3, -4,
+    -1, -1,  4, -1,  1,  0,  1,  6, -5, -7,  2,  1,-47, -3, 50,-17 },
+  {  8, -4,-11, -7, 11, 11, 14, -7, 12, -7,  6,  2, 13, -6, -3, -2,
+   -14,  6,  6,  6,  0,  2, -1,  5,-20,  2, -1,  4, -5,  6, 21,-11 },
+  { -2, -9,  3,  0, -6,  7,  8, -8,  1, -3,  4,  1,  5, -2, -3, -7,
+     4,  7,-12, -9, -2, 10, -6, 13,  6,  5, 20,  2,-15,  9, 28, -7 },
+  {  0, -5, -6, -6, -6,  1, -6,  6, -2,  4,  8, -3, 12, -1, -4, -2,
+     6, 16,-14,  9,-14, -2, -8,-27, -3, 18, -1, -7, -3,  8, 23,-23 },
+  {  1,  4, -9, -1, -5, 10, -2,  1,-11,  1, -9,  4,  7, 14, -9, -2,
+    -3,  2, -5, -1, -6,-10, -7, 11, 20,  2,  3,-19,  3, 15, 30, -9 },
+  {  7,  2,-14, -4,  0, -2,  5,  2,  5, -2,  8, -3, -7,  6,  6,-11,
+   -14,  1, 10, -1, -7, -8,  1, 10,  3, -6,-15,-12,-17,  4, 30, -6 },
+  {  4,  2,  1, -2,  3,  0,  1,  0,  2,  0,  1,  6, -7,  0,  3,  4,
+     4, -4, -2, -5, -2,  2, -1, -2,  0, -2,-11, -7, -3, 42, 24,-14 },
+  {  4,  1,  3,  2,  0, -2, -3, -2,  2, -1,  4, 11, -2,  2,  3, -4,
+    -5,  9,  2, -4, -9,  5,  8, -1, -7,  1, 24,-13,-28, 20, 15,-22 },
+  { -3,  7,  6,  3, -2, -5,-10, -2, -2, -1, -6, -6, -2,-14,-16, -6,
+    -5,  0, 18,  0,  9,  1,  7,-13, -5, -6, -9, 11,-15,  9, 22,-11 },
+  {  9, -2,  6,  5,  2,  9,-10,  1,  1,  5, -4, 12,  2,  2,-10, -7,
+    -4, -6,  7,  9,  6, 15,  6,  6,-10, 10,  5,-13, -5,  6, 24,-12 },
+  {  1,  3, -3, -3,  8,  1, -6,  2, -5, -3,  7,  2, 14,  6,  9, -6,
+    -5, -4, 27,  7, -3,  8, -6,  3, -8,  8, 22, -5, -6, -2, 22,-17 },
+  { -2, -2,  3, 10,  9,  9, 12,-15, -1,-11,-13,  3, -2,  1, -3,-11,
+     7,  9, 16, -3,-10, -5, -5,  1,  8, -3,  9,  9, -5,  3, 31,-12 },
+  {  7, -5, 10, -4, -8,  2, 16, -2, 10, 10, -3, -2,  3, -8, -3,  3,
+   -13, -6, 15, 20, -9, -3,-12,  1, -2,-16,  8,  8, -1, 16, 22, -5 },
+  {  5, -3,-15, -2, 12, -8,  8, -5,  2, -8, 20,-18, 14, -4,  3,  3,
+     7,-13,-16,  1,-10,  7, 16,  7,  4,-14, -4, -5, -9,  8, 23, -6 },
+  {  5, -4, -5, -4,  1,  8,  4, -7, -5,  8, 10,  6, -6,-10, -2,  6,
+     9,-17,-14, 11, 12, -3,-13, -7,  2, 18,  3,-25,-16, 18, 22, -5 },
+  {  5,  6, -7,-20, -4,  2,  8,  4,-24, -4,  1,  4, -5, -2,  1,-10,
+    -2,  9,  3, -4, -3, -4, -4, -4, 10, 10,  3,  0, -6, 25, 21,-11 },
+  {  0,  7, -1, 14, -6, -4,-10,  5,  4,  4,  4, -5,  3,  4, -1, -7,
+     8,-19,  0,  6,  2,  3,-18, -3, -6,  2,  8, 14,-26, 22, 27,-13 },
+  { -2, -6,  7, -5, 12, -7,  8, -1,  3, -2,  4,  1,  8, -2,  0, 14,
+     6, -5,  6, -4, -7,  7,-21,  8,  1,  8, -9, -4, -3, 11, 25,-13 },
+  {  4,  4, -1, -6,  4,  9, -8,  1, -3,-10, -2,  0, 15, -9,-16, 11,
+     1,  1,  6,  3, -9, -5, 16, 26,  1,-14,  1, -3,-14,  7, 15, -9 },
+  {-12, -2, -9,-13,  2,  6, 14,  0,  1,  0, -1,-13,  0, 10, -1,  6,
+     9, -7,  8,  8, 19,  6, -1,  9, 10, -4,  1, -7,-22, -2, 29, -7 },
+  {  2,  4, 13,-12, -8, -4, -5, 13, 12, -5, -3, -3, -4,  1, -1, 10,
+    15, -6, -1,-11,-30,  4, 15, -1,  9, -7,  0, -2, -7, 10, 25,-16 },
+  {  7,-15, -7, -7, -1, -5, -5,-11,-20, 10,  3,-10, -3,  5, 20, -4,
+     0, -2, -2, 17,  2,  0, -3,  3,  6,  5, -1,-12, -3, 15, 22,-16 },
+  {  4, -1,  3,  4, -5,  0, -1, -5,-24,-29,  4, -9,  1, -3,  0,  0,
+     0, -4,  7, -4, -4, -4,  3,  1, -6,  5, -3, -5,-10,  3, 25,-10 },
+  { -2, -1, -1,  4,  4, -1,  2,  0, -4, -4,  2, -1, -3, -1, -2, -2,
+     1, -3, -5, -1,  2, -3, -4, -4, -3,  5, -9,  1,-11,  7, 46,-46 },
+  {  0, -9,  3,  4,  4,  3, -5, -6,  5, -4,  4, -2,  1,  7, -4,-10,
+    13,  1,  3, -6,  4, -4,  7,  2,-19,-25, -3,-16,-12, 16, 20, -1 },
+  { 18,  6,  4,-12,  0,-14,  9, -6, -1, -4, -5,  2,  1, 12,  4,  2,
+     7,  0,  2,  5,-11, -5, -2,  2, -4, 10,  0, -9, -7,  9, 25, -8 },
+  {  5,  0, -6,  5,  6,  3,  3,-10, -5,  1, -1,  4,  3,-11, -8,  5,
+     4, -5,  5, -5, -7, -5, 11,  5, 20, -8,-16, 21, -4, 27, 23, -5 }
 };
 
 
diff --git a/ffmpeg-mt/libavcodec/dcadsp.c b/ffmpeg-mt/libavcodec/dcadsp.c
index af48e3c..14932e6 100644
--- a/ffmpeg-mt/libavcodec/dcadsp.c
+++ b/ffmpeg-mt/libavcodec/dcadsp.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2004 Gildas Bazin
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 #include "dcadsp.h"
 
 static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
-                          int decifactor, float scale, float bias)
+                          int decifactor, float scale)
 {
     float *out2 = out + decifactor;
     const float *cf0 = coefs;
@@ -39,8 +39,8 @@ static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
             v0 += s * *cf0++;
             v1 += s * *--cf1;
         }
-        *out++  = (v0 * scale) + bias;
-        *out2++ = (v1 * scale) + bias;
+        *out++  = v0 * scale;
+        *out2++ = v1 * scale;
     }
 }
 
diff --git a/ffmpeg-mt/libavcodec/dcadsp.h b/ffmpeg-mt/libavcodec/dcadsp.h
index 20020ae..3c6f1f9 100644
--- a/ffmpeg-mt/libavcodec/dcadsp.h
+++ b/ffmpeg-mt/libavcodec/dcadsp.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -21,7 +21,7 @@
 
 typedef struct DCADSPContext {
     void (*lfe_fir)(float *out, const float *in, const float *coefs,
-                    int decifactor, float scale, float bias);
+                    int decifactor, float scale);
 } DCADSPContext;
 
 void ff_dcadsp_init(DCADSPContext *s);
diff --git a/ffmpeg-mt/libavcodec/dcahuff.h b/ffmpeg-mt/libavcodec/dcahuff.h
index cbc8429..254fc76 100644
--- a/ffmpeg-mt/libavcodec/dcahuff.h
+++ b/ffmpeg-mt/libavcodec/dcahuff.h
@@ -3,20 +3,20 @@
  * Copyright (C) 2004 Gildas Bazin
  * Copyright (C) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dct-test.c b/ffmpeg-mt/libavcodec/dct-test.c
index b45f23e..e943d6a 100644
--- a/ffmpeg-mt/libavcodec/dct-test.c
+++ b/ffmpeg-mt/libavcodec/dct-test.c
@@ -2,20 +2,20 @@
  * (c) 2001 Fabrice Bellard
  *     2007 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dct.c b/ffmpeg-mt/libavcodec/dct.c
index dab94c3..83ea00f 100644
--- a/ffmpeg-mt/libavcodec/dct.c
+++ b/ffmpeg-mt/libavcodec/dct.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
  * Copyright (c) 2010 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
@@ -29,8 +29,7 @@
 
 #include <math.h>
 #include "libavutil/mathematics.h"
-#include "fft.h"
-#include "x86/fft.h"
+#include "dct.h"
 
 #define DCT32_FLOAT
 #include "dct32.c"
@@ -59,7 +58,7 @@ static void ff_dst_calc_I_c(DCTContext *ctx, FFTSample *data)
     }
 
     data[n/2] *= 2;
-    ff_rdft_calc(&ctx->rdft, data);
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
 
     data[0] *= 0.5f;
 
@@ -93,7 +92,7 @@ static void ff_dct_calc_I_c(DCTContext *ctx, FFTSample *data)
         data[n - i] = tmp1 + s;
     }
 
-    ff_rdft_calc(&ctx->rdft, data);
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
     data[n] = data[1];
     data[1] = next;
 
@@ -121,7 +120,7 @@ static void ff_dct_calc_III_c(DCTContext *ctx, FFTSample *data)
 
     data[1] = 2 * next;
 
-    ff_rdft_calc(&ctx->rdft, data);
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
 
     for (i = 0; i < n / 2; i++) {
         float tmp1 = data[i        ] * inv_n;
@@ -152,7 +151,7 @@ static void ff_dct_calc_II_c(DCTContext *ctx, FFTSample *data)
         data[n-i-1] = tmp1 - s;
     }
 
-    ff_rdft_calc(&ctx->rdft, data);
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
 
     next = data[1] * 0.5;
     data[1] *= -1;
@@ -176,11 +175,6 @@ static void dct32_func(DCTContext *ctx, FFTSample *data)
     ctx->dct32(data, data);
 }
 
-void ff_dct_calc(DCTContext *s, FFTSample *data)
-{
-    s->dct_calc(s, data);
-}
-
 av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
 {
     int n = 1 << nbits;
diff --git a/ffmpeg-mt/libavcodec/dct.h b/ffmpeg-mt/libavcodec/dct.h
new file mode 100644
index 0000000..faddaa3
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/dct.h
@@ -0,0 +1,52 @@
+/*
+ * (I)DCT Transforms
+ * Copyright (c) 2009 Peter Ross <pross at xvid.org>
+ * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
+ * Copyright (c) 2010 Vitor Sessak
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef AVCODEC_DCT_H
+#define AVCODEC_DCT_H
+
+#include "rdft.h"
+
+struct DCTContext {
+    int nbits;
+    int inverse;
+    RDFTContext rdft;
+    const float *costab;
+    FFTSample *csc2;
+    void (*dct_calc)(struct DCTContext *s, FFTSample *data);
+    void (*dct32)(FFTSample *out, const FFTSample *in);
+};
+
+/**
+ * Set up DCT.
+ * @param nbits           size of the input array:
+ *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
+ *                        (1 << nbits) + 1 for DCT-I
+ *
+ * @note the first element of the input of DST-I is ignored
+ */
+int  ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
+void ff_dct_end (DCTContext *s);
+
+void ff_dct_init_mmx(DCTContext *s);
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/dct32.c b/ffmpeg-mt/libavcodec/dct32.c
index 4e843ee..ae99d88 100644
--- a/ffmpeg-mt/libavcodec/dct32.c
+++ b/ffmpeg-mt/libavcodec/dct32.c
@@ -2,20 +2,20 @@
  * Template for the Discrete Cosine Transform for 32 samples
  * Copyright (c) 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dctref.c b/ffmpeg-mt/libavcodec/dctref.c
index 851014b..ae3dec5 100644
--- a/ffmpeg-mt/libavcodec/dctref.c
+++ b/ffmpeg-mt/libavcodec/dctref.c
@@ -2,20 +2,20 @@
  * reference discrete cosine transform (double precision)
  * Copyright (C) 2009 Dylan Yudaken
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dctref.h b/ffmpeg-mt/libavcodec/dctref.h
index adbaf68..ffd3533 100644
--- a/ffmpeg-mt/libavcodec/dctref.h
+++ b/ffmpeg-mt/libavcodec/dctref.h
@@ -2,20 +2,20 @@
  * reference discrete cosine transform (double precision)
  * Copyright (C) 2009 Dylan Yudaken
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dfa.c b/ffmpeg-mt/libavcodec/dfa.c
new file mode 100644
index 0000000..b149791
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/dfa.c
@@ -0,0 +1,395 @@
+/*
+ * Chronomaster DFA Video Decoder
+ * Copyright (c) 2011 Konstantin Shishkov
+ * based on work by Vladimir "VAG" Gneushev
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "libavutil/intreadwrite.h"
+#include "bytestream.h"
+#include "libavutil/lzo.h" // for av_memcpy_backptr
+
+typedef struct DfaContext {
+    AVFrame pic;
+
+    uint32_t pal[256];
+    uint8_t *frame_buf;
+} DfaContext;
+
+static av_cold int dfa_decode_init(AVCodecContext *avctx)
+{
+    DfaContext *s = avctx->priv_data;
+
+    avctx->pix_fmt = PIX_FMT_PAL8;
+
+    s->frame_buf = av_mallocz(avctx->width * avctx->height + AV_LZO_OUTPUT_PADDING);
+    if (!s->frame_buf)
+        return AVERROR(ENOMEM);
+
+    return 0;
+}
+
+static int decode_copy(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    const int size = width * height;
+
+    if (src_end - src < size)
+        return -1;
+    bytestream_get_buffer(&src, frame, size);
+    return 0;
+}
+
+static int decode_tsw1(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    const uint8_t *frame_start = frame;
+    const uint8_t *frame_end   = frame + width * height;
+    int mask = 0x10000, bitbuf = 0;
+    int v, offset, count, segments;
+
+    segments = bytestream_get_le32(&src);
+    frame   += bytestream_get_le32(&src);
+    if (frame < frame_start || frame > frame_end)
+        return -1;
+    while (segments--) {
+        if (mask == 0x10000) {
+            if (src >= src_end)
+                return -1;
+            bitbuf = bytestream_get_le16(&src);
+            mask = 1;
+        }
+        if (src_end - src < 2 || frame_end - frame < 2)
+            return -1;
+        if (bitbuf & mask) {
+            v = bytestream_get_le16(&src);
+            offset = (v & 0x1FFF) << 1;
+            count = ((v >> 13) + 2) << 1;
+            if (frame - frame_start < offset || frame_end - frame < count)
+                return -1;
+            av_memcpy_backptr(frame, offset, count);
+            frame += count;
+        } else {
+            *frame++ = *src++;
+            *frame++ = *src++;
+        }
+        mask <<= 1;
+    }
+
+    return 0;
+}
+
+static int decode_dsw1(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    const uint8_t *frame_start = frame;
+    const uint8_t *frame_end   = frame + width * height;
+    int mask = 0x10000, bitbuf = 0;
+    int v, offset, count, segments;
+
+    segments = bytestream_get_le16(&src);
+    while (segments--) {
+        if (mask == 0x10000) {
+            if (src >= src_end)
+                return -1;
+            bitbuf = bytestream_get_le16(&src);
+            mask = 1;
+        }
+        if (src_end - src < 2 || frame_end - frame < 2)
+            return -1;
+        if (bitbuf & mask) {
+            v = bytestream_get_le16(&src);
+            offset = (v & 0x1FFF) << 1;
+            count = ((v >> 13) + 2) << 1;
+            if (frame - frame_start < offset || frame_end - frame < count)
+                return -1;
+            // can't use av_memcpy_backptr() since it can overwrite following pixels
+            for (v = 0; v < count; v++)
+                frame[v] = frame[v - offset];
+            frame += count;
+        } else if (bitbuf & (mask << 1)) {
+            frame += bytestream_get_le16(&src);
+        } else {
+            *frame++ = *src++;
+            *frame++ = *src++;
+        }
+        mask <<= 2;
+    }
+
+    return 0;
+}
+
+static int decode_dds1(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    const uint8_t *frame_start = frame;
+    const uint8_t *frame_end   = frame + width * height;
+    int mask = 0x10000, bitbuf = 0;
+    int i, v, offset, count, segments;
+
+    segments = bytestream_get_le16(&src);
+    while (segments--) {
+        if (mask == 0x10000) {
+            if (src >= src_end)
+                return -1;
+            bitbuf = bytestream_get_le16(&src);
+            mask = 1;
+        }
+        if (src_end - src < 2 || frame_end - frame < 2)
+            return -1;
+        if (bitbuf & mask) {
+            v = bytestream_get_le16(&src);
+            offset = (v & 0x1FFF) << 2;
+            count = ((v >> 13) + 2) << 1;
+            if (frame - frame_start < offset || frame_end - frame < count*2 + width)
+                return -1;
+            for (i = 0; i < count; i++) {
+                frame[0] = frame[1] =
+                frame[width] = frame[width + 1] = frame[-offset];
+
+                frame += 2;
+            }
+        } else if (bitbuf & (mask << 1)) {
+            frame += bytestream_get_le16(&src) * 2;
+        } else {
+            frame[0] = frame[1] =
+            frame[width] = frame[width + 1] =  *src++;
+            frame += 2;
+            frame[0] = frame[1] =
+            frame[width] = frame[width + 1] =  *src++;
+            frame += 2;
+        }
+        mask <<= 2;
+    }
+
+    return 0;
+}
+
+static int decode_bdlt(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    const uint8_t *frame_end = frame + width * height;
+    uint8_t *line_ptr;
+    int count, lines, segments;
+
+    count = bytestream_get_le16(&src);
+    if (count >= height || width * count < 0)
+        return -1;
+    frame += width * count;
+    lines = bytestream_get_le16(&src);
+    if (frame + lines * width > frame_end || src >= src_end)
+        return -1;
+
+    while (lines--) {
+        line_ptr = frame;
+        frame += width;
+        segments = *src++;
+        while (segments--) {
+            if (src_end - src < 3)
+                return -1;
+            line_ptr += *src++;
+            if (line_ptr >= frame)
+                return -1;
+            count = (int8_t)*src++;
+            if (count >= 0) {
+                if (line_ptr + count > frame || src_end - src < count)
+                    return -1;
+                bytestream_get_buffer(&src, line_ptr, count);
+            } else {
+                count = -count;
+                if (line_ptr + count > frame || src >= src_end)
+                    return -1;
+                memset(line_ptr, *src++, count);
+            }
+            line_ptr += count;
+        }
+    }
+
+    return 0;
+}
+
+static int decode_wdlt(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    const uint8_t *frame_end   = frame + width * height;
+    uint8_t *line_ptr;
+    int count, i, v, lines, segments;
+
+    lines = bytestream_get_le16(&src);
+    if (frame + lines * width > frame_end || src >= src_end)
+        return -1;
+
+    while (lines--) {
+        segments = bytestream_get_le16(&src);
+        while ((segments & 0xC000) == 0xC000) {
+            frame    -= (int16_t)segments * width;
+            if (frame >= frame_end)
+                return -1;
+            segments = bytestream_get_le16(&src);
+        }
+        if (segments & 0x8000) {
+            frame[width - 1] = segments & 0xFF;
+            segments = bytestream_get_le16(&src);
+        }
+        line_ptr = frame;
+        frame += width;
+        while (segments--) {
+            if (src_end - src < 2)
+                return -1;
+            line_ptr += *src++;
+            if (line_ptr >= frame)
+                return -1;
+            count = (int8_t)*src++;
+            if (count >= 0) {
+                if (line_ptr + count*2 > frame || src_end - src < count*2)
+                    return -1;
+                bytestream_get_buffer(&src, line_ptr, count*2);
+                line_ptr += count * 2;
+            } else {
+                count = -count;
+                if (line_ptr + count*2 > frame || src_end - src < 2)
+                    return -1;
+                v = bytestream_get_le16(&src);
+                for (i = 0; i < count; i++)
+                    bytestream_put_le16(&line_ptr, v);
+            }
+        }
+    }
+
+    return 0;
+}
+
+static int decode_unk6(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    return -1;
+}
+
+static int decode_blck(uint8_t *frame, int width, int height,
+                       const uint8_t *src, const uint8_t *src_end)
+{
+    memset(frame, 0, width * height);
+    return 0;
+}
+
+
+typedef int (*chunk_decoder)(uint8_t *frame, int width, int height,
+                             const uint8_t *src, const uint8_t *src_end);
+
+static const chunk_decoder decoder[8] = {
+    decode_copy, decode_tsw1, decode_bdlt, decode_wdlt,
+    decode_unk6, decode_dsw1, decode_blck, decode_dds1,
+};
+
+static const char* chunk_name[8] = {
+    "COPY", "TSW1", "BDLT", "WDLT", "????", "DSW1", "BLCK", "DDS1"
+};
+
+static int dfa_decode_frame(AVCodecContext *avctx,
+                            void *data, int *data_size,
+                            AVPacket *avpkt)
+{
+    DfaContext *s = avctx->priv_data;
+    const uint8_t *buf = avpkt->data;
+    const uint8_t *buf_end = avpkt->data + avpkt->size;
+    const uint8_t *tmp_buf;
+    uint32_t chunk_type, chunk_size;
+    uint8_t *dst;
+    int ret;
+    int i, pal_elems;
+
+    if (s->pic.data[0])
+        avctx->release_buffer(avctx, &s->pic);
+
+    if ((ret = avctx->get_buffer(avctx, &s->pic))) {
+        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+        return ret;
+    }
+
+    while (buf < buf_end) {
+        chunk_size = AV_RL32(buf + 4);
+        chunk_type = AV_RL32(buf + 8);
+        buf += 12;
+        if (buf_end - buf < chunk_size) {
+            av_log(avctx, AV_LOG_ERROR, "Chunk size is too big (%d bytes)\n", chunk_size);
+            return -1;
+        }
+        if (!chunk_type)
+            break;
+        if (chunk_type == 1) {
+            pal_elems = FFMIN(chunk_size / 3, 256);
+            tmp_buf = buf;
+            for (i = 0; i < pal_elems; i++) {
+                s->pal[i] = bytestream_get_be24(&tmp_buf) << 2;
+                s->pal[i] |= (s->pal[i] >> 6) & 0x333;
+            }
+            s->pic.palette_has_changed = 1;
+        } else if (chunk_type <= 9) {
+            if (decoder[chunk_type - 2](s->frame_buf, avctx->width, avctx->height,
+                                        buf, buf + chunk_size)) {
+                av_log(avctx, AV_LOG_ERROR, "Error decoding %s chunk\n",
+                       chunk_name[chunk_type - 2]);
+                return -1;
+            }
+        } else {
+            av_log(avctx, AV_LOG_WARNING, "Ignoring unknown chunk type %d\n",
+                   chunk_type);
+        }
+        buf += chunk_size;
+    }
+
+    buf = s->frame_buf;
+    dst = s->pic.data[0];
+    for (i = 0; i < avctx->height; i++) {
+        memcpy(dst, buf, avctx->width);
+        dst += s->pic.linesize[0];
+        buf += avctx->width;
+    }
+    memcpy(s->pic.data[1], s->pal, sizeof(s->pal));
+
+    *data_size = sizeof(AVFrame);
+    *(AVFrame*)data = s->pic;
+
+    return avpkt->size;
+}
+
+static av_cold int dfa_decode_end(AVCodecContext *avctx)
+{
+    DfaContext *s = avctx->priv_data;
+
+    if (s->pic.data[0])
+        avctx->release_buffer(avctx, &s->pic);
+
+    av_freep(&s->frame_buf);
+
+    return 0;
+}
+
+AVCodec ff_dfa_decoder = {
+    "dfa",
+    AVMEDIA_TYPE_VIDEO,
+    CODEC_ID_DFA,
+    sizeof(DfaContext),
+    dfa_decode_init,
+    NULL,
+    dfa_decode_end,
+    dfa_decode_frame,
+    CODEC_CAP_DR1,
+    .long_name = NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
+};
diff --git a/ffmpeg-mt/libavcodec/dirac.c b/ffmpeg-mt/libavcodec/dirac.c
index bacd1f8..0256f29 100644
--- a/ffmpeg-mt/libavcodec/dirac.c
+++ b/ffmpeg-mt/libavcodec/dirac.c
@@ -2,20 +2,20 @@
  * Copyright (C) 2007 Marco Gerards <marco at gnu.org>
  * Copyright (C) 2009 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
  * @author Marco Gerards <marco at gnu.org>
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "dirac.h"
 #include "avcodec.h"
 #include "golomb.h"
diff --git a/ffmpeg-mt/libavcodec/dirac.h b/ffmpeg-mt/libavcodec/dirac.h
index 87d66cc..0be66c2 100644
--- a/ffmpeg-mt/libavcodec/dirac.h
+++ b/ffmpeg-mt/libavcodec/dirac.h
@@ -2,20 +2,20 @@
  * Copyright (C) 2007 Marco Gerards <marco at gnu.org>
  * Copyright (C) 2009 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dirac_parser.c b/ffmpeg-mt/libavcodec/dirac_parser.c
index e5b9599..aa561f7 100644
--- a/ffmpeg-mt/libavcodec/dirac_parser.c
+++ b/ffmpeg-mt/libavcodec/dirac_parser.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2007-2008 Marco Gerards <marco at gnu.org>
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -247,7 +247,7 @@ static void dirac_parse_close(AVCodecParserContext *s)
         av_free(pc->buffer);
 }
 
-AVCodecParser dirac_parser = {
+AVCodecParser ff_dirac_parser = {
     { CODEC_ID_DIRAC },
     sizeof(DiracParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/dnxhd_parser.c b/ffmpeg-mt/libavcodec/dnxhd_parser.c
index 6149a2d..44ea8f0 100644
--- a/ffmpeg-mt/libavcodec/dnxhd_parser.c
+++ b/ffmpeg-mt/libavcodec/dnxhd_parser.c
@@ -2,20 +2,20 @@
  * DNxHD/VC-3 parser
  * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier at free.fr>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -86,7 +86,7 @@ static int dnxhd_parse(AVCodecParserContext *s,
     return next;
 }
 
-AVCodecParser dnxhd_parser = {
+AVCodecParser ff_dnxhd_parser = {
     { CODEC_ID_DNXHD },
     sizeof(ParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/dnxhddata.c b/ffmpeg-mt/libavcodec/dnxhddata.c
index 2625a9b..82d083c 100644
--- a/ffmpeg-mt/libavcodec/dnxhddata.c
+++ b/ffmpeg-mt/libavcodec/dnxhddata.c
@@ -2,20 +2,20 @@
  * VC3/DNxHD data.
  * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dnxhddata.h b/ffmpeg-mt/libavcodec/dnxhddata.h
index 32c77db..df84187 100644
--- a/ffmpeg-mt/libavcodec/dnxhddata.h
+++ b/ffmpeg-mt/libavcodec/dnxhddata.h
@@ -2,20 +2,20 @@
  * VC3/DNxHD decoder.
  * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dnxhddec.c b/ffmpeg-mt/libavcodec/dnxhddec.c
index 67dd7fc..e4ad5cf 100644
--- a/ffmpeg-mt/libavcodec/dnxhddec.c
+++ b/ffmpeg-mt/libavcodec/dnxhddec.c
@@ -2,27 +2,27 @@
  * VC3/DNxHD decoder.
  * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 //#define TRACE
 //#define DEBUG
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "get_bits.h"
 #include "dnxhddata.h"
@@ -107,7 +107,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
     ctx->height = AV_RB16(buf + 0x18);
     ctx->width  = AV_RB16(buf + 0x1a);
 
-    dprintf(ctx->avctx, "width %d, heigth %d\n", ctx->width, ctx->height);
+    av_dlog(ctx->avctx, "width %d, heigth %d\n", ctx->width, ctx->height);
 
     if (buf[0x21] & 0x40) {
         av_log(ctx->avctx, AV_LOG_ERROR, "10 bit per component\n");
@@ -115,7 +115,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
     }
 
     ctx->cid = AV_RB32(buf + 0x28);
-    dprintf(ctx->avctx, "compression id %d\n", ctx->cid);
+    av_dlog(ctx->avctx, "compression id %d\n", ctx->cid);
 
     if (dnxhd_init_vlc(ctx, ctx->cid) < 0)
         return -1;
@@ -128,7 +128,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
     ctx->mb_width = ctx->width>>4;
     ctx->mb_height = buf[0x16d];
 
-    dprintf(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
+    av_dlog(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
 
     if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame)
         ctx->height <<= 1;
@@ -141,7 +141,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
 
     for (i = 0; i < ctx->mb_height; i++) {
         ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2));
-        dprintf(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
+        av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
         if (buf_size < ctx->mb_scan_index[i] + 0x280) {
             av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n");
             return -1;
@@ -293,7 +293,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     AVFrame *picture = data;
     int first_field = 1;
 
-    dprintf(avctx, "frame size %d\n", buf_size);
+    av_dlog(avctx, "frame size %d\n", buf_size);
 
  decode_coding_unit:
     if (dnxhd_decode_header(ctx, buf, buf_size, first_field) < 0)
@@ -346,7 +346,7 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec dnxhd_decoder = {
+AVCodec ff_dnxhd_decoder = {
     "dnxhd",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DNXHD,
diff --git a/ffmpeg-mt/libavcodec/dnxhdenc.c b/ffmpeg-mt/libavcodec/dnxhdenc.c
index 8cf54c5..958f9d4 100644
--- a/ffmpeg-mt/libavcodec/dnxhdenc.c
+++ b/ffmpeg-mt/libavcodec/dnxhdenc.c
@@ -4,31 +4,40 @@
  *
  * VC-3 encoder funded by the British Broadcasting Corporation
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 //#define DEBUG
 #define RC_VARIANCE 1 // use variance or ssd for fast rc
 
+#include "libavutil/opt.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
 #include "dnxhdenc.h"
 
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+
+static const AVOption options[]={
+    {"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), FF_OPT_TYPE_INT, 0, 0, 1, VE},
+{NULL}
+};
+static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
+
 int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
 
 #define LAMBDA_FRAC_BITS 10
@@ -146,7 +155,7 @@ static int dnxhd_init_rc(DNXHDEncContext *ctx)
     if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
         FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);
 
-    ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8;
+    ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4 - ctx->min_padding) * 8;
     ctx->qscale = 1;
     ctx->lambda = 2<<LAMBDA_FRAC_BITS; // qscale 2
     return 0;
@@ -198,6 +207,10 @@ static int dnxhd_encode_init(AVCodecContext *avctx)
     if (dnxhd_init_qmat(ctx, ctx->m.intra_quant_bias, 0) < 0) // XXX tune lbias/cbias
         return -1;
 
+    // Avid Nitris hardware decoder requires a minimum amount of padding in the coding unit payload
+    if (ctx->nitris_compat)
+        ctx->min_padding = 1600;
+
     if (dnxhd_init_vlc(ctx) < 0)
         return -1;
     if (dnxhd_init_rc(ctx) < 0)
@@ -552,7 +565,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
             if (bits > ctx->frame_bits)
                 break;
         }
-        //dprintf(ctx->m.avctx, "lambda %d, up %u, down %u, bits %d, frame %d\n",
+        //av_dlog(ctx->m.avctx, "lambda %d, up %u, down %u, bits %d, frame %d\n",
         //        lambda, last_higher, last_lower, bits, ctx->frame_bits);
         if (end) {
             if (bits > ctx->frame_bits)
@@ -582,7 +595,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
             down_step = 1<<LAMBDA_FRAC_BITS;
         }
     }
-    //dprintf(ctx->m.avctx, "out lambda %d\n", lambda);
+    //av_dlog(ctx->m.avctx, "out lambda %d\n", lambda);
     ctx->lambda = lambda;
     return 0;
 }
@@ -610,7 +623,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx)
             if (bits > ctx->frame_bits)
                 break;
         }
-        //dprintf(ctx->m.avctx, "%d, qscale %d, bits %d, frame %d, higher %d, lower %d\n",
+        //av_dlog(ctx->m.avctx, "%d, qscale %d, bits %d, frame %d, higher %d, lower %d\n",
         //        ctx->m.avctx->frame_number, qscale, bits, ctx->frame_bits, last_higher, last_lower);
         if (bits < ctx->frame_bits) {
             if (qscale == 1)
@@ -640,7 +653,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx)
                 return -1;
         }
     }
-    //dprintf(ctx->m.avctx, "out qscale %d\n", qscale);
+    //av_dlog(ctx->m.avctx, "out qscale %d\n", qscale);
     ctx->qscale = qscale;
     return 0;
 }
@@ -848,7 +861,7 @@ static int dnxhd_encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec dnxhd_encoder = {
+AVCodec ff_dnxhd_encoder = {
     "dnxhd",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DNXHD,
@@ -858,4 +871,5 @@ AVCodec dnxhd_encoder = {
     dnxhd_encode_end,
     .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
+    .priv_class = &class,
 };
diff --git a/ffmpeg-mt/libavcodec/dnxhdenc.h b/ffmpeg-mt/libavcodec/dnxhdenc.h
index eaf33d5..83c0b1c 100644
--- a/ffmpeg-mt/libavcodec/dnxhdenc.h
+++ b/ffmpeg-mt/libavcodec/dnxhdenc.h
@@ -4,20 +4,20 @@
  *
  * VC-3 encoder funded by the British Broadcasting Corporation
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,6 +55,9 @@ typedef struct DNXHDEncContext {
     int interlaced;
     int cur_field;
 
+    int nitris_compat;
+    unsigned min_padding;
+
     DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64];
 
     int      (*qmatrix_c)     [64];
diff --git a/ffmpeg-mt/libavcodec/dpcm.c b/ffmpeg-mt/libavcodec/dpcm.c
index 334f25d..af5bf8a 100644
--- a/ffmpeg-mt/libavcodec/dpcm.c
+++ b/ffmpeg-mt/libavcodec/dpcm.c
@@ -2,20 +2,20 @@
  * Assorted DPCM codecs
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -299,7 +299,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
 }
 
 #define DPCM_DECODER(id, name, long_name_)      \
-AVCodec name ## _decoder = {                    \
+AVCodec ff_ ## name ## _decoder = {             \
     #name,                                      \
     AVMEDIA_TYPE_AUDIO,                         \
     id,                                         \
@@ -309,7 +309,7 @@ AVCodec name ## _decoder = {                    \
     NULL,                                       \
     dpcm_decode_frame,                          \
     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
 
 DPCM_DECODER(CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay");
 DPCM_DECODER(CODEC_ID_ROQ_DPCM, roq_dpcm, "DPCM id RoQ");
diff --git a/ffmpeg-mt/libavcodec/dpx.c b/ffmpeg-mt/libavcodec/dpx.c
index e49c969..36a4a39 100644
--- a/ffmpeg-mt/libavcodec/dpx.c
+++ b/ffmpeg-mt/libavcodec/dpx.c
@@ -2,25 +2,25 @@
  * DPX (.dpx) image decoder
  * Copyright (c) 2009 Jimmy Christensen
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "bytestream.h"
 #include "avcodec.h"
 
@@ -220,7 +220,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec dpx_decoder = {
+AVCodec ff_dpx_decoder = {
     "dpx",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DPX,
diff --git a/ffmpeg-mt/libavcodec/dsicinav.c b/ffmpeg-mt/libavcodec/dsicinav.c
index 4eddaac..643aed9 100644
--- a/ffmpeg-mt/libavcodec/dsicinav.c
+++ b/ffmpeg-mt/libavcodec/dsicinav.c
@@ -2,20 +2,20 @@
  * Delphine Software International CIN Audio/Video Decoders
  * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -343,7 +343,7 @@ static int cinaudio_decode_frame(AVCodecContext *avctx,
 }
 
 
-AVCodec dsicinvideo_decoder = {
+AVCodec ff_dsicinvideo_decoder = {
     "dsicinvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DSICINVIDEO,
@@ -356,7 +356,7 @@ AVCodec dsicinvideo_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"),
 };
 
-AVCodec dsicinaudio_decoder = {
+AVCodec ff_dsicinaudio_decoder = {
     "dsicinaudio",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_DSICINAUDIO,
diff --git a/ffmpeg-mt/libavcodec/dsputil.c b/ffmpeg-mt/libavcodec/dsputil.c
index 2d38975..33fc78a 100644
--- a/ffmpeg-mt/libavcodec/dsputil.c
+++ b/ffmpeg-mt/libavcodec/dsputil.c
@@ -5,20 +5,20 @@
  *
  * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
  * DSP utils
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "simple_idct.h"
@@ -36,7 +36,6 @@
 #include "mathops.h"
 #include "mpegvideo.h"
 #include "config.h"
-#include "lpc.h"
 #include "ac3dec.h"
 #include "vorbis.h"
 #include "png.h"
@@ -223,6 +222,12 @@ static void bswap_buf(uint32_t *dst, const uint32_t *src, int w){
     }
 }
 
+static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len)
+{
+    while (len--)
+        *dst++ = av_bswap16(*src++);
+}
+
 static int sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
 {
     int s, i;
@@ -298,12 +303,6 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w, i
     uint8_t *ptr, *last_line;
     int i;
 
-    last_line = buf + (height - 1) * wrap;
-    for(i=0;i<w;i++) {
-        /* top and bottom */
-        if (sides&EDGE_TOP)    memcpy(buf - (i + 1) * wrap, buf, width);
-        if (sides&EDGE_BOTTOM) memcpy(last_line + (i + 1) * wrap, last_line, width);
-    }
     /* left and right */
     ptr = buf;
     for(i=0;i<height;i++) {
@@ -311,18 +310,16 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w, i
         memset(ptr + width, ptr[width-1], w);
         ptr += wrap;
     }
-    /* corners */
-    for(i=0;i<w;i++) {
-        if (sides&EDGE_TOP) {
-            memset(buf - (i + 1) * wrap - w, buf[0], w); /* top left */
-            memset(buf - (i + 1) * wrap + width, buf[width-1], w); /* top right */
-        }
 
-        if (sides&EDGE_BOTTOM) {
-            memset(last_line + (i + 1) * wrap - w, last_line[0], w); /* top left */
-            memset(last_line + (i + 1) * wrap + width, last_line[width-1], w); /* top right */
-        }
-    }
+    /* top and bottom + corners */
+    buf -= w;
+    last_line = buf + (height - 1) * wrap;
+    if (sides & EDGE_TOP)
+        for(i = 0; i < w; i++)
+            memcpy(buf - (i + 1) * wrap, buf, width + w + w); // top
+    if (sides & EDGE_BOTTOM)
+        for (i = 0; i < w; i++)
+            memcpy(last_line + (i + 1) * wrap, last_line, width + w + w); // bottom
 }
 
 /**
@@ -361,38 +358,45 @@ void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, int blo
     start_x= FFMAX(0, -src_x);
     end_y= FFMIN(block_h, h-src_y);
     end_x= FFMIN(block_w, w-src_x);
+    assert(start_y < end_y && block_h);
+    assert(start_x < end_x && block_w);
 
-    // copy existing part
-    for(y=start_y; y<end_y; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= src[x + y*linesize];
-        }
-    }
+    w    = end_x - start_x;
+    src += start_y*linesize + start_x;
+    buf += start_x;
 
     //top
     for(y=0; y<start_y; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= buf[x + start_y*linesize];
-        }
+        memcpy(buf, src, w);
+        buf += linesize;
+    }
+
+    // copy existing part
+    for(; y<end_y; y++){
+        memcpy(buf, src, w);
+        src += linesize;
+        buf += linesize;
     }
 
     //bottom
-    for(y=end_y; y<block_h; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= buf[x + (end_y-1)*linesize];
-        }
+    src -= linesize;
+    for(; y<block_h; y++){
+        memcpy(buf, src, w);
+        buf += linesize;
     }
 
-    for(y=0; y<block_h; y++){
+    buf -= block_h * linesize + start_x;
+    while (block_h--){
        //left
         for(x=0; x<start_x; x++){
-            buf[x + y*linesize]= buf[start_x + y*linesize];
+            buf[x] = buf[start_x];
         }
 
        //right
         for(x=end_x; x<block_w; x++){
-            buf[x + y*linesize]= buf[end_x - 1 + y*linesize];
+            buf[x] = buf[end_x - 1];
         }
+        buf += linesize;
     }
 }
 
@@ -436,8 +440,8 @@ static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1,
 }
 
 
-static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
-                                 int line_size)
+void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
+                             int line_size)
 {
     int i;
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
@@ -492,9 +496,9 @@ static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels
     }
 }
 
-static void put_signed_pixels_clamped_c(const DCTELEM *block,
-                                        uint8_t *restrict pixels,
-                                        int line_size)
+void ff_put_signed_pixels_clamped_c(const DCTELEM *block,
+                                    uint8_t *restrict pixels,
+                                    int line_size)
 {
     int i, j;
 
@@ -534,8 +538,8 @@ static void put_pixels_nonclamped_c(const DCTELEM *block, uint8_t *restrict pixe
     }
 }
 
-static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
-                          int line_size)
+void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
+                             int line_size)
 {
     int i;
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
@@ -1599,54 +1603,6 @@ H264_CHROMA_MC(avg_       , op_avg)
 #undef op_avg
 #undef op_put
 
-static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
-    const int A=(8-x)*(8-y);
-    const int B=(  x)*(8-y);
-    const int C=(8-x)*(  y);
-    const int D=(  x)*(  y);
-    int i;
-
-    assert(x<8 && y<8 && x>=0 && y>=0);
-
-    for(i=0; i<h; i++)
-    {
-        dst[0] = (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6;
-        dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6;
-        dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6;
-        dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6;
-        dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6;
-        dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6;
-        dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6;
-        dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6;
-        dst+= stride;
-        src+= stride;
-    }
-}
-
-static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
-    const int A=(8-x)*(8-y);
-    const int B=(  x)*(8-y);
-    const int C=(8-x)*(  y);
-    const int D=(  x)*(  y);
-    int i;
-
-    assert(x<8 && y<8 && x>=0 && y>=0);
-
-    for(i=0; i<h; i++)
-    {
-        dst[0] = avg2(dst[0], ((A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6));
-        dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6));
-        dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6));
-        dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6));
-        dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6));
-        dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6));
-        dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6));
-        dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6));
-        dst+= stride;
-        src+= stride;
-    }
-}
-
 #define QPEL_MC(r, OPNAME, RND, OP) \
 static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
@@ -3756,10 +3712,10 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c)
 WRAPPER8_16_SQ(rd8x8_c, rd16_c)
 WRAPPER8_16_SQ(bit8x8_c, bit16_c)
 
-static void vector_fmul_c(float *dst, const float *src, int len){
+static void vector_fmul_c(float *dst, const float *src0, const float *src1, int len){
     int i;
     for(i=0; i<len; i++)
-        dst[i] *= src[i];
+        dst[i] = src0[i] * src1[i];
 }
 
 static void vector_fmul_reverse_c(float *dst, const float *src0, const float *src1, int len){
@@ -3775,7 +3731,9 @@ static void vector_fmul_add_c(float *dst, const float *src0, const float *src1,
         dst[i] = src0[i] * src1[i] + src2[i];
 }
 
-void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){
+static void vector_fmul_window_c(float *dst, const float *src0,
+                                 const float *src1, const float *win, int len)
+{
     int i,j;
     dst += len;
     win += len;
@@ -3785,8 +3743,8 @@ void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, c
         float s1 = src1[j];
         float wi = win[i];
         float wj = win[j];
-        dst[i] = s0*wj - s1*wi + add_bias;
-        dst[j] = s0*wi + s1*wj + add_bias;
+        dst[i] = s0*wj - s1*wi;
+        dst[j] = s0*wi + s1*wj;
     }
 }
 
@@ -3864,12 +3822,6 @@ static float scalarproduct_float_c(const float *v1, const float *v2, int len)
     return p;
 }
 
-static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){
-    int i;
-    for(i=0; i<len; i++)
-        dst[i] = src[i] * mul;
-}
-
 static inline uint32_t clipf_c_one(uint32_t a, uint32_t mini,
                    uint32_t maxi, uint32_t maxisign)
 {
@@ -3915,37 +3867,6 @@ static void vector_clipf_c(float *dst, const float *src, float min, float max, i
     }
 }
 
-static av_always_inline int float_to_int16_one(const float *src){
-    int_fast32_t tmp = *(const int32_t*)src;
-    if(tmp & 0xf0000){
-        tmp = (0x43c0ffff - tmp)>>31;
-        // is this faster on some gcc/cpu combinations?
-//      if(tmp > 0x43c0ffff) tmp = 0xFFFF;
-//      else                 tmp = 0;
-    }
-    return tmp - 0x8000;
-}
-
-void ff_float_to_int16_c(int16_t *dst, const float *src, long len){
-    int i;
-    for(i=0; i<len; i++)
-        dst[i] = float_to_int16_one(src+i);
-}
-
-void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels){
-    int i,j,c;
-    if(channels==2){
-        for(i=0; i<len; i++){
-            dst[2*i]   = float_to_int16_one(src[0]+i);
-            dst[2*i+1] = float_to_int16_one(src[1]+i);
-        }
-    }else{
-        for(c=0; c<channels; c++)
-            for(i=0, j=c; i<len; i++, j+=channels)
-                dst[j] = float_to_int16_one(src[c]+i);
-    }
-}
-
 static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order, int shift)
 {
     int res = 0;
@@ -3966,6 +3887,19 @@ static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2, co
     return res;
 }
 
+static void apply_window_int16_c(int16_t *output, const int16_t *input,
+                                 const int16_t *window, unsigned int len)
+{
+    int i;
+    int len2 = len >> 1;
+
+    for (i = 0; i < len2; i++) {
+        int16_t w       = window[i];
+        output[i]       = (MUL16(input[i],       w) + (1 << 14)) >> 15;
+        output[len-i-1] = (MUL16(input[len-i-1], w) + (1 << 14)) >> 15;
+    }
+}
+
 #define W0 2048
 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
 #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
@@ -4043,22 +3977,22 @@ void ff_wmv2_idct_c(short * block){
 static void ff_wmv2_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block)
 {
     ff_wmv2_idct_c(block);
-    put_pixels_clamped_c(block, dest, line_size);
+    ff_put_pixels_clamped_c(block, dest, line_size);
 }
 static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block)
 {
     ff_wmv2_idct_c(block);
-    add_pixels_clamped_c(block, dest, line_size);
+    ff_add_pixels_clamped_c(block, dest, line_size);
 }
 static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
 {
     j_rev_dct (block);
-    put_pixels_clamped_c(block, dest, line_size);
+    ff_put_pixels_clamped_c(block, dest, line_size);
 }
 static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
 {
     j_rev_dct (block);
-    add_pixels_clamped_c(block, dest, line_size);
+    ff_add_pixels_clamped_c(block, dest, line_size);
 }
 
 static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block)
@@ -4217,13 +4151,14 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
 
     c->get_pixels = get_pixels_c;
     c->diff_pixels = diff_pixels_c;
-    c->put_pixels_clamped = put_pixels_clamped_c;
-    c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
+    c->put_pixels_clamped = ff_put_pixels_clamped_c;
+    c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c;
     c->put_pixels_nonclamped = put_pixels_nonclamped_c;
-    c->add_pixels_clamped = add_pixels_clamped_c;
+    c->add_pixels_clamped = ff_add_pixels_clamped_c;
     c->add_pixels8 = add_pixels8_c;
     c->add_pixels4 = add_pixels4_c;
     c->sum_abs_dctelem = sum_abs_dctelem_c;
+    c->emulated_edge_mc = ff_emulated_edge_mc;
     c->gmc1 = gmc1_c;
     c->gmc = ff_gmc_c;
     c->clear_block = clear_block_c;
@@ -4334,17 +4269,12 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
     c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
     c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
     c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
-    c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
-    c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
 
     c->draw_edges = draw_edges_c;
 
 #if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
     ff_mlp_init(c, avctx);
 #endif
-#if CONFIG_VC1_DECODER
-    ff_vc1dsp_init(c,avctx);
-#endif
 #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER
     ff_intrax8dsp_init(c,avctx);
 #endif
@@ -4410,6 +4340,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
     c->add_hfyu_left_prediction  = add_hfyu_left_prediction_c;
     c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c;
     c->bswap_buf= bswap_buf;
+    c->bswap16_buf = bswap16_buf;
 #if CONFIG_PNG_DECODER
     c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
 #endif
@@ -4436,19 +4367,14 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
 #if CONFIG_AC3_DECODER
     c->ac3_downmix = ff_ac3_downmix_c;
 #endif
-#if CONFIG_LPC
-    c->lpc_compute_autocorr = ff_lpc_compute_autocorr;
-#endif
     c->vector_fmul = vector_fmul_c;
     c->vector_fmul_reverse = vector_fmul_reverse_c;
     c->vector_fmul_add = vector_fmul_add_c;
-    c->vector_fmul_window = ff_vector_fmul_window_c;
-    c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
+    c->vector_fmul_window = vector_fmul_window_c;
     c->vector_clipf = vector_clipf_c;
-    c->float_to_int16 = ff_float_to_int16_c;
-    c->float_to_int16_interleave = ff_float_to_int16_interleave_c;
     c->scalarproduct_int16 = scalarproduct_int16_c;
     c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
+    c->apply_window_int16 = apply_window_int16_c;
     c->scalarproduct_float = scalarproduct_float_c;
     c->butterflies_float = butterflies_float_c;
     c->vector_fmul_scalar = vector_fmul_scalar_c;
diff --git a/ffmpeg-mt/libavcodec/dsputil.h b/ffmpeg-mt/libavcodec/dsputil.h
index fbb1dfe..99b3283 100644
--- a/ffmpeg-mt/libavcodec/dsputil.h
+++ b/ffmpeg-mt/libavcodec/dsputil.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -66,14 +66,8 @@ void ff_h264_idct_add8_c(uint8_t **dest, const int *blockoffset, DCTELEM *block,
 
 void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul);
 void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp);
-void ff_chroma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul);
 void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
 
-void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1,
-                             const float *win, float add_bias, int len);
-void ff_float_to_int16_c(int16_t *dst, const float *src, long len);
-void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels);
-
 /* encoding scans */
 extern const uint8_t ff_alternate_horizontal_scan[64];
 extern const uint8_t ff_alternate_vertical_scan[64];
@@ -128,7 +122,7 @@ void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
 /* minimum alignment rules ;)
 If you notice errors in the align stuff, need more alignment for some ASM code
 for some CPU or need to use a function with less aligned data then send a mail
-to the ffmpeg-devel mailing list, ...
+to the libav-devel mailing list, ...
 
 !warning These alignments might not match reality, (missing attribute((align))
 stuff somewhere possible).
@@ -204,6 +198,10 @@ void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize,
                          int block_w, int block_h,
                          int src_x, int src_y, int w, int h);
 
+void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
+void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
+void ff_put_signed_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
+
 /**
  * DSPContext.
  */
@@ -219,6 +217,21 @@ typedef struct DSPContext {
     void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size);
     int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/);
     /**
+     * Motion estimation with emulated edge values.
+     * @param buf pointer to destination buffer (unaligned)
+     * @param src pointer to pixel source (unaligned)
+     * @param linesize width (in pixels) for src/buf
+     * @param block_w number of pixels (per row) to copy to buf
+     * @param block_h nummber of pixel rows to copy to buf
+     * @param src_x offset of src to start of row - this may be negative
+     * @param src_y offset of src to top of image - this may be negative
+     * @param w width of src in pixels
+     * @param h height of src in pixels
+     */
+    void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize,
+                             int block_w, int block_h,
+                             int src_x, int src_y, int w, int h);
+    /**
      * translational global motion compensation.
      */
     void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder);
@@ -332,9 +345,6 @@ typedef struct DSPContext {
      */
     h264_chroma_mc_func put_h264_chroma_pixels_tab[3];
     h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
-    /* This is really one func used in VC-1 decoding */
-    h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3];
-    h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3];
 
     qpel_mc_func put_h264_qpel_pixels_tab[4][16];
     qpel_mc_func avg_h264_qpel_pixels_tab[4][16];
@@ -359,6 +369,7 @@ typedef struct DSPContext {
     /* this might write to dst[w] */
     void (*add_png_paeth_prediction)(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp);
     void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
+    void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
 
     void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
     void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
@@ -375,17 +386,14 @@ typedef struct DSPContext {
     /* assume len is a multiple of 4, and arrays are 16-byte aligned */
     void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
     void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
-    /* no alignment needed */
-    void (*lpc_compute_autocorr)(const int32_t *data, int len, int lag, double *autoc);
     /* assume len is a multiple of 8, and arrays are 16-byte aligned */
-    void (*vector_fmul)(float *dst, const float *src, int len);
+    void (*vector_fmul)(float *dst, const float *src0, const float *src1, int len);
     void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len);
     /* assume len is a multiple of 8, and src arrays are 16-byte aligned */
     void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len);
     /* assume len is a multiple of 4, and arrays are 16-byte aligned */
-    void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len);
+    void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len);
     /* assume len is a multiple of 8, and arrays are 16-byte aligned */
-    void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len);
     void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
     /**
      * Multiply a vector of floats by a scalar float.  Source and
@@ -438,11 +446,6 @@ typedef struct DSPContext {
      */
     void (*butterflies_float)(float *restrict v1, float *restrict v2, int len);
 
-    /* C version: convert floats from the range [384.0,386.0] to ints in [-32768,32767]
-     * simd versions: convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */
-    void (*float_to_int16)(int16_t *dst, const float *src, long len);
-    void (*float_to_int16_interleave)(int16_t *dst, const float **src, long len, int channels);
-
     /* (I)DCT */
     void (*fdct)(DCTELEM *block/* align 16*/);
     void (*fdct248)(DCTELEM *block/* align 16*/);
@@ -504,29 +507,6 @@ typedef struct DSPContext {
                                unsigned int filter_shift, int32_t mask, int blocksize,
                                int32_t *sample_buffer);
 
-    /* vc1 functions */
-    void (*vc1_inv_trans_8x8)(DCTELEM *b);
-    void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_v_overlap)(uint8_t* src, int stride);
-    void (*vc1_h_overlap)(uint8_t* src, int stride);
-    void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq);
-    void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq);
-    void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq);
-    void (*vc1_h_loop_filter8)(uint8_t *src, int stride, int pq);
-    void (*vc1_v_loop_filter16)(uint8_t *src, int stride, int pq);
-    void (*vc1_h_loop_filter16)(uint8_t *src, int stride, int pq);
-    /* put 8x8 block with bicubic interpolation and quarterpel precision
-     * last argument is actually round value instead of height
-     */
-    op_pixels_func put_vc1_mspel_pixels_tab[16];
-    op_pixels_func avg_vc1_mspel_pixels_tab[16];
-
     /* intrax8 functions */
     void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
     void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
@@ -546,6 +526,20 @@ typedef struct DSPContext {
      */
     int32_t (*scalarproduct_and_madd_int16)(int16_t *v1/*align 16*/, const int16_t *v2, const int16_t *v3, int len, int mul);
 
+    /**
+     * Apply symmetric window in 16-bit fixed-point.
+     * @param output destination array
+     *               constraints: 16-byte aligned
+     * @param input  source array
+     *               constraints: 16-byte aligned
+     * @param window window array
+     *               constraints: 16-byte aligned, at least len/2 elements
+     * @param len    full window length
+     *               constraints: multiple of ? greater than zero
+     */
+    void (*apply_window_int16)(int16_t *output, const int16_t *input,
+                               const int16_t *window, unsigned int len);
+
     /* rv30 functions */
     qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
     qpel_mc_func avg_rv30_tpel_pixels_tab[4][16];
@@ -630,7 +624,6 @@ void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
 void ff_dsputil_init_dwt(DSPContext *c);
 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx);
 void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx);
 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx);
 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
@@ -666,20 +659,24 @@ static inline void emms(void)
 #   define STRIDE_ALIGN 8
 #endif
 
-#define LOCAL_ALIGNED(a, t, v, s, ...)                          \
-    uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)];              \
-    t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a)
+#define LOCAL_ALIGNED_A(a, t, v, s, o, ...)             \
+    uint8_t la_##v[sizeof(t s o) + (a)];                \
+    t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
+
+#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o
+
+#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)
 
 #if HAVE_LOCAL_ALIGNED_8
-#   define LOCAL_ALIGNED_8(t, v, s, ...) DECLARE_ALIGNED(8, t, v) s __VA_ARGS__
+#   define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)
 #else
-#   define LOCAL_ALIGNED_8(t, v, s, ...) LOCAL_ALIGNED(8, t, v, s, __VA_ARGS__)
+#   define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
 #endif
 
 #if HAVE_LOCAL_ALIGNED_16
-#   define LOCAL_ALIGNED_16(t, v, s, ...) DECLARE_ALIGNED(16, t, v) s __VA_ARGS__
+#   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)
 #else
-#   define LOCAL_ALIGNED_16(t, v, s, ...) LOCAL_ALIGNED(16, t, v, s, __VA_ARGS__)
+#   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
 #endif
 
 /* PSNR */
diff --git a/ffmpeg-mt/libavcodec/dump_extradata_bsf.c b/ffmpeg-mt/libavcodec/dump_extradata_bsf.c
index db26349..ba77b15 100644
--- a/ffmpeg-mt/libavcodec/dump_extradata_bsf.c
+++ b/ffmpeg-mt/libavcodec/dump_extradata_bsf.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -43,7 +43,7 @@ static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx,
     return 0;
 }
 
-AVBitStreamFilter dump_extradata_bsf={
+AVBitStreamFilter ff_dump_extradata_bsf={
     "dump_extra",
     0,
     dump_extradata,
diff --git a/ffmpeg-mt/libavcodec/dv.c b/ffmpeg-mt/libavcodec/dv.c
index 564ccb3..e4f06a7 100644
--- a/ffmpeg-mt/libavcodec/dv.c
+++ b/ffmpeg-mt/libavcodec/dv.c
@@ -16,20 +16,20 @@
  * Many thanks to Dan Dennedy <dan at dennedy.org> for providing wealth
  * of DV technical info.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1290,7 +1290,7 @@ static int dvvideo_close(AVCodecContext *c)
 
 
 #if CONFIG_DVVIDEO_ENCODER
-AVCodec dvvideo_encoder = {
+AVCodec ff_dvvideo_encoder = {
     "dvvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DVVIDEO,
@@ -1303,7 +1303,7 @@ AVCodec dvvideo_encoder = {
 #endif // CONFIG_DVVIDEO_ENCODER
 
 #if CONFIG_DVVIDEO_DECODER
-AVCodec dvvideo_decoder = {
+AVCodec ff_dvvideo_decoder = {
     "dvvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DVVIDEO,
diff --git a/ffmpeg-mt/libavcodec/dv_tablegen.c b/ffmpeg-mt/libavcodec/dv_tablegen.c
index 5d3793e..f463550 100644
--- a/ffmpeg-mt/libavcodec/dv_tablegen.c
+++ b/ffmpeg-mt/libavcodec/dv_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dv_tablegen.h b/ffmpeg-mt/libavcodec/dv_tablegen.h
index 47e8c36..0810f8e 100644
--- a/ffmpeg-mt/libavcodec/dv_tablegen.h
+++ b/ffmpeg-mt/libavcodec/dv_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dv_vlc_data.h b/ffmpeg-mt/libavcodec/dv_vlc_data.h
index c23c564..b5c1dde 100644
--- a/ffmpeg-mt/libavcodec/dv_vlc_data.h
+++ b/ffmpeg-mt/libavcodec/dv_vlc_data.h
@@ -2,20 +2,20 @@
  * VLC constants for DV codec
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dvbsub.c b/ffmpeg-mt/libavcodec/dvbsub.c
index ea55cae..206e50e 100644
--- a/ffmpeg-mt/libavcodec/dvbsub.c
+++ b/ffmpeg-mt/libavcodec/dvbsub.c
@@ -2,20 +2,20 @@
  * DVB subtitle encoding for ffmpeg
  * Copyright (c) 2005 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -223,7 +223,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s,
     else
         page_state = 2; /* mode change */
     /* page_version = 0 + page_state */
-    *q++ = s->object_version | (page_state << 2) | 3;
+    *q++ = (s->object_version << 4) | (page_state << 2) | 3;
 
     for (region_id = 0; region_id < h->num_rects; region_id++) {
         *q++ = region_id;
@@ -402,7 +402,7 @@ static int dvbsub_encode(AVCodecContext *avctx,
     return ret;
 }
 
-AVCodec dvbsub_encoder = {
+AVCodec ff_dvbsub_encoder = {
     "dvbsub",
     AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_DVB_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/dvbsub_parser.c b/ffmpeg-mt/libavcodec/dvbsub_parser.c
index c9ccfd0..b54aac6 100644
--- a/ffmpeg-mt/libavcodec/dvbsub_parser.c
+++ b/ffmpeg-mt/libavcodec/dvbsub_parser.c
@@ -1,21 +1,21 @@
 /*
- * DVB subtitle parser for FFmpeg
+ * DVB subtitle parser for Libav
  * Copyright (c) 2005 Ian Caulfield
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -55,7 +55,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
     uint8_t *p, *p_end;
     int len, buf_pos = 0;
 
-    dprintf(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n",
+    av_dlog(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n",
             s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]);
 
 #ifdef DEBUG_PACKET_CONTENTS
@@ -82,7 +82,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
     {
         if (pc->packet_index != pc->packet_start)
         {
-            dprintf(avctx, "Discarding %d bytes\n",
+            av_dlog(avctx, "Discarding %d bytes\n",
                     pc->packet_index - pc->packet_start);
         }
 
@@ -90,7 +90,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
         pc->packet_index = 0;
 
         if (buf_size < 2 || buf[0] != 0x20 || buf[1] != 0x00) {
-            dprintf(avctx, "Bad packet header\n");
+            av_dlog(avctx, "Bad packet header\n");
             return -1;
         }
 
@@ -147,7 +147,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
         } else if (*p == 0xff) {
             if (p + 1 < p_end)
             {
-                dprintf(avctx, "Junk at end of packet\n");
+                av_dlog(avctx, "Junk at end of packet\n");
             }
             pc->packet_index = p - pc->packet_buf;
             pc->in_packet = 0;
@@ -179,7 +179,7 @@ static av_cold void dvbsub_parse_close(AVCodecParserContext *s)
     av_freep(&pc->packet_buf);
 }
 
-AVCodecParser dvbsub_parser = {
+AVCodecParser ff_dvbsub_parser = {
     { CODEC_ID_DVB_SUBTITLE },
     sizeof(DVBSubParseContext),
     dvbsub_parse_init,
diff --git a/ffmpeg-mt/libavcodec/dvbsubdec.c b/ffmpeg-mt/libavcodec/dvbsubdec.c
index 3e06260..2c27f6b 100644
--- a/ffmpeg-mt/libavcodec/dvbsubdec.c
+++ b/ffmpeg-mt/libavcodec/dvbsubdec.c
@@ -2,20 +2,20 @@
  * DVB subtitle decoding for ffmpeg
  * Copyright (c) 2005 Ian Caulfield
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -332,9 +332,7 @@ static void delete_state(DVBSubContext *ctx)
         ctx->region_list = region->next;
 
         delete_region_display_list(ctx, region);
-        if (region->pbuf)
-            av_free(region->pbuf);
-
+        av_free(region->pbuf);
         av_free(region);
     }
 
@@ -749,7 +747,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
                          0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
     uint8_t *map_table;
 
-    dprintf(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
+    av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
             top_bottom ? "bottom" : "top");
 
 #ifdef DEBUG_PACKET_CONTENTS
@@ -794,7 +792,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
                 map_table = NULL;
 
             x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos,
-                                                region->width - x_pos, &buf, buf_size,
+                                                region->width - x_pos, &buf, buf_end - buf,
                                                 non_mod, map_table);
             break;
         case 0x11:
@@ -809,7 +807,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
                 map_table = NULL;
 
             x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos,
-                                                region->width - x_pos, &buf, buf_size,
+                                                region->width - x_pos, &buf, buf_end - buf,
                                                 non_mod, map_table);
             break;
         case 0x12:
@@ -819,7 +817,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
             }
 
             x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos,
-                                                region->width - x_pos, &buf, buf_size,
+                                                region->width - x_pos, &buf, buf_end - buf,
                                                 non_mod, NULL);
             break;
 
@@ -984,7 +982,7 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
         YUV_TO_RGB1_CCIR(cb, cr);
         YUV_TO_RGB2_CCIR(r, g, b, y);
 
-        dprintf(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
+        av_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
 
         if (depth & 0x80)
             clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
@@ -1032,8 +1030,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
     buf += 2;
 
     if (region->width * region->height != region->buf_size) {
-        if (region->pbuf)
-            av_free(region->pbuf);
+        av_free(region->pbuf);
 
         region->buf_size = region->width * region->height;
 
@@ -1060,11 +1057,11 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
             region->bgcolor = (((*buf++) >> 2) & 3);
     }
 
-    dprintf(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
+    av_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
 
     if (fill) {
         memset(region->pbuf, region->bgcolor, region->buf_size);
-        dprintf(avctx, "Fill region (%d)\n", region->bgcolor);
+        av_dlog(avctx, "Fill region (%d)\n", region->bgcolor);
     }
 
     delete_region_display_list(ctx, region);
@@ -1125,7 +1122,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
     ctx->time_out = *buf++;
     page_state = ((*buf++) >> 2) & 3;
 
-    dprintf(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
+    av_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
 
     if (page_state == 2) {
         delete_state(ctx);
@@ -1163,7 +1160,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
         ctx->display_list = display;
         ctx->display_list_size++;
 
-        dprintf(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos);
+        av_dlog(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos);
     }
 
     while (tmp_display_list) {
@@ -1426,13 +1423,15 @@ static int dvbsub_decode(AVCodecContext *avctx,
 
 #endif
 
-    if (buf_size <= 2)
+    if (buf_size <= 6 || *buf != 0x0f) {
+        av_dlog(avctx, "incomplete or broken packet");
         return -1;
+    }
 
     p = buf;
     p_end = buf + buf_size;
 
-    while (p < p_end && *p == 0x0f) {
+    while (p_end - p >= 6 && *p == 0x0f) {
         p += 1;
         segment_type = *p++;
         page_id = AV_RB16(p);
@@ -1440,6 +1439,11 @@ static int dvbsub_decode(AVCodecContext *avctx,
         segment_length = AV_RB16(p);
         p += 2;
 
+        if (p_end - p < segment_length) {
+            av_dlog(avctx, "incomplete or broken packet");
+            return -1;
+        }
+
         if (page_id == ctx->composition_id || page_id == ctx->ancillary_id ||
             ctx->composition_id == -1 || ctx->ancillary_id == -1) {
             switch (segment_type) {
@@ -1461,7 +1465,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
                 *data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub);
                 break;
             default:
-                dprintf(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
+                av_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
                         segment_type, page_id, segment_length);
                 break;
             }
@@ -1470,16 +1474,11 @@ static int dvbsub_decode(AVCodecContext *avctx,
         p += segment_length;
     }
 
-    if (p != p_end) {
-        dprintf(avctx, "Junk at end of packet\n");
-        return -1;
-    }
-
-    return buf_size;
+    return p - buf;
 }
 
 
-AVCodec dvbsub_decoder = {
+AVCodec ff_dvbsub_decoder = {
     "dvbsub",
     AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_DVB_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/dvdata.c b/ffmpeg-mt/libavcodec/dvdata.c
index 05993d8..a80d2da 100644
--- a/ffmpeg-mt/libavcodec/dvdata.c
+++ b/ffmpeg-mt/libavcodec/dvdata.c
@@ -2,20 +2,20 @@
  * Constants for DV codec
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dvdata.h b/ffmpeg-mt/libavcodec/dvdata.h
index 90f4059..817b506 100644
--- a/ffmpeg-mt/libavcodec/dvdata.h
+++ b/ffmpeg-mt/libavcodec/dvdata.h
@@ -2,20 +2,20 @@
  * Constants for DV codec
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dvdsub_parser.c b/ffmpeg-mt/libavcodec/dvdsub_parser.c
index 8f1b8d0..5b07de6 100644
--- a/ffmpeg-mt/libavcodec/dvdsub_parser.c
+++ b/ffmpeg-mt/libavcodec/dvdsub_parser.c
@@ -2,20 +2,20 @@
  * DVD subtitle decoding for ffmpeg
  * Copyright (c) 2005 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -76,7 +76,7 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
     av_freep(&pc->packet);
 }
 
-AVCodecParser dvdsub_parser = {
+AVCodecParser ff_dvdsub_parser = {
     { CODEC_ID_DVD_SUBTITLE },
     sizeof(DVDSubParseContext),
     dvdsub_parse_init,
diff --git a/ffmpeg-mt/libavcodec/dvdsubdec.c b/ffmpeg-mt/libavcodec/dvdsubdec.c
index ea7467f..87eb53b 100644
--- a/ffmpeg-mt/libavcodec/dvdsubdec.c
+++ b/ffmpeg-mt/libavcodec/dvdsubdec.c
@@ -2,20 +2,20 @@
  * DVD subtitle decoding for ffmpeg
  * Copyright (c) 2005 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -190,7 +190,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
     while (cmd_pos > 0 && cmd_pos < buf_size - 2 - offset_size) {
         date = AV_RB16(buf + cmd_pos);
         next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2);
-        dprintf(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n",
+        av_dlog(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n",
                 cmd_pos, next_cmd_pos, date);
         pos = cmd_pos + 2 + offset_size;
         offset1 = -1;
@@ -198,7 +198,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
         x1 = y1 = x2 = y2 = 0;
         while (pos < buf_size) {
             cmd = buf[pos++];
-            dprintf(NULL, "cmd=%02x\n", cmd);
+            av_dlog(NULL, "cmd=%02x\n", cmd);
             switch(cmd) {
             case 0x00:
                 /* menu subpicture */
@@ -231,7 +231,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
                 alpha[1] = buf[pos + 1] >> 4;
                 alpha[0] = buf[pos + 1] & 0x0f;
                 pos += 2;
-            dprintf(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
+            av_dlog(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
                 break;
             case 0x05:
             case 0x85:
@@ -243,7 +243,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
                 y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5];
                 if (cmd & 0x80)
                     is_8bit = 1;
-                dprintf(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2);
+                av_dlog(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2);
                 pos += 6;
                 break;
             case 0x06:
@@ -251,7 +251,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
                     goto fail;
                 offset1 = AV_RB16(buf + pos);
                 offset2 = AV_RB16(buf + pos + 2);
-                dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
+                av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
                 pos += 4;
                 break;
             case 0x86:
@@ -259,7 +259,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
                     goto fail;
                 offset1 = AV_RB32(buf + pos);
                 offset2 = AV_RB32(buf + pos + 4);
-                dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
+                av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
                 pos += 8;
                 break;
 
@@ -282,7 +282,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
             case 0xff:
                 goto the_end;
             default:
-                dprintf(NULL, "unrecognised subpicture command 0x%x\n", cmd);
+                av_dlog(NULL, "unrecognised subpicture command 0x%x\n", cmd);
                 goto the_end;
             }
         }
@@ -475,7 +475,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
         goto no_subtitle;
 
 #if defined(DEBUG)
-    dprintf(NULL, "start=%d ms end =%d ms\n",
+    av_dlog(NULL, "start=%d ms end =%d ms\n",
             sub->start_display_time,
             sub->end_display_time);
     ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0],
@@ -486,7 +486,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
     return buf_size;
 }
 
-AVCodec dvdsub_decoder = {
+AVCodec ff_dvdsub_decoder = {
     "dvdsub",
     AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_DVD_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/dvdsubenc.c b/ffmpeg-mt/libavcodec/dvdsubenc.c
index 4ee0f37..71c5e79 100644
--- a/ffmpeg-mt/libavcodec/dvdsubenc.c
+++ b/ffmpeg-mt/libavcodec/dvdsubenc.c
@@ -2,20 +2,20 @@
  * DVD subtitle encoding for ffmpeg
  * Copyright (c) 2005 Wolfram Gloger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -215,7 +215,7 @@ static int dvdsub_encode(AVCodecContext *avctx,
     return ret;
 }
 
-AVCodec dvdsub_encoder = {
+AVCodec ff_dvdsub_encoder = {
     "dvdsub",
     AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_DVD_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/dwt.c b/ffmpeg-mt/libavcodec/dwt.c
index 2ecb04a..2c5b56c 100644
--- a/ffmpeg-mt/libavcodec/dwt.c
+++ b/ffmpeg-mt/libavcodec/dwt.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2004-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -697,7 +697,7 @@ void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffe
     }
 }
 
-void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
+static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
     int level;
     for(level=decomposition_count-1; level>=0; level--){
         switch(type){
@@ -707,7 +707,7 @@ void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int heigh
     }
 }
 
-void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){
+static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){
     const int support = type==1 ? 3 : 5;
     int level;
     if(type==2) return;
diff --git a/ffmpeg-mt/libavcodec/dwt.h b/ffmpeg-mt/libavcodec/dwt.h
index 8c3aa20..fc73fe7 100644
--- a/ffmpeg-mt/libavcodec/dwt.h
+++ b/ffmpeg-mt/libavcodec/dwt.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2004-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -146,8 +146,6 @@ void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type, in
 
 void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count);
 void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y);
-void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count);
-void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y);
 void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count);
 
 void ff_dwt_init(DWTContext *c);
diff --git a/ffmpeg-mt/libavcodec/dxa.c b/ffmpeg-mt/libavcodec/dxa.c
index 62e4e0a..35fd443 100644
--- a/ffmpeg-mt/libavcodec/dxa.c
+++ b/ffmpeg-mt/libavcodec/dxa.c
@@ -2,20 +2,20 @@
  * Feeble Files/ScummVM DXA decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -317,7 +317,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec dxa_decoder = {
+AVCodec ff_dxa_decoder = {
     "dxa",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DXA,
diff --git a/ffmpeg-mt/libavcodec/dxva2.c b/ffmpeg-mt/libavcodec/dxva2.c
index 3f14311..25b021a 100644
--- a/ffmpeg-mt/libavcodec/dxva2.c
+++ b/ffmpeg-mt/libavcodec/dxva2.c
@@ -3,20 +3,20 @@
  *
  * copyright (c) 2010 Laurent Aimar
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/dxva2.h b/ffmpeg-mt/libavcodec/dxva2.h
index 5c5fe21..6f08a84 100644
--- a/ffmpeg-mt/libavcodec/dxva2.h
+++ b/ffmpeg-mt/libavcodec/dxva2.h
@@ -3,20 +3,20 @@
  *
  * copyright (c) 2009 Laurent Aimar
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,7 +29,7 @@
 
 /**
  * This structure is used to provides the necessary configurations and data
- * to the DXVA2 FFmpeg HWAccel implementation.
+ * to the DXVA2 Libav HWAccel implementation.
  *
  * The application must make it available as AVCodecContext.hwaccel_context.
  */
diff --git a/ffmpeg-mt/libavcodec/dxva2_h264.c b/ffmpeg-mt/libavcodec/dxva2_h264.c
index bdb42df..f9dc720 100644
--- a/ffmpeg-mt/libavcodec/dxva2_h264.c
+++ b/ffmpeg-mt/libavcodec/dxva2_h264.c
@@ -3,20 +3,20 @@
  *
  * copyright (c) 2009 Laurent Aimar
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -423,7 +423,7 @@ static int end_frame(AVCodecContext *avctx)
                                      commit_bitstream_and_slice_buffer);
 }
 
-AVHWAccel h264_dxva2_hwaccel = {
+AVHWAccel ff_h264_dxva2_hwaccel = {
     .name           = "h264_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_H264,
diff --git a/ffmpeg-mt/libavcodec/dxva2_internal.h b/ffmpeg-mt/libavcodec/dxva2_internal.h
index a9be7a0..57fc7bd 100644
--- a/ffmpeg-mt/libavcodec/dxva2_internal.h
+++ b/ffmpeg-mt/libavcodec/dxva2_internal.h
@@ -3,26 +3,28 @@
  *
  * copyright (c) 2010 Laurent Aimar
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef AVCODEC_DXVA_INTERNAL_H
 #define AVCODEC_DXVA_INTERNAL_H
 
+#define _WIN32_WINNT 0x0600
+#define COBJMACROS
 #include "dxva2.h"
 #include "avcodec.h"
 #include "mpegvideo.h"
diff --git a/ffmpeg-mt/libavcodec/dxva2_mpeg2.c b/ffmpeg-mt/libavcodec/dxva2_mpeg2.c
index 3b75dae..6868e39 100644
--- a/ffmpeg-mt/libavcodec/dxva2_mpeg2.c
+++ b/ffmpeg-mt/libavcodec/dxva2_mpeg2.c
@@ -3,20 +3,20 @@
  *
  * copyright (c) 2010 Laurent Aimar
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -260,7 +260,7 @@ static int end_frame(AVCodecContext *avctx)
                                      commit_bitstream_and_slice_buffer);
 }
 
-AVHWAccel mpeg2_dxva2_hwaccel = {
+AVHWAccel ff_mpeg2_dxva2_hwaccel = {
     .name           = "mpeg2_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_MPEG2VIDEO,
diff --git a/ffmpeg-mt/libavcodec/dxva2_vc1.c b/ffmpeg-mt/libavcodec/dxva2_vc1.c
index a111213..8bc84a8 100644
--- a/ffmpeg-mt/libavcodec/dxva2_vc1.c
+++ b/ffmpeg-mt/libavcodec/dxva2_vc1.c
@@ -3,20 +3,20 @@
  *
  * copyright (c) 2010 Laurent Aimar
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -264,7 +264,7 @@ static int end_frame(AVCodecContext *avctx)
 }
 
 #if CONFIG_WMV3_DXVA2_HWACCEL
-AVHWAccel wmv3_dxva2_hwaccel = {
+AVHWAccel ff_wmv3_dxva2_hwaccel = {
     .name           = "wmv3_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_WMV3,
@@ -277,7 +277,7 @@ AVHWAccel wmv3_dxva2_hwaccel = {
 };
 #endif
 
-AVHWAccel vc1_dxva2_hwaccel = {
+AVHWAccel ff_vc1_dxva2_hwaccel = {
     .name           = "vc1_dxva2",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_VC1,
diff --git a/ffmpeg-mt/libavcodec/eac3dec.c b/ffmpeg-mt/libavcodec/eac3dec.c
index 52d15c8..5400768 100644
--- a/ffmpeg-mt/libavcodec/eac3dec.c
+++ b/ffmpeg-mt/libavcodec/eac3dec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
  * Copyright (c) 2008 Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -410,7 +410,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
 
     /* informational metadata */
     if (get_bits1(gbc)) {
-        skip_bits(gbc, 3); // skip bit stream mode
+        s->bitstream_mode = get_bits(gbc, 3);
         skip_bits(gbc, 2); // skip copyright bit and original bitstream bit
         if (s->channel_mode == AC3_CHMODE_STEREO) {
             skip_bits(gbc, 4); // skip Dolby surround and headphone mode
diff --git a/ffmpeg-mt/libavcodec/eac3dec_data.c b/ffmpeg-mt/libavcodec/eac3dec_data.c
index 031702e..4cea26f 100644
--- a/ffmpeg-mt/libavcodec/eac3dec_data.c
+++ b/ffmpeg-mt/libavcodec/eac3dec_data.c
@@ -2,20 +2,20 @@
  * E-AC-3 decoder tables
  * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/eac3dec_data.h b/ffmpeg-mt/libavcodec/eac3dec_data.h
index 1331833..91892a3 100644
--- a/ffmpeg-mt/libavcodec/eac3dec_data.h
+++ b/ffmpeg-mt/libavcodec/eac3dec_data.h
@@ -2,20 +2,20 @@
  * E-AC-3 decoder tables
  * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/eacmv.c b/ffmpeg-mt/libavcodec/eacmv.c
index 4a2d7c0..d5e0f45 100644
--- a/ffmpeg-mt/libavcodec/eacmv.c
+++ b/ffmpeg-mt/libavcodec/eacmv.c
@@ -2,20 +2,20 @@
  * Electronic Arts CMV Video Decoder
  * Copyright (c) 2007-2008 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
@@ -29,7 +29,7 @@
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 
 typedef struct CmvContext {
@@ -205,7 +205,7 @@ static av_cold int cmv_decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec eacmv_decoder = {
+AVCodec ff_eacmv_decoder = {
     "eacmv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_CMV,
diff --git a/ffmpeg-mt/libavcodec/eaidct.c b/ffmpeg-mt/libavcodec/eaidct.c
index 9972e42..9d829c4 100644
--- a/ffmpeg-mt/libavcodec/eaidct.c
+++ b/ffmpeg-mt/libavcodec/eaidct.c
@@ -2,20 +2,20 @@
  * Electronic Arts TGQ/TQI/MAD IDCT algorithm
  * Copyright (c) 2007-2008 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/eamad.c b/ffmpeg-mt/libavcodec/eamad.c
index db92d6b..db22781 100644
--- a/ffmpeg-mt/libavcodec/eamad.c
+++ b/ffmpeg-mt/libavcodec/eamad.c
@@ -2,20 +2,20 @@
  * Electronic Arts Madcow Video Decoder
  * Copyright (c) 2007-2009 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
@@ -34,7 +34,7 @@
 #include "aandcttab.h"
 #include "mpeg12.h"
 #include "mpeg12data.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 #define EA_PREAMBLE_SIZE    8
 #define MADk_TAG MKTAG('M', 'A', 'D', 'k')    /* MAD i-frame */
@@ -306,7 +306,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec eamad_decoder = {
+AVCodec ff_eamad_decoder = {
     "eamad",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MAD,
diff --git a/ffmpeg-mt/libavcodec/eatgq.c b/ffmpeg-mt/libavcodec/eatgq.c
index 7a98505..6181486 100644
--- a/ffmpeg-mt/libavcodec/eatgq.c
+++ b/ffmpeg-mt/libavcodec/eatgq.c
@@ -2,20 +2,20 @@
  * Electronic Arts TGQ Video Decoder
  * Copyright (c) 2007-2008 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
@@ -243,7 +243,7 @@ static av_cold int tgq_decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec eatgq_decoder = {
+AVCodec ff_eatgq_decoder = {
     "eatgq",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TGQ,
diff --git a/ffmpeg-mt/libavcodec/eatgv.c b/ffmpeg-mt/libavcodec/eatgv.c
index 45c6644..0404f40 100644
--- a/ffmpeg-mt/libavcodec/eatgv.c
+++ b/ffmpeg-mt/libavcodec/eatgv.c
@@ -2,20 +2,20 @@
  * Electronic Arts TGV Video Decoder
  * Copyright (c) 2007-2008 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
@@ -32,7 +32,7 @@
 #define ALT_BITSTREAM_READER_LE
 #include "get_bits.h"
 #include "libavutil/lzo.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 #define EA_PREAMBLE_SIZE    8
 #define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
@@ -334,7 +334,7 @@ static av_cold int tgv_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec eatgv_decoder = {
+AVCodec ff_eatgv_decoder = {
     "eatgv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TGV,
diff --git a/ffmpeg-mt/libavcodec/eatqi.c b/ffmpeg-mt/libavcodec/eatqi.c
index 7f1901d..aa96437 100644
--- a/ffmpeg-mt/libavcodec/eatqi.c
+++ b/ffmpeg-mt/libavcodec/eatqi.c
@@ -2,20 +2,20 @@
  * Electronic Arts TQI Video Decoder
  * Copyright (c) 2007-2009 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
@@ -154,7 +154,7 @@ static av_cold int tqi_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec eatqi_decoder = {
+AVCodec ff_eatqi_decoder = {
     "eatqi",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TQI,
diff --git a/ffmpeg-mt/libavcodec/elbg.c b/ffmpeg-mt/libavcodec/elbg.c
index ede863e..030c3a6 100644
--- a/ffmpeg-mt/libavcodec/elbg.c
+++ b/ffmpeg-mt/libavcodec/elbg.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Vitor Sessak <vitor1001 at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/elbg.h b/ffmpeg-mt/libavcodec/elbg.h
index e6f577e..b8ea489 100644
--- a/ffmpeg-mt/libavcodec/elbg.h
+++ b/ffmpeg-mt/libavcodec/elbg.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Vitor Sessak <vitor1001 at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/error_resilience.c b/ffmpeg-mt/libavcodec/error_resilience.c
index dc015b9..d4d5839 100644
--- a/ffmpeg-mt/libavcodec/error_resilience.c
+++ b/ffmpeg-mt/libavcodec/error_resilience.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/escape124.c b/ffmpeg-mt/libavcodec/escape124.c
index af14e0d..9d216a4 100644
--- a/ffmpeg-mt/libavcodec/escape124.c
+++ b/ffmpeg-mt/libavcodec/escape124.c
@@ -2,20 +2,20 @@
  * Escape 124 Video Decoder
  * Copyright (C) 2008 Eli Friedman (eli.friedman at gmail.com)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -363,7 +363,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
 }
 
 
-AVCodec escape124_decoder = {
+AVCodec ff_escape124_decoder = {
     "escape124",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ESCAPE124,
diff --git a/ffmpeg-mt/libavcodec/faandct.h b/ffmpeg-mt/libavcodec/faandct.h
index f43b62f..da8c0e4 100644
--- a/ffmpeg-mt/libavcodec/faandct.h
+++ b/ffmpeg-mt/libavcodec/faandct.h
@@ -2,20 +2,20 @@
  * Floating point AAN DCT
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/faanidct.c b/ffmpeg-mt/libavcodec/faanidct.c
index dc3d8fb..0b9b458 100644
--- a/ffmpeg-mt/libavcodec/faanidct.c
+++ b/ffmpeg-mt/libavcodec/faanidct.c
@@ -2,20 +2,20 @@
  * Floating point AAN IDCT
  * Copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "faanidct.h"
diff --git a/ffmpeg-mt/libavcodec/faanidct.h b/ffmpeg-mt/libavcodec/faanidct.h
index 4cf1189..f3896f7 100644
--- a/ffmpeg-mt/libavcodec/faanidct.h
+++ b/ffmpeg-mt/libavcodec/faanidct.h
@@ -2,20 +2,20 @@
  * Floating point AAN IDCT
  * Copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/faxcompr.c b/ffmpeg-mt/libavcodec/faxcompr.c
index 34aa576..79e8d75 100644
--- a/ffmpeg-mt/libavcodec/faxcompr.c
+++ b/ffmpeg-mt/libavcodec/faxcompr.c
@@ -2,20 +2,20 @@
  * CCITT Fax Group 3 and 4 decompression
  * Copyright (c) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/faxcompr.h b/ffmpeg-mt/libavcodec/faxcompr.h
index 62f591c..4742d15 100644
--- a/ffmpeg-mt/libavcodec/faxcompr.h
+++ b/ffmpeg-mt/libavcodec/faxcompr.h
@@ -2,20 +2,20 @@
  * CCITT Fax Group 3 and 4 decompression
  * Copyright (c) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/fft-fixed-test.c b/ffmpeg-mt/libavcodec/fft-fixed-test.c
new file mode 100644
index 0000000..63cd194
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/fft-fixed-test.c
@@ -0,0 +1,20 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define CONFIG_FFT_FLOAT 0
+#include "fft-test.c"
diff --git a/ffmpeg-mt/libavcodec/fft-internal.h b/ffmpeg-mt/libavcodec/fft-internal.h
new file mode 100644
index 0000000..d30571b
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/fft-internal.h
@@ -0,0 +1,75 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_FFT_INTERNAL_H
+#define AVCODEC_FFT_INTERNAL_H
+
+#if CONFIG_FFT_FLOAT
+
+#define FIX15(v) (v)
+#define sqrthalf (float)M_SQRT1_2
+
+#define BF(x, y, a, b) do {                     \
+        x = a - b;                              \
+        y = a + b;                              \
+    } while (0)
+
+#define CMUL(dre, dim, are, aim, bre, bim) do { \
+        (dre) = (are) * (bre) - (aim) * (bim);  \
+        (dim) = (are) * (bim) + (aim) * (bre);  \
+    } while (0)
+
+#else
+
+#include "libavutil/intmath.h"
+#include "mathops.h"
+
+void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input);
+
+#define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits)))
+#define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767)
+
+#define sqrthalf ((int16_t)((1<<15)*M_SQRT1_2))
+
+#define BF(x, y, a, b) do {                     \
+        x = (a - b) >> 1;                       \
+        y = (a + b) >> 1;                       \
+    } while (0)
+
+#define CMULS(dre, dim, are, aim, bre, bim, sh) do {            \
+        (dre) = (MUL16(are, bre) - MUL16(aim, bim)) >> sh;      \
+        (dim) = (MUL16(are, bim) + MUL16(aim, bre)) >> sh;      \
+    } while (0)
+
+#define CMUL(dre, dim, are, aim, bre, bim)      \
+    CMULS(dre, dim, are, aim, bre, bim, 15)
+
+#define CMULL(dre, dim, are, aim, bre, bim)     \
+    CMULS(dre, dim, are, aim, bre, bim, 0)
+
+#endif /* CONFIG_FFT_FLOAT */
+
+#define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c)
+#define ff_imdct_half_c FFT_NAME(ff_imdct_half_c)
+#define ff_mdct_calc_c  FFT_NAME(ff_mdct_calc_c)
+
+void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
+void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
+void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
+
+#endif /* AVCODEC_FFT_INTERNAL_H */
diff --git a/ffmpeg-mt/libavcodec/fft-test.c b/ffmpeg-mt/libavcodec/fft-test.c
index 85282f5..0112c6f 100644
--- a/ffmpeg-mt/libavcodec/fft-test.c
+++ b/ffmpeg-mt/libavcodec/fft-test.c
@@ -1,20 +1,20 @@
 /*
  * (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,6 +27,10 @@
 #include "libavutil/lfg.h"
 #include "libavutil/log.h"
 #include "fft.h"
+#if CONFIG_FFT_FLOAT
+#include "dct.h"
+#include "rdft.h"
+#endif
 #include <math.h>
 #include <unistd.h>
 #include <sys/time.h>
@@ -45,7 +49,19 @@
    pim += (MUL16(are, bim) + MUL16(bre, aim));\
 }
 
-FFTComplex *exptab;
+#if CONFIG_FFT_FLOAT
+#   define RANGE 1.0
+#   define REF_SCALE(x, bits)  (x)
+#   define FMT "%10.6f"
+#else
+#   define RANGE 16384
+#   define REF_SCALE(x, bits) ((x) / (1<<(bits)))
+#   define FMT "%6d"
+#endif
+
+struct {
+    float re, im;
+} *exptab;
 
 static void fft_ref_init(int nbits, int inverse)
 {
@@ -53,7 +69,7 @@ static void fft_ref_init(int nbits, int inverse)
     double c1, s1, alpha;
 
     n = 1 << nbits;
-    exptab = av_malloc((n / 2) * sizeof(FFTComplex));
+    exptab = av_malloc((n / 2) * sizeof(*exptab));
 
     for (i = 0; i < (n/2); i++) {
         alpha = 2 * M_PI * (float)i / (float)n;
@@ -90,12 +106,12 @@ static void fft_ref(FFTComplex *tabr, FFTComplex *tab, int nbits)
             CMAC(tmp_re, tmp_im, c, s, q->re, q->im);
             q++;
         }
-        tabr[i].re = tmp_re;
-        tabr[i].im = tmp_im;
+        tabr[i].re = REF_SCALE(tmp_re, nbits);
+        tabr[i].im = REF_SCALE(tmp_im, nbits);
     }
 }
 
-static void imdct_ref(float *out, float *in, int nbits)
+static void imdct_ref(FFTSample *out, FFTSample *in, int nbits)
 {
     int n = 1<<nbits;
     int k, i, a;
@@ -108,12 +124,12 @@ static void imdct_ref(float *out, float *in, int nbits)
             f = cos(M_PI * a / (double)(2 * n));
             sum += f * in[k];
         }
-        out[i] = -sum;
+        out[i] = REF_SCALE(-sum, nbits - 2);
     }
 }
 
 /* NOTE: no normalisation by 1 / N is done */
-static void mdct_ref(float *output, float *input, int nbits)
+static void mdct_ref(FFTSample *output, FFTSample *input, int nbits)
 {
     int n = 1<<nbits;
     int k, i;
@@ -126,10 +142,11 @@ static void mdct_ref(float *output, float *input, int nbits)
             a = (2*M_PI*(2*i+1+n/2)*(2*k+1) / (4 * n));
             s += input[i] * cos(a);
         }
-        output[k] = s;
+        output[k] = REF_SCALE(s, nbits - 1);
     }
 }
 
+#if CONFIG_FFT_FLOAT
 static void idct_ref(float *output, float *input, int nbits)
 {
     int n = 1<<nbits;
@@ -162,11 +179,12 @@ static void dct_ref(float *output, float *input, int nbits)
         output[k] = s;
     }
 }
+#endif
 
 
-static float frandom(AVLFG *prng)
+static FFTSample frandom(AVLFG *prng)
 {
-    return (int16_t)av_lfg_get(prng) / 32768.0;
+    return (int16_t)av_lfg_get(prng) / 32768.0 * RANGE;
 }
 
 static int64_t gettime(void)
@@ -176,7 +194,7 @@ static int64_t gettime(void)
     return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
 }
 
-static int check_diff(float *tab1, float *tab2, int n, double scale)
+static int check_diff(FFTSample *tab1, FFTSample *tab2, int n, double scale)
 {
     int i;
     double max= 0;
@@ -184,9 +202,9 @@ static int check_diff(float *tab1, float *tab2, int n, double scale)
     int err = 0;
 
     for (i = 0; i < n; i++) {
-        double e= fabsf(tab1[i] - (tab2[i] / scale));
+        double e = fabsf(tab1[i] - (tab2[i] / scale)) / RANGE;
         if (e >= 1e-3) {
-            av_log(NULL, AV_LOG_ERROR, "ERROR %5d: %10.6f %10.6f\n",
+            av_log(NULL, AV_LOG_ERROR, "ERROR %5d: "FMT" "FMT"\n",
                    i, tab1[i], tab2[i]);
             err = 1;
         }
@@ -231,8 +249,10 @@ int main(int argc, char **argv)
     int do_inverse = 0;
     FFTContext s1, *s = &s1;
     FFTContext m1, *m = &m1;
+#if CONFIG_FFT_FLOAT
     RDFTContext r1, *r = &r1;
     DCTContext d1, *d = &d1;
+#endif
     int fft_nbits, fft_size, fft_size_2;
     double scale = 1.0;
     AVLFG prng;
@@ -295,6 +315,7 @@ int main(int argc, char **argv)
         ff_fft_init(s, fft_nbits, do_inverse);
         fft_ref_init(fft_nbits, do_inverse);
         break;
+#if CONFIG_FFT_FLOAT
     case TRANSFORM_RDFT:
         if (do_inverse)
             av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
@@ -310,6 +331,10 @@ int main(int argc, char **argv)
             av_log(NULL, AV_LOG_INFO,"DCT_II");
         ff_dct_init(d, fft_nbits, do_inverse ? DCT_III : DCT_II);
         break;
+#endif
+    default:
+        av_log(NULL, AV_LOG_ERROR, "Requested transform not supported\n");
+        return 1;
     }
     av_log(NULL, AV_LOG_INFO," %d test\n", fft_size);
 
@@ -326,25 +351,26 @@ int main(int argc, char **argv)
     switch (transform) {
     case TRANSFORM_MDCT:
         if (do_inverse) {
-            imdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
-            ff_imdct_calc(m, tab2, (float *)tab1);
-            err = check_diff((float *)tab_ref, tab2, fft_size, scale);
+            imdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
+            m->imdct_calc(m, tab2, (FFTSample *)tab1);
+            err = check_diff((FFTSample *)tab_ref, tab2, fft_size, scale);
         } else {
-            mdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
+            mdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
 
-            ff_mdct_calc(m, tab2, (float *)tab1);
+            m->mdct_calc(m, tab2, (FFTSample *)tab1);
 
-            err = check_diff((float *)tab_ref, tab2, fft_size / 2, scale);
+            err = check_diff((FFTSample *)tab_ref, tab2, fft_size / 2, scale);
         }
         break;
     case TRANSFORM_FFT:
         memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
-        ff_fft_permute(s, tab);
-        ff_fft_calc(s, tab);
+        s->fft_permute(s, tab);
+        s->fft_calc(s, tab);
 
         fft_ref(tab_ref, tab1, fft_nbits);
-        err = check_diff((float *)tab_ref, (float *)tab, fft_size * 2, 1.0);
+        err = check_diff((FFTSample *)tab_ref, (FFTSample *)tab, fft_size * 2, 1.0);
         break;
+#if CONFIG_FFT_FLOAT
     case TRANSFORM_RDFT:
         if (do_inverse) {
             tab1[         0].im = 0;
@@ -357,7 +383,7 @@ int main(int argc, char **argv)
             memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
             tab2[1] = tab1[fft_size_2].re;
 
-            ff_rdft_calc(r, tab2);
+            r->rdft_calc(r, tab2);
             fft_ref(tab_ref, tab1, fft_nbits);
             for (i = 0; i < fft_size; i++) {
                 tab[i].re = tab2[i];
@@ -369,7 +395,7 @@ int main(int argc, char **argv)
                 tab2[i]    = tab1[i].re;
                 tab1[i].im = 0;
             }
-            ff_rdft_calc(r, tab2);
+            r->rdft_calc(r, tab2);
             fft_ref(tab_ref, tab1, fft_nbits);
             tab_ref[0].im = tab_ref[fft_size_2].re;
             err = check_diff((float *)tab_ref, (float *)tab2, fft_size, 1.0);
@@ -377,7 +403,7 @@ int main(int argc, char **argv)
         break;
     case TRANSFORM_DCT:
         memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
-        ff_dct_calc(d, tab);
+        d->dct_calc(d, tab);
         if (do_inverse) {
             idct_ref(tab_ref, tab1, fft_nbits);
         } else {
@@ -385,6 +411,7 @@ int main(int argc, char **argv)
         }
         err = check_diff((float *)tab_ref, (float *)tab, fft_size, 1.0);
         break;
+#endif
     }
 
     /* do a speed test */
@@ -402,23 +429,25 @@ int main(int argc, char **argv)
                 switch (transform) {
                 case TRANSFORM_MDCT:
                     if (do_inverse) {
-                        ff_imdct_calc(m, (float *)tab, (float *)tab1);
+                        m->imdct_calc(m, (FFTSample *)tab, (FFTSample *)tab1);
                     } else {
-                        ff_mdct_calc(m, (float *)tab, (float *)tab1);
+                        m->mdct_calc(m, (FFTSample *)tab, (FFTSample *)tab1);
                     }
                     break;
                 case TRANSFORM_FFT:
                     memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
-                    ff_fft_calc(s, tab);
+                    s->fft_calc(s, tab);
                     break;
+#if CONFIG_FFT_FLOAT
                 case TRANSFORM_RDFT:
                     memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
-                    ff_rdft_calc(r, tab2);
+                    r->rdft_calc(r, tab2);
                     break;
                 case TRANSFORM_DCT:
                     memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
-                    ff_dct_calc(d, tab2);
+                    d->dct_calc(d, tab2);
                     break;
+#endif
                 }
             }
             duration = gettime() - time_start;
@@ -439,12 +468,14 @@ int main(int argc, char **argv)
     case TRANSFORM_FFT:
         ff_fft_end(s);
         break;
+#if CONFIG_FFT_FLOAT
     case TRANSFORM_RDFT:
         ff_rdft_end(r);
         break;
     case TRANSFORM_DCT:
         ff_dct_end(d);
         break;
+#endif
     }
 
     av_free(tab);
diff --git a/ffmpeg-mt/libavcodec/fft.c b/ffmpeg-mt/libavcodec/fft.c
index 8176551..077f471 100644
--- a/ffmpeg-mt/libavcodec/fft.c
+++ b/ffmpeg-mt/libavcodec/fft.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2002 Fabrice Bellard
  * Partly based on libdjbfft by D. J. Bernstein
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,6 +30,7 @@
 #include <string.h>
 #include "libavutil/mathematics.h"
 #include "fft.h"
+#include "fft-internal.h"
 
 /* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */
 #if !CONFIG_HARDCODED_TABLES
@@ -47,12 +48,26 @@ COSTABLE(16384);
 COSTABLE(32768);
 COSTABLE(65536);
 #endif
-COSTABLE_CONST FFTSample * const ff_cos_tabs[] = {
+COSTABLE_CONST FFTSample * const FFT_NAME(ff_cos_tabs)[] = {
     NULL, NULL, NULL, NULL,
-    ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024,
-    ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536,
+    FFT_NAME(ff_cos_16),
+    FFT_NAME(ff_cos_32),
+    FFT_NAME(ff_cos_64),
+    FFT_NAME(ff_cos_128),
+    FFT_NAME(ff_cos_256),
+    FFT_NAME(ff_cos_512),
+    FFT_NAME(ff_cos_1024),
+    FFT_NAME(ff_cos_2048),
+    FFT_NAME(ff_cos_4096),
+    FFT_NAME(ff_cos_8192),
+    FFT_NAME(ff_cos_16384),
+    FFT_NAME(ff_cos_32768),
+    FFT_NAME(ff_cos_65536),
 };
 
+static void ff_fft_permute_c(FFTContext *s, FFTComplex *z);
+static void ff_fft_calc_c(FFTContext *s, FFTComplex *z);
+
 static int split_radix_permutation(int i, int n, int inverse)
 {
     int m;
@@ -70,9 +85,9 @@ av_cold void ff_init_ff_cos_tabs(int index)
     int i;
     int m = 1<<index;
     double freq = 2*M_PI/m;
-    FFTSample *tab = ff_cos_tabs[index];
+    FFTSample *tab = FFT_NAME(ff_cos_tabs)[index];
     for(i=0; i<=m/4; i++)
-        tab[i] = cos(i*freq);
+        tab[i] = FIX15(cos(i*freq));
     for(i=1; i<m/4; i++)
         tab[m/2-i] = tab[i];
 #endif
@@ -94,6 +109,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
     if (!s->tmp_buf)
         goto fail;
     s->inverse = inverse;
+    s->fft_permutation = FF_FFT_PERM_DEFAULT;
 
     s->fft_permute = ff_fft_permute_c;
     s->fft_calc    = ff_fft_calc_c;
@@ -103,15 +119,25 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
     s->mdct_calc   = ff_mdct_calc_c;
 #endif
 
+#if CONFIG_FFT_FLOAT
     if (ARCH_ARM)     ff_fft_init_arm(s);
     if (HAVE_ALTIVEC) ff_fft_init_altivec(s);
     if (HAVE_MMX)     ff_fft_init_mmx(s);
+    if (CONFIG_MDCT)  s->mdct_calcw = s->mdct_calc;
+#else
+    if (CONFIG_MDCT)  s->mdct_calcw = ff_mdct_calcw_c;
+    if (ARCH_ARM)     ff_fft_fixed_init_arm(s);
+#endif
 
     for(j=4; j<=nbits; j++) {
         ff_init_ff_cos_tabs(j);
     }
-    for(i=0; i<n; i++)
-        s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = i;
+    for(i=0; i<n; i++) {
+        int j = i;
+        if (s->fft_permutation == FF_FFT_PERM_SWAP_LSBS)
+            j = (j&~3) | ((j>>1)&1) | ((j<<1)&2);
+        s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = j;
+    }
 
     return 0;
  fail:
@@ -120,7 +146,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
     return -1;
 }
 
-void ff_fft_permute_c(FFTContext *s, FFTComplex *z)
+static void ff_fft_permute_c(FFTContext *s, FFTComplex *z)
 {
     int j, np;
     const uint16_t *revtab = s->revtab;
@@ -136,13 +162,6 @@ av_cold void ff_fft_end(FFTContext *s)
     av_freep(&s->tmp_buf);
 }
 
-#define sqrthalf (float)M_SQRT1_2
-
-#define BF(x,y,a,b) {\
-    x = a - b;\
-    y = a + b;\
-}
-
 #define BUTTERFLIES(a0,a1,a2,a3) {\
     BF(t3, t5, t5, t1);\
     BF(a2.re, a0.re, a0.re, t5);\
@@ -166,10 +185,8 @@ av_cold void ff_fft_end(FFTContext *s)
 }
 
 #define TRANSFORM(a0,a1,a2,a3,wre,wim) {\
-    t1 = a2.re * wre + a2.im * wim;\
-    t2 = a2.im * wre - a2.re * wim;\
-    t5 = a3.re * wre - a3.im * wim;\
-    t6 = a3.im * wre + a3.re * wim;\
+    CMUL(t1, t2, a2.re, a2.im, wre, -wim);\
+    CMUL(t5, t6, a3.re, a3.im, wre,  wim);\
     BUTTERFLIES(a0,a1,a2,a3)\
 }
 
@@ -185,7 +202,7 @@ av_cold void ff_fft_end(FFTContext *s)
 #define PASS(name)\
 static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\
 {\
-    FFTSample t1, t2, t3, t4, t5, t6;\
+    FFTDouble t1, t2, t3, t4, t5, t6;\
     int o1 = 2*n;\
     int o2 = 4*n;\
     int o3 = 6*n;\
@@ -214,12 +231,12 @@ static void fft##n(FFTComplex *z)\
     fft##n2(z);\
     fft##n4(z+n4*2);\
     fft##n4(z+n4*3);\
-    pass(z,ff_cos_##n,n4/2);\
+    pass(z,FFT_NAME(ff_cos_##n),n4/2);\
 }
 
 static void fft4(FFTComplex *z)
 {
-    FFTSample t1, t2, t3, t4, t5, t6, t7, t8;
+    FFTDouble t1, t2, t3, t4, t5, t6, t7, t8;
 
     BF(t3, t1, z[0].re, z[1].re);
     BF(t8, t6, z[3].re, z[2].re);
@@ -233,28 +250,25 @@ static void fft4(FFTComplex *z)
 
 static void fft8(FFTComplex *z)
 {
-    FFTSample t1, t2, t3, t4, t5, t6, t7, t8;
+    FFTDouble t1, t2, t3, t4, t5, t6;
 
     fft4(z);
 
     BF(t1, z[5].re, z[4].re, -z[5].re);
     BF(t2, z[5].im, z[4].im, -z[5].im);
-    BF(t3, z[7].re, z[6].re, -z[7].re);
-    BF(t4, z[7].im, z[6].im, -z[7].im);
-    BF(t8, t1, t3, t1);
-    BF(t7, t2, t2, t4);
-    BF(z[4].re, z[0].re, z[0].re, t1);
-    BF(z[4].im, z[0].im, z[0].im, t2);
-    BF(z[6].re, z[2].re, z[2].re, t7);
-    BF(z[6].im, z[2].im, z[2].im, t8);
+    BF(t5, z[7].re, z[6].re, -z[7].re);
+    BF(t6, z[7].im, z[6].im, -z[7].im);
 
+    BUTTERFLIES(z[0],z[2],z[4],z[6]);
     TRANSFORM(z[1],z[3],z[5],z[7],sqrthalf,sqrthalf);
 }
 
 #if !CONFIG_SMALL
 static void fft16(FFTComplex *z)
 {
-    FFTSample t1, t2, t3, t4, t5, t6;
+    FFTDouble t1, t2, t3, t4, t5, t6;
+    FFTSample cos_16_1 = FFT_NAME(ff_cos_16)[1];
+    FFTSample cos_16_3 = FFT_NAME(ff_cos_16)[3];
 
     fft8(z);
     fft4(z+8);
@@ -262,8 +276,8 @@ static void fft16(FFTComplex *z)
 
     TRANSFORM_ZERO(z[0],z[4],z[8],z[12]);
     TRANSFORM(z[2],z[6],z[10],z[14],sqrthalf,sqrthalf);
-    TRANSFORM(z[1],z[5],z[9],z[13],ff_cos_16[1],ff_cos_16[3]);
-    TRANSFORM(z[3],z[7],z[11],z[15],ff_cos_16[3],ff_cos_16[1]);
+    TRANSFORM(z[1],z[5],z[9],z[13],cos_16_1,cos_16_3);
+    TRANSFORM(z[3],z[7],z[11],z[15],cos_16_3,cos_16_1);
 }
 #else
 DECL_FFT(16,8,4)
@@ -289,7 +303,7 @@ static void (* const fft_dispatch[])(FFTComplex*) = {
     fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
 };
 
-void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
+static void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
 {
     fft_dispatch[s->nbits-2](z);
 }
diff --git a/ffmpeg-mt/libavcodec/fft.h b/ffmpeg-mt/libavcodec/fft.h
index eb6714f..a4fee00 100644
--- a/ffmpeg-mt/libavcodec/fft.h
+++ b/ffmpeg-mt/libavcodec/fft.h
@@ -2,31 +2,61 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef AVCODEC_FFT_H
 #define AVCODEC_FFT_H
 
+#ifndef CONFIG_FFT_FLOAT
+#define CONFIG_FFT_FLOAT 1
+#endif
+
 #include <stdint.h>
 #include "config.h"
 #include "libavutil/mem.h"
+
+#if CONFIG_FFT_FLOAT
+
 #include "avfft.h"
 
+#define FFT_NAME(x) x
+
+typedef float FFTDouble;
+
+#else
+
+#define FFT_NAME(x) x ## _fixed
+
+typedef int16_t FFTSample;
+typedef int     FFTDouble;
+
+typedef struct FFTComplex {
+    int16_t re, im;
+} FFTComplex;
+
+typedef struct FFTContext FFTContext;
+
+#endif /* CONFIG_FFT_FLOAT */
+
+typedef struct FFTDComplex {
+    FFTDouble re, im;
+} FFTDComplex;
+
 /* FFT computation */
 
 struct FFTContext {
@@ -39,32 +69,36 @@ struct FFTContext {
     /* pre/post rotation tables */
     FFTSample *tcos;
     FFTSample *tsin;
+    /**
+     * Do the permutation needed BEFORE calling fft_calc().
+     */
     void (*fft_permute)(struct FFTContext *s, FFTComplex *z);
+    /**
+     * Do a complex FFT with the parameters defined in ff_fft_init(). The
+     * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
+     */
     void (*fft_calc)(struct FFTContext *s, FFTComplex *z);
     void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
     void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
     void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
-    int permutation;
+    void (*mdct_calcw)(struct FFTContext *s, FFTDouble *output, const FFTSample *input);
+    int fft_permutation;
+#define FF_FFT_PERM_DEFAULT   0
+#define FF_FFT_PERM_SWAP_LSBS 1
+    int mdct_permutation;
 #define FF_MDCT_PERM_NONE       0
 #define FF_MDCT_PERM_INTERLEAVE 1
 };
 
 #if CONFIG_HARDCODED_TABLES
 #define COSTABLE_CONST const
-#define SINTABLE_CONST const
-#define SINETABLE_CONST const
 #else
 #define COSTABLE_CONST
-#define SINTABLE_CONST
-#define SINETABLE_CONST
 #endif
 
 #define COSTABLE(size) \
-    COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_cos_##size)[size/2]
-#define SINTABLE(size) \
-    SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2]
-#define SINETABLE(size) \
-    SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size]
+    COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, FFT_NAME(ff_cos_##size))[size/2]
+
 extern COSTABLE(16);
 extern COSTABLE(32);
 extern COSTABLE(64);
@@ -78,7 +112,9 @@ extern COSTABLE(8192);
 extern COSTABLE(16384);
 extern COSTABLE(32768);
 extern COSTABLE(65536);
-extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17];
+extern COSTABLE_CONST FFTSample* const FFT_NAME(ff_cos_tabs)[17];
+
+#define ff_init_ff_cos_tabs FFT_NAME(ff_init_ff_cos_tabs)
 
 /**
  * Initialize the cosine table in ff_cos_tabs[index]
@@ -86,19 +122,8 @@ extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17];
  */
 void ff_init_ff_cos_tabs(int index);
 
-extern SINTABLE(16);
-extern SINTABLE(32);
-extern SINTABLE(64);
-extern SINTABLE(128);
-extern SINTABLE(256);
-extern SINTABLE(512);
-extern SINTABLE(1024);
-extern SINTABLE(2048);
-extern SINTABLE(4096);
-extern SINTABLE(8192);
-extern SINTABLE(16384);
-extern SINTABLE(32768);
-extern SINTABLE(65536);
+#define ff_fft_init FFT_NAME(ff_fft_init)
+#define ff_fft_end  FFT_NAME(ff_fft_end)
 
 /**
  * Set up a complex FFT.
@@ -106,139 +131,21 @@ extern SINTABLE(65536);
  * @param inverse         if 0 perform the forward transform, if 1 perform the inverse
  */
 int ff_fft_init(FFTContext *s, int nbits, int inverse);
-void ff_fft_permute_c(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_c(FFTContext *s, FFTComplex *z);
 
+#if CONFIG_FFT_FLOAT
 void ff_fft_init_altivec(FFTContext *s);
 void ff_fft_init_mmx(FFTContext *s);
 void ff_fft_init_arm(FFTContext *s);
-void ff_dct_init_mmx(DCTContext *s);
+#else
+void ff_fft_fixed_init_arm(FFTContext *s);
+#endif
 
-/**
- * Do the permutation needed BEFORE calling ff_fft_calc().
- */
-static inline void ff_fft_permute(FFTContext *s, FFTComplex *z)
-{
-    s->fft_permute(s, z);
-}
-/**
- * Do a complex FFT with the parameters defined in ff_fft_init(). The
- * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
- */
-static inline void ff_fft_calc(FFTContext *s, FFTComplex *z)
-{
-    s->fft_calc(s, z);
-}
 void ff_fft_end(FFTContext *s);
 
-/* MDCT computation */
-
-static inline void ff_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    s->imdct_calc(s, output, input);
-}
-static inline void ff_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    s->imdct_half(s, output, input);
-}
-
-static inline void ff_mdct_calc(FFTContext *s, FFTSample *output,
-                                const FFTSample *input)
-{
-    s->mdct_calc(s, output, input);
-}
-
-/**
- * Maximum window size for ff_kbd_window_init.
- */
-#define FF_KBD_WINDOW_MAX 1024
-
-/**
- * Generate a Kaiser-Bessel Derived Window.
- * @param   window  pointer to half window
- * @param   alpha   determines window shape
- * @param   n       size of half window, max FF_KBD_WINDOW_MAX
- */
-void ff_kbd_window_init(float *window, float alpha, int n);
-
-/**
- * Generate a sine window.
- * @param   window  pointer to half window
- * @param   n       size of half window
- */
-void ff_sine_window_init(float *window, int n);
-
-/**
- * initialize the specified entry of ff_sine_windows
- */
-void ff_init_ff_sine_windows(int index);
-extern SINETABLE(  32);
-extern SINETABLE(  64);
-extern SINETABLE( 128);
-extern SINETABLE( 256);
-extern SINETABLE( 512);
-extern SINETABLE(1024);
-extern SINETABLE(2048);
-extern SINETABLE(4096);
-extern SINETABLE_CONST float * const ff_sine_windows[13];
+#define ff_mdct_init FFT_NAME(ff_mdct_init)
+#define ff_mdct_end  FFT_NAME(ff_mdct_end)
 
 int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale);
-void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
 void ff_mdct_end(FFTContext *s);
 
-/* Real Discrete Fourier Transform */
-
-struct RDFTContext {
-    int nbits;
-    int inverse;
-    int sign_convention;
-
-    /* pre/post rotation tables */
-    const FFTSample *tcos;
-    SINTABLE_CONST FFTSample *tsin;
-    FFTContext fft;
-    void (*rdft_calc)(struct RDFTContext *s, FFTSample *z);
-};
-
-/**
- * Set up a real FFT.
- * @param nbits           log2 of the length of the input array
- * @param trans           the type of transform
- */
-int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
-void ff_rdft_end(RDFTContext *s);
-
-void ff_rdft_init_arm(RDFTContext *s);
-
-static av_always_inline void ff_rdft_calc(RDFTContext *s, FFTSample *data)
-{
-    s->rdft_calc(s, data);
-}
-
-/* Discrete Cosine Transform */
-
-struct DCTContext {
-    int nbits;
-    int inverse;
-    RDFTContext rdft;
-    const float *costab;
-    FFTSample *csc2;
-    void (*dct_calc)(struct DCTContext *s, FFTSample *data);
-    void (*dct32)(FFTSample *out, const FFTSample *in);
-};
-
-/**
- * Set up DCT.
- * @param nbits           size of the input array:
- *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
- *                        (1 << nbits) + 1 for DCT-I
- *
- * @note the first element of the input of DST-I is ignored
- */
-int  ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
-void ff_dct_calc(DCTContext *s, FFTSample *data);
-void ff_dct_end (DCTContext *s);
-
 #endif /* AVCODEC_FFT_H */
diff --git a/ffmpeg-mt/libavcodec/fft_fixed.c b/ffmpeg-mt/libavcodec/fft_fixed.c
new file mode 100644
index 0000000..b28091d
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/fft_fixed.c
@@ -0,0 +1,20 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define CONFIG_FFT_FLOAT 0
+#include "fft.c"
diff --git a/ffmpeg-mt/libavcodec/fft_float.c b/ffmpeg-mt/libavcodec/fft_float.c
new file mode 100644
index 0000000..24c9fdb
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/fft_float.c
@@ -0,0 +1,20 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define CONFIG_FFT_FLOAT 1
+#include "fft.c"
diff --git a/ffmpeg-mt/libavcodec/ffv1.c b/ffmpeg-mt/libavcodec/ffv1.c
index 83292b3..8b46091 100644
--- a/ffmpeg-mt/libavcodec/ffv1.c
+++ b/ffmpeg-mt/libavcodec/ffv1.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -792,7 +792,7 @@ static av_cold int init_slice_contexts(FFV1Context *f){
         fs->slice_x     = sxs;
         fs->slice_y     = sys;
 
-        fs->sample_buffer = av_malloc(6 * (fs->width+6) * sizeof(*fs->sample_buffer));
+        fs->sample_buffer = av_malloc(9 * (fs->width+6) * sizeof(*fs->sample_buffer));
         if (!fs->sample_buffer)
             return AVERROR(ENOMEM);
     }
@@ -1786,7 +1786,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     return buf_size;
 }
 
-AVCodec ffv1_decoder = {
+AVCodec ff_ffv1_decoder = {
     "ffv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FFV1,
@@ -1801,7 +1801,7 @@ AVCodec ffv1_decoder = {
 };
 
 #if CONFIG_FFV1_ENCODER
-AVCodec ffv1_encoder = {
+AVCodec ff_ffv1_encoder = {
     "ffv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FFV1,
diff --git a/ffmpeg-mt/libavcodec/flac.c b/ffmpeg-mt/libavcodec/flac.c
index 484a44e..e6a427a 100644
--- a/ffmpeg-mt/libavcodec/flac.c
+++ b/ffmpeg-mt/libavcodec/flac.c
@@ -2,20 +2,20 @@
  * FLAC common code
  * Copyright (c) 2009 Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/flac.h b/ffmpeg-mt/libavcodec/flac.h
index fcd8099..6ec8a37 100644
--- a/ffmpeg-mt/libavcodec/flac.h
+++ b/ffmpeg-mt/libavcodec/flac.h
@@ -2,20 +2,20 @@
  * FLAC (Free Lossless Audio Codec) decoder/demuxer common functions
  * Copyright (c) 2008 Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/flac_parser.c b/ffmpeg-mt/libavcodec/flac_parser.c
index 4ba3203..947a5b6 100644
--- a/ffmpeg-mt/libavcodec/flac_parser.c
+++ b/ffmpeg-mt/libavcodec/flac_parser.c
@@ -2,20 +2,20 @@
  * FLAC parser
  * Copyright (c) 2010 Michael Chinen
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -673,7 +673,7 @@ static void flac_parse_close(AVCodecParserContext *c)
     av_free(fpc->wrap_buf);
 }
 
-AVCodecParser flac_parser = {
+AVCodecParser ff_flac_parser = {
     { CODEC_ID_FLAC },
     sizeof(FLACParseContext),
     flac_parse_init,
diff --git a/ffmpeg-mt/libavcodec/flacdata.c b/ffmpeg-mt/libavcodec/flacdata.c
index 6fcbe39..820c3aa 100644
--- a/ffmpeg-mt/libavcodec/flacdata.c
+++ b/ffmpeg-mt/libavcodec/flacdata.c
@@ -2,20 +2,20 @@
  * FLAC data
  * Copyright (c) 2003 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/flacdata.h b/ffmpeg-mt/libavcodec/flacdata.h
index 96a50b9..f566377 100644
--- a/ffmpeg-mt/libavcodec/flacdata.h
+++ b/ffmpeg-mt/libavcodec/flacdata.h
@@ -2,20 +2,20 @@
  * FLAC data header
  * Copyright (c) 2003 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/flacdec.c b/ffmpeg-mt/libavcodec/flacdec.c
index 18ea0ac..1ce8559 100644
--- a/ffmpeg-mt/libavcodec/flacdec.c
+++ b/ffmpeg-mt/libavcodec/flacdec.c
@@ -2,20 +2,20 @@
  * FLAC (Free Lossless Audio Codec) decoder
  * Copyright (c) 2003 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -653,7 +653,7 @@ static av_cold int flac_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec flac_decoder = {
+AVCodec ff_flac_decoder = {
     "flac",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_FLAC,
diff --git a/ffmpeg-mt/libavcodec/flacenc.c b/ffmpeg-mt/libavcodec/flacenc.c
index 272d446..d93bfb5 100644
--- a/ffmpeg-mt/libavcodec/flacenc.c
+++ b/ffmpeg-mt/libavcodec/flacenc.c
@@ -2,20 +2,20 @@
  * FLAC audio encoder
  * Copyright (c) 2006  Justin Ruggles <justin.ruggles at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,6 @@
 #include "libavutil/md5.h"
 #include "avcodec.h"
 #include "get_bits.h"
-#include "dsputil.h"
 #include "golomb.h"
 #include "lpc.h"
 #include "flac.h"
@@ -95,7 +94,7 @@ typedef struct FlacEncodeContext {
     FlacFrame frame;
     CompressionOptions options;
     AVCodecContext *avctx;
-    DSPContext dsp;
+    LPCContext lpc_ctx;
     struct AVMD5 *md5ctx;
 } FlacEncodeContext;
 
@@ -212,13 +211,11 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
     int freq = avctx->sample_rate;
     int channels = avctx->channels;
     FlacEncodeContext *s = avctx->priv_data;
-    int i, level;
+    int i, level, ret;
     uint8_t *streaminfo;
 
     s->avctx = avctx;
 
-    dsputil_init(&s->dsp, avctx);
-
     if (avctx->sample_fmt != AV_SAMPLE_FMT_S16)
         return -1;
 
@@ -439,9 +436,12 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
     if (!avctx->coded_frame)
         return AVERROR(ENOMEM);
 
+    ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size,
+                      s->options.max_prediction_order, AV_LPC_TYPE_LEVINSON);
+
     dprint_compression_options(s);
 
-    return 0;
+    return ret;
 }
 
 
@@ -902,7 +902,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
 
     /* LPC */
     sub->type = FLAC_SUBFRAME_LPC;
-    opt_order = ff_lpc_calc_coefs(&s->dsp, smp, n, min_order, max_order,
+    opt_order = ff_lpc_calc_coefs(&s->lpc_ctx, smp, n, min_order, max_order,
                                   s->options.lpc_coeff_precision, coefs, shift, s->options.lpc_type,
                                   s->options.lpc_passes, omethod,
                                   MAX_LPC_SHIFT, 0);
@@ -1317,6 +1317,7 @@ static av_cold int flac_encode_close(AVCodecContext *avctx)
     if (avctx->priv_data) {
         FlacEncodeContext *s = avctx->priv_data;
         av_freep(&s->md5ctx);
+        ff_lpc_end(&s->lpc_ctx);
     }
     av_freep(&avctx->extradata);
     avctx->extradata_size = 0;
@@ -1325,7 +1326,7 @@ static av_cold int flac_encode_close(AVCodecContext *avctx)
 }
 
 
-AVCodec flac_encoder = {
+AVCodec ff_flac_encoder = {
     "flac",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_FLAC,
diff --git a/ffmpeg-mt/libavcodec/flashsv.c b/ffmpeg-mt/libavcodec/flashsv.c
index 394ac0f..287cb10 100644
--- a/ffmpeg-mt/libavcodec/flashsv.c
+++ b/ffmpeg-mt/libavcodec/flashsv.c
@@ -3,20 +3,20 @@
  * Copyright (C) 2004 Alex Beregszaszi
  * Copyright (C) 2006 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -133,8 +133,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx,
     /* the block size could change between frames, make sure the buffer
      * is large enough, if not, get a larger one */
     if(s->block_size < s->block_width*s->block_height) {
-        if (s->tmpblock != NULL)
-            av_free(s->tmpblock);
+        av_free(s->tmpblock);
         if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) {
             av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
             return -1;
@@ -243,14 +242,13 @@ static av_cold int flashsv_decode_end(AVCodecContext *avctx)
         avctx->release_buffer(avctx, &s->frame);
 
     /* free the tmpblock */
-    if (s->tmpblock != NULL)
-        av_free(s->tmpblock);
+    av_free(s->tmpblock);
 
     return 0;
 }
 
 
-AVCodec flashsv_decoder = {
+AVCodec ff_flashsv_decoder = {
     "flashsv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FLASHSV,
diff --git a/ffmpeg-mt/libavcodec/flashsvenc.c b/ffmpeg-mt/libavcodec/flashsvenc.c
index ff917e9..2a12d0e 100644
--- a/ffmpeg-mt/libavcodec/flashsvenc.c
+++ b/ffmpeg-mt/libavcodec/flashsvenc.c
@@ -3,20 +3,20 @@
  * Copyright (C) 2004 Alex Beregszaszi
  * Copyright (C) 2006 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -280,7 +280,7 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec flashsv_encoder = {
+AVCodec ff_flashsv_encoder = {
     "flashsv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FLASHSV,
diff --git a/ffmpeg-mt/libavcodec/flicvideo.c b/ffmpeg-mt/libavcodec/flicvideo.c
index b63d7d4..ed9972c 100644
--- a/ffmpeg-mt/libavcodec/flicvideo.c
+++ b/ffmpeg-mt/libavcodec/flicvideo.c
@@ -2,20 +2,20 @@
  * FLI/FLC Animation Video Decoder
  * Copyright (C) 2003, 2004 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -742,7 +742,7 @@ static av_cold int flic_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec flic_decoder = {
+AVCodec ff_flic_decoder = {
     "flic",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FLIC,
diff --git a/ffmpeg-mt/libavcodec/flv.h b/ffmpeg-mt/libavcodec/flv.h
index eb10f22..8411117 100644
--- a/ffmpeg-mt/libavcodec/flv.h
+++ b/ffmpeg-mt/libavcodec/flv.h
@@ -1,19 +1,19 @@
 /*
  * FLV specific private header.
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/flvdec.c b/ffmpeg-mt/libavcodec/flvdec.c
index f53291d..485ee96 100644
--- a/ffmpeg-mt/libavcodec/flvdec.c
+++ b/ffmpeg-mt/libavcodec/flvdec.c
@@ -1,26 +1,26 @@
 /*
  * FLV decoding.
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "mpegvideo.h"
 #include "h263.h"
 #include "flv.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){
     int is11 = get_bits1(gb);
@@ -118,7 +118,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
     return 0;
 }
 
-AVCodec flv_decoder = {
+AVCodec ff_flv_decoder = {
     "flv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FLV1,
diff --git a/ffmpeg-mt/libavcodec/flvenc.c b/ffmpeg-mt/libavcodec/flvenc.c
index bf320f2..af3e813 100644
--- a/ffmpeg-mt/libavcodec/flvenc.c
+++ b/ffmpeg-mt/libavcodec/flvenc.c
@@ -1,19 +1,19 @@
 /*
  * FLV Encoding specific code.
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -84,7 +84,7 @@ void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run, in
     }
 }
 
-AVCodec flv_encoder = {
+AVCodec ff_flv_encoder = {
     "flv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FLV1,
diff --git a/ffmpeg-mt/libavcodec/fmtconvert.c b/ffmpeg-mt/libavcodec/fmtconvert.c
new file mode 100644
index 0000000..e970755
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/fmtconvert.c
@@ -0,0 +1,68 @@
+/*
+ * Format Conversion Utils
+ * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "fmtconvert.h"
+
+static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){
+    int i;
+    for(i=0; i<len; i++)
+        dst[i] = src[i] * mul;
+}
+
+static av_always_inline int float_to_int16_one(const float *src){
+    return av_clip_int16(lrintf(*src));
+}
+
+static void float_to_int16_c(int16_t *dst, const float *src, long len)
+{
+    int i;
+    for(i=0; i<len; i++)
+        dst[i] = float_to_int16_one(src+i);
+}
+
+static void float_to_int16_interleave_c(int16_t *dst, const float **src,
+                                        long len, int channels)
+{
+    int i,j,c;
+    if(channels==2){
+        for(i=0; i<len; i++){
+            dst[2*i]   = float_to_int16_one(src[0]+i);
+            dst[2*i+1] = float_to_int16_one(src[1]+i);
+        }
+    }else{
+        for(c=0; c<channels; c++)
+            for(i=0, j=c; i<len; i++, j+=channels)
+                dst[j] = float_to_int16_one(src[c]+i);
+    }
+}
+
+av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
+{
+    c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
+    c->float_to_int16             = float_to_int16_c;
+    c->float_to_int16_interleave  = float_to_int16_interleave_c;
+
+    if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx);
+    if (HAVE_ALTIVEC) ff_fmt_convert_init_altivec(c, avctx);
+    if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx);
+}
diff --git a/ffmpeg-mt/libavcodec/fmtconvert.h b/ffmpeg-mt/libavcodec/fmtconvert.h
new file mode 100644
index 0000000..e0afee4
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/fmtconvert.h
@@ -0,0 +1,79 @@
+/*
+ * Format Conversion Utils
+ * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_FMTCONVERT_H
+#define AVCODEC_FMTCONVERT_H
+
+#include "avcodec.h"
+
+typedef struct FmtConvertContext {
+    /**
+     * Convert an array of int32_t to float and multiply by a float value.
+     * @param dst destination array of float.
+     *            constraints: 16-byte aligned
+     * @param src source array of int32_t.
+     *            constraints: 16-byte aligned
+     * @param len number of elements to convert.
+     *            constraints: multiple of 8
+     */
+    void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len);
+
+    /**
+     * Convert an array of float to an array of int16_t.
+     *
+     * Convert floats from in the range [-32768.0,32767.0] to ints
+     * without rescaling
+     *
+     * @param dst destination array of int16_t.
+     *            constraints: 16-byte aligned
+     * @param src source array of float.
+     *            constraints: 16-byte aligned
+     * @param len number of elements to convert.
+     *            constraints: multiple of 8
+     */
+    void (*float_to_int16)(int16_t *dst, const float *src, long len);
+
+    /**
+     * Convert multiple arrays of float to an interleaved array of int16_t.
+     *
+     * Convert floats from in the range [-32768.0,32767.0] to ints
+     * without rescaling
+     *
+     * @param dst destination array of interleaved int16_t.
+     *            constraints: 16-byte aligned
+     * @param src source array of float arrays, one for each channel.
+     *            constraints: 16-byte aligned
+     * @param len number of elements to convert.
+     *            constraints: multiple of 8
+     * @param channels number of channels
+     */
+    void (*float_to_int16_interleave)(int16_t *dst, const float **src,
+                                      long len, int channels);
+} FmtConvertContext;
+
+void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx);
+
+void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx);
+void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx);
+void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx);
+
+#endif /* AVCODEC_FMTCONVERT_H */
diff --git a/ffmpeg-mt/libavcodec/fraps.c b/ffmpeg-mt/libavcodec/fraps.c
index 9786fd0..346f034 100644
--- a/ffmpeg-mt/libavcodec/fraps.c
+++ b/ffmpeg-mt/libavcodec/fraps.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2005 Roine Gustafsson
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -355,7 +355,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
 }
 
 
-AVCodec fraps_decoder = {
+AVCodec ff_fraps_decoder = {
     "fraps",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FRAPS,
diff --git a/ffmpeg-mt/libavcodec/frwu.c b/ffmpeg-mt/libavcodec/frwu.c
index b685248..bff7d0a 100644
--- a/ffmpeg-mt/libavcodec/frwu.c
+++ b/ffmpeg-mt/libavcodec/frwu.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -109,7 +109,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec frwu_decoder = {
+AVCodec ff_frwu_decoder = {
     "FRWU",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FRWU,
diff --git a/ffmpeg-mt/libavcodec/g722.c b/ffmpeg-mt/libavcodec/g722.c
index 96a2bd6..422a134 100644
--- a/ffmpeg-mt/libavcodec/g722.c
+++ b/ffmpeg-mt/libavcodec/g722.c
@@ -7,20 +7,20 @@
  * Copyright (c) 2009 Kenan Gillet
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -328,7 +328,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data,
     return avpkt->size;
 }
 
-AVCodec adpcm_g722_decoder = {
+AVCodec ff_adpcm_g722_decoder = {
     .name           = "g722",
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = CODEC_ID_ADPCM_G722,
@@ -568,7 +568,7 @@ static int g722_encode_frame(AVCodecContext *avctx,
     return i;
 }
 
-AVCodec adpcm_g722_encoder = {
+AVCodec ff_adpcm_g722_encoder = {
     .name           = "g722",
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = CODEC_ID_ADPCM_G722,
diff --git a/ffmpeg-mt/libavcodec/g726.c b/ffmpeg-mt/libavcodec/g726.c
index 52ebda6..09df727 100644
--- a/ffmpeg-mt/libavcodec/g726.c
+++ b/ffmpeg-mt/libavcodec/g726.c
@@ -5,20 +5,20 @@
  * This is a very straightforward rendition of the G.726
  * Section 4 "Computational Details".
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <limits.h>
@@ -391,7 +391,7 @@ static int g726_decode_frame(AVCodecContext *avctx,
 }
 
 #if CONFIG_ADPCM_G726_ENCODER
-AVCodec adpcm_g726_encoder = {
+AVCodec ff_adpcm_g726_encoder = {
     "g726",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_ADPCM_G726,
@@ -406,7 +406,7 @@ AVCodec adpcm_g726_encoder = {
 };
 #endif
 
-AVCodec adpcm_g726_decoder = {
+AVCodec ff_adpcm_g726_decoder = {
     "g726",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_ADPCM_G726,
diff --git a/ffmpeg-mt/libavcodec/g729.h b/ffmpeg-mt/libavcodec/g729.h
index 462cf8f..9cae471 100644
--- a/ffmpeg-mt/libavcodec/g729.h
+++ b/ffmpeg-mt/libavcodec/g729.h
@@ -2,20 +2,20 @@
  * G.729 decoder
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVCODEC_G729_H
diff --git a/ffmpeg-mt/libavcodec/g729data.h b/ffmpeg-mt/libavcodec/g729data.h
index 1d64553..48010a7 100644
--- a/ffmpeg-mt/libavcodec/g729data.h
+++ b/ffmpeg-mt/libavcodec/g729data.h
@@ -2,20 +2,20 @@
  * data for G.729 decoder
  * Copyright (c) 2007 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/g729dec.c b/ffmpeg-mt/libavcodec/g729dec.c
index 3a6fb0f..5763108 100644
--- a/ffmpeg-mt/libavcodec/g729dec.c
+++ b/ffmpeg-mt/libavcodec/g729dec.c
@@ -2,20 +2,20 @@
  * G.729 decoder
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <stdlib.h>
@@ -312,7 +312,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     return buf_size;
 }
 
-AVCodec g729_decoder =
+AVCodec ff_g729_decoder =
 {
     "g729",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/get_bits.h b/ffmpeg-mt/libavcodec/get_bits.h
index f4b3646..2d36b81 100644
--- a/ffmpeg-mt/libavcodec/get_bits.h
+++ b/ffmpeg-mt/libavcodec/get_bits.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,12 +39,11 @@
 #   define ALT_BITSTREAM_READER
 #endif
 
-#if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER)
+#if !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER)
 #   if ARCH_ARM && !HAVE_FAST_UNALIGNED
 #       define A32_BITSTREAM_READER
 #   else
 #       define ALT_BITSTREAM_READER
-//#define LIBMPEG2_BITSTREAM_READER
 //#define A32_BITSTREAM_READER
 #   endif
 #endif
@@ -55,10 +54,6 @@ typedef struct GetBitContext {
     const uint8_t *buffer, *buffer_end;
 #ifdef ALT_BITSTREAM_READER
     int index;
-#elif defined LIBMPEG2_BITSTREAM_READER
-    uint8_t *buffer_ptr;
-    uint32_t cache;
-    int bit_count;
 #elif defined A32_BITSTREAM_READER
     uint32_t *buffer_ptr;
     uint32_t cache0;
@@ -130,56 +125,46 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
 #ifdef ALT_BITSTREAM_READER
 #   define MIN_CACHE_BITS 25
 
-#   define OPEN_READER(name, gb)\
-        unsigned int name##_index= (gb)->index;\
-        int name##_cache= 0;\
+#   define OPEN_READER(name, gb)                \
+    unsigned int name##_index = (gb)->index;    \
+    int name##_cache          = 0
 
-#   define CLOSE_READER(name, gb)\
-        (gb)->index= name##_index;\
+#   define CLOSE_READER(name, gb) (gb)->index = name##_index
 
 # ifdef ALT_BITSTREAM_READER_LE
-#   define UPDATE_CACHE(name, gb)\
-        name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\
+#   define UPDATE_CACHE(name, gb) \
+    name##_cache = AV_RL32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) >> (name##_index&0x07)
 
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache >>= (num);
+#   define SKIP_CACHE(name, gb, num) name##_cache >>= (num)
 # else
-#   define UPDATE_CACHE(name, gb)\
-        name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\
+#   define UPDATE_CACHE(name, gb) \
+    name##_cache = AV_RB32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) << (name##_index&0x07)
 
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache <<= (num);
+#   define SKIP_CACHE(name, gb, num) name##_cache <<= (num)
 # endif
 
 // FIXME name?
-#   define SKIP_COUNTER(name, gb, num)\
-        name##_index += (num);\
+#   define SKIP_COUNTER(name, gb, num) name##_index += (num)
 
-#   define SKIP_BITS(name, gb, num)\
-        {\
-            SKIP_CACHE(name, gb, num)\
-            SKIP_COUNTER(name, gb, num)\
-        }\
+#   define SKIP_BITS(name, gb, num) do {        \
+        SKIP_CACHE(name, gb, num);              \
+        SKIP_COUNTER(name, gb, num);            \
+    } while (0)
 
 #   define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
-#   define LAST_SKIP_CACHE(name, gb, num) ;
+#   define LAST_SKIP_CACHE(name, gb, num)
 
 # ifdef ALT_BITSTREAM_READER_LE
-#   define SHOW_UBITS(name, gb, num)\
-        zero_extend(name##_cache, num)
+#   define SHOW_UBITS(name, gb, num) zero_extend(name##_cache, num)
 
-#   define SHOW_SBITS(name, gb, num)\
-        sign_extend(name##_cache, num)
+#   define SHOW_SBITS(name, gb, num) sign_extend(name##_cache, num)
 # else
-#   define SHOW_UBITS(name, gb, num)\
-        NEG_USR32(name##_cache, num)
+#   define SHOW_UBITS(name, gb, num) NEG_USR32(name##_cache, num)
 
-#   define SHOW_SBITS(name, gb, num)\
-        NEG_SSR32(name##_cache, num)
+#   define SHOW_SBITS(name, gb, num) NEG_SSR32(name##_cache, num)
 # endif
 
-#   define GET_CACHE(name, gb)\
-        ((uint32_t)name##_cache)
+#   define GET_CACHE(name, gb) ((uint32_t)name##_cache)
 
 static inline int get_bits_count(const GetBitContext *s){
     return s->index;
@@ -189,140 +174,76 @@ static inline void skip_bits_long(GetBitContext *s, int n){
     s->index += n;
 }
 
-#elif defined LIBMPEG2_BITSTREAM_READER
-//libmpeg2 like reader
-
-#   define MIN_CACHE_BITS 17
-
-#   define OPEN_READER(name, gb)\
-        int name##_bit_count=(gb)->bit_count;\
-        int name##_cache= (gb)->cache;\
-        uint8_t * name##_buffer_ptr=(gb)->buffer_ptr;\
-
-#   define CLOSE_READER(name, gb)\
-        (gb)->bit_count= name##_bit_count;\
-        (gb)->cache= name##_cache;\
-        (gb)->buffer_ptr= name##_buffer_ptr;\
-
-#   define UPDATE_CACHE(name, gb)\
-    if(name##_bit_count >= 0){\
-        name##_cache+= AV_RB16(name##_buffer_ptr) << name##_bit_count; \
-        name##_buffer_ptr+=2;\
-        name##_bit_count-= 16;\
-    }\
-
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache <<= (num);\
-
-#   define SKIP_COUNTER(name, gb, num)\
-        name##_bit_count += (num);\
-
-#   define SKIP_BITS(name, gb, num)\
-        {\
-            SKIP_CACHE(name, gb, num)\
-            SKIP_COUNTER(name, gb, num)\
-        }\
-
-#   define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
-#   define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
-
-#   define SHOW_UBITS(name, gb, num)\
-        NEG_USR32(name##_cache, num)
-
-#   define SHOW_SBITS(name, gb, num)\
-        NEG_SSR32(name##_cache, num)
-
-#   define GET_CACHE(name, gb)\
-        ((uint32_t)name##_cache)
-
-static inline int get_bits_count(const GetBitContext *s){
-    return (s->buffer_ptr - s->buffer)*8 - 16 + s->bit_count;
-}
-
-static inline void skip_bits_long(GetBitContext *s, int n){
-    OPEN_READER(re, s)
-    re_bit_count += n;
-    re_buffer_ptr += 2*(re_bit_count>>4);
-    re_bit_count &= 15;
-    re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count);
-    UPDATE_CACHE(re, s)
-    CLOSE_READER(re, s)
-}
-
 #elif defined A32_BITSTREAM_READER
 
 #   define MIN_CACHE_BITS 32
 
-#   define OPEN_READER(name, gb)\
-        int name##_bit_count=(gb)->bit_count;\
-        uint32_t name##_cache0= (gb)->cache0;\
-        uint32_t name##_cache1= (gb)->cache1;\
-        uint32_t * name##_buffer_ptr=(gb)->buffer_ptr;\
-
-#   define CLOSE_READER(name, gb)\
-        (gb)->bit_count= name##_bit_count;\
-        (gb)->cache0= name##_cache0;\
-        (gb)->cache1= name##_cache1;\
-        (gb)->buffer_ptr= name##_buffer_ptr;\
-
-#   define UPDATE_CACHE(name, gb)\
-    if(name##_bit_count > 0){\
-        const uint32_t next= av_be2ne32( *name##_buffer_ptr );\
-        name##_cache0 |= NEG_USR32(next,name##_bit_count);\
-        name##_cache1 |= next<<name##_bit_count;\
-        name##_buffer_ptr++;\
-        name##_bit_count-= 32;\
-    }\
+#   define OPEN_READER(name, gb)                        \
+    int name##_bit_count        = (gb)->bit_count;      \
+    uint32_t name##_cache0      = (gb)->cache0;         \
+    uint32_t name##_cache1      = (gb)->cache1;         \
+    uint32_t *name##_buffer_ptr = (gb)->buffer_ptr
+
+#   define CLOSE_READER(name, gb) do {          \
+        (gb)->bit_count  = name##_bit_count;    \
+        (gb)->cache0     = name##_cache0;       \
+        (gb)->cache1     = name##_cache1;       \
+        (gb)->buffer_ptr = name##_buffer_ptr;   \
+    } while (0)
+
+#   define UPDATE_CACHE(name, gb) do {                                  \
+        if(name##_bit_count > 0){                                       \
+            const uint32_t next = av_be2ne32(*name##_buffer_ptr);       \
+            name##_cache0 |= NEG_USR32(next, name##_bit_count);         \
+            name##_cache1 |= next << name##_bit_count;                  \
+            name##_buffer_ptr++;                                        \
+            name##_bit_count -= 32;                                     \
+        }                                                               \
+    } while (0)
 
 #if ARCH_X86
-#   define SKIP_CACHE(name, gb, num)\
-        __asm__(\
-            "shldl %2, %1, %0          \n\t"\
-            "shll %2, %1               \n\t"\
-            : "+r" (name##_cache0), "+r" (name##_cache1)\
-            : "Ic" ((uint8_t)(num))\
-           );
+#   define SKIP_CACHE(name, gb, num)                            \
+    __asm__("shldl %2, %1, %0          \n\t"                    \
+            "shll  %2, %1              \n\t"                    \
+            : "+r" (name##_cache0), "+r" (name##_cache1)        \
+            : "Ic" ((uint8_t)(num)))
 #else
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache0 <<= (num);\
-        name##_cache0 |= NEG_USR32(name##_cache1,num);\
-        name##_cache1 <<= (num);
+#   define SKIP_CACHE(name, gb, num) do {               \
+        name##_cache0 <<= (num);                        \
+        name##_cache0 |= NEG_USR32(name##_cache1,num);  \
+        name##_cache1 <<= (num);                        \
+    } while (0)
 #endif
 
-#   define SKIP_COUNTER(name, gb, num)\
-        name##_bit_count += (num);\
+#   define SKIP_COUNTER(name, gb, num) name##_bit_count += (num)
 
-#   define SKIP_BITS(name, gb, num)\
-        {\
-            SKIP_CACHE(name, gb, num)\
-            SKIP_COUNTER(name, gb, num)\
-        }\
+#   define SKIP_BITS(name, gb, num) do {        \
+        SKIP_CACHE(name, gb, num);              \
+        SKIP_COUNTER(name, gb, num);            \
+    } while (0)
 
-#   define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
+#   define LAST_SKIP_BITS(name, gb, num)  SKIP_BITS(name, gb, num)
 #   define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
 
-#   define SHOW_UBITS(name, gb, num)\
-        NEG_USR32(name##_cache0, num)
+#   define SHOW_UBITS(name, gb, num) NEG_USR32(name##_cache0, num)
 
-#   define SHOW_SBITS(name, gb, num)\
-        NEG_SSR32(name##_cache0, num)
+#   define SHOW_SBITS(name, gb, num) NEG_SSR32(name##_cache0, num)
 
-#   define GET_CACHE(name, gb)\
-        (name##_cache0)
+#   define GET_CACHE(name, gb) name##_cache0
 
-static inline int get_bits_count(const GetBitContext *s){
+static inline int get_bits_count(const GetBitContext *s) {
     return ((uint8_t*)s->buffer_ptr - s->buffer)*8 - 32 + s->bit_count;
 }
 
 static inline void skip_bits_long(GetBitContext *s, int n){
-    OPEN_READER(re, s)
+    OPEN_READER(re, s);
     re_bit_count += n;
     re_buffer_ptr += re_bit_count>>5;
     re_bit_count &= 31;
-    re_cache0 = av_be2ne32( re_buffer_ptr[-1] ) << re_bit_count;
+    re_cache0 = av_be2ne32(re_buffer_ptr[-1]) << re_bit_count;
     re_cache1 = 0;
-    UPDATE_CACHE(re, s)
-    CLOSE_READER(re, s)
+    UPDATE_CACHE(re, s);
+    CLOSE_READER(re, s);
 }
 
 #endif
@@ -336,73 +257,70 @@ static inline void skip_bits_long(GetBitContext *s, int n){
 static inline int get_xbits(GetBitContext *s, int n){
     register int sign;
     register int32_t cache;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    cache = GET_CACHE(re,s);
-    sign=(~cache)>>31;
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
+    OPEN_READER(re, s);
+    UPDATE_CACHE(re, s);
+    cache = GET_CACHE(re, s);
+    sign = ~cache >> 31;
+    LAST_SKIP_BITS(re, s, n);
+    CLOSE_READER(re, s);
     return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
 }
 
 static inline int get_sbits(GetBitContext *s, int n){
     register int tmp;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    tmp= SHOW_SBITS(re, s, n);
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
+    OPEN_READER(re, s);
+    UPDATE_CACHE(re, s);
+    tmp = SHOW_SBITS(re, s, n);
+    LAST_SKIP_BITS(re, s, n);
+    CLOSE_READER(re, s);
     return tmp;
 }
 
 /**
- * reads 1-17 bits.
- * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
+ * Read 1-25 bits.
  */
 static inline unsigned int get_bits(GetBitContext *s, int n){
     register int tmp;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    tmp= SHOW_UBITS(re, s, n);
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
+    OPEN_READER(re, s);
+    UPDATE_CACHE(re, s);
+    tmp = SHOW_UBITS(re, s, n);
+    LAST_SKIP_BITS(re, s, n);
+    CLOSE_READER(re, s);
     return tmp;
 }
 
 /**
- * shows 1-17 bits.
- * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
+ * Shows 1-25 bits.
  */
 static inline unsigned int show_bits(GetBitContext *s, int n){
     register int tmp;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    tmp= SHOW_UBITS(re, s, n);
-//    CLOSE_READER(re, s)
+    OPEN_READER(re, s);
+    UPDATE_CACHE(re, s);
+    tmp = SHOW_UBITS(re, s, n);
     return tmp;
 }
 
 static inline void skip_bits(GetBitContext *s, int n){
  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
+    OPEN_READER(re, s);
+    UPDATE_CACHE(re, s);
+    LAST_SKIP_BITS(re, s, n);
+    CLOSE_READER(re, s);
 }
 
 static inline unsigned int get_bits1(GetBitContext *s){
 #ifdef ALT_BITSTREAM_READER
-    unsigned int index= s->index;
-    uint8_t result= s->buffer[ index>>3 ];
+    unsigned int index = s->index;
+    uint8_t result = s->buffer[index>>3];
 #ifdef ALT_BITSTREAM_READER_LE
-    result>>= (index&0x07);
-    result&= 1;
+    result >>= index & 7;
+    result &= 1;
 #else
-    result<<= (index&0x07);
-    result>>= 8 - 1;
+    result <<= index & 7;
+    result >>= 8 - 1;
 #endif
     index++;
-    s->index= index;
+    s->index = index;
 
     return result;
 #else
@@ -422,13 +340,13 @@ static inline void skip_bits1(GetBitContext *s){
  * reads 0-32 bits.
  */
 static inline unsigned int get_bits_long(GetBitContext *s, int n){
-    if(n<=MIN_CACHE_BITS) return get_bits(s, n);
-    else{
+    if (n <= MIN_CACHE_BITS) return get_bits(s, n);
+    else {
 #ifdef ALT_BITSTREAM_READER_LE
-        int ret= get_bits(s, 16);
+        int ret = get_bits(s, 16);
         return ret | (get_bits(s, n-16) << 16);
 #else
-        int ret= get_bits(s, 16) << (n-16);
+        int ret = get_bits(s, 16) << (n-16);
         return ret | get_bits(s, n-16);
 #endif
     }
@@ -445,17 +363,17 @@ static inline int get_sbits_long(GetBitContext *s, int n) {
  * shows 0-32 bits.
  */
 static inline unsigned int show_bits_long(GetBitContext *s, int n){
-    if(n<=MIN_CACHE_BITS) return show_bits(s, n);
-    else{
-        GetBitContext gb= *s;
+    if (n <= MIN_CACHE_BITS) return show_bits(s, n);
+    else {
+        GetBitContext gb = *s;
         return get_bits_long(&gb, n);
     }
 }
 
 static inline int check_marker(GetBitContext *s, const char *msg)
 {
-    int bit= get_bits1(s);
-    if(!bit)
+    int bit = get_bits1(s);
+    if (!bit)
         av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
 
     return bit;
@@ -473,42 +391,38 @@ static inline int check_marker(GetBitContext *s, const char *msg)
 static inline void init_get_bits(GetBitContext *s,
                    const uint8_t *buffer, int bit_size)
 {
-    int buffer_size= (bit_size+7)>>3;
-    if(buffer_size < 0 || bit_size < 0) {
+    int buffer_size = (bit_size+7)>>3;
+    if (buffer_size < 0 || bit_size < 0) {
         buffer_size = bit_size = 0;
         buffer = NULL;
     }
 
-    s->buffer= buffer;
-    s->size_in_bits= bit_size;
-    s->buffer_end= buffer + buffer_size;
+    s->buffer       = buffer;
+    s->size_in_bits = bit_size;
+    s->buffer_end   = buffer + buffer_size;
 #ifdef ALT_BITSTREAM_READER
-    s->index=0;
-#elif defined LIBMPEG2_BITSTREAM_READER
-    s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
-    s->bit_count = 16 + 8*((intptr_t)buffer&1);
-    skip_bits_long(s, 0);
+    s->index        = 0;
 #elif defined A32_BITSTREAM_READER
-    s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));
-    s->bit_count = 32 + 8*((intptr_t)buffer&3);
+    s->buffer_ptr   = (uint32_t*)((intptr_t)buffer & ~3);
+    s->bit_count    = 32 +     8*((intptr_t)buffer &  3);
     skip_bits_long(s, 0);
 #endif
 }
 
 static inline void align_get_bits(GetBitContext *s)
 {
-    int n= (-get_bits_count(s)) & 7;
-    if(n) skip_bits(s, n);
+    int n = -get_bits_count(s) & 7;
+    if (n) skip_bits(s, n);
 }
 
-#define init_vlc(vlc, nb_bits, nb_codes,\
-                 bits, bits_wrap, bits_size,\
-                 codes, codes_wrap, codes_size,\
-                 flags)\
-        init_vlc_sparse(vlc, nb_bits, nb_codes,\
-                 bits, bits_wrap, bits_size,\
-                 codes, codes_wrap, codes_size,\
-                 NULL, 0, 0, flags)
+#define init_vlc(vlc, nb_bits, nb_codes,                \
+                 bits, bits_wrap, bits_size,            \
+                 codes, codes_wrap, codes_size,         \
+                 flags)                                 \
+        init_vlc_sparse(vlc, nb_bits, nb_codes,         \
+                        bits, bits_wrap, bits_size,     \
+                        codes, codes_wrap, codes_size,  \
+                        NULL, 0, 0, flags)
 
 int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
              const void *bits, int bits_wrap, int bits_size,
@@ -519,13 +433,12 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
 #define INIT_VLC_USE_NEW_STATIC 4
 void free_vlc(VLC *vlc);
 
-#define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size)\
-{\
-    static VLC_TYPE table[static_size][2];\
-    (vlc)->table= table;\
-    (vlc)->table_allocated= static_size;\
-    init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC);\
-}
+#define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size) do {     \
+        static VLC_TYPE table[static_size][2];                          \
+        (vlc)->table = table;                                           \
+        (vlc)->table_allocated = static_size;                           \
+        init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC);    \
+    } while (0)
 
 
 /**
@@ -534,62 +447,60 @@ void free_vlc(VLC *vlc);
  * If the vlc code is invalid and max_depth>1, then the number of bits removed
  * is undefined.
  */
-#define GET_VLC(code, name, gb, table, bits, max_depth)\
-{\
-    int n, nb_bits;\
-    unsigned int index;\
-\
-    index= SHOW_UBITS(name, gb, bits);\
-    code = table[index][0];\
-    n    = table[index][1];\
-\
-    if(max_depth > 1 && n < 0){\
-        LAST_SKIP_BITS(name, gb, bits)\
-        UPDATE_CACHE(name, gb)\
-\
-        nb_bits = -n;\
-\
-        index= SHOW_UBITS(name, gb, nb_bits) + code;\
-        code = table[index][0];\
-        n    = table[index][1];\
-        if(max_depth > 2 && n < 0){\
-            LAST_SKIP_BITS(name, gb, nb_bits)\
-            UPDATE_CACHE(name, gb)\
-\
-            nb_bits = -n;\
-\
-            index= SHOW_UBITS(name, gb, nb_bits) + code;\
-            code = table[index][0];\
-            n    = table[index][1];\
-        }\
-    }\
-    SKIP_BITS(name, gb, n)\
-}
-
-#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\
-{\
-    int n, nb_bits;\
-    unsigned int index;\
-\
-    index= SHOW_UBITS(name, gb, bits);\
-    level = table[index].level;\
-    n     = table[index].len;\
-\
-    if(max_depth > 1 && n < 0){\
-        SKIP_BITS(name, gb, bits)\
-        if(need_update){\
-            UPDATE_CACHE(name, gb)\
-        }\
-\
-        nb_bits = -n;\
-\
-        index= SHOW_UBITS(name, gb, nb_bits) + level;\
-        level = table[index].level;\
-        n     = table[index].len;\
-    }\
-    run= table[index].run;\
-    SKIP_BITS(name, gb, n)\
-}
+#define GET_VLC(code, name, gb, table, bits, max_depth) do {    \
+        int n, nb_bits;                                         \
+        unsigned int index;                                     \
+                                                                \
+        index = SHOW_UBITS(name, gb, bits);                     \
+        code  = table[index][0];                                \
+        n     = table[index][1];                                \
+                                                                \
+        if (max_depth > 1 && n < 0) {                           \
+            LAST_SKIP_BITS(name, gb, bits);                     \
+            UPDATE_CACHE(name, gb);                             \
+                                                                \
+            nb_bits = -n;                                       \
+                                                                \
+            index = SHOW_UBITS(name, gb, nb_bits) + code;       \
+            code  = table[index][0];                            \
+            n     = table[index][1];                            \
+            if (max_depth > 2 && n < 0) {                       \
+                LAST_SKIP_BITS(name, gb, nb_bits);              \
+                UPDATE_CACHE(name, gb);                         \
+                                                                \
+                nb_bits = -n;                                   \
+                                                                \
+                index = SHOW_UBITS(name, gb, nb_bits) + code;   \
+                code  = table[index][0];                        \
+                n     = table[index][1];                        \
+            }                                                   \
+        }                                                       \
+        SKIP_BITS(name, gb, n);                                 \
+    } while (0)
+
+#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update) do { \
+        int n, nb_bits;                                                 \
+        unsigned int index;                                             \
+                                                                        \
+        index = SHOW_UBITS(name, gb, bits);                             \
+        level = table[index].level;                                     \
+        n     = table[index].len;                                       \
+                                                                        \
+        if (max_depth > 1 && n < 0) {                                   \
+            SKIP_BITS(name, gb, bits);                                  \
+            if (need_update) {                                          \
+                UPDATE_CACHE(name, gb);                                 \
+            }                                                           \
+                                                                        \
+            nb_bits = -n;                                               \
+                                                                        \
+            index = SHOW_UBITS(name, gb, nb_bits) + level;              \
+            level = table[index].level;                                 \
+            n     = table[index].len;                                   \
+        }                                                               \
+        run = table[index].run;                                         \
+        SKIP_BITS(name, gb, n);                                         \
+    } while (0)
 
 
 /**
@@ -605,53 +516,81 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
 {
     int code;
 
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
+    OPEN_READER(re, s);
+    UPDATE_CACHE(re, s);
 
-    GET_VLC(code, re, s, table, bits, max_depth)
+    GET_VLC(code, re, s, table, bits, max_depth);
 
-    CLOSE_READER(re, s)
+    CLOSE_READER(re, s);
     return code;
 }
 
+static inline int decode012(GetBitContext *gb){
+    int n;
+    n = get_bits1(gb);
+    if (n == 0)
+        return 0;
+    else
+        return get_bits1(gb) + 1;
+}
+
+static inline int decode210(GetBitContext *gb){
+    if (get_bits1(gb))
+        return 0;
+    else
+        return 2 - get_bits1(gb);
+}
+
+static inline int get_bits_left(GetBitContext *gb)
+{
+    return gb->size_in_bits - get_bits_count(gb);
+}
+
 //#define TRACE
 
 #ifdef TRACE
 static inline void print_bin(int bits, int n){
     int i;
 
-    for(i=n-1; i>=0; i--){
+    for (i = n-1; i >= 0; i--) {
         av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1);
     }
-    for(i=n; i<24; i++)
+    for (i = n; i < 24; i++)
         av_log(NULL, AV_LOG_DEBUG, " ");
 }
 
-static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
-    int r= get_bits(s, n);
+static inline int get_bits_trace(GetBitContext *s, int n, char *file,
+                                 const char *func, int line){
+    int r = get_bits(s, n);
 
     print_bin(r, n);
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line);
+    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n",
+           r, n, r, get_bits_count(s)-n, file, func, line);
     return r;
 }
-static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, const char *func, int line){
-    int show= show_bits(s, 24);
-    int pos= get_bits_count(s);
-    int r= get_vlc2(s, table, bits, max_depth);
-    int len= get_bits_count(s) - pos;
-    int bits2= show>>(24-len);
+static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2],
+                                int bits, int max_depth, char *file,
+                                const char *func, int line){
+    int show  = show_bits(s, 24);
+    int pos   = get_bits_count(s);
+    int r     = get_vlc2(s, table, bits, max_depth);
+    int len   = get_bits_count(s) - pos;
+    int bits2 = show >> (24-len);
 
     print_bin(bits2, len);
 
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line);
+    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n",
+           bits2, len, r, pos, file, func, line);
     return r;
 }
-static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
-    int show= show_bits(s, n);
-    int r= get_xbits(s, n);
+static inline int get_xbits_trace(GetBitContext *s, int n, char *file,
+                                  const char *func, int line){
+    int show = show_bits(s, n);
+    int r    = get_xbits(s, n);
 
     print_bin(show, n);
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line);
+    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n",
+           show, n, r, get_bits_count(s)-n, file, func, line);
     return r;
 }
 
@@ -667,25 +606,4 @@ static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const cha
 #define tprintf(p, ...) {}
 #endif
 
-static inline int decode012(GetBitContext *gb){
-    int n;
-    n = get_bits1(gb);
-    if (n == 0)
-        return 0;
-    else
-        return get_bits1(gb) + 1;
-}
-
-static inline int decode210(GetBitContext *gb){
-    if (get_bits1(gb))
-        return 0;
-    else
-        return 2 - get_bits1(gb);
-}
-
-static inline int get_bits_left(GetBitContext *gb)
-{
-    return gb->size_in_bits - get_bits_count(gb);
-}
-
 #endif /* AVCODEC_GET_BITS_H */
diff --git a/ffmpeg-mt/libavcodec/gif.c b/ffmpeg-mt/libavcodec/gif.c
index a52f140..6fb7051 100644
--- a/ffmpeg-mt/libavcodec/gif.c
+++ b/ffmpeg-mt/libavcodec/gif.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2002 Francois Revol
  * Copyright (c) 2006 Baptiste Coudurier
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -166,7 +166,7 @@ static int gif_encode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec gif_encoder = {
+AVCodec ff_gif_encoder = {
     "gif",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_GIF,
diff --git a/ffmpeg-mt/libavcodec/gifdec.c b/ffmpeg-mt/libavcodec/gifdec.c
index 4cc8001..934c944 100644
--- a/ffmpeg-mt/libavcodec/gifdec.c
+++ b/ffmpeg-mt/libavcodec/gifdec.c
@@ -3,26 +3,26 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2006 Baptiste Coudurier
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 //#define DEBUG
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "lzw.h"
@@ -76,9 +76,8 @@ static int gif_read_image(GifState *s)
     is_interleaved = flags & 0x40;
     has_local_palette = flags & 0x80;
     bits_per_pixel = (flags & 0x07) + 1;
-#ifdef DEBUG
-    dprintf(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height);
-#endif
+
+    av_dlog(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height);
 
     if (has_local_palette) {
         bytestream_get_buffer(&s->bytestream, s->local_palette, 3 * (1 << bits_per_pixel));
@@ -163,9 +162,9 @@ static int gif_read_extension(GifState *s)
     /* extension */
     ext_code = bytestream_get_byte(&s->bytestream);
     ext_len = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
-    dprintf(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len);
-#endif
+
+    av_dlog(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len);
+
     switch(ext_code) {
     case 0xf9:
         if (ext_len != 4)
@@ -179,11 +178,11 @@ static int gif_read_extension(GifState *s)
         else
             s->transparent_color_index = -1;
         s->gce_disposal = (gce_flags >> 2) & 0x7;
-#ifdef DEBUG
-        dprintf(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n",
+
+        av_dlog(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n",
                gce_flags, s->gce_delay,
                s->transparent_color_index, s->gce_disposal);
-#endif
+
         ext_len = bytestream_get_byte(&s->bytestream);
         break;
     }
@@ -194,9 +193,8 @@ static int gif_read_extension(GifState *s)
         for (i = 0; i < ext_len; i++)
             bytestream_get_byte(&s->bytestream);
         ext_len = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
-        dprintf(s->avctx, "gif: ext_len1=%d\n", ext_len);
-#endif
+
+        av_dlog(s->avctx, "gif: ext_len1=%d\n", ext_len);
     }
     return 0;
 }
@@ -232,11 +230,11 @@ static int gif_read_header1(GifState *s)
     s->bits_per_pixel = (v & 0x07) + 1;
     s->background_color_index = bytestream_get_byte(&s->bytestream);
     bytestream_get_byte(&s->bytestream);                /* ignored */
-#ifdef DEBUG
-    dprintf(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n",
+
+    av_dlog(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n",
            s->screen_width, s->screen_height, s->bits_per_pixel,
            has_global_palette);
-#endif
+
     if (has_global_palette) {
         n = 1 << s->bits_per_pixel;
         if (s->bytestream_end < s->bytestream + n * 3)
@@ -250,9 +248,9 @@ static int gif_parse_next_image(GifState *s)
 {
     while (s->bytestream < s->bytestream_end) {
         int code = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
-        dprintf(s->avctx, "gif: code=%02x '%c'\n", code, code);
-#endif
+
+        av_dlog(s->avctx, "gif: code=%02x '%c'\n", code, code);
+
         switch (code) {
         case ',':
             return gif_read_image(s);
@@ -327,7 +325,7 @@ static av_cold int gif_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec gif_decoder = {
+AVCodec ff_gif_decoder = {
     "gif",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_GIF,
diff --git a/ffmpeg-mt/libavcodec/golomb.c b/ffmpeg-mt/libavcodec/golomb.c
index 937ac22..550c41e 100644
--- a/ffmpeg-mt/libavcodec/golomb.c
+++ b/ffmpeg-mt/libavcodec/golomb.c
@@ -2,20 +2,20 @@
  * exp golomb vlc stuff
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/golomb.h b/ffmpeg-mt/libavcodec/golomb.h
index 90eeb30..83d277f 100644
--- a/ffmpeg-mt/libavcodec/golomb.h
+++ b/ffmpeg-mt/libavcodec/golomb.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2004 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/gsmdec.c b/ffmpeg-mt/libavcodec/gsmdec.c
index b316810..693febd 100644
--- a/ffmpeg-mt/libavcodec/gsmdec.c
+++ b/ffmpeg-mt/libavcodec/gsmdec.c
@@ -2,20 +2,20 @@
  * gsm 06.10 decoder
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -84,7 +84,7 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
     return avctx->block_align;
 }
 
-AVCodec gsm_decoder = {
+AVCodec ff_gsm_decoder = {
     "gsm",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_GSM,
@@ -96,7 +96,7 @@ AVCodec gsm_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("GSM"),
 };
 
-AVCodec gsm_ms_decoder = {
+AVCodec ff_gsm_ms_decoder = {
     "gsm_ms",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_GSM_MS,
diff --git a/ffmpeg-mt/libavcodec/gsmdec_data.c b/ffmpeg-mt/libavcodec/gsmdec_data.c
index 4324ea2..8b75bb6 100644
--- a/ffmpeg-mt/libavcodec/gsmdec_data.c
+++ b/ffmpeg-mt/libavcodec/gsmdec_data.c
@@ -2,20 +2,20 @@
  * gsm 06.10 decoder data
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/gsmdec_data.h b/ffmpeg-mt/libavcodec/gsmdec_data.h
index 6b05bf6..32cd01e 100644
--- a/ffmpeg-mt/libavcodec/gsmdec_data.h
+++ b/ffmpeg-mt/libavcodec/gsmdec_data.h
@@ -2,20 +2,20 @@
  * gsm 06.10 decoder data
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/gsmdec_template.c b/ffmpeg-mt/libavcodec/gsmdec_template.c
index b63ec9e..7e57c71 100644
--- a/ffmpeg-mt/libavcodec/gsmdec_template.c
+++ b/ffmpeg-mt/libavcodec/gsmdec_template.c
@@ -2,20 +2,20 @@
  * gsm 06.10 decoder
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h261.c b/ffmpeg-mt/libavcodec/h261.c
index 562a151..eab3640 100644
--- a/ffmpeg-mt/libavcodec/h261.c
+++ b/ffmpeg-mt/libavcodec/h261.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2004 Maarten Daniels
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h261.h b/ffmpeg-mt/libavcodec/h261.h
index 5b60dd6..6461329 100644
--- a/ffmpeg-mt/libavcodec/h261.h
+++ b/ffmpeg-mt/libavcodec/h261.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2004 Maarten Daniels
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h261_parser.c b/ffmpeg-mt/libavcodec/h261_parser.c
index c32300d..20c2862 100644
--- a/ffmpeg-mt/libavcodec/h261_parser.c
+++ b/ffmpeg-mt/libavcodec/h261_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2004 Maarten Daniels
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -81,7 +81,7 @@ static int h261_parse(AVCodecParserContext *s,
     return next;
 }
 
-AVCodecParser h261_parser = {
+AVCodecParser ff_h261_parser = {
     { CODEC_ID_H261 },
     sizeof(ParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/h261data.h b/ffmpeg-mt/libavcodec/h261data.h
index 82bae16..2c61015 100644
--- a/ffmpeg-mt/libavcodec/h261data.h
+++ b/ffmpeg-mt/libavcodec/h261data.h
@@ -2,20 +2,20 @@
  * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  * copyright (c) 2004 Maarten Daniels
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h261dec.c b/ffmpeg-mt/libavcodec/h261dec.c
index 3809a01..93c5cb4 100644
--- a/ffmpeg-mt/libavcodec/h261dec.c
+++ b/ffmpeg-mt/libavcodec/h261dec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2004 Maarten Daniels
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -553,8 +553,8 @@ static int h261_decode_frame(AVCodecContext *avctx,
     int ret;
     AVFrame *pict = data;
 
-    dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
-    dprintf(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
+    av_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
+    av_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
     s->flags= avctx->flags;
     s->flags2= avctx->flags2;
 
@@ -595,12 +595,14 @@ retry:
         goto retry;
     }
 
-    // for hurry_up==5
+    // for skipping the frame
     s->current_picture.pict_type= s->pict_type;
     s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
 
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
+#endif
     if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
        ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
        || avctx->skip_frame >= AVDISCARD_ALL)
@@ -641,7 +643,7 @@ static av_cold int h261_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec h261_decoder = {
+AVCodec ff_h261_decoder = {
     "h261",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H261,
diff --git a/ffmpeg-mt/libavcodec/h261enc.c b/ffmpeg-mt/libavcodec/h261enc.c
index c85ee8b..27746d5 100644
--- a/ffmpeg-mt/libavcodec/h261enc.c
+++ b/ffmpeg-mt/libavcodec/h261enc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2004 Maarten Daniels
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -321,7 +321,7 @@ static void h261_encode_block(H261Context * h, DCTELEM * block, int n){
     }
 }
 
-AVCodec h261_encoder = {
+AVCodec ff_h261_encoder = {
     "h261",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H261,
diff --git a/ffmpeg-mt/libavcodec/h263.c b/ffmpeg-mt/libavcodec/h263.c
index 50ea6ce..d816a59 100644
--- a/ffmpeg-mt/libavcodec/h263.c
+++ b/ffmpeg-mt/libavcodec/h263.c
@@ -5,20 +5,20 @@
  * Copyright (c) 2001 Juan J. Sierralta P
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h263.h b/ffmpeg-mt/libavcodec/h263.h
index 6c05565..cdbe44e 100644
--- a/ffmpeg-mt/libavcodec/h263.h
+++ b/ffmpeg-mt/libavcodec/h263.h
@@ -1,20 +1,20 @@
 /*
  * H263 internal header
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVCODEC_H263_H
diff --git a/ffmpeg-mt/libavcodec/h263_parser.c b/ffmpeg-mt/libavcodec/h263_parser.c
index 16c5ea5..4b9fc11 100644
--- a/ffmpeg-mt/libavcodec/h263_parser.c
+++ b/ffmpeg-mt/libavcodec/h263_parser.c
@@ -2,20 +2,20 @@
  * H.263 parser
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -83,7 +83,7 @@ static int h263_parse(AVCodecParserContext *s,
     return next;
 }
 
-AVCodecParser h263_parser = {
+AVCodecParser ff_h263_parser = {
     { CODEC_ID_H263 },
     sizeof(ParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/h263_parser.h b/ffmpeg-mt/libavcodec/h263_parser.h
index 565a222..5bd715f 100644
--- a/ffmpeg-mt/libavcodec/h263_parser.h
+++ b/ffmpeg-mt/libavcodec/h263_parser.h
@@ -2,20 +2,20 @@
  * H.263 parser
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h263data.h b/ffmpeg-mt/libavcodec/h263data.h
index 81e3ddd..966da56 100644
--- a/ffmpeg-mt/libavcodec/h263data.h
+++ b/ffmpeg-mt/libavcodec/h263data.h
@@ -4,20 +4,20 @@
  * copyright (c) 2001 Juan J. Sierralta P
  * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h263dec.c b/ffmpeg-mt/libavcodec/h263dec.c
index 3a33569..3bff7db 100644
--- a/ffmpeg-mt/libavcodec/h263dec.c
+++ b/ffmpeg-mt/libavcodec/h263dec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -594,20 +594,24 @@ retry:
     if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I))
         s->gob_index = ff_h263_get_gob_height(s);
 
-    // for hurry_up==5
+    // for skipping the frame
     s->current_picture.pict_type= s->pict_type;
     s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
 
     /* skip B-frames if we don't have reference frames */
     if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
+#if FF_API_HURRY_UP
     /* skip b frames if we are in a hurry */
     if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
+#endif
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
        || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
        ||  avctx->skip_frame >= AVDISCARD_ALL)
         return get_consumed_bytes(s, buf_size);
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
+#endif
 
     if(s->next_p_frame_damaged){
         if(s->pict_type==FF_B_TYPE)
@@ -740,7 +744,7 @@ av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
     return get_consumed_bytes(s, buf_size);
 }
 
-AVCodec h263_decoder = {
+AVCodec ff_h263_decoder = {
     "h263",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H263,
diff --git a/ffmpeg-mt/libavcodec/h264.c b/ffmpeg-mt/libavcodec/h264.c
index b7ffb78..2bb6a61 100644
--- a/ffmpeg-mt/libavcodec/h264.c
+++ b/ffmpeg-mt/libavcodec/h264.c
@@ -1,21 +1,21 @@
 /*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
+ * H.26L/H.264/AVC/JVT/14496-10/... decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
  * @author Michael Niedermayer <michaelni at gmx.at>
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "internal.h"
 #include "dsputil.h"
 #include "avcodec.h"
@@ -33,7 +33,6 @@
 #include "h264.h"
 #include "h264data.h"
 #include "h264_mvpred.h"
-#include "h264_parser.h"
 #include "golomb.h"
 #include "mathops.h"
 #include "rectangle.h"
@@ -234,7 +233,11 @@ nsc:
     return dst;
 }
 
-int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){
+/**
+ * Identify the exact end of the bitstream
+ * @return the length of the trailing, or 0 if damaged
+ */
+static int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){
     int v= *src;
     int r;
 
@@ -382,6 +385,93 @@ static void await_references(H264Context *h){
     }
 }
 
+#if 0
+/**
+ * DCT transforms the 16 dc values.
+ * @param qp quantization parameter ??? FIXME
+ */
+static void h264_luma_dc_dct_c(DCTELEM *block/*, int qp*/){
+//    const int qmul= dequant_coeff[qp][0];
+    int i;
+    int temp[16]; //FIXME check if this is a good idea
+    static const int x_offset[4]={0, 1*stride, 4* stride,  5*stride};
+    static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride};
+
+    for(i=0; i<4; i++){
+        const int offset= y_offset[i];
+        const int z0= block[offset+stride*0] + block[offset+stride*4];
+        const int z1= block[offset+stride*0] - block[offset+stride*4];
+        const int z2= block[offset+stride*1] - block[offset+stride*5];
+        const int z3= block[offset+stride*1] + block[offset+stride*5];
+
+        temp[4*i+0]= z0+z3;
+        temp[4*i+1]= z1+z2;
+        temp[4*i+2]= z1-z2;
+        temp[4*i+3]= z0-z3;
+    }
+
+    for(i=0; i<4; i++){
+        const int offset= x_offset[i];
+        const int z0= temp[4*0+i] + temp[4*2+i];
+        const int z1= temp[4*0+i] - temp[4*2+i];
+        const int z2= temp[4*1+i] - temp[4*3+i];
+        const int z3= temp[4*1+i] + temp[4*3+i];
+
+        block[stride*0 +offset]= (z0 + z3)>>1;
+        block[stride*2 +offset]= (z1 + z2)>>1;
+        block[stride*8 +offset]= (z1 - z2)>>1;
+        block[stride*10+offset]= (z0 - z3)>>1;
+    }
+}
+#endif
+
+#undef xStride
+#undef stride
+
+static void chroma_dc_dequant_idct_c(DCTELEM *block, int qmul){
+    const int stride= 16*2;
+    const int xStride= 16;
+    int a,b,c,d,e;
+
+    a= block[stride*0 + xStride*0];
+    b= block[stride*0 + xStride*1];
+    c= block[stride*1 + xStride*0];
+    d= block[stride*1 + xStride*1];
+
+    e= a-b;
+    a= a+b;
+    b= c-d;
+    c= c+d;
+
+    block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;
+    block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;
+    block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;
+    block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;
+}
+
+#if 0
+static void chroma_dc_dct_c(DCTELEM *block){
+    const int stride= 16*2;
+    const int xStride= 16;
+    int a,b,c,d,e;
+
+    a= block[stride*0 + xStride*0];
+    b= block[stride*0 + xStride*1];
+    c= block[stride*1 + xStride*0];
+    d= block[stride*1 + xStride*1];
+
+    e= a-b;
+    a= a+b;
+    b= c-d;
+    c= c+d;
+
+    block[stride*0 + xStride*0]= (a+c);
+    block[stride*0 + xStride*1]= (e+b);
+    block[stride*1 + xStride*0]= (a-c);
+    block[stride*1 + xStride*1]= (e-b);
+}
+#endif
+
 static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list,
                            uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
                            int src_x_offset, int src_y_offset,
@@ -407,7 +497,7 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square,
        || full_my < 0-extra_height
        || full_mx + 16/*FIXME*/ > pic_width + extra_width
        || full_my + 16/*FIXME*/ > pic_height + extra_height){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
             src_y= s->edge_emu_buffer + 2 + 2*h->mb_linesize;
         emu=1;
     }
@@ -428,13 +518,13 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square,
     src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize;
 
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
             src_cb= s->edge_emu_buffer;
     }
     chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx&7, my&7);
 
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
             src_cr= s->edge_emu_buffer;
     }
     chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx&7, my&7);
@@ -665,7 +755,7 @@ static void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t
 }
 
 
-static void free_tables(H264Context *h){
+static void free_tables(H264Context *h, int free_rbsp){
     int i;
     H264Context *hx;
     av_freep(&h->intra4x4_pred_mode);
@@ -688,10 +778,12 @@ static void free_tables(H264Context *h){
         av_freep(&hx->top_borders[1]);
         av_freep(&hx->top_borders[0]);
         av_freep(&hx->s.obmc_scratchpad);
-        av_freep(&hx->rbsp_buffer[1]);
-        av_freep(&hx->rbsp_buffer[0]);
-        hx->rbsp_buffer_size[0] = 0;
-        hx->rbsp_buffer_size[1] = 0;
+        if (free_rbsp){
+            av_freep(&hx->rbsp_buffer[1]);
+            av_freep(&hx->rbsp_buffer[0]);
+            hx->rbsp_buffer_size[0] = 0;
+            hx->rbsp_buffer_size[1] = 0;
+        }
         if (i) av_freep(&h->thread_context[i]);
     }
 }
@@ -799,7 +891,7 @@ int ff_h264_alloc_tables(H264Context *h){
 
     return 0;
 fail:
-    free_tables(h);
+    free_tables(h, 1);
     return -1;
 }
 
@@ -1056,7 +1148,7 @@ static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContex
     copy_fields(h, h1, short_ref, cabac_init_idc);
 
     copy_picture_range(h->short_ref,   h1->short_ref,   32, s, s1);
-    copy_picture_range(h->long_ref,    h1->long_ref,    32,  s, s1);
+    copy_picture_range(h->long_ref,    h1->long_ref,    32, s, s1);
     copy_picture_range(h->delayed_pic, h1->delayed_pic, MAX_DELAYED_PIC_COUNT+2, s, s1);
 
     h->last_slice_type = h1->last_slice_type;
@@ -1271,6 +1363,8 @@ static void decode_postinit(H264Context *h){
 
     if(out_of_order || pics > s->avctx->has_b_frames){
         out->reference &= ~DELAYED_PIC_REF;
+        out->owner2 = s; // for frame threading, the owner must be the second field's thread
+                         // or else the first thread can release the picture and reuse it unsafely
         for(i=out_idx; h->delayed_pic[i]; i++)
             h->delayed_pic[i] = h->delayed_pic[i+1];
     }
@@ -1609,19 +1703,17 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
                     }
                 }
             }else{
-                int chroma_qpu = h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0];
-                int chroma_qpv = h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0];
                 if(is_h264){
                     if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ])
-                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu );
+                        chroma_dc_dequant_idct_c(h->mb + 16*16     , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
                     if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ])
-                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv );
+                        chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
                     h->h264dsp.h264_idct_add8(dest, block_offset,
                                               h->mb, uvlinesize,
                                               h->non_zero_count_cache);
                 }else{
-                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu );
-                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv );
+                    chroma_dc_dequant_idct_c(h->mb + 16*16     , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
+                    chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
                     for(i=16; i<16+8; i++){
                         if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
                             uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];
@@ -2005,6 +2097,33 @@ static void clone_slice(H264Context *dst, H264Context *src)
 }
 
 /**
+ * computes profile from profile_idc and constraint_set?_flags
+ *
+ * @param sps SPS
+ *
+ * @return profile as defined by FF_PROFILE_H264_*
+ */
+int ff_h264_get_profile(SPS *sps)
+{
+    int profile = sps->profile_idc;
+
+    switch(sps->profile_idc) {
+    case FF_PROFILE_H264_BASELINE:
+        // constraint_set1_flag set to 1
+        profile |= (sps->constraint_set_flags & 1<<1) ? FF_PROFILE_H264_CONSTRAINED : 0;
+        break;
+    case FF_PROFILE_H264_HIGH_10:
+    case FF_PROFILE_H264_HIGH_422:
+    case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
+        // constraint_set3_flag set to 1
+        profile |= (sps->constraint_set_flags & 1<<3) ? FF_PROFILE_H264_INTRA : 0;
+        break;
+    }
+
+    return profile;
+}
+
+/**
  * decodes a slice header.
  * This will also call MPV_common_init() and frame_start() as needed.
  *
@@ -2083,7 +2202,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
     }
     h->sps = *h0->sps_buffers[h->pps.sps_id];
 
-    s->avctx->profile = h->sps.profile_idc;
+    s->avctx->profile = ff_h264_get_profile(&h->sps);
     s->avctx->level   = h->sps.level_idc;
     s->avctx->refs    = h->sps.ref_frame_count;
 
@@ -2110,7 +2229,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
             av_log_missing_feature(s->avctx, "Width/height changing with threads is", 0);
             return -1;   // width / height changed during parallelized decoding
         }
-        free_tables(h);
+        free_tables(h, 0);
         flush_dpb(s->avctx);
         MPV_common_end(s);
     }
@@ -2268,9 +2387,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
             s0->first_field = FIELD_PICTURE;
         }
 
-        if((!FIELD_PICTURE || s0->first_field) && ff_h264_frame_start(h) < 0) {
-            s0->first_field = 0;
-            return -1;
+        if(!FIELD_PICTURE || s0->first_field) {
+            if (ff_h264_frame_start(h) < 0) {
+                s0->first_field = 0;
+                return -1;
+            }
+        } else {
+            ff_release_unused_pictures(s, 0);
         }
     }
     if(h != h0)
@@ -2358,9 +2481,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
     if(h->slice_type_nos!=FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
         return -1;
 
-    //FIXME mt gives valgrind warnings and crashes if this is uncommented
-    /*
-
     if(h->slice_type_nos!=FF_I_TYPE){
         s->last_picture_ptr= &h->ref_list[0][0];
         ff_copy_picture(&s->last_picture, s->last_picture_ptr);
@@ -2370,8 +2490,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
         ff_copy_picture(&s->next_picture, s->next_picture_ptr);
     }
 
-    */
-
     if(   (h->pps.weighted_pred          && h->slice_type_nos == FF_P_TYPE )
        ||  (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== FF_B_TYPE ) )
         pred_weight_table(h);
@@ -3173,8 +3291,12 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
 
         buf_index += consumed;
 
-        if(  (s->hurry_up == 1 && h->nal_ref_idc  == 0) //FIXME do not discard SEI id
-           ||(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0))
+        //FIXME do not discard SEI id
+        if(
+#if FF_API_HURRY_UP
+           (s->hurry_up == 1 && h->nal_ref_idc  == 0) ||
+#endif
+           (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0))
             continue;
 
       again:
@@ -3210,7 +3332,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
                     ff_vdpau_h264_picture_start(s);
             }
 
-            if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
+            if(hx->redundant_pic_count==0
+#if FF_API_HURRY_UP
+               && hx->s.hurry_up < 5
+#endif
                && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
@@ -3248,7 +3373,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
 
             if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
                && s->context_initialized
+#if FF_API_HURRY_UP
                && s->hurry_up < 5
+#endif
                && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
@@ -3371,7 +3498,12 @@ static int decode_frame(AVCodecContext *avctx,
     }
 
     if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
-        if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
+        if (avctx->skip_frame >= AVDISCARD_NONREF
+#if FF_API_HURRY_UP
+                || s->hurry_up
+#endif
+           )
+            return 0;
         av_log(avctx, AV_LOG_ERROR, "no frame!\n");
         return -1;
     }
@@ -3598,7 +3730,7 @@ av_cold void ff_h264_free_context(H264Context *h)
 {
     int i;
 
-    free_tables(h); //FIXME cleanup init stuff perhaps
+    free_tables(h, 1); //FIXME cleanup init stuff perhaps
 
     for(i = 0; i < MAX_SPS_COUNT; i++)
         av_freep(h->sps_buffers + i);
@@ -3621,8 +3753,24 @@ av_cold int ff_h264_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
+static const AVProfile profiles[] = {
+    { FF_PROFILE_H264_BASELINE,             "Baseline"              },
+    { FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline"  },
+    { FF_PROFILE_H264_MAIN,                 "Main"                  },
+    { FF_PROFILE_H264_EXTENDED,             "Extended"              },
+    { FF_PROFILE_H264_HIGH,                 "High"                  },
+    { FF_PROFILE_H264_HIGH_10,              "High 10"               },
+    { FF_PROFILE_H264_HIGH_10_INTRA,        "High 10 Intra"         },
+    { FF_PROFILE_H264_HIGH_422,             "High 4:2:2"            },
+    { FF_PROFILE_H264_HIGH_422_INTRA,       "High 4:2:2 Intra"      },
+    { FF_PROFILE_H264_HIGH_444,             "High 4:4:4"            },
+    { FF_PROFILE_H264_HIGH_444_PREDICTIVE,  "High 4:4:4 Predictive" },
+    { FF_PROFILE_H264_HIGH_444_INTRA,       "High 4:4:4 Intra"      },
+    { FF_PROFILE_H264_CAVLC_444,            "CAVLC 4:4:4"           },
+    { FF_PROFILE_UNKNOWN },
+};
 
-AVCodec h264_decoder = {
+AVCodec ff_h264_decoder = {
     "h264",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H264,
@@ -3635,11 +3783,12 @@ AVCodec h264_decoder = {
     .flush= flush_dpb,
     .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
     .init_thread_copy      = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
-    .update_thread_context = ONLY_IF_THREADS_ENABLED(decode_update_thread_context)
+    .update_thread_context = ONLY_IF_THREADS_ENABLED(decode_update_thread_context),
+    .profiles = NULL_IF_CONFIG_SMALL(profiles),
 };
 
 #if CONFIG_H264_VDPAU_DECODER
-AVCodec h264_vdpau_decoder = {
+AVCodec ff_h264_vdpau_decoder = {
     "h264_vdpau",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H264,
@@ -3652,5 +3801,6 @@ AVCodec h264_vdpau_decoder = {
     .flush= flush_dpb,
     .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
     .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_H264, PIX_FMT_NONE},
+    .profiles = NULL_IF_CONFIG_SMALL(profiles),
 };
 #endif
diff --git a/ffmpeg-mt/libavcodec/h264.h b/ffmpeg-mt/libavcodec/h264.h
index 8b9134a..af40148 100644
--- a/ffmpeg-mt/libavcodec/h264.h
+++ b/ffmpeg-mt/libavcodec/h264.h
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -209,6 +209,7 @@ typedef struct SPS{
     int bit_depth_luma;                ///< bit_depth_luma_minus8 + 8
     int bit_depth_chroma;              ///< bit_depth_chroma_minus8 + 8
     int residual_color_transform_flag; ///< residual_colour_transform_flag
+    int constraint_set_flags;          ///< constraint_set[0-3]_flag
 }SPS;
 
 /**
@@ -407,7 +408,6 @@ typedef struct H264Context{
 
     DECLARE_ALIGNED(16, DCTELEM, mb)[16*24];
     DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[16];
-    DECLARE_ALIGNED(16, DCTELEM, mb_chroma_dc)[2][4];
     DCTELEM mb_padding[256];        ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
 
     /**
@@ -615,6 +615,11 @@ int ff_h264_decode_sei(H264Context *h);
 int ff_h264_decode_seq_parameter_set(H264Context *h);
 
 /**
+ * compute profile from sps
+ */
+int ff_h264_get_profile(SPS *sps);
+
+/**
  * Decode PPS
  */
 int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
@@ -629,12 +634,6 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
 const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length);
 
 /**
- * Identify the exact end of the bitstream
- * @return the length of the trailing, or 0 if damaged
- */
-int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src);
-
-/**
  * Free any data that may have been allocated in the H264 context like SPS, PPS etc.
  */
 av_cold void ff_h264_free_context(H264Context *h);
diff --git a/ffmpeg-mt/libavcodec/h264_cabac.c b/ffmpeg-mt/libavcodec/h264_cabac.c
index 5aad4d7..02cf05e 100644
--- a/ffmpeg-mt/libavcodec/h264_cabac.c
+++ b/ffmpeg-mt/libavcodec/h264_cabac.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... cabac decoding
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1373,6 +1373,8 @@ decode_intra_mb:
             pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode );
             if( pred_mode < 0 ) return -1;
             h->chroma_pred_mode= pred_mode;
+        } else {
+            h->chroma_pred_mode= DC_128_PRED8x8;
         }
     } else if( partition_count == 4 ) {
         int i, j, sub_partition_count[4], list, ref[2][4];
@@ -1687,10 +1689,9 @@ decode_intra_mb:
 
         if( cbp&0x30 ){
             int c;
-            AV_ZERO128(h->mb_chroma_dc);
             for( c = 0; c < 2; c++ ) {
                 //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
-                decode_cabac_residual_dc(h, h->mb_chroma_dc[c], 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
+                decode_cabac_residual_dc(h, h->mb + 256 + 16*4*c, 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
             }
         }
 
diff --git a/ffmpeg-mt/libavcodec/h264_cavlc.c b/ffmpeg-mt/libavcodec/h264_cavlc.c
index 55ff022..a22a9e2 100644
--- a/ffmpeg-mt/libavcodec/h264_cavlc.c
+++ b/ffmpeg-mt/libavcodec/h264_cavlc.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... cavlc bitstream decoding
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -665,6 +665,8 @@ decode_intra_mb:
             if(pred_mode < 0)
                 return -1;
             h->chroma_pred_mode= pred_mode;
+        } else {
+            h->chroma_pred_mode = DC_128_PRED8x8;
         }
     }else if(partition_count==4){
         int i, j, sub_partition_count[4], list, ref[2][4];
@@ -987,9 +989,8 @@ decode_intra_mb:
         }
 
         if(cbp&0x30){
-            AV_ZERO128(h->mb_chroma_dc);
             for(chroma_idx=0; chroma_idx<2; chroma_idx++)
-                if( decode_residual(h, gb, h->mb_chroma_dc[chroma_idx], CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){
+                if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){
                     return -1;
                 }
         }
diff --git a/ffmpeg-mt/libavcodec/h264_direct.c b/ffmpeg-mt/libavcodec/h264_direct.c
index a26a51a..e14ce20 100644
--- a/ffmpeg-mt/libavcodec/h264_direct.c
+++ b/ffmpeg-mt/libavcodec/h264_direct.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... direct mb/block decoding
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h264_loopfilter.c b/ffmpeg-mt/libavcodec/h264_loopfilter.c
index 710e037..619ab19 100644
--- a/ffmpeg-mt/libavcodec/h264_loopfilter.c
+++ b/ffmpeg-mt/libavcodec/h264_loopfilter.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... loop filter
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h264_mp4toannexb_bsf.c b/ffmpeg-mt/libavcodec/h264_mp4toannexb_bsf.c
index e2ee10a..bc49b14 100644
--- a/ffmpeg-mt/libavcodec/h264_mp4toannexb_bsf.c
+++ b/ffmpeg-mt/libavcodec/h264_mp4toannexb_bsf.c
@@ -2,20 +2,20 @@
  * H.264 MP4 to Annex B byte stream format filter
  * Copyright (c) 2007 Benoit Fouet <benoit.fouet at free.fr>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -75,7 +75,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
     if (!ctx->extradata_parsed) {
         uint16_t unit_size;
         uint64_t total_size = 0;
-        uint8_t *out = NULL, unit_nb, sps_done = 0;
+        uint8_t *out = NULL, unit_nb, sps_done = 0, sps_seen = 0, pps_seen = 0;
         const uint8_t *extradata = avctx->extradata+4;
         static const uint8_t nalu_header[4] = {0, 0, 0, 1};
 
@@ -89,7 +89,13 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
         if (!unit_nb) {
             unit_nb = *extradata++; /* number of pps unit(s) */
             sps_done++;
+
+            if (unit_nb)
+                pps_seen = 1;
+        } else {
+            sps_seen = 1;
         }
+
         while (unit_nb--) {
             void *tmp;
 
@@ -110,11 +116,21 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
             memcpy(out+total_size-unit_size,   extradata+2, unit_size);
             extradata += 2+unit_size;
 
-            if (!unit_nb && !sps_done++)
+            if (!unit_nb && !sps_done++) {
                 unit_nb = *extradata++; /* number of pps unit(s) */
+                if (unit_nb)
+                    pps_seen = 1;
+            }
         }
 
-        memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+        if(out)
+            memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
+        if (!sps_seen)
+            av_log(avctx, AV_LOG_WARNING, "Warning: SPS NALU missing or invalid. The resulting stream may not play.\n");
+        if (!pps_seen)
+            av_log(avctx, AV_LOG_WARNING, "Warning: PPS NALU missing or invalid. The resulting stream may not play.\n");
+
         av_free(avctx->extradata);
         avctx->extradata      = out;
         avctx->extradata_size = total_size;
@@ -169,7 +185,7 @@ fail:
     return AVERROR(EINVAL);
 }
 
-AVBitStreamFilter h264_mp4toannexb_bsf = {
+AVBitStreamFilter ff_h264_mp4toannexb_bsf = {
     "h264_mp4toannexb",
     sizeof(H264BSFContext),
     h264_mp4toannexb_filter,
diff --git a/ffmpeg-mt/libavcodec/h264_mvpred.h b/ffmpeg-mt/libavcodec/h264_mvpred.h
index 661ef6c..1359072 100644
--- a/ffmpeg-mt/libavcodec/h264_mvpred.h
+++ b/ffmpeg-mt/libavcodec/h264_mvpred.h
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... motion vector predicion
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h264_parser.c b/ffmpeg-mt/libavcodec/h264_parser.c
index 70d08f4..91fbebc 100644
--- a/ffmpeg-mt/libavcodec/h264_parser.c
+++ b/ffmpeg-mt/libavcodec/h264_parser.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... parser
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,14 +26,13 @@
  */
 
 #include "parser.h"
-#include "h264_parser.h"
 #include "h264data.h"
 #include "golomb.h"
 
 #include <assert.h>
 
 
-int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
+static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
 {
     int i;
     uint32_t state;
@@ -188,7 +187,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
             h->sps = *h->sps_buffers[h->pps.sps_id];
             h->frame_num = get_bits(&h->s.gb, h->sps.log2_max_frame_num);
 
-            avctx->profile = h->sps.profile_idc;
+            avctx->profile = ff_h264_get_profile(&h->sps);
             avctx->level   = h->sps.level_idc;
 
             if(h->sps.frame_mbs_only_flag){
@@ -333,7 +332,7 @@ static int init(AVCodecParserContext *s)
     return 0;
 }
 
-AVCodecParser h264_parser = {
+AVCodecParser ff_h264_parser = {
     { CODEC_ID_H264 },
     sizeof(H264Context),
     init,
diff --git a/ffmpeg-mt/libavcodec/h264_parser.h b/ffmpeg-mt/libavcodec/h264_parser.h
deleted file mode 100644
index 149f49a..0000000
--- a/ffmpeg-mt/libavcodec/h264_parser.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... parser
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 parser.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_H264_PARSER_H
-#define AVCODEC_H264_PARSER_H
-
-#include "h264.h"
-
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size);
-
-#endif /* AVCODEC_H264_PARSER_H */
diff --git a/ffmpeg-mt/libavcodec/h264_ps.c b/ffmpeg-mt/libavcodec/h264_ps.c
index 876bcb2..44b8381 100644
--- a/ffmpeg-mt/libavcodec/h264_ps.c
+++ b/ffmpeg-mt/libavcodec/h264_ps.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... parameter set decoding
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
  * @author Michael Niedermayer <michaelni at gmx.at>
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "internal.h"
 #include "dsputil.h"
 #include "avcodec.h"
@@ -267,16 +267,16 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s
 
 int ff_h264_decode_seq_parameter_set(H264Context *h){
     MpegEncContext * const s = &h->s;
-    int profile_idc, level_idc;
+    int profile_idc, level_idc, constraint_set_flags = 0;
     unsigned int sps_id;
     int i;
     SPS *sps;
 
     profile_idc= get_bits(&s->gb, 8);
-    get_bits1(&s->gb);   //constraint_set0_flag
-    get_bits1(&s->gb);   //constraint_set1_flag
-    get_bits1(&s->gb);   //constraint_set2_flag
-    get_bits1(&s->gb);   //constraint_set3_flag
+    constraint_set_flags |= get_bits1(&s->gb) << 0;   //constraint_set0_flag
+    constraint_set_flags |= get_bits1(&s->gb) << 1;   //constraint_set1_flag
+    constraint_set_flags |= get_bits1(&s->gb) << 2;   //constraint_set2_flag
+    constraint_set_flags |= get_bits1(&s->gb) << 3;   //constraint_set3_flag
     get_bits(&s->gb, 4); // reserved
     level_idc= get_bits(&s->gb, 8);
     sps_id= get_ue_golomb_31(&s->gb);
@@ -291,6 +291,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
 
     sps->time_offset_length = 24;
     sps->profile_idc= profile_idc;
+    sps->constraint_set_flags = constraint_set_flags;
     sps->level_idc= level_idc;
 
     memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
diff --git a/ffmpeg-mt/libavcodec/h264_refs.c b/ffmpeg-mt/libavcodec/h264_refs.c
index 74eaaa8..da3ee91 100644
--- a/ffmpeg-mt/libavcodec/h264_refs.c
+++ b/ffmpeg-mt/libavcodec/h264_refs.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... reference picture handling
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h264_sei.c b/ffmpeg-mt/libavcodec/h264_sei.c
index 195ea28..4f52bbe 100644
--- a/ffmpeg-mt/libavcodec/h264_sei.c
+++ b/ffmpeg-mt/libavcodec/h264_sei.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... sei decoding
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h264data.h b/ffmpeg-mt/libavcodec/h264data.h
index 73fcc5c..151f4e3 100644
--- a/ffmpeg-mt/libavcodec/h264data.h
+++ b/ffmpeg-mt/libavcodec/h264data.h
@@ -2,20 +2,20 @@
  * H26L/H264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,7 +79,8 @@ static const uint8_t luma_dc_field_scan[16]={
 };
 
 static const uint8_t chroma_dc_scan[4]={
- 0,1,2,3
+ (0+0*2)*16, (1+0*2)*16,
+ (0+1*2)*16, (1+1*2)*16,  //FIXME
 };
 
 // zigzag_scan8x8_cavlc[i] = zigzag_scan8x8[(i/4) + 16*(i%4)]
diff --git a/ffmpeg-mt/libavcodec/h264dsp.c b/ffmpeg-mt/libavcodec/h264dsp.c
index acb458f..85dbb8f 100644
--- a/ffmpeg-mt/libavcodec/h264dsp.c
+++ b/ffmpeg-mt/libavcodec/h264dsp.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -283,7 +283,6 @@ void ff_h264dsp_init(H264DSPContext *c)
     c->h264_idct_add8      = ff_h264_idct_add8_c;
     c->h264_idct_add16intra= ff_h264_idct_add16intra_c;
     c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_c;
-    c->h264_chroma_dc_dequant_idct= ff_chroma_dc_dequant_idct_c;
 
     c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
     c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
diff --git a/ffmpeg-mt/libavcodec/h264dsp.h b/ffmpeg-mt/libavcodec/h264dsp.h
index c790f4a..6fa1746 100644
--- a/ffmpeg-mt/libavcodec/h264dsp.h
+++ b/ffmpeg-mt/libavcodec/h264dsp.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2003-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -68,7 +68,6 @@ typedef struct H264DSPContext{
     void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
     void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
     void (*h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul);
-    void (*h264_chroma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul);
 }H264DSPContext;
 
 void ff_h264dsp_init(H264DSPContext *c);
diff --git a/ffmpeg-mt/libavcodec/h264dspenc.c b/ffmpeg-mt/libavcodec/h264dspenc.c
deleted file mode 100644
index b65a2cc..0000000
--- a/ffmpeg-mt/libavcodec/h264dspenc.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * H.264/MPEG-4 Part 10 (Base profile) encoder.
- *
- * DSP functions
- *
- * Copyright (c) 2006 Expertisecentrum Digitale Media, UHasselt
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 encoder related DSP utils
- *
- */
-
-#include "dsputil.h"
-
-#define  H264_DCT_PART1(X) \
-         a = block[0][X]+block[3][X]; \
-         c = block[0][X]-block[3][X]; \
-         b = block[1][X]+block[2][X]; \
-         d = block[1][X]-block[2][X]; \
-         pieces[0][X] = a+b; \
-         pieces[2][X] = a-b; \
-         pieces[1][X] = (c<<1)+d; \
-         pieces[3][X] = c-(d<<1);
-
-#define  H264_DCT_PART2(X) \
-         a = pieces[X][0]+pieces[X][3]; \
-         c = pieces[X][0]-pieces[X][3]; \
-         b = pieces[X][1]+pieces[X][2]; \
-         d = pieces[X][1]-pieces[X][2]; \
-         block[0][X] = a+b; \
-         block[2][X] = a-b; \
-         block[1][X] = (c<<1)+d; \
-         block[3][X] = c-(d<<1);
-
-/**
- * Transform the provided matrix using the H.264 modified DCT.
- * @note
- * we'll always work with transposed input blocks, to avoid having to make a
- * distinction between C and mmx implementations.
- *
- * @param block transposed input block
- */
-static void h264_dct_c(DCTELEM block[4][4])
-{
-    DCTELEM pieces[4][4];
-    DCTELEM a, b, c, d;
-
-    H264_DCT_PART1(0);
-    H264_DCT_PART1(1);
-    H264_DCT_PART1(2);
-    H264_DCT_PART1(3);
-    H264_DCT_PART2(0);
-    H264_DCT_PART2(1);
-    H264_DCT_PART2(2);
-    H264_DCT_PART2(3);
-}
-
-av_cold void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx)
-{
-    c->h264_dct = h264_dct_c;
-}
-
diff --git a/ffmpeg-mt/libavcodec/h264enc.c b/ffmpeg-mt/libavcodec/h264enc.c
deleted file mode 100644
index ad874f3..0000000
--- a/ffmpeg-mt/libavcodec/h264enc.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * H.264 encoder
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "libavutil/common.h"
-#include "get_bits.h"
-#include "mpegvideo.h"
-#include "h264data.h"
-
-/**
- * Write out the provided data into a NAL unit.
- * @param nal_ref_idc NAL reference IDC
- * @param nal_unit_type NAL unit payload type
- * @param dest the target buffer, dst+1 == src is allowed as a special case
- * @param destsize the length of the dst array
- * @param b2 the data which should be escaped
- * @return pointer to current position in the output buffer or NULL if an error occurred
- */
-static uint8_t *h264_write_nal_unit(int nal_ref_idc, int nal_unit_type, uint8_t *dest, int *destsize,
-                          PutBitContext *b2)
-{
-    PutBitContext b;
-    int i, destpos, rbsplen, escape_count;
-    uint8_t *rbsp;
-
-    if (nal_unit_type != NAL_END_STREAM)
-        put_bits(b2,1,1); // rbsp_stop_bit
-
-    // Align b2 on a byte boundary
-    align_put_bits(b2);
-    rbsplen = put_bits_count(b2)/8;
-    flush_put_bits(b2);
-    rbsp = b2->buf;
-
-    init_put_bits(&b,dest,*destsize);
-
-    put_bits(&b,16,0);
-    put_bits(&b,16,0x01);
-
-    put_bits(&b,1,0); // forbidden zero bit
-    put_bits(&b,2,nal_ref_idc); // nal_ref_idc
-    put_bits(&b,5,nal_unit_type); // nal_unit_type
-
-    flush_put_bits(&b);
-
-    destpos = 5;
-    escape_count= 0;
-
-    for (i=0; i<rbsplen; i+=2)
-    {
-        if (rbsp[i]) continue;
-        if (i>0 && rbsp[i-1]==0)
-            i--;
-        if (i+2<rbsplen && rbsp[i+1]==0 && rbsp[i+2]<=3)
-        {
-            escape_count++;
-            i+=2;
-        }
-    }
-
-    if(escape_count==0)
-    {
-        if(dest+destpos != rbsp)
-        {
-            memcpy(dest+destpos, rbsp, rbsplen);
-            *destsize -= (rbsplen+destpos);
-        }
-        return dest+rbsplen+destpos;
-    }
-
-    if(rbsplen + escape_count + 1> *destsize)
-    {
-        av_log(NULL, AV_LOG_ERROR, "Destination buffer too small!\n");
-        return NULL;
-    }
-
-    // this should be damn rare (hopefully)
-    for (i = 0 ; i < rbsplen ; i++)
-    {
-        if (i + 2 < rbsplen && (rbsp[i] == 0 && rbsp[i+1] == 0 && rbsp[i+2] < 4))
-        {
-            dest[destpos++] = rbsp[i++];
-            dest[destpos++] = rbsp[i];
-            dest[destpos++] = 0x03; // emulation prevention byte
-        }
-        else
-            dest[destpos++] = rbsp[i];
-    }
-    *destsize -= destpos;
-    return dest+destpos;
-}
-
-static const uint8_t pict_type_to_golomb[7] = {-1, 2, 0, 1, -1, 4, 3};
-
-static const uint8_t intra4x4_cbp_to_golomb[48] = {
-    3, 29, 30, 17, 31, 18, 37,  8, 32, 38, 19,  9, 20, 10, 11,  2,
-   16, 33, 34, 21, 35, 22, 39,  4, 36, 40, 23,  5, 24,  6,  7,  1,
-   41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15,  0
-};
-
-static const uint8_t inter_cbp_to_golomb[48] = {
-    0,  2,  3,  7,  4,  8, 17, 13,  5, 18,  9, 14, 10, 15, 16, 11,
-    1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19,
-    6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12
-};
-
-#define QUANT_SHIFT 22
-
-static const int quant_coeff[52][16] = {
-    { 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772, 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772,},
-    { 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131, 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131,},
-    { 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218, 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218,},
-    { 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711, 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711,},
-    { 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374, 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374,},
-    { 233017, 145889, 233017, 145889, 145889,  92564, 145889,  92564, 233017, 145889, 233017, 145889, 145889,  92564, 145889,  92564,},
-    { 209715, 129056, 209715, 129056, 129056,  83886, 129056,  83886, 209715, 129056, 209715, 129056, 129056,  83886, 129056,  83886,},
-    { 190650, 119837, 190650, 119837, 119837,  74565, 119837,  74565, 190650, 119837, 190650, 119837, 119837,  74565, 119837,  74565,},
-    { 161319, 104858, 161319, 104858, 104858,  67109, 104858,  67109, 161319, 104858, 161319, 104858, 104858,  67109, 104858,  67109,},
-    { 149797,  93207, 149797,  93207,  93207,  58356,  93207,  58356, 149797,  93207, 149797,  93207,  93207,  58356,  93207,  58356,},
-    { 131072,  83886, 131072,  83886,  83886,  53687,  83886,  53687, 131072,  83886, 131072,  83886,  83886,  53687,  83886,  53687,},
-    { 116508,  72944, 116508,  72944,  72944,  46282,  72944,  46282, 116508,  72944, 116508,  72944,  72944,  46282,  72944,  46282,},
-    { 104858,  64528, 104858,  64528,  64528,  41943,  64528,  41943, 104858,  64528, 104858,  64528,  64528,  41943,  64528,  41943,},
-    {  95325,  59919,  95325,  59919,  59919,  37283,  59919,  37283,  95325,  59919,  95325,  59919,  59919,  37283,  59919,  37283,},
-    {  80660,  52429,  80660,  52429,  52429,  33554,  52429,  33554,  80660,  52429,  80660,  52429,  52429,  33554,  52429,  33554,},
-    {  74898,  46603,  74898,  46603,  46603,  29178,  46603,  29178,  74898,  46603,  74898,  46603,  46603,  29178,  46603,  29178,},
-    {  65536,  41943,  65536,  41943,  41943,  26844,  41943,  26844,  65536,  41943,  65536,  41943,  41943,  26844,  41943,  26844,},
-    {  58254,  36472,  58254,  36472,  36472,  23141,  36472,  23141,  58254,  36472,  58254,  36472,  36472,  23141,  36472,  23141,},
-    {  52429,  32264,  52429,  32264,  32264,  20972,  32264,  20972,  52429,  32264,  52429,  32264,  32264,  20972,  32264,  20972,},
-    {  47663,  29959,  47663,  29959,  29959,  18641,  29959,  18641,  47663,  29959,  47663,  29959,  29959,  18641,  29959,  18641,},
-    {  40330,  26214,  40330,  26214,  26214,  16777,  26214,  16777,  40330,  26214,  40330,  26214,  26214,  16777,  26214,  16777,},
-    {  37449,  23302,  37449,  23302,  23302,  14589,  23302,  14589,  37449,  23302,  37449,  23302,  23302,  14589,  23302,  14589,},
-    {  32768,  20972,  32768,  20972,  20972,  13422,  20972,  13422,  32768,  20972,  32768,  20972,  20972,  13422,  20972,  13422,},
-    {  29127,  18236,  29127,  18236,  18236,  11570,  18236,  11570,  29127,  18236,  29127,  18236,  18236,  11570,  18236,  11570,},
-    {  26214,  16132,  26214,  16132,  16132,  10486,  16132,  10486,  26214,  16132,  26214,  16132,  16132,  10486,  16132,  10486,},
-    {  23831,  14980,  23831,  14980,  14980,   9321,  14980,   9321,  23831,  14980,  23831,  14980,  14980,   9321,  14980,   9321,},
-    {  20165,  13107,  20165,  13107,  13107,   8389,  13107,   8389,  20165,  13107,  20165,  13107,  13107,   8389,  13107,   8389,},
-    {  18725,  11651,  18725,  11651,  11651,   7294,  11651,   7294,  18725,  11651,  18725,  11651,  11651,   7294,  11651,   7294,},
-    {  16384,  10486,  16384,  10486,  10486,   6711,  10486,   6711,  16384,  10486,  16384,  10486,  10486,   6711,  10486,   6711,},
-    {  14564,   9118,  14564,   9118,   9118,   5785,   9118,   5785,  14564,   9118,  14564,   9118,   9118,   5785,   9118,   5785,},
-    {  13107,   8066,  13107,   8066,   8066,   5243,   8066,   5243,  13107,   8066,  13107,   8066,   8066,   5243,   8066,   5243,},
-    {  11916,   7490,  11916,   7490,   7490,   4660,   7490,   4660,  11916,   7490,  11916,   7490,   7490,   4660,   7490,   4660,},
-    {  10082,   6554,  10082,   6554,   6554,   4194,   6554,   4194,  10082,   6554,  10082,   6554,   6554,   4194,   6554,   4194,},
-    {   9362,   5825,   9362,   5825,   5825,   3647,   5825,   3647,   9362,   5825,   9362,   5825,   5825,   3647,   5825,   3647,},
-    {   8192,   5243,   8192,   5243,   5243,   3355,   5243,   3355,   8192,   5243,   8192,   5243,   5243,   3355,   5243,   3355,},
-    {   7282,   4559,   7282,   4559,   4559,   2893,   4559,   2893,   7282,   4559,   7282,   4559,   4559,   2893,   4559,   2893,},
-    {   6554,   4033,   6554,   4033,   4033,   2621,   4033,   2621,   6554,   4033,   6554,   4033,   4033,   2621,   4033,   2621,},
-    {   5958,   3745,   5958,   3745,   3745,   2330,   3745,   2330,   5958,   3745,   5958,   3745,   3745,   2330,   3745,   2330,},
-    {   5041,   3277,   5041,   3277,   3277,   2097,   3277,   2097,   5041,   3277,   5041,   3277,   3277,   2097,   3277,   2097,},
-    {   4681,   2913,   4681,   2913,   2913,   1824,   2913,   1824,   4681,   2913,   4681,   2913,   2913,   1824,   2913,   1824,},
-    {   4096,   2621,   4096,   2621,   2621,   1678,   2621,   1678,   4096,   2621,   4096,   2621,   2621,   1678,   2621,   1678,},
-    {   3641,   2280,   3641,   2280,   2280,   1446,   2280,   1446,   3641,   2280,   3641,   2280,   2280,   1446,   2280,   1446,},
-    {   3277,   2016,   3277,   2016,   2016,   1311,   2016,   1311,   3277,   2016,   3277,   2016,   2016,   1311,   2016,   1311,},
-    {   2979,   1872,   2979,   1872,   1872,   1165,   1872,   1165,   2979,   1872,   2979,   1872,   1872,   1165,   1872,   1165,},
-    {   2521,   1638,   2521,   1638,   1638,   1049,   1638,   1049,   2521,   1638,   2521,   1638,   1638,   1049,   1638,   1049,},
-    {   2341,   1456,   2341,   1456,   1456,    912,   1456,    912,   2341,   1456,   2341,   1456,   1456,    912,   1456,    912,},
-    {   2048,   1311,   2048,   1311,   1311,    839,   1311,    839,   2048,   1311,   2048,   1311,   1311,    839,   1311,    839,},
-    {   1820,   1140,   1820,   1140,   1140,    723,   1140,    723,   1820,   1140,   1820,   1140,   1140,    723,   1140,    723,},
-    {   1638,   1008,   1638,   1008,   1008,    655,   1008,    655,   1638,   1008,   1638,   1008,   1008,    655,   1008,    655,},
-    {   1489,    936,   1489,    936,    936,    583,    936,    583,   1489,    936,   1489,    936,    936,    583,    936,    583,},
-    {   1260,    819,   1260,    819,    819,    524,    819,    524,   1260,    819,   1260,    819,    819,    524,    819,    524,},
-    {   1170,    728,   1170,    728,    728,    456,    728,    456,   1170,    728,   1170,    728,    728,    456,    728,    456,},
-};
-
-//FIXME need to check that this does not overflow signed 32 bit for low qp, I am not sure, it's very close
-//FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away)
-static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale,
-                             int intra, int separate_dc)
-{
-    int i;
-    const int * const quant_table = quant_coeff[qscale];
-    const int bias = intra ? (1 << QUANT_SHIFT) / 3 : (1 << QUANT_SHIFT) / 6;
-    const unsigned int threshold1 = (1 << QUANT_SHIFT) - bias - 1;
-    const unsigned int threshold2 = (threshold1 << 1);
-    int last_non_zero;
-
-    if (separate_dc) {
-        if (qscale <= 18) {
-            //avoid overflows
-            const int dc_bias = intra ? (1 << (QUANT_SHIFT - 2)) / 3 : (1 << (QUANT_SHIFT - 2)) / 6;
-            const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT - 2)) - dc_bias - 1;
-            const unsigned int dc_threshold2 = (dc_threshold1 << 1);
-
-            int level = block[0]*quant_coeff[qscale+18][0];
-            if (((unsigned)(level + dc_threshold1)) > dc_threshold2) {
-                if (level > 0) {
-                    level = (dc_bias + level) >> (QUANT_SHIFT - 2);
-                    block[0] = level;
-                } else {
-                    level = (dc_bias - level) >> (QUANT_SHIFT - 2);
-                    block[0] = -level;
-                }
-//                last_non_zero = i;
-            } else {
-                block[0] = 0;
-            }
-        } else {
-            const int dc_bias = intra ? (1 << (QUANT_SHIFT + 1)) / 3 : (1 << (QUANT_SHIFT + 1)) / 6;
-            const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT + 1)) - dc_bias - 1;
-            const unsigned int dc_threshold2 = (dc_threshold1 << 1);
-
-            int level = block[0]*quant_table[0];
-            if (((unsigned)(level + dc_threshold1)) > dc_threshold2) {
-                if (level > 0) {
-                    level = (dc_bias + level) >> (QUANT_SHIFT + 1);
-                    block[0] = level;
-                } else {
-                    level = (dc_bias - level) >> (QUANT_SHIFT + 1);
-                    block[0] = -level;
-                }
-//                last_non_zero = i;
-            } else {
-                block[0] = 0;
-            }
-        }
-        last_non_zero = 0;
-        i = 1;
-    } else {
-        last_non_zero = -1;
-        i = 0;
-    }
-
-    for (; i < 16; i++) {
-        const int j = scantable[i];
-        int level = block[j]*quant_table[j];
-
-//        if (   bias+level >= (1 << (QMAT_SHIFT - 3))
-//            || bias-level >= (1 << (QMAT_SHIFT - 3))) {
-        if (((unsigned)(level + threshold1)) > threshold2) {
-            if (level > 0) {
-                level = (bias + level) >> QUANT_SHIFT;
-                block[j] = level;
-            } else {
-                level = (bias - level) >> QUANT_SHIFT;
-                block[j] = -level;
-            }
-            last_non_zero = i;
-        } else {
-            block[j] = 0;
-        }
-    }
-
-    return last_non_zero;
-}
diff --git a/ffmpeg-mt/libavcodec/h264idct.c b/ffmpeg-mt/libavcodec/h264idct.c
index 53e70a2..ecf669e 100644
--- a/ffmpeg-mt/libavcodec/h264idct.c
+++ b/ffmpeg-mt/libavcodec/h264idct.c
@@ -2,20 +2,20 @@
  * H.264 IDCT
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -250,26 +250,4 @@ void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul){
         output[stride* 4+offset]= ((((z1 - z2)*qmul + 128 ) >> 8));
         output[stride* 5+offset]= ((((z0 - z3)*qmul + 128 ) >> 8));
     }
-#undef stride
-}
-
-void ff_chroma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul){
-    const int stride= 16*2;
-    const int xStride= 16;
-    int a,b,c,d,e;
-
-    a= input[0];
-    b= input[1];
-    c= input[2];
-    d= input[3];
-
-    e= a-b;
-    a= a+b;
-    b= c-d;
-    c= c+d;
-
-    output[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;
-    output[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;
-    output[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;
-    output[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;
 }
diff --git a/ffmpeg-mt/libavcodec/h264pred.c b/ffmpeg-mt/libavcodec/h264pred.c
index 7edb971..1a4ab81 100644
--- a/ffmpeg-mt/libavcodec/h264pred.c
+++ b/ffmpeg-mt/libavcodec/h264pred.c
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/h264pred.h b/ffmpeg-mt/libavcodec/h264pred.h
index a492ae0..db3f580 100644
--- a/ffmpeg-mt/libavcodec/h264pred.h
+++ b/ffmpeg-mt/libavcodec/h264pred.h
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/huffman.c b/ffmpeg-mt/libavcodec/huffman.c
index 853fa64..211ea63 100644
--- a/ffmpeg-mt/libavcodec/huffman.c
+++ b/ffmpeg-mt/libavcodec/huffman.c
@@ -3,20 +3,20 @@
  * huffman tree builder and VLC generator
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/huffman.h b/ffmpeg-mt/libavcodec/huffman.h
index 3c08e6f..4a60187 100644
--- a/ffmpeg-mt/libavcodec/huffman.h
+++ b/ffmpeg-mt/libavcodec/huffman.h
@@ -3,20 +3,20 @@
  * huffman tree builder and VLC generator
  * Copyright (C) 2007  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/huffyuv.c b/ffmpeg-mt/libavcodec/huffyuv.c
index 8d94ad6..183ce0e 100644
--- a/ffmpeg-mt/libavcodec/huffyuv.c
+++ b/ffmpeg-mt/libavcodec/huffyuv.c
@@ -6,20 +6,20 @@
  * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of
  * the algorithm used
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1439,7 +1439,7 @@ static av_cold int encode_end(AVCodecContext *avctx)
 #endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
 
 #if CONFIG_HUFFYUV_DECODER
-AVCodec huffyuv_decoder = {
+AVCodec ff_huffyuv_decoder = {
     "huffyuv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_HUFFYUV,
@@ -1456,7 +1456,7 @@ AVCodec huffyuv_decoder = {
 #endif
 
 #if CONFIG_FFVHUFF_DECODER
-AVCodec ffvhuff_decoder = {
+AVCodec ff_ffvhuff_decoder = {
     "ffvhuff",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FFVHUFF,
@@ -1473,7 +1473,7 @@ AVCodec ffvhuff_decoder = {
 #endif
 
 #if CONFIG_HUFFYUV_ENCODER
-AVCodec huffyuv_encoder = {
+AVCodec ff_huffyuv_encoder = {
     "huffyuv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_HUFFYUV,
@@ -1487,7 +1487,7 @@ AVCodec huffyuv_encoder = {
 #endif
 
 #if CONFIG_FFVHUFF_ENCODER
-AVCodec ffvhuff_encoder = {
+AVCodec ff_ffvhuff_encoder = {
     "ffvhuff",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_FFVHUFF,
diff --git a/ffmpeg-mt/libavcodec/idcinvideo.c b/ffmpeg-mt/libavcodec/idcinvideo.c
index cc79ef0..b8d47ad 100644
--- a/ffmpeg-mt/libavcodec/idcinvideo.c
+++ b/ffmpeg-mt/libavcodec/idcinvideo.c
@@ -2,20 +2,20 @@
  * id Quake II CIN Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -253,7 +253,7 @@ static av_cold int idcin_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec idcin_decoder = {
+AVCodec ff_idcin_decoder = {
     "idcinvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_IDCIN,
diff --git a/ffmpeg-mt/libavcodec/iff.c b/ffmpeg-mt/libavcodec/iff.c
index 19f4172..63e1f31 100644
--- a/ffmpeg-mt/libavcodec/iff.c
+++ b/ffmpeg-mt/libavcodec/iff.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2010 Peter Ross <pross at xvid.org>
  * Copyright (c) 2010 Sebastian Vater <cdgs.basty at googlemail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,11 +25,10 @@
  * IFF PBM/ILBM bitmap decoder
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "bytestream.h"
 #include "avcodec.h"
 #include "get_bits.h"
-#include "iff.h"
 
 typedef struct {
     AVFrame frame;
@@ -120,7 +119,7 @@ static av_always_inline uint32_t gray2rgb(const uint32_t x) {
 /**
  * Convert CMAP buffer (stored in extradata) to lavc palette format
  */
-int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
+static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
 {
     int count, i;
 
@@ -368,7 +367,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec iff_ilbm_decoder = {
+AVCodec ff_iff_ilbm_decoder = {
     "iff_ilbm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_IFF_ILBM,
@@ -381,7 +380,7 @@ AVCodec iff_ilbm_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"),
 };
 
-AVCodec iff_byterun1_decoder = {
+AVCodec ff_iff_byterun1_decoder = {
     "iff_byterun1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_IFF_BYTERUN1,
diff --git a/ffmpeg-mt/libavcodec/iff.h b/ffmpeg-mt/libavcodec/iff.h
deleted file mode 100644
index 76db10b..0000000
--- a/ffmpeg-mt/libavcodec/iff.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * IFF PBM/ILBM bitmap decoder
- * Copyright (c) 2010 Peter Ross <pross at xvid.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_IFF_H
-#define AVCODEC_IFF_H
-
-#include <stdint.h>
-#include "avcodec.h"
-
-int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal);
-
-#endif /* AVCODEC_IFF_H */
diff --git a/ffmpeg-mt/libavcodec/iirfilter.c b/ffmpeg-mt/libavcodec/iirfilter.c
index 90af431..56d17d2 100644
--- a/ffmpeg-mt/libavcodec/iirfilter.c
+++ b/ffmpeg-mt/libavcodec/iirfilter.c
@@ -2,20 +2,20 @@
  * IIR filter
  * Copyright (c) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -47,25 +47,25 @@ typedef struct FFIIRFilterState{
 /// maximum supported filter order
 #define MAXORDER 30
 
-av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,
-                                                    enum IIRFilterMode filt_mode,
-                                                    int order, float cutoff_ratio,
-                                                    float stopband, float ripple)
+static int butterworth_init_coeffs(void *avc, struct FFIIRFilterCoeffs *c,
+                                   enum IIRFilterMode filt_mode,
+                                   int order, float cutoff_ratio,
+                                   float stopband)
 {
     int i, j;
-    FFIIRFilterCoeffs *c;
     double wa;
     double p[MAXORDER + 1][2];
 
-    if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
-        return NULL;
-    if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
-        return NULL;
-
-    c = av_malloc(sizeof(FFIIRFilterCoeffs));
-    c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));
-    c->cy = av_malloc(sizeof(c->cy[0]) * order);
-    c->order = order;
+    if (filt_mode != FF_FILTER_MODE_LOWPASS) {
+        av_log(avc, AV_LOG_ERROR, "Butterworth filter currently only supports "
+               "low-pass filter mode\n");
+        return -1;
+    }
+    if (order & 1) {
+        av_log(avc, AV_LOG_ERROR, "Butterworth filter currently only supports "
+               "even filter orders\n");
+        return -1;
+    }
 
     wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);
 
@@ -109,7 +109,94 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType f
     }
     c->gain /= 1 << order;
 
-    return c;
+    return 0;
+}
+
+static int biquad_init_coeffs(void *avc, struct FFIIRFilterCoeffs *c,
+                              enum IIRFilterMode filt_mode, int order,
+                              float cutoff_ratio, float stopband)
+{
+    double cos_w0, sin_w0;
+    double a0, x0, x1;
+
+    if (filt_mode != FF_FILTER_MODE_HIGHPASS &&
+        filt_mode != FF_FILTER_MODE_LOWPASS) {
+        av_log(avc, AV_LOG_ERROR, "Biquad filter currently only supports "
+               "high-pass and low-pass filter modes\n");
+        return -1;
+    }
+    if (order != 2) {
+        av_log(avc, AV_LOG_ERROR, "Biquad filter must have order of 2\n");
+        return -1;
+    }
+
+    cos_w0 = cos(M_PI * cutoff_ratio);
+    sin_w0 = sin(M_PI * cutoff_ratio);
+
+    a0 = 1.0 + (sin_w0 / 2.0);
+
+    if (filt_mode == FF_FILTER_MODE_HIGHPASS) {
+        c->gain  =  ((1.0 + cos_w0) / 2.0)  / a0;
+        x0       =  ((1.0 + cos_w0) / 2.0)  / a0;
+        x1       = (-(1.0 + cos_w0))        / a0;
+    } else { // FF_FILTER_MODE_LOWPASS
+        c->gain  =  ((1.0 - cos_w0) / 2.0)  / a0;
+        x0       =  ((1.0 - cos_w0) / 2.0)  / a0;
+        x1       =   (1.0 - cos_w0)         / a0;
+    }
+    c->cy[0] = (-1.0 + (sin_w0 / 2.0)) / a0;
+    c->cy[1] =  (2.0 *  cos_w0)        / a0;
+
+    // divide by gain to make the x coeffs integers.
+    // during filtering, the delay state will include the gain multiplication
+    c->cx[0] = lrintf(x0 / c->gain);
+    c->cx[1] = lrintf(x1 / c->gain);
+    c->cy[0] /= c->gain;
+    c->cy[1] /= c->gain;
+
+    return 0;
+}
+
+av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc,
+                                                enum IIRFilterType filt_type,
+                                                enum IIRFilterMode filt_mode,
+                                                int order, float cutoff_ratio,
+                                                float stopband, float ripple)
+{
+    FFIIRFilterCoeffs *c;
+    int ret = 0;
+
+    if (order <= 0 || order > MAXORDER || cutoff_ratio >= 1.0)
+        return NULL;
+
+    FF_ALLOCZ_OR_GOTO(avc, c,     sizeof(FFIIRFilterCoeffs),
+                      init_fail);
+    FF_ALLOC_OR_GOTO (avc, c->cx, sizeof(c->cx[0]) * ((order >> 1) + 1),
+                      init_fail);
+    FF_ALLOC_OR_GOTO (avc, c->cy, sizeof(c->cy[0]) * order,
+                      init_fail);
+    c->order = order;
+
+    switch (filt_type) {
+    case FF_FILTER_TYPE_BUTTERWORTH:
+        ret = butterworth_init_coeffs(avc, c, filt_mode, order, cutoff_ratio,
+                                      stopband);
+        break;
+    case FF_FILTER_TYPE_BIQUAD:
+        ret = biquad_init_coeffs(avc, c, filt_mode, order, cutoff_ratio,
+                                 stopband);
+        break;
+    default:
+        av_log(avc, AV_LOG_ERROR, "filter type is not currently implemented\n");
+        goto init_fail;
+    }
+
+    if (!ret)
+        return c;
+
+init_fail:
+    ff_iir_filter_free_coeffs(c);
+    return NULL;
 }
 
 av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order)
@@ -118,48 +205,96 @@ av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order)
     return s;
 }
 
-#define FILTER(i0, i1, i2, i3)                    \
-    in =   *src * c->gain                         \
-         + c->cy[0]*s->x[i0] + c->cy[1]*s->x[i1]  \
-         + c->cy[2]*s->x[i2] + c->cy[3]*s->x[i3]; \
-    res =  (s->x[i0] + in      )*1                \
-         + (s->x[i1] + s->x[i3])*4                \
-         +  s->x[i2]            *6;               \
-    *dst = av_clip_int16(lrintf(res));            \
-    s->x[i0] = in;                                \
-    src += sstep;                                 \
-    dst += dstep;                                 \
-
-void ff_iir_filter(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const int16_t *src, int sstep, int16_t *dst, int dstep)
-{
-    int i;
+#define CONV_S16(dest, source) dest = av_clip_int16(lrintf(source));
 
-    if(c->order == 4){
-        for(i = 0; i < size; i += 4){
-            float in, res;
+#define CONV_FLT(dest, source) dest = source;
 
-            FILTER(0, 1, 2, 3);
-            FILTER(1, 2, 3, 0);
-            FILTER(2, 3, 0, 1);
-            FILTER(3, 0, 1, 2);
-        }
-    }else{
-        for(i = 0; i < size; i++){
-            int j;
-            float in, res;
-            in = *src * c->gain;
-            for(j = 0; j < c->order; j++)
-                in += c->cy[j] * s->x[j];
-            res = s->x[0] + in + s->x[c->order >> 1] * c->cx[c->order >> 1];
-            for(j = 1; j < c->order >> 1; j++)
-                res += (s->x[j] + s->x[c->order - j]) * c->cx[j];
-            for(j = 0; j < c->order - 1; j++)
-                s->x[j] = s->x[j + 1];
-            *dst = av_clip_int16(lrintf(res));
-            s->x[c->order - 1] = in;
-            src += sstep;
-            dst += sstep;
-        }
+#define FILTER_BW_O4_1(i0, i1, i2, i3, fmt)         \
+    in = *src0 * c->gain                            \
+         + c->cy[0]*s->x[i0] + c->cy[1]*s->x[i1]    \
+         + c->cy[2]*s->x[i2] + c->cy[3]*s->x[i3];   \
+    res =  (s->x[i0] + in      )*1                  \
+         + (s->x[i1] + s->x[i3])*4                  \
+         +  s->x[i2]            *6;                 \
+    CONV_##fmt(*dst0, res)                          \
+    s->x[i0] = in;                                  \
+    src0 += sstep;                                  \
+    dst0 += dstep;
+
+#define FILTER_BW_O4(type, fmt) {           \
+    int i;                                  \
+    const type *src0 = src;                 \
+    type       *dst0 = dst;                 \
+    for (i = 0; i < size; i += 4) {         \
+        float in, res;                      \
+        FILTER_BW_O4_1(0, 1, 2, 3, fmt);    \
+        FILTER_BW_O4_1(1, 2, 3, 0, fmt);    \
+        FILTER_BW_O4_1(2, 3, 0, 1, fmt);    \
+        FILTER_BW_O4_1(3, 0, 1, 2, fmt);    \
+    }                                       \
+}
+
+#define FILTER_DIRECT_FORM_II(type, fmt) {                                  \
+    int i;                                                                  \
+    const type *src0 = src;                                                 \
+    type       *dst0 = dst;                                                 \
+    for (i = 0; i < size; i++) {                                            \
+        int j;                                                              \
+        float in, res;                                                      \
+        in = *src0 * c->gain;                                               \
+        for(j = 0; j < c->order; j++)                                       \
+            in += c->cy[j] * s->x[j];                                       \
+        res = s->x[0] + in + s->x[c->order >> 1] * c->cx[c->order >> 1];    \
+        for(j = 1; j < c->order >> 1; j++)                                  \
+            res += (s->x[j] + s->x[c->order - j]) * c->cx[j];               \
+        for(j = 0; j < c->order - 1; j++)                                   \
+            s->x[j] = s->x[j + 1];                                          \
+        CONV_##fmt(*dst0, res)                                              \
+        s->x[c->order - 1] = in;                                            \
+        src0 += sstep;                                                      \
+        dst0 += dstep;                                                      \
+    }                                                                       \
+}
+
+#define FILTER_O2(type, fmt) {                                              \
+    int i;                                                                  \
+    const type *src0 = src;                                                 \
+    type       *dst0 = dst;                                                 \
+    for (i = 0; i < size; i++) {                                            \
+        float in = *src0   * c->gain  +                                     \
+                   s->x[0] * c->cy[0] +                                     \
+                   s->x[1] * c->cy[1];                                      \
+        CONV_##fmt(*dst0, s->x[0] + in + s->x[1] * c->cx[1])                \
+        s->x[0] = s->x[1];                                                  \
+        s->x[1] = in;                                                       \
+        src0 += sstep;                                                      \
+        dst0 += dstep;                                                      \
+    }                                                                       \
+}
+
+void ff_iir_filter(const struct FFIIRFilterCoeffs *c,
+                   struct FFIIRFilterState *s, int size,
+                   const int16_t *src, int sstep, int16_t *dst, int dstep)
+{
+    if (c->order == 2) {
+        FILTER_O2(int16_t, S16)
+    } else if (c->order == 4) {
+        FILTER_BW_O4(int16_t, S16)
+    } else {
+        FILTER_DIRECT_FORM_II(int16_t, S16)
+    }
+}
+
+void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c,
+                       struct FFIIRFilterState *s, int size,
+                       const float *src, int sstep, float *dst, int dstep)
+{
+    if (c->order == 2) {
+        FILTER_O2(float, FLT)
+    } else if (c->order == 4) {
+        FILTER_BW_O4(float, FLT)
+    } else {
+        FILTER_DIRECT_FORM_II(float, FLT)
     }
 }
 
diff --git a/ffmpeg-mt/libavcodec/iirfilter.h b/ffmpeg-mt/libavcodec/iirfilter.h
index f660955..bc65a96 100644
--- a/ffmpeg-mt/libavcodec/iirfilter.h
+++ b/ffmpeg-mt/libavcodec/iirfilter.h
@@ -2,20 +2,20 @@
  * IIR filter
  * Copyright (c) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -34,6 +34,7 @@ struct FFIIRFilterState;
 
 enum IIRFilterType{
     FF_FILTER_TYPE_BESSEL,
+    FF_FILTER_TYPE_BIQUAD,
     FF_FILTER_TYPE_BUTTERWORTH,
     FF_FILTER_TYPE_CHEBYSHEV,
     FF_FILTER_TYPE_ELLIPTIC,
@@ -49,6 +50,8 @@ enum IIRFilterMode{
 /**
  * Initialize filter coefficients.
  *
+ * @param avc          a pointer to an arbitrary struct of which the first
+ *                     field is a pointer to an AVClass struct
  * @param filt_type    filter type (e.g. Butterworth)
  * @param filt_mode    filter mode (e.g. lowpass)
  * @param order        filter order
@@ -58,10 +61,11 @@ enum IIRFilterMode{
  *
  * @return pointer to filter coefficients structure or NULL if filter cannot be created
  */
-struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,
-                                                    enum IIRFilterMode filt_mode,
-                                                    int order, float cutoff_ratio,
-                                                    float stopband, float ripple);
+struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc,
+                                                enum IIRFilterType filt_type,
+                                                enum IIRFilterMode filt_mode,
+                                                int order, float cutoff_ratio,
+                                                float stopband, float ripple);
 
 /**
  * Create new filter state.
@@ -87,7 +91,7 @@ void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs);
 void ff_iir_filter_free_state(struct FFIIRFilterState *state);
 
 /**
- * Perform lowpass filtering on input samples.
+ * Perform IIR filtering on signed 16-bit input samples.
  *
  * @param coeffs pointer to filter coefficients
  * @param state  pointer to filter state
@@ -100,4 +104,19 @@ void ff_iir_filter_free_state(struct FFIIRFilterState *state);
 void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state,
                    int size, const int16_t *src, int sstep, int16_t *dst, int dstep);
 
+/**
+ * Perform IIR filtering on floating-point input samples.
+ *
+ * @param coeffs pointer to filter coefficients
+ * @param state  pointer to filter state
+ * @param size   input length
+ * @param src    source samples
+ * @param sstep  source stride
+ * @param dst    filtered samples (destination may be the same as input)
+ * @param dstep  destination stride
+ */
+void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *coeffs,
+                       struct FFIIRFilterState *state, int size,
+                       const float *src, int sstep, float *dst, int dstep);
+
 #endif /* AVCODEC_IIRFILTER_H */
diff --git a/ffmpeg-mt/libavcodec/imc.c b/ffmpeg-mt/libavcodec/imc.c
index 272e4ee..e48a709 100644
--- a/ffmpeg-mt/libavcodec/imc.c
+++ b/ffmpeg-mt/libavcodec/imc.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2006 Benjamin Larsson
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -40,6 +40,8 @@
 #include "get_bits.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "libavutil/audioconvert.h"
+#include "sinewin.h"
 
 #include "imcdata.h"
 
@@ -157,7 +159,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx)
     ff_fft_init(&q->fft, 7, 1);
     dsputil_init(&q->dsp, avctx);
     avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+    avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
     return 0;
 }
 
@@ -563,8 +565,8 @@ static void imc_imdct256(IMCContext *q) {
     }
 
     /* FFT */
-    ff_fft_permute(&q->fft, q->samples);
-    ff_fft_calc (&q->fft, q->samples);
+    q->fft.fft_permute(&q->fft, q->samples);
+    q->fft.fft_calc   (&q->fft, q->samples);
 
     /* postrotation, window and reorder */
     for(i = 0; i < COEFFS/2; i++){
@@ -821,7 +823,7 @@ static av_cold int imc_decode_close(AVCodecContext * avctx)
 }
 
 
-AVCodec imc_decoder = {
+AVCodec ff_imc_decoder = {
     .name = "imc",
     .type = AVMEDIA_TYPE_AUDIO,
     .id = CODEC_ID_IMC,
diff --git a/ffmpeg-mt/libavcodec/imcdata.h b/ffmpeg-mt/libavcodec/imcdata.h
index 64e7c71..8e99391 100644
--- a/ffmpeg-mt/libavcodec/imcdata.h
+++ b/ffmpeg-mt/libavcodec/imcdata.h
@@ -4,20 +4,20 @@
  * Copyright (c) 2006 Benjamin Larsson
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/imgconvert.c b/ffmpeg-mt/libavcodec/imgconvert.c
index 6b0c049..09ccdbc 100644
--- a/ffmpeg-mt/libavcodec/imgconvert.c
+++ b/ffmpeg-mt/libavcodec/imgconvert.c
@@ -2,20 +2,20 @@
  * Misc image conversion routines
  * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,8 +36,7 @@
 #include "imgconvert.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/pixdesc.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/internal.h"
+#include "libavutil/imgutils.h"
 
 #if HAVE_MMX && HAVE_YASM
 #include "x86/dsputil_mmx.h"
diff --git a/ffmpeg-mt/libavcodec/imgconvert.h b/ffmpeg-mt/libavcodec/imgconvert.h
index 64da317..c99e587 100644
--- a/ffmpeg-mt/libavcodec/imgconvert.h
+++ b/ffmpeg-mt/libavcodec/imgconvert.h
@@ -4,20 +4,20 @@
  *
  * Copyright (c) 2008 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/imx_dump_header_bsf.c b/ffmpeg-mt/libavcodec/imx_dump_header_bsf.c
index 2310185..3724daf 100644
--- a/ffmpeg-mt/libavcodec/imx_dump_header_bsf.c
+++ b/ffmpeg-mt/libavcodec/imx_dump_header_bsf.c
@@ -2,20 +2,20 @@
  * imx dump header bitstream filter
  * Copyright (c) 2007 Baptiste Coudurier
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -52,7 +52,7 @@ static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx
     return 1;
 }
 
-AVBitStreamFilter imx_dump_header_bsf = {
+AVBitStreamFilter ff_imx_dump_header_bsf = {
     "imxdump",
     0,
     imx_dump_header,
diff --git a/ffmpeg-mt/libavcodec/indeo2.c b/ffmpeg-mt/libavcodec/indeo2.c
index a3d6c80..0e588c3 100644
--- a/ffmpeg-mt/libavcodec/indeo2.c
+++ b/ffmpeg-mt/libavcodec/indeo2.c
@@ -2,20 +2,20 @@
  * Intel Indeo 2 codec
  * Copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -224,7 +224,7 @@ static av_cold int ir2_decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec indeo2_decoder = {
+AVCodec ff_indeo2_decoder = {
     "indeo2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_INDEO2,
diff --git a/ffmpeg-mt/libavcodec/indeo2data.h b/ffmpeg-mt/libavcodec/indeo2data.h
index b2e0b8a..ef85e32 100644
--- a/ffmpeg-mt/libavcodec/indeo2data.h
+++ b/ffmpeg-mt/libavcodec/indeo2data.h
@@ -2,20 +2,20 @@
  * Intel Indeo 2 codec
  * copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/indeo3.c b/ffmpeg-mt/libavcodec/indeo3.c
index 66ea987..29a8d4a 100644
--- a/ffmpeg-mt/libavcodec/indeo3.c
+++ b/ffmpeg-mt/libavcodec/indeo3.c
@@ -2,20 +2,20 @@
  * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
  * written, produced, and directed by Alan Smithee
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "bytestream.h"
@@ -1137,7 +1137,7 @@ static av_cold int indeo3_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec indeo3_decoder = {
+AVCodec ff_indeo3_decoder = {
     "indeo3",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_INDEO3,
diff --git a/ffmpeg-mt/libavcodec/indeo3data.h b/ffmpeg-mt/libavcodec/indeo3data.h
index bbc4c95..334c3e0 100644
--- a/ffmpeg-mt/libavcodec/indeo3data.h
+++ b/ffmpeg-mt/libavcodec/indeo3data.h
@@ -2,20 +2,20 @@
  * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
  * written, produced, and directed by Alan Smithee
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/indeo5.c b/ffmpeg-mt/libavcodec/indeo5.c
index d8aab20..088b45a 100644
--- a/ffmpeg-mt/libavcodec/indeo5.c
+++ b/ffmpeg-mt/libavcodec/indeo5.c
@@ -2,20 +2,20 @@
  * Indeo Video Interactive v5 compatible decoder
  * Copyright (c) 2009 Maxim Poliakovski
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -818,7 +818,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
 }
 
 
-AVCodec indeo5_decoder = {
+AVCodec ff_indeo5_decoder = {
     .name           = "indeo5",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_INDEO5,
diff --git a/ffmpeg-mt/libavcodec/indeo5data.h b/ffmpeg-mt/libavcodec/indeo5data.h
index a6217d0..f4252b5 100644
--- a/ffmpeg-mt/libavcodec/indeo5data.h
+++ b/ffmpeg-mt/libavcodec/indeo5data.h
@@ -2,20 +2,20 @@
  * Indeo Video Interactive 5 compatible decoder
  * Copyright (c) 2009 Maxim Poliakovski
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/intelh263dec.c b/ffmpeg-mt/libavcodec/intelh263dec.c
index 5e45129..414c45a 100644
--- a/ffmpeg-mt/libavcodec/intelh263dec.c
+++ b/ffmpeg-mt/libavcodec/intelh263dec.c
@@ -1,20 +1,20 @@
 /*
  * H.263i decoder
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -115,7 +115,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
     return 0;
 }
 
-AVCodec h263i_decoder = {
+AVCodec ff_h263i_decoder = {
     "h263i",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H263I,
diff --git a/ffmpeg-mt/libavcodec/internal.h b/ffmpeg-mt/libavcodec/internal.h
index 24aca6b..fe853ab 100644
--- a/ffmpeg-mt/libavcodec/internal.h
+++ b/ffmpeg-mt/libavcodec/internal.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/interplayvideo.c b/ffmpeg-mt/libavcodec/interplayvideo.c
index 34f0557..8dbe6f6 100644
--- a/ffmpeg-mt/libavcodec/interplayvideo.c
+++ b/ffmpeg-mt/libavcodec/interplayvideo.c
@@ -2,20 +2,20 @@
  * Interplay MVE Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1097,7 +1097,7 @@ static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec interplay_video_decoder = {
+AVCodec ff_interplay_video_decoder = {
     "interplayvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_INTERPLAY_VIDEO,
diff --git a/ffmpeg-mt/libavcodec/intrax8.c b/ffmpeg-mt/libavcodec/intrax8.c
index 75166e8..69f940a 100644
--- a/ffmpeg-mt/libavcodec/intrax8.c
+++ b/ffmpeg-mt/libavcodec/intrax8.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/intrax8.h b/ffmpeg-mt/libavcodec/intrax8.h
index 8ce4f8d..3a58938 100644
--- a/ffmpeg-mt/libavcodec/intrax8.h
+++ b/ffmpeg-mt/libavcodec/intrax8.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/intrax8dsp.c b/ffmpeg-mt/libavcodec/intrax8dsp.c
index 692e1b1..1a62fcd 100644
--- a/ffmpeg-mt/libavcodec/intrax8dsp.c
+++ b/ffmpeg-mt/libavcodec/intrax8dsp.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/intrax8huf.h b/ffmpeg-mt/libavcodec/intrax8huf.h
index 375906b..6bf01f3 100644
--- a/ffmpeg-mt/libavcodec/intrax8huf.h
+++ b/ffmpeg-mt/libavcodec/intrax8huf.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ituh263dec.c b/ffmpeg-mt/libavcodec/ituh263dec.c
index 8b5d939..676349c 100644
--- a/ffmpeg-mt/libavcodec/ituh263dec.c
+++ b/ffmpeg-mt/libavcodec/ituh263dec.c
@@ -5,20 +5,20 @@
  * Copyright (c) 2001 Juan J. Sierralta P
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -325,7 +325,7 @@ static int h263p_decode_umotion(MpegEncContext * s, int pred)
    code >>= 1;
 
    code = (sign) ? (pred - code) : (pred + code);
-   dprintf(s->avctx,"H.263+ UMV Motion = %d\n", code);
+   av_dlog(s->avctx,"H.263+ UMV Motion = %d\n", code);
    return code;
 
 }
@@ -951,7 +951,7 @@ int h263_decode_picture_header(MpegEncContext *s)
         if (ufep == 1) {
             /* OPPTYPE */
             format = get_bits(&s->gb, 3);
-            dprintf(s->avctx, "ufep=1, format: %d\n", format);
+            av_dlog(s->avctx, "ufep=1, format: %d\n", format);
             s->custom_pcf= get_bits1(&s->gb);
             s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */
             if (get_bits1(&s->gb) != 0) {
@@ -1002,7 +1002,7 @@ int h263_decode_picture_header(MpegEncContext *s)
             if (format == 6) {
                 /* Custom Picture Format (CPFMT) */
                 s->aspect_ratio_info = get_bits(&s->gb, 4);
-                dprintf(s->avctx, "aspect: %d\n", s->aspect_ratio_info);
+                av_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info);
                 /* aspect ratios:
                 0 - forbidden
                 1 - 1:1
@@ -1015,7 +1015,7 @@ int h263_decode_picture_header(MpegEncContext *s)
                 width = (get_bits(&s->gb, 9) + 1) * 4;
                 skip_bits1(&s->gb);
                 height = get_bits(&s->gb, 9) * 4;
-                dprintf(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height);
+                av_dlog(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height);
                 if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
                     /* aspected dimensions */
                     s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8);
diff --git a/ffmpeg-mt/libavcodec/ituh263enc.c b/ffmpeg-mt/libavcodec/ituh263enc.c
index 6a84636..6a9a174 100644
--- a/ffmpeg-mt/libavcodec/ituh263enc.c
+++ b/ffmpeg-mt/libavcodec/ituh263enc.c
@@ -5,20 +5,20 @@
  * Copyright (c) 2001 Juan J. Sierralta P
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ivi_common.c b/ffmpeg-mt/libavcodec/ivi_common.c
index 0e552bc..ac4c68e 100644
--- a/ffmpeg-mt/libavcodec/ivi_common.c
+++ b/ffmpeg-mt/libavcodec/ivi_common.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Maxim Poliakovski
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ivi_common.h b/ffmpeg-mt/libavcodec/ivi_common.h
index 803c058..582a1d7 100644
--- a/ffmpeg-mt/libavcodec/ivi_common.h
+++ b/ffmpeg-mt/libavcodec/ivi_common.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Maxim Poliakovski
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -221,7 +221,7 @@ static inline int ivi_scale_mv(int mv, int mv_scale)
 
 /**
  *  Generate a huffman codebook from the given descriptor
- *  and convert it into the FFmpeg VLC table.
+ *  and convert it into the Libav VLC table.
  *
  *  @param[in]   cb    pointer to codebook descriptor
  *  @param[out]  vlc   where to place the generated VLC table
diff --git a/ffmpeg-mt/libavcodec/ivi_dsp.c b/ffmpeg-mt/libavcodec/ivi_dsp.c
index ccaffd4..6b62dc8 100644
--- a/ffmpeg-mt/libavcodec/ivi_dsp.c
+++ b/ffmpeg-mt/libavcodec/ivi_dsp.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Maxim Poliakovski
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -461,7 +461,7 @@ void ff_ivi_mc_ ## size ##x## size ## suffix (int16_t *buf, const int16_t *ref_b
 #define OP_PUT(a, b)  (a) = (b)
 #define OP_ADD(a, b)  (a) += (b)
 
-IVI_MC_TEMPLATE(8, _no_delta, OP_PUT);
-IVI_MC_TEMPLATE(8, _delta,    OP_ADD);
-IVI_MC_TEMPLATE(4, _no_delta, OP_PUT);
-IVI_MC_TEMPLATE(4, _delta,    OP_ADD);
+IVI_MC_TEMPLATE(8, _no_delta, OP_PUT)
+IVI_MC_TEMPLATE(8, _delta,    OP_ADD)
+IVI_MC_TEMPLATE(4, _no_delta, OP_PUT)
+IVI_MC_TEMPLATE(4, _delta,    OP_ADD)
diff --git a/ffmpeg-mt/libavcodec/ivi_dsp.h b/ffmpeg-mt/libavcodec/ivi_dsp.h
index 4fb2f80..9632966 100644
--- a/ffmpeg-mt/libavcodec/ivi_dsp.h
+++ b/ffmpeg-mt/libavcodec/ivi_dsp.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Maxim Poliakovski
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/jpegls.c b/ffmpeg-mt/libavcodec/jpegls.c
index c40b929..ebe6b85 100644
--- a/ffmpeg-mt/libavcodec/jpegls.c
+++ b/ffmpeg-mt/libavcodec/jpegls.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Michael Niedermayer
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/jpegls.h b/ffmpeg-mt/libavcodec/jpegls.h
index 28c7524..1c1817e 100644
--- a/ffmpeg-mt/libavcodec/jpegls.h
+++ b/ffmpeg-mt/libavcodec/jpegls.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Michael Niedermayer
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/jpeglsdec.c b/ffmpeg-mt/libavcodec/jpeglsdec.c
index 6b7dd94..adaa0a3 100644
--- a/ffmpeg-mt/libavcodec/jpeglsdec.c
+++ b/ffmpeg-mt/libavcodec/jpeglsdec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Michael Niedermayer
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -262,9 +262,9 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
     JLSState *state;
     int off = 0, stride = 1, width, shift;
 
-    zero = av_mallocz(s->picture.linesize[0]);
+    zero = av_mallocz(s->picture_ptr->linesize[0]);
     last = zero;
-    cur = s->picture.data[0];
+    cur = s->picture_ptr->data[0];
 
     state = av_mallocz(sizeof(JLSState));
     /* initialize JPEG-LS state from JPEG parameters */
@@ -299,7 +299,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
                 t = *((uint16_t*)last);
             }
             last = cur;
-            cur += s->picture.linesize[0];
+            cur += s->picture_ptr->linesize[0];
 
             if (s->restart_interval && !--s->restart_count) {
                 align_get_bits(&s->gb);
@@ -309,7 +309,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
     } else if(ilv == 1) { /* line interleaving */
         int j;
         int Rc[3] = {0, 0, 0};
-        memset(cur, 0, s->picture.linesize[0]);
+        memset(cur, 0, s->picture_ptr->linesize[0]);
         width = s->width * 3;
         for(i = 0; i < s->height; i++) {
             for(j = 0; j < 3; j++) {
@@ -322,7 +322,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
                 }
             }
             last = cur;
-            cur += s->picture.linesize[0];
+            cur += s->picture_ptr->linesize[0];
         }
     } else if(ilv == 2) { /* sample interleaving */
         av_log(s->avctx, AV_LOG_ERROR, "Sample interleaved images are not supported.\n");
@@ -337,22 +337,22 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
         w = s->width * s->nb_components;
 
         if(s->bits <= 8){
-            uint8_t *src = s->picture.data[0];
+            uint8_t *src = s->picture_ptr->data[0];
 
             for(i = 0; i < s->height; i++){
                 for(x = off; x < w; x+= stride){
                     src[x] <<= shift;
                 }
-                src += s->picture.linesize[0];
+                src += s->picture_ptr->linesize[0];
             }
         }else{
-            uint16_t *src = (uint16_t*) s->picture.data[0];
+            uint16_t *src = (uint16_t*) s->picture_ptr->data[0];
 
             for(i = 0; i < s->height; i++){
                 for(x = 0; x < w; x++){
                     src[x] <<= shift;
                 }
-                src += s->picture.linesize[0]/2;
+                src += s->picture_ptr->linesize[0]/2;
             }
         }
     }
@@ -363,7 +363,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
 }
 
 
-AVCodec jpegls_decoder = {
+AVCodec ff_jpegls_decoder = {
     "jpegls",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_JPEGLS,
diff --git a/ffmpeg-mt/libavcodec/jpeglsdec.h b/ffmpeg-mt/libavcodec/jpeglsdec.h
index 5204ecb..4732822 100644
--- a/ffmpeg-mt/libavcodec/jpeglsdec.h
+++ b/ffmpeg-mt/libavcodec/jpeglsdec.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Michael Niedermayer
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/jpeglsenc.c b/ffmpeg-mt/libavcodec/jpeglsenc.c
index 08ef71f..56c6fb0 100644
--- a/ffmpeg-mt/libavcodec/jpeglsenc.c
+++ b/ffmpeg-mt/libavcodec/jpeglsenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Michael Niedermayer
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -382,7 +382,7 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) {
     return 0;
 }
 
-AVCodec jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
+AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
     "jpegls",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_JPEGLS,
diff --git a/ffmpeg-mt/libavcodec/jvdec.c b/ffmpeg-mt/libavcodec/jvdec.c
new file mode 100644
index 0000000..8f19ba3
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/jvdec.c
@@ -0,0 +1,215 @@
+/*
+ * Bitmap Brothers JV video decoder
+ * Copyright (c) 2011 Peter Ross <pross at xvid.org>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Bitmap Brothers JV video decoder
+ * @author Peter Ross <pross at xvid.org>
+ */
+
+#include "avcodec.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "libavutil/intreadwrite.h"
+
+typedef struct JvContext {
+    DSPContext dsp;
+    AVFrame    frame;
+    uint32_t   palette[AVPALETTE_COUNT];
+    int        palette_has_changed;
+} JvContext;
+
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+    JvContext *s = avctx->priv_data;
+    avctx->pix_fmt = PIX_FMT_PAL8;
+    dsputil_init(&s->dsp, avctx);
+    return 0;
+}
+
+/**
+ * Decode 2x2 block
+ */
+static inline void decode2x2(GetBitContext *gb, uint8_t *dst, int linesize)
+{
+    int i, j, v[2];
+
+    switch (get_bits(gb, 2)) {
+    case 1:
+        v[0] = get_bits(gb, 8);
+        for (j = 0; j < 2; j++)
+            memset(dst + j*linesize, v[0], 2);
+        break;
+    case 2:
+        v[0] = get_bits(gb, 8);
+        v[1] = get_bits(gb, 8);
+        for (j = 0; j < 2; j++)
+            for (i = 0; i < 2; i++)
+                dst[j*linesize + i] = v[get_bits1(gb)];
+        break;
+    case 3:
+        for (j = 0; j < 2; j++)
+            for (i = 0; i < 2; i++)
+                dst[j*linesize + i] = get_bits(gb, 8);
+    }
+}
+
+/**
+ * Decode 4x4 block
+ */
+static inline void decode4x4(GetBitContext *gb, uint8_t *dst, int linesize)
+{
+    int i, j, v[2];
+
+    switch (get_bits(gb, 2)) {
+    case 1:
+        v[0] = get_bits(gb, 8);
+        for (j = 0; j < 4; j++)
+            memset(dst + j*linesize, v[0], 4);
+        break;
+    case 2:
+        v[0] = get_bits(gb, 8);
+        v[1] = get_bits(gb, 8);
+        for (j = 2; j >= 0; j -= 2) {
+            for (i = 0; i < 4; i++)
+                dst[j*linesize + i]     = v[get_bits1(gb)];
+            for (i = 0; i < 4; i++)
+                dst[(j+1)*linesize + i] = v[get_bits1(gb)];
+        }
+        break;
+    case 3:
+        for (j = 0; j < 4; j += 2)
+            for (i = 0; i < 4; i += 2)
+                decode2x2(gb, dst + j*linesize + i, linesize);
+    }
+}
+
+/**
+ * Decode 8x8 block
+ */
+static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize, DSPContext *dsp)
+{
+    int i, j, v[2];
+
+    switch (get_bits(gb, 2)) {
+    case 1:
+        v[0] = get_bits(gb, 8);
+        dsp->fill_block_tab[1](dst, v[0], linesize, 8);
+        break;
+    case 2:
+        v[0] = get_bits(gb, 8);
+        v[1] = get_bits(gb, 8);
+        for (j = 7; j >= 0; j--)
+            for (i = 0; i <  8; i++)
+                dst[j*linesize + i] = v[get_bits1(gb)];
+        break;
+    case 3:
+        for (j = 0; j < 8; j += 4)
+            for (i = 0; i < 8; i += 4)
+                decode4x4(gb, dst + j*linesize + i, linesize);
+    }
+}
+
+static int decode_frame(AVCodecContext *avctx,
+                        void *data, int *data_size,
+                        AVPacket *avpkt)
+{
+    JvContext *s           = avctx->priv_data;
+    int buf_size           = avpkt->size;
+    const uint8_t *buf     = avpkt->data;
+    const uint8_t *buf_end = buf + buf_size;
+    int video_size, video_type, i, j;
+
+    video_size = AV_RL32(buf);
+    video_type = buf[4];
+    buf += 5;
+
+    if (video_size) {
+        if (avctx->reget_buffer(avctx, &s->frame) < 0) {
+            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+            return -1;
+        }
+
+        if (video_type == 0 || video_type == 1) {
+            GetBitContext gb;
+            init_get_bits(&gb, buf, FFMIN(video_size, buf_end - buf));
+
+            for (j = 0; j < avctx->height; j += 8)
+                for (i = 0; i < avctx->width; i += 8)
+                    decode8x8(&gb, s->frame.data[0] + j*s->frame.linesize[0] + i,
+                              s->frame.linesize[0], &s->dsp);
+
+            buf += video_size;
+        } else if (video_type == 2) {
+            if (buf + 1 <= buf_end) {
+                int v = *buf++;
+                for (j = 0; j < avctx->height; j++)
+                    memset(s->frame.data[0] + j*s->frame.linesize[0], v, avctx->width);
+            }
+        } else {
+            av_log(avctx, AV_LOG_WARNING, "unsupported frame type %i\n", video_type);
+            return AVERROR_INVALIDDATA;
+        }
+    }
+
+    if (buf < buf_end) {
+        for (i = 0; i < AVPALETTE_COUNT && buf + 3 <= buf_end; i++) {
+            s->palette[i] = AV_RB24(buf) << 2;
+            buf += 3;
+        }
+        s->palette_has_changed = 1;
+    }
+
+    if (video_size) {
+        s->frame.key_frame           = 1;
+        s->frame.pict_type           = FF_I_TYPE;
+        s->frame.palette_has_changed = s->palette_has_changed;
+        s->palette_has_changed       = 0;
+        memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
+
+        *data_size      = sizeof(AVFrame);
+        *(AVFrame*)data = s->frame;
+    }
+
+    return buf_size;
+}
+
+static av_cold int decode_close(AVCodecContext *avctx)
+{
+    JvContext *s = avctx->priv_data;
+
+    if(s->frame.data[0])
+        avctx->release_buffer(avctx, &s->frame);
+
+    return 0;
+}
+
+AVCodec ff_jv_decoder = {
+    .name           = "jv",
+    .long_name      = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_JV,
+    .priv_data_size = sizeof(JvContext),
+    .init           = decode_init,
+    .close          = decode_close,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
+};
diff --git a/ffmpeg-mt/libavcodec/kbdwin.c b/ffmpeg-mt/libavcodec/kbdwin.c
new file mode 100644
index 0000000..c2c1c59
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/kbdwin.c
@@ -0,0 +1,48 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <assert.h>
+#include <libavutil/mathematics.h>
+#include "libavutil/attributes.h"
+#include "kbdwin.h"
+
+#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation
+
+av_cold void ff_kbd_window_init(float *window, float alpha, int n)
+{
+   int i, j;
+   double sum = 0.0, bessel, tmp;
+   double local_window[FF_KBD_WINDOW_MAX];
+   double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n);
+
+   assert(n <= FF_KBD_WINDOW_MAX);
+
+   for (i = 0; i < n; i++) {
+       tmp = i * (n - i) * alpha2;
+       bessel = 1.0;
+       for (j = BESSEL_I0_ITER; j > 0; j--)
+           bessel = bessel * tmp / (j * j) + 1;
+       sum += bessel;
+       local_window[i] = sum;
+   }
+
+   sum++;
+   for (i = 0; i < n; i++)
+       window[i] = sqrt(local_window[i] / sum);
+}
+
diff --git a/ffmpeg-mt/libavcodec/kbdwin.h b/ffmpeg-mt/libavcodec/kbdwin.h
new file mode 100644
index 0000000..5ac2b8c
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/kbdwin.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_KBDWIN_H
+#define AVCODEC_KBDWIN_H
+
+/**
+ * Maximum window size for ff_kbd_window_init.
+ */
+#define FF_KBD_WINDOW_MAX 1024
+
+/**
+ * Generate a Kaiser-Bessel Derived Window.
+ * @param   window  pointer to half window
+ * @param   alpha   determines window shape
+ * @param   n       size of half window, max FF_KBD_WINDOW_MAX
+ */
+void ff_kbd_window_init(float *window, float alpha, int n);
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/kgv1dec.c b/ffmpeg-mt/libavcodec/kgv1dec.c
index a41d312..5768434 100644
--- a/ffmpeg-mt/libavcodec/kgv1dec.c
+++ b/ffmpeg-mt/libavcodec/kgv1dec.c
@@ -2,20 +2,20 @@
  * Kega Game Video (KGV1) decoder
  * Copyright (c) 2010 Daniel Verkamp
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 
 typedef struct {
@@ -164,7 +164,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec kgv1_decoder = {
+AVCodec ff_kgv1_decoder = {
     "kgv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_KGV1,
diff --git a/ffmpeg-mt/libavcodec/kmvc.c b/ffmpeg-mt/libavcodec/kmvc.c
index 3e8dccd..2671cc6 100644
--- a/ffmpeg-mt/libavcodec/kmvc.c
+++ b/ffmpeg-mt/libavcodec/kmvc.c
@@ -2,20 +2,20 @@
  * KMVC decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -401,7 +401,7 @@ static av_cold int decode_end(AVCodecContext * avctx)
     return 0;
 }
 
-AVCodec kmvc_decoder = {
+AVCodec ff_kmvc_decoder = {
     "kmvc",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_KMVC,
diff --git a/ffmpeg-mt/libavcodec/lagarith.c b/ffmpeg-mt/libavcodec/lagarith.c
index 1bf61bd..53f274d 100644
--- a/ffmpeg-mt/libavcodec/lagarith.c
+++ b/ffmpeg-mt/libavcodec/lagarith.c
@@ -2,20 +2,20 @@
  * Lagarith lossless decoder
  * Copyright (c) 2009 Nathan Caldwell <saintdev (at) gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -508,9 +508,9 @@ static av_cold int lag_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec lagarith_decoder = {
+AVCodec ff_lagarith_decoder = {
     "lagarith",
-    CODEC_TYPE_VIDEO,
+    AVMEDIA_TYPE_VIDEO,
     CODEC_ID_LAGARITH,
     sizeof(LagarithContext),
     lag_decode_init,
diff --git a/ffmpeg-mt/libavcodec/lagarithrac.c b/ffmpeg-mt/libavcodec/lagarithrac.c
index 0cbc3b8..f1ffbf0 100644
--- a/ffmpeg-mt/libavcodec/lagarithrac.c
+++ b/ffmpeg-mt/libavcodec/lagarithrac.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Nathan Caldwell <saintdev (at) gmail.com>
  * Copyright (c) 2009 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/lagarithrac.h b/ffmpeg-mt/libavcodec/lagarithrac.h
index d985b60..7d0d05c 100644
--- a/ffmpeg-mt/libavcodec/lagarithrac.h
+++ b/ffmpeg-mt/libavcodec/lagarithrac.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Nathan Caldwell <saintdev (at) gmail.com>
  * Copyright (c) 2009 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/latm_parser.c b/ffmpeg-mt/libavcodec/latm_parser.c
index b8b67ef..fe39de8 100644
--- a/ffmpeg-mt/libavcodec/latm_parser.c
+++ b/ffmpeg-mt/libavcodec/latm_parser.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2008 Paul Kendall <paul at kcbbs.gen.nz>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,12 +23,7 @@
  * AAC LATM parser
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-
+#include <stdint.h>
 #include "parser.h"
 
 #define LATM_HEADER     0x56e000        // 0x2b7 (11 bits)
@@ -110,7 +105,7 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
     return next;
 }
 
-AVCodecParser aac_latm_parser = {
+AVCodecParser ff_aac_latm_parser = {
     { CODEC_ID_AAC_LATM },
     sizeof(LATMParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/lcl.h b/ffmpeg-mt/libavcodec/lcl.h
index b60c0e9..4e7e170 100644
--- a/ffmpeg-mt/libavcodec/lcl.h
+++ b/ffmpeg-mt/libavcodec/lcl.h
@@ -2,20 +2,20 @@
  * LCL (LossLess Codec Library) Codec
  * Copyright (c) 2002-2004 Roberto Togni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/lcldec.c b/ffmpeg-mt/libavcodec/lcldec.c
index 23af511..70414d4 100644
--- a/ffmpeg-mt/libavcodec/lcldec.c
+++ b/ffmpeg-mt/libavcodec/lcldec.c
@@ -2,20 +2,20 @@
  * LCL (LossLess Codec Library) Codec
  * Copyright (c) 2002-2004 Roberto Togni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -609,7 +609,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
 }
 
 #if CONFIG_MSZH_DECODER
-AVCodec mszh_decoder = {
+AVCodec ff_mszh_decoder = {
     "mszh",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSZH,
@@ -624,7 +624,7 @@ AVCodec mszh_decoder = {
 #endif
 
 #if CONFIG_ZLIB_DECODER
-AVCodec zlib_decoder = {
+AVCodec ff_zlib_decoder = {
     "zlib",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ZLIB,
diff --git a/ffmpeg-mt/libavcodec/lclenc.c b/ffmpeg-mt/libavcodec/lclenc.c
index f50b588..63cb237 100644
--- a/ffmpeg-mt/libavcodec/lclenc.c
+++ b/ffmpeg-mt/libavcodec/lclenc.c
@@ -2,20 +2,20 @@
  * LCL (LossLess Codec Library) Codec
  * Copyright (c) 2002-2004 Roberto Togni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -170,7 +170,7 @@ static av_cold int encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec zlib_encoder = {
+AVCodec ff_zlib_encoder = {
     "zlib",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ZLIB,
diff --git a/ffmpeg-mt/libavcodec/libavcodec.v b/ffmpeg-mt/libavcodec/libavcodec.v
index 561a42c..6569903 100644
--- a/ffmpeg-mt/libavcodec/libavcodec.v
+++ b/ffmpeg-mt/libavcodec/libavcodec.v
@@ -1,3 +1,9 @@
 LIBAVCODEC_$MAJOR {
         global: *;
+        local:
+                ff_*_bsf;
+                ff_*_decoder;
+                ff_*_encoder;
+                ff_*_hwaccel;
+                ff_*_parser;
 };
diff --git a/ffmpeg-mt/libavcodec/libdirac.h b/ffmpeg-mt/libavcodec/libdirac.h
index 0dc19ca..9430dcc 100644
--- a/ffmpeg-mt/libavcodec/libdirac.h
+++ b/ffmpeg-mt/libavcodec/libdirac.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/libdirac_libschro.c b/ffmpeg-mt/libavcodec/libdirac_libschro.c
index aee1858..525d866 100644
--- a/ffmpeg-mt/libavcodec/libdirac_libschro.c
+++ b/ffmpeg-mt/libavcodec/libdirac_libschro.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/libdirac_libschro.h b/ffmpeg-mt/libavcodec/libdirac_libschro.h
index 3d63f97..9c2e9e7 100644
--- a/ffmpeg-mt/libavcodec/libdirac_libschro.h
+++ b/ffmpeg-mt/libavcodec/libdirac_libschro.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/libdiracdec.c b/ffmpeg-mt/libavcodec/libdiracdec.c
index 0e8454e..3670e57 100644
--- a/ffmpeg-mt/libavcodec/libdiracdec.c
+++ b/ffmpeg-mt/libavcodec/libdiracdec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk>
  * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,7 +28,7 @@
 * (http://dirac.sourceforge.net/specification.html).
 */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "libdirac.h"
 
 #undef NDEBUG
@@ -194,7 +194,7 @@ static void libdirac_flush(AVCodecContext *avccontext)
 
 
 
-AVCodec libdirac_decoder = {
+AVCodec ff_libdirac_decoder = {
     "libdirac",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DIRAC,
diff --git a/ffmpeg-mt/libavcodec/libdiracenc.c b/ffmpeg-mt/libavcodec/libdiracenc.c
index d390aa8..ff4b92f 100644
--- a/ffmpeg-mt/libavcodec/libdiracenc.c
+++ b/ffmpeg-mt/libavcodec/libdiracenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk>
  * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -391,7 +391,7 @@ static av_cold int libdirac_encode_close(AVCodecContext *avccontext)
 }
 
 
-AVCodec libdirac_encoder = {
+AVCodec ff_libdirac_encoder = {
     "libdirac",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DIRAC,
diff --git a/ffmpeg-mt/libavcodec/libfaac.c b/ffmpeg-mt/libavcodec/libfaac.c
index b220b17..51d965e 100644
--- a/ffmpeg-mt/libavcodec/libfaac.c
+++ b/ffmpeg-mt/libavcodec/libfaac.c
@@ -2,20 +2,20 @@
  * Interface to libfaac for aac encoding
  * Copyright (c) 2002 Gildas Bazin <gbazin at netcourrier.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -124,10 +124,11 @@ static int Faac_encode_frame(AVCodecContext *avctx,
 {
     FaacAudioContext *s = avctx->priv_data;
     int bytes_written;
+    int num_samples = data ? avctx->frame_size : 0;
 
     bytes_written = faacEncEncode(s->faac_handle,
                                   data,
-                                  avctx->frame_size * avctx->channels,
+                                  num_samples * avctx->channels,
                                   frame,
                                   buf_size);
 
@@ -145,7 +146,15 @@ static av_cold int Faac_encode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec libfaac_encoder = {
+static const AVProfile profiles[] = {
+    { FF_PROFILE_AAC_MAIN, "Main" },
+    { FF_PROFILE_AAC_LOW,  "LC"   },
+    { FF_PROFILE_AAC_SSR,  "SSR"  },
+    { FF_PROFILE_AAC_LTP,  "LTP"  },
+    { FF_PROFILE_UNKNOWN },
+};
+
+AVCodec ff_libfaac_encoder = {
     "libfaac",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AAC,
@@ -153,6 +162,8 @@ AVCodec libfaac_encoder = {
     Faac_encode_init,
     Faac_encode_frame,
     Faac_encode_close,
+    .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
     .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
+    .profiles = NULL_IF_CONFIG_SMALL(profiles),
 };
diff --git a/ffmpeg-mt/libavcodec/libgsm.c b/ffmpeg-mt/libavcodec/libgsm.c
index 77cc891..34f2957 100644
--- a/ffmpeg-mt/libavcodec/libgsm.c
+++ b/ffmpeg-mt/libavcodec/libgsm.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2005 Alban Bedel <albeu at free.fr>
  * Copyright (c) 2006, 2007 Michel Bardiaux <mbardiaux at mediaxim.be>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -112,7 +112,7 @@ static int libgsm_encode_frame(AVCodecContext *avctx,
 }
 
 
-AVCodec libgsm_encoder = {
+AVCodec ff_libgsm_encoder = {
     "libgsm",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_GSM,
@@ -124,7 +124,7 @@ AVCodec libgsm_encoder = {
     .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
 };
 
-AVCodec libgsm_ms_encoder = {
+AVCodec ff_libgsm_ms_encoder = {
     "libgsm_ms",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_GSM_MS,
@@ -156,7 +156,7 @@ static int libgsm_decode_frame(AVCodecContext *avctx,
     return avctx->block_align;
 }
 
-AVCodec libgsm_decoder = {
+AVCodec ff_libgsm_decoder = {
     "libgsm",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_GSM,
@@ -168,7 +168,7 @@ AVCodec libgsm_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
 };
 
-AVCodec libgsm_ms_decoder = {
+AVCodec ff_libgsm_ms_decoder = {
     "libgsm_ms",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_GSM_MS,
diff --git a/ffmpeg-mt/libavcodec/libmp3lame.c b/ffmpeg-mt/libavcodec/libmp3lame.c
index 35c8054..62b55c9 100644
--- a/ffmpeg-mt/libavcodec/libmp3lame.c
+++ b/ffmpeg-mt/libavcodec/libmp3lame.c
@@ -2,20 +2,20 @@
  * Interface to libmp3lame for mp3 encoding
  * Copyright (c) 2002 Lennert Buytenhek <buytenh at gnu.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -213,7 +213,7 @@ static av_cold int MP3lame_encode_close(AVCodecContext *avctx)
 }
 
 
-AVCodec libmp3lame_encoder = {
+AVCodec ff_libmp3lame_encoder = {
     "libmp3lame",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MP3,
diff --git a/ffmpeg-mt/libavcodec/libopencore-amr.c b/ffmpeg-mt/libavcodec/libopencore-amr.c
index ab1f89a..a7abe26 100644
--- a/ffmpeg-mt/libavcodec/libopencore-amr.c
+++ b/ffmpeg-mt/libavcodec/libopencore-amr.c
@@ -2,20 +2,20 @@
  * AMR Audio decoder stub
  * Copyright (c) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -139,7 +139,7 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
     return packet_size;
 }
 
-AVCodec libopencore_amrnb_decoder = {
+AVCodec ff_libopencore_amrnb_decoder = {
     "libopencore_amrnb",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AMR_NB,
@@ -213,7 +213,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx,
     return written;
 }
 
-AVCodec libopencore_amrnb_encoder = {
+AVCodec ff_libopencore_amrnb_encoder = {
     "libopencore_amrnb",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AMR_NB,
@@ -310,7 +310,7 @@ static int amr_wb_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec libopencore_amrwb_decoder = {
+AVCodec ff_libopencore_amrwb_decoder = {
     "libopencore_amrwb",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_AMR_WB,
diff --git a/ffmpeg-mt/libavcodec/libopenjpeg.c b/ffmpeg-mt/libavcodec/libopenjpeg.c
index a23b17f..342dcd9 100644
--- a/ffmpeg-mt/libavcodec/libopenjpeg.c
+++ b/ffmpeg-mt/libavcodec/libopenjpeg.c
@@ -2,20 +2,20 @@
  * JPEG 2000 decoding support via OpenJPEG
  * Copyright (c) 2009 Jaikrishnan Menon <realityman at gmx.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,7 +24,7 @@
 * JPEG 2000 decoder using libopenjpeg
 */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "libavutil/intreadwrite.h"
 #define  OPJ_STATIC
@@ -184,7 +184,7 @@ static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
 }
 
 
-AVCodec libopenjpeg_decoder = {
+AVCodec ff_libopenjpeg_decoder = {
     "libopenjpeg",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_JPEG2000,
diff --git a/ffmpeg-mt/libavcodec/libschroedinger.c b/ffmpeg-mt/libavcodec/libschroedinger.c
index 04c15a2..804d652 100644
--- a/ffmpeg-mt/libavcodec/libschroedinger.c
+++ b/ffmpeg-mt/libavcodec/libschroedinger.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/libschroedinger.h b/ffmpeg-mt/libavcodec/libschroedinger.h
index 65a41e6..c9e2a5e 100644
--- a/ffmpeg-mt/libavcodec/libschroedinger.h
+++ b/ffmpeg-mt/libavcodec/libschroedinger.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/libschroedingerdec.c b/ffmpeg-mt/libavcodec/libschroedingerdec.c
index fc875bb..672745a 100644
--- a/ffmpeg-mt/libavcodec/libschroedingerdec.c
+++ b/ffmpeg-mt/libavcodec/libschroedingerdec.c
@@ -2,20 +2,20 @@
  * Dirac decoder support via Schroedinger libraries
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 * (http://dirac.sourceforge.net/specification.html).
 */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "libdirac_libschro.h"
 #include "libschroedinger.h"
@@ -346,7 +346,7 @@ static void libschroedinger_flush(AVCodecContext *avccontext)
     p_schro_params->eos_signalled = 0;
 }
 
-AVCodec libschroedinger_decoder = {
+AVCodec ff_libschroedinger_decoder = {
     "libschroedinger",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DIRAC,
diff --git a/ffmpeg-mt/libavcodec/libschroedingerenc.c b/ffmpeg-mt/libavcodec/libschroedingerenc.c
index c4a0433..d7190d0 100644
--- a/ffmpeg-mt/libavcodec/libschroedingerenc.c
+++ b/ffmpeg-mt/libavcodec/libschroedingerenc.c
@@ -2,20 +2,20 @@
  * Dirac encoder support via Schroedinger libraries
  * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -422,7 +422,7 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext)
 }
 
 
-AVCodec libschroedinger_encoder = {
+AVCodec ff_libschroedinger_encoder = {
     "libschroedinger",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_DIRAC,
diff --git a/ffmpeg-mt/libavcodec/libspeexdec.c b/ffmpeg-mt/libavcodec/libspeexdec.c
index 204e52c..e6626dc 100644
--- a/ffmpeg-mt/libavcodec/libspeexdec.c
+++ b/ffmpeg-mt/libavcodec/libspeexdec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2008 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -138,7 +138,7 @@ static av_cold int libspeex_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec libspeex_decoder = {
+AVCodec ff_libspeex_decoder = {
     "libspeex",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_SPEEX,
diff --git a/ffmpeg-mt/libavcodec/libtheoraenc.c b/ffmpeg-mt/libavcodec/libtheoraenc.c
index e4ca721..cc614e3 100644
--- a/ffmpeg-mt/libavcodec/libtheoraenc.c
+++ b/ffmpeg-mt/libavcodec/libtheoraenc.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2006 Paul Richards <paul.richards at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -357,7 +357,7 @@ static av_cold int encode_close(AVCodecContext* avc_context)
 }
 
 /** AVCodec struct exposed to libavcodec */
-AVCodec libtheora_encoder = {
+AVCodec ff_libtheora_encoder = {
     .name = "libtheora",
     .type = AVMEDIA_TYPE_VIDEO,
     .id = CODEC_ID_THEORA,
diff --git a/ffmpeg-mt/libavcodec/libvorbis.c b/ffmpeg-mt/libavcodec/libvorbis.c
index ef56c25..0a52daf 100644
--- a/ffmpeg-mt/libavcodec/libvorbis.c
+++ b/ffmpeg-mt/libavcodec/libvorbis.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2002 Mark Hills <mark at pogo.org.uk>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -243,7 +243,7 @@ static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) {
 }
 
 
-AVCodec libvorbis_encoder = {
+AVCodec ff_libvorbis_encoder = {
     "libvorbis",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_VORBIS,
diff --git a/ffmpeg-mt/libavcodec/libvpxdec.c b/ffmpeg-mt/libavcodec/libvpxdec.c
index 12efb9f..2aa077c 100644
--- a/ffmpeg-mt/libavcodec/libvpxdec.c
+++ b/ffmpeg-mt/libavcodec/libvpxdec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010, Google, Inc.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 #include <vpx/vpx_decoder.h>
 #include <vpx/vp8dx.h>
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 
 typedef struct VP8DecoderContext {
@@ -111,7 +111,7 @@ static av_cold int vp8_free(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec libvpx_decoder = {
+AVCodec ff_libvpx_decoder = {
     "libvpx",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP8,
diff --git a/ffmpeg-mt/libavcodec/libvpxenc.c b/ffmpeg-mt/libavcodec/libvpxenc.c
index d0838ba..2d818e1 100644
--- a/ffmpeg-mt/libavcodec/libvpxenc.c
+++ b/ffmpeg-mt/libavcodec/libvpxenc.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010, Google, Inc.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -494,7 +494,7 @@ static int vp8_encode(AVCodecContext *avctx, uint8_t *buf, int buf_size,
     return coded_size;
 }
 
-AVCodec libvpx_encoder = {
+AVCodec ff_libvpx_encoder = {
     "libvpx",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP8,
diff --git a/ffmpeg-mt/libavcodec/libx264.c b/ffmpeg-mt/libavcodec/libx264.c
index 0dad5cd..5825945 100644
--- a/ffmpeg-mt/libavcodec/libx264.c
+++ b/ffmpeg-mt/libavcodec/libx264.c
@@ -2,20 +2,20 @@
  * H.264 encoding using the x264 library
  * Copyright (C) 2005  Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -105,6 +105,10 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
             frame->pict_type == FF_P_TYPE ? X264_TYPE_P :
             frame->pict_type == FF_B_TYPE ? X264_TYPE_B :
                                             X264_TYPE_AUTO;
+        if (x4->params.b_tff != frame->top_field_first) {
+            x4->params.b_tff = frame->top_field_first;
+            x264_encoder_reconfig(x4->enc, &x4->params);
+        }
     }
 
     do {
@@ -273,12 +277,11 @@ static av_cold int X264_init(AVCodecContext *avctx)
     if (avctx->level > 0)
         x4->params.i_level_idc = avctx->level;
 
-    if ((avctx->rc_buffer_size != 0) &&
+    if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy &&
         (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
         x4->params.rc.f_vbv_buffer_init =
             (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
-    } else
-        x4->params.rc.f_vbv_buffer_init = 0.9;
+    }
 
     x4->params.rc.b_mb_tree               = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
     x4->params.rc.f_ip_factor             = 1 / fabs(avctx->i_quant_factor);
@@ -325,7 +328,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec libx264_encoder = {
+AVCodec ff_libx264_encoder = {
     .name           = "libx264",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_H264,
diff --git a/ffmpeg-mt/libavcodec/libxavs.c b/ffmpeg-mt/libavcodec/libxavs.c
index aa5dc23..7732914 100644
--- a/ffmpeg-mt/libavcodec/libxavs.c
+++ b/ffmpeg-mt/libavcodec/libxavs.c
@@ -2,20 +2,20 @@
  * AVS encoding using the xavs library
  * Copyright (C) 2010 Amanda, Y.N. Wu <amanda11192003 at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -336,7 +336,7 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec libxavs_encoder = {
+AVCodec ff_libxavs_encoder = {
     .name           = "libxavs",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_CAVS,
diff --git a/ffmpeg-mt/libavcodec/libxvid_internal.h b/ffmpeg-mt/libavcodec/libxvid_internal.h
index 6517f62..a2dc6ef 100644
--- a/ffmpeg-mt/libavcodec/libxvid_internal.h
+++ b/ffmpeg-mt/libavcodec/libxvid_internal.h
@@ -1,20 +1,20 @@
 /*
  * copyright (C) 2006 Corey Hickey
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/libxvid_rc.c b/ffmpeg-mt/libavcodec/libxvid_rc.c
index 08e89c8..9e33170 100644
--- a/ffmpeg-mt/libavcodec/libxvid_rc.c
+++ b/ffmpeg-mt/libavcodec/libxvid_rc.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/libxvidff.c b/ffmpeg-mt/libavcodec/libxvidff.c
index f527354..89360e0 100644
--- a/ffmpeg-mt/libavcodec/libxvidff.c
+++ b/ffmpeg-mt/libavcodec/libxvidff.c
@@ -2,20 +2,20 @@
  * Interface to xvidcore for mpeg4 encoding
  * Copyright (c) 2004 Adam Thayer <krevnik at comcast.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -527,18 +527,14 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) {
 
     xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
 
-    if( avctx->extradata != NULL )
-        av_freep(&avctx->extradata);
+    av_freep(&avctx->extradata);
     if( x->twopassbuffer != NULL ) {
         av_free(x->twopassbuffer);
         av_free(x->old_twopassbuffer);
     }
-    if( x->twopassfile != NULL )
-        av_free(x->twopassfile);
-    if( x->intra_matrix != NULL )
-        av_free(x->intra_matrix);
-    if( x->inter_matrix != NULL )
-        av_free(x->inter_matrix);
+    av_free(x->twopassfile);
+    av_free(x->intra_matrix);
+    av_free(x->inter_matrix);
 
     return 0;
 }
@@ -814,7 +810,7 @@ int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2) {
 /**
  * Xvid codec definition for libavcodec.
  */
-AVCodec libxvid_encoder = {
+AVCodec ff_libxvid_encoder = {
     "libxvid",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG4,
diff --git a/ffmpeg-mt/libavcodec/ljpegenc.c b/ffmpeg-mt/libavcodec/ljpegenc.c
index 2ef07c3..9eeb6f2 100644
--- a/ffmpeg-mt/libavcodec/ljpegenc.c
+++ b/ffmpeg-mt/libavcodec/ljpegenc.c
@@ -8,20 +8,20 @@
  * aspecting, new decode_frame mechanism and apple mjpeg-b support
  *                                  by Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -186,7 +186,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
 }
 
 
-AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
+AVCodec ff_ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
     "ljpeg",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_LJPEG,
diff --git a/ffmpeg-mt/libavcodec/loco.c b/ffmpeg-mt/libavcodec/loco.c
index d19a80c..0733d09 100644
--- a/ffmpeg-mt/libavcodec/loco.c
+++ b/ffmpeg-mt/libavcodec/loco.c
@@ -2,20 +2,20 @@
  * LOCO codec
  * Copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -285,7 +285,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec loco_decoder = {
+AVCodec ff_loco_decoder = {
     "loco",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_LOCO,
diff --git a/ffmpeg-mt/libavcodec/lpc.c b/ffmpeg-mt/libavcodec/lpc.c
index 112a78d..58bb02d 100644
--- a/ffmpeg-mt/libavcodec/lpc.c
+++ b/ffmpeg-mt/libavcodec/lpc.c
@@ -2,25 +2,24 @@
  * LPC utility code
  * Copyright (c) 2006  Justin Ruggles <justin.ruggles at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/lls.h"
-#include "dsputil.h"
 
 #define LPC_USE_DOUBLE
 #include "lpc.h"
@@ -29,7 +28,8 @@
 /**
  * Apply Welch window function to audio block
  */
-static void apply_welch_window(const int32_t *data, int len, double *w_data)
+static void lpc_apply_welch_window_c(const int32_t *data, int len,
+                                     double *w_data)
 {
     int i, n2;
     double w;
@@ -55,24 +55,16 @@ static void apply_welch_window(const int32_t *data, int len, double *w_data)
  * Calculate autocorrelation data from audio samples
  * A Welch window function is applied before calculation.
  */
-void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag,
-                             double *autoc)
+static void lpc_compute_autocorr_c(const double *data, int len, int lag,
+                                   double *autoc)
 {
     int i, j;
-    double tmp[len + lag + 1];
-    double *data1= tmp + lag;
-
-    apply_welch_window(data, len, data1);
-
-    for(j=0; j<lag; j++)
-        data1[j-lag]= 0.0;
-    data1[len] = 0.0;
 
     for(j=0; j<lag; j+=2){
         double sum0 = 1.0, sum1 = 1.0;
         for(i=j; i<len; i++){
-            sum0 += data1[i] * data1[i-j];
-            sum1 += data1[i] * data1[i-j-1];
+            sum0 += data[i] * data[i-j];
+            sum1 += data[i] * data[i-j-1];
         }
         autoc[j  ] = sum0;
         autoc[j+1] = sum1;
@@ -81,8 +73,8 @@ void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag,
     if(j==lag){
         double sum = 1.0;
         for(i=j-1; i<len; i+=2){
-            sum += data1[i  ] * data1[i-j  ]
-                 + data1[i+1] * data1[i-j+1];
+            sum += data[i  ] * data[i-j  ]
+                 + data[i+1] * data[i-j+1];
         }
         autoc[j] = sum;
     }
@@ -162,7 +154,7 @@ static int estimate_best_order(double *ref, int min_order, int max_order)
  * 1  = LPC with coeffs determined by Levinson-Durbin recursion
  * 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes.
  */
-int ff_lpc_calc_coefs(DSPContext *s,
+int ff_lpc_calc_coefs(LPCContext *s,
                       const int32_t *samples, int blocksize, int min_order,
                       int max_order, int precision,
                       int32_t coefs[][MAX_LPC_ORDER], int *shift,
@@ -178,8 +170,19 @@ int ff_lpc_calc_coefs(DSPContext *s,
     assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER &&
            lpc_type > AV_LPC_TYPE_FIXED);
 
+    /* reinit LPC context if parameters have changed */
+    if (blocksize != s->blocksize || max_order != s->max_order ||
+        lpc_type  != s->lpc_type) {
+        ff_lpc_end(s);
+        ff_lpc_init(s, blocksize, max_order, lpc_type);
+    }
+
     if (lpc_type == AV_LPC_TYPE_LEVINSON) {
-        s->lpc_compute_autocorr(samples, blocksize, max_order, autoc);
+        double *windowed_samples = s->windowed_samples + max_order;
+
+        s->lpc_apply_welch_window(samples, blocksize, windowed_samples);
+
+        s->lpc_compute_autocorr(windowed_samples, blocksize, max_order, autoc);
 
         compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1);
 
@@ -236,3 +239,33 @@ int ff_lpc_calc_coefs(DSPContext *s,
 
     return opt_order;
 }
+
+av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
+                        enum AVLPCType lpc_type)
+{
+    s->blocksize = blocksize;
+    s->max_order = max_order;
+    s->lpc_type  = lpc_type;
+
+    if (lpc_type == AV_LPC_TYPE_LEVINSON) {
+        s->windowed_samples = av_mallocz((blocksize + max_order + 2) *
+                                         sizeof(*s->windowed_samples));
+        if (!s->windowed_samples)
+            return AVERROR(ENOMEM);
+    } else {
+        s->windowed_samples = NULL;
+    }
+
+    s->lpc_apply_welch_window = lpc_apply_welch_window_c;
+    s->lpc_compute_autocorr   = lpc_compute_autocorr_c;
+
+    if (HAVE_MMX)
+        ff_lpc_init_x86(s);
+
+    return 0;
+}
+
+av_cold void ff_lpc_end(LPCContext *s)
+{
+    av_freep(&s->windowed_samples);
+}
diff --git a/ffmpeg-mt/libavcodec/lpc.h b/ffmpeg-mt/libavcodec/lpc.h
index 1c595f6..c2d3428 100644
--- a/ffmpeg-mt/libavcodec/lpc.h
+++ b/ffmpeg-mt/libavcodec/lpc.h
@@ -2,20 +2,20 @@
  * LPC utility code
  * Copyright (c) 2006  Justin Ruggles <justin.ruggles at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,18 +36,61 @@
 #define MAX_LPC_ORDER       32
 
 
+typedef struct LPCContext {
+    int blocksize;
+    int max_order;
+    enum AVLPCType lpc_type;
+    double *windowed_samples;
+
+    /**
+     * Apply a Welch window to an array of input samples.
+     * The output samples have the same scale as the input, but are in double
+     * sample format.
+     * @param data    input samples
+     * @param len     number of input samples
+     * @param w_data  output samples
+     */
+    void (*lpc_apply_welch_window)(const int32_t *data, int len,
+                                   double *w_data);
+    /**
+     * Perform autocorrelation on input samples with delay of 0 to lag.
+     * @param data  input samples.
+     *              constraints: no alignment needed, but must have have at
+     *              least lag*sizeof(double) valid bytes preceeding it, and
+     *              size must be at least (len+1)*sizeof(double) if data is
+     *              16-byte aligned or (len+2)*sizeof(double) if data is
+     *              unaligned.
+     * @param len   number of input samples to process
+     * @param lag   maximum delay to calculate
+     * @param autoc output autocorrelation coefficients.
+     *              constraints: array size must be at least lag+1.
+     */
+    void (*lpc_compute_autocorr)(const double *data, int len, int lag,
+                                 double *autoc);
+} LPCContext;
+
+
 /**
  * Calculate LPC coefficients for multiple orders
  */
-int ff_lpc_calc_coefs(DSPContext *s,
+int ff_lpc_calc_coefs(LPCContext *s,
                       const int32_t *samples, int blocksize, int min_order,
                       int max_order, int precision,
                       int32_t coefs[][MAX_LPC_ORDER], int *shift,
                       enum AVLPCType lpc_type, int lpc_passes,
                       int omethod, int max_shift, int zero_shift);
 
-void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag,
-                             double *autoc);
+/**
+ * Initialize LPCContext.
+ */
+int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
+                enum AVLPCType lpc_type);
+void ff_lpc_init_x86(LPCContext *s);
+
+/**
+ * Uninitialize LPCContext.
+ */
+void ff_lpc_end(LPCContext *s);
 
 #ifdef LPC_USE_DOUBLE
 #define LPC_TYPE double
diff --git a/ffmpeg-mt/libavcodec/lsp.c b/ffmpeg-mt/libavcodec/lsp.c
index 98ca490..d9ddd7d 100644
--- a/ffmpeg-mt/libavcodec/lsp.c
+++ b/ffmpeg-mt/libavcodec/lsp.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet (QCELP decoder)
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/lsp.h b/ffmpeg-mt/libavcodec/lsp.h
index e3af30d..388de51 100644
--- a/ffmpeg-mt/libavcodec/lsp.h
+++ b/ffmpeg-mt/libavcodec/lsp.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2008 Vladimir Voroshilov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/lzw.c b/ffmpeg-mt/libavcodec/lzw.c
index aa88691..6129429 100644
--- a/ffmpeg-mt/libavcodec/lzw.c
+++ b/ffmpeg-mt/libavcodec/lzw.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/lzw.h b/ffmpeg-mt/libavcodec/lzw.h
index 76a5b67..d1efdaf 100644
--- a/ffmpeg-mt/libavcodec/lzw.h
+++ b/ffmpeg-mt/libavcodec/lzw.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/lzwenc.c b/ffmpeg-mt/libavcodec/lzwenc.c
index 23248a6..df38116 100644
--- a/ffmpeg-mt/libavcodec/lzwenc.c
+++ b/ffmpeg-mt/libavcodec/lzwenc.c
@@ -2,20 +2,20 @@
  * LZW encoder
  * Copyright (c) 2007 Bartlomiej Wolowiec
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mace.c b/ffmpeg-mt/libavcodec/mace.c
index c4c43f6..53ec056 100644
--- a/ffmpeg-mt/libavcodec/mace.c
+++ b/ffmpeg-mt/libavcodec/mace.c
@@ -2,20 +2,20 @@
  * MACE decoder
  * Copyright (c) 2002 Laszlo Torok <torokl at alpha.dfmk.hu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -279,7 +279,7 @@ static int mace_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-AVCodec mace3_decoder = {
+AVCodec ff_mace3_decoder = {
     "mace3",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MACE3,
@@ -291,7 +291,7 @@ AVCodec mace3_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"),
 };
 
-AVCodec mace6_decoder = {
+AVCodec ff_mace6_decoder = {
     "mace6",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MACE6,
diff --git a/ffmpeg-mt/libavcodec/mathops.h b/ffmpeg-mt/libavcodec/mathops.h
index 4d88ed1..547bc1a 100644
--- a/ffmpeg-mt/libavcodec/mathops.h
+++ b/ffmpeg-mt/libavcodec/mathops.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2001, 2002 Fabrice Bellard
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVCODEC_MATHOPS_H
diff --git a/ffmpeg-mt/libavcodec/mdct.c b/ffmpeg-mt/libavcodec/mdct.c
index c511188..6f64534 100644
--- a/ffmpeg-mt/libavcodec/mdct.c
+++ b/ffmpeg-mt/libavcodec/mdct.c
@@ -2,20 +2,20 @@
  * MDCT/IMDCT transforms
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,38 +24,18 @@
 #include "libavutil/common.h"
 #include "libavutil/mathematics.h"
 #include "fft.h"
+#include "fft-internal.h"
 
 /**
  * @file
  * MDCT/IMDCT transforms.
  */
 
-// Generate a Kaiser-Bessel Derived Window.
-#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation
-av_cold void ff_kbd_window_init(float *window, float alpha, int n)
-{
-   int i, j;
-   double sum = 0.0, bessel, tmp;
-   double local_window[FF_KBD_WINDOW_MAX];
-   double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n);
-
-   assert(n <= FF_KBD_WINDOW_MAX);
-
-   for (i = 0; i < n; i++) {
-       tmp = i * (n - i) * alpha2;
-       bessel = 1.0;
-       for (j = BESSEL_I0_ITER; j > 0; j--)
-           bessel = bessel * tmp / (j * j) + 1;
-       sum += bessel;
-       local_window[i] = sum;
-   }
-
-   sum++;
-   for (i = 0; i < n; i++)
-       window[i] = sqrt(local_window[i] / sum);
-}
-
-#include "mdct_tablegen.h"
+#if CONFIG_FFT_FLOAT
+#   define RSCALE(x) (x)
+#else
+#   define RSCALE(x) ((x) >> 1)
+#endif
 
 /**
  * init MDCT or IMDCT computation.
@@ -71,7 +51,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
     s->mdct_bits = nbits;
     s->mdct_size = n;
     n4 = n >> 2;
-    s->permutation = FF_MDCT_PERM_NONE;
+    s->mdct_permutation = FF_MDCT_PERM_NONE;
 
     if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0)
         goto fail;
@@ -80,7 +60,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
     if (!s->tcos)
         goto fail;
 
-    switch (s->permutation) {
+    switch (s->mdct_permutation) {
     case FF_MDCT_PERM_NONE:
         s->tsin = s->tcos + n4;
         tstep = 1;
@@ -97,8 +77,8 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
     scale = sqrt(fabs(scale));
     for(i=0;i<n4;i++) {
         alpha = 2 * M_PI * (i + theta) / n;
-        s->tcos[i*tstep] = -cos(alpha) * scale;
-        s->tsin[i*tstep] = -sin(alpha) * scale;
+        s->tcos[i*tstep] = FIX15(-cos(alpha) * scale);
+        s->tsin[i*tstep] = FIX15(-sin(alpha) * scale);
     }
     return 0;
  fail:
@@ -106,17 +86,6 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
     return -1;
 }
 
-/* complex multiplication: p = a * b */
-#define CMUL(pre, pim, are, aim, bre, bim) \
-{\
-    FFTSample _are = (are);\
-    FFTSample _aim = (aim);\
-    FFTSample _bre = (bre);\
-    FFTSample _bim = (bim);\
-    (pre) = _are * _bre - _aim * _bim;\
-    (pim) = _are * _bim + _aim * _bre;\
-}
-
 /**
  * Compute the middle half of the inverse MDCT of size N = 2^nbits,
  * thus excluding the parts that can be derived by symmetry
@@ -146,7 +115,7 @@ void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input)
         in1 += 2;
         in2 -= 2;
     }
-    ff_fft_calc(s, z);
+    s->fft_calc(s, z);
 
     /* post rotation + reordering */
     for(k = 0; k < n8; k++) {
@@ -188,7 +157,7 @@ void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input)
 void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
 {
     int i, j, n, n8, n4, n2, n3;
-    FFTSample re, im;
+    FFTDouble re, im;
     const uint16_t *revtab = s->revtab;
     const FFTSample *tcos = s->tcos;
     const FFTSample *tsin = s->tsin;
@@ -202,18 +171,18 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
 
     /* pre rotation */
     for(i=0;i<n8;i++) {
-        re = -input[2*i+3*n4] - input[n3-1-2*i];
-        im = -input[n4+2*i] + input[n4-1-2*i];
+        re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
+        im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
         j = revtab[i];
         CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
 
-        re = input[2*i] - input[n2-1-2*i];
-        im = -(input[n2+2*i] + input[n-1-2*i]);
+        re = RSCALE( input[2*i]    - input[n2-1-2*i]);
+        im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
         j = revtab[n8 + i];
         CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
     }
 
-    ff_fft_calc(s, x);
+    s->fft_calc(s, x);
 
     /* post rotation */
     for(i=0;i<n8;i++) {
diff --git a/ffmpeg-mt/libavcodec/mdct_fixed.c b/ffmpeg-mt/libavcodec/mdct_fixed.c
new file mode 100644
index 0000000..94527f9
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/mdct_fixed.c
@@ -0,0 +1,64 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define CONFIG_FFT_FLOAT 0
+#include "mdct.c"
+
+/* same as ff_mdct_calcw_c with double-width unscaled output */
+void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input)
+{
+    int i, j, n, n8, n4, n2, n3;
+    FFTDouble re, im;
+    const uint16_t *revtab = s->revtab;
+    const FFTSample *tcos = s->tcos;
+    const FFTSample *tsin = s->tsin;
+    FFTComplex *x = s->tmp_buf;
+    FFTDComplex *o = (FFTDComplex *)out;
+
+    n = 1 << s->mdct_bits;
+    n2 = n >> 1;
+    n4 = n >> 2;
+    n8 = n >> 3;
+    n3 = 3 * n4;
+
+    /* pre rotation */
+    for(i=0;i<n8;i++) {
+        re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
+        im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
+        j = revtab[i];
+        CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
+
+        re = RSCALE( input[2*i]    - input[n2-1-2*i]);
+        im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
+        j = revtab[n8 + i];
+        CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
+    }
+
+    s->fft_calc(s, x);
+
+    /* post rotation */
+    for(i=0;i<n8;i++) {
+        FFTDouble r0, i0, r1, i1;
+        CMULL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]);
+        CMULL(i0, r1, x[n8+i  ].re, x[n8+i  ].im, -tsin[n8+i  ], -tcos[n8+i  ]);
+        o[n8-i-1].re = r0;
+        o[n8-i-1].im = i0;
+        o[n8+i  ].re = r1;
+        o[n8+i  ].im = i1;
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/mdct_float.c b/ffmpeg-mt/libavcodec/mdct_float.c
new file mode 100644
index 0000000..e4f5549
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/mdct_float.c
@@ -0,0 +1,20 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define CONFIG_FFT_FLOAT 1
+#include "mdct.c"
diff --git a/ffmpeg-mt/libavcodec/mdct_tablegen.c b/ffmpeg-mt/libavcodec/mdct_tablegen.c
deleted file mode 100644
index 6205f06..0000000
--- a/ffmpeg-mt/libavcodec/mdct_tablegen.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Generate a header file for hardcoded MDCT tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#define SINETABLE_CONST
-#define SINETABLE(size) \
-    float ff_sine_##size[size]
-#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#include "mdct_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    int i;
-
-    write_fileheader();
-
-    for (i = 5; i <= 12; i++) {
-        ff_init_ff_sine_windows(i);
-        printf("SINETABLE(%4i) = {\n", 1 << i);
-        write_float_array(ff_sine_windows[i], 1 << i);
-        printf("};\n");
-    }
-
-    return 0;
-}
diff --git a/ffmpeg-mt/libavcodec/mdct_tablegen.h b/ffmpeg-mt/libavcodec/mdct_tablegen.h
deleted file mode 100644
index 51a0094..0000000
--- a/ffmpeg-mt/libavcodec/mdct_tablegen.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Header file for hardcoded MDCT tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <assert.h>
-// do not use libavutil/libm.h since this is compiled both
-// for the host and the target and config.h is only valid for the target
-#include <math.h>
-#include "libavutil/attributes.h"
-
-#if !CONFIG_HARDCODED_TABLES
-SINETABLE(  32);
-SINETABLE(  64);
-SINETABLE( 128);
-SINETABLE( 256);
-SINETABLE( 512);
-SINETABLE(1024);
-SINETABLE(2048);
-SINETABLE(4096);
-#else
-#include "libavcodec/mdct_tables.h"
-#endif
-
-SINETABLE_CONST float * const ff_sine_windows[] = {
-    NULL, NULL, NULL, NULL, NULL, // unused
-    ff_sine_32 , ff_sine_64 ,
-    ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
-};
-
-// Generate a sine window.
-av_cold void ff_sine_window_init(float *window, int n) {
-    int i;
-    for(i = 0; i < n; i++)
-        window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
-}
-
-av_cold void ff_init_ff_sine_windows(int index) {
-    assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows));
-#if !CONFIG_HARDCODED_TABLES
-    ff_sine_window_init(ff_sine_windows[index], 1 << index);
-#endif
-}
diff --git a/ffmpeg-mt/libavcodec/mdec.c b/ffmpeg-mt/libavcodec/mdec.c
index 37bb915..a2664e2 100644
--- a/ffmpeg-mt/libavcodec/mdec.c
+++ b/ffmpeg-mt/libavcodec/mdec.c
@@ -4,20 +4,20 @@
  *
  * based upon code from Sebastian Jedruszkiewicz <elf at frogger.rules.pl>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -246,7 +246,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx){
     avctx->coded_frame= p;
     a->avctx= avctx;
 
-    p->qscale_table= av_mallocz( p->qstride * a->mb_height);
+    p->qscale_table= av_mallocz(a->mb_width);
 
     return 0;
 }
@@ -263,7 +263,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec mdec_decoder = {
+AVCodec ff_mdec_decoder = {
     "mdec",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MDEC,
diff --git a/ffmpeg-mt/libavcodec/mimic.c b/ffmpeg-mt/libavcodec/mimic.c
index bfba4f7..133d26f 100644
--- a/ffmpeg-mt/libavcodec/mimic.c
+++ b/ffmpeg-mt/libavcodec/mimic.c
@@ -1,21 +1,21 @@
 /*
  * Copyright (C) 2005  Ole André Vadla Ravnås <oleavr at gmail.com>
- * Copyright (C) 2008  Ramiro Polla <ramiro at lisha.ufsc.br>
+ * Copyright (C) 2008  Ramiro Polla
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -415,7 +415,7 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec mimic_decoder = {
+AVCodec ff_mimic_decoder = {
     "mimic",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MIMIC,
diff --git a/ffmpeg-mt/libavcodec/mips/mathops.h b/ffmpeg-mt/libavcodec/mips/mathops.h
index a1b04ed..573745b 100644
--- a/ffmpeg-mt/libavcodec/mips/mathops.h
+++ b/ffmpeg-mt/libavcodec/mips/mathops.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,8 @@
 #include "config.h"
 #include "libavutil/common.h"
 
+#if HAVE_INLINE_ASM
+
 #if HAVE_LOONGSON
 
 static inline av_const int64_t MAC64(int64_t d, int a, int b)
@@ -73,4 +75,6 @@ static inline av_const int64_t MLS64(int64_t d, int a, int b)
 
 #endif
 
+#endif /* HAVE_INLINE_ASM */
+
 #endif /* AVCODEC_MIPS_MATHOPS_H */
diff --git a/ffmpeg-mt/libavcodec/mjpeg.c b/ffmpeg-mt/libavcodec/mjpeg.c
index 6eba27d..9f2d50f 100644
--- a/ffmpeg-mt/libavcodec/mjpeg.c
+++ b/ffmpeg-mt/libavcodec/mjpeg.c
@@ -8,20 +8,20 @@
  * aspecting, new decode_frame mechanism and apple mjpeg-b support
  *                                  by Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mjpeg.h b/ffmpeg-mt/libavcodec/mjpeg.h
index 3c88471..c3fde44 100644
--- a/ffmpeg-mt/libavcodec/mjpeg.h
+++ b/ffmpeg-mt/libavcodec/mjpeg.h
@@ -8,20 +8,20 @@
  * aspecting, new decode_frame mechanism and apple mjpeg-b support
  *                                  by Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mjpeg2jpeg_bsf.c b/ffmpeg-mt/libavcodec/mjpeg2jpeg_bsf.c
index 36bb749..335a73b 100644
--- a/ffmpeg-mt/libavcodec/mjpeg2jpeg_bsf.c
+++ b/ffmpeg-mt/libavcodec/mjpeg2jpeg_bsf.c
@@ -2,20 +2,20 @@
  * MJPEG/AVI1 to JPEG/JFIF bitstream format filter
  * Copyright (c) 2010 Adrian Daerr and Nicolas George
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -106,7 +106,7 @@ static int mjpeg2jpeg_filter(AVBitStreamFilterContext *bsfc,
     return 1;
 }
 
-AVBitStreamFilter mjpeg2jpeg_bsf = {
+AVBitStreamFilter ff_mjpeg2jpeg_bsf = {
     .name           = "mjpeg2jpeg",
     .priv_data_size = 0,
     .filter         = mjpeg2jpeg_filter,
diff --git a/ffmpeg-mt/libavcodec/mjpeg_parser.c b/ffmpeg-mt/libavcodec/mjpeg_parser.c
index b1848fa..b5282f1 100644
--- a/ffmpeg-mt/libavcodec/mjpeg_parser.c
+++ b/ffmpeg-mt/libavcodec/mjpeg_parser.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2003 Alex Beregszaszi
  * Copyright (c) 2003-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -96,7 +96,7 @@ static int jpeg_parse(AVCodecParserContext *s,
 }
 
 
-AVCodecParser mjpeg_parser = {
+AVCodecParser ff_mjpeg_parser = {
     { CODEC_ID_MJPEG },
     sizeof(ParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/mjpega_dump_header_bsf.c b/ffmpeg-mt/libavcodec/mjpega_dump_header_bsf.c
index bb7858e..2a181fc 100644
--- a/ffmpeg-mt/libavcodec/mjpega_dump_header_bsf.c
+++ b/ffmpeg-mt/libavcodec/mjpega_dump_header_bsf.c
@@ -2,20 +2,20 @@
  * MJPEG A dump header bitstream filter
  * Copyright (c) 2006 Baptiste Coudurier
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -87,7 +87,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av
     return 0;
 }
 
-AVBitStreamFilter mjpega_dump_header_bsf = {
+AVBitStreamFilter ff_mjpega_dump_header_bsf = {
     "mjpegadump",
     0,
     mjpega_dump_header,
diff --git a/ffmpeg-mt/libavcodec/mjpegbdec.c b/ffmpeg-mt/libavcodec/mjpegbdec.c
index 907fa6f..837304e 100644
--- a/ffmpeg-mt/libavcodec/mjpegbdec.c
+++ b/ffmpeg-mt/libavcodec/mjpegbdec.c
@@ -2,20 +2,20 @@
  * Apple MJPEG-B decoder
  * Copyright (c) 2002 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -113,7 +113,7 @@ read_header:
         init_get_bits(&s->gb, buf_ptr+sos_offs, field_size*8);
         s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16));
         s->start_code = SOS;
-        ff_mjpeg_decode_sos(s);
+        ff_mjpeg_decode_sos(s, NULL, NULL);
     }
 
     if (s->interlaced) {
@@ -129,7 +129,7 @@ read_header:
 
     //XXX FIXME factorize, this looks very similar to the EOI code
 
-    *picture= s->picture;
+    *picture= *s->picture_ptr;
     *data_size = sizeof(AVFrame);
 
     if(!s->lossless){
@@ -145,7 +145,7 @@ read_header:
     return buf_ptr - buf;
 }
 
-AVCodec mjpegb_decoder = {
+AVCodec ff_mjpegb_decoder = {
     "mjpegb",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MJPEGB,
diff --git a/ffmpeg-mt/libavcodec/mjpegdec.c b/ffmpeg-mt/libavcodec/mjpegdec.c
index 19bd2f7..6f29e46 100644
--- a/ffmpeg-mt/libavcodec/mjpegdec.c
+++ b/ffmpeg-mt/libavcodec/mjpegdec.c
@@ -8,20 +8,20 @@
  * aspecting, new decode_frame mechanism and apple mjpeg-b support
  *                                  by Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,7 +33,7 @@
 //#define DEBUG
 #include <assert.h>
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mjpeg.h"
@@ -81,6 +81,9 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
 {
     MJpegDecodeContext *s = avctx->priv_data;
 
+    if (!s->picture_ptr)
+        s->picture_ptr = &s->picture;
+
     s->avctx = avctx;
     dsputil_init(&s->dsp, avctx);
     ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
@@ -282,8 +285,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
             s->height < ((s->org_height * 3) / 4)) {
             s->interlaced = 1;
             s->bottom_field = s->interlace_polarity;
-            s->picture.interlaced_frame = 1;
-            s->picture.top_field_first = !s->interlace_polarity;
+            s->picture_ptr->interlaced_frame = 1;
+            s->picture_ptr->top_field_first = !s->interlace_polarity;
             height *= 2;
         }
 
@@ -342,20 +345,19 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
             s->avctx->pix_fmt = PIX_FMT_GRAY16;
     }
 
-    if(s->picture.data[0])
-        s->avctx->release_buffer(s->avctx, &s->picture);
+    if(s->picture_ptr->data[0])
+        s->avctx->release_buffer(s->avctx, s->picture_ptr);
 
-    s->picture.reference= 0;
-    if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
+    if(s->avctx->get_buffer(s->avctx, s->picture_ptr) < 0){
         av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return -1;
     }
-    s->picture.pict_type= FF_I_TYPE;
-    s->picture.key_frame= 1;
+    s->picture_ptr->pict_type= FF_I_TYPE;
+    s->picture_ptr->key_frame= 1;
     s->got_picture = 1;
 
     for(i=0; i<3; i++){
-        s->linesize[i]= s->picture.linesize[i] << s->interlaced;
+        s->linesize[i]= s->picture_ptr->linesize[i] << s->interlaced;
     }
 
 //    printf("%d %d %d %d %d %d\n", s->width, s->height, s->linesize[0], s->linesize[1], s->interlaced, s->avctx->height);
@@ -416,16 +418,16 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
     block[0] = val;
     /* AC coefs */
     i = 0;
-    {OPEN_READER(re, &s->gb)
+    {OPEN_READER(re, &s->gb);
     do {
         UPDATE_CACHE(re, &s->gb);
-        GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
+        GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);
 
         i += ((unsigned)code) >> 4;
             code &= 0xf;
         if(code){
             if(code > MIN_CACHE_BITS - 16){
-                UPDATE_CACHE(re, &s->gb)
+                UPDATE_CACHE(re, &s->gb);
             }
             {
                 int cache=GET_CACHE(re,&s->gb);
@@ -433,7 +435,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
                 level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
             }
 
-            LAST_SKIP_BITS(re, &s->gb, code)
+            LAST_SKIP_BITS(re, &s->gb, code);
 
             if (i > 63) {
                 av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
@@ -443,7 +445,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
             block[j] = level * quant_matrix[j];
         }
     }while(i<63);
-    CLOSE_READER(re, &s->gb)}
+    CLOSE_READER(re, &s->gb);}
 
     return 0;
 }
@@ -475,17 +477,17 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8
         (*EOBRUN)--;
         return 0;
     }
-    {OPEN_READER(re, &s->gb)
+    {OPEN_READER(re, &s->gb);
     for(i=ss;;i++) {
         UPDATE_CACHE(re, &s->gb);
-        GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2)
+        GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2);
 
         run = ((unsigned) code) >> 4;
         code &= 0xF;
         if(code) {
             i += run;
             if(code > MIN_CACHE_BITS - 16){
-                UPDATE_CACHE(re, &s->gb)
+                UPDATE_CACHE(re, &s->gb);
             }
             {
                 int cache=GET_CACHE(re,&s->gb);
@@ -493,7 +495,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8
                 level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
             }
 
-            LAST_SKIP_BITS(re, &s->gb, code)
+            LAST_SKIP_BITS(re, &s->gb, code);
 
             if (i >= se) {
                 if(i == se){
@@ -525,7 +527,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8
             }
         }
     }
-    CLOSE_READER(re, &s->gb)}
+    CLOSE_READER(re, &s->gb);}
     if(i > *last_nnz)
         *last_nnz = i;
     return 0;
@@ -569,7 +571,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_
     else {
         for(;;i++) {
             UPDATE_CACHE(re, &s->gb);
-            GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2)
+            GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2);
 
             if(code & 0xF) {
                 run = ((unsigned) code) >> 4;
@@ -583,7 +585,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_
                 if(i == se) {
                     if(i > *last_nnz)
                         *last_nnz = i;
-                    CLOSE_READER(re, &s->gb)
+                    CLOSE_READER(re, &s->gb);
                     return 0;
                 }
             }else{
@@ -635,7 +637,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point
     }
     for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
         const int modified_predictor= mb_y ? predictor : 1;
-        uint8_t *ptr = s->picture.data[0] + (linesize * mb_y);
+        uint8_t *ptr = s->picture_ptr->data[0] + (linesize * mb_y);
 
         if (s->interlaced && s->bottom_field)
             ptr += linesize >> 1;
@@ -712,7 +714,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
                     for(j=0; j<n; j++) {
                         int pred;
 
-                        ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
+                        ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
                         if(y==0 && mb_y==0){
                             if(x==0 && mb_x==0){
                                 pred= 128 << point_transform;
@@ -752,7 +754,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
                     for(j=0; j<n; j++) {
                         int pred;
 
-                        ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
+                        ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
                         PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
                         *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
                         if (++x == h) {
@@ -771,10 +773,32 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
     return 0;
 }
 
-static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, int Al){
+static av_always_inline void mjpeg_copy_block(uint8_t *dst, const uint8_t *src,
+                                              int linesize, int lowres)
+{
+    switch (lowres) {
+    case 0: copy_block8(dst, src, linesize, linesize, 8);
+        break;
+    case 1: copy_block4(dst, src, linesize, linesize, 4);
+        break;
+    case 2: copy_block2(dst, src, linesize, linesize, 2);
+        break;
+    case 3: *dst = *src;
+        break;
+    }
+}
+
+static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, int Al,
+                             const uint8_t *mb_bitmask, const AVFrame *reference){
     int i, mb_x, mb_y;
     uint8_t* data[MAX_COMPONENTS];
+    const uint8_t *reference_data[MAX_COMPONENTS];
     int linesize[MAX_COMPONENTS];
+    GetBitContext mb_bitmask_gb;
+
+    if (mb_bitmask) {
+        init_get_bits(&mb_bitmask_gb, mb_bitmask, s->mb_width*s->mb_height);
+    }
 
     if(s->flipped && s->avctx->flags & CODEC_FLAG_EMU_EDGE) {
         av_log(s->avctx, AV_LOG_ERROR, "Can not flip image with CODEC_FLAG_EMU_EDGE set!\n");
@@ -782,24 +806,30 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
     }
     for(i=0; i < nb_components; i++) {
         int c = s->comp_index[i];
-        data[c] = s->picture.data[c];
+        data[c] = s->picture_ptr->data[c];
+        reference_data[c] = reference ? reference->data[c] : NULL;
         linesize[c]=s->linesize[c];
         s->coefs_finished[c] |= 1;
         if(s->flipped) {
             //picture should be flipped upside-down for this codec
-            data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 ));
+            int offset = (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 ));
+            data[c] += offset;
+            reference_data[c] += offset;
             linesize[c] *= -1;
         }
     }
 
     for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
         for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
+            const int copy_mb = mb_bitmask && !get_bits1(&mb_bitmask_gb);
+
             if (s->restart_interval && !s->restart_count)
                 s->restart_count = s->restart_interval;
 
             for(i=0;i<nb_components;i++) {
                 uint8_t *ptr;
                 int n, h, v, x, y, c, j;
+                int block_offset;
                 n = s->nb_blocks[i];
                 c = s->comp_index[i];
                 h = s->h_scount[i];
@@ -807,12 +837,16 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
                 x = 0;
                 y = 0;
                 for(j=0;j<n;j++) {
-                    ptr = data[c] +
-                        (((linesize[c] * (v * mb_y + y) * 8) +
-                        (h * mb_x + x) * 8) >> s->avctx->lowres);
+                    block_offset = (((linesize[c] * (v * mb_y + y) * 8) +
+                                     (h * mb_x + x) * 8) >> s->avctx->lowres);
+
                     if(s->interlaced && s->bottom_field)
-                        ptr += linesize[c] >> 1;
+                        block_offset += linesize[c] >> 1;
+                    ptr = data[c] + block_offset;
                     if(!s->progressive) {
+                        if (copy_mb) {
+                            mjpeg_copy_block(ptr, reference_data[c] + block_offset, linesize[c], s->avctx->lowres);
+                        } else {
                         s->dsp.clear_block(s->block);
                         if(decode_block(s, s->block, i,
                                      s->dc_index[i], s->ac_index[i],
@@ -821,6 +855,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
                             return -1;
                         }
                         s->dsp.idct_put(ptr, linesize[c], s->block);
+                        }
                     } else {
                         int block_idx = s->block_stride[c] * (v * mb_y + y) + (h * mb_x + x);
                         DCTELEM *block = s->blocks[c][block_idx];
@@ -851,29 +886,43 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
     return 0;
 }
 
-static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int se, int Ah, int Al){
+static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int se, int Ah, int Al,
+                                            const uint8_t *mb_bitmask, const AVFrame *reference){
     int mb_x, mb_y;
     int EOBRUN = 0;
     int c = s->comp_index[0];
-    uint8_t* data = s->picture.data[c];
+    uint8_t* data = s->picture_ptr->data[c];
+    const uint8_t *reference_data = reference ? reference->data[c] : NULL;
     int linesize = s->linesize[c];
     int last_scan = 0;
     int16_t *quant_matrix = s->quant_matrixes[ s->quant_index[c] ];
+    GetBitContext mb_bitmask_gb;
+
+    if (mb_bitmask) {
+        init_get_bits(&mb_bitmask_gb, mb_bitmask, s->mb_width*s->mb_height);
+    }
 
     if(!Al) {
         s->coefs_finished[c] |= (1LL<<(se+1))-(1LL<<ss);
         last_scan = !~s->coefs_finished[c];
     }
 
-    if(s->interlaced && s->bottom_field)
-        data += linesize >> 1;
+    if(s->interlaced && s->bottom_field) {
+        int offset = linesize >> 1;
+        data += offset;
+        reference_data += offset;
+    }
 
     for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
-        uint8_t *ptr = data + (mb_y*linesize*8 >> s->avctx->lowres);
+        int block_offset = (mb_y*linesize*8 >> s->avctx->lowres);
+        uint8_t *ptr = data + block_offset;
         int block_idx = mb_y * s->block_stride[c];
         DCTELEM (*block)[64] = &s->blocks[c][block_idx];
         uint8_t *last_nnz = &s->last_nnz[c][block_idx];
         for(mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) {
+            const int copy_mb = mb_bitmask && !get_bits1(&mb_bitmask_gb);
+
+            if (!copy_mb) {
             int ret;
             if(Ah)
                 ret = decode_block_refinement(s, *block, last_nnz, s->ac_index[0],
@@ -885,16 +934,23 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int s
                 av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x);
                 return -1;
             }
+            }
+
             if(last_scan) {
+                if (copy_mb) {
+                    mjpeg_copy_block(ptr, reference_data + block_offset, linesize, s->avctx->lowres);
+                } else {
                 s->dsp.idct_put(ptr, linesize, *block);
                 ptr += 8 >> s->avctx->lowres;
+                }
             }
         }
     }
     return 0;
 }
 
-int ff_mjpeg_decode_sos(MJpegDecodeContext *s)
+int ff_mjpeg_decode_sos(MJpegDecodeContext *s,
+                        const uint8_t *mb_bitmask, const AVFrame *reference)
 {
     int len, nb_components, i, h, v, predictor, point_transform;
     int index, id;
@@ -996,10 +1052,12 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s)
         }
     }else{
         if(s->progressive && predictor) {
-            if(mjpeg_decode_scan_progressive_ac(s, predictor, ilv, prev_shift, point_transform) < 0)
+            if(mjpeg_decode_scan_progressive_ac(s, predictor, ilv, prev_shift, point_transform,
+                                                mb_bitmask, reference) < 0)
                 return -1;
         } else {
-            if(mjpeg_decode_scan(s, nb_components, prev_shift, point_transform) < 0)
+            if(mjpeg_decode_scan(s, nb_components, prev_shift, point_transform,
+                                 mb_bitmask, reference) < 0)
                 return -1;
         }
     }
@@ -1255,48 +1313,31 @@ static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
     }
     val = -1;
 found:
-    dprintf(NULL, "find_marker skipped %d bytes\n", skipped);
+    av_dlog(NULL, "find_marker skipped %d bytes\n", skipped);
     *pbuf_ptr = buf_ptr;
     return val;
 }
 
-int ff_mjpeg_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
+int ff_mjpeg_find_marker(MJpegDecodeContext *s,
+                         const uint8_t **buf_ptr, const uint8_t *buf_end,
+                         const uint8_t **unescaped_buf_ptr, int *unescaped_buf_size)
 {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MJpegDecodeContext *s = avctx->priv_data;
-    const uint8_t *buf_end, *buf_ptr;
     int start_code;
-    AVFrame *picture = data;
-
-    s->got_picture = 0; // picture from previous image can not be reused
-    buf_ptr = buf;
-    buf_end = buf + buf_size;
-    while (buf_ptr < buf_end) {
-        /* find start next marker */
-        start_code = find_marker(&buf_ptr, buf_end);
-        {
-            /* EOF */
-            if (start_code < 0) {
-                goto the_end;
-            } else {
-                av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr);
+    start_code = find_marker(buf_ptr, buf_end);
 
-                if ((buf_end - buf_ptr) > s->buffer_size)
+                if ((buf_end - *buf_ptr) > s->buffer_size)
                 {
                     av_free(s->buffer);
-                    s->buffer_size = buf_end-buf_ptr;
+                    s->buffer_size = buf_end - *buf_ptr;
                     s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                    av_log(avctx, AV_LOG_DEBUG, "buffer too small, expanding to %d bytes\n",
+                    av_log(s->avctx, AV_LOG_DEBUG, "buffer too small, expanding to %d bytes\n",
                         s->buffer_size);
                 }
 
                 /* unescape buffer of SOS, use special treatment for JPEG-LS */
                 if (start_code == SOS && !s->ls)
                 {
-                    const uint8_t *src = buf_ptr;
+                    const uint8_t *src = *buf_ptr;
                     uint8_t *dst = s->buffer;
 
                     while (src<buf_end)
@@ -1304,7 +1345,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
                         uint8_t x = *(src++);
 
                         *(dst++) = x;
-                        if (avctx->codec_id != CODEC_ID_THP)
+                        if (s->avctx->codec_id != CODEC_ID_THP)
                         {
                             if (x == 0xff) {
                                 while (src < buf_end && x == 0xff)
@@ -1317,13 +1358,14 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
                             }
                         }
                     }
-                    init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
+                    *unescaped_buf_ptr  = s->buffer;
+                    *unescaped_buf_size = dst - s->buffer;
 
-                    av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
-                           (buf_end - buf_ptr) - (dst - s->buffer));
+                    av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
+                           (buf_end - *buf_ptr) - (dst - s->buffer));
                 }
                 else if(start_code == SOS && s->ls){
-                    const uint8_t *src = buf_ptr;
+                    const uint8_t *src = *buf_ptr;
                     uint8_t *dst = s->buffer;
                     int bit_count = 0;
                     int t = 0, b = 0;
@@ -1359,10 +1401,46 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
                     }
                     flush_put_bits(&pb);
 
-                    init_get_bits(&s->gb, dst, bit_count);
+                    *unescaped_buf_ptr  = dst;
+                    *unescaped_buf_size = (bit_count + 7) >> 3;
                 }
                 else
-                    init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr)*8);
+                {
+                    *unescaped_buf_ptr  = *buf_ptr;
+                    *unescaped_buf_size = buf_end - *buf_ptr;
+                }
+
+    return start_code;
+}
+
+int ff_mjpeg_decode_frame(AVCodecContext *avctx,
+                              void *data, int *data_size,
+                              AVPacket *avpkt)
+{
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
+    MJpegDecodeContext *s = avctx->priv_data;
+    const uint8_t *buf_end, *buf_ptr;
+    const uint8_t *unescaped_buf_ptr;
+    int unescaped_buf_size;
+    int start_code;
+    AVFrame *picture = data;
+
+    s->got_picture = 0; // picture from previous image can not be reused
+    buf_ptr = buf;
+    buf_end = buf + buf_size;
+    while (buf_ptr < buf_end) {
+        /* find start next marker */
+        start_code = ff_mjpeg_find_marker(s, &buf_ptr, buf_end,
+                                          &unescaped_buf_ptr, &unescaped_buf_size);
+        {
+            /* EOF */
+            if (start_code < 0) {
+                goto the_end;
+            } else {
+                av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr);
+
+                init_get_bits(&s->gb, unescaped_buf_ptr, unescaped_buf_size*8);
 
                 s->start_code = start_code;
                 if(s->avctx->debug & FF_DEBUG_STARTCODE){
@@ -1445,7 +1523,7 @@ eoi_parser:
                             if (s->bottom_field == !s->interlace_polarity)
                                 goto not_the_end;
                         }
-                        *picture = s->picture;
+                        *picture = *s->picture_ptr;
                         *data_size = sizeof(AVFrame);
 
                         if(!s->lossless){
@@ -1466,7 +1544,7 @@ eoi_parser:
                         av_log(avctx, AV_LOG_WARNING, "Can not process SOS before SOF, skipping\n");
                         break;
                     }
-                    ff_mjpeg_decode_sos(s);
+                    ff_mjpeg_decode_sos(s, NULL, NULL);
                     /* buggy avid puts EOI every 10-20th frame */
                     /* if restart period is over process EOI */
                     if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
@@ -1517,8 +1595,8 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
     MJpegDecodeContext *s = avctx->priv_data;
     int i, j;
 
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
+    if (s->picture_ptr && s->picture_ptr->data[0])
+        avctx->release_buffer(avctx, s->picture_ptr);
 
     av_free(s->buffer);
     av_free(s->qscale_table);
@@ -1536,7 +1614,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec mjpeg_decoder = {
+AVCodec ff_mjpeg_decoder = {
     "mjpeg",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MJPEG,
@@ -1547,11 +1625,11 @@ AVCodec mjpeg_decoder = {
     ff_mjpeg_decode_frame,
     CODEC_CAP_DR1,
     NULL,
-    .max_lowres = 4,
+    .max_lowres = 3,
     .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
 };
 
-AVCodec thp_decoder = {
+AVCodec ff_thp_decoder = {
     "thp",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_THP,
diff --git a/ffmpeg-mt/libavcodec/mjpegdec.h b/ffmpeg-mt/libavcodec/mjpegdec.h
index 7baa5dc..52c256e 100644
--- a/ffmpeg-mt/libavcodec/mjpegdec.h
+++ b/ffmpeg-mt/libavcodec/mjpegdec.h
@@ -4,20 +4,20 @@
  * Copyright (c) 2003 Alex Beregszaszi
  * Copyright (c) 2003-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -81,6 +81,7 @@ typedef struct MJpegDecodeContext {
     int quant_index[4];   /* quant table index for each component */
     int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */
     AVFrame picture; /* picture structure */
+    AVFrame *picture_ptr; /* pointer to picture structure */
     int got_picture;                                ///< we found a SOF and picture is valid, too.
     int linesize[MAX_COMPONENTS];                   ///< linesize << interlaced
     int8_t *qscale_table;
@@ -115,6 +116,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx,
 int ff_mjpeg_decode_dqt(MJpegDecodeContext *s);
 int ff_mjpeg_decode_dht(MJpegDecodeContext *s);
 int ff_mjpeg_decode_sof(MJpegDecodeContext *s);
-int ff_mjpeg_decode_sos(MJpegDecodeContext *s);
+int ff_mjpeg_decode_sos(MJpegDecodeContext *s,
+                        const uint8_t *mb_bitmask, const AVFrame *reference);
+int ff_mjpeg_find_marker(MJpegDecodeContext *s,
+                         const uint8_t **buf_ptr, const uint8_t *buf_end,
+                         const uint8_t **unescaped_buf_ptr, int *unescaped_buf_size);
 
 #endif /* AVCODEC_MJPEGDEC_H */
diff --git a/ffmpeg-mt/libavcodec/mjpegenc.c b/ffmpeg-mt/libavcodec/mjpegenc.c
index 05f0bed..169d19e 100644
--- a/ffmpeg-mt/libavcodec/mjpegenc.c
+++ b/ffmpeg-mt/libavcodec/mjpegenc.c
@@ -8,20 +8,20 @@
  * aspecting, new decode_frame mechanism and apple mjpeg-b support
  *                                  by Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -445,7 +445,7 @@ void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64])
     s->i_tex_bits += get_bits_diff(s);
 }
 
-AVCodec mjpeg_encoder = {
+AVCodec ff_mjpeg_encoder = {
     "mjpeg",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MJPEG,
diff --git a/ffmpeg-mt/libavcodec/mjpegenc.h b/ffmpeg-mt/libavcodec/mjpegenc.h
index 49627a3..12ff540 100644
--- a/ffmpeg-mt/libavcodec/mjpegenc.h
+++ b/ffmpeg-mt/libavcodec/mjpegenc.h
@@ -8,20 +8,20 @@
  * aspecting, new decode_frame mechanism and apple mjpeg-b support
  *                                  by Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mlib/dsputil_mlib.c b/ffmpeg-mt/libavcodec/mlib/dsputil_mlib.c
index 6be0ba4..9e49c91 100644
--- a/ffmpeg-mt/libavcodec/mlib/dsputil_mlib.c
+++ b/ffmpeg-mt/libavcodec/mlib/dsputil_mlib.c
@@ -2,20 +2,20 @@
  * Sun mediaLib optimized DSP utils
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mlp.c b/ffmpeg-mt/libavcodec/mlp.c
index 87f7c77..9615b66 100644
--- a/ffmpeg-mt/libavcodec/mlp.c
+++ b/ffmpeg-mt/libavcodec/mlp.c
@@ -2,20 +2,20 @@
  * MLP codec common code
  * Copyright (c) 2007-2008 Ian Caulfield
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mlp.h b/ffmpeg-mt/libavcodec/mlp.h
index 628b58d..b001ad2 100644
--- a/ffmpeg-mt/libavcodec/mlp.h
+++ b/ffmpeg-mt/libavcodec/mlp.h
@@ -2,20 +2,20 @@
  * MLP codec common header file
  * Copyright (c) 2007-2008 Ian Caulfield
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mlp_parser.c b/ffmpeg-mt/libavcodec/mlp_parser.c
index 36a296f..e85eb72 100644
--- a/ffmpeg-mt/libavcodec/mlp_parser.c
+++ b/ffmpeg-mt/libavcodec/mlp_parser.c
@@ -2,20 +2,20 @@
  * MLP parser
  * Copyright (c) 2007 Ian Caulfield
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,6 +27,7 @@
 #include <stdint.h>
 
 #include "libavutil/crc.h"
+#include "libavutil/audioconvert.h"
 #include "get_bits.h"
 #include "parser.h"
 #include "mlp_parser.h"
@@ -42,11 +43,52 @@ static const uint8_t mlp_channels[32] = {
     5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 };
 
+static const uint64_t mlp_layout[32] = {
+    AV_CH_LAYOUT_MONO,
+    AV_CH_LAYOUT_STEREO,
+    AV_CH_LAYOUT_2_1,
+    AV_CH_LAYOUT_2_2,
+    AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_SURROUND,
+    AV_CH_LAYOUT_4POINT0,
+    AV_CH_LAYOUT_5POINT0,
+    AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_5POINT1,
+    AV_CH_LAYOUT_4POINT0,
+    AV_CH_LAYOUT_5POINT0,
+    AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_5POINT1,
+    AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY,
+    AV_CH_LAYOUT_5POINT0,
+    AV_CH_LAYOUT_5POINT1,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
 static const uint8_t thd_chancount[13] = {
 //  LR    C   LFE  LRs LRvh  LRc LRrs  Cs   Ts  LRsd  LRw  Cvh  LFE2
      2,   1,   1,   2,   2,   2,   2,   1,   1,   2,   2,   1,   1
 };
 
+static const uint64_t thd_layout[13] = {
+    AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT,                     // LR
+    AV_CH_FRONT_CENTER,                                     // C
+    AV_CH_LOW_FREQUENCY,                                    // LFE
+    AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT,                       // LRs
+    AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT,             // LRvh
+    AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT,                       // LRc
+    AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT,                       // LRrs
+    AV_CH_BACK_CENTER,                                      // Cs
+    AV_CH_TOP_BACK_CENTER,                                  // Ts
+    AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT,                       // LRsd
+    AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, // LRw
+    AV_CH_TOP_BACK_CENTER,                                  // Cvh
+    AV_CH_LOW_FREQUENCY                                     // LFE2
+};
+
 static int mlp_samplerate(int in)
 {
     if (in == 0xF)
@@ -65,6 +107,16 @@ static int truehd_channels(int chanmap)
     return channels;
 }
 
+static int64_t truehd_layout(int chanmap)
+{
+    int layout = 0, i;
+
+    for (i = 0; i < 13; i++)
+        layout |= thd_layout[i] * ((chanmap >> i) & 1);
+
+    return layout;
+}
+
 /** Read a major sync info header - contains high level information about
  *  the stream - sample rate, channel arrangement etc. Most of this
  *  information is not actually necessary for decoding, only for playback.
@@ -264,12 +316,16 @@ static int mlp_parse(AVCodecParserContext *s,
         if (mh.stream_type == 0xbb) {
             /* MLP stream */
             avctx->channels = mlp_channels[mh.channels_mlp];
+            avctx->channel_layout = mlp_layout[mh.channels_mlp];
         } else { /* mh.stream_type == 0xba */
             /* TrueHD stream */
-            if (mh.channels_thd_stream2)
+            if (mh.channels_thd_stream2) {
                 avctx->channels = truehd_channels(mh.channels_thd_stream2);
-            else
+                avctx->channel_layout = truehd_layout(mh.channels_thd_stream2);
+            } else {
                 avctx->channels = truehd_channels(mh.channels_thd_stream1);
+                avctx->channel_layout = truehd_layout(mh.channels_thd_stream1);
+            }
         }
 
         if (!mh.is_vbr) /* Stream is CBR */
@@ -288,7 +344,7 @@ lost_sync:
     return 1;
 }
 
-AVCodecParser mlp_parser = {
+AVCodecParser ff_mlp_parser = {
     { CODEC_ID_MLP, CODEC_ID_TRUEHD },
     sizeof(MLPParseContext),
     mlp_init,
diff --git a/ffmpeg-mt/libavcodec/mlp_parser.h b/ffmpeg-mt/libavcodec/mlp_parser.h
index d7ce2b8..940ba83 100644
--- a/ffmpeg-mt/libavcodec/mlp_parser.h
+++ b/ffmpeg-mt/libavcodec/mlp_parser.h
@@ -2,20 +2,20 @@
  * MLP parser prototypes
  * Copyright (c) 2007 Ian Caulfield
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mlpdec.c b/ffmpeg-mt/libavcodec/mlpdec.c
index 2a04be5..5e50eba 100644
--- a/ffmpeg-mt/libavcodec/mlpdec.c
+++ b/ffmpeg-mt/libavcodec/mlpdec.c
@@ -2,20 +2,20 @@
  * MLP decoder
  * Copyright (c) 2007-2008 Ian Caulfield
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -41,7 +41,7 @@
 
 static const char* sample_message =
     "Please file a bug report following the instructions at "
-    "http://ffmpeg.org/bugreports.html and include "
+    "http://libav.org/bugreports.html and include "
     "a sample of this file.";
 
 typedef struct SubStream {
@@ -1137,7 +1137,7 @@ error:
     return -1;
 }
 
-AVCodec mlp_decoder = {
+AVCodec ff_mlp_decoder = {
     "mlp",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MLP,
@@ -1150,7 +1150,7 @@ AVCodec mlp_decoder = {
 };
 
 #if CONFIG_TRUEHD_DECODER
-AVCodec truehd_decoder = {
+AVCodec ff_truehd_decoder = {
     "truehd",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_TRUEHD,
diff --git a/ffmpeg-mt/libavcodec/mlpdsp.c b/ffmpeg-mt/libavcodec/mlpdsp.c
index a0647ee..0053df8 100644
--- a/ffmpeg-mt/libavcodec/mlpdsp.c
+++ b/ffmpeg-mt/libavcodec/mlpdsp.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2007-2008 Ian Caulfield
  *               2009 Ramiro Polla
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mmvideo.c b/ffmpeg-mt/libavcodec/mmvideo.c
index 568a010..b65335e 100644
--- a/ffmpeg-mt/libavcodec/mmvideo.c
+++ b/ffmpeg-mt/libavcodec/mmvideo.c
@@ -2,20 +2,20 @@
  * American Laser Games MM Video Decoder
  * Copyright (c) 2006,2008 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -59,10 +59,6 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
     avctx->pix_fmt = PIX_FMT_PAL8;
 
     s->frame.reference = 1;
-    if (avctx->get_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
 
     return 0;
 }
@@ -182,6 +178,11 @@ static int mm_decode_frame(AVCodecContext *avctx,
     buf += MM_PREAMBLE_SIZE;
     buf_size -= MM_PREAMBLE_SIZE;
 
+    if (avctx->reget_buffer(avctx, &s->frame) < 0) {
+        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+        return -1;
+    }
+
     switch(type) {
     case MM_TYPE_PALETTE   : mm_decode_pal(s, buf, buf_end); return buf_size;
     case MM_TYPE_INTRA     : mm_decode_intra(s, 0, 0, buf, buf_size); break;
@@ -212,7 +213,7 @@ static av_cold int mm_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec mmvideo_decoder = {
+AVCodec ff_mmvideo_decoder = {
     "mmvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MMVIDEO,
diff --git a/ffmpeg-mt/libavcodec/motion-test.c b/ffmpeg-mt/libavcodec/motion-test.c
index 994b262..b88917c 100644
--- a/ffmpeg-mt/libavcodec/motion-test.c
+++ b/ffmpeg-mt/libavcodec/motion-test.c
@@ -1,20 +1,20 @@
 /*
  * (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/motion_est.c b/ffmpeg-mt/libavcodec/motion_est.c
index 50078f9..8e85219 100644
--- a/ffmpeg-mt/libavcodec/motion_est.c
+++ b/ffmpeg-mt/libavcodec/motion_est.c
@@ -5,20 +5,20 @@
  *
  * new motion estimation (X1/EPZS) by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/motion_est_template.c b/ffmpeg-mt/libavcodec/motion_est_template.c
index 8f730ef..faf03d2 100644
--- a/ffmpeg-mt/libavcodec/motion_est_template.c
+++ b/ffmpeg-mt/libavcodec/motion_est_template.c
@@ -2,20 +2,20 @@
  * Motion estimation
  * Copyright (c) 2002-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/motionpixels.c b/ffmpeg-mt/libavcodec/motionpixels.c
index 9bc5e20..ebc4b31 100644
--- a/ffmpeg-mt/libavcodec/motionpixels.c
+++ b/ffmpeg-mt/libavcodec/motionpixels.c
@@ -2,20 +2,20 @@
  * Motion Pixels Video Decoder
  * Copyright (c) 2008 Gregory Montoir (cyx at users.sourceforge.net)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -302,7 +302,7 @@ static av_cold int mp_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec motionpixels_decoder = {
+AVCodec ff_motionpixels_decoder = {
     "motionpixels",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MOTIONPIXELS,
diff --git a/ffmpeg-mt/libavcodec/motionpixels_tablegen.c b/ffmpeg-mt/libavcodec/motionpixels_tablegen.c
index 31e5cdf..ad8e0d9 100644
--- a/ffmpeg-mt/libavcodec/motionpixels_tablegen.c
+++ b/ffmpeg-mt/libavcodec/motionpixels_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/motionpixels_tablegen.h b/ffmpeg-mt/libavcodec/motionpixels_tablegen.h
index 5d6df52..9516dfe 100644
--- a/ffmpeg-mt/libavcodec/motionpixels_tablegen.h
+++ b/ffmpeg-mt/libavcodec/motionpixels_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/movsub_bsf.c b/ffmpeg-mt/libavcodec/movsub_bsf.c
index 2423f2d..423ebeb 100644
--- a/ffmpeg-mt/libavcodec/movsub_bsf.c
+++ b/ffmpeg-mt/libavcodec/movsub_bsf.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Reimar Döffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,7 +33,7 @@ static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co
     return 1;
 }
 
-AVBitStreamFilter text2movsub_bsf={
+AVBitStreamFilter ff_text2movsub_bsf={
     "text2movsub",
     0,
     text2movsub,
@@ -49,7 +49,7 @@ static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co
     return 1;
 }
 
-AVBitStreamFilter mov2textsub_bsf={
+AVBitStreamFilter ff_mov2textsub_bsf={
     "mov2textsub",
     0,
     mov2textsub,
diff --git a/ffmpeg-mt/libavcodec/mp3_header_compress_bsf.c b/ffmpeg-mt/libavcodec/mp3_header_compress_bsf.c
index f5c5138..5a69377 100644
--- a/ffmpeg-mt/libavcodec/mp3_header_compress_bsf.c
+++ b/ffmpeg-mt/libavcodec/mp3_header_compress_bsf.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,7 +79,7 @@ output_unchanged:
     return 1;
 }
 
-AVBitStreamFilter mp3_header_compress_bsf={
+AVBitStreamFilter ff_mp3_header_compress_bsf={
     "mp3comp",
     0,
     mp3_header_compress,
diff --git a/ffmpeg-mt/libavcodec/mp3_header_decompress_bsf.c b/ffmpeg-mt/libavcodec/mp3_header_decompress_bsf.c
index d897ed9..7dda795 100644
--- a/ffmpeg-mt/libavcodec/mp3_header_decompress_bsf.c
+++ b/ffmpeg-mt/libavcodec/mp3_header_decompress_bsf.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -89,7 +89,7 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
     return 1;
 }
 
-AVBitStreamFilter mp3_header_decompress_bsf={
+AVBitStreamFilter ff_mp3_header_decompress_bsf={
     "mp3decomp",
     0,
     mp3_header_decompress,
diff --git a/ffmpeg-mt/libavcodec/mpc.c b/ffmpeg-mt/libavcodec/mpc.c
index d9a1fb7..36e0f04 100644
--- a/ffmpeg-mt/libavcodec/mpc.c
+++ b/ffmpeg-mt/libavcodec/mpc.c
@@ -2,20 +2,20 @@
  * Musepack decoder core
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpc.h b/ffmpeg-mt/libavcodec/mpc.h
index 2d9755a..67fc7fe 100644
--- a/ffmpeg-mt/libavcodec/mpc.h
+++ b/ffmpeg-mt/libavcodec/mpc.h
@@ -2,20 +2,20 @@
  * Musepack decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpc7.c b/ffmpeg-mt/libavcodec/mpc7.c
index 5ac2579..6a4bf57 100644
--- a/ffmpeg-mt/libavcodec/mpc7.c
+++ b/ffmpeg-mt/libavcodec/mpc7.c
@@ -2,20 +2,20 @@
  * Musepack SV7 decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,6 +30,7 @@
 #include "get_bits.h"
 #include "dsputil.h"
 #include "mpegaudio.h"
+#include "libavutil/audioconvert.h"
 
 #include "mpc.h"
 #include "mpc7data.h"
@@ -86,7 +87,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
     c->frames_to_skip = 0;
 
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+    avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
 
     if(vlc_initialized) return 0;
     av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
@@ -288,7 +289,7 @@ static void mpc7_decode_flush(AVCodecContext *avctx)
     c->frames_to_skip = 32;
 }
 
-AVCodec mpc7_decoder = {
+AVCodec ff_mpc7_decoder = {
     "mpc7",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MUSEPACK7,
diff --git a/ffmpeg-mt/libavcodec/mpc7data.h b/ffmpeg-mt/libavcodec/mpc7data.h
index 5609e8f..f205ffe 100644
--- a/ffmpeg-mt/libavcodec/mpc7data.h
+++ b/ffmpeg-mt/libavcodec/mpc7data.h
@@ -2,20 +2,20 @@
  * Musepack decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpc8.c b/ffmpeg-mt/libavcodec/mpc8.c
index d8d62ed..5de8c15 100644
--- a/ffmpeg-mt/libavcodec/mpc8.c
+++ b/ffmpeg-mt/libavcodec/mpc8.c
@@ -2,20 +2,20 @@
  * Musepack SV8 decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,6 +30,7 @@
 #include "get_bits.h"
 #include "dsputil.h"
 #include "mpegaudio.h"
+#include "libavutil/audioconvert.h"
 
 #include "mpc.h"
 #include "mpcdata.h"
@@ -135,7 +136,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
     c->frames = 1 << (get_bits(&gb, 3) * 2);
 
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+    avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
 
     if(vlc_initialized) return 0;
     av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
@@ -404,7 +405,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx,
     return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
 }
 
-AVCodec mpc8_decoder = {
+AVCodec ff_mpc8_decoder = {
     "mpc8",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MUSEPACK8,
diff --git a/ffmpeg-mt/libavcodec/mpc8data.h b/ffmpeg-mt/libavcodec/mpc8data.h
index 22c2be4..2940b30 100644
--- a/ffmpeg-mt/libavcodec/mpc8data.h
+++ b/ffmpeg-mt/libavcodec/mpc8data.h
@@ -2,20 +2,20 @@
  * Musepack SV8 decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpc8huff.h b/ffmpeg-mt/libavcodec/mpc8huff.h
index 8491037..6005e21 100644
--- a/ffmpeg-mt/libavcodec/mpc8huff.h
+++ b/ffmpeg-mt/libavcodec/mpc8huff.h
@@ -2,20 +2,20 @@
  * Musepack SV8 decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpcdata.h b/ffmpeg-mt/libavcodec/mpcdata.h
index a2212ec..ad06b7a 100644
--- a/ffmpeg-mt/libavcodec/mpcdata.h
+++ b/ffmpeg-mt/libavcodec/mpcdata.h
@@ -2,20 +2,20 @@
  * Musepack decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg12.c b/ffmpeg-mt/libavcodec/mpeg12.c
index f2dddf1..3df510e 100644
--- a/ffmpeg-mt/libavcodec/mpeg12.c
+++ b/ffmpeg-mt/libavcodec/mpeg12.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -214,7 +214,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
     int i, j, k, cbp, val, mb_type, motion_type;
     const int mb_block_count = 4 + (1<< s->chroma_format);
 
-    dprintf(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
+    av_dlog(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
 
     assert(s->mb_skipped==0);
 
@@ -273,7 +273,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
         mb_type = btype2mb_type[ mb_type ];
         break;
     }
-    dprintf(s->avctx, "mb_type=%x\n", mb_type);
+    av_dlog(s->avctx, "mb_type=%x\n", mb_type);
 //    motion_type = 0; /* avoid warning */
     if (IS_INTRA(mb_type)) {
         s->dsp.clear_blocks(s->block[0]);
@@ -371,7 +371,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
 
             /* motion vectors */
             s->mv_dir= (mb_type>>13)&3;
-            dprintf(s->avctx, "motion_type=%d\n", motion_type);
+            av_dlog(s->avctx, "motion_type=%d\n", motion_type);
             switch(motion_type) {
             case MT_FRAME: /* or MT_16X8 */
                 if (s->picture_structure == PICT_FRAME) {
@@ -422,12 +422,12 @@ static int mpeg_decode_mb(MpegEncContext *s,
                                                          s->last_mv[i][j][0]);
                                 s->last_mv[i][j][0] = val;
                                 s->mv[i][j][0] = val;
-                                dprintf(s->avctx, "fmx=%d\n", val);
+                                av_dlog(s->avctx, "fmx=%d\n", val);
                                 val = mpeg_decode_motion(s, s->mpeg_f_code[i][1],
                                                          s->last_mv[i][j][1] >> 1);
                                 s->last_mv[i][j][1] = val << 1;
                                 s->mv[i][j][1] = val;
-                                dprintf(s->avctx, "fmy=%d\n", val);
+                                av_dlog(s->avctx, "fmy=%d\n", val);
                             }
                         }
                     }
@@ -633,7 +633,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s,
     dc += diff;
     s->last_dc[component] = dc;
     block[0] = dc*quant_matrix[0];
-    dprintf(s->avctx, "dc=%d diff=%d\n", dc, diff);
+    av_dlog(s->avctx, "dc=%d diff=%d\n", dc, diff);
     i = 0;
     {
         OPEN_READER(re, &s->gb);
@@ -719,9 +719,6 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s,
             if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
                 goto end;
         }
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
         /* now quantify & encode AC coefficients */
         for(;;) {
             GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
@@ -761,14 +758,9 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s,
             }
 
             block[j] = level;
-#if MIN_CACHE_BITS < 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
             if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
                 break;
-#if MIN_CACHE_BITS >= 19
             UPDATE_CACHE(re, &s->gb);
-#endif
         }
 end:
         LAST_SKIP_BITS(re, &s->gb, 2);
@@ -801,9 +793,6 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc
             if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
                 goto end;
         }
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
 
         /* now quantify & encode AC coefficients */
         for(;;) {
@@ -840,14 +829,9 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc
             }
 
             block[j] = level;
-#if MIN_CACHE_BITS < 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
             if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
                 break;
-#if MIN_CACHE_BITS >= 19
             UPDATE_CACHE(re, &s->gb);
-#endif
         }
 end:
         LAST_SKIP_BITS(re, &s->gb, 2);
@@ -892,9 +876,6 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
             if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
                 goto end;
         }
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
 
         /* now quantify & encode AC coefficients */
         for(;;) {
@@ -928,14 +909,9 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
 
             mismatch ^= level;
             block[j] = level;
-#if MIN_CACHE_BITS < 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
             if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
                 break;
-#if MIN_CACHE_BITS >= 19
             UPDATE_CACHE(re, &s->gb);
-#endif
         }
 end:
         LAST_SKIP_BITS(re, &s->gb, 2);
@@ -970,9 +946,6 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
         if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
             goto end;
     }
-#if MIN_CACHE_BITS < 19
-    UPDATE_CACHE(re, &s->gb);
-#endif
 
     /* now quantify & encode AC coefficients */
     for(;;) {
@@ -1001,14 +974,9 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
         }
 
         block[j] = level;
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
         if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
             break;
-#if MIN_CACHE_BITS >=19
         UPDATE_CACHE(re, &s->gb);
-#endif
     }
 end:
     LAST_SKIP_BITS(re, &s->gb, 2);
@@ -1045,7 +1013,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
     dc += diff;
     s->last_dc[component] = dc;
     block[0] = dc << (3 - s->intra_dc_precision);
-    dprintf(s->avctx, "dc=%d\n", block[0]);
+    av_dlog(s->avctx, "dc=%d\n", block[0]);
     mismatch = block[0] ^ 1;
     i = 0;
     if (s->intra_vlc_format)
@@ -1440,7 +1408,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
     s1->frame_rate_ext.num = get_bits(&s->gb, 2)+1;
     s1->frame_rate_ext.den = get_bits(&s->gb, 5)+1;
 
-    dprintf(s->avctx, "sequence extension\n");
+    av_dlog(s->avctx, "sequence extension\n");
     s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;
     s->avctx->sub_id = 2; /* indicates MPEG-2 found */
 
@@ -1531,7 +1499,7 @@ static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1
 
 static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
 {
-    dprintf(s->avctx, "matrix extension\n");
+    av_dlog(s->avctx, "matrix extension\n");
 
     if(get_bits1(&s->gb)) load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, 1);
     if(get_bits1(&s->gb)) load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, 0);
@@ -1605,15 +1573,15 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
     }
 
     /* composite display not parsed */
-    dprintf(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision);
-    dprintf(s->avctx, "picture_structure=%d\n", s->picture_structure);
-    dprintf(s->avctx, "top field first=%d\n", s->top_field_first);
-    dprintf(s->avctx, "repeat first field=%d\n", s->repeat_first_field);
-    dprintf(s->avctx, "conceal=%d\n", s->concealment_motion_vectors);
-    dprintf(s->avctx, "intra_vlc_format=%d\n", s->intra_vlc_format);
-    dprintf(s->avctx, "alternate_scan=%d\n", s->alternate_scan);
-    dprintf(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);
-    dprintf(s->avctx, "progressive_frame=%d\n", s->progressive_frame);
+    av_dlog(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision);
+    av_dlog(s->avctx, "picture_structure=%d\n", s->picture_structure);
+    av_dlog(s->avctx, "top field first=%d\n", s->top_field_first);
+    av_dlog(s->avctx, "repeat first field=%d\n", s->repeat_first_field);
+    av_dlog(s->avctx, "conceal=%d\n", s->concealment_motion_vectors);
+    av_dlog(s->avctx, "intra_vlc_format=%d\n", s->intra_vlc_format);
+    av_dlog(s->avctx, "alternate_scan=%d\n", s->alternate_scan);
+    av_dlog(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);
+    av_dlog(s->avctx, "progressive_frame=%d\n", s->progressive_frame);
 }
 
 static void exchange_uv(MpegEncContext *s){
@@ -1940,7 +1908,9 @@ static int slice_decode_thread(AVCodecContext *c, void *arg){
 
         start_code= -1;
         buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code);
-        mb_y= start_code - SLICE_MIN_START_CODE;
+        mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
+        if (s->picture_structure == PICT_BOTTOM_FIELD)
+            mb_y++;
         if(mb_y < 0 || mb_y >= s->end_mb_y)
             return -1;
     }
@@ -2259,7 +2229,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
     Mpeg1Context *s = avctx->priv_data;
     AVFrame *picture = data;
     MpegEncContext *s2 = &s->mpeg_enc_ctx;
-    dprintf(avctx, "fill_buffer\n");
+    av_dlog(avctx, "fill_buffer\n");
 
     if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
         /* special case for last picture */
@@ -2358,6 +2328,16 @@ static int decode_chunks(AVCodecContext *avctx,
             break;
 
         case PICTURE_START_CODE:
+            if (HAVE_THREADS && (avctx->active_thread_type&FF_THREAD_SLICE) && s->slice_count) {
+                int i;
+
+                avctx->execute(avctx, slice_decode_thread,
+                               s2->thread_context, NULL,
+                               s->slice_count, sizeof(void*));
+                for (i = 0; i < s->slice_count; i++)
+                    s2->error_count += s2->thread_context[i]->error_count;
+                s->slice_count = 0;
+            }
             if(last_code == 0 || last_code == SLICE_MIN_START_CODE){
             if(mpeg_decode_postinit(avctx) < 0){
                 av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n");
@@ -2445,14 +2425,18 @@ static int decode_chunks(AVCodecContext *avctx,
                 /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
                     if(s2->pict_type==FF_P_TYPE && !s->sync) break;
                 }
+#if FF_API_HURRY_UP
                 /* Skip B-frames if we are in a hurry. */
                 if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
+#endif
                 if(  (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
                     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
                     || avctx->skip_frame >= AVDISCARD_ALL)
                     break;
+#if FF_API_HURRY_UP
                 /* Skip everything if we are in a hurry>=5. */
                 if(avctx->hurry_up>=5) break;
+#endif
 
                 if (!s->mpeg_enc_ctx_allocated) break;
 
@@ -2530,7 +2514,19 @@ static int mpeg_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec mpeg1video_decoder = {
+static const AVProfile mpeg2_video_profiles[] = {
+    { FF_PROFILE_MPEG2_422,          "4:2:2"              },
+    { FF_PROFILE_MPEG2_HIGH,         "High"               },
+    { FF_PROFILE_MPEG2_SS,           "Spatially Scalable" },
+    { FF_PROFILE_MPEG2_SNR_SCALABLE, "SNR Scalable"       },
+    { FF_PROFILE_MPEG2_MAIN,         "Main"               },
+    { FF_PROFILE_MPEG2_SIMPLE,       "Simple"             },
+    { FF_PROFILE_RESERVED,           "Reserved"           },
+    { FF_PROFILE_RESERVED,           "Reserved"           },
+};
+
+
+AVCodec ff_mpeg1video_decoder = {
     "mpeg1video",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG1VIDEO,
@@ -2546,7 +2542,7 @@ AVCodec mpeg1video_decoder = {
     .update_thread_context= ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context)
 };
 
-AVCodec mpeg2video_decoder = {
+AVCodec ff_mpeg2video_decoder = {
     "mpeg2video",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG2VIDEO,
@@ -2559,10 +2555,11 @@ AVCodec mpeg2video_decoder = {
     .flush= flush,
     .max_lowres= 3,
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
+    .profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
 };
 
 //legacy decoder
-AVCodec mpegvideo_decoder = {
+AVCodec ff_mpegvideo_decoder = {
     "mpegvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG2VIDEO,
@@ -2584,7 +2581,7 @@ static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx){
     if( !(avctx->slice_flags & SLICE_FLAG_CODED_ORDER) )
         return -1;
     if( !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD) ){
-        dprintf(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
+        av_dlog(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
     }
     mpeg_decode_init(avctx);
 
@@ -2594,7 +2591,7 @@ static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec mpeg_xvmc_decoder = {
+AVCodec ff_mpeg_xvmc_decoder = {
     "mpegvideo_xvmc",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG2VIDEO_XVMC,
@@ -2611,7 +2608,7 @@ AVCodec mpeg_xvmc_decoder = {
 #endif
 
 #if CONFIG_MPEG_VDPAU_DECODER
-AVCodec mpeg_vdpau_decoder = {
+AVCodec ff_mpeg_vdpau_decoder = {
     "mpegvideo_vdpau",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG2VIDEO,
@@ -2627,7 +2624,7 @@ AVCodec mpeg_vdpau_decoder = {
 #endif
 
 #if CONFIG_MPEG1_VDPAU_DECODER
-AVCodec mpeg1_vdpau_decoder = {
+AVCodec ff_mpeg1_vdpau_decoder = {
     "mpeg1video_vdpau",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG1VIDEO,
diff --git a/ffmpeg-mt/libavcodec/mpeg12.h b/ffmpeg-mt/libavcodec/mpeg12.h
index 541b66b..4c55726 100644
--- a/ffmpeg-mt/libavcodec/mpeg12.h
+++ b/ffmpeg-mt/libavcodec/mpeg12.h
@@ -2,20 +2,20 @@
  * MPEG1/2 common code
  * Copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg12data.c b/ffmpeg-mt/libavcodec/mpeg12data.c
index 8b1f563..299215f 100644
--- a/ffmpeg-mt/libavcodec/mpeg12data.c
+++ b/ffmpeg-mt/libavcodec/mpeg12data.c
@@ -3,20 +3,20 @@
  * copyright (c) 2000,2001 Fabrice Bellard
  * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg12data.h b/ffmpeg-mt/libavcodec/mpeg12data.h
index 9695e9d..3586a61 100644
--- a/ffmpeg-mt/libavcodec/mpeg12data.h
+++ b/ffmpeg-mt/libavcodec/mpeg12data.h
@@ -3,20 +3,20 @@
  * copyright (c) 2000,2001 Fabrice Bellard
  * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg12decdata.h b/ffmpeg-mt/libavcodec/mpeg12decdata.h
index 66ca5c4..323a902 100644
--- a/ffmpeg-mt/libavcodec/mpeg12decdata.h
+++ b/ffmpeg-mt/libavcodec/mpeg12decdata.h
@@ -3,20 +3,20 @@
  * copyright (c) 2000,2001 Fabrice Bellard
  * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg12enc.c b/ffmpeg-mt/libavcodec/mpeg12enc.c
index 6868e2a..206e7d6 100644
--- a/ffmpeg-mt/libavcodec/mpeg12enc.c
+++ b/ffmpeg-mt/libavcodec/mpeg12enc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -890,7 +890,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
     next_coef:
 #if 0
         if (level != 0)
-            dprintf(s->avctx, "level[%d]=%d\n", i, level);
+            av_dlog(s->avctx, "level[%d]=%d\n", i, level);
 #endif
         /* encode using VLC */
         if (level != 0) {
@@ -930,7 +930,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
     put_bits(&s->pb, table_vlc[112][1], table_vlc[112][0]);
 }
 
-AVCodec mpeg1video_encoder = {
+AVCodec ff_mpeg1video_encoder = {
     "mpeg1video",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG1VIDEO,
@@ -944,7 +944,7 @@ AVCodec mpeg1video_encoder = {
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
 };
 
-AVCodec mpeg2video_encoder = {
+AVCodec ff_mpeg2video_encoder = {
     "mpeg2video",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG2VIDEO,
diff --git a/ffmpeg-mt/libavcodec/mpeg4audio.c b/ffmpeg-mt/libavcodec/mpeg4audio.c
index f9951b1..f0399af 100644
--- a/ffmpeg-mt/libavcodec/mpeg4audio.c
+++ b/ffmpeg-mt/libavcodec/mpeg4audio.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier at free.fr>
  * Copyright (c) 2009 Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg4audio.h b/ffmpeg-mt/libavcodec/mpeg4audio.h
index b941850..2d2b4a2 100644
--- a/ffmpeg-mt/libavcodec/mpeg4audio.h
+++ b/ffmpeg-mt/libavcodec/mpeg4audio.h
@@ -2,20 +2,20 @@
  * MPEG-4 Audio common header
  * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier at free.fr>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -57,7 +57,7 @@ enum AudioObjectType {
     AOT_AAC_MAIN,              ///< Y                       Main
     AOT_AAC_LC,                ///< Y                       Low Complexity
     AOT_AAC_SSR,               ///< N (code in SoC repo)    Scalable Sample Rate
-    AOT_AAC_LTP,               ///< N (code in SoC repo)    Long Term Prediction
+    AOT_AAC_LTP,               ///< Y                       Long Term Prediction
     AOT_SBR,                   ///< Y                       Spectral Band Replication
     AOT_AAC_SCALABLE,          ///< N                       Scalable
     AOT_TWINVQ,                ///< N                       Twin Vector Quantizer
diff --git a/ffmpeg-mt/libavcodec/mpeg4data.h b/ffmpeg-mt/libavcodec/mpeg4data.h
index bef5f88..07cbeee 100644
--- a/ffmpeg-mt/libavcodec/mpeg4data.h
+++ b/ffmpeg-mt/libavcodec/mpeg4data.h
@@ -3,20 +3,20 @@
  * H263+ support
  * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -115,7 +115,7 @@ RLTable ff_mpeg4_rl_intra = {
 };
 
 /* Note this is identical to the intra rvlc except that it is reordered. */
-const uint16_t inter_rvlc[170][2]={
+static const uint16_t inter_rvlc[170][2]={
 {0x0006,  3},{0x0001,  4},{0x0004,  5},{0x001C,  7},
 {0x003C,  8},{0x003D,  8},{0x007C,  9},{0x00FC, 10},
 {0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12},
@@ -219,7 +219,7 @@ RLTable rvlc_rl_inter = {
     inter_rvlc_level,
 };
 
-const uint16_t intra_rvlc[170][2]={
+static const uint16_t intra_rvlc[170][2]={
 {0x0006,  3},{0x0007,  3},{0x000A,  4},{0x0009,  5},
 {0x0014,  6},{0x0015,  6},{0x0034,  7},{0x0074,  8},
 {0x0075,  8},{0x00DD,  9},{0x00EC,  9},{0x01EC, 10},
diff --git a/ffmpeg-mt/libavcodec/mpeg4video.c b/ffmpeg-mt/libavcodec/mpeg4video.c
index dd4dd8a..98781b4 100644
--- a/ffmpeg-mt/libavcodec/mpeg4video.c
+++ b/ffmpeg-mt/libavcodec/mpeg4video.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg4video.h b/ffmpeg-mt/libavcodec/mpeg4video.h
index aab3236..015193e 100644
--- a/ffmpeg-mt/libavcodec/mpeg4video.h
+++ b/ffmpeg-mt/libavcodec/mpeg4video.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -66,10 +66,7 @@ extern const uint16_t ff_mpeg4_intra_vlc[103][2];
 extern RLTable ff_mpeg4_rl_intra;
 
 /* Note this is identical to the intra rvlc except that it is reordered. */
-extern const uint16_t inter_rvlc[170][2];
 extern RLTable rvlc_rl_inter;
-
-extern const uint16_t intra_rvlc[170][2];
 extern RLTable rvlc_rl_intra;
 
 extern const uint16_t sprite_trajectory_tab[15][2];
diff --git a/ffmpeg-mt/libavcodec/mpeg4video_parser.c b/ffmpeg-mt/libavcodec/mpeg4video_parser.c
index 5dbda8b..2e498d1 100644
--- a/ffmpeg-mt/libavcodec/mpeg4video_parser.c
+++ b/ffmpeg-mt/libavcodec/mpeg4video_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -129,7 +129,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
 }
 
 
-AVCodecParser mpeg4video_parser = {
+AVCodecParser ff_mpeg4video_parser = {
     { CODEC_ID_MPEG4 },
     sizeof(ParseContext1),
     mpeg4video_parse_init,
diff --git a/ffmpeg-mt/libavcodec/mpeg4video_parser.h b/ffmpeg-mt/libavcodec/mpeg4video_parser.h
index 822a24c..d907dc4 100644
--- a/ffmpeg-mt/libavcodec/mpeg4video_parser.h
+++ b/ffmpeg-mt/libavcodec/mpeg4video_parser.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpeg4videodec.c b/ffmpeg-mt/libavcodec/mpeg4videodec.c
index fe45b1d..22411b7 100644
--- a/ffmpeg-mt/libavcodec/mpeg4videodec.c
+++ b/ffmpeg-mt/libavcodec/mpeg4videodec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1030,12 +1030,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                     if(last) i+=192;
                 } else {
                     /* second escape */
-#if MIN_CACHE_BITS < 20
-                    LAST_SKIP_BITS(re, &s->gb, 2);
-                    UPDATE_CACHE(re, &s->gb);
-#else
                     SKIP_BITS(re, &s->gb, 2);
-#endif
                     GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
                     i+= run + rl->max_run[run>>7][level/qmul] +1; //FIXME opt indexing
                     level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
@@ -1043,12 +1038,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                 }
             } else {
                 /* first escape */
-#if MIN_CACHE_BITS < 19
-                LAST_SKIP_BITS(re, &s->gb, 1);
-                UPDATE_CACHE(re, &s->gb);
-#else
                 SKIP_BITS(re, &s->gb, 1);
-#endif
                 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
                 i+= run;
                 level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
@@ -1519,16 +1509,17 @@ end:
 
 static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb){
     int hours, minutes, seconds;
-
-    hours= get_bits(gb, 5);
-    minutes= get_bits(gb, 6);
-    skip_bits1(gb);
-    seconds= get_bits(gb, 6);
-
-    s->time_base= seconds + 60*(minutes + 60*hours);
-
-    skip_bits1(gb);
-    skip_bits1(gb);
+    unsigned time_code = show_bits(gb, 18);
+
+    if (time_code & 0x40) {     /* marker_bit */
+        hours   = time_code >> 13;
+        minutes = time_code >>  7 & 0x3f;
+        seconds = time_code       & 0x3f;
+        s->time_base = seconds + 60*(minutes + 60*hours);
+        skip_bits(gb, 20);      /* time_code, closed_gov, broken_link */
+    } else {
+        av_log(s->avctx, AV_LOG_WARNING, "GOP header missing marker_bit\n");
+    }
 
     return 0;
 }
@@ -2096,7 +2087,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
      /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/opendivx)*/
      // note we cannot detect divx5 without b-frames easily (although it's buggy too)
      if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==-1 && s->picture_number==0){
-         av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
+         av_log(s->avctx, AV_LOG_WARNING, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
          s->low_delay=1;
      }
 
@@ -2135,7 +2126,7 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
     for(;;) {
         if(get_bits_count(gb) >= gb->size_in_bits){
             if(gb->size_in_bits==8 && (s->divx_version>=0 || s->xvid_build>=0)){
-                av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bits);
+                av_log(s->avctx, AV_LOG_WARNING, "frame skip %d\n", gb->size_in_bits);
                 return FRAME_SKIPPED; //divx bug
             }else
                 return -1; //end of stream
@@ -2250,7 +2241,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec mpeg4_decoder = {
+AVCodec ff_mpeg4_decoder = {
     "mpeg4",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG4,
@@ -2269,7 +2260,7 @@ AVCodec mpeg4_decoder = {
 
 
 #if CONFIG_MPEG4_VDPAU_DECODER
-AVCodec mpeg4_vdpau_decoder = {
+AVCodec ff_mpeg4_vdpau_decoder = {
     "mpeg4_vdpau",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG4,
diff --git a/ffmpeg-mt/libavcodec/mpeg4videoenc.c b/ffmpeg-mt/libavcodec/mpeg4videoenc.c
index 856cfa7..134894c 100644
--- a/ffmpeg-mt/libavcodec/mpeg4videoenc.c
+++ b/ffmpeg-mt/libavcodec/mpeg4videoenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1338,7 +1338,7 @@ void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
     put_bits(&s->pb, 1, 0); /* no HEC */
 }
 
-AVCodec mpeg4_encoder = {
+AVCodec ff_mpeg4_encoder = {
     "mpeg4",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MPEG4,
diff --git a/ffmpeg-mt/libavcodec/mpegaudio.c b/ffmpeg-mt/libavcodec/mpegaudio.c
index cba5299..1a83635 100644
--- a/ffmpeg-mt/libavcodec/mpegaudio.c
+++ b/ffmpeg-mt/libavcodec/mpegaudio.c
@@ -2,20 +2,20 @@
  * MPEG Audio common code
  * Copyright (c) 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudio.h b/ffmpeg-mt/libavcodec/mpegaudio.h
index 97c7855..fbfddcc 100644
--- a/ffmpeg-mt/libavcodec/mpegaudio.h
+++ b/ffmpeg-mt/libavcodec/mpegaudio.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,7 +33,7 @@
 #include "avcodec.h"
 #include "get_bits.h"
 #include "dsputil.h"
-#include "fft.h"
+#include "dct.h"
 
 #define CONFIG_AUDIO_NONSHORT 0
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudio3.h b/ffmpeg-mt/libavcodec/mpegaudio3.h
index c374a59..7047652 100644
--- a/ffmpeg-mt/libavcodec/mpegaudio3.h
+++ b/ffmpeg-mt/libavcodec/mpegaudio3.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudio_parser.c b/ffmpeg-mt/libavcodec/mpegaudio_parser.c
index 6d7ab8a..3bf1a18 100644
--- a/ffmpeg-mt/libavcodec/mpegaudio_parser.c
+++ b/ffmpeg-mt/libavcodec/mpegaudio_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -140,7 +140,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
 }
 
 
-AVCodecParser mpegaudio_parser = {
+AVCodecParser ff_mpegaudio_parser = {
     { CODEC_ID_MP1, CODEC_ID_MP2, CODEC_ID_MP3 },
     sizeof(MpegAudioParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/mpegaudio_tablegen.c b/ffmpeg-mt/libavcodec/mpegaudio_tablegen.c
index 0888e78..27da219 100644
--- a/ffmpeg-mt/libavcodec/mpegaudio_tablegen.c
+++ b/ffmpeg-mt/libavcodec/mpegaudio_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudio_tablegen.h b/ffmpeg-mt/libavcodec/mpegaudio_tablegen.h
index 6b5ff22..ccaaf0b 100644
--- a/ffmpeg-mt/libavcodec/mpegaudio_tablegen.h
+++ b/ffmpeg-mt/libavcodec/mpegaudio_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudiodata.c b/ffmpeg-mt/libavcodec/mpegaudiodata.c
index c9dabf3..b850d22 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiodata.c
+++ b/ffmpeg-mt/libavcodec/mpegaudiodata.c
@@ -2,20 +2,20 @@
  * MPEG Audio common tables
  * copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudiodata.h b/ffmpeg-mt/libavcodec/mpegaudiodata.h
index 5626e3d..841ec51 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiodata.h
+++ b/ffmpeg-mt/libavcodec/mpegaudiodata.h
@@ -2,20 +2,20 @@
  * MPEG Audio common tables
  * copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudiodec.c b/ffmpeg-mt/libavcodec/mpegaudiodec.c
index 76fdffb..024d618 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiodec.c
+++ b/ffmpeg-mt/libavcodec/mpegaudiodec.c
@@ -2,20 +2,20 @@
  * MPEG Audio decoder
  * Copyright (c) 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,10 +24,10 @@
  * MPEG Audio decoder.
  */
 
+#include "libavutil/audioconvert.h"
 #include "avcodec.h"
 #include "get_bits.h"
 #include "dsputil.h"
-#include "libavformat/id3v1.h"
 
 /*
  * TODO:
@@ -353,7 +353,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
             scale_factor_mult[i][0] = MULLx(norm, FIXR(1.0          * 2.0), FRAC_BITS);
             scale_factor_mult[i][1] = MULLx(norm, FIXR(0.7937005259 * 2.0), FRAC_BITS);
             scale_factor_mult[i][2] = MULLx(norm, FIXR(0.6299605249 * 2.0), FRAC_BITS);
-            dprintf(avctx, "%d: norm=%x s=%x %x %x\n",
+            av_dlog(avctx, "%d: norm=%x s=%x %x %x\n",
                     i, norm,
                     scale_factor_mult[i][0],
                     scale_factor_mult[i][1],
@@ -458,7 +458,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
                 k = i & 1;
                 is_table_lsf[j][k ^ 1][i] = FIXR(f);
                 is_table_lsf[j][k][i] = FIXR(1.0);
-                dprintf(avctx, "is_table_lsf %d %d: %x %x\n",
+                av_dlog(avctx, "is_table_lsf %d %d: %x %x\n",
                         i, j, is_table_lsf[j][0][i], is_table_lsf[j][1][i]);
             }
         }
@@ -987,7 +987,7 @@ static int mp_decode_layer2(MPADecodeContext *s)
     else
         bound = sblimit;
 
-    dprintf(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit);
+    av_dlog(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit);
 
     /* sanity check */
     if( bound > sblimit ) bound = sblimit;
@@ -1310,7 +1310,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
 
             exponent= exponents[s_index];
 
-            dprintf(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n",
+            av_dlog(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n",
                     i, g->region_size[i] - j, x, y, exponent);
             if(y&16){
                 x = y >> 5;
@@ -1378,7 +1378,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
         last_pos= pos;
 
         code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1);
-        dprintf(s->avctx, "t=%d code=%d\n", g->count1table_select, code);
+        av_dlog(s->avctx, "t=%d code=%d\n", g->count1table_select, code);
         g->sb_hybrid[s_index+0]=
         g->sb_hybrid[s_index+1]=
         g->sb_hybrid[s_index+2]=
@@ -1736,7 +1736,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
 
     for(gr=0;gr<nb_granules;gr++) {
         for(ch=0;ch<s->nb_channels;ch++) {
-            dprintf(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch);
+            av_dlog(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch);
             g = &s->granules[ch][gr];
             g->part2_3_length = get_bits(&s->gb, 12);
             g->big_values = get_bits(&s->gb, 9);
@@ -1777,7 +1777,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
                 /* compute huffman coded region sizes */
                 region_address1 = get_bits(&s->gb, 4);
                 region_address2 = get_bits(&s->gb, 3);
-                dprintf(s->avctx, "region1=%d region2=%d\n",
+                av_dlog(s->avctx, "region1=%d region2=%d\n",
                         region_address1, region_address2);
                 ff_init_long_region(s, g, region_address1, region_address2);
             }
@@ -1789,7 +1789,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
                 g->preflag = get_bits1(&s->gb);
             g->scalefac_scale = get_bits1(&s->gb);
             g->count1table_select = get_bits1(&s->gb);
-            dprintf(s->avctx, "block_type=%d switch_point=%d\n",
+            av_dlog(s->avctx, "block_type=%d switch_point=%d\n",
                     g->block_type, g->switch_point);
         }
     }
@@ -1798,7 +1798,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
     const uint8_t *ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3);
     assert((get_bits_count(&s->gb) & 7) == 0);
     /* now we get bits from the main_data_begin offset */
-    dprintf(s->avctx, "seekback: %d\n", main_data_begin);
+    av_dlog(s->avctx, "seekback: %d\n", main_data_begin);
 //av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size);
 
     memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES);
@@ -1832,7 +1832,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
                 /* MPEG1 scale factors */
                 slen1 = slen_table[0][g->scalefac_compress];
                 slen2 = slen_table[1][g->scalefac_compress];
-                dprintf(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2);
+                av_dlog(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2);
                 if (g->block_type == 2) {
                     n = g->switch_point ? 17 : 18;
                     j = 0;
@@ -1965,7 +1965,7 @@ static int mp_decode_frame(MPADecodeContext *s,
     if (s->error_protection)
         skip_bits(&s->gb, 16);
 
-    dprintf(s->avctx, "frame %d:\n", s->frame_count);
+    av_dlog(s->avctx, "frame %d:\n", s->frame_count);
     switch(s->layer) {
     case 1:
         s->avctx->frame_size = 384;
@@ -2044,13 +2044,6 @@ static int decode_frame(AVCodecContext * avctx,
 
     header = AV_RB32(buf);
     if(ff_mpa_check_header(header) < 0){
-
-        if (buf_size == ID3v1_TAG_SIZE
-            && buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G') {
-            *data_size = 0;
-            return ID3v1_TAG_SIZE;
-        }
-
         av_log(avctx, AV_LOG_ERROR, "Header missing\n");
         return -1;
     }
@@ -2062,6 +2055,7 @@ static int decode_frame(AVCodecContext * avctx,
     }
     /* update codec info */
     avctx->channels = s->nb_channels;
+    avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
     if (!avctx->bit_rate)
         avctx->bit_rate = s->bit_rate;
     avctx->sub_id = s->layer;
@@ -2235,8 +2229,7 @@ static av_cold int decode_close_mp3on4(AVCodecContext * avctx)
     int i;
 
     for (i = 0; i < s->frames; i++)
-        if (s->mp3decctx[i])
-            av_free(s->mp3decctx[i]);
+        av_free(s->mp3decctx[i]);
 
     return 0;
 }
@@ -2316,7 +2309,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx,
 
 #if !CONFIG_FLOAT
 #if CONFIG_MP1_DECODER
-AVCodec mp1_decoder =
+AVCodec ff_mp1_decoder =
 {
     "mp1",
     AVMEDIA_TYPE_AUDIO,
@@ -2332,7 +2325,7 @@ AVCodec mp1_decoder =
 };
 #endif
 #if CONFIG_MP2_DECODER
-AVCodec mp2_decoder =
+AVCodec ff_mp2_decoder =
 {
     "mp2",
     AVMEDIA_TYPE_AUDIO,
@@ -2348,7 +2341,7 @@ AVCodec mp2_decoder =
 };
 #endif
 #if CONFIG_MP3_DECODER
-AVCodec mp3_decoder =
+AVCodec ff_mp3_decoder =
 {
     "mp3",
     AVMEDIA_TYPE_AUDIO,
@@ -2364,7 +2357,7 @@ AVCodec mp3_decoder =
 };
 #endif
 #if CONFIG_MP3ADU_DECODER
-AVCodec mp3adu_decoder =
+AVCodec ff_mp3adu_decoder =
 {
     "mp3adu",
     AVMEDIA_TYPE_AUDIO,
@@ -2380,7 +2373,7 @@ AVCodec mp3adu_decoder =
 };
 #endif
 #if CONFIG_MP3ON4_DECODER
-AVCodec mp3on4_decoder =
+AVCodec ff_mp3on4_decoder =
 {
     "mp3on4",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/mpegaudiodec_float.c b/ffmpeg-mt/libavcodec/mpegaudiodec_float.c
index 9150b33..e9041fc 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiodec_float.c
+++ b/ffmpeg-mt/libavcodec/mpegaudiodec_float.c
@@ -2,20 +2,20 @@
  * Float MPEG Audio decoder
  * Copyright (c) 2010 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -88,7 +88,7 @@ static av_cold int decode_end(AVCodecContext * avctx)
 }
 
 #if CONFIG_MP1FLOAT_DECODER
-AVCodec mp1float_decoder =
+AVCodec ff_mp1float_decoder =
 {
     "mp1float",
     AVMEDIA_TYPE_AUDIO,
@@ -104,7 +104,7 @@ AVCodec mp1float_decoder =
 };
 #endif
 #if CONFIG_MP2FLOAT_DECODER
-AVCodec mp2float_decoder =
+AVCodec ff_mp2float_decoder =
 {
     "mp2float",
     AVMEDIA_TYPE_AUDIO,
@@ -120,7 +120,7 @@ AVCodec mp2float_decoder =
 };
 #endif
 #if CONFIG_MP3FLOAT_DECODER
-AVCodec mp3float_decoder =
+AVCodec ff_mp3float_decoder =
 {
     "mp3float",
     AVMEDIA_TYPE_AUDIO,
@@ -136,7 +136,7 @@ AVCodec mp3float_decoder =
 };
 #endif
 #if CONFIG_MP3ADUFLOAT_DECODER
-AVCodec mp3adufloat_decoder =
+AVCodec ff_mp3adufloat_decoder =
 {
     "mp3adufloat",
     AVMEDIA_TYPE_AUDIO,
@@ -152,7 +152,7 @@ AVCodec mp3adufloat_decoder =
 };
 #endif
 #if CONFIG_MP3ON4FLOAT_DECODER
-AVCodec mp3on4float_decoder =
+AVCodec ff_mp3on4float_decoder =
 {
     "mp3on4float",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/mpegaudiodecheader.c b/ffmpeg-mt/libavcodec/mpegaudiodecheader.c
index 67f882f..a0bd4fc 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiodecheader.c
+++ b/ffmpeg-mt/libavcodec/mpegaudiodecheader.c
@@ -2,20 +2,20 @@
  * MPEG Audio header decoder
  * Copyright (c) 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -91,20 +91,20 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
     }
 
 #if defined(DEBUG)
-    dprintf(NULL, "layer%d, %d Hz, %d kbits/s, ",
+    av_dlog(NULL, "layer%d, %d Hz, %d kbits/s, ",
            s->layer, s->sample_rate, s->bit_rate);
     if (s->nb_channels == 2) {
         if (s->layer == 3) {
             if (s->mode_ext & MODE_EXT_MS_STEREO)
-                dprintf(NULL, "ms-");
+                av_dlog(NULL, "ms-");
             if (s->mode_ext & MODE_EXT_I_STEREO)
-                dprintf(NULL, "i-");
+                av_dlog(NULL, "i-");
         }
-        dprintf(NULL, "stereo");
+        av_dlog(NULL, "stereo");
     } else {
-        dprintf(NULL, "mono");
+        av_dlog(NULL, "mono");
     }
-    dprintf(NULL, "\n");
+    av_dlog(NULL, "\n");
 #endif
     return 0;
 }
diff --git a/ffmpeg-mt/libavcodec/mpegaudiodecheader.h b/ffmpeg-mt/libavcodec/mpegaudiodecheader.h
index 5578618..41a491b 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiodecheader.h
+++ b/ffmpeg-mt/libavcodec/mpegaudiodecheader.h
@@ -2,20 +2,20 @@
  * MPEG Audio header decoder
  * Copyright (c) 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudiodectab.h b/ffmpeg-mt/libavcodec/mpegaudiodectab.h
index 234a70e..fdcf83f 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiodectab.h
+++ b/ffmpeg-mt/libavcodec/mpegaudiodectab.h
@@ -2,20 +2,20 @@
  * MPEG Audio decoder
  * copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegaudioenc.c b/ffmpeg-mt/libavcodec/mpegaudioenc.c
index 736cbe1..bd581cf 100644
--- a/ffmpeg-mt/libavcodec/mpegaudioenc.c
+++ b/ffmpeg-mt/libavcodec/mpegaudioenc.c
@@ -2,20 +2,20 @@
  * The simplest mpeg audio layer 2 encoder
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -122,7 +122,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
     s->sblimit = ff_mpa_sblimit_table[table];
     s->alloc_table = ff_mpa_alloc_tables[table];
 
-    dprintf(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
+    av_dlog(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
             bitrate, freq, s->frame_size, table, s->frame_frac_incr);
 
     for(i=0;i<s->nb_channels;i++)
@@ -783,7 +783,7 @@ static av_cold int MPA_encode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec mp2_encoder = {
+AVCodec ff_mp2_encoder = {
     "mp2",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_MP2,
diff --git a/ffmpeg-mt/libavcodec/mpegaudiotab.h b/ffmpeg-mt/libavcodec/mpegaudiotab.h
index 35129e6..45afe9b 100644
--- a/ffmpeg-mt/libavcodec/mpegaudiotab.h
+++ b/ffmpeg-mt/libavcodec/mpegaudiotab.h
@@ -4,20 +4,20 @@
  *
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/mpegvideo.c b/ffmpeg-mt/libavcodec/mpegvideo.c
index 0dfc914..feb3d95 100644
--- a/ffmpeg-mt/libavcodec/mpegvideo.c
+++ b/ffmpeg-mt/libavcodec/mpegvideo.c
@@ -5,20 +5,20 @@
  *
  * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,7 +28,7 @@
  */
 
 #include "libavutil/intmath.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "internal.h"
@@ -316,6 +316,7 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared){
     s->prev_pict_types[0]= s->dropable ? FF_B_TYPE : s->pict_type;
     if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == FF_B_TYPE)
         pic->age= INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway.
+    pic->owner2 = s;
 
     return 0;
 fail: //for the FF_ALLOCZ_OR_GOTO macro
@@ -512,7 +513,8 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src
     s->divx_packed          = s1->divx_packed;
 
     if(s1->bitstream_buffer){
-        s->bitstream_buffer       = av_fast_realloc(s->bitstream_buffer, &s->allocated_bitstream_buffer_size, s1->allocated_bitstream_buffer_size+FF_INPUT_BUFFER_PADDING_SIZE);
+        if (s1->bitstream_buffer_size + FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size)
+            av_fast_malloc(&s->bitstream_buffer, &s->allocated_bitstream_buffer_size, s1->allocated_bitstream_buffer_size);
         s->bitstream_buffer_size  = s1->bitstream_buffer_size;
         memcpy(s->bitstream_buffer, s1->bitstream_buffer, s1->bitstream_buffer_size);
         memset(s->bitstream_buffer+s->bitstream_buffer_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
@@ -945,6 +947,21 @@ void init_vlc_rl(RLTable *rl)
     }
 }
 
+void ff_release_unused_pictures(MpegEncContext *s, int remove_current)
+{
+    int i;
+
+    /* release non reference frames */
+    for(i=0; i<s->picture_count; i++){
+        if(s->picture[i].data[0] && !s->picture[i].reference
+           && s->picture[i].owner2 == s
+           && (remove_current || &s->picture[i] != s->current_picture_ptr)
+           /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
+            free_frame_buffer(s, &s->picture[i]);
+        }
+    }
+}
+
 int ff_find_unused_picture(MpegEncContext *s, int shared){
     int i;
 
@@ -1024,12 +1041,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
     }
 
     if(!s->encoding){
-        /* release non reference frames */
-        for(i=0; i<s->picture_count; i++){
-            if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
-                free_frame_buffer(s, &s->picture[i]);
-            }
-        }
+        ff_release_unused_pictures(s, 1);
 
         if(s->current_picture_ptr && s->current_picture_ptr->data[0]==NULL)
             pic= s->current_picture_ptr; //we already have a unused image (maybe it was set before reading the header)
@@ -1119,7 +1131,9 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
         }
     }
 
+#if FF_API_HURRY_UP
     s->hurry_up= s->avctx->hurry_up;
+#endif
     s->error_recognition= avctx->error_recognition;
 
     /* set dequantizer, we can't do it during init as it might change for mpeg4
@@ -1155,19 +1169,22 @@ void MPV_frame_end(MpegEncContext *s)
     //just to make sure that all data is rendered.
     if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
         ff_xvmc_field_end(s);
-   }else if(s->error_count
+   }else if((s->error_count || s->encoding)
        && !s->avctx->hwaccel
        && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
        && s->unrestricted_mv
        && s->current_picture.reference
        && !s->intra_only
        && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
-        int edges = EDGE_BOTTOM | EDGE_TOP, h = s->v_edge_pos;
-
-            s->dsp.draw_edges(s->current_picture_ptr->data[0], s->linesize  , s->h_edge_pos   , h   , EDGE_WIDTH  , edges);
-            s->dsp.draw_edges(s->current_picture_ptr->data[1], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
-            s->dsp.draw_edges(s->current_picture_ptr->data[2], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
-
+            s->dsp.draw_edges(s->current_picture.data[0], s->linesize  ,
+                              s->h_edge_pos   , s->v_edge_pos   ,
+                              EDGE_WIDTH  , EDGE_TOP | EDGE_BOTTOM);
+            s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize,
+                              s->h_edge_pos>>1, s->v_edge_pos>>1,
+                              EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
+            s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize,
+                              s->h_edge_pos>>1, s->v_edge_pos>>1,
+                              EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
     }
 
     emms_c();
@@ -1582,7 +1599,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
 
     if(   (unsigned)src_x > h_edge_pos                 - (!!sx) - w
        || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
                             src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
         src= s->edge_emu_buffer;
         emu=1;
@@ -1655,14 +1672,14 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
 
     if(   (unsigned)src_x > h_edge_pos                 - (!!sx) - 2*block_s
        || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
                              src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
             ptr_y = s->edge_emu_buffer;
             if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
                 uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
-                ff_emulated_edge_mc(uvbuf  , ptr_cb, s->uvlinesize, 9, 9+field_based,
+                s->dsp.emulated_edge_mc(uvbuf  , ptr_cb, s->uvlinesize, 9, 9+field_based,
                                  uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
-                ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based,
+                s->dsp.emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based,
                                  uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
                 ptr_cb= uvbuf;
                 ptr_cr= uvbuf+16;
@@ -1728,7 +1745,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
     if(s->flags&CODEC_FLAG_EMU_EDGE){
         if(   (unsigned)src_x > h_edge_pos - (!!sx) - block_s
            || (unsigned)src_y > v_edge_pos - (!!sy) - block_s){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
             ptr= s->edge_emu_buffer;
             emu=1;
         }
@@ -1739,7 +1756,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
 
     ptr = ref_picture[2] + offset;
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
         ptr= s->edge_emu_buffer;
     }
     pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
@@ -2106,7 +2123,9 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
             }
 
             /* skip dequant / idct if we are really late ;) */
+#if FF_API_HURRY_UP
             if(s->hurry_up>1) goto skip_idct;
+#endif
             if(s->avctx->skip_idct){
                 if(  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
                    ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
diff --git a/ffmpeg-mt/libavcodec/mpegvideo.h b/ffmpeg-mt/libavcodec/mpegvideo.h
index b78b520..769f425 100644
--- a/ffmpeg-mt/libavcodec/mpegvideo.h
+++ b/ffmpeg-mt/libavcodec/mpegvideo.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -76,6 +76,8 @@ enum OutputFormat {
 #define EXT_START_CODE          0x000001b5
 #define USER_START_CODE         0x000001b2
 
+struct MpegEncContext;
+
 /**
  * Picture.
  */
@@ -132,10 +134,9 @@ typedef struct Picture{
     uint8_t *mb_mean;           ///< Table for MB luminance
     int32_t *mb_cmp_score;      ///< Table for MB cmp scores, for mb decision FIXME remove
     int b_frame_score;          /* */
+    struct MpegEncContext *owner2; ///< pointer to the MpegEncContext that allocated this picture
 } Picture;
 
-struct MpegEncContext;
-
 /**
  * Motion estimation context.
  */
@@ -225,9 +226,6 @@ typedef struct MpegEncContext {
     int stream_codec_tag;      ///< internal stream_codec_tag upper case converted from avctx stream_codec_tag
     /* the following fields are managed internally by the encoder */
 
-    /** bit output */
-    PutBitContext pb;
-
     /* sequence parameters */
     int context_initialized;
     int input_picture_number;  ///< used to set pic->display_picture_number, should not be used for/by anything else
@@ -248,8 +246,22 @@ typedef struct MpegEncContext {
     Picture **input_picture;   ///< next pictures on display order for encoding
     Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding
 
-    int picture_count;         ///< number of allocated pictures (MAX_PICTURE_COUNT * avctx->thread_count)
-    int picture_range_start, picture_range_end; ///< the part of picture that this context can allocate in
+    int y_dc_scale, c_dc_scale;
+    int ac_pred;
+    int block_last_index[12];  ///< last non zero coefficient in block
+    int h263_aic;              ///< Advanded INTRA Coding (AIC)
+
+    /* scantables */
+    ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage
+    ScanTable intra_scantable;
+    ScanTable intra_h_scantable;
+    ScanTable intra_v_scantable;
+
+    /* WARNING: changes above this line require updates to hardcoded
+     *          offsets used in asm. */
+
+    /** bit output */
+    PutBitContext pb;
 
     int start_mb_y;            ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
     int end_mb_y;              ///< end   mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
@@ -282,12 +294,13 @@ typedef struct MpegEncContext {
     Picture *last_picture_ptr;     ///< pointer to the previous picture.
     Picture *next_picture_ptr;     ///< pointer to the next picture (for bidir pred)
     Picture *current_picture_ptr;  ///< pointer to the current picture
+    int picture_count;             ///< number of allocated pictures (MAX_PICTURE_COUNT * avctx->thread_count)
+    int picture_range_start, picture_range_end; ///< the part of picture that this context can allocate in
     uint8_t *visualization_buffer[3]; //< temporary buffer vor MV visualization
     int last_dc[3];                ///< last DC values for MPEG1
     int16_t *dc_val_base;
     int16_t *dc_val[3];            ///< used for mpeg4 DC prediction, all 3 arrays must be continuous
     int16_t dc_cache[4*5];
-    int y_dc_scale, c_dc_scale;
     const uint8_t *y_dc_scale_table;     ///< qscale -> y_dc_scale table
     const uint8_t *c_dc_scale_table;     ///< qscale -> c_dc_scale table
     const uint8_t *chroma_qscale_table;  ///< qscale -> chroma_qscale (h263)
@@ -295,7 +308,6 @@ typedef struct MpegEncContext {
     uint8_t *coded_block;          ///< used for coded block pattern prediction (msmpeg4v3, wmv1)
     int16_t (*ac_val_base)[16];
     int16_t (*ac_val[3])[16];      ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous
-    int ac_pred;
     uint8_t *prev_pict_types;     ///< previous picture types in bitstream order, used for mb skip
 #define PREV_PICT_TYPES_BUFFER_SIZE 256
     int mb_skipped;                ///< MUST BE SET only during DECODING
@@ -379,8 +391,10 @@ typedef struct MpegEncContext {
     int no_rounding;  /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
                         for b-frames rounding mode is always 0 */
 
+#if FF_API_HURRY_UP
     int hurry_up;     /**< when set to 1 during decoding, b frames will be skipped
                          when set to 2 idct/dequant will be skipped too */
+#endif
 
     /* macroblock layer */
     int mb_x, mb_y;
@@ -438,12 +452,6 @@ typedef struct MpegEncContext {
     /** identical to the above but for MMX & these are not permutated, second 64 entries are bias*/
     uint16_t (*q_intra_matrix16)[2][64];
     uint16_t (*q_inter_matrix16)[2][64];
-    int block_last_index[12];  ///< last non zero coefficient in block
-    /* scantables */
-    ScanTable intra_scantable;
-    ScanTable intra_h_scantable;
-    ScanTable intra_v_scantable;
-    ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage
 
     /* noise reduction */
     int (*dct_error_sum)[64];
@@ -499,7 +507,6 @@ typedef struct MpegEncContext {
 
     /* H.263+ specific */
     int umvplus;                    ///< == H263+ && unrestricted_mv
-    int h263_aic;                   ///< Advanded INTRA Coding (AIC)
     int h263_aic_dir;               ///< AIC direction: 0 = left, 1 = top
     int h263_slice_structured;
     int alt_inter_vlc;              ///< alternative inter vlc
@@ -680,7 +687,10 @@ typedef struct MpegEncContext {
     void (*denoise_dct)(struct MpegEncContext *s, DCTELEM *block);
 } MpegEncContext;
 
-#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? &new_ctx->picture[pic - old_ctx->picture] : NULL)
+#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
+    (pic >= old_ctx->picture && pic < old_ctx->picture+old_ctx->picture_count ?\
+        &new_ctx->picture[pic - old_ctx->picture] : pic - (Picture*)old_ctx + (Picture*)new_ctx)\
+    : NULL)
 
 void MPV_decode_defaults(MpegEncContext *s);
 int MPV_common_init(MpegEncContext *s);
@@ -703,6 +713,7 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h);
 void ff_mpeg_flush(AVCodecContext *avctx);
 void ff_print_debug_info(MpegEncContext *s, AVFrame *pict);
 void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
+void ff_release_unused_pictures(MpegEncContext *s, int remove_current);
 int ff_find_unused_picture(MpegEncContext *s, int shared);
 void ff_denoise_dct(MpegEncContext *s, DCTELEM *block);
 void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
diff --git a/ffmpeg-mt/libavcodec/mpegvideo_common.h b/ffmpeg-mt/libavcodec/mpegvideo_common.h
index 8e46e69..f6c94fb 100644
--- a/ffmpeg-mt/libavcodec/mpegvideo_common.h
+++ b/ffmpeg-mt/libavcodec/mpegvideo_common.h
@@ -5,20 +5,20 @@
  *
  * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -40,8 +40,6 @@
 #include <limits.h>
 
 int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-void  denoise_dct_c(MpegEncContext *s, DCTELEM *block);
 
 /**
  * allocates a Picture
@@ -85,7 +83,7 @@ static inline void gmc1_motion(MpegEncContext *s,
     if(s->flags&CODEC_FLAG_EMU_EDGE){
         if(   (unsigned)src_x >= s->h_edge_pos - 17
            || (unsigned)src_y >= s->v_edge_pos - 17){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
             ptr= s->edge_emu_buffer;
         }
     }
@@ -124,7 +122,7 @@ static inline void gmc1_motion(MpegEncContext *s,
     if(s->flags&CODEC_FLAG_EMU_EDGE){
         if(   (unsigned)src_x >= (s->h_edge_pos>>1) - 9
            || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
             ptr= s->edge_emu_buffer;
             emu=1;
         }
@@ -133,7 +131,7 @@ static inline void gmc1_motion(MpegEncContext *s,
 
     ptr = ref_picture[2] + offset;
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
         ptr= s->edge_emu_buffer;
     }
     s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
@@ -225,7 +223,7 @@ static inline int hpel_motion(MpegEncContext *s,
     if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
         if(   (unsigned)src_x > h_edge_pos - (motion_x&1) - w
            || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
-            ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
                              src_x, src_y<<field_based, h_edge_pos, s->v_edge_pos);
             src= s->edge_emu_buffer;
             emu=1;
@@ -317,19 +315,19 @@ if(s->quarter_sample)
                         "MPEG motion vector out of boundary (%d %d)\n", src_x, src_y);
                 return;
             }
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
                                 17, 17+field_based,
                                 src_x, src_y<<field_based,
                                 s->h_edge_pos, s->v_edge_pos);
             ptr_y = s->edge_emu_buffer;
             if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
                 uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
-                ff_emulated_edge_mc(uvbuf ,
+                s->dsp.emulated_edge_mc(uvbuf ,
                                     ptr_cb, s->uvlinesize,
                                     9, 9+field_based,
                                     uvsrc_x, uvsrc_y<<field_based,
                                     s->h_edge_pos>>1, s->v_edge_pos>>1);
-                ff_emulated_edge_mc(uvbuf+16,
+                s->dsp.emulated_edge_mc(uvbuf+16,
                                     ptr_cr, s->uvlinesize,
                                     9, 9+field_based,
                                     uvsrc_x, uvsrc_y<<field_based,
@@ -514,17 +512,17 @@ static inline void qpel_motion(MpegEncContext *s,
 
     if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 16
        || (unsigned)src_y >    v_edge_pos - (motion_y&3) - h  ){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
                             17, 17+field_based, src_x, src_y<<field_based,
                             s->h_edge_pos, s->v_edge_pos);
         ptr_y= s->edge_emu_buffer;
         if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
             uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
-            ff_emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize,
+            s->dsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize,
                                 9, 9 + field_based,
                                 uvsrc_x, uvsrc_y<<field_based,
                                 s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ff_emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize,
+            s->dsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize,
                                 9, 9 + field_based,
                                 uvsrc_x, uvsrc_y<<field_based,
                                 s->h_edge_pos>>1, s->v_edge_pos>>1);
@@ -592,7 +590,7 @@ static inline void chroma_4mv_motion(MpegEncContext *s,
     if(s->flags&CODEC_FLAG_EMU_EDGE){
         if(   (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8
            || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
                                 9, 9, src_x, src_y,
                                 s->h_edge_pos>>1, s->v_edge_pos>>1);
             ptr= s->edge_emu_buffer;
@@ -603,7 +601,7 @@ static inline void chroma_4mv_motion(MpegEncContext *s,
 
     ptr = ref_picture[2] + offset;
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
                             9, 9, src_x, src_y,
                             s->h_edge_pos>>1, s->v_edge_pos>>1);
         ptr= s->edge_emu_buffer;
@@ -764,7 +762,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
                 if(s->flags&CODEC_FLAG_EMU_EDGE){
                     if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8
                        || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){
-                        ff_emulated_edge_mc(s->edge_emu_buffer, ptr,
+                        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr,
                                             s->linesize, 9, 9,
                                             src_x, src_y,
                                             s->h_edge_pos, s->v_edge_pos);
diff --git a/ffmpeg-mt/libavcodec/mpegvideo_enc.c b/ffmpeg-mt/libavcodec/mpegvideo_enc.c
index a54dec2..c244c53 100644
--- a/ffmpeg-mt/libavcodec/mpegvideo_enc.c
+++ b/ffmpeg-mt/libavcodec/mpegvideo_enc.c
@@ -5,20 +5,20 @@
  *
  * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -49,6 +49,8 @@
 static int encode_picture(MpegEncContext *s, int picture_number);
 static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale);
 static int sse_mb(MpegEncContext *s);
+static void denoise_dct_c(MpegEncContext *s, DCTELEM *block);
+static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
 
 /* enable all paranoid tests for rounding, overflows, etc... */
 //#define PARANOID
@@ -1380,6 +1382,7 @@ vbv_retry:
             s->vbv_delay_ptr[1]  = vbv_delay>>5;
             s->vbv_delay_ptr[2] &= 0x07;
             s->vbv_delay_ptr[2] |= vbv_delay<<3;
+            avctx->vbv_delay = vbv_delay*300;
         }
         s->total_bits += s->frame_bits;
         avctx->frame_bits  = s->frame_bits;
@@ -1547,11 +1550,11 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x,
 
     if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){
         uint8_t *ebuf= s->edge_emu_buffer + 32;
-        ff_emulated_edge_mc(ebuf            , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width   , s->height);
+        s->dsp.emulated_edge_mc(ebuf            , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width   , s->height);
         ptr_y= ebuf;
-        ff_emulated_edge_mc(ebuf+18*wrap_y  , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
+        s->dsp.emulated_edge_mc(ebuf+18*wrap_y  , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
         ptr_cb= ebuf+18*wrap_y;
-        ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
+        s->dsp.emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
         ptr_cr= ebuf+18*wrap_y+8;
     }
 
@@ -2984,7 +2987,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
     return 0;
 }
 
-void  denoise_dct_c(MpegEncContext *s, DCTELEM *block){
+static void denoise_dct_c(MpegEncContext *s, DCTELEM *block){
     const int intra= s->mb_intra;
     int i;
 
@@ -3008,9 +3011,9 @@ void  denoise_dct_c(MpegEncContext *s, DCTELEM *block){
     }
 }
 
-int dct_quantize_trellis_c(MpegEncContext *s,
-                        DCTELEM *block, int n,
-                        int qscale, int *overflow){
+static int dct_quantize_trellis_c(MpegEncContext *s,
+                                  DCTELEM *block, int n,
+                                  int qscale, int *overflow){
     const int *qmat;
     const uint8_t *scantable= s->intra_scantable.scantable;
     const uint8_t *perm_scantable= s->intra_scantable.permutated;
@@ -3779,7 +3782,7 @@ int dct_quantize_c(MpegEncContext *s,
     return last_non_zero;
 }
 
-AVCodec h263_encoder = {
+AVCodec ff_h263_encoder = {
     "h263",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H263,
@@ -3791,7 +3794,7 @@ AVCodec h263_encoder = {
     .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996"),
 };
 
-AVCodec h263p_encoder = {
+AVCodec ff_h263p_encoder = {
     "h263p",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_H263P,
@@ -3803,7 +3806,7 @@ AVCodec h263p_encoder = {
     .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
 };
 
-AVCodec msmpeg4v1_encoder = {
+AVCodec ff_msmpeg4v1_encoder = {
     "msmpeg4v1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSMPEG4V1,
@@ -3815,7 +3818,7 @@ AVCodec msmpeg4v1_encoder = {
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
 };
 
-AVCodec msmpeg4v2_encoder = {
+AVCodec ff_msmpeg4v2_encoder = {
     "msmpeg4v2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSMPEG4V2,
@@ -3827,7 +3830,7 @@ AVCodec msmpeg4v2_encoder = {
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
 };
 
-AVCodec msmpeg4v3_encoder = {
+AVCodec ff_msmpeg4v3_encoder = {
     "msmpeg4",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSMPEG4V3,
@@ -3839,7 +3842,7 @@ AVCodec msmpeg4v3_encoder = {
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
 };
 
-AVCodec wmv1_encoder = {
+AVCodec ff_wmv1_encoder = {
     "wmv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WMV1,
diff --git a/ffmpeg-mt/libavcodec/mpegvideo_parser.c b/ffmpeg-mt/libavcodec/mpegvideo_parser.c
index 546c3bd..8115df5 100644
--- a/ffmpeg-mt/libavcodec/mpegvideo_parser.c
+++ b/ffmpeg-mt/libavcodec/mpegvideo_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -176,7 +176,7 @@ static int mpegvideo_split(AVCodecContext *avctx,
     return 0;
 }
 
-AVCodecParser mpegvideo_parser = {
+AVCodecParser ff_mpegvideo_parser = {
     { CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO },
     sizeof(ParseContext1),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/mpegvideo_xvmc.c b/ffmpeg-mt/libavcodec/mpegvideo_xvmc.c
index 0a5a750..d05eb48 100644
--- a/ffmpeg-mt/libavcodec/mpegvideo_xvmc.c
+++ b/ffmpeg-mt/libavcodec/mpegvideo_xvmc.c
@@ -2,20 +2,20 @@
  * XVideo Motion Compensation
  * Copyright (c) 2003 Ivan Kalvachev
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msgsmdec.c b/ffmpeg-mt/libavcodec/msgsmdec.c
index e759451..ff9b275 100644
--- a/ffmpeg-mt/libavcodec/msgsmdec.c
+++ b/ffmpeg-mt/libavcodec/msgsmdec.c
@@ -2,20 +2,20 @@
  * gsm 06.10 decoder, Microsoft variant
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msgsmdec.h b/ffmpeg-mt/libavcodec/msgsmdec.h
index fbf819a..cf58baa 100644
--- a/ffmpeg-mt/libavcodec/msgsmdec.h
+++ b/ffmpeg-mt/libavcodec/msgsmdec.h
@@ -2,20 +2,20 @@
  * gsm 06.10 decoder, Microsoft variant
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msmpeg4.c b/ffmpeg-mt/libavcodec/msmpeg4.c
index c54df7a..3b40c83 100644
--- a/ffmpeg-mt/libavcodec/msmpeg4.c
+++ b/ffmpeg-mt/libavcodec/msmpeg4.c
@@ -5,20 +5,20 @@
  *
  * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1797,12 +1797,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
 #endif
                 } else {
                     /* second escape */
-#if MIN_CACHE_BITS < 23
-                    LAST_SKIP_BITS(re, &s->gb, 2);
-                    UPDATE_CACHE(re, &s->gb);
-#else
                     SKIP_BITS(re, &s->gb, 2);
-#endif
                     GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
                     i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing
                     level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
@@ -1816,12 +1811,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                 }
             } else {
                 /* first escape */
-#if MIN_CACHE_BITS < 22
-                LAST_SKIP_BITS(re, &s->gb, 1);
-                UPDATE_CACHE(re, &s->gb);
-#else
                 SKIP_BITS(re, &s->gb, 1);
-#endif
                 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
                 i+= run;
                 level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
@@ -1918,7 +1908,7 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
     return 0;
 }
 
-AVCodec msmpeg4v1_decoder = {
+AVCodec ff_msmpeg4v1_decoder = {
     "msmpeg4v1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSMPEG4V1,
@@ -1933,7 +1923,7 @@ AVCodec msmpeg4v1_decoder = {
     .pix_fmts= ff_pixfmt_list_420,
 };
 
-AVCodec msmpeg4v2_decoder = {
+AVCodec ff_msmpeg4v2_decoder = {
     "msmpeg4v2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSMPEG4V2,
@@ -1948,7 +1938,7 @@ AVCodec msmpeg4v2_decoder = {
     .pix_fmts= ff_pixfmt_list_420,
 };
 
-AVCodec msmpeg4v3_decoder = {
+AVCodec ff_msmpeg4v3_decoder = {
     "msmpeg4",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSMPEG4V3,
@@ -1963,7 +1953,7 @@ AVCodec msmpeg4v3_decoder = {
     .pix_fmts= ff_pixfmt_list_420,
 };
 
-AVCodec wmv1_decoder = {
+AVCodec ff_wmv1_decoder = {
     "wmv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WMV1,
diff --git a/ffmpeg-mt/libavcodec/msmpeg4.h b/ffmpeg-mt/libavcodec/msmpeg4.h
index 28372a0..0570bf9 100644
--- a/ffmpeg-mt/libavcodec/msmpeg4.h
+++ b/ffmpeg-mt/libavcodec/msmpeg4.h
@@ -2,20 +2,20 @@
  * MSMPEG4 backend for ffmpeg encoder and decoder
  * copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msmpeg4data.c b/ffmpeg-mt/libavcodec/msmpeg4data.c
index f72715d..eeb8122 100644
--- a/ffmpeg-mt/libavcodec/msmpeg4data.c
+++ b/ffmpeg-mt/libavcodec/msmpeg4data.c
@@ -5,20 +5,20 @@
  *
  * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msmpeg4data.h b/ffmpeg-mt/libavcodec/msmpeg4data.h
index 623d957..bbb802e 100644
--- a/ffmpeg-mt/libavcodec/msmpeg4data.h
+++ b/ffmpeg-mt/libavcodec/msmpeg4data.h
@@ -5,20 +5,20 @@
  *
  * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msrle.c b/ffmpeg-mt/libavcodec/msrle.c
index 28eb5d3..a400589 100644
--- a/ffmpeg-mt/libavcodec/msrle.c
+++ b/ffmpeg-mt/libavcodec/msrle.c
@@ -2,20 +2,20 @@
  * Micrsoft RLE Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -143,7 +143,7 @@ static av_cold int msrle_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec msrle_decoder = {
+AVCodec ff_msrle_decoder = {
     "msrle",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSRLE,
diff --git a/ffmpeg-mt/libavcodec/msrledec.c b/ffmpeg-mt/libavcodec/msrledec.c
index 9751083..46cd50d 100644
--- a/ffmpeg-mt/libavcodec/msrledec.c
+++ b/ffmpeg-mt/libavcodec/msrledec.c
@@ -2,20 +2,20 @@
  * Microsoft RLE decoder
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msrledec.h b/ffmpeg-mt/libavcodec/msrledec.h
index 2230162..5bde35a 100644
--- a/ffmpeg-mt/libavcodec/msrledec.h
+++ b/ffmpeg-mt/libavcodec/msrledec.h
@@ -2,20 +2,20 @@
  * Microsoft RLE decoder
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/msvideo1.c b/ffmpeg-mt/libavcodec/msvideo1.c
index 30aca39..e01ddf5 100644
--- a/ffmpeg-mt/libavcodec/msvideo1.c
+++ b/ffmpeg-mt/libavcodec/msvideo1.c
@@ -2,20 +2,20 @@
  * Microsoft Video-1 Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -331,7 +331,7 @@ static av_cold int msvideo1_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec msvideo1_decoder = {
+AVCodec ff_msvideo1_decoder = {
     "msvideo1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_MSVIDEO1,
diff --git a/ffmpeg-mt/libavcodec/mxpegdec.c b/ffmpeg-mt/libavcodec/mxpegdec.c
new file mode 100644
index 0000000..7d6f759
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/mxpegdec.c
@@ -0,0 +1,340 @@
+/*
+ * MxPEG decoder
+ * Copyright (c) 2011 Anatoly Nenashev
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+/**
+ * @file
+ * MxPEG decoder
+ */
+
+#include "mjpeg.h"
+#include "mjpegdec.h"
+
+typedef struct MXpegDecodeContext {
+    MJpegDecodeContext jpg;
+    AVFrame picture[2]; /* pictures array */
+    int picture_index; /* index of current picture */
+    int got_sof_data; /* true if SOF data successfully parsed */
+    int got_mxm_bitmask; /* true if MXM bitmask available */
+    uint8_t *mxm_bitmask; /* bitmask buffer */
+    unsigned bitmask_size; /* size of bitmask */
+    int has_complete_frame; /* true if has complete frame */
+    uint8_t *completion_bitmask; /* completion bitmask of macroblocks */
+    unsigned mb_width, mb_height; /* size of picture in MB's from MXM header */
+} MXpegDecodeContext;
+
+static av_cold int mxpeg_decode_init(AVCodecContext *avctx)
+{
+    MXpegDecodeContext *s = avctx->priv_data;
+
+    s->picture[0].reference = s->picture[1].reference = 3;
+    s->jpg.picture_ptr      = &s->picture[0];
+    ff_mjpeg_decode_init(avctx);
+
+    return 0;
+}
+
+static int mxpeg_decode_app(MXpegDecodeContext *s,
+                            const uint8_t *buf_ptr, int buf_size)
+{
+    int len;
+    if (buf_size < 2)
+        return 0;
+    len = AV_RB16(buf_ptr);
+    skip_bits(&s->jpg.gb, 8*FFMIN(len,buf_size));
+
+    return 0;
+}
+
+static int mxpeg_decode_mxm(MXpegDecodeContext *s,
+                            const uint8_t *buf_ptr, int buf_size)
+{
+    unsigned bitmask_size, mb_count;
+    int i;
+
+    s->mb_width  = AV_RL16(buf_ptr+4);
+    s->mb_height = AV_RL16(buf_ptr+6);
+    mb_count = s->mb_width * s->mb_height;
+
+    bitmask_size = (mb_count + 7) >> 3;
+    if (bitmask_size > buf_size - 12) {
+        av_log(s->jpg.avctx, AV_LOG_ERROR,
+               "MXM bitmask is not complete\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (s->bitmask_size != bitmask_size) {
+        av_freep(&s->mxm_bitmask);
+        s->mxm_bitmask = av_malloc(bitmask_size);
+        if (!s->mxm_bitmask) {
+            av_log(s->jpg.avctx, AV_LOG_ERROR,
+                   "MXM bitmask memory allocation error\n");
+            return AVERROR(ENOMEM);
+        }
+
+        av_freep(&s->completion_bitmask);
+        s->completion_bitmask = av_mallocz(bitmask_size);
+        if (!s->completion_bitmask) {
+            av_log(s->jpg.avctx, AV_LOG_ERROR,
+                   "Completion bitmask memory allocation error\n");
+            return AVERROR(ENOMEM);
+        }
+
+        s->bitmask_size = bitmask_size;
+    }
+
+    memcpy(s->mxm_bitmask, buf_ptr + 12, bitmask_size);
+    s->got_mxm_bitmask = 1;
+
+    if (!s->has_complete_frame) {
+        uint8_t completion_check = 0xFF;
+        for (i = 0; i < bitmask_size; ++i) {
+            s->completion_bitmask[i] |= s->mxm_bitmask[i];
+            completion_check &= s->completion_bitmask[i];
+        }
+        s->has_complete_frame = !(completion_check ^ 0xFF);
+    }
+
+    return 0;
+}
+
+static int mxpeg_decode_com(MXpegDecodeContext *s,
+                            const uint8_t *buf_ptr, int buf_size)
+{
+    int len, ret = 0;
+    if (buf_size < 2)
+        return 0;
+    len = AV_RB16(buf_ptr);
+    if (len > 14 && len <= buf_size && !strncmp(buf_ptr + 2, "MXM", 3)) {
+        ret = mxpeg_decode_mxm(s, buf_ptr + 2, len - 2);
+    }
+    skip_bits(&s->jpg.gb, 8*FFMIN(len,buf_size));
+
+    return ret;
+}
+
+static int mxpeg_check_dimensions(MXpegDecodeContext *s, MJpegDecodeContext *jpg,
+                                  AVFrame *reference_ptr)
+{
+    if ((jpg->width + 0x0F)>>4 != s->mb_width ||
+        (jpg->height + 0x0F)>>4 != s->mb_height) {
+        av_log(jpg->avctx, AV_LOG_ERROR,
+               "Picture dimensions stored in SOF and MXM mismatch\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (reference_ptr->data[0]) {
+        int i;
+        for (i = 0; i < MAX_COMPONENTS; ++i) {
+            if ( (!reference_ptr->data[i] ^ !jpg->picture_ptr->data[i]) ||
+                 reference_ptr->linesize[i] != jpg->picture_ptr->linesize[i]) {
+                av_log(jpg->avctx, AV_LOG_ERROR,
+                       "Dimensions of current and reference picture mismatch\n");
+                return AVERROR(EINVAL);
+            }
+        }
+    }
+
+    return 0;
+}
+
+static int mxpeg_decode_frame(AVCodecContext *avctx,
+                          void *data, int *data_size,
+                          AVPacket *avpkt)
+{
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
+    MXpegDecodeContext *s = avctx->priv_data;
+    MJpegDecodeContext *jpg = &s->jpg;
+    const uint8_t *buf_end, *buf_ptr;
+    const uint8_t *unescaped_buf_ptr;
+    int unescaped_buf_size;
+    int start_code;
+    AVFrame *picture = data;
+    int ret;
+
+    buf_ptr = buf;
+    buf_end = buf + buf_size;
+    jpg->got_picture = 0;
+    s->got_mxm_bitmask = 0;
+    while (buf_ptr < buf_end) {
+        start_code = ff_mjpeg_find_marker(jpg, &buf_ptr, buf_end,
+                                          &unescaped_buf_ptr, &unescaped_buf_size);
+        if (start_code < 0)
+            goto the_end;
+        {
+            init_get_bits(&jpg->gb, unescaped_buf_ptr, unescaped_buf_size*8);
+
+            if (start_code >= APP0 && start_code <= APP15) {
+                mxpeg_decode_app(s, unescaped_buf_ptr, unescaped_buf_size);
+            }
+
+            switch (start_code) {
+            case SOI:
+                if (jpg->got_picture) //emulating EOI
+                    goto the_end;
+                break;
+            case EOI:
+                goto the_end;
+            case DQT:
+                ret = ff_mjpeg_decode_dqt(jpg);
+                if (ret < 0) {
+                    av_log(avctx, AV_LOG_ERROR,
+                           "quantization table decode error\n");
+                    return ret;
+                }
+                break;
+            case DHT:
+                ret = ff_mjpeg_decode_dht(jpg);
+                if (ret < 0) {
+                    av_log(avctx, AV_LOG_ERROR,
+                           "huffman table decode error\n");
+                    return ret;
+                }
+                break;
+            case COM:
+                ret = mxpeg_decode_com(s, unescaped_buf_ptr,
+                                       unescaped_buf_size);
+                if (ret < 0)
+                    return ret;
+                break;
+            case SOF0:
+                s->got_sof_data = 0;
+                ret = ff_mjpeg_decode_sof(jpg);
+                if (ret < 0) {
+                    av_log(avctx, AV_LOG_ERROR,
+                           "SOF data decode error\n");
+                    return ret;
+                }
+                if (jpg->interlaced) {
+                    av_log(avctx, AV_LOG_ERROR,
+                           "Interlaced mode not supported in MxPEG\n");
+                    return AVERROR(EINVAL);
+                }
+                s->got_sof_data = 1;
+                break;
+            case SOS:
+                if (!s->got_sof_data) {
+                    av_log(avctx, AV_LOG_WARNING,
+                           "Can not process SOS without SOF data, skipping\n");
+                    break;
+                }
+                if (!jpg->got_picture) {
+                    if (jpg->first_picture) {
+                        av_log(avctx, AV_LOG_WARNING,
+                               "First picture has no SOF, skipping\n");
+                        break;
+                    }
+                    if (!s->got_mxm_bitmask){
+                        av_log(avctx, AV_LOG_WARNING,
+                               "Non-key frame has no MXM, skipping\n");
+                        break;
+                    }
+                    /* use stored SOF data to allocate current picture */
+                    if (jpg->picture_ptr->data[0])
+                        avctx->release_buffer(avctx, jpg->picture_ptr);
+                    if (avctx->get_buffer(avctx, jpg->picture_ptr) < 0) {
+                        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+                        return AVERROR(ENOMEM);
+                    }
+                    jpg->picture_ptr->pict_type = FF_P_TYPE;
+                    jpg->picture_ptr->key_frame = 0;
+                    jpg->got_picture = 1;
+                } else {
+                    jpg->picture_ptr->pict_type = FF_I_TYPE;
+                    jpg->picture_ptr->key_frame = 1;
+                }
+
+                if (s->got_mxm_bitmask) {
+                    AVFrame *reference_ptr = &s->picture[s->picture_index ^ 1];
+                    if (mxpeg_check_dimensions(s, jpg, reference_ptr) < 0)
+                        break;
+
+                    /* allocate dummy reference picture if needed */
+                    if (!reference_ptr->data[0] &&
+                        avctx->get_buffer(avctx, reference_ptr) < 0) {
+                        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+                        return AVERROR(ENOMEM);
+                    }
+
+                    ff_mjpeg_decode_sos(jpg, s->mxm_bitmask, reference_ptr);
+                } else {
+                    ff_mjpeg_decode_sos(jpg, NULL, NULL);
+                }
+
+                break;
+            }
+
+            buf_ptr += (get_bits_count(&jpg->gb)+7) >> 3;
+        }
+
+    }
+
+the_end:
+    if (jpg->got_picture) {
+        *data_size = sizeof(AVFrame);
+        *picture = *jpg->picture_ptr;
+        s->picture_index ^= 1;
+        jpg->picture_ptr = &s->picture[s->picture_index];
+
+        if (!s->has_complete_frame) {
+            if (!s->got_mxm_bitmask)
+                s->has_complete_frame = 1;
+            else
+                *data_size = 0;
+        }
+    }
+
+    return buf_ptr - buf;
+}
+
+static av_cold int mxpeg_decode_end(AVCodecContext *avctx)
+{
+    MXpegDecodeContext *s = avctx->priv_data;
+    MJpegDecodeContext *jpg = &s->jpg;
+    int i;
+
+    jpg->picture_ptr = NULL;
+    ff_mjpeg_decode_end(avctx);
+
+    for (i = 0; i < 2; ++i) {
+        if (s->picture[i].data[0])
+            avctx->release_buffer(avctx, &s->picture[i]);
+    }
+
+    av_freep(&s->mxm_bitmask);
+    av_freep(&s->completion_bitmask);
+
+    return 0;
+}
+
+AVCodec ff_mxpeg_decoder = {
+    .name           = "mxpeg",
+    .long_name      = NULL_IF_CONFIG_SMALL("Mobotix MxPEG video"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_MXPEG,
+    .priv_data_size = sizeof(MXpegDecodeContext),
+    .init           = mxpeg_decode_init,
+    .close          = mxpeg_decode_end,
+    .decode         = mxpeg_decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
+    .max_lowres     = 3
+};
diff --git a/ffmpeg-mt/libavcodec/nellymoserdec.c b/ffmpeg-mt/libavcodec/nellymoserdec.c
index c2cbe95..5ad49ab 100644
--- a/ffmpeg-mt/libavcodec/nellymoserdec.c
+++ b/ffmpeg-mt/libavcodec/nellymoserdec.c
@@ -34,10 +34,12 @@
 #include "nellymoser.h"
 #include "libavutil/lfg.h"
 #include "libavutil/random_seed.h"
-#include "libavcore/audioconvert.h"
+#include "libavutil/audioconvert.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "fmtconvert.h"
+#include "sinewin.h"
 
 #define ALT_BITSTREAM_READER_LE
 #include "get_bits.h"
@@ -49,10 +51,10 @@ typedef struct NellyMoserDecodeContext {
     float           state[128];
     AVLFG           random_state;
     GetBitContext   gb;
-    int             add_bias;
     float           scale_bias;
     DSPContext      dsp;
     FFTContext      imdct_ctx;
+    FmtConvertContext fmt_conv;
     DECLARE_ALIGNED(16, float,imdct_out)[NELLY_BUF_LEN * 2];
 } NellyMoserDecodeContext;
 
@@ -65,7 +67,7 @@ static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float *
 
     while (bot < NELLY_BUF_LEN) {
         audio[bot] = a_in [bot]*ff_sine_128[bot]
-                    +state[bot]*ff_sine_128[top] + s->add_bias;
+                    +state[bot]*ff_sine_128[top];
 
         bot++;
         top--;
@@ -120,7 +122,7 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
         memset(&aptr[NELLY_FILL_LEN], 0,
                (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));
 
-        ff_imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
+        s->imdct_ctx.imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
         /* XXX: overlapping and windowing should be part of a more
            generic imdct function */
         overlap_and_window(s, s->state, aptr, s->imdct_out);
@@ -135,14 +137,9 @@ static av_cold int decode_init(AVCodecContext * avctx) {
     ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0);
 
     dsputil_init(&s->dsp, avctx);
+    ff_fmt_convert_init(&s->fmt_conv, avctx);
 
-    if(s->dsp.float_to_int16 == ff_float_to_int16_c) {
-        s->add_bias = 385;
-        s->scale_bias = 1.0/(8*32768);
-    } else {
-        s->add_bias = 0;
-        s->scale_bias = 1.0/(1*8);
-    }
+    s->scale_bias = 1.0/(1*8);
 
     /* Generate overlap window */
     if (!ff_sine_128[127])
@@ -182,7 +179,7 @@ static int decode_tag(AVCodecContext * avctx,
 
     for (i=0 ; i<blocks ; i++) {
         nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf);
-        s->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES);
+        s->fmt_conv.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES);
         *data_size += NELLY_SAMPLES*sizeof(int16_t);
     }
 
@@ -196,7 +193,7 @@ static av_cold int decode_end(AVCodecContext * avctx) {
     return 0;
 }
 
-AVCodec nellymoser_decoder = {
+AVCodec ff_nellymoser_decoder = {
     "nellymoser",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_NELLYMOSER,
diff --git a/ffmpeg-mt/libavcodec/nellymoserenc.c b/ffmpeg-mt/libavcodec/nellymoserenc.c
index b3f6aa3..586443d 100644
--- a/ffmpeg-mt/libavcodec/nellymoserenc.c
+++ b/ffmpeg-mt/libavcodec/nellymoserenc.c
@@ -4,20 +4,20 @@
  *
  * Copyright (c) 2008 Bartlomiej Wolowiec
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,6 +39,7 @@
 #include "avcodec.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "sinewin.h"
 
 #define BITSTREAM_WRITER_LE
 #include "put_bits.h"
@@ -113,16 +114,16 @@ static const uint8_t quant_lut_offset[8] = { 0, 0, 1, 4, 11, 32, 81, 230 };
 
 static void apply_mdct(NellyMoserEncodeContext *s)
 {
-    memcpy(s->in_buff, s->buf[s->bufsel], NELLY_BUF_LEN * sizeof(float));
-    s->dsp.vector_fmul(s->in_buff, ff_sine_128, NELLY_BUF_LEN);
+    s->dsp.vector_fmul(s->in_buff, s->buf[s->bufsel], ff_sine_128, NELLY_BUF_LEN);
     s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128,
                                NELLY_BUF_LEN);
-    ff_mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
+    s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
 
-    s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128, NELLY_BUF_LEN);
+    s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN,
+                       ff_sine_128, NELLY_BUF_LEN);
     s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128,
                                NELLY_BUF_LEN);
-    ff_mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
+    s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
 }
 
 static av_cold int encode_init(AVCodecContext *avctx)
@@ -382,7 +383,7 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, voi
     return 0;
 }
 
-AVCodec nellymoser_encoder = {
+AVCodec ff_nellymoser_encoder = {
     .name = "nellymoser",
     .type = AVMEDIA_TYPE_AUDIO,
     .id = CODEC_ID_NELLYMOSER,
diff --git a/ffmpeg-mt/libavcodec/noise_bsf.c b/ffmpeg-mt/libavcodec/noise_bsf.c
index c49dd1f..489e3c7 100644
--- a/ffmpeg-mt/libavcodec/noise_bsf.c
+++ b/ffmpeg-mt/libavcodec/noise_bsf.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,7 +39,7 @@ static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const ch
     return 1;
 }
 
-AVBitStreamFilter noise_bsf={
+AVBitStreamFilter ff_noise_bsf={
     "noise",
     sizeof(int),
     noise,
diff --git a/ffmpeg-mt/libavcodec/nuv.c b/ffmpeg-mt/libavcodec/nuv.c
index 26dcfd0..61e2800 100644
--- a/ffmpeg-mt/libavcodec/nuv.c
+++ b/ffmpeg-mt/libavcodec/nuv.c
@@ -2,20 +2,20 @@
  * NuppelVideo decoder
  * Copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <stdio.h>
@@ -23,7 +23,7 @@
 
 #include "libavutil/bswap.h"
 #include "libavutil/lzo.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "rtjpeg.h"
@@ -116,8 +116,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
             return 0;
         avctx->width = c->width = width;
         avctx->height = c->height = height;
-        c->decomp_size = c->height * c->width * 3 / 2;
-        c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING);
+        av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2);
         if (!c->decomp_buf) {
             av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
             return 0;
@@ -273,7 +272,7 @@ static av_cold int decode_end(AVCodecContext *avctx) {
     return 0;
 }
 
-AVCodec nuv_decoder = {
+AVCodec ff_nuv_decoder = {
     "nuv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_NUV,
diff --git a/ffmpeg-mt/libavcodec/opt.c b/ffmpeg-mt/libavcodec/opt.c
index ffa422e..f41fae0 100644
--- a/ffmpeg-mt/libavcodec/opt.c
+++ b/ffmpeg-mt/libavcodec/opt.c
@@ -2,20 +2,20 @@
  * AVOptions ABI compatibility wrapper
  * Copyright (c) 2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/opt.h b/ffmpeg-mt/libavcodec/opt.h
index 9514759..cf54354 100644
--- a/ffmpeg-mt/libavcodec/opt.h
+++ b/ffmpeg-mt/libavcodec/opt.h
@@ -2,20 +2,20 @@
  * AVOptions
  * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/options.c b/ffmpeg-mt/libavcodec/options.c
index a630897..5856f96 100644
--- a/ffmpeg-mt/libavcodec/options.c
+++ b/ffmpeg-mt/libavcodec/options.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -105,7 +105,9 @@ static const AVOption options[]={
 {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
 {"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX},
 {"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E},
+#if FF_API_RATE_EMU
 {"rate_emu", "frame rate emulation", OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
+#endif
 {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
 {"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
 {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E},
@@ -117,15 +119,17 @@ static const AVOption options[]={
 {"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
 {"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, 0.5, -FLT_MAX, FLT_MAX, V|E},
 {"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, 0.5, 0, FLT_MAX, V|E},
-{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 0, 63, V|E},
-{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 0, 63, V|E},
+{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 0, 69, V|E},
+{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 0, 69, V|E},
 {"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), FF_OPT_TYPE_INT, 3, INT_MIN, INT_MAX, V|E},
 {"bf", "use 'frames' B frames", OFFSET(max_b_frames), FF_OPT_TYPE_INT, DEFAULT, 0, FF_MAX_B_FRAMES, V|E},
 {"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, 1.25, -FLT_MAX, FLT_MAX, V|E},
 {"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
 {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
 {"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
-{"hurry_up", NULL, OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
+#if FF_API_HURRY_UP
+{"hurry_up", "deprecated, use skip_idct/skip_frame instead", OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
+#endif
 {"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
 {"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
 {"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
@@ -255,8 +259,10 @@ static const AVOption options[]={
 {"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
 {"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
 {"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"},
+#if FF_API_MB_Q
 {"mb_qmin", "obsolete, use qmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
 {"mb_qmax", "obsolete, use qmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
+#endif
 {"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
 {"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
 {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
@@ -313,7 +319,9 @@ static const AVOption options[]={
 {"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
 {"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE, 0, UINT_MAX, V|A|E|D, "flags2"},
 {"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
+#if FF_API_ANTIALIAS_ALGO
 {"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"},
+#endif
 {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_AUTO, INT_MIN, INT_MAX, V|D, "aa"},
 {"fastint", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FASTINT, INT_MIN, INT_MAX, V|D, "aa"},
 {"int", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_INT, INT_MIN, INT_MAX, V|D, "aa"},
@@ -400,7 +408,9 @@ static const AVOption options[]={
 {"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT64, 0, 0, INT64_MAX, V|E},
 {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"},
 {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
+#if FF_API_REQUEST_CHANNELS
 {"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|D},
+#endif
 {"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, 1.0, 0.0, 1.0, A|D},
 {"reservoir", "use bit reservoir", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BIT_RESERVOIR, INT_MIN, INT_MAX, A|E, "flags2"},
 {"mbtree", "use macroblock tree ratecontrol (x264 only)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MBTREE, INT_MIN, INT_MAX, V|E, "flags2"},
@@ -435,6 +445,17 @@ static const AVOption options[]={
 {"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_INT, FF_THREAD_SLICE|FF_THREAD_FRAME, 0, INT_MAX, V|E|D, "thread_type"},
 {"slice", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_SLICE, INT_MIN, INT_MAX, V|E|D, "thread_type"},
 {"frame", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_FRAME, INT_MIN, INT_MAX, V|E|D, "thread_type"},
+{"vbv_delay", "initial buffer fill time in periods of 27Mhz clock", 0, FF_OPT_TYPE_INT64, 0, 0, INT64_MAX},
+{"audio_service_type", "audio service type", OFFSET(audio_service_type), FF_OPT_TYPE_INT, AV_AUDIO_SERVICE_TYPE_MAIN, 0, AV_AUDIO_SERVICE_TYPE_NB-1, A|E, "audio_service_type"},
+{"ma", "Main Audio Service", 0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_MAIN,              INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"ef", "Effects",            0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_EFFECTS,           INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"vi", "Visually Impaired",  0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"hi", "Hearing Impaired",   0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED,  INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"di", "Dialogue",           0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_DIALOGUE,          INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"co", "Commentary",         0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_COMMENTARY,        INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"em", "Emergency",          0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_EMERGENCY,         INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"vo", "Voice Over",         0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_VOICE_OVER,        INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"ka", "Karaoke",            0, FF_OPT_TYPE_CONST, AV_AUDIO_SERVICE_TYPE_KARAOKE,           INT_MIN, INT_MAX, A|E, "audio_service_type"},
 {NULL},
 };
 
diff --git a/ffmpeg-mt/libavcodec/pamenc.c b/ffmpeg-mt/libavcodec/pamenc.c
index ae0ea3a..8225a62 100644
--- a/ffmpeg-mt/libavcodec/pamenc.c
+++ b/ffmpeg-mt/libavcodec/pamenc.c
@@ -2,20 +2,20 @@
  * PAM image format
  * Copyright (c) 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -108,7 +108,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
 }
 
 
-AVCodec pam_encoder = {
+AVCodec ff_pam_encoder = {
     "pam",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PAM,
diff --git a/ffmpeg-mt/libavcodec/parser.c b/ffmpeg-mt/libavcodec/parser.c
index d877f5d..3ba3e9c 100644
--- a/ffmpeg-mt/libavcodec/parser.c
+++ b/ffmpeg-mt/libavcodec/parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -105,6 +105,7 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){
     }
 }
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
 /**
  *
  * @param buf           input
@@ -139,6 +140,7 @@ int av_parser_parse(AVCodecParserContext *s,
 {
     return av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE);
 }
+#endif
 
 int av_parser_parse2(AVCodecParserContext *s,
                      AVCodecContext *avctx,
diff --git a/ffmpeg-mt/libavcodec/parser.h b/ffmpeg-mt/libavcodec/parser.h
index 6712bfe..1e85ae4 100644
--- a/ffmpeg-mt/libavcodec/parser.h
+++ b/ffmpeg-mt/libavcodec/parser.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/pcm-mpeg.c b/ffmpeg-mt/libavcodec/pcm-mpeg.c
index cf2792b..a55d48c 100644
--- a/ffmpeg-mt/libavcodec/pcm-mpeg.c
+++ b/ffmpeg-mt/libavcodec/pcm-mpeg.c
@@ -2,20 +2,20 @@
  * LPCM codecs for PCM formats found in MPEG streams
  * Copyright (c) 2009 Christian Schmidt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,7 +24,7 @@
  * PCM codecs for encodings found in MPEG streams (DVD/Blu-ray)
  */
 
-#include "libavcore/audioconvert.h"
+#include "libavutil/audioconvert.h"
 #include "avcodec.h"
 #include "bytestream.h"
 
@@ -64,7 +64,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
     uint8_t channel_layout = header[2] >> 4;
 
     if (avctx->debug & FF_DEBUG_PICT_INFO)
-        dprintf(avctx, "pcm_bluray_parse_header: header = %02x%02x%02x%02x\n",
+        av_dlog(avctx, "pcm_bluray_parse_header: header = %02x%02x%02x%02x\n",
                 header[0], header[1], header[2], header[3]);
 
     /* get the sample depth and derive the sample format from it */
@@ -112,7 +112,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
                       avctx->bits_per_coded_sample;
 
     if (avctx->debug & FF_DEBUG_PICT_INFO)
-        dprintf(avctx,
+        av_dlog(avctx,
                 "pcm_bluray_parse_header: %d channels, %d bits per sample, %d kHz, %d kbit\n",
                 avctx->channels, avctx->bits_per_coded_sample,
                 avctx->sample_rate, avctx->bit_rate);
@@ -291,12 +291,12 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
 
     retval = src - avpkt->data;
     if (avctx->debug & FF_DEBUG_BITSTREAM)
-        dprintf(avctx, "pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
+        av_dlog(avctx, "pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
                 retval, *data_size);
     return retval;
 }
 
-AVCodec pcm_bluray_decoder = {
+AVCodec ff_pcm_bluray_decoder = {
     "pcm_bluray",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_PCM_BLURAY,
diff --git a/ffmpeg-mt/libavcodec/pcm.c b/ffmpeg-mt/libavcodec/pcm.c
index 533e834..e2a7334 100644
--- a/ffmpeg-mt/libavcodec/pcm.c
+++ b/ffmpeg-mt/libavcodec/pcm.c
@@ -2,20 +2,20 @@
  * PCM codecs
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -473,7 +473,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
 
 #if CONFIG_ENCODERS
 #define PCM_ENCODER(id_,sample_fmt_,name_,long_name_) \
-AVCodec name_ ## _encoder = {                   \
+AVCodec ff_ ## name_ ## _encoder = {            \
     .name        = #name_,                      \
     .type        = AVMEDIA_TYPE_AUDIO,          \
     .id          = id_,                         \
@@ -482,14 +482,14 @@ AVCodec name_ ## _encoder = {                   \
     .close       = pcm_encode_close,            \
     .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
 #else
 #define PCM_ENCODER(id,sample_fmt_,name,long_name_)
 #endif
 
 #if CONFIG_DECODERS
 #define PCM_DECODER(id_,sample_fmt_,name_,long_name_)         \
-AVCodec name_ ## _decoder = {                   \
+AVCodec ff_ ## name_ ## _decoder = {            \
     .name           = #name_,                   \
     .type           = AVMEDIA_TYPE_AUDIO,       \
     .id             = id_,                      \
@@ -498,17 +498,17 @@ AVCodec name_ ## _decoder = {                   \
     .decode         = pcm_decode_frame,         \
     .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
+}
 #else
 #define PCM_DECODER(id,sample_fmt_,name,long_name_)
 #endif
 
 #define PCM_CODEC(id, sample_fmt_, name, long_name_)         \
-    PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_)
+    PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_)
 
 /* Note: Do not forget to add new entries to the Makefile as well. */
 PCM_CODEC  (CODEC_ID_PCM_ALAW,  AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
-PCM_CODEC  (CODEC_ID_PCM_DVD,   AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
+PCM_DECODER(CODEC_ID_PCM_DVD,   AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
 PCM_CODEC  (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
 PCM_CODEC  (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
 PCM_CODEC  (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
diff --git a/ffmpeg-mt/libavcodec/pcm_tablegen.c b/ffmpeg-mt/libavcodec/pcm_tablegen.c
index b0fde93..8a9bcb6 100644
--- a/ffmpeg-mt/libavcodec/pcm_tablegen.c
+++ b/ffmpeg-mt/libavcodec/pcm_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/pcm_tablegen.h b/ffmpeg-mt/libavcodec/pcm_tablegen.h
index 3d641b0..838052e 100644
--- a/ffmpeg-mt/libavcodec/pcm_tablegen.h
+++ b/ffmpeg-mt/libavcodec/pcm_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/pcx.c b/ffmpeg-mt/libavcodec/pcx.c
index c1b67cd..fc0093f 100644
--- a/ffmpeg-mt/libavcodec/pcx.c
+++ b/ffmpeg-mt/libavcodec/pcx.c
@@ -5,24 +5,24 @@
  * This decoder does not support CGA palettes. I am unable to find samples
  * and Netpbm cannot generate them.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "get_bits.h"
@@ -247,7 +247,7 @@ static av_cold int pcx_end(AVCodecContext *avctx) {
     return 0;
 }
 
-AVCodec pcx_decoder = {
+AVCodec ff_pcx_decoder = {
     "pcx",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PCX,
diff --git a/ffmpeg-mt/libavcodec/pcxenc.c b/ffmpeg-mt/libavcodec/pcxenc.c
index e01727f..2f2ae69 100644
--- a/ffmpeg-mt/libavcodec/pcxenc.c
+++ b/ffmpeg-mt/libavcodec/pcxenc.c
@@ -2,20 +2,20 @@
  * PC Paintbrush PCX (.pcx) image encoder
  * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -189,7 +189,7 @@ static int pcx_encode_frame(AVCodecContext *avctx,
     return buf - buf_start;
 }
 
-AVCodec pcx_encoder = {
+AVCodec ff_pcx_encoder = {
     "pcx",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PCX,
diff --git a/ffmpeg-mt/libavcodec/pgssubdec.c b/ffmpeg-mt/libavcodec/pgssubdec.c
index 9ee1ded..ea53e55 100644
--- a/ffmpeg-mt/libavcodec/pgssubdec.c
+++ b/ffmpeg-mt/libavcodec/pgssubdec.c
@@ -2,20 +2,20 @@
  * PGS subtitle decoder
  * Copyright (c) 2009 Stephen Backway
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,7 +28,7 @@
 #include "dsputil.h"
 #include "bytestream.h"
 #include "libavutil/colorspace.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 //#define DEBUG_PACKET_CONTENTS
 
@@ -141,7 +141,7 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
         return -1;
     }
 
-    dprintf(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h);
+    av_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h);
 
     return 0;
 }
@@ -253,7 +253,7 @@ static void parse_palette_segment(AVCodecContext *avctx,
         YUV_TO_RGB1(cb, cr);
         YUV_TO_RGB2(r, g, b, y);
 
-        dprintf(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
+        av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
 
         /* Store color in palette */
         ctx->clut[color_id] = RGBA(r,g,b,alpha);
@@ -282,7 +282,7 @@ static void parse_presentation_segment(AVCodecContext *avctx,
     int w = bytestream_get_be16(&buf);
     int h = bytestream_get_be16(&buf);
 
-    dprintf(avctx, "Video Dimensions %dx%d\n",
+    av_dlog(avctx, "Video Dimensions %dx%d\n",
             w, h);
     if (av_image_check_size(w, h, 0, avctx) >= 0)
         avcodec_set_dimensions(avctx, w, h);
@@ -317,7 +317,7 @@ static void parse_presentation_segment(AVCodecContext *avctx,
 
     /* TODO If cropping, cropping_x, cropping_y, cropping_width, cropping_height (all 2 bytes).*/
 
-    dprintf(avctx, "Subtitle Placement x=%d, y=%d\n", x, y);
+    av_dlog(avctx, "Subtitle Placement x=%d, y=%d\n", x, y);
 
     if (x > avctx->width || y > avctx->height) {
         av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n",
@@ -433,7 +433,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
         segment_type   = bytestream_get_byte(&buf);
         segment_length = bytestream_get_be16(&buf);
 
-        dprintf(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type);
+        av_dlog(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type);
 
         if (segment_type != DISPLAY_SEGMENT && segment_length > buf_end - buf)
             break;
@@ -473,7 +473,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
     return buf_size;
 }
 
-AVCodec pgssub_decoder = {
+AVCodec ff_pgssub_decoder = {
     "pgssub",
     AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_HDMV_PGS_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/pictordec.c b/ffmpeg-mt/libavcodec/pictordec.c
index 04667f6..74a49c8 100644
--- a/ffmpeg-mt/libavcodec/pictordec.c
+++ b/ffmpeg-mt/libavcodec/pictordec.c
@@ -2,20 +2,20 @@
  * Pictor/PC Paint decoder
  * Copyright (c) 2010 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,7 +24,7 @@
  * Pictor/PC Paint decoder
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "cga_data.h"
@@ -237,7 +237,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec pictor_decoder = {
+AVCodec ff_pictor_decoder = {
     "pictor",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PICTOR,
diff --git a/ffmpeg-mt/libavcodec/png.c b/ffmpeg-mt/libavcodec/png.c
index 534dc68..70a080e 100644
--- a/ffmpeg-mt/libavcodec/png.c
+++ b/ffmpeg-mt/libavcodec/png.c
@@ -2,20 +2,20 @@
  * PNG image format
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -31,12 +31,12 @@ const uint8_t ff_png_pass_ymask[NB_PASSES] = {
 };
 
 /* minimum x value */
-const uint8_t ff_png_pass_xmin[NB_PASSES] = {
+static const uint8_t ff_png_pass_xmin[NB_PASSES] = {
     0, 4, 0, 2, 0, 1, 0
 };
 
 /* x shift to get row width */
-const uint8_t ff_png_pass_xshift[NB_PASSES] = {
+static const uint8_t ff_png_pass_xshift[NB_PASSES] = {
     3, 3, 2, 2, 1, 1, 0
 };
 
diff --git a/ffmpeg-mt/libavcodec/png.h b/ffmpeg-mt/libavcodec/png.h
index 7c0ab9f..b8c72ee 100644
--- a/ffmpeg-mt/libavcodec/png.h
+++ b/ffmpeg-mt/libavcodec/png.h
@@ -2,20 +2,20 @@
  * PNG image format
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,12 +55,6 @@ extern const uint8_t ff_mngsig[8];
 /* Mask to determine which y pixels are valid in a pass */
 extern const uint8_t ff_png_pass_ymask[NB_PASSES];
 
-/* minimum x value */
-extern const uint8_t ff_png_pass_xmin[NB_PASSES];
-
-/* x shift to get row width */
-extern const uint8_t ff_png_pass_xshift[NB_PASSES];
-
 /* Mask to determine which pixels are valid in a pass */
 extern const uint8_t ff_png_pass_mask[NB_PASSES];
 
diff --git a/ffmpeg-mt/libavcodec/pngdec.c b/ffmpeg-mt/libavcodec/pngdec.c
index eb8989f..b1521de 100644
--- a/ffmpeg-mt/libavcodec/pngdec.c
+++ b/ffmpeg-mt/libavcodec/pngdec.c
@@ -2,23 +2,23 @@
  * PNG image format
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "png.h"
@@ -431,7 +431,7 @@ static int decode_frame(AVCodecContext *avctx,
             goto fail;
         tag32 = bytestream_get_be32(&s->bytestream);
         tag = av_bswap32(tag32);
-        dprintf(avctx, "png: tag=%c%c%c%c length=%u\n",
+        av_dlog(avctx, "png: tag=%c%c%c%c length=%u\n",
                 (tag & 0xff),
                 ((tag >> 8) & 0xff),
                 ((tag >> 16) & 0xff),
@@ -453,7 +453,7 @@ static int decode_frame(AVCodecContext *avctx,
             s->interlace_type = *s->bytestream++;
             crc = bytestream_get_be32(&s->bytestream);
             s->state |= PNG_IHDR;
-            dprintf(avctx, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n",
+            av_dlog(avctx, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n",
                     s->width, s->height, s->bit_depth, s->color_type,
                     s->compression_type, s->filter_type, s->interlace_type);
             break;
@@ -517,7 +517,7 @@ static int decode_frame(AVCodecContext *avctx,
                                                          s->width);
                     s->crow_size = s->pass_row_size + 1;
                 }
-                dprintf(avctx, "row_size=%d crow_size =%d\n",
+                av_dlog(avctx, "row_size=%d crow_size =%d\n",
                         s->row_size, s->crow_size);
                 s->image_buf = p->data[0];
                 s->image_linesize = p->linesize[0];
@@ -657,7 +657,7 @@ static av_cold int png_dec_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec png_decoder = {
+AVCodec ff_png_decoder = {
     "png",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PNG,
diff --git a/ffmpeg-mt/libavcodec/pngenc.c b/ffmpeg-mt/libavcodec/pngenc.c
index d199b95..e7b09ef 100644
--- a/ffmpeg-mt/libavcodec/pngenc.c
+++ b/ffmpeg-mt/libavcodec/pngenc.c
@@ -2,20 +2,20 @@
  * PNG image format
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
@@ -436,7 +436,7 @@ static av_cold int png_enc_init(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec png_encoder = {
+AVCodec ff_png_encoder = {
     "png",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PNG,
diff --git a/ffmpeg-mt/libavcodec/pnm.c b/ffmpeg-mt/libavcodec/pnm.c
index c104e23..54b55cf 100644
--- a/ffmpeg-mt/libavcodec/pnm.c
+++ b/ffmpeg-mt/libavcodec/pnm.c
@@ -2,24 +2,24 @@
  * PNM image format
  * Copyright (c) 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "pnm.h"
 
diff --git a/ffmpeg-mt/libavcodec/pnm.h b/ffmpeg-mt/libavcodec/pnm.h
index ac4b108..702921f 100644
--- a/ffmpeg-mt/libavcodec/pnm.h
+++ b/ffmpeg-mt/libavcodec/pnm.h
@@ -2,20 +2,20 @@
  * PNM image format
  * Copyright (c) 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/pnm_parser.c b/ffmpeg-mt/libavcodec/pnm_parser.c
index b8ba1a8..2dc2987 100644
--- a/ffmpeg-mt/libavcodec/pnm_parser.c
+++ b/ffmpeg-mt/libavcodec/pnm_parser.c
@@ -2,20 +2,20 @@
  * PNM image parser
  * Copyright (c) 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -83,7 +83,7 @@ retry:
     return next;
 }
 
-AVCodecParser pnm_parser = {
+AVCodecParser ff_pnm_parser = {
     { CODEC_ID_PGM, CODEC_ID_PGMYUV, CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PAM},
     sizeof(ParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/pnmdec.c b/ffmpeg-mt/libavcodec/pnmdec.c
index 6bea93d..663def6 100644
--- a/ffmpeg-mt/libavcodec/pnmdec.c
+++ b/ffmpeg-mt/libavcodec/pnmdec.c
@@ -2,20 +2,20 @@
  * PNM image format
  * Copyright (c) 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -188,7 +188,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
 
 
 #if CONFIG_PGM_DECODER
-AVCodec pgm_decoder = {
+AVCodec ff_pgm_decoder = {
     "pgm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PGM,
@@ -205,7 +205,7 @@ AVCodec pgm_decoder = {
 #endif
 
 #if CONFIG_PGMYUV_DECODER
-AVCodec pgmyuv_decoder = {
+AVCodec ff_pgmyuv_decoder = {
     "pgmyuv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PGMYUV,
@@ -222,7 +222,7 @@ AVCodec pgmyuv_decoder = {
 #endif
 
 #if CONFIG_PPM_DECODER
-AVCodec ppm_decoder = {
+AVCodec ff_ppm_decoder = {
     "ppm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PPM,
@@ -239,7 +239,7 @@ AVCodec ppm_decoder = {
 #endif
 
 #if CONFIG_PBM_DECODER
-AVCodec pbm_decoder = {
+AVCodec ff_pbm_decoder = {
     "pbm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PBM,
@@ -256,7 +256,7 @@ AVCodec pbm_decoder = {
 #endif
 
 #if CONFIG_PAM_DECODER
-AVCodec pam_decoder = {
+AVCodec ff_pam_decoder = {
     "pam",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PAM,
diff --git a/ffmpeg-mt/libavcodec/pnmenc.c b/ffmpeg-mt/libavcodec/pnmenc.c
index 1fbf665..a04b864 100644
--- a/ffmpeg-mt/libavcodec/pnmenc.c
+++ b/ffmpeg-mt/libavcodec/pnmenc.c
@@ -2,20 +2,20 @@
  * PNM image format
  * Copyright (c) 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -113,7 +113,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
 
 
 #if CONFIG_PGM_ENCODER
-AVCodec pgm_encoder = {
+AVCodec ff_pgm_encoder = {
     "pgm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PGM,
@@ -126,7 +126,7 @@ AVCodec pgm_encoder = {
 #endif
 
 #if CONFIG_PGMYUV_ENCODER
-AVCodec pgmyuv_encoder = {
+AVCodec ff_pgmyuv_encoder = {
     "pgmyuv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PGMYUV,
@@ -139,7 +139,7 @@ AVCodec pgmyuv_encoder = {
 #endif
 
 #if CONFIG_PPM_ENCODER
-AVCodec ppm_encoder = {
+AVCodec ff_ppm_encoder = {
     "ppm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PPM,
@@ -152,7 +152,7 @@ AVCodec ppm_encoder = {
 #endif
 
 #if CONFIG_PBM_ENCODER
-AVCodec pbm_encoder = {
+AVCodec ff_pbm_encoder = {
     "pbm",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PBM,
diff --git a/ffmpeg-mt/libavcodec/ppc/Makefile b/ffmpeg-mt/libavcodec/ppc/Makefile
index 9b2358d..35ea0c3 100644
--- a/ffmpeg-mt/libavcodec/ppc/Makefile
+++ b/ffmpeg-mt/libavcodec/ppc/Makefile
@@ -21,6 +21,7 @@ ALTIVEC-OBJS-$(CONFIG_FFT)             += ppc/fft_altivec.o             \
 OBJS-$(HAVE_ALTIVEC)                   += ppc/dsputil_altivec.o         \
                                           ppc/fdct_altivec.o            \
                                           ppc/float_altivec.o           \
+                                          ppc/fmtconvert_altivec.o      \
                                           ppc/gmc_altivec.o             \
                                           ppc/idct_altivec.o            \
                                           ppc/int_altivec.o             \
diff --git a/ffmpeg-mt/libavcodec/ppc/asm.S b/ffmpeg-mt/libavcodec/ppc/asm.S
index e372d53..5cbbf97 100644
--- a/ffmpeg-mt/libavcodec/ppc/asm.S
+++ b/ffmpeg-mt/libavcodec/ppc/asm.S
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.c b/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.c
index 1633232..9111d03 100644
--- a/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002 Dieter Shirley
  * Copyright (c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -230,7 +230,7 @@ static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
     int i;
     int s;
     const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
-    vector unsigned char perm1, perm2, *pix1v, *pix2v;
+    vector unsigned char perm1, perm2, pix1v_low, pix1v_high, pix2v_low, pix2v_high;
     vector unsigned char t1, t2, t3,t4, t5;
     vector unsigned int sad;
     vector signed int sumdiffs;
@@ -241,11 +241,13 @@ static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
     for (i = 0; i < h; i++) {
         /* Read potentially unaligned pixels into t1 and t2 */
         perm1 = vec_lvsl(0, pix1);
-        pix1v = (vector unsigned char *) pix1;
+        pix1v_high = vec_ld( 0, pix1);
+        pix1v_low  = vec_ld(15, pix1);
         perm2 = vec_lvsl(0, pix2);
-        pix2v = (vector unsigned char *) pix2;
-        t1 = vec_perm(pix1v[0], pix1v[1], perm1);
-        t2 = vec_perm(pix2v[0], pix2v[1], perm2);
+        pix2v_high = vec_ld( 0, pix2);
+        pix2v_low  = vec_ld(15, pix2);
+        t1 = vec_perm(pix1v_high, pix1v_low, perm1);
+        t2 = vec_perm(pix2v_high, pix2v_low, perm2);
 
         /* Calculate a sum of abs differences vector */
         t3 = vec_max(t1, t2);
diff --git a/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.h b/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.h
index cd44f60..abf2dd3 100644
--- a/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.h
+++ b/ffmpeg-mt/libavcodec/ppc/dsputil_altivec.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2002 Dieter Shirley
  * Copyright (c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -43,7 +43,6 @@ void ff_vp3_idct_add_altivec(uint8_t *dest, int line_size, DCTELEM *block);
 void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx);
 
 void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx);
-void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx);
 void float_init_altivec(DSPContext* c, AVCodecContext *avctx);
 void int_init_altivec(DSPContext* c, AVCodecContext *avctx);
 
diff --git a/ffmpeg-mt/libavcodec/ppc/dsputil_ppc.c b/ffmpeg-mt/libavcodec/ppc/dsputil_ppc.c
index 9e4f1aa..c52ea61 100644
--- a/ffmpeg-mt/libavcodec/ppc/dsputil_ppc.c
+++ b/ffmpeg-mt/libavcodec/ppc/dsputil_ppc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002 Dieter Shirley
  * Copyright (c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -171,8 +171,6 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
 
     if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
         dsputil_init_altivec(c, avctx);
-        if(CONFIG_VC1_DECODER)
-            vc1dsp_init_altivec(c, avctx);
         float_init_altivec(c, avctx);
         int_init_altivec(c, avctx);
         c->gmc1 = gmc1_altivec;
diff --git a/ffmpeg-mt/libavcodec/ppc/fdct_altivec.c b/ffmpeg-mt/libavcodec/ppc/fdct_altivec.c
index 6309a47..8dbfe33 100644
--- a/ffmpeg-mt/libavcodec/ppc/fdct_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/fdct_altivec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003  James Klicman <james at klicman.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/fft_altivec.c b/ffmpeg-mt/libavcodec/ppc/fft_altivec.c
index ec610b0..68f3071 100644
--- a/ffmpeg-mt/libavcodec/ppc/fft_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/fft_altivec.c
@@ -3,20 +3,20 @@
  * AltiVec-enabled
  * Copyright (c) 2009 Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "libavcodec/fft.h"
diff --git a/ffmpeg-mt/libavcodec/ppc/fft_altivec_s.S b/ffmpeg-mt/libavcodec/ppc/fft_altivec_s.S
index 5d3c540..ab33900 100644
--- a/ffmpeg-mt/libavcodec/ppc/fft_altivec_s.S
+++ b/ffmpeg-mt/libavcodec/ppc/fft_altivec_s.S
@@ -5,20 +5,20 @@
  * This algorithm (though not any of the implementation details) is
  * based on libdjbfft by D. J. Bernstein.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/float_altivec.c b/ffmpeg-mt/libavcodec/ppc/float_altivec.c
index d1f9f1a..e401069 100644
--- a/ffmpeg-mt/libavcodec/ppc/float_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/float_altivec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2006 Luca Barbato <lu_zero at gentoo.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,16 +23,16 @@
 #include "dsputil_altivec.h"
 #include "util_altivec.h"
 
-static void vector_fmul_altivec(float *dst, const float *src, int len)
+static void vector_fmul_altivec(float *dst, const float *src0, const float *src1, int len)
 {
     int i;
     vector float d0, d1, s, zero = (vector float)vec_splat_u32(0);
     for(i=0; i<len-7; i+=8) {
-        d0 = vec_ld(0, dst+i);
-        s = vec_ld(0, src+i);
-        d1 = vec_ld(16, dst+i);
+        d0 = vec_ld(0, src0+i);
+        s = vec_ld(0, src1+i);
+        d1 = vec_ld(16, src0+i);
         d0 = vec_madd(d0, s, zero);
-        d1 = vec_madd(d1, vec_ld(16,src+i), zero);
+        d1 = vec_madd(d1, vec_ld(16,src1+i), zero);
         vec_st(d0, 0, dst+i);
         vec_st(d1, 16, dst+i);
     }
@@ -90,13 +90,9 @@ static void vector_fmul_add_altivec(float *dst, const float *src0,
     }
 }
 
-static void vector_fmul_window_altivec(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len)
+static void vector_fmul_window_altivec(float *dst, const float *src0, const float *src1, const float *win, int len)
 {
-    union {
-        vector float v;
-        float s[4];
-    } vadd;
-    vector float vadd_bias, zero, t0, t1, s0, s1, wi, wj;
+    vector float zero, t0, t1, s0, s1, wi, wj;
     const vector unsigned char reverse = vcprm(3,2,1,0);
     int i,j;
 
@@ -104,8 +100,6 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa
     win += len;
     src0+= len;
 
-    vadd.s[0] = add_bias;
-    vadd_bias = vec_splat(vadd.v, 0);
     zero = (vector float)vec_splat_u32(0);
 
     for(i=-len*4, j=len*4-16; i<0; i+=16, j-=16) {
@@ -117,9 +111,9 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa
         s1 = vec_perm(s1, s1, reverse);
         wj = vec_perm(wj, wj, reverse);
 
-        t0 = vec_madd(s0, wj, vadd_bias);
+        t0 = vec_madd(s0, wj, zero);
         t0 = vec_nmsub(s1, wi, t0);
-        t1 = vec_madd(s0, wi, vadd_bias);
+        t1 = vec_madd(s0, wi, zero);
         t1 = vec_madd(s1, wj, t1);
         t1 = vec_perm(t1, t1, reverse);
 
@@ -128,124 +122,12 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa
     }
 }
 
-static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len)
-{
-    union {
-        vector float v;
-        float s[4];
-    } mul_u;
-    int i;
-    vector float src1, src2, dst1, dst2, mul_v, zero;
-
-    zero = (vector float)vec_splat_u32(0);
-    mul_u.s[0] = mul;
-    mul_v = vec_splat(mul_u.v, 0);
-
-    for(i=0; i<len; i+=8) {
-        src1 = vec_ctf(vec_ld(0,  src+i), 0);
-        src2 = vec_ctf(vec_ld(16, src+i), 0);
-        dst1 = vec_madd(src1, mul_v, zero);
-        dst2 = vec_madd(src2, mul_v, zero);
-        vec_st(dst1,  0, dst+i);
-        vec_st(dst2, 16, dst+i);
-    }
-}
-
-
-static vector signed short
-float_to_int16_one_altivec(const float *src)
-{
-    vector float s0 = vec_ld(0, src);
-    vector float s1 = vec_ld(16, src);
-    vector signed int t0 = vec_cts(s0, 0);
-    vector signed int t1 = vec_cts(s1, 0);
-    return vec_packs(t0,t1);
-}
-
-static void float_to_int16_altivec(int16_t *dst, const float *src, long len)
-{
-    int i;
-    vector signed short d0, d1, d;
-    vector unsigned char align;
-    if(((long)dst)&15) //FIXME
-    for(i=0; i<len-7; i+=8) {
-        d0 = vec_ld(0, dst+i);
-        d = float_to_int16_one_altivec(src+i);
-        d1 = vec_ld(15, dst+i);
-        d1 = vec_perm(d1, d0, vec_lvsl(0,dst+i));
-        align = vec_lvsr(0, dst+i);
-        d0 = vec_perm(d1, d, align);
-        d1 = vec_perm(d, d1, align);
-        vec_st(d0, 0, dst+i);
-        vec_st(d1,15, dst+i);
-    }
-    else
-    for(i=0; i<len-7; i+=8) {
-        d = float_to_int16_one_altivec(src+i);
-        vec_st(d, 0, dst+i);
-    }
-}
-
-static void
-float_to_int16_interleave_altivec(int16_t *dst, const float **src,
-                                  long len, int channels)
-{
-    int i;
-    vector signed short d0, d1, d2, c0, c1, t0, t1;
-    vector unsigned char align;
-    if(channels == 1)
-        float_to_int16_altivec(dst, src[0], len);
-    else
-        if (channels == 2) {
-        if(((long)dst)&15)
-        for(i=0; i<len-7; i+=8) {
-            d0 = vec_ld(0, dst + i);
-            t0 = float_to_int16_one_altivec(src[0] + i);
-            d1 = vec_ld(31, dst + i);
-            t1 = float_to_int16_one_altivec(src[1] + i);
-            c0 = vec_mergeh(t0, t1);
-            c1 = vec_mergel(t0, t1);
-            d2 = vec_perm(d1, d0, vec_lvsl(0, dst + i));
-            align = vec_lvsr(0, dst + i);
-            d0 = vec_perm(d2, c0, align);
-            d1 = vec_perm(c0, c1, align);
-            vec_st(d0,  0, dst + i);
-            d0 = vec_perm(c1, d2, align);
-            vec_st(d1, 15, dst + i);
-            vec_st(d0, 31, dst + i);
-            dst+=8;
-        }
-        else
-        for(i=0; i<len-7; i+=8) {
-            t0 = float_to_int16_one_altivec(src[0] + i);
-            t1 = float_to_int16_one_altivec(src[1] + i);
-            d0 = vec_mergeh(t0, t1);
-            d1 = vec_mergel(t0, t1);
-            vec_st(d0,  0, dst + i);
-            vec_st(d1, 16, dst + i);
-            dst+=8;
-        }
-    } else {
-        DECLARE_ALIGNED(16, int16_t, tmp)[len];
-        int c, j;
-        for (c = 0; c < channels; c++) {
-            float_to_int16_altivec(tmp, src[c], len);
-            for (i = 0, j = c; i < len; i++, j+=channels) {
-                dst[j] = tmp[i];
-            }
-        }
-   }
-}
-
 void float_init_altivec(DSPContext* c, AVCodecContext *avctx)
 {
     c->vector_fmul = vector_fmul_altivec;
     c->vector_fmul_reverse = vector_fmul_reverse_altivec;
     c->vector_fmul_add = vector_fmul_add_altivec;
-    c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec;
     if(!(avctx->flags & CODEC_FLAG_BITEXACT)) {
         c->vector_fmul_window = vector_fmul_window_altivec;
-        c->float_to_int16 = float_to_int16_altivec;
-        c->float_to_int16_interleave = float_to_int16_interleave_altivec;
     }
 }
diff --git a/ffmpeg-mt/libavcodec/ppc/fmtconvert_altivec.c b/ffmpeg-mt/libavcodec/ppc/fmtconvert_altivec.c
new file mode 100644
index 0000000..b1eaf9b
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/ppc/fmtconvert_altivec.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2006 Luca Barbato <lu_zero at gentoo.org>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavcodec/fmtconvert.h"
+
+#include "dsputil_altivec.h"
+#include "util_altivec.h"
+
+static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len)
+{
+    union {
+        vector float v;
+        float s[4];
+    } mul_u;
+    int i;
+    vector float src1, src2, dst1, dst2, mul_v, zero;
+
+    zero = (vector float)vec_splat_u32(0);
+    mul_u.s[0] = mul;
+    mul_v = vec_splat(mul_u.v, 0);
+
+    for(i=0; i<len; i+=8) {
+        src1 = vec_ctf(vec_ld(0,  src+i), 0);
+        src2 = vec_ctf(vec_ld(16, src+i), 0);
+        dst1 = vec_madd(src1, mul_v, zero);
+        dst2 = vec_madd(src2, mul_v, zero);
+        vec_st(dst1,  0, dst+i);
+        vec_st(dst2, 16, dst+i);
+    }
+}
+
+
+static vector signed short
+float_to_int16_one_altivec(const float *src)
+{
+    vector float s0 = vec_ld(0, src);
+    vector float s1 = vec_ld(16, src);
+    vector signed int t0 = vec_cts(s0, 0);
+    vector signed int t1 = vec_cts(s1, 0);
+    return vec_packs(t0,t1);
+}
+
+static void float_to_int16_altivec(int16_t *dst, const float *src, long len)
+{
+    int i;
+    vector signed short d0, d1, d;
+    vector unsigned char align;
+    if(((long)dst)&15) //FIXME
+    for(i=0; i<len-7; i+=8) {
+        d0 = vec_ld(0, dst+i);
+        d = float_to_int16_one_altivec(src+i);
+        d1 = vec_ld(15, dst+i);
+        d1 = vec_perm(d1, d0, vec_lvsl(0,dst+i));
+        align = vec_lvsr(0, dst+i);
+        d0 = vec_perm(d1, d, align);
+        d1 = vec_perm(d, d1, align);
+        vec_st(d0, 0, dst+i);
+        vec_st(d1,15, dst+i);
+    }
+    else
+    for(i=0; i<len-7; i+=8) {
+        d = float_to_int16_one_altivec(src+i);
+        vec_st(d, 0, dst+i);
+    }
+}
+
+static void
+float_to_int16_interleave_altivec(int16_t *dst, const float **src,
+                                  long len, int channels)
+{
+    int i;
+    vector signed short d0, d1, d2, c0, c1, t0, t1;
+    vector unsigned char align;
+    if(channels == 1)
+        float_to_int16_altivec(dst, src[0], len);
+    else
+        if (channels == 2) {
+        if(((long)dst)&15)
+        for(i=0; i<len-7; i+=8) {
+            d0 = vec_ld(0, dst + i);
+            t0 = float_to_int16_one_altivec(src[0] + i);
+            d1 = vec_ld(31, dst + i);
+            t1 = float_to_int16_one_altivec(src[1] + i);
+            c0 = vec_mergeh(t0, t1);
+            c1 = vec_mergel(t0, t1);
+            d2 = vec_perm(d1, d0, vec_lvsl(0, dst + i));
+            align = vec_lvsr(0, dst + i);
+            d0 = vec_perm(d2, c0, align);
+            d1 = vec_perm(c0, c1, align);
+            vec_st(d0,  0, dst + i);
+            d0 = vec_perm(c1, d2, align);
+            vec_st(d1, 15, dst + i);
+            vec_st(d0, 31, dst + i);
+            dst+=8;
+        }
+        else
+        for(i=0; i<len-7; i+=8) {
+            t0 = float_to_int16_one_altivec(src[0] + i);
+            t1 = float_to_int16_one_altivec(src[1] + i);
+            d0 = vec_mergeh(t0, t1);
+            d1 = vec_mergel(t0, t1);
+            vec_st(d0,  0, dst + i);
+            vec_st(d1, 16, dst + i);
+            dst+=8;
+        }
+    } else {
+        DECLARE_ALIGNED(16, int16_t, tmp)[len];
+        int c, j;
+        for (c = 0; c < channels; c++) {
+            float_to_int16_altivec(tmp, src[c], len);
+            for (i = 0, j = c; i < len; i++, j+=channels) {
+                dst[j] = tmp[i];
+            }
+        }
+   }
+}
+
+void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx)
+{
+    c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec;
+    if(!(avctx->flags & CODEC_FLAG_BITEXACT)) {
+        c->float_to_int16 = float_to_int16_altivec;
+        c->float_to_int16_interleave = float_to_int16_interleave_altivec;
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/ppc/gmc_altivec.c b/ffmpeg-mt/libavcodec/ppc/gmc_altivec.c
index 0e93c33..0ed70ab 100644
--- a/ffmpeg-mt/libavcodec/ppc/gmc_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/gmc_altivec.c
@@ -3,20 +3,20 @@
  * AltiVec-enabled
  * Copyright (c) 2003 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/h264_altivec.c b/ffmpeg-mt/libavcodec/ppc/h264_altivec.c
index aee2bc2..02699be 100644
--- a/ffmpeg-mt/libavcodec/ppc/h264_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/h264_altivec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2004 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,7 +32,6 @@
 
 #define OP_U8_ALTIVEC                          PUT_OP_U8_ALTIVEC
 #define PREFIX_h264_chroma_mc8_altivec         put_h264_chroma_mc8_altivec
-#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   put_no_rnd_vc1_chroma_mc8_altivec
 #define PREFIX_h264_chroma_mc8_num             altivec_put_h264_chroma_mc8_num
 #define PREFIX_h264_qpel16_h_lowpass_altivec   put_h264_qpel16_h_lowpass_altivec
 #define PREFIX_h264_qpel16_h_lowpass_num       altivec_put_h264_qpel16_h_lowpass_num
@@ -43,7 +42,6 @@
 #include "h264_template_altivec.c"
 #undef OP_U8_ALTIVEC
 #undef PREFIX_h264_chroma_mc8_altivec
-#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
 #undef PREFIX_h264_chroma_mc8_num
 #undef PREFIX_h264_qpel16_h_lowpass_altivec
 #undef PREFIX_h264_qpel16_h_lowpass_num
@@ -54,7 +52,6 @@
 
 #define OP_U8_ALTIVEC                          AVG_OP_U8_ALTIVEC
 #define PREFIX_h264_chroma_mc8_altivec         avg_h264_chroma_mc8_altivec
-#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   avg_no_rnd_vc1_chroma_mc8_altivec
 #define PREFIX_h264_chroma_mc8_num             altivec_avg_h264_chroma_mc8_num
 #define PREFIX_h264_qpel16_h_lowpass_altivec   avg_h264_qpel16_h_lowpass_altivec
 #define PREFIX_h264_qpel16_h_lowpass_num       altivec_avg_h264_qpel16_h_lowpass_num
@@ -65,7 +62,6 @@
 #include "h264_template_altivec.c"
 #undef OP_U8_ALTIVEC
 #undef PREFIX_h264_chroma_mc8_altivec
-#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
 #undef PREFIX_h264_chroma_mc8_num
 #undef PREFIX_h264_qpel16_h_lowpass_altivec
 #undef PREFIX_h264_qpel16_h_lowpass_num
@@ -973,8 +969,6 @@ void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) {
     if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
         c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec;
         c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec;
-        c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
-        c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec;
 
 #define dspfunc(PFX, IDX, NUM) \
         c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \
diff --git a/ffmpeg-mt/libavcodec/ppc/h264_template_altivec.c b/ffmpeg-mt/libavcodec/ppc/h264_template_altivec.c
index 8cf39c8..020d7c7 100644
--- a/ffmpeg-mt/libavcodec/ppc/h264_template_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/h264_template_altivec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2004 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -75,6 +75,7 @@
 #define noop(a) a
 #define add28(a) vec_add(v28ss, a)
 
+#ifdef PREFIX_h264_chroma_mc8_altivec
 static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src,
                                     int stride, int h, int x, int y) {
     DECLARE_ALIGNED(16, signed int, ABCD)[4] =
@@ -201,8 +202,10 @@ static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src,
         }
     }
 }
+#endif
 
 /* this code assume that stride % 16 == 0 */
+#ifdef PREFIX_no_rnd_vc1_chroma_mc8_altivec
 static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) {
    DECLARE_ALIGNED(16, signed int, ABCD)[4] =
                         {((8 - x) * (8 - y)),
@@ -284,12 +287,14 @@ static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, i
         }
     }
 }
+#endif
 
 #undef noop
 #undef add28
 #undef CHROMA_MC8_ALTIVEC_CORE
 
 /* this code assume stride % 16 == 0 */
+#ifdef PREFIX_h264_qpel16_h_lowpass_altivec
 static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
     register int i;
 
@@ -427,8 +432,10 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i
         dst += dstStride;
     }
 }
+#endif
 
 /* this code assume stride % 16 == 0 */
+#ifdef PREFIX_h264_qpel16_v_lowpass_altivec
 static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
     register int i;
 
@@ -533,8 +540,10 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i
         dst += dstStride;
     }
 }
+#endif
 
 /* this code assume stride % 16 == 0 *and* tmp is properly aligned */
+#ifdef PREFIX_h264_qpel16_hv_lowpass_altivec
 static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) {
     register int i;
     LOAD_ZERO;
@@ -765,3 +774,4 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp,
         dst += dstStride;
     }
 }
+#endif
diff --git a/ffmpeg-mt/libavcodec/ppc/idct_altivec.c b/ffmpeg-mt/libavcodec/ppc/idct_altivec.c
index d65ba24..cc3adcb 100644
--- a/ffmpeg-mt/libavcodec/ppc/idct_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/idct_altivec.c
@@ -1,31 +1,31 @@
 /*
  * Copyright (c) 2001 Michel Lespinasse
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /*
  * NOTE: This code is based on GPL code from the libmpeg2 project.  The
  * author, Michel Lespinasses, has given explicit permission to release
- * under LGPL as part of FFmpeg.
+ * under LGPL as part of Libav.
  */
 
 /*
- * FFmpeg integration by Dieter Shirley
+ * Libav integration by Dieter Shirley
  *
  * This file is a direct copy of the AltiVec IDCT module from the libmpeg2
  * project.  I've deleted all of the libmpeg2-specific code, renamed the
diff --git a/ffmpeg-mt/libavcodec/ppc/int_altivec.c b/ffmpeg-mt/libavcodec/ppc/int_altivec.c
index 61c18c8..25cbb8f 100644
--- a/ffmpeg-mt/libavcodec/ppc/int_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/int_altivec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Luca Barbato <lu_zero at gentoo.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/mathops.h b/ffmpeg-mt/libavcodec/ppc/mathops.h
index dbd714f..34ddb11 100644
--- a/ffmpeg-mt/libavcodec/ppc/mathops.h
+++ b/ffmpeg-mt/libavcodec/ppc/mathops.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2001, 2002 Fabrice Bellard
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/mpegaudiodec_altivec.c b/ffmpeg-mt/libavcodec/ppc/mpegaudiodec_altivec.c
index e087d4a..af94276 100644
--- a/ffmpeg-mt/libavcodec/ppc/mpegaudiodec_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/mpegaudiodec_altivec.c
@@ -2,20 +2,20 @@
  * Altivec optimized MP3 decoding functions
  * Copyright (c) 2010 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/mpegvideo_altivec.c b/ffmpeg-mt/libavcodec/ppc/mpegvideo_altivec.c
index 64898a1..e02c094 100644
--- a/ffmpeg-mt/libavcodec/ppc/mpegvideo_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/mpegvideo_altivec.c
@@ -4,20 +4,20 @@
  * dct_unquantize_h263_altivec:
  * Copyright (c) 2003 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/regs.h b/ffmpeg-mt/libavcodec/ppc/regs.h
index 63861f2..2edd639 100644
--- a/ffmpeg-mt/libavcodec/ppc/regs.h
+++ b/ffmpeg-mt/libavcodec/ppc/regs.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/types_altivec.h b/ffmpeg-mt/libavcodec/ppc/types_altivec.h
index 36b6e1f..defa20e 100644
--- a/ffmpeg-mt/libavcodec/ppc/types_altivec.h
+++ b/ffmpeg-mt/libavcodec/ppc/types_altivec.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2006 Guillaume Poirier <gpoirier at mplayerhq.hu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/util_altivec.h b/ffmpeg-mt/libavcodec/ppc/util_altivec.h
index cb638df..e68e5b5 100644
--- a/ffmpeg-mt/libavcodec/ppc/util_altivec.h
+++ b/ffmpeg-mt/libavcodec/ppc/util_altivec.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/vc1dsp_altivec.c b/ffmpeg-mt/libavcodec/ppc/vc1dsp_altivec.c
index a2f55f2..c52b5a9 100644
--- a/ffmpeg-mt/libavcodec/ppc/vc1dsp_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/vc1dsp_altivec.c
@@ -2,24 +2,25 @@
  * VC-1 and WMV3 decoder - DSP functions AltiVec-optimized
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavcodec/dsputil.h"
+#include "libavcodec/vc1dsp.h"
 
 #include "util_altivec.h"
 #include "dsputil_altivec.h"
@@ -129,7 +130,8 @@ do { \
 
 /** Do inverse transform on 8x8 block
 */
-static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
+static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
+                                      int sign, int rangered)
 {
     vector signed short src0, src1, src2, src3, src4, src5, src6, src7;
     vector signed int s0, s1, s2, s3, s4, s5, s6, s7;
@@ -143,7 +145,9 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
     const vector unsigned int vec_2 = vec_splat_u32(2);
     const vector  signed int vec_1s = vec_splat_s32(1);
     const vector unsigned int vec_1 = vec_splat_u32(1);
-
+    const vector unsigned short rangered_shift = vec_splat_u16(1);
+    const vector   signed short signed_bias = vec_sl(vec_splat_s16(4),
+                                                     vec_splat_u16(4));
 
     src0 = vec_ld(  0, block);
     src1 = vec_ld( 16, block);
@@ -154,7 +158,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
     src6 = vec_ld( 96, block);
     src7 = vec_ld(112, block);
 
-    TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7);
     s0 = vec_unpackl(src0);
     s1 = vec_unpackl(src1);
     s2 = vec_unpackl(src2);
@@ -214,6 +217,27 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
     src6 = vec_pack(sE, s6);
     src7 = vec_pack(sF, s7);
 
+    if (rangered) {
+        if (!sign) {
+            src0 = vec_sub(src0, signed_bias);
+            src1 = vec_sub(src1, signed_bias);
+            src2 = vec_sub(src2, signed_bias);
+            src3 = vec_sub(src3, signed_bias);
+            src4 = vec_sub(src4, signed_bias);
+            src5 = vec_sub(src5, signed_bias);
+            src6 = vec_sub(src6, signed_bias);
+            src7 = vec_sub(src7, signed_bias);
+        }
+        src0 = vec_sl(src0, rangered_shift);
+        src1 = vec_sl(src1, rangered_shift);
+        src2 = vec_sl(src2, rangered_shift);
+        src3 = vec_sl(src3, rangered_shift);
+        src4 = vec_sl(src4, rangered_shift);
+        src5 = vec_sl(src5, rangered_shift);
+        src6 = vec_sl(src6, rangered_shift);
+        src7 = vec_sl(src7, rangered_shift);
+    }
+
     vec_st(src0,  0, block);
     vec_st(src1, 16, block);
     vec_st(src2, 32, block);
@@ -224,6 +248,36 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
     vec_st(src7,112, block);
 }
 
+static void vc1_inv_trans_8x8_add_altivec(uint8_t *dest, int stride, DCTELEM *b)
+{
+    vc1_inv_trans_8x8_altivec(b, 0, 0);
+    ff_add_pixels_clamped_c(b, dest, stride);
+}
+
+static void vc1_inv_trans_8x8_put_signed_altivec(uint8_t *dest, int stride, DCTELEM *b)
+{
+    vc1_inv_trans_8x8_altivec(b, 1, 0);
+    ff_put_signed_pixels_clamped_c(b, dest, stride);
+}
+
+static void vc1_inv_trans_8x8_put_signed_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b)
+{
+    vc1_inv_trans_8x8_altivec(b, 1, 1);
+    ff_put_signed_pixels_clamped_c(b, dest, stride);
+}
+
+static void vc1_inv_trans_8x8_put_altivec(uint8_t *dest, int stride, DCTELEM *b)
+{
+    vc1_inv_trans_8x8_altivec(b, 0, 0);
+    ff_put_pixels_clamped_c(b, dest, stride);
+}
+
+static void vc1_inv_trans_8x8_put_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b)
+{
+    vc1_inv_trans_8x8_altivec(b, 0, 1);
+    ff_put_pixels_clamped_c(b, dest, stride);
+}
+
 /** Do inverse transform on 8x4 part of block
 */
 static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block)
@@ -322,8 +376,32 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block)
     ADD (dest, src3, perm1)
 }
 
+#define PUT_OP_U8_ALTIVEC(d, s, dst) d = s
+#define AVG_OP_U8_ALTIVEC(d, s, dst) d = vec_avg(dst, s)
+
+#define OP_U8_ALTIVEC                          PUT_OP_U8_ALTIVEC
+#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   put_no_rnd_vc1_chroma_mc8_altivec
+#include "h264_template_altivec.c"
+#undef OP_U8_ALTIVEC
+#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
+
+#define OP_U8_ALTIVEC                          AVG_OP_U8_ALTIVEC
+#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   avg_no_rnd_vc1_chroma_mc8_altivec
+#include "h264_template_altivec.c"
+#undef OP_U8_ALTIVEC
+#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
+
+void ff_vc1dsp_init_altivec(VC1DSPContext* dsp)
+{
+    if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
+        return;
 
-void vc1dsp_init_altivec(DSPContext* dsp, AVCodecContext *avctx) {
-    dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec;
+    dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_altivec;
+    dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_altivec;
+    dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_altivec;
+    dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_altivec;
+    dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_altivec;
     dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec;
+    dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
+    dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec;
 }
diff --git a/ffmpeg-mt/libavcodec/ppc/vp3dsp_altivec.c b/ffmpeg-mt/libavcodec/ppc/vp3dsp_altivec.c
index b0509d8..bbe9170 100644
--- a/ffmpeg-mt/libavcodec/ppc/vp3dsp_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/vp3dsp_altivec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2009 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ppc/vp8dsp_altivec.c b/ffmpeg-mt/libavcodec/ppc/vp8dsp_altivec.c
index 8096c4a..06874b8 100644
--- a/ffmpeg-mt/libavcodec/ppc/vp8dsp_altivec.c
+++ b/ffmpeg-mt/libavcodec/ppc/vp8dsp_altivec.c
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2010 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -56,8 +56,8 @@ static const vec_s8 h_subpel_filters_outer[3] =
     vec_s8 filter_outerl = vec_sld(filter_outerh, filter_outerh, 2)
 
 #define FILTER_H(dstv, off) \
-    a = vec_ld((off)-2,    src); \
-    b = vec_ld((off)-2+15, src); \
+    a = vec_ld((off)-is6tap-1,    src); \
+    b = vec_ld((off)-is6tap-1+15, src); \
 \
     pixh  = vec_perm(a, b, permh##off); \
     pixl  = vec_perm(a, b, perml##off); \
@@ -86,13 +86,15 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, int dst_stride,
     vec_s16 f16h, f16l;
     vec_s32 filth, filtl;
 
-    vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };
+    vec_u8 perm_inner6 = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };
+    vec_u8 perm_inner4 = { 0,1,2,3, 1,2,3,4, 2,3,4,5, 3,4,5,6 };
+    vec_u8 perm_inner  = is6tap ? perm_inner6 : perm_inner4;
     vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 };
     vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));
     vec_u16 c7  = vec_splat_u16(7);
 
-    align_vec0 = vec_lvsl( -2, src);
-    align_vec8 = vec_lvsl(8-2, src);
+    align_vec0 = vec_lvsl( -is6tap-1, src);
+    align_vec8 = vec_lvsl(8-is6tap-1, src);
 
     permh0     = vec_perm(align_vec0, align_vec0, perm_inner);
     permh8     = vec_perm(align_vec8, align_vec8, perm_inner);
@@ -239,8 +241,13 @@ void put_vp8_epel ## WIDTH ## _v ## TAPS ## _altivec(uint8_t *dst, int dst_strid
 static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, int stride, uint8_t *src, int s, int h, int mx, int my) \
 { \
     DECLARE_ALIGNED(16, uint8_t, tmp)[(2*WIDTH+5)*16]; \
-    put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16,     src-2*stride, stride, h+5, mx, my); \
-    put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16,     16,     h,   mx, my); \
+    if (VTAPS == 6) { \
+        put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16,     src-2*stride, stride, h+5, mx, my); \
+        put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16,     16,     h,   mx, my); \
+    } else { \
+        put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16,     src-stride, stride, h+4, mx, my); \
+        put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+16,     16,     h,   mx, my); \
+    } \
 }
 
 EPEL_FUNCS(16,6)
diff --git a/ffmpeg-mt/libavcodec/ps2/dsputil_mmi.c b/ffmpeg-mt/libavcodec/ps2/dsputil_mmi.c
index 15b5b56..b6096b3 100644
--- a/ffmpeg-mt/libavcodec/ps2/dsputil_mmi.c
+++ b/ffmpeg-mt/libavcodec/ps2/dsputil_mmi.c
@@ -5,20 +5,20 @@
  * MMI optimization by Leon van Stuivenberg
  * clear_blocks_mmi() by BroadQ
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ps2/idct_mmi.c b/ffmpeg-mt/libavcodec/ps2/idct_mmi.c
index bfe362a..86df092 100644
--- a/ffmpeg-mt/libavcodec/ps2/idct_mmi.c
+++ b/ffmpeg-mt/libavcodec/ps2/idct_mmi.c
@@ -8,20 +8,20 @@
  *
  * MMI port and (c) 2002 by Leon van Stuivenberg
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ps2/mmi.h b/ffmpeg-mt/libavcodec/ps2/mmi.h
index 0265456..fc8d328 100644
--- a/ffmpeg-mt/libavcodec/ps2/mmi.h
+++ b/ffmpeg-mt/libavcodec/ps2/mmi.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2002 Leon van Stuivenberg
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ps2/mpegvideo_mmi.c b/ffmpeg-mt/libavcodec/ps2/mpegvideo_mmi.c
index 68c3b0d..ed56893 100644
--- a/ffmpeg-mt/libavcodec/ps2/mpegvideo_mmi.c
+++ b/ffmpeg-mt/libavcodec/ps2/mpegvideo_mmi.c
@@ -3,20 +3,20 @@
  *
  * MMI optimization by Leon van Stuivenberg
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/psymodel.c b/ffmpeg-mt/libavcodec/psymodel.c
index a2e469c..a943ae1 100644
--- a/ffmpeg-mt/libavcodec/psymodel.c
+++ b/ffmpeg-mt/libavcodec/psymodel.c
@@ -2,20 +2,20 @@
  * audio encoder psychoacoustic model
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -88,8 +88,9 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av
         cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate;
 
     if (cutoff_coeff)
-    ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS,
-                                             FILT_ORDER, cutoff_coeff, 0.0, 0.0);
+    ctx->fcoeffs = ff_iir_filter_init_coeffs(avctx, FF_FILTER_TYPE_BUTTERWORTH,
+                                             FF_FILTER_MODE_LOWPASS, FILT_ORDER,
+                                             cutoff_coeff, 0.0, 0.0);
     if (ctx->fcoeffs) {
         ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels);
         for (i = 0; i < avctx->channels; i++)
diff --git a/ffmpeg-mt/libavcodec/psymodel.h b/ffmpeg-mt/libavcodec/psymodel.h
index fc2f6d9..91eb9ae 100644
--- a/ffmpeg-mt/libavcodec/psymodel.h
+++ b/ffmpeg-mt/libavcodec/psymodel.h
@@ -2,20 +2,20 @@
  * audio encoder psychoacoustic model
  * Copyright (C) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,6 +26,8 @@
 
 /** maximum possible number of bands */
 #define PSY_MAX_BANDS 128
+/** maximum number of channels */
+#define PSY_MAX_CHANS 20
 
 /**
  * single band psychoacoustic information
@@ -62,6 +64,13 @@ typedef struct FFPsyContext {
     int     *num_bands;               ///< number of scalefactor bands for possible frame sizes
     int num_lens;                     ///< number of scalefactor band sets
 
+    float pe[PSY_MAX_CHANS];          ///< total PE for each channel in the frame
+
+    struct {
+        int size;                     ///< size of the bitresevoir in bits
+        int bits;                     ///< number of bits used in the bitresevoir
+    } bitres;
+
     void* model_priv_data;            ///< psychoacoustic model implementation private data
 } FFPsyContext;
 
diff --git a/ffmpeg-mt/libavcodec/pthread.c b/ffmpeg-mt/libavcodec/pthread.c
index 7acb22f..ba6e395 100644
--- a/ffmpeg-mt/libavcodec/pthread.c
+++ b/ffmpeg-mt/libavcodec/pthread.c
@@ -6,20 +6,20 @@
  * to Michael Niedermayer <michaelni at gmx.at> for writing initial
  * implementation.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -64,26 +64,26 @@ typedef struct PerThreadContext {
     struct FrameThreadContext *parent;
 
     pthread_t      thread;
-    pthread_cond_t input_cond;      ///< Used to wait for a new frame from the main thread.
+    pthread_cond_t input_cond;      ///< Used to wait for a new packet from the main thread.
     pthread_cond_t progress_cond;   ///< Used by child threads to wait for progress to change.
     pthread_cond_t output_cond;     ///< Used by the main thread to wait for frames to finish.
 
     pthread_mutex_t mutex;          ///< Mutex used to protect the contents of the PerThreadContext.
     pthread_mutex_t progress_mutex; ///< Mutex used to protect frame progress values and progress_cond.
 
-    AVCodecContext *avctx;          ///< Context used to decode frames passed to this thread.
+    AVCodecContext *avctx;          ///< Context used to decode packets passed to this thread.
 
-    AVPacket       avpkt;           ///< Input frame (for decoding) or output (for encoding).
+    AVPacket       avpkt;           ///< Input packet (for decoding) or output (for encoding).
     int            allocated_buf_size; ///< Size allocated for avpkt.data
 
-    AVFrame picture;                ///< Output picture (for decoding) or input (for encoding).
-    int     got_picture;            ///< The output of got_picture_ptr from the last avcodec_decode_video() call.
+    AVFrame frame;                  ///< Output frame (for decoding) or input (for encoding).
+    int     got_frame;              ///< The output of got_picture_ptr from the last avcodec_decode_video() call.
     int     result;                 ///< The result of the last codec decode/encode() call.
 
     enum {
-        STATE_INPUT_READY,          ///< Set when the thread is awaiting a frame.
+        STATE_INPUT_READY,          ///< Set when the thread is awaiting a packet.
         STATE_SETTING_UP,           ///< Set before the codec has called ff_thread_finish_setup().
-        STATE_GET_BUFFER,           /**
+        STATE_GET_BUFFER,           /**<
                                      * Set when the codec calls get_buffer().
                                      * State is returned to STATE_SETTING_UP afterwards.
                                      */
@@ -111,16 +111,16 @@ typedef struct PerThreadContext {
  */
 typedef struct FrameThreadContext {
     PerThreadContext *threads;     ///< The contexts for each thread.
-    PerThreadContext *prev_thread; ///< The last thread submit_frame() was called on.
+    PerThreadContext *prev_thread; ///< The last thread submit_packet() was called on.
 
     pthread_mutex_t buffer_mutex;  ///< Mutex used to protect get/release_buffer().
 
-    int next_decoding;             ///< The next context to submit a frame to.
+    int next_decoding;             ///< The next context to submit a packet to.
     int next_finished;             ///< The next context to return output from.
 
-    int delaying;                  /**
-                                    * Set for the first N frames, where N is the number of threads.
-                                    * While it is set, ff_en/decode_frame_threaded won't return any results.
+    int delaying;                  /**<
+                                    * Set for the first N packets, where N is the number of threads.
+                                    * While it is set, ff_thread_en/decode_frame won't return any results.
                                     */
 
     int die;                       ///< Set when threads should exit.
@@ -230,8 +230,6 @@ static int thread_init(AVCodecContext *avctx)
     ThreadContext *c;
     int thread_count = avctx->thread_count;
 
-    avctx->thread_count = thread_count;
-
     if (thread_count <= 1)
         return 0;
 
@@ -258,7 +256,7 @@ static int thread_init(AVCodecContext *avctx)
         if(pthread_create(&c->workers[i], NULL, worker, avctx)) {
            avctx->thread_count = i;
            pthread_mutex_unlock(&c->current_job_lock);
-           avcodec_thread_free(avctx);
+           ff_thread_free(avctx);
            return -1;
         }
     }
@@ -294,12 +292,13 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
 
         if (fctx->die) break;
 
-        if (!codec->update_thread_context) ff_thread_finish_setup(avctx);
+        if (!codec->update_thread_context && avctx->thread_safe_callbacks)
+            ff_thread_finish_setup(avctx);
 
         pthread_mutex_lock(&p->mutex);
-        avcodec_get_frame_defaults(&p->picture);
-        p->got_picture = 0;
-        p->result = codec->decode(avctx, &p->picture, &p->got_picture, &p->avpkt);
+        avcodec_get_frame_defaults(&p->frame);
+        p->got_frame = 0;
+        p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt);
 
         if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
 
@@ -381,7 +380,9 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
     dst->release_buffer = src->release_buffer;
 
     dst->opaque   = src->opaque;
+#if FF_API_HURRY_UP
     dst->hurry_up = src->hurry_up;
+#endif
     dst->dsp_mask = src->dsp_mask;
     dst->debug    = src->debug;
     dst->debug_mv = src->debug_mv;
@@ -421,7 +422,7 @@ static void release_delayed_buffers(PerThreadContext *p)
     }
 }
 
-static int submit_frame(PerThreadContext *p, AVPacket *avpkt)
+static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
 {
     FrameThreadContext *fctx = p->parent;
     PerThreadContext *prev_thread = fctx->prev_thread;
@@ -497,18 +498,18 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
     int err;
 
     /*
-     * Submit a frame to the next decoding thread.
+     * Submit a packet to the next decoding thread.
      */
 
     p = &fctx->threads[fctx->next_decoding];
     update_context_from_user(p->avctx, avctx);
-    err = submit_frame(p, avpkt);
+    err = submit_packet(p, avpkt);
     if (err) return err;
 
     fctx->next_decoding++;
 
     /*
-     * If we're still receiving the initial frames, don't return a picture.
+     * If we're still receiving the initial packets, don't return a frame.
      */
 
     if (fctx->delaying && avpkt->size) {
@@ -519,9 +520,9 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
     }
 
     /*
-     * Return the next available picture from the oldest thread.
+     * Return the next available frame from the oldest thread.
      * If we're at the end of the stream, then we have to skip threads that
-     * didn't output a picture, because we don't want to accidentally signal
+     * didn't output a frame, because we don't want to accidentally signal
      * EOF (avpkt->size == 0 && *got_picture_ptr == 0).
      */
 
@@ -535,8 +536,8 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
             pthread_mutex_unlock(&p->progress_mutex);
         }
 
-        *picture = p->picture;
-        *got_picture_ptr = p->got_picture;
+        *picture = p->frame;
+        *got_picture_ptr = p->got_frame;
         picture->pkt_dts = p->avpkt.dts;
 
         /*
@@ -545,7 +546,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
          * stopped by the "finished != fctx->next_finished" condition.
          * Make sure we don't mistakenly return the same frame again.
          */
-        p->got_picture = 0;
+        p->got_frame = 0;
 
         if (finished >= avctx->thread_count) finished = 0;
     } while (!avpkt->size && !*got_picture_ptr && finished != fctx->next_finished);
@@ -684,6 +685,11 @@ static int frame_thread_init(AVCodecContext *avctx)
     FrameThreadContext *fctx;
     int i, err = 0;
 
+    if (thread_count <= 1) {
+        avctx->active_thread_type = 0;
+        return 0;
+    }
+
     avctx->thread_opaque = fctx = av_mallocz(sizeof(FrameThreadContext));
 
     fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
@@ -781,7 +787,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
         return avctx->get_buffer(avctx, f);
     }
 
-    if (p->state != STATE_SETTING_UP) {
+    if (p->state != STATE_SETTING_UP &&
+        (avctx->codec->update_thread_context || !avctx->thread_safe_callbacks)) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n");
         return -1;
     }
@@ -812,6 +819,9 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
         err = p->result;
 
         pthread_mutex_unlock(&p->progress_mutex);
+
+        if (!avctx->codec->update_thread_context)
+            ff_thread_finish_setup(avctx);
     }
 
     pthread_mutex_unlock(&p->parent->buffer_mutex);
@@ -867,20 +877,18 @@ static void validate_thread_parameters(AVCodecContext *avctx)
         avctx->active_thread_type = 0;
     } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {
         avctx->active_thread_type = FF_THREAD_FRAME;
-    } else {
+    } else if (avctx->thread_type & FF_THREAD_SLICE) {
         avctx->active_thread_type = FF_THREAD_SLICE;
     }
 }
 
-int avcodec_thread_init(AVCodecContext *avctx, int thread_count)
+int ff_thread_init(AVCodecContext *avctx)
 {
     if (avctx->thread_opaque) {
         av_log(avctx, AV_LOG_ERROR, "avcodec_thread_init is ignored after avcodec_open\n");
         return -1;
     }
 
-    avctx->thread_count = FFMAX(1, thread_count);
-
     if (avctx->codec) {
         validate_thread_parameters(avctx);
 
@@ -893,7 +901,7 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count)
     return 0;
 }
 
-void avcodec_thread_free(AVCodecContext *avctx)
+void ff_thread_free(AVCodecContext *avctx)
 {
     if (avctx->active_thread_type&FF_THREAD_FRAME)
         frame_thread_free(avctx, avctx->thread_count);
diff --git a/ffmpeg-mt/libavcodec/ptx.c b/ffmpeg-mt/libavcodec/ptx.c
index a064425..fb8b0d8 100644
--- a/ffmpeg-mt/libavcodec/ptx.c
+++ b/ffmpeg-mt/libavcodec/ptx.c
@@ -2,25 +2,25 @@
  * V.Flash PTX (.ptx) image decoder
  * Copyright (c) 2007 Ivo van Poorten
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 
 typedef struct PTXContext {
@@ -106,7 +106,7 @@ static av_cold int ptx_end(AVCodecContext *avctx) {
     return 0;
 }
 
-AVCodec ptx_decoder = {
+AVCodec ff_ptx_decoder = {
     "ptx",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_PTX,
diff --git a/ffmpeg-mt/libavcodec/put_bits.h b/ffmpeg-mt/libavcodec/put_bits.h
index d301d0a..c426540 100644
--- a/ffmpeg-mt/libavcodec/put_bits.h
+++ b/ffmpeg-mt/libavcodec/put_bits.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/qcelpdata.h b/ffmpeg-mt/libavcodec/qcelpdata.h
index d79cea9..df33e91 100644
--- a/ffmpeg-mt/libavcodec/qcelpdata.h
+++ b/ffmpeg-mt/libavcodec/qcelpdata.h
@@ -2,20 +2,20 @@
  * QCELP decoder
  * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,7 +26,7 @@
  * @file
  * Data tables for the QCELP decoder
  * @author Reynaldo H. Verdejo Pinochet
- * @remark FFmpeg merging spearheaded by Kenan Gillet
+ * @remark Libav merging spearheaded by Kenan Gillet
  * @remark Development mentored by Benjamin Larson
  */
 
diff --git a/ffmpeg-mt/libavcodec/qcelpdec.c b/ffmpeg-mt/libavcodec/qcelpdec.c
index 22b90ce..3095a24 100644
--- a/ffmpeg-mt/libavcodec/qcelpdec.c
+++ b/ffmpeg-mt/libavcodec/qcelpdec.c
@@ -2,20 +2,20 @@
  * QCELP decoder
  * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
  * @file
  * QCELP decoder
  * @author Reynaldo H. Verdejo Pinochet
- * @remark FFmpeg merging spearheaded by Kenan Gillet
+ * @remark Libav merging spearheaded by Kenan Gillet
  * @remark Development mentored by Benjamin Larson
  */
 
@@ -842,7 +842,7 @@ erasure:
     return *data_size;
 }
 
-AVCodec qcelp_decoder =
+AVCodec ff_qcelp_decoder =
 {
     .name   = "qcelp",
     .type   = AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/qdm2.c b/ffmpeg-mt/libavcodec/qdm2.c
index a5fa28d..3ef712c 100644
--- a/ffmpeg-mt/libavcodec/qdm2.c
+++ b/ffmpeg-mt/libavcodec/qdm2.c
@@ -5,20 +5,20 @@
  * Copyright (c) 2005 Alex Beregszaszi
  * Copyright (c) 2005 Roberto Togni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1588,7 +1588,7 @@ static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet)
     int i;
     q->fft.complex[channel][0].re *= 2.0f;
     q->fft.complex[channel][0].im = 0.0f;
-    ff_rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
+    q->rdft_ctx.rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
     /* add samples to output buffer */
     for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++)
         q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain;
@@ -1974,7 +1974,7 @@ static int qdm2_decode_frame(AVCodecContext *avctx,
     return s->checksum_size;
 }
 
-AVCodec qdm2_decoder =
+AVCodec ff_qdm2_decoder =
 {
     .name = "qdm2",
     .type = AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/qdm2_tablegen.c b/ffmpeg-mt/libavcodec/qdm2_tablegen.c
index a7a9fb6..59d82df 100644
--- a/ffmpeg-mt/libavcodec/qdm2_tablegen.c
+++ b/ffmpeg-mt/libavcodec/qdm2_tablegen.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/qdm2_tablegen.h b/ffmpeg-mt/libavcodec/qdm2_tablegen.h
index 6718f58..769d53b 100644
--- a/ffmpeg-mt/libavcodec/qdm2_tablegen.h
+++ b/ffmpeg-mt/libavcodec/qdm2_tablegen.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/qdm2data.h b/ffmpeg-mt/libavcodec/qdm2data.h
index 355d613..ad6ea88 100644
--- a/ffmpeg-mt/libavcodec/qdm2data.h
+++ b/ffmpeg-mt/libavcodec/qdm2data.h
@@ -5,20 +5,20 @@
  * Copyright (c) 2005 Alex Beregszaszi
  * Copyright (c) 2005 Roberto Togni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/qdrw.c b/ffmpeg-mt/libavcodec/qdrw.c
index 5750058..3768c1b 100644
--- a/ffmpeg-mt/libavcodec/qdrw.c
+++ b/ffmpeg-mt/libavcodec/qdrw.c
@@ -2,20 +2,20 @@
  * QuickDraw (qdrw) codec
  * Copyright (c) 2004 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -150,7 +150,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec qdraw_decoder = {
+AVCodec ff_qdraw_decoder = {
     "qdraw",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_QDRAW,
diff --git a/ffmpeg-mt/libavcodec/qpeg.c b/ffmpeg-mt/libavcodec/qpeg.c
index e6a0b30..ccd634a 100644
--- a/ffmpeg-mt/libavcodec/qpeg.c
+++ b/ffmpeg-mt/libavcodec/qpeg.c
@@ -2,20 +2,20 @@
  * QPEG codec
  * Copyright (c) 2004 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -311,7 +311,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec qpeg_decoder = {
+AVCodec ff_qpeg_decoder = {
     "qpeg",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_QPEG,
diff --git a/ffmpeg-mt/libavcodec/qtrle.c b/ffmpeg-mt/libavcodec/qtrle.c
index 1fd9a80..a8cc903 100644
--- a/ffmpeg-mt/libavcodec/qtrle.c
+++ b/ffmpeg-mt/libavcodec/qtrle.c
@@ -2,20 +2,20 @@
  * Quicktime Animation (RLE) Video Decoder
  * Copyright (C) 2004 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -537,7 +537,7 @@ static av_cold int qtrle_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec qtrle_decoder = {
+AVCodec ff_qtrle_decoder = {
     "qtrle",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_QTRLE,
diff --git a/ffmpeg-mt/libavcodec/qtrleenc.c b/ffmpeg-mt/libavcodec/qtrleenc.c
index aea0f68..d35bc20 100644
--- a/ffmpeg-mt/libavcodec/qtrleenc.c
+++ b/ffmpeg-mt/libavcodec/qtrleenc.c
@@ -5,24 +5,24 @@
  *
  * This file is based on flashsvenc.c.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
 
@@ -321,7 +321,7 @@ static av_cold int qtrle_encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec qtrle_encoder = {
+AVCodec ff_qtrle_encoder = {
     "qtrle",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_QTRLE,
diff --git a/ffmpeg-mt/libavcodec/r210dec.c b/ffmpeg-mt/libavcodec/r210dec.c
index b1fe62d..ae215fe 100644
--- a/ffmpeg-mt/libavcodec/r210dec.c
+++ b/ffmpeg-mt/libavcodec/r210dec.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Doeffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -97,7 +97,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
 }
 
 #if CONFIG_R210_DECODER
-AVCodec r210_decoder = {
+AVCodec ff_r210_decoder = {
     "r210",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_R210,
@@ -111,7 +111,7 @@ AVCodec r210_decoder = {
 };
 #endif
 #if CONFIG_R10K_DECODER
-AVCodec r10k_decoder = {
+AVCodec ff_r10k_decoder = {
     "r10k",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_R10K,
diff --git a/ffmpeg-mt/libavcodec/ra144.c b/ffmpeg-mt/libavcodec/ra144.c
index 35b7921..fd2ed32 100644
--- a/ffmpeg-mt/libavcodec/ra144.c
+++ b/ffmpeg-mt/libavcodec/ra144.c
@@ -2,20 +2,20 @@
  * Real Audio 1.0 (14.4K)
  * Copyright (c) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1503,8 +1503,8 @@ const int16_t * const ff_lpc_refl_cb[10]={
     lpc_refl_cb6, lpc_refl_cb7, lpc_refl_cb8, lpc_refl_cb9, lpc_refl_cb10
 };
 
-void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
-                const int8_t *s2, const int8_t *s3)
+static void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
+                       const int8_t *s2, const int8_t *s3)
 {
     int i;
     int v[3];
diff --git a/ffmpeg-mt/libavcodec/ra144.h b/ffmpeg-mt/libavcodec/ra144.h
index 536b5bb..dcdfbb8 100644
--- a/ffmpeg-mt/libavcodec/ra144.h
+++ b/ffmpeg-mt/libavcodec/ra144.h
@@ -2,20 +2,20 @@
  * Real Audio 1.0 (14.4K)
  * Copyright (c) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 #define AVCODEC_RA144_H
 
 #include <stdint.h>
-#include "dsputil.h"
+#include "lpc.h"
 
 #define NBLOCKS         4       ///< number of subblocks within a block
 #define BLOCKSIZE       40      ///< subblock size in 16-bit words
@@ -34,7 +34,7 @@
 
 typedef struct {
     AVCodecContext *avctx;
-    DSPContext dsp;
+    LPCContext lpc_ctx;
 
     unsigned int     old_energy;        ///< previous frame energy
 
@@ -56,8 +56,6 @@ typedef struct {
     uint16_t adapt_cb[146+2];
 } RA144Context;
 
-void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
-                const int8_t *s2, const int8_t *s3);
 void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset);
 int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
 void ff_eval_coefs(int *coefs, const int *refl);
diff --git a/ffmpeg-mt/libavcodec/ra144dec.c b/ffmpeg-mt/libavcodec/ra144dec.c
index 2c022b1..e64b6c2 100644
--- a/ffmpeg-mt/libavcodec/ra144dec.c
+++ b/ffmpeg-mt/libavcodec/ra144dec.c
@@ -5,20 +5,20 @@
  * Copyright (c) 2003 Nick Kurshev
  *     Based on public domain decoder at http://www.honeypot.net/audio
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -114,7 +114,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
     return 20;
 }
 
-AVCodec ra_144_decoder =
+AVCodec ff_ra_144_decoder =
 {
     "real_144",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/ra144enc.c b/ffmpeg-mt/libavcodec/ra144enc.c
index 9865dc9..24ba934 100644
--- a/ffmpeg-mt/libavcodec/ra144enc.c
+++ b/ffmpeg-mt/libavcodec/ra144enc.c
@@ -2,20 +2,20 @@
  * Real Audio 1.0 (14.4K) encoder
  * Copyright (c) 2010 Francesco Lavra <francescolavra at interfree.it>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,7 +29,6 @@
 
 #include "avcodec.h"
 #include "put_bits.h"
-#include "lpc.h"
 #include "celp_filters.h"
 #include "ra144.h"
 
@@ -37,6 +36,7 @@
 static av_cold int ra144_encode_init(AVCodecContext * avctx)
 {
     RA144Context *ractx;
+    int ret;
 
     if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
         av_log(avctx, AV_LOG_ERROR, "invalid sample format\n");
@@ -53,7 +53,16 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
     ractx->lpc_coef[0] = ractx->lpc_tables[0];
     ractx->lpc_coef[1] = ractx->lpc_tables[1];
     ractx->avctx = avctx;
-    dsputil_init(&ractx->dsp, avctx);
+    ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER,
+                      AV_LPC_TYPE_LEVINSON);
+    return ret;
+}
+
+
+static av_cold int ra144_encode_close(AVCodecContext *avctx)
+{
+    RA144Context *ractx = avctx->priv_data;
+    ff_lpc_end(&ractx->lpc_ctx);
     return 0;
 }
 
@@ -451,7 +460,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
     energy = ff_energy_tab[quantize(ff_t_sqrt(energy >> 5) >> 10, ff_energy_tab,
                                     32)];
 
-    ff_lpc_calc_coefs(&ractx->dsp, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER,
+    ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER,
                       LPC_ORDER, 16, lpc_coefs, shift, AV_LPC_TYPE_LEVINSON,
                       0, ORDER_METHOD_EST, 12, 0);
     for (i = 0; i < LPC_ORDER; i++)
@@ -499,7 +508,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
 }
 
 
-AVCodec ra_144_encoder =
+AVCodec ff_ra_144_encoder =
 {
     "real_144",
     AVMEDIA_TYPE_AUDIO,
@@ -507,5 +516,6 @@ AVCodec ra_144_encoder =
     sizeof(RA144Context),
     ra144_encode_init,
     ra144_encode_frame,
+    ra144_encode_close,
     .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"),
 };
diff --git a/ffmpeg-mt/libavcodec/ra288.c b/ffmpeg-mt/libavcodec/ra288.c
index 03cf18f..64d765c 100644
--- a/ffmpeg-mt/libavcodec/ra288.c
+++ b/ffmpeg-mt/libavcodec/ra288.c
@@ -2,20 +2,20 @@
  * RealAudio 2.0 (28.8K)
  * Copyright (c) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -203,7 +203,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
     return avctx->block_align;
 }
 
-AVCodec ra_288_decoder =
+AVCodec ff_ra_288_decoder =
 {
     "real_288",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/ra288.h b/ffmpeg-mt/libavcodec/ra288.h
index d7fd4b5..8857f40 100644
--- a/ffmpeg-mt/libavcodec/ra288.h
+++ b/ffmpeg-mt/libavcodec/ra288.h
@@ -2,20 +2,20 @@
  * RealAudio 2.0 (28.8K)
  * Copyright (c) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rangecoder.c b/ffmpeg-mt/libavcodec/rangecoder.c
index 04c2738..1cd6762 100644
--- a/ffmpeg-mt/libavcodec/rangecoder.c
+++ b/ffmpeg-mt/libavcodec/rangecoder.c
@@ -2,20 +2,20 @@
  * Range coder
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rangecoder.h b/ffmpeg-mt/libavcodec/rangecoder.h
index 47c0362..7ad1bd2 100644
--- a/ffmpeg-mt/libavcodec/rangecoder.h
+++ b/ffmpeg-mt/libavcodec/rangecoder.h
@@ -2,20 +2,20 @@
  * Range coder
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ratecontrol.c b/ffmpeg-mt/libavcodec/ratecontrol.c
index 1fe947f..380e354 100644
--- a/ffmpeg-mt/libavcodec/ratecontrol.c
+++ b/ffmpeg-mt/libavcodec/ratecontrol.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/ratecontrol.h b/ffmpeg-mt/libavcodec/ratecontrol.h
index 32efe01..6cd4a18 100644
--- a/ffmpeg-mt/libavcodec/ratecontrol.h
+++ b/ffmpeg-mt/libavcodec/ratecontrol.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/raw.c b/ffmpeg-mt/libavcodec/raw.c
index 1fbf4d2..c2a060b 100644
--- a/ffmpeg-mt/libavcodec/raw.c
+++ b/ffmpeg-mt/libavcodec/raw.c
@@ -2,20 +2,20 @@
  * Raw Video Codec
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/raw.h b/ffmpeg-mt/libavcodec/raw.h
index 4eece61..2caa3fa 100644
--- a/ffmpeg-mt/libavcodec/raw.h
+++ b/ffmpeg-mt/libavcodec/raw.h
@@ -2,20 +2,20 @@
  * Raw Video Codec
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rawdec.c b/ffmpeg-mt/libavcodec/rawdec.c
index c664207..3c38829 100644
--- a/ffmpeg-mt/libavcodec/rawdec.c
+++ b/ffmpeg-mt/libavcodec/rawdec.c
@@ -2,20 +2,20 @@
  * Raw Video Decoder
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,8 +28,7 @@
 #include "imgconvert.h"
 #include "raw.h"
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/internal.h"
+#include "libavutil/imgutils.h"
 
 typedef struct RawVideoContext {
     uint32_t palette[AVPALETTE_COUNT];
@@ -124,6 +123,7 @@ static int raw_decode(AVCodecContext *avctx,
     frame->interlaced_frame = avctx->coded_frame->interlaced_frame;
     frame->top_field_first = avctx->coded_frame->top_field_first;
     frame->reordered_opaque = avctx->reordered_opaque;
+    frame->pkt_pts          = avctx->pkt->pts;
 
     //2bpp and 4bpp raw in avi and mov (yes this is ugly ...)
     if (context->buffer) {
@@ -195,7 +195,7 @@ static av_cold int raw_close_decoder(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec rawvideo_decoder = {
+AVCodec ff_rawvideo_decoder = {
     "rawvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RAWVIDEO,
diff --git a/ffmpeg-mt/libavcodec/rawenc.c b/ffmpeg-mt/libavcodec/rawenc.c
index 4199704..229f01f 100644
--- a/ffmpeg-mt/libavcodec/rawenc.c
+++ b/ffmpeg-mt/libavcodec/rawenc.c
@@ -2,20 +2,20 @@
  * Raw Video Encoder
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,7 +55,7 @@ static int raw_encode(AVCodecContext *avctx,
     return ret;
 }
 
-AVCodec rawvideo_encoder = {
+AVCodec ff_rawvideo_encoder = {
     "rawvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RAWVIDEO,
diff --git a/ffmpeg-mt/libavcodec/rdft.c b/ffmpeg-mt/libavcodec/rdft.c
index f37263b..116cfa4 100644
--- a/ffmpeg-mt/libavcodec/rdft.c
+++ b/ffmpeg-mt/libavcodec/rdft.c
@@ -2,26 +2,26 @@
  * (I)RDFT transforms
  * Copyright (c) 2009 Alex Converse <alex dot converse at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <stdlib.h>
 #include <math.h>
 #include "libavutil/mathematics.h"
-#include "fft.h"
+#include "rdft.h"
 
 /**
  * @file
@@ -44,7 +44,7 @@ SINTABLE(16384);
 SINTABLE(32768);
 SINTABLE(65536);
 #endif
-SINTABLE_CONST FFTSample * const ff_sin_tabs[] = {
+static SINTABLE_CONST FFTSample * const ff_sin_tabs[] = {
     NULL, NULL, NULL, NULL,
     ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024,
     ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536,
@@ -65,8 +65,8 @@ static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data)
     const FFTSample *tsin = s->tsin;
 
     if (!s->inverse) {
-        ff_fft_permute(&s->fft, (FFTComplex*)data);
-        ff_fft_calc(&s->fft, (FFTComplex*)data);
+        s->fft.fft_permute(&s->fft, (FFTComplex*)data);
+        s->fft.fft_calc(&s->fft, (FFTComplex*)data);
     }
     /* i=0 is a special case because of packing, the DC term is real, so we
        are going to throw the N/2 term (also real) in with it. */
@@ -91,8 +91,8 @@ static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data)
     if (s->inverse) {
         data[0] *= k1;
         data[1] *= k1;
-        ff_fft_permute(&s->fft, (FFTComplex*)data);
-        ff_fft_calc(&s->fft, (FFTComplex*)data);
+        s->fft.fft_permute(&s->fft, (FFTComplex*)data);
+        s->fft.fft_calc(&s->fft, (FFTComplex*)data);
     }
 }
 
diff --git a/ffmpeg-mt/libavcodec/rdft.h b/ffmpeg-mt/libavcodec/rdft.h
new file mode 100644
index 0000000..7572c6c
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/rdft.h
@@ -0,0 +1,74 @@
+/*
+ * (I)RDFT transforms
+ * Copyright (c) 2009 Alex Converse <alex dot converse at gmail dot com>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_RDFT_H
+#define AVCODEC_RDFT_H
+
+#include "config.h"
+#include "fft.h"
+
+#if CONFIG_HARDCODED_TABLES
+#   define SINTABLE_CONST const
+#else
+#   define SINTABLE_CONST
+#endif
+
+#define SINTABLE(size) \
+    SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2]
+
+extern SINTABLE(16);
+extern SINTABLE(32);
+extern SINTABLE(64);
+extern SINTABLE(128);
+extern SINTABLE(256);
+extern SINTABLE(512);
+extern SINTABLE(1024);
+extern SINTABLE(2048);
+extern SINTABLE(4096);
+extern SINTABLE(8192);
+extern SINTABLE(16384);
+extern SINTABLE(32768);
+extern SINTABLE(65536);
+
+struct RDFTContext {
+    int nbits;
+    int inverse;
+    int sign_convention;
+
+    /* pre/post rotation tables */
+    const FFTSample *tcos;
+    SINTABLE_CONST FFTSample *tsin;
+    FFTContext fft;
+    void (*rdft_calc)(struct RDFTContext *s, FFTSample *z);
+};
+
+/**
+ * Set up a real FFT.
+ * @param nbits           log2 of the length of the input array
+ * @param trans           the type of transform
+ */
+int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
+void ff_rdft_end(RDFTContext *s);
+
+void ff_rdft_init_arm(RDFTContext *s);
+
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/rectangle.h b/ffmpeg-mt/libavcodec/rectangle.h
index cf4a9cc..5cc81fe 100644
--- a/ffmpeg-mt/libavcodec/rectangle.h
+++ b/ffmpeg-mt/libavcodec/rectangle.h
@@ -2,20 +2,20 @@
  * rectangle filling function
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/remove_extradata_bsf.c b/ffmpeg-mt/libavcodec/remove_extradata_bsf.c
index 95bd98b..460482a 100644
--- a/ffmpeg-mt/libavcodec/remove_extradata_bsf.c
+++ b/ffmpeg-mt/libavcodec/remove_extradata_bsf.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -48,7 +48,7 @@ static int remove_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avct
     return 0;
 }
 
-AVBitStreamFilter remove_extradata_bsf={
+AVBitStreamFilter ff_remove_extradata_bsf={
     "remove_extra",
     0,
     remove_extradata,
diff --git a/ffmpeg-mt/libavcodec/resample.c b/ffmpeg-mt/libavcodec/resample.c
index 2728315..8e66689 100644
--- a/ffmpeg-mt/libavcodec/resample.c
+++ b/ffmpeg-mt/libavcodec/resample.c
@@ -2,20 +2,20 @@
  * samplerate conversion for both audio and video
  * Copyright (c) 2000 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 #include "avcodec.h"
 #include "audioconvert.h"
 #include "libavutil/opt.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/samplefmt.h"
 
 struct AVResampleContext;
 
diff --git a/ffmpeg-mt/libavcodec/resample2.c b/ffmpeg-mt/libavcodec/resample2.c
index b940059..7560d84 100644
--- a/ffmpeg-mt/libavcodec/resample2.c
+++ b/ffmpeg-mt/libavcodec/resample2.c
@@ -2,20 +2,20 @@
  * audio resampling
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rl.h b/ffmpeg-mt/libavcodec/rl.h
index b244589..9c1ad7a 100644
--- a/ffmpeg-mt/libavcodec/rl.h
+++ b/ffmpeg-mt/libavcodec/rl.h
@@ -2,20 +2,20 @@
  * Copyright (c) 2000-2002 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rl2.c b/ffmpeg-mt/libavcodec/rl2.c
index ba99fb9..3d1cea3 100644
--- a/ffmpeg-mt/libavcodec/rl2.c
+++ b/ffmpeg-mt/libavcodec/rl2.c
@@ -2,20 +2,20 @@
  * RL2 Video Decoder
  * Copyright (C) 2008 Sascha Sommer (saschasommer at freenet.de)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -219,7 +219,7 @@ static av_cold int rl2_decode_end(AVCodecContext *avctx)
 }
 
 
-AVCodec rl2_decoder = {
+AVCodec ff_rl2_decoder = {
     "rl2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RL2,
diff --git a/ffmpeg-mt/libavcodec/rle.c b/ffmpeg-mt/libavcodec/rle.c
index 6e468f8..8a009e7 100644
--- a/ffmpeg-mt/libavcodec/rle.c
+++ b/ffmpeg-mt/libavcodec/rle.c
@@ -2,20 +2,20 @@
  * RLE encoder
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avcodec.h"
diff --git a/ffmpeg-mt/libavcodec/rle.h b/ffmpeg-mt/libavcodec/rle.h
index 2485132..00261d3 100644
--- a/ffmpeg-mt/libavcodec/rle.h
+++ b/ffmpeg-mt/libavcodec/rle.h
@@ -1,20 +1,20 @@
 /*
  * RLE encoder
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/roqaudioenc.c b/ffmpeg-mt/libavcodec/roqaudioenc.c
index 229b546..46aefb4 100644
--- a/ffmpeg-mt/libavcodec/roqaudioenc.c
+++ b/ffmpeg-mt/libavcodec/roqaudioenc.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2005 Eric Lasota
  *    Based on RoQ specs (c)2001 Tim Ferguson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -153,7 +153,7 @@ static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec roq_dpcm_encoder = {
+AVCodec ff_roq_dpcm_encoder = {
     "roq_dpcm",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_ROQ_DPCM,
diff --git a/ffmpeg-mt/libavcodec/roqvideo.c b/ffmpeg-mt/libavcodec/roqvideo.c
index eb8fc25..77df079 100644
--- a/ffmpeg-mt/libavcodec/roqvideo.c
+++ b/ffmpeg-mt/libavcodec/roqvideo.c
@@ -2,20 +2,20 @@
  * Copyright (C) 2003 Mike Melanson
  * Copyright (C) 2003 Dr. Tim Ferguson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/roqvideo.h b/ffmpeg-mt/libavcodec/roqvideo.h
index 3fe11c6..a1ff10a 100644
--- a/ffmpeg-mt/libavcodec/roqvideo.h
+++ b/ffmpeg-mt/libavcodec/roqvideo.h
@@ -2,20 +2,20 @@
  * Copyright (C) 2003 Mike Melanson
  * Copyright (C) 2003 Dr. Tim Ferguson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/roqvideodec.c b/ffmpeg-mt/libavcodec/roqvideodec.c
index 7c6f5ff..06d1309 100644
--- a/ffmpeg-mt/libavcodec/roqvideodec.c
+++ b/ffmpeg-mt/libavcodec/roqvideodec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -210,7 +210,7 @@ static av_cold int roq_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec roq_decoder = {
+AVCodec ff_roq_decoder = {
     "roqvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ROQ,
diff --git a/ffmpeg-mt/libavcodec/roqvideoenc.c b/ffmpeg-mt/libavcodec/roqvideoenc.c
index 28fd9d8..052dcef 100644
--- a/ffmpeg-mt/libavcodec/roqvideoenc.c
+++ b/ffmpeg-mt/libavcodec/roqvideoenc.c
@@ -5,27 +5,27 @@
  * Copyright (C) 2004-2007 Eric Lasota
  *    Based on RoQ specs (C) 2001 Tim Ferguson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
  * @file
  * id RoQ encoder by Vitor. Based on the Switchblade3 library and the
- * Switchblade3 FFmpeg glue by Eric Lasota.
+ * Switchblade3 Libav glue by Eric Lasota.
  */
 
 /*
@@ -898,9 +898,20 @@ static void roq_encode_video(RoqContext *enc)
     for (i=0; i<enc->width*enc->height/64; i++)
         gather_data_for_cel(tempData->cel_evals + i, enc, tempData);
 
-    /* Quake 3 can't handle chunks bigger than 65536 bytes */
-    if (tempData->mainChunkSize/8 > 65536) {
-        enc->lambda *= .8;
+    /* Quake 3 can't handle chunks bigger than 65535 bytes */
+    if (tempData->mainChunkSize/8 > 65535) {
+        av_log(enc->avctx, AV_LOG_ERROR,
+               "Warning, generated a frame too big (%d > 65535), "
+               "try using a smaller qscale value.\n",
+               tempData->mainChunkSize/8);
+        enc->lambda *= 1.5;
+        tempData->mainChunkSize = 0;
+        memset(tempData->used_option, 0, sizeof(tempData->used_option));
+        memset(tempData->codebooks.usedCB4, 0,
+               sizeof(tempData->codebooks.usedCB4));
+        memset(tempData->codebooks.usedCB2, 0,
+               sizeof(tempData->codebooks.usedCB2));
+
         goto retry_encode;
     }
 
@@ -1054,7 +1065,7 @@ static int roq_encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec roq_encoder =
+AVCodec ff_roq_encoder =
 {
     "roqvideo",
     AVMEDIA_TYPE_VIDEO,
diff --git a/ffmpeg-mt/libavcodec/rpza.c b/ffmpeg-mt/libavcodec/rpza.c
index e103f52..958f103 100644
--- a/ffmpeg-mt/libavcodec/rpza.c
+++ b/ffmpeg-mt/libavcodec/rpza.c
@@ -2,20 +2,20 @@
  * Quicktime Video (RPZA) Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -275,7 +275,7 @@ static av_cold int rpza_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec rpza_decoder = {
+AVCodec ff_rpza_decoder = {
     "rpza",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RPZA,
diff --git a/ffmpeg-mt/libavcodec/rtjpeg.c b/ffmpeg-mt/libavcodec/rtjpeg.c
index 4c48f25..616c402 100644
--- a/ffmpeg-mt/libavcodec/rtjpeg.c
+++ b/ffmpeg-mt/libavcodec/rtjpeg.c
@@ -2,20 +2,20 @@
  * RTJpeg decoding functions
  * Copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "libavutil/common.h"
diff --git a/ffmpeg-mt/libavcodec/rtjpeg.h b/ffmpeg-mt/libavcodec/rtjpeg.h
index 4bcb9f7..d537c93 100644
--- a/ffmpeg-mt/libavcodec/rtjpeg.h
+++ b/ffmpeg-mt/libavcodec/rtjpeg.h
@@ -2,20 +2,20 @@
  * RTJpeg decoding functions
  * copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv10.c b/ffmpeg-mt/libavcodec/rv10.c
index b6d87f4..5df162b 100644
--- a/ffmpeg-mt/libavcodec/rv10.c
+++ b/ffmpeg-mt/libavcodec/rv10.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
  * RV10/RV20 decoder
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
@@ -246,7 +246,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
     if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
     pb_frame = get_bits1(&s->gb);
 
-    dprintf(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
+    av_dlog(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
 
     if (pb_frame){
         av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n");
@@ -265,7 +265,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
             s->last_dc[0] = get_bits(&s->gb, 8);
             s->last_dc[1] = get_bits(&s->gb, 8);
             s->last_dc[2] = get_bits(&s->gb, 8);
-            dprintf(s->avctx, "DC:%d %d %d\n", s->last_dc[0],
+            av_dlog(s->avctx, "DC:%d %d %d\n", s->last_dc[0],
                     s->last_dc[1], s->last_dc[2]);
         }
     }
@@ -561,7 +561,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
         ff_er_frame_start(s);
     }
 
-    dprintf(avctx, "qscale=%d\n", s->qscale);
+    av_dlog(avctx, "qscale=%d\n", s->qscale);
 
     /* default quantization values */
     if(s->codec_id== CODEC_ID_RV10){
@@ -600,7 +600,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
     for(s->mb_num_left= mb_count; s->mb_num_left>0; s->mb_num_left--) {
         int ret;
         ff_update_block_index(s);
-        dprintf(avctx, "**mb x=%d y=%d\n", s->mb_x, s->mb_y);
+        av_dlog(avctx, "**mb x=%d y=%d\n", s->mb_x, s->mb_y);
 
         s->mv_dir = MV_DIR_FORWARD;
         s->mv_type = MV_TYPE_16X16;
@@ -655,7 +655,7 @@ static int rv10_decode_frame(AVCodecContext *avctx,
     int slice_count;
     const uint8_t *slices_hdr = NULL;
 
-    dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
+    av_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
 
     /* no supplementary picture */
     if (buf_size == 0) {
@@ -707,7 +707,7 @@ static int rv10_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-AVCodec rv10_decoder = {
+AVCodec ff_rv10_decoder = {
     "rv10",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RV10,
@@ -722,7 +722,7 @@ AVCodec rv10_decoder = {
     .pix_fmts= ff_pixfmt_list_420,
 };
 
-AVCodec rv20_decoder = {
+AVCodec ff_rv20_decoder = {
     "rv20",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RV20,
diff --git a/ffmpeg-mt/libavcodec/rv10enc.c b/ffmpeg-mt/libavcodec/rv10enc.c
index 51ca691..1830b35 100644
--- a/ffmpeg-mt/libavcodec/rv10enc.c
+++ b/ffmpeg-mt/libavcodec/rv10enc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -56,7 +56,7 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
     put_bits(&s->pb, 3, 0);     /* ignored */
 }
 
-AVCodec rv10_encoder = {
+AVCodec ff_rv10_encoder = {
     "rv10",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RV10,
diff --git a/ffmpeg-mt/libavcodec/rv20enc.c b/ffmpeg-mt/libavcodec/rv20enc.c
index a31a351..dbce0b3 100644
--- a/ffmpeg-mt/libavcodec/rv20enc.c
+++ b/ffmpeg-mt/libavcodec/rv20enc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000,2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -57,7 +57,7 @@ void rv20_encode_picture_header(MpegEncContext *s, int picture_number){
     }
 }
 
-AVCodec rv20_encoder = {
+AVCodec ff_rv20_encoder = {
     "rv20",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RV20,
diff --git a/ffmpeg-mt/libavcodec/rv30.c b/ffmpeg-mt/libavcodec/rv30.c
index 22a5dd5..b4a52e0 100644
--- a/ffmpeg-mt/libavcodec/rv30.c
+++ b/ffmpeg-mt/libavcodec/rv30.c
@@ -2,20 +2,20 @@
  * RV30 decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -266,7 +266,7 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec rv30_decoder = {
+AVCodec ff_rv30_decoder = {
     "rv30",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RV30,
diff --git a/ffmpeg-mt/libavcodec/rv30data.h b/ffmpeg-mt/libavcodec/rv30data.h
index 9cc48a6..5ee3048 100644
--- a/ffmpeg-mt/libavcodec/rv30data.h
+++ b/ffmpeg-mt/libavcodec/rv30data.h
@@ -2,20 +2,20 @@
  * RealVideo 3 decoder
  * copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv30dsp.c b/ffmpeg-mt/libavcodec/rv30dsp.c
index 4700e78..c6e0614 100644
--- a/ffmpeg-mt/libavcodec/rv30dsp.c
+++ b/ffmpeg-mt/libavcodec/rv30dsp.c
@@ -2,20 +2,20 @@
  * RV30 decoder motion compensation functions
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv34.c b/ffmpeg-mt/libavcodec/rv34.c
index b586aa0..8122b66 100644
--- a/ffmpeg-mt/libavcodec/rv34.c
+++ b/ffmpeg-mt/libavcodec/rv34.c
@@ -2,20 +2,20 @@
  * RV30/40 decoder common data
  * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -718,12 +718,12 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
         uint8_t *uvbuf= s->edge_emu_buffer + 22 * s->linesize;
 
         srcY -= 2 + 2*s->linesize;
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6,
                             src_x - 2, src_y - 2, s->h_edge_pos, s->v_edge_pos);
         srcY = s->edge_emu_buffer + 2 + 2*s->linesize;
-        ff_emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1,
+        s->dsp.emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1,
+        s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
         srcU = uvbuf;
         srcV = uvbuf + 16;
@@ -1454,15 +1454,19 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
     }
     if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
         return -1;
+#if FF_API_HURRY_UP
     /* skip b frames if we are in a hurry */
     if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
+#endif
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)
        || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE)
        ||  avctx->skip_frame >= AVDISCARD_ALL)
         return buf_size;
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5)
         return buf_size;
+#endif
 
     for(i=0; i<slice_count; i++){
         int offset= get_slice_offset(avctx, slices_hdr, i);
diff --git a/ffmpeg-mt/libavcodec/rv34.h b/ffmpeg-mt/libavcodec/rv34.h
index 24a27ce..c9f4ff7 100644
--- a/ffmpeg-mt/libavcodec/rv34.h
+++ b/ffmpeg-mt/libavcodec/rv34.h
@@ -2,20 +2,20 @@
  * RV30/40 decoder common data declarations
  * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv34data.h b/ffmpeg-mt/libavcodec/rv34data.h
index 2155084..f8f941d 100644
--- a/ffmpeg-mt/libavcodec/rv34data.h
+++ b/ffmpeg-mt/libavcodec/rv34data.h
@@ -2,20 +2,20 @@
  * RealVideo 4 decoder
  * copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv34vlc.h b/ffmpeg-mt/libavcodec/rv34vlc.h
index aa29357..f4670c1 100644
--- a/ffmpeg-mt/libavcodec/rv34vlc.h
+++ b/ffmpeg-mt/libavcodec/rv34vlc.h
@@ -2,20 +2,20 @@
  * RealVideo 3/4 decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv40.c b/ffmpeg-mt/libavcodec/rv40.c
index e236c8f..ea6c3c1 100644
--- a/ffmpeg-mt/libavcodec/rv40.c
+++ b/ffmpeg-mt/libavcodec/rv40.c
@@ -2,20 +2,20 @@
  * RV40 decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,7 +24,7 @@
  * RV40 decoder
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 #include "avcodec.h"
 #include "dsputil.h"
@@ -668,7 +668,7 @@ static av_cold int rv40_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec rv40_decoder = {
+AVCodec ff_rv40_decoder = {
     "rv40",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_RV40,
diff --git a/ffmpeg-mt/libavcodec/rv40data.h b/ffmpeg-mt/libavcodec/rv40data.h
index 7912919..4787075 100644
--- a/ffmpeg-mt/libavcodec/rv40data.h
+++ b/ffmpeg-mt/libavcodec/rv40data.h
@@ -2,20 +2,20 @@
  * RealVideo 4 decoder
  * copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv40dsp.c b/ffmpeg-mt/libavcodec/rv40dsp.c
index 27bc79e..2271f54 100644
--- a/ffmpeg-mt/libavcodec/rv40dsp.c
+++ b/ffmpeg-mt/libavcodec/rv40dsp.c
@@ -2,20 +2,20 @@
  * RV40 decoder motion compensation functions
  * Copyright (c) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/rv40vlc2.h b/ffmpeg-mt/libavcodec/rv40vlc2.h
index 15119a1..2f63fc2 100644
--- a/ffmpeg-mt/libavcodec/rv40vlc2.h
+++ b/ffmpeg-mt/libavcodec/rv40vlc2.h
@@ -2,20 +2,20 @@
  * RealVideo 4 decoder
  * copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/s3tc.c b/ffmpeg-mt/libavcodec/s3tc.c
index 546ee21..e8ca688 100644
--- a/ffmpeg-mt/libavcodec/s3tc.c
+++ b/ffmpeg-mt/libavcodec/s3tc.c
@@ -4,20 +4,20 @@
  *
  * see also: http://wiki.multimedia.cx/index.php?title=S3TC
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/s3tc.h b/ffmpeg-mt/libavcodec/s3tc.h
index 4919c07..45da6fa 100644
--- a/ffmpeg-mt/libavcodec/s3tc.h
+++ b/ffmpeg-mt/libavcodec/s3tc.h
@@ -2,20 +2,20 @@
  * S3 Texture Compression (S3TC) decoding functions
  * Copyright (c) 2007 by Ivo van Poorten
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sbr.h b/ffmpeg-mt/libavcodec/sbr.h
index 82a996f..cbf3e23 100644
--- a/ffmpeg-mt/libavcodec/sbr.h
+++ b/ffmpeg-mt/libavcodec/sbr.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
  * Copyright (c) 2010      Alex Converse <alex.converse at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sgi.h b/ffmpeg-mt/libavcodec/sgi.h
index be17f2e..ca531f0 100644
--- a/ffmpeg-mt/libavcodec/sgi.h
+++ b/ffmpeg-mt/libavcodec/sgi.h
@@ -2,20 +2,20 @@
  * SGI image encoder
  * Xiaohui Sun <tjnksxh at hotmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sgidec.c b/ffmpeg-mt/libavcodec/sgidec.c
index 3c199e2..49f79b6 100644
--- a/ffmpeg-mt/libavcodec/sgidec.c
+++ b/ffmpeg-mt/libavcodec/sgidec.c
@@ -2,24 +2,24 @@
  * SGI image decoder
  * Todd Kirby <doubleshot at pacbell.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "sgi.h"
@@ -259,7 +259,7 @@ static av_cold int sgi_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec sgi_decoder = {
+AVCodec ff_sgi_decoder = {
     "sgi",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SGI,
diff --git a/ffmpeg-mt/libavcodec/sgienc.c b/ffmpeg-mt/libavcodec/sgienc.c
index f9f3709..805935b 100644
--- a/ffmpeg-mt/libavcodec/sgienc.c
+++ b/ffmpeg-mt/libavcodec/sgienc.c
@@ -2,20 +2,20 @@
  * SGI image encoder
  * Todd Kirby <doubleshot at pacbell.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -159,7 +159,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
     return buf - orig_buf;
 }
 
-AVCodec sgi_encoder = {
+AVCodec ff_sgi_encoder = {
     "sgi",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SGI,
diff --git a/ffmpeg-mt/libavcodec/sh4/dsputil_align.c b/ffmpeg-mt/libavcodec/sh4/dsputil_align.c
index 9e7efde..7a8d60d 100644
--- a/ffmpeg-mt/libavcodec/sh4/dsputil_align.c
+++ b/ffmpeg-mt/libavcodec/sh4/dsputil_align.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2001-2003 BERO <bero at geocities.co.jp>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.c b/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.c
index ec06e24..0c724c3 100644
--- a/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.c
+++ b/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2003 BERO <bero at geocities.co.jp>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.h b/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.h
index 2c1f77c..1a8b7af 100644
--- a/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.h
+++ b/ffmpeg-mt/libavcodec/sh4/dsputil_sh4.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sh4/idct_sh4.c b/ffmpeg-mt/libavcodec/sh4/idct_sh4.c
index 8d1a316..0758cd9 100644
--- a/ffmpeg-mt/libavcodec/sh4/idct_sh4.c
+++ b/ffmpeg-mt/libavcodec/sh4/idct_sh4.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2001-2003 BERO <bero at geocities.co.jp>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sh4/qpel.c b/ffmpeg-mt/libavcodec/sh4/qpel.c
index 917068d..ff88b76 100644
--- a/ffmpeg-mt/libavcodec/sh4/qpel.c
+++ b/ffmpeg-mt/libavcodec/sh4/qpel.c
@@ -4,20 +4,20 @@
  *
  * copyright (c) 2001-2003 BERO <bero at geocities.co.jp>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sh4/sh4.h b/ffmpeg-mt/libavcodec/sh4/sh4.h
index 5d46540..acd12e6 100644
--- a/ffmpeg-mt/libavcodec/sh4/sh4.h
+++ b/ffmpeg-mt/libavcodec/sh4/sh4.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/shorten.c b/ffmpeg-mt/libavcodec/shorten.c
index f61c263..f19f0fe 100644
--- a/ffmpeg-mt/libavcodec/shorten.c
+++ b/ffmpeg-mt/libavcodec/shorten.c
@@ -2,20 +2,20 @@
  * Shorten decoder
  * Copyright (c) 2005 Jeff Muizelaar
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -305,7 +305,7 @@ static int shorten_decode_frame(AVCodecContext *avctx,
         s->bitstream_size= buf_size;
 
         if(buf_size < s->max_framesize){
-            //dprintf(avctx, "wanna more data ... %d\n", buf_size);
+            //av_dlog(avctx, "wanna more data ... %d\n", buf_size);
             *data_size = 0;
             return input_buf_size;
         }
@@ -541,7 +541,7 @@ static void shorten_flush(AVCodecContext *avctx){
         s->bitstream_index= 0;
 }
 
-AVCodec shorten_decoder = {
+AVCodec ff_shorten_decoder = {
     "shorten",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_SHORTEN,
diff --git a/ffmpeg-mt/libavcodec/simple_idct.c b/ffmpeg-mt/libavcodec/simple_idct.c
index 475be6d..4af11be 100644
--- a/ffmpeg-mt/libavcodec/simple_idct.c
+++ b/ffmpeg-mt/libavcodec/simple_idct.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/simple_idct.h b/ffmpeg-mt/libavcodec/simple_idct.h
index 24f6a6d..23bae9c 100644
--- a/ffmpeg-mt/libavcodec/simple_idct.h
+++ b/ffmpeg-mt/libavcodec/simple_idct.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sinewin.c b/ffmpeg-mt/libavcodec/sinewin.c
new file mode 100644
index 0000000..be38dbc
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/sinewin.c
@@ -0,0 +1,20 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "sinewin.h"
+#include "sinewin_tablegen.h"
diff --git a/ffmpeg-mt/libavcodec/sinewin.h b/ffmpeg-mt/libavcodec/sinewin.h
new file mode 100644
index 0000000..2ed386a
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/sinewin.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2008 Robert Swain
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_SINEWIN_H
+#define AVCODEC_SINEWIN_H
+
+#include "config.h"
+#include "libavutil/mem.h"
+
+#if CONFIG_HARDCODED_TABLES
+#   define SINETABLE_CONST const
+#else
+#   define SINETABLE_CONST
+#endif
+
+#define SINETABLE(size) \
+    SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size]
+
+/**
+ * Generate a sine window.
+ * @param   window  pointer to half window
+ * @param   n       size of half window
+ */
+void ff_sine_window_init(float *window, int n);
+
+/**
+ * initialize the specified entry of ff_sine_windows
+ */
+void ff_init_ff_sine_windows(int index);
+
+extern SINETABLE(  32);
+extern SINETABLE(  64);
+extern SINETABLE( 128);
+extern SINETABLE( 256);
+extern SINETABLE( 512);
+extern SINETABLE(1024);
+extern SINETABLE(2048);
+extern SINETABLE(4096);
+
+extern SINETABLE_CONST float * const ff_sine_windows[13];
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/sinewin_tablegen.c b/ffmpeg-mt/libavcodec/sinewin_tablegen.c
new file mode 100644
index 0000000..2f4d1aa
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/sinewin_tablegen.c
@@ -0,0 +1,49 @@
+/*
+ * Generate a header file for hardcoded sine windows
+ *
+ * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdlib.h>
+#define CONFIG_HARDCODED_TABLES 0
+#define SINETABLE_CONST
+#define SINETABLE(size) \
+    float ff_sine_##size[size]
+#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#include "sinewin_tablegen.h"
+#include "tableprint.h"
+
+int main(void)
+{
+    int i;
+
+    write_fileheader();
+
+    for (i = 5; i <= 12; i++) {
+        ff_init_ff_sine_windows(i);
+        printf("SINETABLE(%4i) = {\n", 1 << i);
+        write_float_array(ff_sine_windows[i], 1 << i);
+        printf("};\n");
+    }
+
+    return 0;
+}
diff --git a/ffmpeg-mt/libavcodec/sinewin_tablegen.h b/ffmpeg-mt/libavcodec/sinewin_tablegen.h
new file mode 100644
index 0000000..91c26c1
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/sinewin_tablegen.h
@@ -0,0 +1,60 @@
+/*
+ * Header file for hardcoded sine windows
+ *
+ * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <assert.h>
+// do not use libavutil/libm.h since this is compiled both
+// for the host and the target and config.h is only valid for the target
+#include <math.h>
+#include "libavutil/attributes.h"
+
+#if !CONFIG_HARDCODED_TABLES
+SINETABLE(  32);
+SINETABLE(  64);
+SINETABLE( 128);
+SINETABLE( 256);
+SINETABLE( 512);
+SINETABLE(1024);
+SINETABLE(2048);
+SINETABLE(4096);
+#else
+#include "libavcodec/sinewin_tables.h"
+#endif
+
+SINETABLE_CONST float * const ff_sine_windows[] = {
+    NULL, NULL, NULL, NULL, NULL, // unused
+    ff_sine_32 , ff_sine_64 ,
+    ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
+};
+
+// Generate a sine window.
+av_cold void ff_sine_window_init(float *window, int n) {
+    int i;
+    for(i = 0; i < n; i++)
+        window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
+}
+
+av_cold void ff_init_ff_sine_windows(int index) {
+    assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows));
+#if !CONFIG_HARDCODED_TABLES
+    ff_sine_window_init(ff_sine_windows[index], 1 << index);
+#endif
+}
diff --git a/ffmpeg-mt/libavcodec/sipr.c b/ffmpeg-mt/libavcodec/sipr.c
index 0822456..17e7e85 100644
--- a/ffmpeg-mt/libavcodec/sipr.c
+++ b/ffmpeg-mt/libavcodec/sipr.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2008 Vladimir Voroshilov
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -549,7 +549,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap,
     return mode_par->bits_per_frame >> 3;
 }
 
-AVCodec sipr_decoder = {
+AVCodec ff_sipr_decoder = {
     "sipr",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_SIPR,
diff --git a/ffmpeg-mt/libavcodec/sipr.h b/ffmpeg-mt/libavcodec/sipr.h
index 66e7696..33984b1 100644
--- a/ffmpeg-mt/libavcodec/sipr.h
+++ b/ffmpeg-mt/libavcodec/sipr.h
@@ -4,20 +4,20 @@
  * Copyright (c) 2008 Vladimir Voroshilov
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sipr16k.c b/ffmpeg-mt/libavcodec/sipr16k.c
index 7fb9252..ca10cd9 100644
--- a/ffmpeg-mt/libavcodec/sipr16k.c
+++ b/ffmpeg-mt/libavcodec/sipr16k.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2008 Vladimir Voroshilov
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sipr16kdata.h b/ffmpeg-mt/libavcodec/sipr16kdata.h
index 96bf0e9..ec60c29 100644
--- a/ffmpeg-mt/libavcodec/sipr16kdata.h
+++ b/ffmpeg-mt/libavcodec/sipr16kdata.h
@@ -4,20 +4,20 @@
  * Copyright (c) 2008 Vladimir Voroshilov
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/siprdata.h b/ffmpeg-mt/libavcodec/siprdata.h
index ed804ee..92037a4 100644
--- a/ffmpeg-mt/libavcodec/siprdata.h
+++ b/ffmpeg-mt/libavcodec/siprdata.h
@@ -4,20 +4,20 @@
  * Copyright (c) 2008 Vladimir Voroshilov
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/smacker.c b/ffmpeg-mt/libavcodec/smacker.c
index 38ca61c..3a97b72 100644
--- a/ffmpeg-mt/libavcodec/smacker.c
+++ b/ffmpeg-mt/libavcodec/smacker.c
@@ -2,20 +2,20 @@
  * Smacker decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 
 #include "avcodec.h"
+#include "libavutil/audioconvert.h"
 
 #define ALT_BITSTREAM_READER_LE
 #include "get_bits.h"
@@ -167,7 +168,7 @@ static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx
 }
 
 /**
- * Store large tree as FFmpeg's vlc codes
+ * Store large tree as Libav's vlc codes
  */
 static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int **recodes, int *last, int size)
 {
@@ -554,7 +555,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
 
 static av_cold int smka_decode_init(AVCodecContext *avctx)
 {
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+    avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
     avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16;
     return 0;
 }
@@ -677,19 +678,16 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     for(i = 0; i < 4; i++) {
         if(vlc[i].table)
             free_vlc(&vlc[i]);
-        if(h[i].bits)
-            av_free(h[i].bits);
-        if(h[i].lengths)
-            av_free(h[i].lengths);
-        if(h[i].values)
-            av_free(h[i].values);
+        av_free(h[i].bits);
+        av_free(h[i].lengths);
+        av_free(h[i].values);
     }
 
     *data_size = unp_size;
     return buf_size;
 }
 
-AVCodec smacker_decoder = {
+AVCodec ff_smacker_decoder = {
     "smackvid",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SMACKVIDEO,
@@ -702,7 +700,7 @@ AVCodec smacker_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("Smacker video"),
 };
 
-AVCodec smackaud_decoder = {
+AVCodec ff_smackaud_decoder = {
     "smackaud",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_SMACKAUDIO,
diff --git a/ffmpeg-mt/libavcodec/smc.c b/ffmpeg-mt/libavcodec/smc.c
index 2e2dffd..fe92b43 100644
--- a/ffmpeg-mt/libavcodec/smc.c
+++ b/ffmpeg-mt/libavcodec/smc.c
@@ -2,20 +2,20 @@
  * Quicktime Graphics (SMC) Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -471,7 +471,7 @@ static av_cold int smc_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec smc_decoder = {
+AVCodec ff_smc_decoder = {
     "smc",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SMC,
diff --git a/ffmpeg-mt/libavcodec/snow.c b/ffmpeg-mt/libavcodec/snow.c
index a8fd15a..42145f5 100644
--- a/ffmpeg-mt/libavcodec/snow.c
+++ b/ffmpeg-mt/libavcodec/snow.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -1171,7 +1171,7 @@ static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, i
         src += sx + sy*stride;
         if(   (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
            || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
-            ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
+            s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
             src= tmp + MB_SIZE;
         }
 //        assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h);
@@ -1976,9 +1976,15 @@ static int frame_start(SnowContext *s){
    int h= s->avctx->height;
 
     if(s->current_picture.data[0]){
-        s->dsp.draw_edges(s->current_picture.data[0], s->current_picture.linesize[0], w   , h   , EDGE_WIDTH  , EDGE_TOP|EDGE_BOTTOM);
-        s->dsp.draw_edges(s->current_picture.data[1], s->current_picture.linesize[1], w>>1, h>>1, EDGE_WIDTH/2, EDGE_TOP|EDGE_BOTTOM);
-        s->dsp.draw_edges(s->current_picture.data[2], s->current_picture.linesize[2], w>>1, h>>1, EDGE_WIDTH/2, EDGE_TOP|EDGE_BOTTOM);
+        s->dsp.draw_edges(s->current_picture.data[0],
+                          s->current_picture.linesize[0], w   , h   ,
+                          EDGE_WIDTH  , EDGE_TOP | EDGE_BOTTOM);
+        s->dsp.draw_edges(s->current_picture.data[1],
+                          s->current_picture.linesize[1], w>>1, h>>1,
+                          EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
+        s->dsp.draw_edges(s->current_picture.data[2],
+                          s->current_picture.linesize[2], w>>1, h>>1,
+                          EDGE_WIDTH/2, EDGE_TOP | EDGE_BOTTOM);
     }
 
     release_buffer(s->avctx);
@@ -2234,7 +2240,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec snow_decoder = {
+AVCodec ff_snow_decoder = {
     "snow",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SNOW,
@@ -3985,7 +3991,7 @@ static av_cold int encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec snow_encoder = {
+AVCodec ff_snow_encoder = {
     "snow",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SNOW,
diff --git a/ffmpeg-mt/libavcodec/snow.h b/ffmpeg-mt/libavcodec/snow.h
index 7d847e4..db61b87 100644
--- a/ffmpeg-mt/libavcodec/snow.h
+++ b/ffmpeg-mt/libavcodec/snow.h
@@ -2,20 +2,20 @@
  * Copyright (C) 2004 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (C) 2006 Robert Edele <yartrebo at earthlink.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sonic.c b/ffmpeg-mt/libavcodec/sonic.c
deleted file mode 100644
index aff155d..0000000
--- a/ffmpeg-mt/libavcodec/sonic.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * Simple free lossless/lossy audio codec
- * Copyright (c) 2004 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-
-/**
- * @file
- * Simple free lossless/lossy audio codec
- * Based on Paul Francis Harrison's Bonk (http://www.logarithmic.net/pfh/bonk)
- * Written and designed by Alex Beregszaszi
- *
- * TODO:
- *  - CABAC put/get_symbol
- *  - independent quantizer for channels
- *  - >2 channels support
- *  - more decorrelation types
- *  - more tap_quant tests
- *  - selectable intlist writers/readers (bonk-style, golomb, cabac)
- */
-
-#define MAX_CHANNELS 2
-
-#define MID_SIDE 0
-#define LEFT_SIDE 1
-#define RIGHT_SIDE 2
-
-typedef struct SonicContext {
-    int lossless, decorrelation;
-
-    int num_taps, downsampling;
-    double quantization;
-
-    int channels, samplerate, block_align, frame_size;
-
-    int *tap_quant;
-    int *int_samples;
-    int *coded_samples[MAX_CHANNELS];
-
-    // for encoding
-    int *tail;
-    int tail_size;
-    int *window;
-    int window_size;
-
-    // for decoding
-    int *predictor_k;
-    int *predictor_state[MAX_CHANNELS];
-} SonicContext;
-
-#define LATTICE_SHIFT   10
-#define SAMPLE_SHIFT    4
-#define LATTICE_FACTOR  (1 << LATTICE_SHIFT)
-#define SAMPLE_FACTOR   (1 << SAMPLE_SHIFT)
-
-#define BASE_QUANT      0.6
-#define RATE_VARIATION  3.0
-
-static inline int divide(int a, int b)
-{
-    if (a < 0)
-        return -( (-a + b/2)/b );
-    else
-        return (a + b/2)/b;
-}
-
-static inline int shift(int a,int b)
-{
-    return (a+(1<<(b-1))) >> b;
-}
-
-static inline int shift_down(int a,int b)
-{
-    return (a>>b)+((a<0)?1:0);
-}
-
-#if 1
-static inline int intlist_write(PutBitContext *pb, int *buf, int entries, int base_2_part)
-{
-    int i;
-
-    for (i = 0; i < entries; i++)
-        set_se_golomb(pb, buf[i]);
-
-    return 1;
-}
-
-static inline int intlist_read(GetBitContext *gb, int *buf, int entries, int base_2_part)
-{
-    int i;
-
-    for (i = 0; i < entries; i++)
-        buf[i] = get_se_golomb(gb);
-
-    return 1;
-}
-
-#else
-
-#define ADAPT_LEVEL 8
-
-static int bits_to_store(uint64_t x)
-{
-    int res = 0;
-
-    while(x)
-    {
-        res++;
-        x >>= 1;
-    }
-    return res;
-}
-
-static void write_uint_max(PutBitContext *pb, unsigned int value, unsigned int max)
-{
-    int i, bits;
-
-    if (!max)
-        return;
-
-    bits = bits_to_store(max);
-
-    for (i = 0; i < bits-1; i++)
-        put_bits(pb, 1, value & (1 << i));
-
-    if ( (value | (1 << (bits-1))) <= max)
-        put_bits(pb, 1, value & (1 << (bits-1)));
-}
-
-static unsigned int read_uint_max(GetBitContext *gb, int max)
-{
-    int i, bits, value = 0;
-
-    if (!max)
-        return 0;
-
-    bits = bits_to_store(max);
-
-    for (i = 0; i < bits-1; i++)
-        if (get_bits1(gb))
-            value += 1 << i;
-
-    if ( (value | (1<<(bits-1))) <= max)
-        if (get_bits1(gb))
-            value += 1 << (bits-1);
-
-    return value;
-}
-
-static int intlist_write(PutBitContext *pb, int *buf, int entries, int base_2_part)
-{
-    int i, j, x = 0, low_bits = 0, max = 0;
-    int step = 256, pos = 0, dominant = 0, any = 0;
-    int *copy, *bits;
-
-    copy = av_mallocz(4* entries);
-    if (!copy)
-        return -1;
-
-    if (base_2_part)
-    {
-        int energy = 0;
-
-        for (i = 0; i < entries; i++)
-            energy += abs(buf[i]);
-
-        low_bits = bits_to_store(energy / (entries * 2));
-        if (low_bits > 15)
-            low_bits = 15;
-
-        put_bits(pb, 4, low_bits);
-    }
-
-    for (i = 0; i < entries; i++)
-    {
-        put_bits(pb, low_bits, abs(buf[i]));
-        copy[i] = abs(buf[i]) >> low_bits;
-        if (copy[i] > max)
-            max = abs(copy[i]);
-    }
-
-    bits = av_mallocz(4* entries*max);
-    if (!bits)
-    {
-//        av_free(copy);
-        return -1;
-    }
-
-    for (i = 0; i <= max; i++)
-    {
-        for (j = 0; j < entries; j++)
-            if (copy[j] >= i)
-                bits[x++] = copy[j] > i;
-    }
-
-    // store bitstream
-    while (pos < x)
-    {
-        int steplet = step >> 8;
-
-        if (pos + steplet > x)
-            steplet = x - pos;
-
-        for (i = 0; i < steplet; i++)
-            if (bits[i+pos] != dominant)
-                any = 1;
-
-        put_bits(pb, 1, any);
-
-        if (!any)
-        {
-            pos += steplet;
-            step += step / ADAPT_LEVEL;
-        }
-        else
-        {
-            int interloper = 0;
-
-            while (((pos + interloper) < x) && (bits[pos + interloper] == dominant))
-                interloper++;
-
-            // note change
-            write_uint_max(pb, interloper, (step >> 8) - 1);
-
-            pos += interloper + 1;
-            step -= step / ADAPT_LEVEL;
-        }
-
-        if (step < 256)
-        {
-            step = 65536 / step;
-            dominant = !dominant;
-        }
-    }
-
-    // store signs
-    for (i = 0; i < entries; i++)
-        if (buf[i])
-            put_bits(pb, 1, buf[i] < 0);
-
-//    av_free(bits);
-//    av_free(copy);
-
-    return 0;
-}
-
-static int intlist_read(GetBitContext *gb, int *buf, int entries, int base_2_part)
-{
-    int i, low_bits = 0, x = 0;
-    int n_zeros = 0, step = 256, dominant = 0;
-    int pos = 0, level = 0;
-    int *bits = av_mallocz(4* entries);
-
-    if (!bits)
-        return -1;
-
-    if (base_2_part)
-    {
-        low_bits = get_bits(gb, 4);
-
-        if (low_bits)
-            for (i = 0; i < entries; i++)
-                buf[i] = get_bits(gb, low_bits);
-    }
-
-//    av_log(NULL, AV_LOG_INFO, "entries: %d, low bits: %d\n", entries, low_bits);
-
-    while (n_zeros < entries)
-    {
-        int steplet = step >> 8;
-
-        if (!get_bits1(gb))
-        {
-            for (i = 0; i < steplet; i++)
-                bits[x++] = dominant;
-
-            if (!dominant)
-                n_zeros += steplet;
-
-            step += step / ADAPT_LEVEL;
-        }
-        else
-        {
-            int actual_run = read_uint_max(gb, steplet-1);
-
-//            av_log(NULL, AV_LOG_INFO, "actual run: %d\n", actual_run);
-
-            for (i = 0; i < actual_run; i++)
-                bits[x++] = dominant;
-
-            bits[x++] = !dominant;
-
-            if (!dominant)
-                n_zeros += actual_run;
-            else
-                n_zeros++;
-
-            step -= step / ADAPT_LEVEL;
-        }
-
-        if (step < 256)
-        {
-            step = 65536 / step;
-            dominant = !dominant;
-        }
-    }
-
-    // reconstruct unsigned values
-    n_zeros = 0;
-    for (i = 0; n_zeros < entries; i++)
-    {
-        while(1)
-        {
-            if (pos >= entries)
-            {
-                pos = 0;
-                level += 1 << low_bits;
-            }
-
-            if (buf[pos] >= level)
-                break;
-
-            pos++;
-        }
-
-        if (bits[i])
-            buf[pos] += 1 << low_bits;
-        else
-            n_zeros++;
-
-        pos++;
-    }
-//    av_free(bits);
-
-    // read signs
-    for (i = 0; i < entries; i++)
-        if (buf[i] && get_bits1(gb))
-            buf[i] = -buf[i];
-
-//    av_log(NULL, AV_LOG_INFO, "zeros: %d pos: %d\n", n_zeros, pos);
-
-    return 0;
-}
-#endif
-
-static void predictor_init_state(int *k, int *state, int order)
-{
-    int i;
-
-    for (i = order-2; i >= 0; i--)
-    {
-        int j, p, x = state[i];
-
-        for (j = 0, p = i+1; p < order; j++,p++)
-            {
-            int tmp = x + shift_down(k[j] * state[p], LATTICE_SHIFT);
-            state[p] += shift_down(k[j]*x, LATTICE_SHIFT);
-            x = tmp;
-        }
-    }
-}
-
-static int predictor_calc_error(int *k, int *state, int order, int error)
-{
-    int i, x = error - shift_down(k[order-1] * state[order-1], LATTICE_SHIFT);
-
-#if 1
-    int *k_ptr = &(k[order-2]),
-        *state_ptr = &(state[order-2]);
-    for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--)
-    {
-        int k_value = *k_ptr, state_value = *state_ptr;
-        x -= shift_down(k_value * state_value, LATTICE_SHIFT);
-        state_ptr[1] = state_value + shift_down(k_value * x, LATTICE_SHIFT);
-    }
-#else
-    for (i = order-2; i >= 0; i--)
-    {
-        x -= shift_down(k[i] * state[i], LATTICE_SHIFT);
-        state[i+1] = state[i] + shift_down(k[i] * x, LATTICE_SHIFT);
-    }
-#endif
-
-    // don't drift too far, to avoid overflows
-    if (x >  (SAMPLE_FACTOR<<16)) x =  (SAMPLE_FACTOR<<16);
-    if (x < -(SAMPLE_FACTOR<<16)) x = -(SAMPLE_FACTOR<<16);
-
-    state[0] = x;
-
-    return x;
-}
-
-#if CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER
-// Heavily modified Levinson-Durbin algorithm which
-// copes better with quantization, and calculates the
-// actual whitened result as it goes.
-
-static void modified_levinson_durbin(int *window, int window_entries,
-        int *out, int out_entries, int channels, int *tap_quant)
-{
-    int i;
-    int *state = av_mallocz(4* window_entries);
-
-    memcpy(state, window, 4* window_entries);
-
-    for (i = 0; i < out_entries; i++)
-    {
-        int step = (i+1)*channels, k, j;
-        double xx = 0.0, xy = 0.0;
-#if 1
-        int *x_ptr = &(window[step]), *state_ptr = &(state[0]);
-        j = window_entries - step;
-        for (;j>=0;j--,x_ptr++,state_ptr++)
-        {
-            double x_value = *x_ptr, state_value = *state_ptr;
-            xx += state_value*state_value;
-            xy += x_value*state_value;
-        }
-#else
-        for (j = 0; j <= (window_entries - step); j++);
-        {
-            double stepval = window[step+j], stateval = window[j];
-//            xx += (double)window[j]*(double)window[j];
-//            xy += (double)window[step+j]*(double)window[j];
-            xx += stateval*stateval;
-            xy += stepval*stateval;
-        }
-#endif
-        if (xx == 0.0)
-            k = 0;
-        else
-            k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5));
-
-        if (k > (LATTICE_FACTOR/tap_quant[i]))
-            k = LATTICE_FACTOR/tap_quant[i];
-        if (-k > (LATTICE_FACTOR/tap_quant[i]))
-            k = -(LATTICE_FACTOR/tap_quant[i]);
-
-        out[i] = k;
-        k *= tap_quant[i];
-
-#if 1
-        x_ptr = &(window[step]);
-        state_ptr = &(state[0]);
-        j = window_entries - step;
-        for (;j>=0;j--,x_ptr++,state_ptr++)
-        {
-            int x_value = *x_ptr, state_value = *state_ptr;
-            *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT);
-            *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT);
-        }
-#else
-        for (j=0; j <= (window_entries - step); j++)
-        {
-            int stepval = window[step+j], stateval=state[j];
-            window[step+j] += shift_down(k * stateval, LATTICE_SHIFT);
-            state[j] += shift_down(k * stepval, LATTICE_SHIFT);
-        }
-#endif
-    }
-
-    av_free(state);
-}
-
-static inline int code_samplerate(int samplerate)
-{
-    switch (samplerate)
-    {
-        case 44100: return 0;
-        case 22050: return 1;
-        case 11025: return 2;
-        case 96000: return 3;
-        case 48000: return 4;
-        case 32000: return 5;
-        case 24000: return 6;
-        case 16000: return 7;
-        case 8000: return 8;
-    }
-    return -1;
-}
-
-static av_cold int sonic_encode_init(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    PutBitContext pb;
-    int i, version = 0;
-
-    if (avctx->channels > MAX_CHANNELS)
-    {
-        av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
-        return -1; /* only stereo or mono for now */
-    }
-
-    if (avctx->channels == 2)
-        s->decorrelation = MID_SIDE;
-
-    if (avctx->codec->id == CODEC_ID_SONIC_LS)
-    {
-        s->lossless = 1;
-        s->num_taps = 32;
-        s->downsampling = 1;
-        s->quantization = 0.0;
-    }
-    else
-    {
-        s->num_taps = 128;
-        s->downsampling = 2;
-        s->quantization = 1.0;
-    }
-
-    // max tap 2048
-    if ((s->num_taps < 32) || (s->num_taps > 1024) ||
-        ((s->num_taps>>5)<<5 != s->num_taps))
-    {
-        av_log(avctx, AV_LOG_ERROR, "Invalid number of taps\n");
-        return -1;
-    }
-
-    // generate taps
-    s->tap_quant = av_mallocz(4* s->num_taps);
-    for (i = 0; i < s->num_taps; i++)
-        s->tap_quant[i] = (int)(sqrt(i+1));
-
-    s->channels = avctx->channels;
-    s->samplerate = avctx->sample_rate;
-
-    s->block_align = (int)(2048.0*s->samplerate/44100)/s->downsampling;
-    s->frame_size = s->channels*s->block_align*s->downsampling;
-
-    s->tail = av_mallocz(4* s->num_taps*s->channels);
-    if (!s->tail)
-        return -1;
-    s->tail_size = s->num_taps*s->channels;
-
-    s->predictor_k = av_mallocz(4 * s->num_taps);
-    if (!s->predictor_k)
-        return -1;
-
-    for (i = 0; i < s->channels; i++)
-    {
-        s->coded_samples[i] = av_mallocz(4* s->block_align);
-        if (!s->coded_samples[i])
-            return -1;
-    }
-
-    s->int_samples = av_mallocz(4* s->frame_size);
-
-    s->window_size = ((2*s->tail_size)+s->frame_size);
-    s->window = av_mallocz(4* s->window_size);
-    if (!s->window)
-        return -1;
-
-    avctx->extradata = av_mallocz(16);
-    if (!avctx->extradata)
-        return -1;
-    init_put_bits(&pb, avctx->extradata, 16*8);
-
-    put_bits(&pb, 2, version); // version
-    if (version == 1)
-    {
-        put_bits(&pb, 2, s->channels);
-        put_bits(&pb, 4, code_samplerate(s->samplerate));
-    }
-    put_bits(&pb, 1, s->lossless);
-    if (!s->lossless)
-        put_bits(&pb, 3, SAMPLE_SHIFT); // XXX FIXME: sample precision
-    put_bits(&pb, 2, s->decorrelation);
-    put_bits(&pb, 2, s->downsampling);
-    put_bits(&pb, 5, (s->num_taps >> 5)-1); // 32..1024
-    put_bits(&pb, 1, 0); // XXX FIXME: no custom tap quant table
-
-    flush_put_bits(&pb);
-    avctx->extradata_size = put_bits_count(&pb)/8;
-
-    av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
-        version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
-
-    avctx->coded_frame = avcodec_alloc_frame();
-    if (!avctx->coded_frame)
-        return AVERROR(ENOMEM);
-    avctx->coded_frame->key_frame = 1;
-    avctx->frame_size = s->block_align*s->downsampling;
-
-    return 0;
-}
-
-static av_cold int sonic_encode_close(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    int i;
-
-    av_freep(&avctx->coded_frame);
-
-    for (i = 0; i < s->channels; i++)
-        av_free(s->coded_samples[i]);
-
-    av_free(s->predictor_k);
-    av_free(s->tail);
-    av_free(s->tap_quant);
-    av_free(s->window);
-    av_free(s->int_samples);
-
-    return 0;
-}
-
-static int sonic_encode_frame(AVCodecContext *avctx,
-                            uint8_t *buf, int buf_size, void *data)
-{
-    SonicContext *s = avctx->priv_data;
-    PutBitContext pb;
-    int i, j, ch, quant = 0, x = 0;
-    short *samples = data;
-
-    init_put_bits(&pb, buf, buf_size*8);
-
-    // short -> internal
-    for (i = 0; i < s->frame_size; i++)
-        s->int_samples[i] = samples[i];
-
-    if (!s->lossless)
-        for (i = 0; i < s->frame_size; i++)
-            s->int_samples[i] = s->int_samples[i] << SAMPLE_SHIFT;
-
-    switch(s->decorrelation)
-    {
-        case MID_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-            {
-                s->int_samples[i] += s->int_samples[i+1];
-                s->int_samples[i+1] -= shift(s->int_samples[i], 1);
-            }
-            break;
-        case LEFT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i+1] -= s->int_samples[i];
-            break;
-        case RIGHT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i] -= s->int_samples[i+1];
-            break;
-    }
-
-    memset(s->window, 0, 4* s->window_size);
-
-    for (i = 0; i < s->tail_size; i++)
-        s->window[x++] = s->tail[i];
-
-    for (i = 0; i < s->frame_size; i++)
-        s->window[x++] = s->int_samples[i];
-
-    for (i = 0; i < s->tail_size; i++)
-        s->window[x++] = 0;
-
-    for (i = 0; i < s->tail_size; i++)
-        s->tail[i] = s->int_samples[s->frame_size - s->tail_size + i];
-
-    // generate taps
-    modified_levinson_durbin(s->window, s->window_size,
-                s->predictor_k, s->num_taps, s->channels, s->tap_quant);
-    if (intlist_write(&pb, s->predictor_k, s->num_taps, 0) < 0)
-        return -1;
-
-    for (ch = 0; ch < s->channels; ch++)
-    {
-        x = s->tail_size+ch;
-        for (i = 0; i < s->block_align; i++)
-        {
-            int sum = 0;
-            for (j = 0; j < s->downsampling; j++, x += s->channels)
-                sum += s->window[x];
-            s->coded_samples[ch][i] = sum;
-        }
-    }
-
-    // simple rate control code
-    if (!s->lossless)
-    {
-        double energy1 = 0.0, energy2 = 0.0;
-        for (ch = 0; ch < s->channels; ch++)
-        {
-            for (i = 0; i < s->block_align; i++)
-            {
-                double sample = s->coded_samples[ch][i];
-                energy2 += sample*sample;
-                energy1 += fabs(sample);
-            }
-        }
-
-        energy2 = sqrt(energy2/(s->channels*s->block_align));
-        energy1 = sqrt(2.0)*energy1/(s->channels*s->block_align);
-
-        // increase bitrate when samples are like a gaussian distribution
-        // reduce bitrate when samples are like a two-tailed exponential distribution
-
-        if (energy2 > energy1)
-            energy2 += (energy2-energy1)*RATE_VARIATION;
-
-        quant = (int)(BASE_QUANT*s->quantization*energy2/SAMPLE_FACTOR);
-//        av_log(avctx, AV_LOG_DEBUG, "quant: %d energy: %f / %f\n", quant, energy1, energy2);
-
-        if (quant < 1)
-            quant = 1;
-        if (quant > 65535)
-            quant = 65535;
-
-        set_ue_golomb(&pb, quant);
-
-        quant *= SAMPLE_FACTOR;
-    }
-
-    // write out coded samples
-    for (ch = 0; ch < s->channels; ch++)
-    {
-        if (!s->lossless)
-            for (i = 0; i < s->block_align; i++)
-                s->coded_samples[ch][i] = divide(s->coded_samples[ch][i], quant);
-
-        if (intlist_write(&pb, s->coded_samples[ch], s->block_align, 1) < 0)
-            return -1;
-    }
-
-//    av_log(avctx, AV_LOG_DEBUG, "used bytes: %d\n", (put_bits_count(&pb)+7)/8);
-
-    flush_put_bits(&pb);
-    return (put_bits_count(&pb)+7)/8;
-}
-#endif /* CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER */
-
-#if CONFIG_SONIC_DECODER
-static const int samplerate_table[] =
-    { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 };
-
-static av_cold int sonic_decode_init(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    GetBitContext gb;
-    int i, version;
-
-    s->channels = avctx->channels;
-    s->samplerate = avctx->sample_rate;
-
-    if (!avctx->extradata)
-    {
-        av_log(avctx, AV_LOG_ERROR, "No mandatory headers present\n");
-        return -1;
-    }
-
-    init_get_bits(&gb, avctx->extradata, avctx->extradata_size);
-
-    version = get_bits(&gb, 2);
-    if (version > 1)
-    {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported Sonic version, please report\n");
-        return -1;
-    }
-
-    if (version == 1)
-    {
-        s->channels = get_bits(&gb, 2);
-        s->samplerate = samplerate_table[get_bits(&gb, 4)];
-        av_log(avctx, AV_LOG_INFO, "Sonicv2 chans: %d samprate: %d\n",
-            s->channels, s->samplerate);
-    }
-
-    if (s->channels > MAX_CHANNELS)
-    {
-        av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
-        return -1;
-    }
-
-    s->lossless = get_bits1(&gb);
-    if (!s->lossless)
-        skip_bits(&gb, 3); // XXX FIXME
-    s->decorrelation = get_bits(&gb, 2);
-
-    s->downsampling = get_bits(&gb, 2);
-    s->num_taps = (get_bits(&gb, 5)+1)<<5;
-    if (get_bits1(&gb)) // XXX FIXME
-        av_log(avctx, AV_LOG_INFO, "Custom quant table\n");
-
-    s->block_align = (int)(2048.0*(s->samplerate/44100))/s->downsampling;
-    s->frame_size = s->channels*s->block_align*s->downsampling;
-//    avctx->frame_size = s->block_align;
-
-    av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
-        version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
-
-    // generate taps
-    s->tap_quant = av_mallocz(4* s->num_taps);
-    for (i = 0; i < s->num_taps; i++)
-        s->tap_quant[i] = (int)(sqrt(i+1));
-
-    s->predictor_k = av_mallocz(4* s->num_taps);
-
-    for (i = 0; i < s->channels; i++)
-    {
-        s->predictor_state[i] = av_mallocz(4* s->num_taps);
-        if (!s->predictor_state[i])
-            return -1;
-    }
-
-    for (i = 0; i < s->channels; i++)
-    {
-        s->coded_samples[i] = av_mallocz(4* s->block_align);
-        if (!s->coded_samples[i])
-            return -1;
-    }
-    s->int_samples = av_mallocz(4* s->frame_size);
-
-    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-    return 0;
-}
-
-static av_cold int sonic_decode_close(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    int i;
-
-    av_free(s->int_samples);
-    av_free(s->tap_quant);
-    av_free(s->predictor_k);
-
-    for (i = 0; i < s->channels; i++)
-    {
-        av_free(s->predictor_state[i]);
-        av_free(s->coded_samples[i]);
-    }
-
-    return 0;
-}
-
-static int sonic_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    SonicContext *s = avctx->priv_data;
-    GetBitContext gb;
-    int i, quant, ch, j;
-    short *samples = data;
-
-    if (buf_size == 0) return 0;
-
-//    av_log(NULL, AV_LOG_INFO, "buf_size: %d\n", buf_size);
-
-    init_get_bits(&gb, buf, buf_size*8);
-
-    intlist_read(&gb, s->predictor_k, s->num_taps, 0);
-
-    // dequantize
-    for (i = 0; i < s->num_taps; i++)
-        s->predictor_k[i] *= s->tap_quant[i];
-
-    if (s->lossless)
-        quant = 1;
-    else
-        quant = get_ue_golomb(&gb) * SAMPLE_FACTOR;
-
-//    av_log(NULL, AV_LOG_INFO, "quant: %d\n", quant);
-
-    for (ch = 0; ch < s->channels; ch++)
-    {
-        int x = ch;
-
-        predictor_init_state(s->predictor_k, s->predictor_state[ch], s->num_taps);
-
-        intlist_read(&gb, s->coded_samples[ch], s->block_align, 1);
-
-        for (i = 0; i < s->block_align; i++)
-        {
-            for (j = 0; j < s->downsampling - 1; j++)
-            {
-                s->int_samples[x] = predictor_calc_error(s->predictor_k, s->predictor_state[ch], s->num_taps, 0);
-                x += s->channels;
-            }
-
-            s->int_samples[x] = predictor_calc_error(s->predictor_k, s->predictor_state[ch], s->num_taps, s->coded_samples[ch][i] * quant);
-            x += s->channels;
-        }
-
-        for (i = 0; i < s->num_taps; i++)
-            s->predictor_state[ch][i] = s->int_samples[s->frame_size - s->channels + ch - i*s->channels];
-    }
-
-    switch(s->decorrelation)
-    {
-        case MID_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-            {
-                s->int_samples[i+1] += shift(s->int_samples[i], 1);
-                s->int_samples[i] -= s->int_samples[i+1];
-            }
-            break;
-        case LEFT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i+1] += s->int_samples[i];
-            break;
-        case RIGHT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i] += s->int_samples[i+1];
-            break;
-    }
-
-    if (!s->lossless)
-        for (i = 0; i < s->frame_size; i++)
-            s->int_samples[i] = shift(s->int_samples[i], SAMPLE_SHIFT);
-
-    // internal -> short
-    for (i = 0; i < s->frame_size; i++)
-        samples[i] = av_clip_int16(s->int_samples[i]);
-
-    align_get_bits(&gb);
-
-    *data_size = s->frame_size * 2;
-
-    return (get_bits_count(&gb)+7)/8;
-}
-
-AVCodec sonic_decoder = {
-    "sonic",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SONIC,
-    sizeof(SonicContext),
-    sonic_decode_init,
-    NULL,
-    sonic_decode_close,
-    sonic_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
-};
-#endif /* CONFIG_SONIC_DECODER */
-
-#if CONFIG_SONIC_ENCODER
-AVCodec sonic_encoder = {
-    "sonic",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SONIC,
-    sizeof(SonicContext),
-    sonic_encode_init,
-    sonic_encode_frame,
-    sonic_encode_close,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
-};
-#endif
-
-#if CONFIG_SONIC_LS_ENCODER
-AVCodec sonic_ls_encoder = {
-    "sonicls",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SONIC_LS,
-    sizeof(SonicContext),
-    sonic_encode_init,
-    sonic_encode_frame,
-    sonic_encode_close,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"),
-};
-#endif
diff --git a/ffmpeg-mt/libavcodec/sp5x.h b/ffmpeg-mt/libavcodec/sp5x.h
index b2c53cc..23c893b 100644
--- a/ffmpeg-mt/libavcodec/sp5x.h
+++ b/ffmpeg-mt/libavcodec/sp5x.h
@@ -2,20 +2,20 @@
  * Sunplus JPEG tables
  * Copyright (c) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sp5xdec.c b/ffmpeg-mt/libavcodec/sp5xdec.c
index 67fbaf4..e2c371a 100644
--- a/ffmpeg-mt/libavcodec/sp5xdec.c
+++ b/ffmpeg-mt/libavcodec/sp5xdec.c
@@ -2,20 +2,20 @@
  * Sunplus JPEG decoder (SP5X)
  * Copyright (c) 2003 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -97,7 +97,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
     return i;
 }
 
-AVCodec sp5x_decoder = {
+AVCodec ff_sp5x_decoder = {
     "sp5x",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SP5X,
@@ -112,7 +112,7 @@ AVCodec sp5x_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
 };
 
-AVCodec amv_decoder = {
+AVCodec ff_amv_decoder = {
     "amv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_AMV,
diff --git a/ffmpeg-mt/libavcodec/sparc/dsputil_vis.c b/ffmpeg-mt/libavcodec/sparc/dsputil_vis.c
index a39096c..baf555b 100644
--- a/ffmpeg-mt/libavcodec/sparc/dsputil_vis.c
+++ b/ffmpeg-mt/libavcodec/sparc/dsputil_vis.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003 David S. Miller <davem at redhat.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sparc/dsputil_vis.h b/ffmpeg-mt/libavcodec/sparc/dsputil_vis.h
index 97ff965..b590e59 100644
--- a/ffmpeg-mt/libavcodec/sparc/dsputil_vis.h
+++ b/ffmpeg-mt/libavcodec/sparc/dsputil_vis.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sparc/simple_idct_vis.c b/ffmpeg-mt/libavcodec/sparc/simple_idct_vis.c
index d98bf37..f9fcf80 100644
--- a/ffmpeg-mt/libavcodec/sparc/simple_idct_vis.c
+++ b/ffmpeg-mt/libavcodec/sparc/simple_idct_vis.c
@@ -5,20 +5,20 @@
  * I did consult the following fine web page about dct
  * http://www.geocities.com/ssavekar/dct.htm
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/sparc/vis.h b/ffmpeg-mt/libavcodec/sparc/vis.h
index adee91b..505c735 100644
--- a/ffmpeg-mt/libavcodec/sparc/vis.h
+++ b/ffmpeg-mt/libavcodec/sparc/vis.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003 David S. Miller <davem at redhat.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/srtdec.c b/ffmpeg-mt/libavcodec/srtdec.c
index adbae51..da625aa 100644
--- a/ffmpeg-mt/libavcodec/srtdec.c
+++ b/ffmpeg-mt/libavcodec/srtdec.c
@@ -2,25 +2,25 @@
  * SubRip subtitle decoder
  * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/avstring.h"
-#include "libavcore/parseutils.h"
+#include "libavutil/parseutils.h"
 #include "avcodec.h"
 #include "ass.h"
 
@@ -231,7 +231,7 @@ static int srt_decode_frame(AVCodecContext *avctx,
     return avpkt->size;
 }
 
-AVCodec srt_decoder = {
+AVCodec ff_srt_decoder = {
     .name         = "srt",
     .long_name    = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
     .type         = AVMEDIA_TYPE_SUBTITLE,
diff --git a/ffmpeg-mt/libavcodec/sunrast.c b/ffmpeg-mt/libavcodec/sunrast.c
index 0696a53..749a41b 100644
--- a/ffmpeg-mt/libavcodec/sunrast.c
+++ b/ffmpeg-mt/libavcodec/sunrast.c
@@ -2,25 +2,25 @@
  * Sun Rasterfile (.sun/.ras/im{1,8,24}/.sunras) image decoder
  * Copyright (c) 2007, 2008 Ivo van Poorten
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 
 #define RT_OLD          0
@@ -184,7 +184,7 @@ static av_cold int sunrast_end(AVCodecContext *avctx) {
     return 0;
 }
 
-AVCodec sunrast_decoder = {
+AVCodec ff_sunrast_decoder = {
     "sunrast",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SUNRAST,
diff --git a/ffmpeg-mt/libavcodec/svq1.c b/ffmpeg-mt/libavcodec/svq1.c
index d0e1132..b7e3af0 100644
--- a/ffmpeg-mt/libavcodec/svq1.c
+++ b/ffmpeg-mt/libavcodec/svq1.c
@@ -8,20 +8,20 @@
  *
  * SVQ1 Encoder (c) 2004 Mike Melanson <melanson at pcisys.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/svq1.h b/ffmpeg-mt/libavcodec/svq1.h
index 3ade05d..066ea47 100644
--- a/ffmpeg-mt/libavcodec/svq1.h
+++ b/ffmpeg-mt/libavcodec/svq1.h
@@ -8,20 +8,20 @@
  *
  * SVQ1 Encoder (c) 2004 Mike Melanson <melanson at pcisys.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/svq1_cb.h b/ffmpeg-mt/libavcodec/svq1_cb.h
index 7926ce1..e22cd60 100644
--- a/ffmpeg-mt/libavcodec/svq1_cb.h
+++ b/ffmpeg-mt/libavcodec/svq1_cb.h
@@ -6,20 +6,20 @@
  * Copyright (C) 2002 the xine project
  * Copyright (C) 2002 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/svq1_vlc.h b/ffmpeg-mt/libavcodec/svq1_vlc.h
index 272597e..4d03b08 100644
--- a/ffmpeg-mt/libavcodec/svq1_vlc.h
+++ b/ffmpeg-mt/libavcodec/svq1_vlc.h
@@ -1,20 +1,20 @@
 /*
  * copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/svq1dec.c b/ffmpeg-mt/libavcodec/svq1dec.c
index 1d40f59..5439abb 100644
--- a/ffmpeg-mt/libavcodec/svq1dec.c
+++ b/ffmpeg-mt/libavcodec/svq1dec.c
@@ -8,20 +8,20 @@
  *
  * SVQ1 Encoder (c) 2004 Mike Melanson <melanson at pcisys.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -684,7 +684,9 @@ static int svq1_decode_frame(AVCodecContext *avctx,
   //this should be removed after libavcodec can handle more flexible picture types & ordering
   if(s->pict_type==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size;
 
+#if FF_API_HURRY_UP
   if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
+#endif
   if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
      ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
      || avctx->skip_frame >= AVDISCARD_ALL)
@@ -833,7 +835,7 @@ static av_cold int svq1_decode_end(AVCodecContext *avctx)
 }
 
 
-AVCodec svq1_decoder = {
+AVCodec ff_svq1_decoder = {
     "svq1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SVQ1,
diff --git a/ffmpeg-mt/libavcodec/svq1enc.c b/ffmpeg-mt/libavcodec/svq1enc.c
index c89be25..cf10d85 100644
--- a/ffmpeg-mt/libavcodec/svq1enc.c
+++ b/ffmpeg-mt/libavcodec/svq1enc.c
@@ -2,20 +2,20 @@
  * SVQ1 Encoder
  * Copyright (C) 2004 Mike Melanson <melanson at pcisys.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -572,7 +572,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
 }
 
 
-AVCodec svq1_encoder = {
+AVCodec ff_svq1_encoder = {
     "svq1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SVQ1,
diff --git a/ffmpeg-mt/libavcodec/svq1enc_cb.h b/ffmpeg-mt/libavcodec/svq1enc_cb.h
index 7eff82e..1c86ebe 100644
--- a/ffmpeg-mt/libavcodec/svq1enc_cb.h
+++ b/ffmpeg-mt/libavcodec/svq1enc_cb.h
@@ -2,20 +2,20 @@
  * SVQ1 Encoder
  * Copyright (C) 2004 Mike Melanson <melanson at pcisys.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/svq3.c b/ffmpeg-mt/libavcodec/svq3.c
index 62a2091..5886713 100644
--- a/ffmpeg-mt/libavcodec/svq3.c
+++ b/ffmpeg-mt/libavcodec/svq3.c
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2003 The FFmpeg Project
+ * Copyright (c) 2003 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -283,7 +283,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s,
     src  = pic->data[0] + mx + my*s->linesize;
 
     if (emu) {
-        ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
                             mx, my, s->h_edge_pos, s->v_edge_pos);
         src = s->edge_emu_buffer;
     }
@@ -304,7 +304,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s,
             src  = pic->data[i] + mx + my*s->uvlinesize;
 
             if (emu) {
-                ff_emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1),
+                s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1),
                                     mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1));
                 src = s->edge_emu_buffer;
             }
@@ -671,12 +671,11 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
         }
 
         if ((cbp & 0x30)) {
-            AV_ZERO128(h->mb_chroma_dc);
             for (i = 0; i < 2; ++i) {
-                if (svq3_decode_block(&s->gb, h->mb_chroma_dc[i], 0, 3)){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
-                    return -1;
-                }
+              if (svq3_decode_block(&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)){
+                av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
+                return -1;
+              }
             }
 
             if ((cbp & 0x20)) {
@@ -946,19 +945,21 @@ static int svq3_decode_frame(AVCodecContext *avctx,
                s->adaptive_quant, s->qscale, h->slice_num);
     }
 
-    /* for hurry_up == 5 */
+    /* for skipping the frame */
     s->current_picture.pict_type = s->pict_type;
     s->current_picture.key_frame = (s->pict_type == FF_I_TYPE);
 
     /* Skip B-frames if we do not have reference frames. */
     if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
         return 0;
+#if FF_API_HURRY_UP
     /* Skip B-frames if we are in a hurry. */
     if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
         return 0;
     /* Skip everything if we are in a hurry >= 5. */
     if (avctx->hurry_up >= 5)
         return 0;
+#endif
     if (  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
         ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
         || avctx->skip_frame >= AVDISCARD_ALL)
@@ -1063,7 +1064,7 @@ static int svq3_decode_frame(AVCodecContext *avctx,
 }
 
 
-AVCodec svq3_decoder = {
+AVCodec ff_svq3_decoder = {
     "svq3",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_SVQ3,
diff --git a/ffmpeg-mt/libavcodec/synth_filter.c b/ffmpeg-mt/libavcodec/synth_filter.c
index a0ae364..8e6f120 100644
--- a/ffmpeg-mt/libavcodec/synth_filter.c
+++ b/ffmpeg-mt/libavcodec/synth_filter.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,12 +24,12 @@
 static void synth_filter_float(FFTContext *imdct,
                            float *synth_buf_ptr, int *synth_buf_offset,
                            float synth_buf2[32], const float window[512],
-                           float out[32], const float in[32], float scale, float bias)
+                           float out[32], const float in[32], float scale)
 {
     float *synth_buf= synth_buf_ptr + *synth_buf_offset;
     int i, j;
 
-    ff_imdct_half(imdct, synth_buf, in);
+    imdct->imdct_half(imdct, synth_buf, in);
 
     for (i = 0; i < 16; i++){
         float a= synth_buf2[i     ];
@@ -48,8 +48,8 @@ static void synth_filter_float(FFTContext *imdct,
             c += window[i + j + 32]*( synth_buf[16 + i + j - 512]);
             d += window[i + j + 48]*( synth_buf[31 - i + j - 512]);
         }
-        out[i     ] = a*scale + bias;
-        out[i + 16] = b*scale + bias;
+        out[i     ] = a*scale;
+        out[i + 16] = b*scale;
         synth_buf2[i     ] = c;
         synth_buf2[i + 16] = d;
     }
diff --git a/ffmpeg-mt/libavcodec/synth_filter.h b/ffmpeg-mt/libavcodec/synth_filter.h
index d6209d5..7b73578 100644
--- a/ffmpeg-mt/libavcodec/synth_filter.h
+++ b/ffmpeg-mt/libavcodec/synth_filter.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,7 +28,7 @@ typedef struct SynthFilterContext {
                                float *synth_buf_ptr, int *synth_buf_offset,
                                float synth_buf2[32], const float window[512],
                                float out[32], const float in[32],
-                               float scale, float bias);
+                               float scale);
 } SynthFilterContext;
 
 void ff_synth_filter_init(SynthFilterContext *c);
diff --git a/ffmpeg-mt/libavcodec/tableprint.c b/ffmpeg-mt/libavcodec/tableprint.c
index 52f6ac2..da77525 100644
--- a/ffmpeg-mt/libavcodec/tableprint.c
+++ b/ffmpeg-mt/libavcodec/tableprint.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/tableprint.h b/ffmpeg-mt/libavcodec/tableprint.h
index 97a667d..af69fe8 100644
--- a/ffmpeg-mt/libavcodec/tableprint.h
+++ b/ffmpeg-mt/libavcodec/tableprint.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/targa.c b/ffmpeg-mt/libavcodec/targa.c
index 7f8774e..06f87e4 100644
--- a/ffmpeg-mt/libavcodec/targa.c
+++ b/ffmpeg-mt/libavcodec/targa.c
@@ -2,25 +2,25 @@
  * Targa (.tga) image decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "targa.h"
 
@@ -33,22 +33,35 @@ typedef struct TargaContext {
     int compression_type;
 } TargaContext;
 
-static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp)
+#define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \
+    if(needed > buf_end - buf){ \
+        av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \
+        return -1; \
+    } \
+
+static int targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, int src_size, uint8_t *dst, int w, int h, int stride, int bpp)
 {
     int i, x, y;
     int depth = (bpp + 1) >> 3;
     int type, count;
     int diff;
+    const uint8_t *src_end = src + src_size;
 
     diff = stride - w * depth;
     x = y = 0;
     while(y < h){
+        CHECK_BUFFER_SIZE(src, src_end, 1, "image type");
         type = *src++;
         count = (type & 0x7F) + 1;
         type &= 0x80;
         if((x + count > w) && (x + count + 1 > (h - y) * w)){
             av_log(avctx, AV_LOG_ERROR, "Packet went out of bounds: position (%i,%i) size %i\n", x, y, count);
-            return;
+            return -1;
+        }
+        if(type){
+            CHECK_BUFFER_SIZE(src, src_end, depth, "image data");
+        }else{
+            CHECK_BUFFER_SIZE(src, src_end, count * depth, "image data");
         }
         for(i = 0; i < count; i++){
             switch(depth){
@@ -81,6 +94,7 @@ static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8
         if(type)
             src += depth;
     }
+    return src_size;
 }
 
 static int decode_frame(AVCodecContext *avctx,
@@ -88,7 +102,7 @@ static int decode_frame(AVCodecContext *avctx,
                         AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
+    const uint8_t *buf_end = avpkt->data + avpkt->size;
     TargaContext * const s = avctx->priv_data;
     AVFrame *picture = data;
     AVFrame * const p= (AVFrame*)&s->picture;
@@ -98,6 +112,7 @@ static int decode_frame(AVCodecContext *avctx,
     int first_clr, colors, csize;
 
     /* parse image header */
+    CHECK_BUFFER_SIZE(buf, buf_end, 18, "header");
     idlen = *buf++;
     pal = *buf++;
     compr = *buf++;
@@ -111,6 +126,7 @@ static int decode_frame(AVCodecContext *avctx,
     bpp = *buf++;
     flags = *buf++;
     //skip identifier if any
+    CHECK_BUFFER_SIZE(buf, buf_end, idlen, "identifiers");
     buf += idlen;
     s->bpp = bpp;
     s->width = w;
@@ -163,6 +179,7 @@ static int decode_frame(AVCodecContext *avctx,
         }
     }
     if(colors){
+        size_t pal_size;
         if((colors + first_clr) > 256){
             av_log(avctx, AV_LOG_ERROR, "Incorrect palette: %i colors with offset %i\n", colors, first_clr);
             return -1;
@@ -171,8 +188,10 @@ static int decode_frame(AVCodecContext *avctx,
             av_log(avctx, AV_LOG_ERROR, "Palette entry size %i bits is not supported\n", csize);
             return -1;
         }
+        pal_size = colors * ((csize + 1) >> 3);
+        CHECK_BUFFER_SIZE(buf, buf_end, pal_size, "color table");
         if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway
-            buf += colors * ((csize + 1) >> 3);
+            buf += pal_size;
         else{
             int r, g, b, t;
             int32_t *pal = ((int32_t*)p->data[1]) + first_clr;
@@ -188,9 +207,14 @@ static int decode_frame(AVCodecContext *avctx,
     if((compr & (~TGA_RLE)) == TGA_NODATA)
         memset(p->data[0], 0, p->linesize[0] * s->height);
     else{
-        if(compr & TGA_RLE)
-            targa_decode_rle(avctx, s, buf, dst, avctx->width, avctx->height, stride, bpp);
-        else{
+        if(compr & TGA_RLE){
+            int res = targa_decode_rle(avctx, s, buf, buf_end - buf, dst, avctx->width, avctx->height, stride, bpp);
+            if (res < 0)
+                return -1;
+            buf += res;
+        }else{
+            size_t img_size = s->width * ((s->bpp + 1) >> 3);
+            CHECK_BUFFER_SIZE(buf, buf_end, img_size, "image data");
             for(y = 0; y < s->height; y++){
 #if HAVE_BIGENDIAN
                 if((s->bpp + 1) >> 3 == 2){
@@ -203,10 +227,10 @@ static int decode_frame(AVCodecContext *avctx,
                         dst32[x] = AV_RL32(buf + x * 4);
                 }else
 #endif
-                    memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3));
+                    memcpy(dst, buf, img_size);
 
                 dst += stride;
-                buf += s->width * ((s->bpp + 1) >> 3);
+                buf += img_size;
             }
         }
     }
@@ -214,7 +238,7 @@ static int decode_frame(AVCodecContext *avctx,
     *picture= *(AVFrame*)&s->picture;
     *data_size = sizeof(AVPicture);
 
-    return buf_size;
+    return avpkt->size;
 }
 
 static av_cold int targa_init(AVCodecContext *avctx){
@@ -235,7 +259,7 @@ static av_cold int targa_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec targa_decoder = {
+AVCodec ff_targa_decoder = {
     "targa",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TARGA,
diff --git a/ffmpeg-mt/libavcodec/targa.h b/ffmpeg-mt/libavcodec/targa.h
index 5bc2a44..d7c3f45 100644
--- a/ffmpeg-mt/libavcodec/targa.h
+++ b/ffmpeg-mt/libavcodec/targa.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/targaenc.c b/ffmpeg-mt/libavcodec/targaenc.c
index 09da727..617087c 100644
--- a/ffmpeg-mt/libavcodec/targaenc.c
+++ b/ffmpeg-mt/libavcodec/targaenc.c
@@ -2,20 +2,20 @@
  * Targa (.tga) image encoder
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -158,7 +158,7 @@ static av_cold int targa_encode_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec targa_encoder = {
+AVCodec ff_targa_encoder = {
     .name = "targa",
     .type = AVMEDIA_TYPE_VIDEO,
     .id = CODEC_ID_TARGA,
diff --git a/ffmpeg-mt/libavcodec/thread.h b/ffmpeg-mt/libavcodec/thread.h
index d9186d6..401c4d2 100644
--- a/ffmpeg-mt/libavcodec/thread.h
+++ b/ffmpeg-mt/libavcodec/thread.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Alexander Strange <astrange at ithinksw.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -108,4 +108,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f);
  */
 void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f);
 
+int ff_thread_init(AVCodecContext *s);
+void ff_thread_free(AVCodecContext *s);
+
 #endif /* AVCODEC_THREAD_H */
diff --git a/ffmpeg-mt/libavcodec/tiertexseqv.c b/ffmpeg-mt/libavcodec/tiertexseqv.c
index c5f632e..4468f00 100644
--- a/ffmpeg-mt/libavcodec/tiertexseqv.c
+++ b/ffmpeg-mt/libavcodec/tiertexseqv.c
@@ -2,20 +2,20 @@
  * Tiertex Limited SEQ Video Decoder
  * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -219,7 +219,7 @@ static av_cold int seqvideo_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec tiertexseqvideo_decoder = {
+AVCodec ff_tiertexseqvideo_decoder = {
     "tiertexseqvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TIERTEXSEQVIDEO,
diff --git a/ffmpeg-mt/libavcodec/tiff.c b/ffmpeg-mt/libavcodec/tiff.c
index f5d922a..3cc3a42 100644
--- a/ffmpeg-mt/libavcodec/tiff.c
+++ b/ffmpeg-mt/libavcodec/tiff.c
@@ -2,20 +2,20 @@
  * TIFF image decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,7 +33,7 @@
 #include "faxcompr.h"
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 typedef struct TiffContext {
     AVCodecContext *avctx;
@@ -600,7 +600,7 @@ static av_cold int tiff_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec tiff_decoder = {
+AVCodec ff_tiff_decoder = {
     "tiff",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TIFF,
diff --git a/ffmpeg-mt/libavcodec/tiff.h b/ffmpeg-mt/libavcodec/tiff.h
index 235a998..cd7ec83 100644
--- a/ffmpeg-mt/libavcodec/tiff.h
+++ b/ffmpeg-mt/libavcodec/tiff.h
@@ -2,20 +2,20 @@
  * TIFF tables
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/tiffenc.c b/ffmpeg-mt/libavcodec/tiffenc.c
index 0905cea..049b28f 100644
--- a/ffmpeg-mt/libavcodec/tiffenc.c
+++ b/ffmpeg-mt/libavcodec/tiffenc.c
@@ -2,20 +2,20 @@
  * TIFF image encoder
  * Copyright (c) 2007 Bartlomiej Wolowiec
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -442,7 +442,7 @@ fail:
     return ret;
 }
 
-AVCodec tiff_encoder = {
+AVCodec ff_tiff_encoder = {
     "tiff",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TIFF,
diff --git a/ffmpeg-mt/libavcodec/tmv.c b/ffmpeg-mt/libavcodec/tmv.c
index 7e0f9a1..3c2ae01 100644
--- a/ffmpeg-mt/libavcodec/tmv.c
+++ b/ffmpeg-mt/libavcodec/tmv.c
@@ -2,20 +2,20 @@
  * 8088flex TMV video decoder
  * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -92,7 +92,7 @@ static av_cold int tmv_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec tmv_decoder = {
+AVCodec ff_tmv_decoder = {
     .name           = "tmv",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_TMV,
diff --git a/ffmpeg-mt/libavcodec/truemotion1.c b/ffmpeg-mt/libavcodec/truemotion1.c
index 338b4dc..afa9cf2 100644
--- a/ffmpeg-mt/libavcodec/truemotion1.c
+++ b/ffmpeg-mt/libavcodec/truemotion1.c
@@ -2,20 +2,20 @@
  * Duck TrueMotion 1.0 Decoder
  * Copyright (C) 2003 Alex Beregszaszi & Mike Melanson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -35,7 +35,7 @@
 
 #include "avcodec.h"
 #include "dsputil.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 #include "truemotion1data.h"
 
@@ -891,7 +891,7 @@ static av_cold int truemotion1_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec truemotion1_decoder = {
+AVCodec ff_truemotion1_decoder = {
     "truemotion1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TRUEMOTION1,
diff --git a/ffmpeg-mt/libavcodec/truemotion1data.h b/ffmpeg-mt/libavcodec/truemotion1data.h
index 6a9822a..c94e3b5 100644
--- a/ffmpeg-mt/libavcodec/truemotion1data.h
+++ b/ffmpeg-mt/libavcodec/truemotion1data.h
@@ -6,20 +6,20 @@
  * GNU LGPL using the common understanding that data tables necessary for
  * decoding algorithms are not necessarily licensable.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVCODEC_TRUEMOTION1DATA_H
diff --git a/ffmpeg-mt/libavcodec/truemotion2.c b/ffmpeg-mt/libavcodec/truemotion2.c
index f4e3074..958ed5a 100644
--- a/ffmpeg-mt/libavcodec/truemotion2.c
+++ b/ffmpeg-mt/libavcodec/truemotion2.c
@@ -2,20 +2,20 @@
  * Duck/ON2 TrueMotion 2 Decoder
  * Copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -185,8 +185,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
 
 static void tm2_free_codes(TM2Codes *code)
 {
-    if(code->recode)
-        av_free(code->recode);
+    av_free(code->recode);
     if(code->vlc.table)
         free_vlc(&code->vlc);
 }
@@ -859,13 +858,10 @@ static av_cold int decode_end(AVCodecContext *avctx){
     AVFrame *pic = &l->pic;
     int i;
 
-    if(l->last)
-        av_free(l->last);
-    if(l->clast)
-        av_free(l->clast);
+    av_free(l->last);
+    av_free(l->clast);
     for(i = 0; i < TM2_NUM_STREAMS; i++)
-        if(l->tokens[i])
-            av_free(l->tokens[i]);
+        av_free(l->tokens[i]);
     if(l->Y1){
         av_free(l->Y1);
         av_free(l->U1);
@@ -881,7 +877,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec truemotion2_decoder = {
+AVCodec ff_truemotion2_decoder = {
     "truemotion2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TRUEMOTION2,
diff --git a/ffmpeg-mt/libavcodec/truespeech.c b/ffmpeg-mt/libavcodec/truespeech.c
index 6bc1e7b..df9d918 100644
--- a/ffmpeg-mt/libavcodec/truespeech.c
+++ b/ffmpeg-mt/libavcodec/truespeech.c
@@ -2,20 +2,20 @@
  * DSP Group TrueSpeech compatible decoder
  * Copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -381,7 +381,7 @@ static int truespeech_decode_frame(AVCodecContext *avctx,
     return consumed;
 }
 
-AVCodec truespeech_decoder = {
+AVCodec ff_truespeech_decoder = {
     "truespeech",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_TRUESPEECH,
diff --git a/ffmpeg-mt/libavcodec/truespeech_data.h b/ffmpeg-mt/libavcodec/truespeech_data.h
index 73ebda5..6e9806a 100644
--- a/ffmpeg-mt/libavcodec/truespeech_data.h
+++ b/ffmpeg-mt/libavcodec/truespeech_data.h
@@ -2,20 +2,20 @@
  * DSP Group TrueSpeech compatible decoder
  * copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/tscc.c b/ffmpeg-mt/libavcodec/tscc.c
index 2b717c1..f695973 100644
--- a/ffmpeg-mt/libavcodec/tscc.c
+++ b/ffmpeg-mt/libavcodec/tscc.c
@@ -2,20 +2,20 @@
  * TechSmith Camtasia decoder
  * Copyright (c) 2004 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -197,7 +197,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec tscc_decoder = {
+AVCodec ff_tscc_decoder = {
         "camtasia",
         AVMEDIA_TYPE_VIDEO,
         CODEC_ID_TSCC,
diff --git a/ffmpeg-mt/libavcodec/tta.c b/ffmpeg-mt/libavcodec/tta.c
index dad9933..fbfc59e 100644
--- a/ffmpeg-mt/libavcodec/tta.c
+++ b/ffmpeg-mt/libavcodec/tta.c
@@ -2,20 +2,20 @@
  * TTA (The Lossless True Audio) decoder
  * Copyright (c) 2006 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -449,14 +449,13 @@ static int tta_decode_frame(AVCodecContext *avctx,
 static av_cold int tta_decode_close(AVCodecContext *avctx) {
     TTAContext *s = avctx->priv_data;
 
-    if (s->decode_buffer)
-        av_free(s->decode_buffer);
+    av_free(s->decode_buffer);
     av_freep(&s->ch_ctx);
 
     return 0;
 }
 
-AVCodec tta_decoder = {
+AVCodec ff_tta_decoder = {
     "tta",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_TTA,
diff --git a/ffmpeg-mt/libavcodec/twinvq.c b/ffmpeg-mt/libavcodec/twinvq.c
index 3d26c6e..e1a8dc4 100644
--- a/ffmpeg-mt/libavcodec/twinvq.c
+++ b/ffmpeg-mt/libavcodec/twinvq.c
@@ -2,20 +2,20 @@
  * TwinVQ decoder
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,6 +24,7 @@
 #include "dsputil.h"
 #include "fft.h"
 #include "lsp.h"
+#include "sinewin.h"
 
 #include <math.h>
 #include <stdint.h>
@@ -608,6 +609,7 @@ static void dec_lpc_spectrum_inv(TwinContext *tctx, float *lsp,
 static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype,
                             float *in, float *prev, int ch)
 {
+    FFTContext *mdct = &tctx->mdct_ctx[ftype];
     const ModeTab *mtab = tctx->mtab;
     int bsize = mtab->size / mtab->fmode[ftype].sub;
     int size  = mtab->size;
@@ -640,13 +642,12 @@ static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype,
 
         wsize = types_sizes[wtype_to_wsize[sub_wtype]];
 
-        ff_imdct_half(&tctx->mdct_ctx[ftype], buf1 + bsize*j, in + bsize*j);
+        mdct->imdct_half(mdct, buf1 + bsize*j, in + bsize*j);
 
         tctx->dsp.vector_fmul_window(out2,
                                      prev_buf + (bsize-wsize)/2,
                                      buf1 + bsize*j,
                                      ff_sine_windows[av_log2(wsize)],
-                                     0.0,
                                      wsize/2);
         out2 += wsize;
 
@@ -783,7 +784,7 @@ static void read_and_decode_spectrum(TwinContext *tctx, GetBitContext *gb,
             dec_bark_env(tctx, bark1[i][j], bark_use_hist[i][j], i,
                          tctx->tmp_buf, gain[sub*i+j], ftype);
 
-            tctx->dsp.vector_fmul(chunk + block_size*j, tctx->tmp_buf,
+            tctx->dsp.vector_fmul(chunk + block_size*j, chunk + block_size*j, tctx->tmp_buf,
                                   block_size);
 
         }
@@ -805,7 +806,7 @@ static void read_and_decode_spectrum(TwinContext *tctx, GetBitContext *gb,
         dec_lpc_spectrum_inv(tctx, lsp, ftype, tctx->tmp_buf);
 
         for (j = 0; j < mtab->fmode[ftype].sub; j++) {
-            tctx->dsp.vector_fmul(chunk, tctx->tmp_buf, block_size);
+            tctx->dsp.vector_fmul(chunk, chunk, tctx->tmp_buf, block_size);
             chunk += block_size;
         }
     }
@@ -1119,7 +1120,7 @@ static av_cold int twin_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec twinvq_decoder =
+AVCodec ff_twinvq_decoder =
 {
     "twinvq",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/twinvq_data.h b/ffmpeg-mt/libavcodec/twinvq_data.h
index 3042cd1..1f1f334 100644
--- a/ffmpeg-mt/libavcodec/twinvq_data.h
+++ b/ffmpeg-mt/libavcodec/twinvq_data.h
@@ -2,20 +2,20 @@
  * TwinVQ decoder
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/txd.c b/ffmpeg-mt/libavcodec/txd.c
index e7d3379..98719fa 100644
--- a/ffmpeg-mt/libavcodec/txd.c
+++ b/ffmpeg-mt/libavcodec/txd.c
@@ -4,25 +4,25 @@
  *
  * See also: http://wiki.multimedia.cx/index.php?title=TXD
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "s3tc.h"
 
@@ -155,7 +155,7 @@ static av_cold int txd_end(AVCodecContext *avctx) {
     return 0;
 }
 
-AVCodec txd_decoder = {
+AVCodec ff_txd_decoder = {
     "txd",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TXD,
diff --git a/ffmpeg-mt/libavcodec/ulti.c b/ffmpeg-mt/libavcodec/ulti.c
index 1d04c80..31b1c4a 100644
--- a/ffmpeg-mt/libavcodec/ulti.c
+++ b/ffmpeg-mt/libavcodec/ulti.c
@@ -2,20 +2,20 @@
  * IBM Ultimotion Video Decoder
  * Copyright (C) 2004 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -404,7 +404,7 @@ static int ulti_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-AVCodec ulti_decoder = {
+AVCodec ff_ulti_decoder = {
     "ultimotion",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ULTI,
diff --git a/ffmpeg-mt/libavcodec/ulti_cb.h b/ffmpeg-mt/libavcodec/ulti_cb.h
index 7061d83..0bd83ff 100644
--- a/ffmpeg-mt/libavcodec/ulti_cb.h
+++ b/ffmpeg-mt/libavcodec/ulti_cb.h
@@ -2,20 +2,20 @@
  * IBM Ultimotion Video Decoder
  * copyright (C) 2004 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/unary.h b/ffmpeg-mt/libavcodec/unary.h
index 908dc93..d14929f 100644
--- a/ffmpeg-mt/libavcodec/unary.h
+++ b/ffmpeg-mt/libavcodec/unary.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/utils.c b/ffmpeg-mt/libavcodec/utils.c
index 3322e25..ec009d8 100644
--- a/ffmpeg-mt/libavcodec/utils.c
+++ b/ffmpeg-mt/libavcodec/utils.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,10 +29,9 @@
 #include "libavutil/integer.h"
 #include "libavutil/crc.h"
 #include "libavutil/pixdesc.h"
-#include "libavcore/audioconvert.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/internal.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/audioconvert.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/samplefmt.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "libavutil/opt.h"
@@ -46,7 +45,7 @@
 #include <float.h>
 
 static int volatile entangled_thread_counter=0;
-int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
+static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
 static void *codec_mutex;
 
 void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size)
@@ -404,6 +403,8 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
 
     /* If internal buffer type return the same buffer */
     if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
+        if(s->pkt) pic->pkt_pts= s->pkt->pts;
+        else       pic->pkt_pts= AV_NOPTS_VALUE;
         pic->reordered_opaque= s->reordered_opaque;
         return 0;
     }
@@ -540,7 +541,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
     avctx->frame_number = 0;
 
     if (HAVE_THREADS && !avctx->thread_opaque) {
-        ret = avcodec_thread_init(avctx, avctx->thread_count);
+        ret = ff_thread_init(avctx);
         if (ret < 0) {
             goto free_and_end;
         }
@@ -551,6 +552,16 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
                avctx->codec->max_lowres);
         goto free_and_end;
     }
+    if (avctx->codec->sample_fmts && avctx->codec->encode) {
+        int i;
+        for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
+            if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
+                break;
+        if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
+            av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n");
+            goto free_and_end;
+        }
+    }
 
     if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){
         ret = avctx->codec->init(avctx);
@@ -644,7 +655,6 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
                          AVPacket *avpkt)
 {
     int ret;
-    int threaded = avctx->active_thread_type&FF_THREAD_FRAME;
 
     *got_picture_ptr= 0;
     if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
@@ -652,9 +662,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
 
     avctx->pkt = avpkt;
 
-    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || threaded){
-        if (HAVE_PTHREADS && threaded) ret = ff_thread_decode_frame(avctx, picture,
-                                got_picture_ptr, avpkt);
+    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){
+        if (HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)
+             ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
+                                          avpkt);
         else {
             ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
                               avpkt);
@@ -778,7 +789,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
     }
 
     if (HAVE_THREADS && avctx->thread_opaque)
-        avcodec_thread_free(avctx);
+        ff_thread_free(avctx);
     if (avctx->codec && avctx->codec->close)
         avctx->codec->close(avctx);
     avcodec_default_free_buffers(avctx);
@@ -1027,13 +1038,13 @@ unsigned avcodec_version( void )
 
 const char *avcodec_configuration(void)
 {
-    return FFMPEG_CONFIGURATION;
+    return LIBAV_CONFIGURATION;
 }
 
 const char *avcodec_license(void)
 {
 #define LICENSE_PREFIX "libavcodec license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+    return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
 
 void avcodec_init(void)
@@ -1139,8 +1150,7 @@ int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) {
 #endif
 
 #if !HAVE_THREADS
-int avcodec_thread_init(AVCodecContext *s, int thread_count){
-    s->thread_count = thread_count;
+int ff_thread_init(AVCodecContext *s){
     return -1;
 }
 #endif
@@ -1160,7 +1170,7 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
 }
 
 #if LIBAVCODEC_VERSION_MAJOR < 53
-#include "libavcore/parseutils.h"
+#include "libavutil/parseutils.h"
 
 int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
 {
@@ -1182,7 +1192,7 @@ int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
 void av_log_missing_feature(void *avc, const char *feature, int want_sample)
 {
     av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your FFmpeg "
-            "version to the newest one from SVN. If the problem still "
+            "version to the newest one from Git. If the problem still "
             "occurs, it means that your file has a feature which has not "
             "been implemented.", feature);
     if(want_sample)
@@ -1196,8 +1206,8 @@ void av_log_ask_for_sample(void *avc, const char *msg)
     if (msg)
         av_log(avc, AV_LOG_WARNING, "%s ", msg);
     av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
-            "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
-            "and contact the ffmpeg-devel mailing list.\n");
+            "of this file to ftp://upload.libav.org/MPlayer/incoming/ "
+            "and contact the libav-devel mailing list.\n");
 }
 
 static AVHWAccel *first_hwaccel = NULL;
@@ -1278,3 +1288,20 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field)
 }
 
 #endif
+
+#if LIBAVCODEC_VERSION_MAJOR < 53
+
+int avcodec_thread_init(AVCodecContext *s, int thread_count)
+{
+    s->thread_count = thread_count;
+    return ff_thread_init(s);
+}
+
+void avcodec_thread_free(AVCodecContext *s)
+{
+#if HAVE_THREADS
+    ff_thread_free(s);
+#endif
+}
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/v210dec.c b/ffmpeg-mt/libavcodec/v210dec.c
index 61e9566..420bc47 100644
--- a/ffmpeg-mt/libavcodec/v210dec.c
+++ b/ffmpeg-mt/libavcodec/v210dec.c
@@ -4,20 +4,20 @@
  * Copyright (C) 2009 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -120,7 +120,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec v210_decoder = {
+AVCodec ff_v210_decoder = {
     "v210",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_V210,
diff --git a/ffmpeg-mt/libavcodec/v210enc.c b/ffmpeg-mt/libavcodec/v210enc.c
index 11e0e0e..ad03703 100644
--- a/ffmpeg-mt/libavcodec/v210enc.c
+++ b/ffmpeg-mt/libavcodec/v210enc.c
@@ -4,20 +4,20 @@
  * Copyright (C) 2009 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -117,7 +117,7 @@ static av_cold int encode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec v210_encoder = {
+AVCodec ff_v210_encoder = {
     "v210",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_V210,
diff --git a/ffmpeg-mt/libavcodec/v210x.c b/ffmpeg-mt/libavcodec/v210x.c
index 6b93a05..3d8bdcf 100644
--- a/ffmpeg-mt/libavcodec/v210x.c
+++ b/ffmpeg-mt/libavcodec/v210x.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2009 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -132,7 +132,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec v210x_decoder = {
+AVCodec ff_v210x_decoder = {
     "v210x",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_V210X,
diff --git a/ffmpeg-mt/libavcodec/vaapi.c b/ffmpeg-mt/libavcodec/vaapi.c
index 10f9054..cc2fec3 100644
--- a/ffmpeg-mt/libavcodec/vaapi.c
+++ b/ffmpeg-mt/libavcodec/vaapi.c
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2008-2009 Splitted-Desktop Systems
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -180,7 +180,7 @@ int ff_vaapi_common_end_frame(MpegEncContext *s)
     struct vaapi_context * const vactx = s->avctx->hwaccel_context;
     int ret = -1;
 
-    dprintf(s->avctx, "ff_vaapi_common_end_frame()\n");
+    av_dlog(s->avctx, "ff_vaapi_common_end_frame()\n");
 
     if (commit_slices(vactx) < 0)
         goto done;
diff --git a/ffmpeg-mt/libavcodec/vaapi.h b/ffmpeg-mt/libavcodec/vaapi.h
index 07568a4..306e164 100644
--- a/ffmpeg-mt/libavcodec/vaapi.h
+++ b/ffmpeg-mt/libavcodec/vaapi.h
@@ -1,23 +1,23 @@
 /*
- * Video Acceleration API (shared data between FFmpeg and the video player)
+ * Video Acceleration API (shared data between Libav and the video player)
  * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
  *
  * Copyright (C) 2008-2009 Splitted-Desktop Systems
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,7 +33,7 @@
  */
 
 /**
- * This structure is used to share data between the FFmpeg library and
+ * This structure is used to share data between the Libav library and
  * the client video application.
  * This shall be zero-allocated and available as
  * AVCodecContext.hwaccel_context. All user members can be set once
diff --git a/ffmpeg-mt/libavcodec/vaapi_h264.c b/ffmpeg-mt/libavcodec/vaapi_h264.c
index 29f3a81..805e4ef 100644
--- a/ffmpeg-mt/libavcodec/vaapi_h264.c
+++ b/ffmpeg-mt/libavcodec/vaapi_h264.c
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2008-2009 Splitted-Desktop Systems
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,7 +24,7 @@
 #include "h264.h"
 
 /** @file
- *  This file implements the glue code between FFmpeg's and VA API's
+ *  This file implements the glue code between Libav's and VA API's
  *  structures for H.264 decoding.
  */
 
@@ -42,10 +42,10 @@ static void init_vaapi_pic(VAPictureH264 *va_pic)
 }
 
 /**
- * Translate an FFmpeg Picture into its VA API form.
+ * Translate an Libav Picture into its VA API form.
  *
  * @param[out] va_pic          A pointer to VA API's own picture struct
- * @param[in]  pic             A pointer to the FFmpeg picture struct to convert
+ * @param[in]  pic             A pointer to the Libav picture struct to convert
  * @param[in]  pic_structure   The picture field type (as defined in mpegvideo.h),
  *                             supersedes pic's field type if nonzero.
  */
@@ -55,6 +55,7 @@ static void fill_vaapi_pic(VAPictureH264 *va_pic,
 {
     if (pic_structure == 0)
         pic_structure = pic->reference;
+    pic_structure &= PICT_FRAME; /* PICT_TOP_FIELD|PICT_BOTTOM_FIELD */
 
     va_pic->picture_id = ff_vaapi_get_surface_id(pic);
     va_pic->frame_idx  = pic->long_ref ? pic->pic_id : pic->frame_num;
@@ -145,11 +146,11 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
 }
 
 /**
- * Fill in VA API reference picture lists from the FFmpeg reference
+ * Fill in VA API reference picture lists from the Libav reference
  * picture list.
  *
  * @param[out] RefPicList  VA API internal reference picture list
- * @param[in]  ref_list    A pointer to the FFmpeg reference list
+ * @param[in]  ref_list    A pointer to the Libav reference list
  * @param[in]  ref_count   The number of reference pictures in ref_list
  */
 static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32],
@@ -227,7 +228,7 @@ static int start_frame(AVCodecContext          *avctx,
     VAPictureParameterBufferH264 *pic_param;
     VAIQMatrixBufferH264 *iq_matrix;
 
-    dprintf(avctx, "start_frame()\n");
+    av_dlog(avctx, "start_frame()\n");
 
     vactx->slice_param_size = sizeof(VASliceParameterBufferH264);
 
@@ -289,7 +290,7 @@ static int end_frame(AVCodecContext *avctx)
 {
     H264Context * const h = avctx->priv_data;
 
-    dprintf(avctx, "end_frame()\n");
+    av_dlog(avctx, "end_frame()\n");
     return ff_vaapi_common_end_frame(&h->s);
 }
 
@@ -302,7 +303,7 @@ static int decode_slice(AVCodecContext *avctx,
     MpegEncContext * const s = &h->s;
     VASliceParameterBufferH264 *slice_param;
 
-    dprintf(avctx, "decode_slice(): buffer %p, size %d\n", buffer, size);
+    av_dlog(avctx, "decode_slice(): buffer %p, size %d\n", buffer, size);
 
     /* Fill in VASliceParameterBufferH264. */
     slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
@@ -334,7 +335,7 @@ static int decode_slice(AVCodecContext *avctx,
     return 0;
 }
 
-AVHWAccel h264_vaapi_hwaccel = {
+AVHWAccel ff_h264_vaapi_hwaccel = {
     .name           = "h264_vaapi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_H264,
diff --git a/ffmpeg-mt/libavcodec/vaapi_internal.h b/ffmpeg-mt/libavcodec/vaapi_internal.h
index 2c0fdf9..3a14a2b 100644
--- a/ffmpeg-mt/libavcodec/vaapi_internal.h
+++ b/ffmpeg-mt/libavcodec/vaapi_internal.h
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2008-2009 Splitted-Desktop Systems
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vaapi_mpeg2.c b/ffmpeg-mt/libavcodec/vaapi_mpeg2.c
index 2e870dc..fd57363 100644
--- a/ffmpeg-mt/libavcodec/vaapi_mpeg2.c
+++ b/ffmpeg-mt/libavcodec/vaapi_mpeg2.c
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2008-2009 Splitted-Desktop Systems
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -44,7 +44,7 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_
     VAIQMatrixBufferMPEG2 *iq_matrix;
     int i;
 
-    dprintf(avctx, "vaapi_mpeg2_start_frame()\n");
+    av_dlog(avctx, "vaapi_mpeg2_start_frame()\n");
 
     vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG2);
 
@@ -111,7 +111,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
     GetBitContext gb;
     uint32_t start_code, quantiser_scale_code, intra_slice_flag, macroblock_offset;
 
-    dprintf(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size);
+    av_dlog(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size);
 
     /* Determine macroblock_offset */
     init_get_bits(&gb, buffer, 8 * size);
@@ -138,7 +138,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
     return 0;
 }
 
-AVHWAccel mpeg2_vaapi_hwaccel = {
+AVHWAccel ff_mpeg2_vaapi_hwaccel = {
     .name           = "mpeg2_vaapi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_MPEG2VIDEO,
diff --git a/ffmpeg-mt/libavcodec/vaapi_mpeg4.c b/ffmpeg-mt/libavcodec/vaapi_mpeg4.c
index 8f02e91..85e2a50 100644
--- a/ffmpeg-mt/libavcodec/vaapi_mpeg4.c
+++ b/ffmpeg-mt/libavcodec/vaapi_mpeg4.c
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2008-2009 Splitted-Desktop Systems
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -47,7 +47,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
     VAIQMatrixBufferMPEG4 *iq_matrix;
     int i;
 
-    dprintf(avctx, "vaapi_mpeg4_start_frame()\n");
+    av_dlog(avctx, "vaapi_mpeg4_start_frame()\n");
 
     vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG4);
 
@@ -125,7 +125,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
     MpegEncContext * const s = avctx->priv_data;
     VASliceParameterBufferMPEG4 *slice_param;
 
-    dprintf(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size);
+    av_dlog(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size);
 
     /* video_plane_with_short_video_header() contains all GOBs
      * in-order, and this is what VA API (Intel backend) expects: only
@@ -150,7 +150,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
 }
 
 #if CONFIG_MPEG4_VAAPI_HWACCEL
-AVHWAccel mpeg4_vaapi_hwaccel = {
+AVHWAccel ff_mpeg4_vaapi_hwaccel = {
     .name           = "mpeg4_vaapi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_MPEG4,
@@ -164,7 +164,7 @@ AVHWAccel mpeg4_vaapi_hwaccel = {
 #endif
 
 #if CONFIG_H263_VAAPI_HWACCEL
-AVHWAccel h263_vaapi_hwaccel = {
+AVHWAccel ff_h263_vaapi_hwaccel = {
     .name           = "h263_vaapi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_H263,
diff --git a/ffmpeg-mt/libavcodec/vaapi_vc1.c b/ffmpeg-mt/libavcodec/vaapi_vc1.c
index 2c24042..5bce829 100644
--- a/ffmpeg-mt/libavcodec/vaapi_vc1.c
+++ b/ffmpeg-mt/libavcodec/vaapi_vc1.c
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2008-2009 Splitted-Desktop Systems
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -138,7 +138,7 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
     struct vaapi_context * const vactx = avctx->hwaccel_context;
     VAPictureParameterBufferVC1 *pic_param;
 
-    dprintf(avctx, "vaapi_vc1_start_frame()\n");
+    av_dlog(avctx, "vaapi_vc1_start_frame()\n");
 
     vactx->slice_param_size = sizeof(VASliceParameterBufferVC1);
 
@@ -160,6 +160,9 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
     pic_param->sequence_fields.bits.syncmarker                      = s->resync_marker;
     pic_param->sequence_fields.bits.rangered                        = v->rangered;
     pic_param->sequence_fields.bits.max_b_frames                    = s->avctx->max_b_frames;
+#if VA_CHECK_VERSION(0,32,0)
+    pic_param->sequence_fields.bits.profile                         = v->profile;
+#endif
     pic_param->coded_width                                          = s->avctx->coded_width;
     pic_param->coded_height                                         = s->avctx->coded_height;
     pic_param->entrypoint_fields.value                              = 0; /* reset all bits */
@@ -308,7 +311,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
     MpegEncContext * const s = &v->s;
     VASliceParameterBufferVC1 *slice_param;
 
-    dprintf(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);
+    av_dlog(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);
 
     /* Current bit buffer is beyond any marker for VC-1, so skip it */
     if (avctx->codec_id == CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) {
@@ -326,7 +329,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
 }
 
 #if CONFIG_WMV3_VAAPI_HWACCEL
-AVHWAccel wmv3_vaapi_hwaccel = {
+AVHWAccel ff_wmv3_vaapi_hwaccel = {
     .name           = "wmv3_vaapi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_WMV3,
@@ -339,7 +342,7 @@ AVHWAccel wmv3_vaapi_hwaccel = {
 };
 #endif
 
-AVHWAccel vc1_vaapi_hwaccel = {
+AVHWAccel ff_vc1_vaapi_hwaccel = {
     .name           = "vc1_vaapi",
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_VC1,
diff --git a/ffmpeg-mt/libavcodec/vb.c b/ffmpeg-mt/libavcodec/vb.c
index 13c4b0a..fb37283 100644
--- a/ffmpeg-mt/libavcodec/vb.c
+++ b/ffmpeg-mt/libavcodec/vb.c
@@ -2,20 +2,20 @@
  * Beam Software VB decoder
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -287,7 +287,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec vb_decoder = {
+AVCodec ff_vb_decoder = {
     "vb",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VB,
diff --git a/ffmpeg-mt/libavcodec/vc1.c b/ffmpeg-mt/libavcodec/vc1.c
index 86904cb..77e71db 100644
--- a/ffmpeg-mt/libavcodec/vc1.c
+++ b/ffmpeg-mt/libavcodec/vc1.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2007 Konstantin Shishkov
  * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -280,6 +280,28 @@ static int vop_dquant_decoding(VC1Context *v)
 
 static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb);
 
+static void simple_idct_put_rangered(uint8_t *dest, int line_size, DCTELEM *block)
+{
+    int i;
+    ff_simple_idct(block);
+    for (i = 0; i < 64; i++) block[i] = (block[i] - 64) << 1;
+    ff_put_pixels_clamped_c(block, dest, line_size);
+}
+
+static void simple_idct_put_signed(uint8_t *dest, int line_size, DCTELEM *block)
+{
+    ff_simple_idct(block);
+    ff_put_signed_pixels_clamped_c(block, dest, line_size);
+}
+
+static void simple_idct_put_signed_rangered(uint8_t *dest, int line_size, DCTELEM *block)
+{
+    int i;
+    ff_simple_idct(block);
+    for (i = 0; i < 64; i++) block[i] <<= 1;
+    ff_put_signed_pixels_clamped_c(block, dest, line_size);
+}
+
 /**
  * Decode Simple/Main Profiles sequence header
  * @see Figure 7-8, p16-17
@@ -293,7 +315,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
     v->profile = get_bits(gb, 2);
     if (v->profile == PROFILE_COMPLEX)
     {
-        av_log(avctx, AV_LOG_ERROR, "WMV3 Complex Profile is not fully supported\n");
+        av_log(avctx, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n");
     }
 
     if (v->profile == PROFILE_ADVANCED)
@@ -337,14 +359,18 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
     v->res_fasttx = get_bits1(gb);
     if (!v->res_fasttx)
     {
-        v->s.dsp.vc1_inv_trans_8x8 = ff_simple_idct;
-        v->s.dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
-        v->s.dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;
-        v->s.dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;
-        v->s.dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add;
-        v->s.dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add;
-        v->s.dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add;
-        v->s.dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add;
+        v->vc1dsp.vc1_inv_trans_8x8_add = ff_simple_idct_add;
+        v->vc1dsp.vc1_inv_trans_8x8_put[0] = ff_simple_idct_put;
+        v->vc1dsp.vc1_inv_trans_8x8_put[1] = simple_idct_put_rangered;
+        v->vc1dsp.vc1_inv_trans_8x8_put_signed[0] = simple_idct_put_signed;
+        v->vc1dsp.vc1_inv_trans_8x8_put_signed[1] = simple_idct_put_signed_rangered;
+        v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
+        v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;
+        v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;
+        v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add;
+        v->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add;
+        v->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add;
+        v->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add;
     }
 
     v->fastuvmc =  get_bits1(gb); //common
@@ -837,6 +863,7 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
         }
     }
     if(v->panscanflag) {
+        av_log_missing_feature(v->s.avctx, "Pan-scan", 0);
         //...
     }
     v->rnd = get_bits1(gb);
diff --git a/ffmpeg-mt/libavcodec/vc1.h b/ffmpeg-mt/libavcodec/vc1.h
index e5a9cba..00dcfbf 100644
--- a/ffmpeg-mt/libavcodec/vc1.h
+++ b/ffmpeg-mt/libavcodec/vc1.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2007 Konstantin Shishkov
  * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,6 +26,7 @@
 #include "avcodec.h"
 #include "mpegvideo.h"
 #include "intrax8.h"
+#include "vc1dsp.h"
 
 /** Markers used in VC-1 AP frame data */
 //@{
@@ -155,6 +156,7 @@ enum COTypes {
 typedef struct VC1Context{
     MpegEncContext s;
     IntraX8Context x8;
+    VC1DSPContext vc1dsp;
 
     int bits;
 
@@ -215,6 +217,7 @@ typedef struct VC1Context{
     int k_y;              ///< Number of bits for MVs (depends on MV range)
     int range_x, range_y; ///< MV range
     uint8_t pq, altpq;    ///< Current/alternate frame quantizer scale
+    uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT
     const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode
     const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode
     /** pquant parameters */
@@ -233,7 +236,7 @@ typedef struct VC1Context{
     //@}
     int ttfrm;            ///< Transform type info present at frame level
     uint8_t ttmbf;        ///< Transform type flag
-    uint8_t ttblk4x4;     ///< Value of ttblk which indicates a 4x4 transform
+    int *ttblk_base, *ttblk; ///< Transform type at the block level
     int codingset;        ///< index of current table set from 11.8 to use for luma block decoding
     int codingset2;       ///< index of current table set from 11.8 to use for chroma block decoding
     int pqindex;          ///< raw pqindex used in coding set selection
@@ -308,6 +311,8 @@ typedef struct VC1Context{
     int x8_type;
 
     uint32_t *cbp_base, *cbp;
+    uint8_t *is_intra_base, *is_intra;
+    int16_t (*luma_mv_base)[2], (*luma_mv)[2];
     uint8_t bfraction_lut_index;///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
     uint8_t broken_link;        ///< Broken link flag (BROKEN_LINK syntax element)
     uint8_t closed_entry;       ///< Closed entry point flag (CLOSED_ENTRY syntax element)
diff --git a/ffmpeg-mt/libavcodec/vc1_parser.c b/ffmpeg-mt/libavcodec/vc1_parser.c
index 6e559de..da8ba87 100644
--- a/ffmpeg-mt/libavcodec/vc1_parser.c
+++ b/ffmpeg-mt/libavcodec/vc1_parser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2007 Konstantin Shishkov
  * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -169,7 +169,7 @@ static int vc1_split(AVCodecContext *avctx,
     return 0;
 }
 
-AVCodecParser vc1_parser = {
+AVCodecParser ff_vc1_parser = {
     { CODEC_ID_VC1 },
     sizeof(VC1ParseContext),
     NULL,
diff --git a/ffmpeg-mt/libavcodec/vc1acdata.h b/ffmpeg-mt/libavcodec/vc1acdata.h
index 78de0f9..a7a33ff 100644
--- a/ffmpeg-mt/libavcodec/vc1acdata.h
+++ b/ffmpeg-mt/libavcodec/vc1acdata.h
@@ -2,20 +2,20 @@
  * VC-1 and WMV3 decoder
  * copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vc1data.c b/ffmpeg-mt/libavcodec/vc1data.c
index 5298079..1cbf93e 100644
--- a/ffmpeg-mt/libavcodec/vc1data.c
+++ b/ffmpeg-mt/libavcodec/vc1data.c
@@ -3,20 +3,20 @@
  * copyright (c) 2006 Konstantin Shishkov
  * (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vc1data.h b/ffmpeg-mt/libavcodec/vc1data.h
index 934627a..1ccc9bb 100644
--- a/ffmpeg-mt/libavcodec/vc1data.h
+++ b/ffmpeg-mt/libavcodec/vc1data.h
@@ -3,20 +3,20 @@
  * copyright (c) 2006 Konstantin Shishkov
  * (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vc1dec.c b/ffmpeg-mt/libavcodec/vc1dec.c
index c9a547b..cde284d 100644
--- a/ffmpeg-mt/libavcodec/vc1dec.c
+++ b/ffmpeg-mt/libavcodec/vc1dec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2006-2007 Konstantin Shishkov
  * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -160,62 +160,30 @@ enum Imode {
 
 /** @} */ //Bitplane group
 
-static void vc1_loop_filter_iblk(MpegEncContext *s, int pq)
+static void vc1_loop_filter_iblk(VC1Context *v, int pq)
 {
+    MpegEncContext *s = &v->s;
     int j;
     if (!s->first_slice_line) {
-        s->dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq);
+        v->vc1dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq);
         if (s->mb_x)
-            s->dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize, s->linesize, pq);
-        s->dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize+8, s->linesize, pq);
+            v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize, s->linesize, pq);
+        v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize+8, s->linesize, pq);
         for(j = 0; j < 2; j++){
-            s->dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq);
+            v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq);
             if (s->mb_x)
-                s->dsp.vc1_h_loop_filter8(s->dest[j+1]-8*s->uvlinesize, s->uvlinesize, pq);
+                v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1]-8*s->uvlinesize, s->uvlinesize, pq);
         }
     }
-    s->dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq);
+    v->vc1dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq);
 
     if (s->mb_y == s->mb_height-1) {
         if (s->mb_x) {
-            s->dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq);
-            s->dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq);
-            s->dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq);
+            v->vc1dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq);
+            v->vc1dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq);
+            v->vc1dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq);
         }
-        s->dsp.vc1_h_loop_filter16(s->dest[0] + 8, s->linesize, pq);
-    }
-}
-
-/** Put block onto picture
- */
-static void vc1_put_block(VC1Context *v, DCTELEM block[6][64])
-{
-    uint8_t *Y;
-    int ys, us, vs;
-    DSPContext *dsp = &v->s.dsp;
-
-    if(v->rangeredfrm) {
-        int i, j, k;
-        for(k = 0; k < 6; k++)
-            for(j = 0; j < 8; j++)
-                for(i = 0; i < 8; i++)
-                    block[k][i + j*8] = ((block[k][i + j*8] - 128) << 1) + 128;
-
-    }
-    ys = v->s.current_picture.linesize[0];
-    us = v->s.current_picture.linesize[1];
-    vs = v->s.current_picture.linesize[2];
-    Y = v->s.dest[0];
-
-    dsp->put_pixels_clamped(block[0], Y, ys);
-    dsp->put_pixels_clamped(block[1], Y + 8, ys);
-    Y += ys * 8;
-    dsp->put_pixels_clamped(block[2], Y, ys);
-    dsp->put_pixels_clamped(block[3], Y + 8, ys);
-
-    if(!(v->s.flags & CODEC_FLAG_GRAY)) {
-        dsp->put_pixels_clamped(block[4], v->s.dest[1], us);
-        dsp->put_pixels_clamped(block[5], v->s.dest[2], vs);
+        v->vc1dsp.vc1_h_loop_filter16(s->dest[0] + 8, s->linesize, pq);
     }
 }
 
@@ -241,6 +209,8 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
     }
     uvmx = (mx + ((mx & 3) == 3)) >> 1;
     uvmy = (my + ((my & 3) == 3)) >> 1;
+    v->luma_mv[s->mb_x][0] = uvmx;
+    v->luma_mv[s->mb_x][1] = uvmy;
     if(v->fastuvmc) {
         uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
         uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
@@ -288,12 +258,12 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
         uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize;
 
         srcY -= s->mspel * (1 + s->linesize);
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2,
                             src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
         srcY = s->edge_emu_buffer;
-        ff_emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, 8+1, 8+1,
+        s->dsp.emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, 8+1, 8+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
+        s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
         srcU = uvbuf;
         srcV = uvbuf + 16;
@@ -342,11 +312,11 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
 
     if(s->mspel) {
         dxy = ((my & 3) << 2) | (mx & 3);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0]    , srcY    , s->linesize, v->rnd);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
+        v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0]    , srcY    , s->linesize, v->rnd);
+        v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
         srcY += s->linesize * 8;
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize    , srcY    , s->linesize, v->rnd);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
+        v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize    , srcY    , s->linesize, v->rnd);
+        v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
     } else { // hpel mc - always used for luma
         dxy = (my & 2) | ((mx & 2) >> 1);
 
@@ -364,8 +334,8 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
         dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
         dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
     }else{
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
+        v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
+        v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
     }
 }
 
@@ -403,7 +373,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n)
        || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2
        || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel*2){
         srcY -= s->mspel * (1 + s->linesize);
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2,
                             src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
         srcY = s->edge_emu_buffer;
         /* if we deal with range reduction we need to scale source blocks */
@@ -433,7 +403,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n)
 
     if(s->mspel) {
         dxy = ((my & 3) << 2) | (mx & 3);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd);
+        v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd);
     } else { // hpel mc - always used for luma
         dxy = (my & 2) | ((mx & 2) >> 1);
         if(!v->rnd)
@@ -509,6 +479,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
     } else {
         s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
         s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
+        v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0;
         return; //no need to do MC for inter blocks
     }
 
@@ -516,6 +487,8 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
     s->current_picture.motion_val[1][s->block_index[0]][1] = ty;
     uvmx = (tx + ((tx&3) == 3)) >> 1;
     uvmy = (ty + ((ty&3) == 3)) >> 1;
+    v->luma_mv[s->mb_x][0] = uvmx;
+    v->luma_mv[s->mb_x][1] = uvmy;
     if(v->fastuvmc) {
         uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
         uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
@@ -537,9 +510,9 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
     if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
        || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9
        || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){
-        ff_emulated_edge_mc(s->edge_emu_buffer     , srcU, s->uvlinesize, 8+1, 8+1,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer     , srcU, s->uvlinesize, 8+1, 8+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
         srcU = s->edge_emu_buffer;
         srcV = s->edge_emu_buffer + 16;
@@ -583,8 +556,8 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
         dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
         dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
     }else{
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
+        v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
+        v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
     }
 }
 
@@ -684,8 +657,9 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
 
 /** Predict and set motion vector
  */
-static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra)
+static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra)
 {
+    MpegEncContext *s = &v->s;
     int xy, wrap, off = 0;
     int16_t *A, *B, *C;
     int px, py;
@@ -710,6 +684,7 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i
             s->current_picture.motion_val[0][xy + wrap][1] = 0;
             s->current_picture.motion_val[0][xy + wrap + 1][0] = 0;
             s->current_picture.motion_val[0][xy + wrap + 1][1] = 0;
+            v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0;
             s->current_picture.motion_val[1][xy + 1][0] = 0;
             s->current_picture.motion_val[1][xy + 1][1] = 0;
             s->current_picture.motion_val[1][xy + wrap][0] = 0;
@@ -872,12 +847,12 @@ static void vc1_interp_mc(VC1Context *v)
         uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize;
 
         srcY -= s->mspel * (1 + s->linesize);
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2,
                             src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
         srcY = s->edge_emu_buffer;
-        ff_emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, 8+1, 8+1,
+        s->dsp.emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, 8+1, 8+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
+        s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
                             uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
         srcU = uvbuf;
         srcV = uvbuf + 16;
@@ -906,11 +881,11 @@ static void vc1_interp_mc(VC1Context *v)
 
     if(s->mspel) {
         dxy = ((my & 3) << 2) | (mx & 3);
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0]    , srcY    , s->linesize, v->rnd);
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
+        v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0]    , srcY    , s->linesize, v->rnd);
+        v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
         srcY += s->linesize * 8;
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize    , srcY    , s->linesize, v->rnd);
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
+        v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize    , srcY    , s->linesize, v->rnd);
+        v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
     } else { // hpel mc
         dxy = (my & 2) | ((mx & 2) >> 1);
 
@@ -928,8 +903,8 @@ static void vc1_interp_mc(VC1Context *v)
         dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
         dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
     }else{
-        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
+        v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
+        v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
     }
 }
 
@@ -1375,7 +1350,7 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value,
     if (index != vc1_ac_sizes[codingset] - 1) {
         run = vc1_index_decode_table[codingset][index][0];
         level = vc1_index_decode_table[codingset][index][1];
-        lst = index >= vc1_last_decode_table[codingset];
+        lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0;
         if(get_bits1(gb))
             level = -level;
     } else {
@@ -1499,11 +1474,11 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
 
         if(v->s.ac_pred) {
             if(!dc_pred_dir)
-                zz_table = wmv1_scantable[2];
+                zz_table = v->zz_8x8[2];
             else
-                zz_table = wmv1_scantable[3];
+                zz_table = v->zz_8x8[3];
         } else
-            zz_table = wmv1_scantable[1];
+            zz_table = v->zz_8x8[1];
 
         ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
         ac_val2 = ac_val;
@@ -1524,16 +1499,16 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded
         if(s->ac_pred) {
             if(dc_pred_dir) { //left
                 for(k = 1; k < 8; k++)
-                    block[k << 3] += ac_val[k];
+                    block[k] += ac_val[k];
             } else { //top
                 for(k = 1; k < 8; k++)
-                    block[k] += ac_val[k + 8];
+                    block[k << 3] += ac_val[k + 8];
             }
         }
         /* save AC coeffs for further prediction */
         for(k = 1; k < 8; k++) {
-            ac_val2[k] = block[k << 3];
-            ac_val2[k + 8] = block[k];
+            ac_val2[k] = block[k];
+            ac_val2[k + 8] = block[k << 3];
         }
 
         /* scale AC coeffs */
@@ -1570,15 +1545,15 @@ not_coded:
         if(s->ac_pred) {
             if(dc_pred_dir) { //left
                 for(k = 1; k < 8; k++) {
-                    block[k << 3] = ac_val[k] * scale;
-                    if(!v->pquantizer && block[k << 3])
-                        block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq;
+                    block[k] = ac_val[k] * scale;
+                    if(!v->pquantizer && block[k])
+                        block[k] += (block[k] < 0) ? -v->pq : v->pq;
                 }
             } else { //top
                 for(k = 1; k < 8; k++) {
-                    block[k] = ac_val[k + 8] * scale;
-                    if(!v->pquantizer && block[k])
-                        block[k] += (block[k] < 0) ? -v->pq : v->pq;
+                    block[k << 3] = ac_val[k + 8] * scale;
+                    if(!v->pquantizer && block[k << 3])
+                        block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq;
                 }
             }
             i = 63;
@@ -1682,11 +1657,11 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
 
         if(v->s.ac_pred) {
             if(!dc_pred_dir)
-                zz_table = wmv1_scantable[2];
+                zz_table = v->zz_8x8[2];
             else
-                zz_table = wmv1_scantable[3];
+                zz_table = v->zz_8x8[3];
         } else
-            zz_table = wmv1_scantable[1];
+            zz_table = v->zz_8x8[1];
 
         while (!last) {
             vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
@@ -1705,25 +1680,25 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
 
                 if(dc_pred_dir) { //left
                     for(k = 1; k < 8; k++)
-                        block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
+                        block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
                 } else { //top
                     for(k = 1; k < 8; k++)
-                        block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
+                        block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
                 }
             } else {
                 if(dc_pred_dir) { //left
                     for(k = 1; k < 8; k++)
-                        block[k << 3] += ac_val[k];
+                        block[k] += ac_val[k];
                 } else { //top
                     for(k = 1; k < 8; k++)
-                        block[k] += ac_val[k + 8];
+                        block[k << 3] += ac_val[k + 8];
                 }
             }
         }
         /* save AC coeffs for further prediction */
         for(k = 1; k < 8; k++) {
-            ac_val2[k] = block[k << 3];
-            ac_val2[k + 8] = block[k];
+            ac_val2[k] = block[k];
+            ac_val2[k + 8] = block[k << 3];
         }
 
         /* scale AC coeffs */
@@ -1765,15 +1740,15 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c
         if(use_pred) {
             if(dc_pred_dir) { //left
                 for(k = 1; k < 8; k++) {
-                    block[k << 3] = ac_val2[k] * scale;
-                    if(!v->pquantizer && block[k << 3])
-                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
+                    block[k] = ac_val2[k] * scale;
+                    if(!v->pquantizer && block[k])
+                        block[k] += (block[k] < 0) ? -mquant : mquant;
                 }
             } else { //top
                 for(k = 1; k < 8; k++) {
-                    block[k] = ac_val2[k + 8] * scale;
-                    if(!v->pquantizer && block[k])
-                        block[k] += (block[k] < 0) ? -mquant : mquant;
+                    block[k << 3] = ac_val2[k + 8] * scale;
+                    if(!v->pquantizer && block[k << 3])
+                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
                 }
             }
             i = 63;
@@ -1884,17 +1859,14 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
 
     if(coded) {
         int last = 0, skip, value;
-        const uint8_t *zz_table;
         int k;
 
-        zz_table = wmv1_scantable[0];
-
         while (!last) {
             vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
             i += skip;
             if(i > 63)
                 break;
-            block[zz_table[i++]] = value;
+            block[v->zz_8x8[0][i++]] = value;
         }
 
         /* apply AC prediction if needed */
@@ -1906,25 +1878,25 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
 
                 if(dc_pred_dir) { //left
                     for(k = 1; k < 8; k++)
-                        block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
+                        block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
                 } else { //top
                     for(k = 1; k < 8; k++)
-                        block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
+                        block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
                 }
             } else {
                 if(dc_pred_dir) { //left
                     for(k = 1; k < 8; k++)
-                        block[k << 3] += ac_val[k];
+                        block[k] += ac_val[k];
                 } else { //top
                     for(k = 1; k < 8; k++)
-                        block[k] += ac_val[k + 8];
+                        block[k << 3] += ac_val[k + 8];
                 }
             }
         }
         /* save AC coeffs for further prediction */
         for(k = 1; k < 8; k++) {
-            ac_val2[k] = block[k << 3];
-            ac_val2[k + 8] = block[k];
+            ac_val2[k] = block[k];
+            ac_val2[k + 8] = block[k << 3];
         }
 
         /* scale AC coeffs */
@@ -1966,15 +1938,15 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
         if(use_pred) {
             if(dc_pred_dir) { //left
                 for(k = 1; k < 8; k++) {
-                    block[k << 3] = ac_val2[k] * scale;
-                    if(!v->pquantizer && block[k << 3])
-                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
+                    block[k] = ac_val2[k] * scale;
+                    if(!v->pquantizer && block[k])
+                        block[k] += (block[k] < 0) ? -mquant : mquant;
                 }
             } else { //top
                 for(k = 1; k < 8; k++) {
-                    block[k] = ac_val2[k + 8] * scale;
-                    if(!v->pquantizer && block[k])
-                        block[k] += (block[k] < 0) ? -mquant : mquant;
+                    block[k << 3] = ac_val2[k + 8] * scale;
+                    if(!v->pquantizer && block[k << 3])
+                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
                 }
             }
             i = 63;
@@ -1988,7 +1960,7 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c
 /** Decode P block
  */
 static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquant, int ttmb, int first_block,
-                              uint8_t *dst, int linesize, int skip_block, int apply_filter, int cbp_top, int cbp_left)
+                              uint8_t *dst, int linesize, int skip_block, int *ttmb_out)
 {
     MpegEncContext *s = &v->s;
     GetBitContext *gb = &s->gb;
@@ -2035,22 +2007,17 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
             i += skip;
             if(i > 63)
                 break;
-            idx = wmv1_scantable[0][i++];
+            idx = v->zz_8x8[0][i++];
             block[idx] = value * scale;
             if(!v->pquantizer)
                 block[idx] += (block[idx] < 0) ? -mquant : mquant;
         }
         if(!skip_block){
             if(i==1)
-                s->dsp.vc1_inv_trans_8x8_dc(dst, linesize, block);
+                v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block);
             else{
-                s->dsp.vc1_inv_trans_8x8(block);
-                s->dsp.add_pixels_clamped(block, dst, linesize);
+                v->vc1dsp.vc1_inv_trans_8x8_add(dst, linesize, block);
             }
-            if(apply_filter && cbp_top  & 0xC)
-                s->dsp.vc1_v_loop_filter8(dst, linesize, v->pq);
-            if(apply_filter && cbp_left & 0xA)
-                s->dsp.vc1_h_loop_filter8(dst, linesize, v->pq);
         }
         break;
     case TT_4X4:
@@ -2071,13 +2038,9 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
             }
             if(!(subblkpat & (1 << (3 - j))) && !skip_block){
                 if(i==1)
-                    s->dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
+                    v->vc1dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
                 else
-                    s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
-                if(apply_filter && (j&2 ? pat & (1<<(j-2)) : (cbp_top & (1 << (j + 2)))))
-                    s->dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq);
-                if(apply_filter && (j&1 ? pat & (1<<(j-1)) : (cbp_left & (1 << (j + 1)))))
-                    s->dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq);
+                    v->vc1dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
             }
         }
         break;
@@ -2099,13 +2062,9 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
             }
             if(!(subblkpat & (1 << (1 - j))) && !skip_block){
                 if(i==1)
-                    s->dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off);
+                    v->vc1dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off);
                 else
-                    s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off);
-                if(apply_filter && j ? pat & 0x3 : (cbp_top & 0xC))
-                    s->dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq);
-                if(apply_filter && cbp_left & (2 << j))
-                    s->dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq);
+                    v->vc1dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off);
             }
         }
         break;
@@ -2127,17 +2086,15 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
             }
             if(!(subblkpat & (1 << (1 - j))) && !skip_block){
                 if(i==1)
-                    s->dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off);
+                    v->vc1dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off);
                 else
-                    s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off);
-                if(apply_filter && cbp_top & (2 << j))
-                    s->dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq);
-                if(apply_filter && j ? pat & 0x5 : (cbp_left & 0xA))
-                    s->dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq);
+                    v->vc1dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off);
             }
         }
         break;
     }
+    if (ttmb_out)
+        *ttmb_out |= ttblk << (n * 4);
     return pat;
 }
 
@@ -2146,13 +2103,162 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan
 static const int size_table  [6] = { 0, 2, 3, 4,  5,  8 };
 static const int offset_table[6] = { 0, 1, 3, 7, 15, 31 };
 
+static av_always_inline void vc1_apply_p_v_loop_filter(VC1Context *v, int block_num)
+{
+    MpegEncContext *s = &v->s;
+    int mb_cbp         = v->cbp[s->mb_x - s->mb_stride],
+        block_cbp      = mb_cbp      >> (block_num * 4), bottom_cbp,
+        mb_is_intra    = v->is_intra[s->mb_x - s->mb_stride],
+        block_is_intra = mb_is_intra >> (block_num * 4), bottom_is_intra;
+    int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize, ttblk;
+    uint8_t *dst;
+
+    if(block_num > 3) {
+        dst      = s->dest[block_num - 3];
+    } else {
+        dst      = s->dest[0] + (block_num & 1) * 8 + ((block_num & 2) * 4 - 8) * linesize;
+    }
+    if (s->mb_y != s->mb_height || block_num < 2) {
+        int16_t (*mv)[2];
+        int mv_stride;
+
+        if(block_num > 3) {
+            bottom_cbp      = v->cbp[s->mb_x]      >> (block_num * 4);
+            bottom_is_intra = v->is_intra[s->mb_x] >> (block_num * 4);
+            mv              = &v->luma_mv[s->mb_x - s->mb_stride];
+            mv_stride       = s->mb_stride;
+        } else {
+            bottom_cbp      = (block_num < 2) ? (mb_cbp               >> ((block_num + 2) * 4)) :
+                                                (v->cbp[s->mb_x]      >> ((block_num - 2) * 4));
+            bottom_is_intra = (block_num < 2) ? (mb_is_intra          >> ((block_num + 2) * 4)) :
+                                                (v->is_intra[s->mb_x] >> ((block_num - 2) * 4));
+            mv_stride       = s->b8_stride;
+            mv              = &s->current_picture.motion_val[0][s->block_index[block_num] - 2 * mv_stride];
+        }
+
+        if (bottom_is_intra & 1 || block_is_intra & 1 ||
+            mv[0][0] != mv[mv_stride][0] || mv[0][1] != mv[mv_stride][1]) {
+            v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq);
+        } else {
+            idx = ((bottom_cbp >> 2) | block_cbp) & 3;
+            if(idx == 3) {
+                v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq);
+            } else if (idx) {
+                if (idx == 1)
+                    v->vc1dsp.vc1_v_loop_filter4(dst + 4, linesize, v->pq);
+                else
+                    v->vc1dsp.vc1_v_loop_filter4(dst,     linesize, v->pq);
+            }
+        }
+    }
+
+    dst -= 4 * linesize;
+    ttblk = (v->ttblk[s->mb_x - s->mb_stride] >> (block_num * 4)) & 0xf;
+    if (ttblk == TT_4X4 || ttblk == TT_8X4) {
+        idx = (block_cbp | (block_cbp >> 2)) & 3;
+        if (idx == 3) {
+            v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq);
+        } else if (idx) {
+            if (idx == 1)
+                v->vc1dsp.vc1_v_loop_filter4(dst + 4, linesize, v->pq);
+            else
+                v->vc1dsp.vc1_v_loop_filter4(dst,     linesize, v->pq);
+        }
+    }
+}
+
+static av_always_inline void vc1_apply_p_h_loop_filter(VC1Context *v, int block_num)
+{
+    MpegEncContext *s = &v->s;
+    int mb_cbp         = v->cbp[s->mb_x - 1 - s->mb_stride],
+        block_cbp      = mb_cbp      >> (block_num * 4), right_cbp,
+        mb_is_intra    = v->is_intra[s->mb_x - 1 - s->mb_stride],
+        block_is_intra = mb_is_intra >> (block_num * 4), right_is_intra;
+    int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize, ttblk;
+    uint8_t *dst;
+
+    if (block_num > 3) {
+        dst = s->dest[block_num - 3] - 8 * linesize;
+    } else {
+        dst = s->dest[0] + (block_num & 1) * 8 + ((block_num & 2) * 4 - 16) * linesize - 8;
+    }
+
+    if (s->mb_x != s->mb_width || !(block_num & 5)) {
+        int16_t (*mv)[2];
+
+        if(block_num > 3) {
+            right_cbp      = v->cbp[s->mb_x - s->mb_stride] >> (block_num * 4);
+            right_is_intra = v->is_intra[s->mb_x - s->mb_stride] >> (block_num * 4);
+            mv             = &v->luma_mv[s->mb_x - s->mb_stride - 1];
+        }else{
+            right_cbp      = (block_num & 1) ? (v->cbp[s->mb_x - s->mb_stride]      >> ((block_num - 1) * 4)) :
+                                               (mb_cbp                              >> ((block_num + 1) * 4));
+            right_is_intra = (block_num & 1) ? (v->is_intra[s->mb_x - s->mb_stride] >> ((block_num - 1) * 4)) :
+                                               (mb_is_intra                         >> ((block_num + 1) * 4));
+            mv             = &s->current_picture.motion_val[0][s->block_index[block_num] - s->b8_stride * 2 - 2];
+        }
+        if (block_is_intra & 1 || right_is_intra & 1 || mv[0][0] != mv[1][0] || mv[0][1] != mv[1][1]) {
+            v->vc1dsp.vc1_h_loop_filter8(dst, linesize, v->pq);
+        } else {
+            idx = ((right_cbp >> 1) | block_cbp) & 5; // FIXME check
+            if (idx == 5) {
+                v->vc1dsp.vc1_h_loop_filter8(dst, linesize, v->pq);
+            } else if (idx) {
+                if (idx == 1)
+                    v->vc1dsp.vc1_h_loop_filter4(dst+4*linesize, linesize, v->pq);
+                else
+                    v->vc1dsp.vc1_h_loop_filter4(dst,            linesize, v->pq);
+            }
+        }
+    }
+
+    dst -= 4;
+    ttblk = (v->ttblk[s->mb_x - s->mb_stride - 1] >> (block_num * 4)) & 0xf;
+    if (ttblk == TT_4X4 || ttblk == TT_4X8) {
+        idx = (block_cbp | (block_cbp >> 1)) & 5;
+        if (idx == 5) {
+            v->vc1dsp.vc1_h_loop_filter8(dst, linesize, v->pq);
+        } else if (idx) {
+            if (idx == 1)
+                v->vc1dsp.vc1_h_loop_filter4(dst + linesize*4, linesize, v->pq);
+            else
+                v->vc1dsp.vc1_h_loop_filter4(dst,              linesize, v->pq);
+        }
+    }
+}
+
+static void vc1_apply_p_loop_filter(VC1Context *v)
+{
+    MpegEncContext *s = &v->s;
+    int i;
+
+    for (i = 0; i < 6; i++) {
+        vc1_apply_p_v_loop_filter(v, i);
+    }
+
+    /* V always preceedes H, therefore we run H one MB before V;
+     * at the end of a row, we catch up to complete the row */
+    if (s->mb_x) {
+        for (i = 0; i < 6; i++) {
+            vc1_apply_p_h_loop_filter(v, i);
+        }
+        if (s->mb_x == s->mb_width - 1) {
+            s->mb_x++;
+            ff_update_block_index(s);
+            for (i = 0; i < 6; i++) {
+                vc1_apply_p_h_loop_filter(v, i);
+            }
+        }
+    }
+}
+
 /** Decode one P-frame MB (in Simple/Main profile)
  */
 static int vc1_decode_p_mb(VC1Context *v)
 {
     MpegEncContext *s = &v->s;
     GetBitContext *gb = &s->gb;
-    int i, j;
+    int i;
     int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
     int cbp; /* cbp decoding stuff */
     int mqdiff, mquant; /* MB quantization */
@@ -2165,8 +2271,7 @@ static int vc1_decode_p_mb(VC1Context *v)
     int first_block = 1;
     int dst_idx, off;
     int skipped, fourmv;
-    int block_cbp = 0, pat;
-    int apply_loop_filter;
+    int block_cbp = 0, pat, block_tt = 0, block_intra = 0;
 
     mquant = v->pq; /* Loosy initialization */
 
@@ -2179,11 +2284,12 @@ static int vc1_decode_p_mb(VC1Context *v)
     else
         skipped = v->s.mbskip_table[mb_pos];
 
-    apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY);
     if (!fourmv) /* 1MV mode */
     {
         if (!skipped)
         {
+            vc1_idct_func idct8x8_fn;
+
             GET_MVDATA(dmv_x, dmv_y);
 
             if (s->mb_intra) {
@@ -2191,7 +2297,7 @@ static int vc1_decode_p_mb(VC1Context *v)
                 s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
             }
             s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16;
-            vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]);
+            vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]);
 
             /* FIXME Set DC val for inter block ? */
             if (s->mb_intra && !mb_has_coeffs)
@@ -2218,6 +2324,7 @@ static int vc1_decode_p_mb(VC1Context *v)
                                 VC1_TTMB_VLC_BITS, 2);
             if(!s->mb_intra) vc1_mc_1mv(v, 0);
             dst_idx = 0;
+            idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm];
             for (i=0; i<6; i++)
             {
                 s->dc_val[0][s->block_index[i]] = 0;
@@ -2235,47 +2342,19 @@ static int vc1_decode_p_mb(VC1Context *v)
 
                     vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
                     if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
-                    s->dsp.vc1_inv_trans_8x8(s->block[i]);
-                    if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
-                    s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
+                    idct8x8_fn(s->dest[dst_idx] + off,
+                               i & 4 ? s->uvlinesize : s->linesize,
+                               s->block[i]);
                     if(v->pq >= 9 && v->overlap) {
                         if(v->c_avail)
-                            s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
+                            v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
                         if(v->a_avail)
-                            s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
-                    }
-                    if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        int left_cbp, top_cbp;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
+                            v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
                     }
                     block_cbp |= 0xF << (i << 2);
+                    block_intra |= 1 << i;
                 } else if(val) {
-                    int left_cbp = 0, top_cbp = 0, filter = 0;
-                    if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        filter = 1;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                    }
-                    pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
+                    pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), &block_tt);
                     block_cbp |= pat << (i << 2);
                     if(!v->ttmbf && ttmb < 8) ttmb = -1;
                     first_block = 0;
@@ -2291,9 +2370,8 @@ static int vc1_decode_p_mb(VC1Context *v)
             }
             s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP;
             s->current_picture.qscale_table[mb_pos] = 0;
-            vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]);
+            vc1_pred_mv(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]);
             vc1_mc_1mv(v, 0);
-            return 0;
         }
     } //1MV mode
     else //4MV mode
@@ -2302,6 +2380,7 @@ static int vc1_decode_p_mb(VC1Context *v)
         {
             int intra_count = 0, coded_inter = 0;
             int is_intra[6], is_coded[6];
+            vc1_idct_func idct8x8_fn;
             /* Get CBPCY */
             cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
             for (i=0; i<6; i++)
@@ -2316,7 +2395,7 @@ static int vc1_decode_p_mb(VC1Context *v)
                     if(val) {
                         GET_MVDATA(dmv_x, dmv_y);
                     }
-                    vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]);
+                    vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]);
                     if(!s->mb_intra) vc1_mc_4mv_luma(v, i);
                     intra_count += s->mb_intra;
                     is_intra[i] = s->mb_intra;
@@ -2331,8 +2410,9 @@ static int vc1_decode_p_mb(VC1Context *v)
                 if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i];
             }
             // if there are no coded blocks then don't do anything more
-            if(!intra_count && !coded_inter) return 0;
             dst_idx = 0;
+            if(!intra_count && !coded_inter)
+                goto end;
             GET_MQUANT();
             s->current_picture.qscale_table[mb_pos] = mquant;
             /* test if block is intra and has pred */
@@ -2351,6 +2431,7 @@ static int vc1_decode_p_mb(VC1Context *v)
             }
             if (!v->ttmbf && coded_inter)
                 ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
+            idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm];
             for (i=0; i<6; i++)
             {
                 dst_idx += i >> 2;
@@ -2366,53 +2447,24 @@ static int vc1_decode_p_mb(VC1Context *v)
 
                     vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset);
                     if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
-                    s->dsp.vc1_inv_trans_8x8(s->block[i]);
-                    if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
-                    s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
+                    idct8x8_fn(s->dest[dst_idx] + off,
+                               (i&4)?s->uvlinesize:s->linesize,
+                               s->block[i]);
                     if(v->pq >= 9 && v->overlap) {
                         if(v->c_avail)
-                            s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
+                            v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
                         if(v->a_avail)
-                            s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
-                    }
-                    if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        int left_cbp, top_cbp;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
+                            v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
                     }
                     block_cbp |= 0xF << (i << 2);
+                    block_intra |= 1 << i;
                 } else if(is_coded[i]) {
-                    int left_cbp = 0, top_cbp = 0, filter = 0;
-                    if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        filter = 1;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                    }
-                    pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
+                    pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), &block_tt);
                     block_cbp |= pat << (i << 2);
                     if(!v->ttmbf && ttmb < 8) ttmb = -1;
                     first_block = 0;
                 }
             }
-            return 0;
         }
         else //Skipped MB
         {
@@ -2424,18 +2476,19 @@ static int vc1_decode_p_mb(VC1Context *v)
             }
             for (i=0; i<4; i++)
             {
-                vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]);
+                vc1_pred_mv(v, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]);
                 vc1_mc_4mv_luma(v, i);
             }
             vc1_mc_4mv_chroma(v);
             s->current_picture.qscale_table[mb_pos] = 0;
-            return 0;
         }
     }
+end:
     v->cbp[s->mb_x] = block_cbp;
+    v->ttblk[s->mb_x] = block_tt;
+    v->is_intra[s->mb_x] = block_intra;
 
-    /* Should never happen */
-    return -1;
+    return 0;
 }
 
 /** Decode one B-frame MB (in Main profile)
@@ -2444,7 +2497,7 @@ static void vc1_decode_b_mb(VC1Context *v)
 {
     MpegEncContext *s = &v->s;
     GetBitContext *gb = &s->gb;
-    int i, j;
+    int i;
     int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
     int cbp = 0; /* cbp decoding stuff */
     int mqdiff, mquant; /* MB quantization */
@@ -2457,6 +2510,7 @@ static void vc1_decode_b_mb(VC1Context *v)
     int skipped, direct;
     int dmv_x[2], dmv_y[2];
     int bmvtype = BMV_TYPE_BACKWARD;
+    vc1_idct_func idct8x8_fn;
 
     mquant = v->pq; /* Loosy initialization */
     s->mb_intra = 0;
@@ -2554,6 +2608,7 @@ static void vc1_decode_b_mb(VC1Context *v)
         }
     }
     dst_idx = 0;
+    idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm];
     for (i=0; i<6; i++)
     {
         s->dc_val[0][s->block_index[i]] = 0;
@@ -2571,11 +2626,11 @@ static void vc1_decode_b_mb(VC1Context *v)
 
             vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
             if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
-            s->dsp.vc1_inv_trans_8x8(s->block[i]);
-            if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
-            s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize);
+            idct8x8_fn(s->dest[dst_idx] + off,
+                       i & 4 ? s->uvlinesize : s->linesize,
+                       s->block[i]);
         } else if(val) {
-            vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), 0, 0, 0);
+            vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), NULL);
             if(!v->ttmbf && ttmb < 8) ttmb = -1;
             first_block = 0;
         }
@@ -2586,11 +2641,12 @@ static void vc1_decode_b_mb(VC1Context *v)
  */
 static void vc1_decode_i_blocks(VC1Context *v)
 {
-    int k, j;
+    int k;
     MpegEncContext *s = &v->s;
     int cbp, val;
     uint8_t *coded_val;
     int mb_pos;
+    vc1_idct_func idct8x8_fn;
 
     /* select codingmode used for VLC tables selection */
     switch(v->y_ac_table_index){
@@ -2625,11 +2681,22 @@ static void vc1_decode_i_blocks(VC1Context *v)
     s->mb_x = s->mb_y = 0;
     s->mb_intra = 1;
     s->first_slice_line = 1;
+    if(v->pq >= 9 && v->overlap) {
+        idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm];
+    } else
+        idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put[!!v->rangeredfrm];
     for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
         s->mb_x = 0;
         ff_init_block_index(s);
         for(; s->mb_x < s->mb_width; s->mb_x++) {
+            uint8_t *dst[6];
             ff_update_block_index(s);
+            dst[0] = s->dest[0];
+            dst[1] = dst[0] + 8;
+            dst[2] = s->dest[0] + s->linesize * 8;
+            dst[3] = dst[2] + 8;
+            dst[4] = s->dest[1];
+            dst[5] = s->dest[2];
             s->dsp.clear_blocks(s->block[0]);
             mb_pos = s->mb_x + s->mb_y * s->mb_width;
             s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
@@ -2653,36 +2720,35 @@ static void vc1_decode_i_blocks(VC1Context *v)
 
                 vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2);
 
-                s->dsp.vc1_inv_trans_8x8(s->block[k]);
-                if(v->pq >= 9 && v->overlap) {
-                    for(j = 0; j < 64; j++) s->block[k][j] += 128;
-                }
+                if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue;
+                idct8x8_fn(dst[k],
+                           k & 4 ? s->uvlinesize : s->linesize,
+                           s->block[k]);
             }
 
-            vc1_put_block(v, s->block);
             if(v->pq >= 9 && v->overlap) {
                 if(s->mb_x) {
-                    s->dsp.vc1_h_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
+                    v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize);
+                    v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
                     if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
+                        v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
+                        v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
                     }
                 }
-                s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
-                s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
+                v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
+                v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
                 if(!s->first_slice_line) {
-                    s->dsp.vc1_v_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
+                    v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize);
+                    v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
                     if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
+                        v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
+                        v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
                     }
                 }
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
+                v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
+                v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
             }
-            if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
+            if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq);
 
             if(get_bits_count(&s->gb) > v->bits) {
                 ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
@@ -2704,9 +2770,9 @@ static void vc1_decode_i_blocks(VC1Context *v)
 
 /** Decode blocks of I-frame for advanced profile
  */
-static void vc1_decode_i_blocks_adv(VC1Context *v)
+static void vc1_decode_i_blocks_adv(VC1Context *v, int mby_start, int mby_end)
 {
-    int k, j;
+    int k;
     MpegEncContext *s = &v->s;
     int cbp, val;
     uint8_t *coded_val;
@@ -2715,6 +2781,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
     int mqdiff;
     int overlap;
     GetBitContext *gb = &s->gb;
+    vc1_idct_func idct8x8_fn;
 
     /* select codingmode used for VLC tables selection */
     switch(v->y_ac_table_index){
@@ -2745,11 +2812,26 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
     s->mb_x = s->mb_y = 0;
     s->mb_intra = 1;
     s->first_slice_line = 1;
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
+    s->mb_y = mby_start;
+    if (mby_start) {
+        s->mb_x = 0;
+        ff_init_block_index(s);
+        memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0,
+               s->b8_stride * sizeof(*s->coded_block));
+    }
+    idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[0];
+    for(; s->mb_y < mby_end; s->mb_y++) {
         s->mb_x = 0;
         ff_init_block_index(s);
         for(;s->mb_x < s->mb_width; s->mb_x++) {
+            uint8_t *dst[6];
             ff_update_block_index(s);
+            dst[0] = s->dest[0];
+            dst[1] = dst[0] + 8;
+            dst[2] = s->dest[0] + s->linesize * 8;
+            dst[3] = dst[2] + 8;
+            dst[4] = s->dest[1];
+            dst[5] = s->dest[2];
             s->dsp.clear_blocks(s->block[0]);
             mb_pos = s->mb_x + s->mb_y * s->mb_stride;
             s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
@@ -2793,37 +2875,38 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
 
                 vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant);
 
-                s->dsp.vc1_inv_trans_8x8(s->block[k]);
-                for(j = 0; j < 64; j++) s->block[k][j] += 128;
+                if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue;
+                idct8x8_fn(dst[k],
+                           k & 4 ? s->uvlinesize : s->linesize,
+                           s->block[k]);
             }
 
-            vc1_put_block(v, s->block);
             if(overlap) {
                 if(s->mb_x) {
-                    s->dsp.vc1_h_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
+                    v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize);
+                    v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
                     if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
+                        v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
+                        v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
                     }
                 }
-                s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
-                s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
+                v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
+                v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
                 if(!s->first_slice_line) {
-                    s->dsp.vc1_v_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
+                    v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize);
+                    v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
                     if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
+                        v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
+                        v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
                     }
                 }
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
+                v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
+                v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
             }
-            if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
+            if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq);
 
             if(get_bits_count(&s->gb) > v->bits) {
-                ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+                ff_er_add_slice(s, 0, mby_start, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
                 av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
                 return;
             }
@@ -2836,12 +2919,13 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
     }
     if (v->s.loop_filter)
         ff_draw_horiz_band(s, (s->mb_height-1)*16, 16);
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
+    ff_er_add_slice(s, 0, mby_start, s->mb_width - 1, mby_end - 1, (AC_END|DC_END|MV_END));
 }
 
-static void vc1_decode_p_blocks(VC1Context *v)
+static void vc1_decode_p_blocks(VC1Context *v, int mby_start, int mby_end)
 {
     MpegEncContext *s = &v->s;
+    int apply_loop_filter;
 
     /* select codingmode used for VLC tables selection */
     switch(v->c_ac_table_index){
@@ -2868,29 +2952,45 @@ static void vc1_decode_p_blocks(VC1Context *v)
         break;
     }
 
+    apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY);
     s->first_slice_line = 1;
     memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride);
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
+    for(s->mb_y = mby_start; s->mb_y < mby_end; s->mb_y++) {
         s->mb_x = 0;
         ff_init_block_index(s);
         for(; s->mb_x < s->mb_width; s->mb_x++) {
             ff_update_block_index(s);
 
             vc1_decode_p_mb(v);
+            if (s->mb_y != mby_start && apply_loop_filter)
+                vc1_apply_p_loop_filter(v);
             if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
-                ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+                ff_er_add_slice(s, 0, mby_start, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
                 av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y);
                 return;
             }
         }
         memmove(v->cbp_base, v->cbp, sizeof(v->cbp_base[0])*s->mb_stride);
-        ff_draw_horiz_band(s, s->mb_y * 16, 16);
+        memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0])*s->mb_stride);
+        memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride);
+        memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0])*s->mb_stride);
+        if (s->mb_y != mby_start) ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16);
         s->first_slice_line = 0;
     }
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
+    if (apply_loop_filter) {
+        s->mb_x = 0;
+        ff_init_block_index(s);
+        for (; s->mb_x < s->mb_width; s->mb_x++) {
+            ff_update_block_index(s);
+            vc1_apply_p_loop_filter(v);
+        }
+    }
+    if (mby_end >= mby_start)
+        ff_draw_horiz_band(s, (mby_end-1) * 16, 16);
+    ff_er_add_slice(s, 0, mby_start, s->mb_width - 1, mby_end - 1, (AC_END|DC_END|MV_END));
 }
 
-static void vc1_decode_b_blocks(VC1Context *v)
+static void vc1_decode_b_blocks(VC1Context *v, int mby_start, int mby_end)
 {
     MpegEncContext *s = &v->s;
 
@@ -2920,7 +3020,7 @@ static void vc1_decode_b_blocks(VC1Context *v)
     }
 
     s->first_slice_line = 1;
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
+    for(s->mb_y = mby_start; s->mb_y < mby_end; s->mb_y++) {
         s->mb_x = 0;
         ff_init_block_index(s);
         for(; s->mb_x < s->mb_width; s->mb_x++) {
@@ -2928,11 +3028,11 @@ static void vc1_decode_b_blocks(VC1Context *v)
 
             vc1_decode_b_mb(v);
             if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
-                ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+                ff_er_add_slice(s, 0, mby_start, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
                 av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y);
                 return;
             }
-            if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
+            if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq);
         }
         if (!v->s.loop_filter)
             ff_draw_horiz_band(s, s->mb_y * 16, 16);
@@ -2942,7 +3042,7 @@ static void vc1_decode_b_blocks(VC1Context *v)
     }
     if (v->s.loop_filter)
         ff_draw_horiz_band(s, (s->mb_height-1)*16, 16);
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
+    ff_er_add_slice(s, 0, mby_start, s->mb_width - 1, mby_end - 1, (AC_END|DC_END|MV_END));
 }
 
 static void vc1_decode_skip_blocks(VC1Context *v)
@@ -2964,18 +3064,17 @@ static void vc1_decode_skip_blocks(VC1Context *v)
     s->pict_type = FF_P_TYPE;
 }
 
-static void vc1_decode_blocks(VC1Context *v)
+static void vc1_decode_blocks(VC1Context *v, int mby_start, int mby_end)
 {
 
     v->s.esc3_level_length = 0;
     if(v->x8_type){
         ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) );
     }else{
-
         switch(v->s.pict_type) {
         case FF_I_TYPE:
             if(v->profile == PROFILE_ADVANCED)
-                vc1_decode_i_blocks_adv(v);
+                vc1_decode_i_blocks_adv(v, mby_start, mby_end);
             else
                 vc1_decode_i_blocks(v);
             break;
@@ -2983,16 +3082,16 @@ static void vc1_decode_blocks(VC1Context *v)
             if(v->p_frame_skipped)
                 vc1_decode_skip_blocks(v);
             else
-                vc1_decode_p_blocks(v);
+                vc1_decode_p_blocks(v, mby_start, mby_end);
             break;
         case FF_B_TYPE:
             if(v->bi_type){
                 if(v->profile == PROFILE_ADVANCED)
-                    vc1_decode_i_blocks_adv(v);
+                    vc1_decode_i_blocks_adv(v, mby_start, mby_end);
                 else
                     vc1_decode_i_blocks(v);
             }else
-                vc1_decode_b_blocks(v);
+                vc1_decode_b_blocks(v, mby_start, mby_end);
             break;
         }
     }
@@ -3007,6 +3106,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
     VC1Context *v = avctx->priv_data;
     MpegEncContext *s = &v->s;
     GetBitContext gb;
+    int i;
 
     if (!avctx->extradata_size || !avctx->extradata) return -1;
     if (!(avctx->flags & CODEC_FLAG_GRAY))
@@ -3025,6 +3125,14 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
     if(ff_msmpeg4_decode_init(avctx) < 0)
         return -1;
     if (vc1_init_common(v) < 0) return -1;
+    ff_vc1dsp_init(&v->vc1dsp);
+    for (i = 0; i < 64;  i++) {
+#define transpose(x) ((x>>3) | ((x&7)<<3))
+        v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]);
+        v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]);
+        v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]);
+        v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]);
+    }
 
     avctx->coded_width = avctx->width;
     avctx->coded_height = avctx->height;
@@ -3097,6 +3205,10 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
             return -1;
         }
     }
+    avctx->profile = v->profile;
+    if (v->profile == PROFILE_ADVANCED)
+        avctx->level = v->level;
+
     avctx->has_b_frames= !!(avctx->max_b_frames);
     s->low_delay = !avctx->has_b_frames;
 
@@ -3111,6 +3223,12 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
 
     v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride);
     v->cbp = v->cbp_base + s->mb_stride;
+    v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride);
+    v->ttblk = v->ttblk_base + s->mb_stride;
+    v->is_intra_base = av_malloc(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride);
+    v->is_intra = v->is_intra_base + s->mb_stride;
+    v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride);
+    v->luma_mv = v->luma_mv_base + s->mb_stride;
 
     /* allocate block type info in that way so it could be used with s->block_index[] */
     v->mb_type_base = av_malloc(s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2);
@@ -3140,15 +3258,20 @@ static int vc1_decode_frame(AVCodecContext *avctx,
                             AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
+    int buf_size = avpkt->size, n_slices = 0, i;
     VC1Context *v = avctx->priv_data;
     MpegEncContext *s = &v->s;
     AVFrame *pict = data;
     uint8_t *buf2 = NULL;
     const uint8_t *buf_start = buf;
+    struct {
+        uint8_t *buf;
+        GetBitContext gb;
+        int mby_start;
+    } *slices = NULL;
 
     /* no supplementary picture */
-    if (buf_size == 0) {
+    if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) {
         /* special case for last picture */
         if (s->low_delay==0 && s->next_picture_ptr) {
             *pict= *(AVFrame*)s->next_picture_ptr;
@@ -3200,10 +3323,20 @@ static int vc1_decode_frame(AVCodecContext *avctx,
                     init_get_bits(&s->gb, buf2, buf_size2*8);
                     vc1_decode_entry_point(avctx, v, &s->gb);
                     break;
-                case VC1_CODE_SLICE:
-                    av_log(avctx, AV_LOG_ERROR, "Sliced decoding is not implemented (yet)\n");
-                    av_free(buf2);
-                    return -1;
+                case VC1_CODE_SLICE: {
+                    int buf_size3;
+                    slices = av_realloc(slices, sizeof(*slices) * (n_slices+1));
+                    if (!slices) goto err;
+                    slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+                    if (!slices[n_slices].buf) goto err;
+                    buf_size3 = vc1_unescape_buffer(start + 4, size,
+                                                    slices[n_slices].buf);
+                    init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
+                                  buf_size3 << 3);
+                    slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9);
+                    n_slices++;
+                    break;
+                }
                 }
             }
         }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ /* WVC1 interlaced stores both fields divided by marker */
@@ -3212,15 +3345,14 @@ static int vc1_decode_frame(AVCodecContext *avctx,
             divider = find_next_marker(buf, buf + buf_size);
             if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){
                 av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n");
-                av_free(buf2);
-                return -1;
+                goto err;
             }
 
             buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2);
             // TODO
             if(!v->warn_interlaced++)
                 av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced WVC1 support is not implemented\n");
-            av_free(buf2);return -1;
+            goto err;
         }else{
             buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2);
         }
@@ -3230,54 +3362,51 @@ static int vc1_decode_frame(AVCodecContext *avctx,
     // do parse frame header
     if(v->profile < PROFILE_ADVANCED) {
         if(vc1_parse_frame_header(v, &s->gb) == -1) {
-            av_free(buf2);
-            return -1;
+            goto err;
         }
     } else {
         if(vc1_parse_frame_header_adv(v, &s->gb) == -1) {
-            av_free(buf2);
-            return -1;
+            goto err;
         }
     }
 
     if(v->res_sprite && (s->pict_type!=FF_I_TYPE)){
-        av_free(buf2);
-        return -1;
+        goto err;
     }
 
-    // for hurry_up==5
+    // for skipping the frame
     s->current_picture.pict_type= s->pict_type;
     s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
 
     /* skip B-frames if we don't have reference frames */
     if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){
-        av_free(buf2);
-        return -1;//buf_size;
+        goto err;
     }
+#if FF_API_HURRY_UP
     /* skip b frames if we are in a hurry */
     if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
+#endif
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
        || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
        ||  avctx->skip_frame >= AVDISCARD_ALL) {
-        av_free(buf2);
-        return buf_size;
+        goto end;
     }
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) {
-        av_free(buf2);
-        return -1;//buf_size;
+        goto err;
     }
+#endif
 
     if(s->next_p_frame_damaged){
         if(s->pict_type==FF_B_TYPE)
-            return buf_size;
+            goto end;
         else
             s->next_p_frame_damaged=0;
     }
 
     if(MPV_frame_start(s, avctx) < 0) {
-        av_free(buf2);
-        return -1;
+        goto err;
     }
 
     s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
@@ -3288,17 +3417,23 @@ static int vc1_decode_frame(AVCodecContext *avctx,
         ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);
     else if (avctx->hwaccel) {
         if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
-            return -1;
+            goto err;
         if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
-            return -1;
+            goto err;
         if (avctx->hwaccel->end_frame(avctx) < 0)
-            return -1;
+            goto err;
     } else {
         ff_er_frame_start(s);
 
         v->bits = buf_size * 8;
-        vc1_decode_blocks(v);
-//av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), buf_size*8);
+        for (i = 0; i <= n_slices; i++) {
+            if (i && get_bits1(&s->gb))
+                vc1_parse_frame_header_adv(v, &s->gb);
+            vc1_decode_blocks(v, i == 0 ? 0 : FFMAX(0, slices[i-1].mby_start),
+                i == n_slices ? s->mb_height : FFMIN(s->mb_height, slices[i].mby_start));
+            if (i != n_slices) s->gb = slices[i].gb;
+        }
+//av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits);
 //  if(get_bits_count(&s->gb) > buf_size * 8)
 //      return -1;
         ff_er_frame_end(s);
@@ -3319,8 +3454,19 @@ assert(s->current_picture.pict_type == s->pict_type);
         ff_print_debug_info(s, pict);
     }
 
+end:
     av_free(buf2);
+    for (i = 0; i < n_slices; i++)
+        av_free(slices[i].buf);
+    av_free(slices);
     return buf_size;
+
+err:
+    av_free(buf2);
+    for (i = 0; i < n_slices; i++)
+        av_free(slices[i].buf);
+    av_free(slices);
+    return -1;
 }
 
 
@@ -3340,12 +3486,22 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx)
     av_freep(&v->over_flags_plane);
     av_freep(&v->mb_type_base);
     av_freep(&v->cbp_base);
+    av_freep(&v->ttblk_base);
+    av_freep(&v->is_intra_base); // FIXME use v->mb_type[]
+    av_freep(&v->luma_mv_base);
     ff_intrax8_common_end(&v->x8);
     return 0;
 }
 
+static const AVProfile profiles[] = {
+    { FF_PROFILE_VC1_SIMPLE,   "Simple"   },
+    { FF_PROFILE_VC1_MAIN,     "Main"     },
+    { FF_PROFILE_VC1_COMPLEX,  "Complex"  },
+    { FF_PROFILE_VC1_ADVANCED, "Advanced" },
+    { FF_PROFILE_UNKNOWN },
+};
 
-AVCodec vc1_decoder = {
+AVCodec ff_vc1_decoder = {
     "vc1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VC1,
@@ -3357,11 +3513,12 @@ AVCodec vc1_decoder = {
     CODEC_CAP_DR1 | CODEC_CAP_DELAY,
     NULL,
     .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
-    .pix_fmts = ff_hwaccel_pixfmt_list_420
+    .pix_fmts = ff_hwaccel_pixfmt_list_420,
+    .profiles = NULL_IF_CONFIG_SMALL(profiles)
 };
 
 #if CONFIG_WMV3_DECODER
-AVCodec wmv3_decoder = {
+AVCodec ff_wmv3_decoder = {
     "wmv3",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WMV3,
@@ -3373,12 +3530,13 @@ AVCodec wmv3_decoder = {
     CODEC_CAP_DR1 | CODEC_CAP_DELAY,
     NULL,
     .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
-    .pix_fmts = ff_hwaccel_pixfmt_list_420
+    .pix_fmts = ff_hwaccel_pixfmt_list_420,
+    .profiles = NULL_IF_CONFIG_SMALL(profiles)
 };
 #endif
 
 #if CONFIG_WMV3_VDPAU_DECODER
-AVCodec wmv3_vdpau_decoder = {
+AVCodec ff_wmv3_vdpau_decoder = {
     "wmv3_vdpau",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WMV3,
@@ -3390,12 +3548,13 @@ AVCodec wmv3_vdpau_decoder = {
     CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
     NULL,
     .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"),
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE}
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE},
+    .profiles = NULL_IF_CONFIG_SMALL(profiles)
 };
 #endif
 
 #if CONFIG_VC1_VDPAU_DECODER
-AVCodec vc1_vdpau_decoder = {
+AVCodec ff_vc1_vdpau_decoder = {
     "vc1_vdpau",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VC1,
@@ -3407,6 +3566,7 @@ AVCodec vc1_vdpau_decoder = {
     CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
     NULL,
     .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"),
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE}
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE},
+    .profiles = NULL_IF_CONFIG_SMALL(profiles)
 };
 #endif
diff --git a/ffmpeg-mt/libavcodec/vc1dsp.c b/ffmpeg-mt/libavcodec/vc1dsp.c
index aab1694..3d02db7 100644
--- a/ffmpeg-mt/libavcodec/vc1dsp.c
+++ b/ffmpeg-mt/libavcodec/vc1dsp.c
@@ -2,20 +2,20 @@
  * VC-1 and WMV3 decoder - DSP functions
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
  *
  */
 
-#include "dsputil.h"
+#include "vc1dsp.h"
 
 
 /** Apply overlap transform to horizontal edge
@@ -199,29 +199,29 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
     }
 }
 
-static void vc1_inv_trans_8x8_c(DCTELEM block[64])
+static av_always_inline void vc1_inv_trans_8x8_c(DCTELEM block[64], int shl, int sub)
 {
     int i;
     register int t1,t2,t3,t4,t5,t6,t7,t8;
-    DCTELEM *src, *dst;
+    DCTELEM *src, *dst, temp[64];
 
     src = block;
-    dst = block;
+    dst = temp;
     for(i = 0; i < 8; i++){
-        t1 = 12 * (src[0] + src[4]) + 4;
-        t2 = 12 * (src[0] - src[4]) + 4;
-        t3 = 16 * src[2] +  6 * src[6];
-        t4 =  6 * src[2] - 16 * src[6];
+        t1 = 12 * (src[ 0] + src[32]) + 4;
+        t2 = 12 * (src[ 0] - src[32]) + 4;
+        t3 = 16 * src[16] +  6 * src[48];
+        t4 =  6 * src[16] - 16 * src[48];
 
         t5 = t1 + t3;
         t6 = t2 + t4;
         t7 = t2 - t4;
         t8 = t1 - t3;
 
-        t1 = 16 * src[1] + 15 * src[3] +  9 * src[5] +  4 * src[7];
-        t2 = 15 * src[1] -  4 * src[3] - 16 * src[5] -  9 * src[7];
-        t3 =  9 * src[1] - 16 * src[3] +  4 * src[5] + 15 * src[7];
-        t4 =  4 * src[1] -  9 * src[3] + 15 * src[5] - 16 * src[7];
+        t1 = 16 * src[ 8] + 15 * src[24] +  9 * src[40] +  4 * src[56];
+        t2 = 15 * src[ 8] -  4 * src[24] - 16 * src[40] -  9 * src[56];
+        t3 =  9 * src[ 8] - 16 * src[24] +  4 * src[40] + 15 * src[56];
+        t4 =  4 * src[ 8] -  9 * src[24] + 15 * src[40] - 16 * src[56];
 
         dst[0] = (t5 + t1) >> 3;
         dst[1] = (t6 + t2) >> 3;
@@ -232,11 +232,11 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64])
         dst[6] = (t6 - t2) >> 3;
         dst[7] = (t5 - t1) >> 3;
 
-        src += 8;
+        src += 1;
         dst += 8;
     }
 
-    src = block;
+    src = temp;
     dst = block;
     for(i = 0; i < 8; i++){
         t1 = 12 * (src[ 0] + src[32]) + 64;
@@ -254,20 +254,50 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64])
         t3 =  9 * src[ 8] - 16 * src[24] +  4 * src[40] + 15 * src[56];
         t4 =  4 * src[ 8] -  9 * src[24] + 15 * src[40] - 16 * src[56];
 
-        dst[ 0] = (t5 + t1) >> 7;
-        dst[ 8] = (t6 + t2) >> 7;
-        dst[16] = (t7 + t3) >> 7;
-        dst[24] = (t8 + t4) >> 7;
-        dst[32] = (t8 - t4 + 1) >> 7;
-        dst[40] = (t7 - t3 + 1) >> 7;
-        dst[48] = (t6 - t2 + 1) >> 7;
-        dst[56] = (t5 - t1 + 1) >> 7;
+        dst[ 0] = (((t5 + t1    ) >> 7) - sub) << shl;
+        dst[ 8] = (((t6 + t2    ) >> 7) - sub) << shl;
+        dst[16] = (((t7 + t3    ) >> 7) - sub) << shl;
+        dst[24] = (((t8 + t4    ) >> 7) - sub) << shl;
+        dst[32] = (((t8 - t4 + 1) >> 7) - sub) << shl;
+        dst[40] = (((t7 - t3 + 1) >> 7) - sub) << shl;
+        dst[48] = (((t6 - t2 + 1) >> 7) - sub) << shl;
+        dst[56] = (((t5 - t1 + 1) >> 7) - sub) << shl;
 
         src++;
         dst++;
     }
 }
 
+static void vc1_inv_trans_8x8_add_c(uint8_t *dest, int linesize, DCTELEM *block)
+{
+    vc1_inv_trans_8x8_c(block, 0, 0);
+    ff_add_pixels_clamped_c(block, dest, linesize);
+}
+
+static void vc1_inv_trans_8x8_put_signed_c(uint8_t *dest, int linesize, DCTELEM *block)
+{
+    vc1_inv_trans_8x8_c(block, 0, 0);
+    ff_put_signed_pixels_clamped_c(block, dest, linesize);
+}
+
+static void vc1_inv_trans_8x8_put_signed_rangered_c(uint8_t *dest, int linesize, DCTELEM *block)
+{
+    vc1_inv_trans_8x8_c(block, 1, 0);
+    ff_put_signed_pixels_clamped_c(block, dest, linesize);
+}
+
+static void vc1_inv_trans_8x8_put_c(uint8_t *dest, int linesize, DCTELEM *block)
+{
+    vc1_inv_trans_8x8_c(block, 0, 0);
+    ff_put_pixels_clamped_c(block, dest, linesize);
+}
+
+static void vc1_inv_trans_8x8_put_rangered_c(uint8_t *dest, int linesize, DCTELEM *block)
+{
+    vc1_inv_trans_8x8_c(block, 1, 64);
+    ff_put_pixels_clamped_c(block, dest, linesize);
+}
+
 /** Do inverse transform on 8x4 part of block
 */
 static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
@@ -612,8 +642,61 @@ PUT_VC1_MSPEL(1, 3)
 PUT_VC1_MSPEL(2, 3)
 PUT_VC1_MSPEL(3, 3)
 
-av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
-    dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
+static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
+    const int A=(8-x)*(8-y);
+    const int B=(  x)*(8-y);
+    const int C=(8-x)*(  y);
+    const int D=(  x)*(  y);
+    int i;
+
+    assert(x<8 && y<8 && x>=0 && y>=0);
+
+    for(i=0; i<h; i++)
+    {
+        dst[0] = (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6;
+        dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6;
+        dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6;
+        dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6;
+        dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6;
+        dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6;
+        dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6;
+        dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6;
+        dst+= stride;
+        src+= stride;
+    }
+}
+
+#define avg2(a,b) ((a+b+1)>>1)
+static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
+    const int A=(8-x)*(8-y);
+    const int B=(  x)*(8-y);
+    const int C=(8-x)*(  y);
+    const int D=(  x)*(  y);
+    int i;
+
+    assert(x<8 && y<8 && x>=0 && y>=0);
+
+    for(i=0; i<h; i++)
+    {
+        dst[0] = avg2(dst[0], ((A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6));
+        dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6));
+        dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6));
+        dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6));
+        dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6));
+        dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6));
+        dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6));
+        dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6));
+        dst+= stride;
+        src+= stride;
+    }
+}
+
+av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) {
+    dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_c;
+    dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_c;
+    dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_c;
+    dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_c;
+    dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_c;
     dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
     dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
     dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c;
@@ -663,4 +746,12 @@ av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
     dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_c;
     dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_c;
     dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_c;
+
+    dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
+    dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
+
+    if (HAVE_ALTIVEC)
+        ff_vc1dsp_init_altivec(dsp);
+    if (HAVE_MMX)
+        ff_vc1dsp_init_mmx(dsp);
 }
diff --git a/ffmpeg-mt/libavcodec/vc1dsp.h b/ffmpeg-mt/libavcodec/vc1dsp.h
new file mode 100644
index 0000000..32bb25b
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/vc1dsp.h
@@ -0,0 +1,71 @@
+/*
+ * VC-1 and WMV3 decoder - DSP functions
+ * Copyright (c) 2006 Konstantin Shishkov
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * VC-1 and WMV3 decoder
+ *
+ */
+
+#ifndef AVCODEC_VC1DSP_H
+#define AVCODEC_VC1DSP_H
+
+#include "dsputil.h"
+
+typedef void (*vc1_idct_func)(uint8_t *dest, int line_size, DCTELEM *block);
+
+typedef struct VC1DSPContext {
+    /* vc1 functions */
+    vc1_idct_func vc1_inv_trans_8x8_add;
+    vc1_idct_func vc1_inv_trans_8x8_put_signed[2];
+    vc1_idct_func vc1_inv_trans_8x8_put[2];
+    void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block);
+    void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block);
+    void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block);
+    void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, int line_size, DCTELEM *block);
+    void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
+    void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block);
+    void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
+    void (*vc1_v_overlap)(uint8_t* src, int stride);
+    void (*vc1_h_overlap)(uint8_t* src, int stride);
+    void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq);
+    void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq);
+    void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq);
+    void (*vc1_h_loop_filter8)(uint8_t *src, int stride, int pq);
+    void (*vc1_v_loop_filter16)(uint8_t *src, int stride, int pq);
+    void (*vc1_h_loop_filter16)(uint8_t *src, int stride, int pq);
+
+    /* put 8x8 block with bicubic interpolation and quarterpel precision
+     * last argument is actually round value instead of height
+     */
+    op_pixels_func put_vc1_mspel_pixels_tab[16];
+    op_pixels_func avg_vc1_mspel_pixels_tab[16];
+
+    /* This is really one func used in VC-1 decoding */
+    h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3];
+    h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3];
+} VC1DSPContext;
+
+void ff_vc1dsp_init(VC1DSPContext* c);
+void ff_vc1dsp_init_altivec(VC1DSPContext* c);
+void ff_vc1dsp_init_mmx(VC1DSPContext* dsp);
+
+#endif /* AVCODEC_VC1DSP_H */
diff --git a/ffmpeg-mt/libavcodec/vcr1.c b/ffmpeg-mt/libavcodec/vcr1.c
index 31da94f..93942e1 100644
--- a/ffmpeg-mt/libavcodec/vcr1.c
+++ b/ffmpeg-mt/libavcodec/vcr1.c
@@ -2,20 +2,20 @@
  * ATI VCR1 codec
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -176,7 +176,7 @@ static av_cold int encode_init(AVCodecContext *avctx){
 }
 #endif
 
-AVCodec vcr1_decoder = {
+AVCodec ff_vcr1_decoder = {
     "vcr1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VCR1,
@@ -190,7 +190,7 @@ AVCodec vcr1_decoder = {
 };
 
 #if CONFIG_VCR1_ENCODER
-AVCodec vcr1_encoder = {
+AVCodec ff_vcr1_encoder = {
     "vcr1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VCR1,
diff --git a/ffmpeg-mt/libavcodec/vdpau.c b/ffmpeg-mt/libavcodec/vdpau.c
index bd721e8..1a193c1 100644
--- a/ffmpeg-mt/libavcodec/vdpau.c
+++ b/ffmpeg-mt/libavcodec/vdpau.c
@@ -4,20 +4,20 @@
  *
  * Copyright (c) 2008 NVIDIA
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vdpau.h b/ffmpeg-mt/libavcodec/vdpau.h
index ab5f682..d06ba63 100644
--- a/ffmpeg-mt/libavcodec/vdpau.h
+++ b/ffmpeg-mt/libavcodec/vdpau.h
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2008 NVIDIA
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,7 +31,7 @@
  * - VDPAU decoding
  * - VDPAU presentation
  *
- * The VDPAU decoding module parses all headers using FFmpeg
+ * The VDPAU decoding module parses all headers using Libav
  * parsing mechanisms and uses VDPAU for the actual decoding.
  *
  * As per the current implementation, the actual decoding
@@ -56,11 +56,11 @@
 #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2
 
 /**
- * \brief This structure is used as a callback between the FFmpeg
+ * \brief This structure is used as a callback between the Libav
  * decoder (vd_) and presentation (vo_) module.
  * This is used for defining a video frame containing surface,
  * picture parameter, bitstream information etc which are passed
- * between the FFmpeg decoder and its clients.
+ * between the Libav decoder and its clients.
  */
 struct vdpau_render_state {
     VdpVideoSurface surface; ///< Used as rendered surface, never changed.
diff --git a/ffmpeg-mt/libavcodec/vdpau_internal.h b/ffmpeg-mt/libavcodec/vdpau_internal.h
index 0a8d0b6..673fd33 100644
--- a/ffmpeg-mt/libavcodec/vdpau_internal.h
+++ b/ffmpeg-mt/libavcodec/vdpau_internal.h
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2008 NVIDIA
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/version.h b/ffmpeg-mt/libavcodec/version.h
new file mode 100644
index 0000000..b60e264
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/version.h
@@ -0,0 +1,90 @@
+/*
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VERSION_H
+#define AVCODEC_VERSION_H
+
+#define LIBAVCODEC_VERSION_MAJOR 52
+#define LIBAVCODEC_VERSION_MINOR 117
+#define LIBAVCODEC_VERSION_MICRO  0
+
+#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
+                                               LIBAVCODEC_VERSION_MINOR, \
+                                               LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
+                                           LIBAVCODEC_VERSION_MINOR,    \
+                                           LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
+
+#define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
+
+/**
+ * Those FF_API_* defines are not part of public API.
+ * They may change, break or disappear at any time.
+ */
+#ifndef FF_API_PALETTE_CONTROL
+#define FF_API_PALETTE_CONTROL  (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_MM_FLAGS
+#define FF_API_MM_FLAGS         (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_OPT_SHOW
+#define FF_API_OPT_SHOW         (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AUDIO_OLD
+#define FF_API_AUDIO_OLD        (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_VIDEO_OLD
+#define FF_API_VIDEO_OLD        (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_SUBTITLE_OLD
+#define FF_API_SUBTITLE_OLD     (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_USE_LPC
+#define FF_API_USE_LPC          (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_SET_STRING_OLD
+#define FF_API_SET_STRING_OLD   (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_INOFFICIAL
+#define FF_API_INOFFICIAL       (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_OLD_SAMPLE_FMT
+#define FF_API_OLD_SAMPLE_FMT   (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_OLD_AUDIOCONVERT
+#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_HURRY_UP
+#define FF_API_HURRY_UP         (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_RATE_EMU
+#define FF_API_RATE_EMU         (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_MB_Q
+#define FF_API_MB_Q             (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_ANTIALIAS_ALGO
+#define FF_API_ANTIALIAS_ALGO   (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_REQUEST_CHANNELS
+#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
+
+#endif /* AVCODEC_VERSION_H */
diff --git a/ffmpeg-mt/libavcodec/vmdav.c b/ffmpeg-mt/libavcodec/vmdav.c
index 9f44e31..710c202 100644
--- a/ffmpeg-mt/libavcodec/vmdav.c
+++ b/ffmpeg-mt/libavcodec/vmdav.c
@@ -2,20 +2,20 @@
  * Sierra VMD Audio & Video Decoders
  * Copyright (C) 2004 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -414,11 +414,13 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx)
  * Audio Decoder
  */
 
+#define BLOCK_TYPE_AUDIO    1
+#define BLOCK_TYPE_INITIAL  2
+#define BLOCK_TYPE_SILENCE  3
+
 typedef struct VmdAudioContext {
     AVCodecContext *avctx;
-    int channels;
-    int bits;
-    int block_align;
+    int out_bps;
     int predictors[2];
 } VmdAudioContext;
 
@@ -443,13 +445,16 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
     VmdAudioContext *s = avctx->priv_data;
 
     s->avctx = avctx;
-    s->channels = avctx->channels;
-    s->bits = avctx->bits_per_coded_sample;
-    s->block_align = avctx->block_align;
-    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+    if (avctx->bits_per_coded_sample == 16)
+        avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+    else
+        avctx->sample_fmt = AV_SAMPLE_FMT_U8;
+    s->out_bps = av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3;
 
-    av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n",
-            s->channels, s->bits, s->block_align, avctx->sample_rate);
+    av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, "
+           "block align = %d, sample rate = %d\n",
+           avctx->channels, avctx->bits_per_coded_sample, avctx->block_align,
+           avctx->sample_rate);
 
     return 0;
 }
@@ -473,49 +478,22 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data,
 }
 
 static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
-    const uint8_t *buf, int silence, int data_size)
+    const uint8_t *buf, int silent_chunks, int data_size)
 {
-    int bytes_decoded = 0;
-    int i;
+    int silent_size = s->avctx->block_align * silent_chunks * s->out_bps;
 
-//    if (silence)
-//        av_log(s->avctx, AV_LOG_INFO, "silent block!\n");
-    if (s->channels == 2) {
-
-        /* stereo handling */
-        if (silence) {
-            memset(data, 0, data_size * 2);
-        } else {
-            if (s->bits == 16)
-                vmdaudio_decode_audio(s, data, buf, data_size, 1);
-            else {
-                /* copy the data but convert it to signed */
-                for (i = 0; i < data_size; i++){
-                    *data++ = buf[i] + 0x80;
-                    *data++ = buf[i] + 0x80;
-                }
-            }
-        }
-    } else {
-        bytes_decoded = data_size * 2;
-
-        /* mono handling */
-        if (silence) {
-            memset(data, 0, data_size * 2);
-        } else {
-            if (s->bits == 16) {
-                vmdaudio_decode_audio(s, data, buf, data_size, 0);
-            } else {
-                /* copy the data but convert it to signed */
-                for (i = 0; i < data_size; i++){
-                    *data++ = buf[i] + 0x80;
-                    *data++ = buf[i] + 0x80;
-                }
-            }
-        }
+    if (silent_chunks) {
+        memset(data, s->out_bps == 2 ? 0x00 : 0x80, silent_size);
+        data += silent_size;
+    }
+    if (s->avctx->bits_per_coded_sample == 16)
+        vmdaudio_decode_audio(s, data, buf, data_size, s->avctx->channels == 2);
+    else {
+        /* just copy the data */
+        memcpy(data, buf, data_size);
     }
 
-    return data_size * 2;
+    return silent_size + data_size * s->out_bps;
 }
 
 static int vmdaudio_decode_frame(AVCodecContext *avctx,
@@ -525,39 +503,41 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     VmdAudioContext *s = avctx->priv_data;
+    int block_type, silent_chunks;
     unsigned char *output_samples = (unsigned char *)data;
 
-    /* point to the start of the encoded data */
-    const unsigned char *p = buf + 16;
-
-    if (buf_size < 16)
+    if (buf_size < 16) {
+        av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n");
+        *data_size = 0;
         return buf_size;
+    }
 
-    if (buf[6] == 1) {
-        /* the chunk contains audio */
-        *data_size = vmdaudio_loadsound(s, output_samples, p, 0, buf_size - 16);
-    } else if (buf[6] == 2) {
-        /* initial chunk, may contain audio and silence */
-        uint32_t flags = AV_RB32(p);
-        int raw_block_size = s->block_align * s->bits / 8;
-        int silent_chunks;
-        if(flags == 0xFFFFFFFF)
-            silent_chunks = 32;
-        else
-            silent_chunks = av_log2(flags + 1);
-        if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2)
-            return -1;
-        *data_size = 0;
-        memset(output_samples, 0, raw_block_size * silent_chunks);
-        output_samples += raw_block_size * silent_chunks;
-        *data_size = raw_block_size * silent_chunks;
-        *data_size += vmdaudio_loadsound(s, output_samples, p + 4, 0, buf_size - 20);
-    } else if (buf[6] == 3) {
-        /* silent chunk */
-        *data_size = vmdaudio_loadsound(s, output_samples, p, 1, 0);
+    block_type = buf[6];
+    if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) {
+        av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type);
+        return AVERROR(EINVAL);
+    }
+    buf      += 16;
+    buf_size -= 16;
+
+    silent_chunks = 0;
+    if (block_type == BLOCK_TYPE_INITIAL) {
+        uint32_t flags = AV_RB32(buf);
+        silent_chunks  = av_popcount(flags);
+        buf      += 4;
+        buf_size -= 4;
+    } else if (block_type == BLOCK_TYPE_SILENCE) {
+        silent_chunks = 1;
+        buf_size = 0; // should already be zero but set it just to be sure
     }
 
-    return buf_size;
+    /* ensure output buffer is large enough */
+    if (*data_size < (avctx->block_align*silent_chunks + buf_size) * s->out_bps)
+        return -1;
+
+    *data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size);
+
+    return avpkt->size;
 }
 
 
@@ -565,7 +545,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
  * Public Data Structures
  */
 
-AVCodec vmdvideo_decoder = {
+AVCodec ff_vmdvideo_decoder = {
     "vmdvideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VMDVIDEO,
@@ -578,7 +558,7 @@ AVCodec vmdvideo_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"),
 };
 
-AVCodec vmdaudio_decoder = {
+AVCodec ff_vmdaudio_decoder = {
     "vmdaudio",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_VMDAUDIO,
diff --git a/ffmpeg-mt/libavcodec/vmnc.c b/ffmpeg-mt/libavcodec/vmnc.c
index 49aaeb2..5618184 100644
--- a/ffmpeg-mt/libavcodec/vmnc.c
+++ b/ffmpeg-mt/libavcodec/vmnc.c
@@ -2,20 +2,20 @@
  * VMware Screen Codec (VMnc) decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -508,7 +508,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec vmnc_decoder = {
+AVCodec ff_vmnc_decoder = {
     "vmnc",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VMNC,
diff --git a/ffmpeg-mt/libavcodec/vorbis.c b/ffmpeg-mt/libavcodec/vorbis.c
index 47388d8..d576a20 100644
--- a/ffmpeg-mt/libavcodec/vorbis.c
+++ b/ffmpeg-mt/libavcodec/vorbis.c
@@ -3,20 +3,20 @@
  * Common code for Vorbis I encoder and decoder
  * @author Denes Balatoni  ( dbalatoni programozo hu )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vorbis.h b/ffmpeg-mt/libavcodec/vorbis.h
index 64bade6..e475455 100644
--- a/ffmpeg-mt/libavcodec/vorbis.h
+++ b/ffmpeg-mt/libavcodec/vorbis.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vorbis_data.c b/ffmpeg-mt/libavcodec/vorbis_data.c
index 24c9921..4e1fe00 100644
--- a/ffmpeg-mt/libavcodec/vorbis_data.c
+++ b/ffmpeg-mt/libavcodec/vorbis_data.c
@@ -1,25 +1,26 @@
 /*
  * copyright (c) 2005 Denes Balatoni ( dbalatoni programozo hu )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "dsputil.h"
 #include "vorbis.h"
+#include "libavutil/audioconvert.h"
 
 const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
     { 0 },
@@ -44,14 +45,14 @@ const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8] = {
 };
 
 const int64_t ff_vorbis_channel_layouts[9] = {
-    CH_LAYOUT_MONO,
-    CH_LAYOUT_STEREO,
-    CH_LAYOUT_SURROUND,
-    CH_LAYOUT_QUAD,
-    CH_LAYOUT_5POINT0_BACK,
-    CH_LAYOUT_5POINT1_BACK,
-    CH_LAYOUT_5POINT1|CH_BACK_CENTER,
-    CH_LAYOUT_7POINT1,
+    AV_CH_LAYOUT_MONO,
+    AV_CH_LAYOUT_STEREO,
+    AV_CH_LAYOUT_SURROUND,
+    AV_CH_LAYOUT_QUAD,
+    AV_CH_LAYOUT_5POINT0_BACK,
+    AV_CH_LAYOUT_5POINT1_BACK,
+    AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER,
+    AV_CH_LAYOUT_7POINT1,
     0
 };
 
diff --git a/ffmpeg-mt/libavcodec/vorbis_dec.c b/ffmpeg-mt/libavcodec/vorbis_dec.c
index 4e16c4a..5fa7be1 100644
--- a/ffmpeg-mt/libavcodec/vorbis_dec.c
+++ b/ffmpeg-mt/libavcodec/vorbis_dec.c
@@ -3,20 +3,20 @@
  * Vorbis I decoder
  * @author Denes Balatoni  ( dbalatoni programozo hu )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,6 +31,7 @@
 #include "get_bits.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "fmtconvert.h"
 
 #include "vorbis.h"
 #include "xiph.h"
@@ -127,6 +128,7 @@ typedef struct vorbis_context_s {
     AVCodecContext *avccontext;
     GetBitContext gb;
     DSPContext dsp;
+    FmtConvertContext fmt_conv;
 
     FFTContext mdct[2];
     uint_fast8_t  first_frame;
@@ -153,8 +155,7 @@ typedef struct vorbis_context_s {
     float        *channel_residues;
     float        *channel_floors;
     float        *saved;
-    uint_fast32_t add_bias; // for float->int conversion
-    uint_fast32_t exp_bias;
+    float         scale_bias; // for float->int conversion
 } vorbis_context;
 
 /* Helper functions */
@@ -567,9 +568,9 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
             /* zero would result in a div by zero later *
              * 2^0 - 1 == 0                             */
             if (floor_setup->data.t0.amplitude_bits == 0) {
-              av_log(vc->avccontext, AV_LOG_ERROR,
-                     "Floor 0 amplitude bits is 0.\n");
-              return -1;
+                av_log(vc->avccontext, AV_LOG_ERROR,
+                       "Floor 0 amplitude bits is 0.\n");
+                return -1;
             }
             floor_setup->data.t0.amplitude_offset = get_bits(gb, 8);
             floor_setup->data.t0.num_books        = get_bits(gb, 4) + 1;
@@ -593,37 +594,34 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
 
             create_map(vc, i);
 
-            /* allocate mem for lsp coefficients */
-            {
-                /* codebook dim is for padding if codebook dim doesn't *
-                 * divide order+1 then we need to read more data       */
-                floor_setup->data.t0.lsp =
-                    av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim)
-                              * sizeof(float));
-                if (!floor_setup->data.t0.lsp)
-                    return -1;
-            }
+            /* codebook dim is for padding if codebook dim doesn't *
+             * divide order+1 then we need to read more data       */
+            floor_setup->data.t0.lsp =
+                av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim)
+                          * sizeof(float));
+            if (!floor_setup->data.t0.lsp)
+                return -1;
 
 #ifdef V_DEBUG /* debug output parsed headers */
             AV_DEBUG("floor0 order: %u\n", floor_setup->data.t0.order);
             AV_DEBUG("floor0 rate: %u\n", floor_setup->data.t0.rate);
             AV_DEBUG("floor0 bark map size: %u\n",
-              floor_setup->data.t0.bark_map_size);
+                     floor_setup->data.t0.bark_map_size);
             AV_DEBUG("floor0 amplitude bits: %u\n",
-              floor_setup->data.t0.amplitude_bits);
+                     floor_setup->data.t0.amplitude_bits);
             AV_DEBUG("floor0 amplitude offset: %u\n",
-              floor_setup->data.t0.amplitude_offset);
+                     floor_setup->data.t0.amplitude_offset);
             AV_DEBUG("floor0 number of books: %u\n",
-              floor_setup->data.t0.num_books);
+                     floor_setup->data.t0.num_books);
             AV_DEBUG("floor0 book list pointer: %p\n",
-              floor_setup->data.t0.book_list);
+                     floor_setup->data.t0.book_list);
             {
-              int idx;
-              for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) {
-                  AV_DEBUG("  Book %d: %u\n",
-                           idx+1,
-                           floor_setup->data.t0.book_list[idx]);
-              }
+                int idx;
+                for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) {
+                    AV_DEBUG("  Book %d: %u\n",
+                             idx+1,
+                             floor_setup->data.t0.book_list[idx]);
+                }
             }
 #endif
         } else {
@@ -801,12 +799,12 @@ static void create_map(vorbis_context *vc, uint_fast8_t floor_number)
         vf->map_size[blockflag] = n;
     }
 
-#   ifdef V_DEBUG
+#ifdef V_DEBUG
     for (idx = 0; idx <= n; ++idx) {
         AV_DEBUG("floor0 map: map at pos %d is %d\n",
                  idx, map[idx]);
     }
-#   endif
+#endif
 }
 
 static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
@@ -932,8 +930,8 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
     vc->saved            =  av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(float));
     vc->previous_window  = 0;
 
-    ff_mdct_init(&vc->mdct[0], bl0, 1, vc->exp_bias ? -(1 << 15) : -1.0);
-    ff_mdct_init(&vc->mdct[1], bl1, 1, vc->exp_bias ? -(1 << 15) : -1.0);
+    ff_mdct_init(&vc->mdct[0], bl0, 1, -vc->scale_bias);
+    ff_mdct_init(&vc->mdct[1], bl1, 1, -vc->scale_bias);
 
     AV_DEBUG(" vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ",
             vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]);
@@ -962,14 +960,9 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
 
     vc->avccontext = avccontext;
     dsputil_init(&vc->dsp, avccontext);
+    ff_fmt_convert_init(&vc->fmt_conv, avccontext);
 
-    if (vc->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        vc->add_bias = 385;
-        vc->exp_bias = 0;
-    } else {
-        vc->add_bias = 0;
-        vc->exp_bias = 15 << 23;
-    }
+    vc->scale_bias = 32768.0f;
 
     if (!headers_len) {
         av_log(avccontext, AV_LOG_ERROR, "Extradata missing.\n");
@@ -1044,7 +1037,6 @@ static int vorbis_floor0_decode(vorbis_context *vc,
             av_log(vc->avccontext, AV_LOG_ERROR,
                     "floor0 dec: booknumber too high!\n");
             book_idx =  0;
-            //FIXME: look above
         }
         AV_DEBUG("floor0 dec: booknumber: %u\n", book_idx);
         codebook = vc->codebooks[vf->book_list[book_idx]];
@@ -1114,11 +1106,9 @@ static int vorbis_floor0_decode(vorbis_context *vc,
                 }
 
                 /* calculate linear floor value */
-                {
-                    q = exp((((amplitude*vf->amplitude_offset) /
-                              (((1 << vf->amplitude_bits) - 1) * sqrt(p + q)))
-                             - vf->amplitude_offset) * .11512925f);
-                }
+                q = exp((((amplitude*vf->amplitude_offset) /
+                          (((1 << vf->amplitude_bits) - 1) * sqrt(p + q)))
+                         - vf->amplitude_offset) * .11512925f);
 
                 /* fill vector */
                 do {
@@ -1453,24 +1443,12 @@ void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
     }
 }
 
-static void copy_normalize(float *dst, float *src, int len, int exp_bias,
-                           float add_bias)
-{
-    int i;
-    if (exp_bias) {
-        memcpy(dst, src, len * sizeof(float));
-    } else {
-        for (i = 0; i < len; i++)
-            dst[i] = src[i] + add_bias;
-    }
-}
-
 // Decode the audio packet using the functions above
 
 static int vorbis_parse_audio_packet(vorbis_context *vc)
 {
     GetBitContext *gb = &vc->gb;
-
+    FFTContext *mdct;
     uint_fast8_t previous_window = vc->previous_window;
     uint_fast8_t mode_number;
     uint_fast8_t blockflag;
@@ -1484,7 +1462,6 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
     uint_fast8_t res_chan[255];
     uint_fast8_t res_num = 0;
     int_fast16_t retlen  = 0;
-    float fadd_bias = vc->add_bias;
 
     if (get_bits1(gb)) {
         av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n");
@@ -1575,11 +1552,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
 
 // Dotproduct, MDCT
 
+    mdct = &vc->mdct[blockflag];
+
     for (j = vc->audio_channels-1;j >= 0; j--) {
         ch_floor_ptr = vc->channel_floors   + j           * blocksize / 2;
         ch_res_ptr   = vc->channel_residues + res_chan[j] * blocksize / 2;
-        vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize / 2);
-        ff_imdct_half(&vc->mdct[blockflag], ch_res_ptr, ch_floor_ptr);
+        vc->dsp.vector_fmul(ch_floor_ptr, ch_floor_ptr, ch_res_ptr, blocksize / 2);
+        mdct->imdct_half(mdct, ch_res_ptr, ch_floor_ptr);
     }
 
 // Overlap/add, save data for next overlapping  FPMATH
@@ -1595,13 +1574,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
         const float *win  = vc->win[blockflag & previous_window];
 
         if (blockflag == previous_window) {
-            vc->dsp.vector_fmul_window(ret, saved, buf, win, fadd_bias, blocksize / 4);
+            vc->dsp.vector_fmul_window(ret, saved, buf, win, blocksize / 4);
         } else if (blockflag > previous_window) {
-            vc->dsp.vector_fmul_window(ret, saved, buf, win, fadd_bias, bs0 / 4);
-            copy_normalize(ret+bs0/2, buf+bs0/4, (bs1-bs0)/4, vc->exp_bias, fadd_bias);
+            vc->dsp.vector_fmul_window(ret, saved, buf, win, bs0 / 4);
+            memcpy(ret+bs0/2, buf+bs0/4, ((bs1-bs0)/4) * sizeof(float));
         } else {
-            copy_normalize(ret, saved, (bs1 - bs0) / 4, vc->exp_bias, fadd_bias);
-            vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, fadd_bias, bs0 / 4);
+            memcpy(ret, saved, ((bs1 - bs0) / 4) * sizeof(float));
+            vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, bs0 / 4);
         }
         memcpy(saved, buf + blocksize / 4, blocksize / 4 * sizeof(float));
     }
@@ -1656,7 +1635,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
                               len * ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i];
     }
 
-    vc->dsp.float_to_int16_interleave(data, channel_ptrs, len, vc->audio_channels);
+    vc->fmt_conv.float_to_int16_interleave(data, channel_ptrs, len,
+                                           vc->audio_channels);
     *data_size = len * 2 * vc->audio_channels;
 
     return buf_size ;
@@ -1673,7 +1653,7 @@ static av_cold int vorbis_decode_close(AVCodecContext *avccontext)
     return 0 ;
 }
 
-AVCodec vorbis_decoder = {
+AVCodec ff_vorbis_decoder = {
     "vorbis",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_VORBIS,
diff --git a/ffmpeg-mt/libavcodec/vorbis_enc.c b/ffmpeg-mt/libavcodec/vorbis_enc.c
index 0a9c80d..7c5d521 100644
--- a/ffmpeg-mt/libavcodec/vorbis_enc.c
+++ b/ffmpeg-mt/libavcodec/vorbis_enc.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -935,7 +935,7 @@ static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *a
     }
 
     for (channel = 0; channel < venc->channels; channel++)
-        ff_mdct_calc(&venc->mdct[0], venc->coeffs + channel * window_len,
+        venc->mdct[0].mdct_calc(&venc->mdct[0], venc->coeffs + channel * window_len,
                      venc->samples + channel * window_len * 2);
 
     if (samples) {
@@ -1102,7 +1102,7 @@ static av_cold int vorbis_encode_close(AVCodecContext *avccontext)
     return 0 ;
 }
 
-AVCodec vorbis_encoder = {
+AVCodec ff_vorbis_encoder = {
     "vorbis",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_VORBIS,
diff --git a/ffmpeg-mt/libavcodec/vorbis_enc_data.h b/ffmpeg-mt/libavcodec/vorbis_enc_data.h
index affc3d6..a1e743e 100644
--- a/ffmpeg-mt/libavcodec/vorbis_enc_data.h
+++ b/ffmpeg-mt/libavcodec/vorbis_enc_data.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp3.c b/ffmpeg-mt/libavcodec/vp3.c
index 6516091..bcbb70f 100644
--- a/ffmpeg-mt/libavcodec/vp3.c
+++ b/ffmpeg-mt/libavcodec/vp3.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003-2004 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,7 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "get_bits.h"
@@ -237,8 +237,7 @@ typedef struct Vp3DecodeContext {
      * is coded. */
     unsigned char *macroblock_coding;
 
-    uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc
-    int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16
+    uint8_t *edge_emu_buffer;
 
     /* Huffman decode */
     int hti;
@@ -325,8 +324,6 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi)
             s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0];
         }
     }
-
-    memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune
 }
 
 /*
@@ -1409,10 +1406,6 @@ static void render_slice(Vp3DecodeContext *s, int slice)
         if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY))
             continue;
 
-
-        if(FFABS(stride) > 2048)
-            return; //various tables are fixed size
-
         /* for each superblock row in the slice (both of them)... */
         for (; sb_y < slice_height; sb_y++) {
 
@@ -1466,10 +1459,9 @@ static void render_slice(Vp3DecodeContext *s, int slice)
 
                         if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){
                             uint8_t *temp= s->edge_emu_buffer;
-                            if(stride<0) temp -= 9*stride;
-                            else temp += 9*stride;
+                            if(stride<0) temp -= 8*stride;
 
-                            ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
+                            s->dsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
                             motion_source= temp;
                         }
                     }
@@ -1817,10 +1809,8 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
             }
         }
 
-        if (s->qps[0] != s1->qps[0]) {
-            memcpy(&s->qscale_table, &s1->qscale_table, sizeof(s->qscale_table));
+        if (s->qps[0] != s1->qps[0])
             memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array));
-        }
 
         if (qps_changed)
             copy_fields(s, s1, qps, superblock_count);
@@ -1892,6 +1882,9 @@ static int vp3_decode_frame(AVCodecContext *avctx,
         goto error;
     }
 
+    if (!s->edge_emu_buffer)
+        s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0]));
+
     if (s->keyframe) {
         if (!s->theora)
         {
@@ -1922,12 +1915,10 @@ static int vp3_decode_frame(AVCodecContext *avctx,
             }
             s->last_frame = s->golden_frame;
             s->last_frame.type = FF_BUFFER_TYPE_COPY;
+            ff_thread_report_progress(&s->last_frame, INT_MAX, 0);
         }
     }
 
-    s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame
-    s->current_frame.qstride= 0;
-
     memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
     ff_thread_finish_setup(avctx);
 
@@ -2007,6 +1998,7 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx)
     av_free(s->macroblock_coding);
     av_free(s->motion_val[0]);
     av_free(s->motion_val[1]);
+    av_free(s->edge_emu_buffer);
 
     if (avctx->is_copy) return 0;
 
@@ -2329,7 +2321,7 @@ static av_cold int theora_decode_init(AVCodecContext *avctx)
     return vp3_decode_init(avctx);
 }
 
-AVCodec theora_decoder = {
+AVCodec ff_theora_decoder = {
     "theora",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_THEORA,
@@ -2345,7 +2337,7 @@ AVCodec theora_decoder = {
 };
 #endif
 
-AVCodec vp3_decoder = {
+AVCodec ff_vp3_decoder = {
     "vp3",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP3,
diff --git a/ffmpeg-mt/libavcodec/vp3_parser.c b/ffmpeg-mt/libavcodec/vp3_parser.c
index c22e6dd..3a9428f 100644
--- a/ffmpeg-mt/libavcodec/vp3_parser.c
+++ b/ffmpeg-mt/libavcodec/vp3_parser.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2008 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -35,7 +35,7 @@ static int parse(AVCodecParserContext *s,
     return buf_size;
 }
 
-AVCodecParser vp3_parser = {
+AVCodecParser ff_vp3_parser = {
     { CODEC_ID_THEORA, CODEC_ID_VP3,
       CODEC_ID_VP6,    CODEC_ID_VP6F, CODEC_ID_VP6A },
     0,
diff --git a/ffmpeg-mt/libavcodec/vp3data.h b/ffmpeg-mt/libavcodec/vp3data.h
index 904ec6a..54d5a6c 100644
--- a/ffmpeg-mt/libavcodec/vp3data.h
+++ b/ffmpeg-mt/libavcodec/vp3data.h
@@ -1,20 +1,20 @@
 /*
  * copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp3dsp.c b/ffmpeg-mt/libavcodec/vp3dsp.c
index 94efa3b..baa22a5 100644
--- a/ffmpeg-mt/libavcodec/vp3dsp.c
+++ b/ffmpeg-mt/libavcodec/vp3dsp.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2004 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp5.c b/ffmpeg-mt/libavcodec/vp5.c
index 7b3a487..807309f 100644
--- a/ffmpeg-mt/libavcodec/vp5.c
+++ b/ffmpeg-mt/libavcodec/vp5.c
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -266,7 +266,7 @@ static av_cold int vp5_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec vp5_decoder = {
+AVCodec ff_vp5_decoder = {
     "vp5",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP5,
diff --git a/ffmpeg-mt/libavcodec/vp56.c b/ffmpeg-mt/libavcodec/vp56.c
index 2e5f2d6..63373d3 100644
--- a/ffmpeg-mt/libavcodec/vp56.c
+++ b/ffmpeg-mt/libavcodec/vp56.c
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -337,7 +337,7 @@ static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,
 
     if (x<0 || x+12>=s->plane_width[plane] ||
         y<0 || y+12>=s->plane_height[plane]) {
-        ff_emulated_edge_mc(s->edge_emu_buffer,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer,
                             src + s->block_offset[b] + (dy-2)*stride + (dx-2),
                             stride, 12, 12, x, y,
                             s->plane_width[plane],
diff --git a/ffmpeg-mt/libavcodec/vp56.h b/ffmpeg-mt/libavcodec/vp56.h
index da6b1b6..5a55f7d 100644
--- a/ffmpeg-mt/libavcodec/vp56.h
+++ b/ffmpeg-mt/libavcodec/vp56.h
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -201,7 +201,9 @@ static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c)
     return code_word;
 }
 
-#if ARCH_X86
+#if   ARCH_ARM
+#include "arm/vp56_arith.h"
+#elif ARCH_X86
 #include "x86/vp56_arith.h"
 #endif
 
@@ -221,6 +223,7 @@ static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
 }
 #endif
 
+#ifndef vp56_rac_get_prob_branchy
 // branchy variant, to be used where there's a branch based on the bit decoded
 static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int prob)
 {
@@ -238,6 +241,7 @@ static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int pro
     c->code_word = code_word;
     return 0;
 }
+#endif
 
 static av_always_inline int vp56_rac_get(VP56RangeCoder *c)
 {
diff --git a/ffmpeg-mt/libavcodec/vp56data.c b/ffmpeg-mt/libavcodec/vp56data.c
index b0515c2..7a41876 100644
--- a/ffmpeg-mt/libavcodec/vp56data.c
+++ b/ffmpeg-mt/libavcodec/vp56data.c
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp56data.h b/ffmpeg-mt/libavcodec/vp56data.h
index 57b0968..7be5921 100644
--- a/ffmpeg-mt/libavcodec/vp56data.h
+++ b/ffmpeg-mt/libavcodec/vp56data.h
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp56dsp.c b/ffmpeg-mt/libavcodec/vp56dsp.c
index c629343..7b4a771 100644
--- a/ffmpeg-mt/libavcodec/vp56dsp.c
+++ b/ffmpeg-mt/libavcodec/vp56dsp.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2006 Aurelien Jacobs <aurel at gnuage.org>
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp56dsp.h b/ffmpeg-mt/libavcodec/vp56dsp.h
index 74a9cb5..3bd6d27 100644
--- a/ffmpeg-mt/libavcodec/vp56dsp.h
+++ b/ffmpeg-mt/libavcodec/vp56dsp.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp56rac.c b/ffmpeg-mt/libavcodec/vp56rac.c
index f11531d..c009cad 100644
--- a/ffmpeg-mt/libavcodec/vp56rac.c
+++ b/ffmpeg-mt/libavcodec/vp56rac.c
@@ -2,20 +2,20 @@
  * VP5/6/8 decoder
  * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp5data.h b/ffmpeg-mt/libavcodec/vp5data.h
index 5c2d46c..11144a3 100644
--- a/ffmpeg-mt/libavcodec/vp5data.h
+++ b/ffmpeg-mt/libavcodec/vp5data.h
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp6.c b/ffmpeg-mt/libavcodec/vp6.c
index d3a2f35..4f3f402 100644
--- a/ffmpeg-mt/libavcodec/vp6.c
+++ b/ffmpeg-mt/libavcodec/vp6.c
@@ -8,20 +8,20 @@
  *  - upper 4bits: difference between encoded width and visible width
  *  - lower 4bits: difference between encoded height and visible height
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -606,7 +606,7 @@ static av_cold int vp6_decode_free(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec vp6_decoder = {
+AVCodec ff_vp6_decoder = {
     "vp6",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP6,
@@ -620,7 +620,7 @@ AVCodec vp6_decoder = {
 };
 
 /* flash version, not flipped upside-down */
-AVCodec vp6f_decoder = {
+AVCodec ff_vp6f_decoder = {
     "vp6f",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP6F,
@@ -634,7 +634,7 @@ AVCodec vp6f_decoder = {
 };
 
 /* flash version, not flipped upside-down, with alpha channel */
-AVCodec vp6a_decoder = {
+AVCodec ff_vp6a_decoder = {
     "vp6a",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP6A,
diff --git a/ffmpeg-mt/libavcodec/vp6data.h b/ffmpeg-mt/libavcodec/vp6data.h
index 1cfdbe7..2ba3ef3 100644
--- a/ffmpeg-mt/libavcodec/vp6data.h
+++ b/ffmpeg-mt/libavcodec/vp6data.h
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp6dsp.c b/ffmpeg-mt/libavcodec/vp6dsp.c
index 1119b56..64282a5 100644
--- a/ffmpeg-mt/libavcodec/vp6dsp.c
+++ b/ffmpeg-mt/libavcodec/vp6dsp.c
@@ -4,20 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/vp8.c b/ffmpeg-mt/libavcodec/vp8.c
index 7552442..de4a51d 100644
--- a/ffmpeg-mt/libavcodec/vp8.c
+++ b/ffmpeg-mt/libavcodec/vp8.c
@@ -5,200 +5,32 @@
  * Copyright (C) 2010 Ronald S. Bultje
  * Copyright (C) 2010 Jason Garrett-Glaser
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
-#include "vp56.h"
+#include "vp8.h"
 #include "vp8data.h"
-#include "vp8dsp.h"
-#include "h264pred.h"
 #include "rectangle.h"
 
-typedef struct {
-    uint8_t filter_level;
-    uint8_t inner_limit;
-    uint8_t inner_filter;
-} VP8FilterStrength;
-
-typedef struct {
-    uint8_t skip;
-    // todo: make it possible to check for at least (i4x4 or split_mv)
-    // in one op. are others needed?
-    uint8_t mode;
-    uint8_t ref_frame;
-    uint8_t partitioning;
-    VP56mv mv;
-    VP56mv bmv[16];
-} VP8Macroblock;
-
-typedef struct {
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    VP8DSPContext vp8dsp;
-    H264PredContext hpc;
-    vp8_mc_func put_pixels_tab[3][3][3];
-    AVFrame frames[4];
-    AVFrame *framep[4];
-    uint8_t *edge_emu_buffer;
-    VP56RangeCoder c;   ///< header context, includes mb modes and motion vectors
-    int profile;
-
-    int mb_width;   /* number of horizontal MB */
-    int mb_height;  /* number of vertical MB */
-    int linesize;
-    int uvlinesize;
-
-    int keyframe;
-    int invisible;
-    int update_last;    ///< update VP56_FRAME_PREVIOUS with the current one
-    int update_golden;  ///< VP56_FRAME_NONE if not updated, or which frame to copy if so
-    int update_altref;
-    int deblock_filter;
-
-    /**
-     * If this flag is not set, all the probability updates
-     * are discarded after this frame is decoded.
-     */
-    int update_probabilities;
-
-    /**
-     * All coefficients are contained in separate arith coding contexts.
-     * There can be 1, 2, 4, or 8 of these after the header context.
-     */
-    int num_coeff_partitions;
-    VP56RangeCoder coeff_partition[8];
-
-    VP8Macroblock *macroblocks;
-    VP8Macroblock *macroblocks_base;
-    VP8FilterStrength *filter_strength;
-
-    uint8_t *intra4x4_pred_mode_top;
-    uint8_t intra4x4_pred_mode_left[4];
-    uint8_t *segmentation_map;
-
-    /**
-     * Cache of the top row needed for intra prediction
-     * 16 for luma, 8 for each chroma plane
-     */
-    uint8_t (*top_border)[16+8+8];
-
-    /**
-     * For coeff decode, we need to know whether the above block had non-zero
-     * coefficients. This means for each macroblock, we need data for 4 luma
-     * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
-     * per macroblock. We keep the last row in top_nnz.
-     */
-    uint8_t (*top_nnz)[9];
-    DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
-
-    /**
-     * This is the index plus one of the last non-zero coeff
-     * for each of the blocks in the current macroblock.
-     * So, 0 -> no coeffs
-     *     1 -> dc-only (special transform)
-     *     2+-> full transform
-     */
-    DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
-    DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
-    DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
-    uint8_t intra4x4_pred_mode_mb[16];
-
-    int chroma_pred_mode;    ///< 8x8c pred mode of the current macroblock
-    int segment;             ///< segment of the current macroblock
-
-    int mbskip_enabled;
-    int sign_bias[4]; ///< one state [0, 1] per ref frame type
-    int ref_count[3];
-
-    /**
-     * Base parameters for segmentation, i.e. per-macroblock parameters.
-     * These must be kept unchanged even if segmentation is not used for
-     * a frame, since the values persist between interframes.
-     */
-    struct {
-        int enabled;
-        int absolute_vals;
-        int update_map;
-        int8_t base_quant[4];
-        int8_t filter_level[4];     ///< base loop filter level
-    } segmentation;
-
-    /**
-     * Macroblocks can have one of 4 different quants in a frame when
-     * segmentation is enabled.
-     * If segmentation is disabled, only the first segment's values are used.
-     */
-    struct {
-        // [0] - DC qmul  [1] - AC qmul
-        int16_t luma_qmul[2];
-        int16_t luma_dc_qmul[2];    ///< luma dc-only block quant
-        int16_t chroma_qmul[2];
-    } qmat[4];
-
-    struct {
-        int simple;
-        int level;
-        int sharpness;
-    } filter;
-
-    struct {
-        int enabled;    ///< whether each mb can have a different strength based on mode/ref
-
-        /**
-         * filter strength adjustment for the following macroblock modes:
-         * [0] - i4x4
-         * [1] - zero mv
-         * [2] - inter modes except for zero or split mv
-         * [3] - split mv
-         *  i16x16 modes never have any adjustment
-         */
-        int8_t mode[4];
-
-        /**
-         * filter strength adjustment for macroblocks that reference:
-         * [0] - intra / VP56_FRAME_CURRENT
-         * [1] - VP56_FRAME_PREVIOUS
-         * [2] - VP56_FRAME_GOLDEN
-         * [3] - altref / VP56_FRAME_GOLDEN2
-         */
-        int8_t ref[4];
-    } lf_delta;
-
-    /**
-     * These are all of the updatable probabilities for binary decisions.
-     * They are only implictly reset on keyframes, making it quite likely
-     * for an interframe to desync if a prior frame's header was corrupt
-     * or missing outright!
-     */
-    struct {
-        uint8_t segmentid[3];
-        uint8_t mbskip;
-        uint8_t intra;
-        uint8_t last;
-        uint8_t golden;
-        uint8_t pred16x16[4];
-        uint8_t pred8x8c[3];
-        /* Padded to allow overreads */
-        uint8_t token[4][17][3][NUM_DCT_TOKENS-1];
-        uint8_t mvc[2][19];
-    } prob[2];
-} VP8Context;
+#if ARCH_ARM
+#   include "arm/vp8.h"
+#endif
 
 static void vp8_decode_flush(AVCodecContext *avctx)
 {
@@ -278,7 +110,7 @@ static void update_lf_deltas(VP8Context *s)
     for (i = 0; i < 4; i++)
         s->lf_delta.ref[i]  = vp8_rac_get_sint(c, 6);
 
-    for (i = 0; i < 4; i++)
+    for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++)
         s->lf_delta.mode[i] = vp8_rac_get_sint(c, 6);
 }
 
@@ -517,76 +349,10 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
     return 0;
 }
 
-static av_always_inline
-void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src, int mb_x, int mb_y)
+static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src)
 {
-#define MARGIN (16 << 2)
-    dst->x = av_clip(src->x, -((mb_x << 6) + MARGIN),
-                     ((s->mb_width  - 1 - mb_x) << 6) + MARGIN);
-    dst->y = av_clip(src->y, -((mb_y << 6) + MARGIN),
-                     ((s->mb_height - 1 - mb_y) << 6) + MARGIN);
-}
-
-static av_always_inline
-void find_near_mvs(VP8Context *s, VP8Macroblock *mb,
-                   VP56mv near[2], VP56mv *best, uint8_t cnt[4])
-{
-    VP8Macroblock *mb_edge[3] = { mb + 2 /* top */,
-                                  mb - 1 /* left */,
-                                  mb + 1 /* top-left */ };
-    enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT };
-    VP56mv near_mv[4]  = {{ 0 }};
-    enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV };
-    int idx = CNT_ZERO;
-    int best_idx = CNT_ZERO;
-    int cur_sign_bias = s->sign_bias[mb->ref_frame];
-    int *sign_bias = s->sign_bias;
-
-    /* Process MB on top, left and top-left */
-    #define MV_EDGE_CHECK(n)\
-    {\
-        VP8Macroblock *edge = mb_edge[n];\
-        int edge_ref = edge->ref_frame;\
-        if (edge_ref != VP56_FRAME_CURRENT) {\
-            uint32_t mv = AV_RN32A(&edge->mv);\
-            if (mv) {\
-                if (cur_sign_bias != sign_bias[edge_ref]) {\
-                    /* SWAR negate of the values in mv. */\
-                    mv = ~mv;\
-                    mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\
-                }\
-                if (!n || mv != AV_RN32A(&near_mv[idx]))\
-                    AV_WN32A(&near_mv[++idx], mv);\
-                cnt[idx]      += 1 + (n != 2);\
-            } else\
-                cnt[CNT_ZERO] += 1 + (n != 2);\
-        }\
-    }
-    MV_EDGE_CHECK(0)
-    MV_EDGE_CHECK(1)
-    MV_EDGE_CHECK(2)
-
-    /* If we have three distinct MVs, merge first and last if they're the same */
-    if (cnt[CNT_SPLITMV] && AV_RN32A(&near_mv[1+VP8_EDGE_TOP]) == AV_RN32A(&near_mv[1+VP8_EDGE_TOPLEFT]))
-        cnt[CNT_NEAREST] += 1;
-
-    cnt[CNT_SPLITMV] = ((mb_edge[VP8_EDGE_LEFT]->mode   == VP8_MVMODE_SPLIT) +
-                        (mb_edge[VP8_EDGE_TOP]->mode    == VP8_MVMODE_SPLIT)) * 2 +
-                       (mb_edge[VP8_EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT);
-
-    /* Swap near and nearest if necessary */
-    if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) {
-        FFSWAP(uint8_t,     cnt[CNT_NEAREST],     cnt[CNT_NEAR]);
-        FFSWAP( VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]);
-    }
-
-    /* Choose the best mv out of 0,0 and the nearest mv */
-    if (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])
-        best_idx = CNT_NEAREST;
-
-    mb->mv  = near_mv[best_idx];
-    near[0] = near_mv[CNT_NEAREST];
-    near[1] = near_mv[CNT_NEAR];
+    dst->x = av_clip(src->x, s->mv_min.x, s->mv_max.x);
+    dst->y = av_clip(src->y, s->mv_min.y, s->mv_max.y);
 }
 
 /**
@@ -699,6 +465,95 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb)
 }
 
 static av_always_inline
+void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
+{
+    VP8Macroblock *mb_edge[3] = { mb + 2 /* top */,
+                                  mb - 1 /* left */,
+                                  mb + 1 /* top-left */ };
+    enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV };
+    enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT };
+    int idx = CNT_ZERO;
+    int cur_sign_bias = s->sign_bias[mb->ref_frame];
+    int8_t *sign_bias = s->sign_bias;
+    VP56mv near_mv[4];
+    uint8_t cnt[4] = { 0 };
+    VP56RangeCoder *c = &s->c;
+
+    AV_ZERO32(&near_mv[0]);
+    AV_ZERO32(&near_mv[1]);
+
+    /* Process MB on top, left and top-left */
+    #define MV_EDGE_CHECK(n)\
+    {\
+        VP8Macroblock *edge = mb_edge[n];\
+        int edge_ref = edge->ref_frame;\
+        if (edge_ref != VP56_FRAME_CURRENT) {\
+            uint32_t mv = AV_RN32A(&edge->mv);\
+            if (mv) {\
+                if (cur_sign_bias != sign_bias[edge_ref]) {\
+                    /* SWAR negate of the values in mv. */\
+                    mv = ~mv;\
+                    mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\
+                }\
+                if (!n || mv != AV_RN32A(&near_mv[idx]))\
+                    AV_WN32A(&near_mv[++idx], mv);\
+                cnt[idx]      += 1 + (n != 2);\
+            } else\
+                cnt[CNT_ZERO] += 1 + (n != 2);\
+        }\
+    }
+
+    MV_EDGE_CHECK(0)
+    MV_EDGE_CHECK(1)
+    MV_EDGE_CHECK(2)
+
+    mb->partitioning = VP8_SPLITMVMODE_NONE;
+    if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_ZERO]][0])) {
+        mb->mode = VP8_MVMODE_MV;
+
+        /* If we have three distinct MVs, merge first and last if they're the same */
+        if (cnt[CNT_SPLITMV] && AV_RN32A(&near_mv[1 + VP8_EDGE_TOP]) == AV_RN32A(&near_mv[1 + VP8_EDGE_TOPLEFT]))
+            cnt[CNT_NEAREST] += 1;
+
+        /* Swap near and nearest if necessary */
+        if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) {
+            FFSWAP(uint8_t,     cnt[CNT_NEAREST],     cnt[CNT_NEAR]);
+            FFSWAP( VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]);
+        }
+
+        if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAREST]][1])) {
+            if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAR]][2])) {
+
+                /* Choose the best mv out of 0,0 and the nearest mv */
+                clamp_mv(s, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])]);
+                cnt[CNT_SPLITMV] = ((mb_edge[VP8_EDGE_LEFT]->mode    == VP8_MVMODE_SPLIT) +
+                                    (mb_edge[VP8_EDGE_TOP]->mode     == VP8_MVMODE_SPLIT)) * 2 +
+                                    (mb_edge[VP8_EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT);
+
+                if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_SPLITMV]][3])) {
+                    mb->mode = VP8_MVMODE_SPLIT;
+                    mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1];
+                } else {
+                    mb->mv.y += read_mv_component(c, s->prob->mvc[0]);
+                    mb->mv.x += read_mv_component(c, s->prob->mvc[1]);
+                    mb->bmv[0] = mb->mv;
+                }
+            } else {
+                clamp_mv(s, &mb->mv, &near_mv[CNT_NEAR]);
+                mb->bmv[0] = mb->mv;
+            }
+        } else {
+            clamp_mv(s, &mb->mv, &near_mv[CNT_NEAREST]);
+            mb->bmv[0] = mb->mv;
+        }
+    } else {
+        mb->mode = VP8_MVMODE_ZERO;
+        AV_ZERO32(&mb->mv);
+        mb->bmv[0] = mb->mv;
+    }
+}
+
+static av_always_inline
 void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c,
                            int mb_x, int keyframe)
 {
@@ -748,9 +603,6 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
         s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra);
         mb->ref_frame = VP56_FRAME_CURRENT;
     } else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) {
-        VP56mv near[2], best;
-        uint8_t cnt[4] = { 0 };
-
         // inter MB, 16.2
         if (vp56_rac_get_prob_branchy(c, s->prob->last))
             mb->ref_frame = vp56_rac_get_prob(c, s->prob->golden) ?
@@ -760,36 +612,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
         s->ref_count[mb->ref_frame-1]++;
 
         // motion vectors, 16.3
-        find_near_mvs(s, mb, near, &best, cnt);
-        if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[0]][0])) {
-            if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[1]][1])) {
-                if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[2]][2])) {
-                    if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[3]][3])) {
-                        mb->mode = VP8_MVMODE_SPLIT;
-                        clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y);
-                        mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1];
-                    } else {
-                        mb->mode = VP8_MVMODE_NEW;
-                        clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y);
-                        mb->mv.y += read_mv_component(c, s->prob->mvc[0]);
-                        mb->mv.x += read_mv_component(c, s->prob->mvc[1]);
-                    }
-                } else {
-                    mb->mode = VP8_MVMODE_NEAR;
-                    clamp_mv(s, &mb->mv, &near[1], mb_x, mb_y);
-                }
-            } else {
-                mb->mode = VP8_MVMODE_NEAREST;
-                clamp_mv(s, &mb->mv, &near[0], mb_x, mb_y);
-            }
-        } else {
-            mb->mode = VP8_MVMODE_ZERO;
-            AV_ZERO32(&mb->mv);
-        }
-        if (mb->mode != VP8_MVMODE_SPLIT) {
-            mb->partitioning = VP8_SPLITMVMODE_NONE;
-            mb->bmv[0] = mb->mv;
-        }
+        decode_mvs(s, mb, mb_x, mb_y);
     } else {
         // intra MB, 16.1
         mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16);
@@ -804,6 +627,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
     }
 }
 
+#ifndef decode_block_coeffs_internal
 /**
  * @param c arithmetic bitstream reader context
  * @param block destination for block coefficients
@@ -816,7 +640,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
  *         otherwise, the index of the last coeff decoded plus one
  */
 static int decode_block_coeffs_internal(VP56RangeCoder *c, DCTELEM block[16],
-                                        uint8_t probs[8][3][NUM_DCT_TOKENS-1],
+                                        uint8_t probs[16][3][NUM_DCT_TOKENS-1],
                                         int i, uint8_t *token_prob, int16_t qmul[2])
 {
     goto skip_eob;
@@ -857,7 +681,7 @@ skip_eob:
                     int b = vp56_rac_get_prob(c, token_prob[9+a]);
                     int cat = (a<<1) + b;
                     coeff  = 3 + (8<<cat);
-                    coeff += vp8_rac_get_coeff(c, vp8_dct_cat_prob[cat]);
+                    coeff += vp8_rac_get_coeff(c, ff_vp8_dct_cat_prob[cat]);
                 }
             }
             token_prob = probs[i+1][2];
@@ -867,10 +691,11 @@ skip_eob:
 
     return i;
 }
+#endif
 
 static av_always_inline
 int decode_block_coeffs(VP56RangeCoder *c, DCTELEM block[16],
-                        uint8_t probs[8][3][NUM_DCT_TOKENS-1],
+                        uint8_t probs[16][3][NUM_DCT_TOKENS-1],
                         int i, int zero_nhood, int16_t qmul[2])
 {
     uint8_t *token_prob = probs[i][zero_nhood];
@@ -1132,9 +957,9 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
                         linesize = 8;
                         if (!(mb_y + y)) {
                             copy_dst[3] = 127U;
-                            * (uint32_t *) (copy_dst + 4) = 127U * 0x01010101U;
+                            AV_WN32A(copy_dst+4, 127U * 0x01010101U);
                         } else {
-                            * (uint32_t *) (copy_dst + 4) = * (uint32_t *) (ptr+4*x-s->linesize);
+                            AV_COPY32(copy_dst+4, ptr+4*x-s->linesize);
                             if (!(mb_x + x)) {
                                 copy_dst[3] = 129U;
                             } else {
@@ -1158,10 +983,10 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
                 }
                 s->hpc.pred4x4[mode](dst, topright, linesize);
                 if (copy) {
-                    * (uint32_t *) (ptr+4*x)               = * (uint32_t *) (copy_dst + 12);
-                    * (uint32_t *) (ptr+4*x+s->linesize)   = * (uint32_t *) (copy_dst + 20);
-                    * (uint32_t *) (ptr+4*x+s->linesize*2) = * (uint32_t *) (copy_dst + 28);
-                    * (uint32_t *) (ptr+4*x+s->linesize*3) = * (uint32_t *) (copy_dst + 36);
+                    AV_COPY32(ptr+4*x              , copy_dst+12);
+                    AV_COPY32(ptr+4*x+s->linesize  , copy_dst+20);
+                    AV_COPY32(ptr+4*x+s->linesize*2, copy_dst+28);
+                    AV_COPY32(ptr+4*x+s->linesize*3, copy_dst+36);
                 }
 
                 nnz = s->non_zero_count_cache[y][x];
@@ -1193,6 +1018,13 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
                        s->filter.simple, 0);
 }
 
+static const uint8_t subpel_idx[3][8] = {
+    { 0, 1, 2, 1, 2, 1, 2, 1 }, // nr. of left extra pixels,
+                                // also function pointer index
+    { 0, 3, 5, 3, 5, 3, 5, 3 }, // nr. of extra pixels required
+    { 0, 2, 3, 2, 3, 2, 3, 2 }, // nr. of right extra pixels
+};
+
 /**
  * Generic MC function.
  *
@@ -1211,28 +1043,27 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
  * @param mc_func motion compensation function pointers (bilinear or sixtap MC)
  */
 static av_always_inline
-void vp8_mc(VP8Context *s, int luma,
-            uint8_t *dst, uint8_t *src, const VP56mv *mv,
-            int x_off, int y_off, int block_w, int block_h,
-            int width, int height, int linesize,
-            vp8_mc_func mc_func[3][3])
+void vp8_mc_luma(VP8Context *s, uint8_t *dst, uint8_t *src, const VP56mv *mv,
+                 int x_off, int y_off, int block_w, int block_h,
+                 int width, int height, int linesize,
+                 vp8_mc_func mc_func[3][3])
 {
     if (AV_RN32A(mv)) {
-        static const uint8_t idx[8] = { 0, 1, 2, 1, 2, 1, 2, 1 };
-        int mx = (mv->x << luma)&7, mx_idx = idx[mx];
-        int my = (mv->y << luma)&7, my_idx = idx[my];
 
-        x_off += mv->x >> (3 - luma);
-        y_off += mv->y >> (3 - luma);
+        int mx = (mv->x << 1)&7, mx_idx = subpel_idx[0][mx];
+        int my = (mv->y << 1)&7, my_idx = subpel_idx[0][my];
+
+        x_off += mv->x >> 2;
+        y_off += mv->y >> 2;
 
         // edge emulation
         src += y_off * linesize + x_off;
-        if (x_off < 2 || x_off >= width  - block_w - 3 ||
-            y_off < 2 || y_off >= height - block_h - 3) {
-            ff_emulated_edge_mc(s->edge_emu_buffer, src - 2 * linesize - 2, linesize,
-                                block_w + 5, block_h + 5,
-                                x_off - 2, y_off - 2, width, height);
-            src = s->edge_emu_buffer + 2 + linesize * 2;
+        if (x_off < mx_idx || x_off >= width  - block_w - subpel_idx[2][mx] ||
+            y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize,
+                                    block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
+                                    x_off - mx_idx, y_off - my_idx, width, height);
+            src = s->edge_emu_buffer + mx_idx + linesize * my_idx;
         }
         mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my);
     } else
@@ -1240,6 +1071,45 @@ void vp8_mc(VP8Context *s, int luma,
 }
 
 static av_always_inline
+void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, uint8_t *src1,
+                   uint8_t *src2, const VP56mv *mv, int x_off, int y_off,
+                   int block_w, int block_h, int width, int height, int linesize,
+                   vp8_mc_func mc_func[3][3])
+{
+    if (AV_RN32A(mv)) {
+        int mx = mv->x&7, mx_idx = subpel_idx[0][mx];
+        int my = mv->y&7, my_idx = subpel_idx[0][my];
+
+        x_off += mv->x >> 3;
+        y_off += mv->y >> 3;
+
+        // edge emulation
+        src1 += y_off * linesize + x_off;
+        src2 += y_off * linesize + x_off;
+        if (x_off < mx_idx || x_off >= width  - block_w - subpel_idx[2][mx] ||
+            y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, src1 - my_idx * linesize - mx_idx, linesize,
+                                    block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
+                                    x_off - mx_idx, y_off - my_idx, width, height);
+            src1 = s->edge_emu_buffer + mx_idx + linesize * my_idx;
+            mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);
+
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, src2 - my_idx * linesize - mx_idx, linesize,
+                                    block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
+                                    x_off - mx_idx, y_off - my_idx, width, height);
+            src2 = s->edge_emu_buffer + mx_idx + linesize * my_idx;
+            mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);
+        } else {
+            mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);
+            mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);
+        }
+    } else {
+        mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0);
+        mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0);
+    }
+}
+
+static av_always_inline
 void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
                  AVFrame *ref_frame, int x_off, int y_off,
                  int bx_off, int by_off,
@@ -1249,10 +1119,10 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
     VP56mv uvmv = *mv;
 
     /* Y */
-    vp8_mc(s, 1, dst[0] + by_off * s->linesize + bx_off,
-           ref_frame->data[0], mv, x_off + bx_off, y_off + by_off,
-           block_w, block_h, width, height, s->linesize,
-           s->put_pixels_tab[block_w == 8]);
+    vp8_mc_luma(s, dst[0] + by_off * s->linesize + bx_off,
+                ref_frame->data[0], mv, x_off + bx_off, y_off + by_off,
+                block_w, block_h, width, height, s->linesize,
+                s->put_pixels_tab[block_w == 8]);
 
     /* U/V */
     if (s->profile == 3) {
@@ -1263,14 +1133,11 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
     bx_off  >>= 1; by_off  >>= 1;
     width   >>= 1; height  >>= 1;
     block_w >>= 1; block_h >>= 1;
-    vp8_mc(s, 0, dst[1] + by_off * s->uvlinesize + bx_off,
-           ref_frame->data[1], &uvmv, x_off + bx_off, y_off + by_off,
-           block_w, block_h, width, height, s->uvlinesize,
-           s->put_pixels_tab[1 + (block_w == 4)]);
-    vp8_mc(s, 0, dst[2] + by_off * s->uvlinesize + bx_off,
-           ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off,
-           block_w, block_h, width, height, s->uvlinesize,
-           s->put_pixels_tab[1 + (block_w == 4)]);
+    vp8_mc_chroma(s, dst[1] + by_off * s->uvlinesize + bx_off,
+                  dst[2] + by_off * s->uvlinesize + bx_off, ref_frame->data[1],
+                  ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off,
+                  block_w, block_h, width, height, s->uvlinesize,
+                  s->put_pixels_tab[1 + (block_w == 4)]);
 }
 
 /* Fetch pixels for estimated mv 4 macroblocks ahead.
@@ -1302,10 +1169,11 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
     AVFrame *ref = s->framep[mb->ref_frame];
     VP56mv *bmv = mb->bmv;
 
-    if (mb->mode < VP8_MVMODE_SPLIT) {
+    switch (mb->partitioning) {
+    case VP8_SPLITMVMODE_NONE:
         vp8_mc_part(s, dst, ref, x_off, y_off,
                     0, 0, 16, 16, width, height, &mb->mv);
-    } else switch (mb->partitioning) {
+        break;
     case VP8_SPLITMVMODE_4x4: {
         int x, y;
         VP56mv uvmv;
@@ -1313,11 +1181,11 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
         /* Y */
         for (y = 0; y < 4; y++) {
             for (x = 0; x < 4; x++) {
-                vp8_mc(s, 1, dst[0] + 4*y*s->linesize + x*4,
-                       ref->data[0], &bmv[4*y + x],
-                       4*x + x_off, 4*y + y_off, 4, 4,
-                       width, height, s->linesize,
-                       s->put_pixels_tab[2]);
+                vp8_mc_luma(s, dst[0] + 4*y*s->linesize + x*4,
+                            ref->data[0], &bmv[4*y + x],
+                            4*x + x_off, 4*y + y_off, 4, 4,
+                            width, height, s->linesize,
+                            s->put_pixels_tab[2]);
             }
         }
 
@@ -1339,16 +1207,12 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
                     uvmv.x &= ~7;
                     uvmv.y &= ~7;
                 }
-                vp8_mc(s, 0, dst[1] + 4*y*s->uvlinesize + x*4,
-                       ref->data[1], &uvmv,
-                       4*x + x_off, 4*y + y_off, 4, 4,
-                       width, height, s->uvlinesize,
-                       s->put_pixels_tab[2]);
-                vp8_mc(s, 0, dst[2] + 4*y*s->uvlinesize + x*4,
-                       ref->data[2], &uvmv,
-                       4*x + x_off, 4*y + y_off, 4, 4,
-                       width, height, s->uvlinesize,
-                       s->put_pixels_tab[2]);
+                vp8_mc_chroma(s, dst[1] + 4*y*s->uvlinesize + x*4,
+                              dst[2] + 4*y*s->uvlinesize + x*4,
+                              ref->data[1], ref->data[2], &uvmv,
+                              4*x + x_off, 4*y + y_off, 4, 4,
+                              width, height, s->uvlinesize,
+                              s->put_pixels_tab[2]);
             }
         }
         break;
@@ -1385,17 +1249,17 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo
     if (mb->mode != MODE_I4x4) {
         uint8_t *y_dst = dst[0];
         for (y = 0; y < 4; y++) {
-            uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[y]);
+            uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[y]);
             if (nnz4) {
                 if (nnz4&~0x01010101) {
                     for (x = 0; x < 4; x++) {
-                        int nnz = s->non_zero_count_cache[y][x];
-                        if (nnz) {
-                            if (nnz == 1)
-                                s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize);
-                            else
-                                s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize);
-                        }
+                        if ((uint8_t)nnz4 == 1)
+                            s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize);
+                        else if((uint8_t)nnz4 > 1)
+                            s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize);
+                        nnz4 >>= 8;
+                        if (!nnz4)
+                            break;
                     }
                 } else {
                     s->vp8dsp.vp8_idct_dc_add4y(y_dst, s->block[y], s->linesize);
@@ -1406,19 +1270,19 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo
     }
 
     for (ch = 0; ch < 2; ch++) {
-        uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[4+ch]);
+        uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[4+ch]);
         if (nnz4) {
             uint8_t *ch_dst = dst[1+ch];
             if (nnz4&~0x01010101) {
                 for (y = 0; y < 2; y++) {
                     for (x = 0; x < 2; x++) {
-                        int nnz = s->non_zero_count_cache[4+ch][(y<<1)+x];
-                        if (nnz) {
-                            if (nnz == 1)
-                                s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
-                            else
-                                s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
-                        }
+                        if ((uint8_t)nnz4 == 1)
+                            s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
+                        else if((uint8_t)nnz4 > 1)
+                            s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
+                        nnz4 >>= 8;
+                        if (!nnz4)
+                            goto chroma_idct_end;
                     }
                     ch_dst += 4*s->uvlinesize;
                 }
@@ -1426,6 +1290,7 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo
                 s->vp8dsp.vp8_idct_dc_add4uv(ch_dst, s->block[4+ch], s->uvlinesize);
             }
         }
+chroma_idct_end: ;
     }
 }
 
@@ -1442,24 +1307,16 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m
 
     if (s->lf_delta.enabled) {
         filter_level += s->lf_delta.ref[mb->ref_frame];
-
-        if (mb->ref_frame == VP56_FRAME_CURRENT) {
-            if (mb->mode == MODE_I4x4)
-                filter_level += s->lf_delta.mode[0];
-        } else {
-            if (mb->mode == VP8_MVMODE_ZERO)
-                filter_level += s->lf_delta.mode[1];
-            else if (mb->mode == VP8_MVMODE_SPLIT)
-                filter_level += s->lf_delta.mode[3];
-            else
-                filter_level += s->lf_delta.mode[2];
-        }
+        filter_level += s->lf_delta.mode[mb->mode];
     }
-    filter_level = av_clip(filter_level, 0, 63);
+
+/* Like av_clip for inputs 0 and max, where max is equal to (2^n-1) */
+#define POW2CLIP(x,max) (((x) & ~max) ? (-(x))>>31 & max : (x));
+    filter_level = POW2CLIP(filter_level, 63);
 
     interior_limit = filter_level;
     if (s->filter.sharpness) {
-        interior_limit >>= s->filter.sharpness > 4 ? 2 : 1;
+        interior_limit >>= (s->filter.sharpness + 3) >> 2;
         interior_limit = FFMIN(interior_limit, 9 - s->filter.sharpness);
     }
     interior_limit = FFMAX(interior_limit, 1);
@@ -1477,23 +1334,24 @@ static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8Filter
     int inner_filter = f->inner_filter;
     int linesize = s->linesize;
     int uvlinesize = s->uvlinesize;
+    static const uint8_t hev_thresh_lut[2][64] = {
+        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+          2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+          3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+          3, 3, 3, 3 },
+        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+          1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+          2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+          2, 2, 2, 2 }
+    };
 
     if (!filter_level)
         return;
 
-    mbedge_lim = 2*(filter_level+2) + inner_limit;
-     bedge_lim = 2* filter_level    + inner_limit;
-    hev_thresh = filter_level >= 15;
+     bedge_lim = 2*filter_level + inner_limit;
+    mbedge_lim = bedge_lim + 4;
 
-    if (s->keyframe) {
-        if (filter_level >= 40)
-            hev_thresh = 2;
-    } else {
-        if (filter_level >= 40)
-            hev_thresh = 3;
-        else if (filter_level >= 20)
-            hev_thresh = 2;
-    }
+    hev_thresh = hev_thresh_lut[s->keyframe][filter_level];
 
     if (mb_x) {
         s->vp8dsp.vp8_h_loop_filter16y(dst[0],     linesize,
@@ -1549,8 +1407,8 @@ static av_always_inline void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8Fi
     if (!filter_level)
         return;
 
-    mbedge_lim = 2*(filter_level+2) + inner_limit;
-     bedge_lim = 2* filter_level    + inner_limit;
+     bedge_lim = 2*filter_level + inner_limit;
+    mbedge_lim = bedge_lim + 4;
 
     if (mb_x)
         s->vp8dsp.vp8_h_loop_filter_simple(dst, linesize, mbedge_lim);
@@ -1672,6 +1530,10 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     if (s->keyframe)
         memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4);
 
+    #define MARGIN (16 << 2)
+    s->mv_min.y = -MARGIN;
+    s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
+
     for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
         VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)];
         VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2;
@@ -1695,6 +1557,9 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
                 s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129;
         }
 
+        s->mv_min.x = -MARGIN;
+        s->mv_max.x = ((s->mb_width  - 1) << 6) + MARGIN;
+
         for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
             /* Prefetch the current frame, 4 MBs ahead */
             s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4);
@@ -1735,6 +1600,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
             dst[0] += 16;
             dst[1] += 8;
             dst[2] += 8;
+            s->mv_min.x -= 64;
+            s->mv_max.x -= 64;
         }
         if (s->deblock_filter) {
             if (s->filter.simple)
@@ -1742,6 +1609,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
             else
                 filter_mb_row(s, mb_y);
         }
+        s->mv_min.y -= 64;
+        s->mv_max.y -= 64;
     }
 
 skip_decode:
@@ -1802,7 +1671,7 @@ static av_cold int vp8_decode_free(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec vp8_decoder = {
+AVCodec ff_vp8_decoder = {
     "vp8",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VP8,
diff --git a/ffmpeg-mt/libavcodec/vp8.h b/ffmpeg-mt/libavcodec/vp8.h
new file mode 100644
index 0000000..e4a6ef1
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/vp8.h
@@ -0,0 +1,241 @@
+/**
+ * VP8 compatible video decoder
+ *
+ * Copyright (C) 2010 David Conrad
+ * Copyright (C) 2010 Ronald S. Bultje
+ * Copyright (C) 2010 Jason Garrett-Glaser
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VP8_H
+#define AVCODEC_VP8_H
+
+#include "vp56.h"
+#include "vp56data.h"
+#include "vp8dsp.h"
+#include "h264pred.h"
+
+#define VP8_MAX_QUANT 127
+
+enum dct_token {
+    DCT_0,
+    DCT_1,
+    DCT_2,
+    DCT_3,
+    DCT_4,
+    DCT_CAT1,
+    DCT_CAT2,
+    DCT_CAT3,
+    DCT_CAT4,
+    DCT_CAT5,
+    DCT_CAT6,
+    DCT_EOB,
+
+    NUM_DCT_TOKENS
+};
+
+// used to signal 4x4 intra pred in luma MBs
+#define MODE_I4x4 4
+
+enum inter_mvmode {
+    VP8_MVMODE_ZERO = MODE_I4x4 + 1,
+    VP8_MVMODE_MV,
+    VP8_MVMODE_SPLIT
+};
+
+enum inter_splitmvmode {
+    VP8_SPLITMVMODE_16x8 = 0,    ///< 2 16x8 blocks (vertical)
+    VP8_SPLITMVMODE_8x16,        ///< 2 8x16 blocks (horizontal)
+    VP8_SPLITMVMODE_8x8,         ///< 2x2 blocks of 8x8px each
+    VP8_SPLITMVMODE_4x4,         ///< 4x4 blocks of 4x4px each
+    VP8_SPLITMVMODE_NONE,        ///< (only used in prediction) no split MVs
+};
+
+typedef struct {
+    uint8_t filter_level;
+    uint8_t inner_limit;
+    uint8_t inner_filter;
+} VP8FilterStrength;
+
+typedef struct {
+    uint8_t skip;
+    // todo: make it possible to check for at least (i4x4 or split_mv)
+    // in one op. are others needed?
+    uint8_t mode;
+    uint8_t ref_frame;
+    uint8_t partitioning;
+    VP56mv mv;
+    VP56mv bmv[16];
+} VP8Macroblock;
+
+typedef struct {
+    AVCodecContext *avctx;
+    AVFrame *framep[4];
+    uint8_t *edge_emu_buffer;
+
+    uint16_t mb_width;   /* number of horizontal MB */
+    uint16_t mb_height;  /* number of vertical MB */
+    int linesize;
+    int uvlinesize;
+
+    uint8_t keyframe;
+    uint8_t deblock_filter;
+    uint8_t mbskip_enabled;
+    uint8_t segment;             ///< segment of the current macroblock
+    uint8_t chroma_pred_mode;    ///< 8x8c pred mode of the current macroblock
+    uint8_t profile;
+    VP56mv mv_min;
+    VP56mv mv_max;
+
+    int8_t sign_bias[4]; ///< one state [0, 1] per ref frame type
+    int ref_count[3];
+
+    /**
+     * Base parameters for segmentation, i.e. per-macroblock parameters.
+     * These must be kept unchanged even if segmentation is not used for
+     * a frame, since the values persist between interframes.
+     */
+    struct {
+        uint8_t enabled;
+        uint8_t absolute_vals;
+        uint8_t update_map;
+        int8_t base_quant[4];
+        int8_t filter_level[4];     ///< base loop filter level
+    } segmentation;
+
+    struct {
+        uint8_t simple;
+        uint8_t level;
+        uint8_t sharpness;
+    } filter;
+
+    VP8Macroblock *macroblocks;
+    VP8FilterStrength *filter_strength;
+
+    uint8_t *intra4x4_pred_mode_top;
+    uint8_t intra4x4_pred_mode_left[4];
+    uint8_t *segmentation_map;
+
+    /**
+     * Macroblocks can have one of 4 different quants in a frame when
+     * segmentation is enabled.
+     * If segmentation is disabled, only the first segment's values are used.
+     */
+    struct {
+        // [0] - DC qmul  [1] - AC qmul
+        int16_t luma_qmul[2];
+        int16_t luma_dc_qmul[2];    ///< luma dc-only block quant
+        int16_t chroma_qmul[2];
+    } qmat[4];
+
+    struct {
+        uint8_t enabled;    ///< whether each mb can have a different strength based on mode/ref
+
+        /**
+         * filter strength adjustment for the following macroblock modes:
+         * [0-3] - i16x16 (always zero)
+         * [4]   - i4x4
+         * [5]   - zero mv
+         * [6]   - inter modes except for zero or split mv
+         * [7]   - split mv
+         *  i16x16 modes never have any adjustment
+         */
+        int8_t mode[VP8_MVMODE_SPLIT+1];
+
+        /**
+         * filter strength adjustment for macroblocks that reference:
+         * [0] - intra / VP56_FRAME_CURRENT
+         * [1] - VP56_FRAME_PREVIOUS
+         * [2] - VP56_FRAME_GOLDEN
+         * [3] - altref / VP56_FRAME_GOLDEN2
+         */
+        int8_t ref[4];
+    } lf_delta;
+
+    /**
+     * Cache of the top row needed for intra prediction
+     * 16 for luma, 8 for each chroma plane
+     */
+    uint8_t (*top_border)[16+8+8];
+
+    /**
+     * For coeff decode, we need to know whether the above block had non-zero
+     * coefficients. This means for each macroblock, we need data for 4 luma
+     * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
+     * per macroblock. We keep the last row in top_nnz.
+     */
+    uint8_t (*top_nnz)[9];
+    DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
+
+    /**
+     * This is the index plus one of the last non-zero coeff
+     * for each of the blocks in the current macroblock.
+     * So, 0 -> no coeffs
+     *     1 -> dc-only (special transform)
+     *     2+-> full transform
+     */
+    DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
+    VP56RangeCoder c;   ///< header context, includes mb modes and motion vectors
+    DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
+    DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
+    uint8_t intra4x4_pred_mode_mb[16];
+
+    /**
+     * These are all of the updatable probabilities for binary decisions.
+     * They are only implictly reset on keyframes, making it quite likely
+     * for an interframe to desync if a prior frame's header was corrupt
+     * or missing outright!
+     */
+    struct {
+        uint8_t segmentid[3];
+        uint8_t mbskip;
+        uint8_t intra;
+        uint8_t last;
+        uint8_t golden;
+        uint8_t pred16x16[4];
+        uint8_t pred8x8c[3];
+        uint8_t token[4][16][3][NUM_DCT_TOKENS-1];
+        uint8_t mvc[2][19];
+    } prob[2];
+
+    VP8Macroblock *macroblocks_base;
+    int invisible;
+    int update_last;    ///< update VP56_FRAME_PREVIOUS with the current one
+    int update_golden;  ///< VP56_FRAME_NONE if not updated, or which frame to copy if so
+    int update_altref;
+
+    /**
+     * If this flag is not set, all the probability updates
+     * are discarded after this frame is decoded.
+     */
+    int update_probabilities;
+
+    /**
+     * All coefficients are contained in separate arith coding contexts.
+     * There can be 1, 2, 4, or 8 of these after the header context.
+     */
+    int num_coeff_partitions;
+    VP56RangeCoder coeff_partition[8];
+    DSPContext dsp;
+    VP8DSPContext vp8dsp;
+    H264PredContext hpc;
+    vp8_mc_func put_pixels_tab[3][3][3];
+    AVFrame frames[4];
+} VP8Context;
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/vp8_parser.c b/ffmpeg-mt/libavcodec/vp8_parser.c
index 10e7c3b..0f2dd4e 100644
--- a/ffmpeg-mt/libavcodec/vp8_parser.c
+++ b/ffmpeg-mt/libavcodec/vp8_parser.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2008 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,7 +32,7 @@ static int parse(AVCodecParserContext *s,
     return buf_size;
 }
 
-AVCodecParser vp8_parser = {
+AVCodecParser ff_vp8_parser = {
     { CODEC_ID_VP8 },
     0,
     NULL,
diff --git a/ffmpeg-mt/libavcodec/vp8data.h b/ffmpeg-mt/libavcodec/vp8data.h
index 775472e..6d1c070 100644
--- a/ffmpeg-mt/libavcodec/vp8data.h
+++ b/ffmpeg-mt/libavcodec/vp8data.h
@@ -4,65 +4,29 @@
  * Copyright (C) 2010 David Conrad
  * Copyright (C) 2010 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-// TODO: move these #define and enum to a better header...
-
-#define VP8_MAX_QUANT 127
-
-enum dct_token {
-    DCT_0,
-    DCT_1,
-    DCT_2,
-    DCT_3,
-    DCT_4,
-    DCT_CAT1,
-    DCT_CAT2,
-    DCT_CAT3,
-    DCT_CAT4,
-    DCT_CAT5,
-    DCT_CAT6,
-    DCT_EOB,
-
-    NUM_DCT_TOKENS
-};
+#ifndef AVCODEC_VP8DATA_H
+#define AVCODEC_VP8DATA_H
 
+#include "vp8.h"
 #include "h264pred.h"
 
-// used to signal 4x4 intra pred in luma MBs
-#define MODE_I4x4 4
-
-enum inter_mvmode {
-    VP8_MVMODE_NEAREST = MODE_I4x4 + 1,
-    VP8_MVMODE_NEAR,
-    VP8_MVMODE_ZERO,
-    VP8_MVMODE_NEW,
-    VP8_MVMODE_SPLIT
-};
-
-enum inter_splitmvmode {
-    VP8_SPLITMVMODE_16x8 = 0,    ///< 2 16x8 blocks (vertical)
-    VP8_SPLITMVMODE_8x16,        ///< 2 8x16 blocks (horizontal)
-    VP8_SPLITMVMODE_8x8,         ///< 2x2 blocks of 8x8px each
-    VP8_SPLITMVMODE_4x4,         ///< 4x4 blocks of 4x4px each
-    VP8_SPLITMVMODE_NONE,        ///< (only used in prediction) no split MVs
-};
-
 static const uint8_t vp8_pred4x4_mode[] =
 {
     [DC_PRED8x8]    = DC_PRED,
@@ -315,7 +279,7 @@ static const uint8_t vp8_dct_cat5_prob[] = { 180, 157, 141, 134, 130, 0 };
 static const uint8_t vp8_dct_cat6_prob[] = { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 };
 
 // only used for cat3 and above; cat 1 and 2 are referenced directly
-static const uint8_t * const vp8_dct_cat_prob[] =
+const uint8_t * const ff_vp8_dct_cat_prob[] =
 {
     vp8_dct_cat3_prob,
     vp8_dct_cat4_prob,
@@ -720,3 +684,5 @@ static const uint8_t vp8_mv_default_prob[2][19] = {
       204, 170, 119, 235, 140, 230, 228,
       128, 130, 130,  74, 148, 180, 203, 236, 254, 254 }
 };
+
+#endif
diff --git a/ffmpeg-mt/libavcodec/vp8dsp.c b/ffmpeg-mt/libavcodec/vp8dsp.c
index b8cf0b2..159c070 100644
--- a/ffmpeg-mt/libavcodec/vp8dsp.c
+++ b/ffmpeg-mt/libavcodec/vp8dsp.c
@@ -4,20 +4,20 @@
  * Copyright (C) 2010 David Conrad
  * Copyright (C) 2010 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -331,8 +331,8 @@ PUT_PIXELS(4)
     cm[(F[2]*src[x+0*stride] - F[1]*src[x-1*stride] + \
         F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + 64) >> 7]
 
-#define VP8_EPEL_H(SIZE, FILTER, FILTERNAME) \
-static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
+#define VP8_EPEL_H(SIZE, TAPS) \
+static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
 { \
     const uint8_t *filter = subpel_filters[mx-1]; \
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
@@ -340,13 +340,13 @@ static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dsts
 \
     for (y = 0; y < h; y++) { \
         for (x = 0; x < SIZE; x++) \
-            dst[x] = FILTER(src, filter, 1); \
+            dst[x] = FILTER_ ## TAPS ## TAP(src, filter, 1); \
         dst += dststride; \
         src += srcstride; \
     } \
 }
-#define VP8_EPEL_V(SIZE, FILTER, FILTERNAME) \
-static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
+#define VP8_EPEL_V(SIZE, TAPS) \
+static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
 { \
     const uint8_t *filter = subpel_filters[my-1]; \
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
@@ -354,63 +354,63 @@ static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dsts
 \
     for (y = 0; y < h; y++) { \
         for (x = 0; x < SIZE; x++) \
-            dst[x] = FILTER(src, filter, srcstride); \
+            dst[x] = FILTER_ ## TAPS ## TAP(src, filter, srcstride); \
         dst += dststride; \
         src += srcstride; \
     } \
 }
-#define VP8_EPEL_HV(SIZE, FILTERX, FILTERY, FILTERNAME) \
-static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
+#define VP8_EPEL_HV(SIZE, HTAPS, VTAPS) \
+static void put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
 { \
     const uint8_t *filter = subpel_filters[mx-1]; \
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
     int x, y; \
-    uint8_t tmp_array[(2*SIZE+5)*SIZE]; \
+    uint8_t tmp_array[(2*SIZE+VTAPS-1)*SIZE]; \
     uint8_t *tmp = tmp_array; \
-    src -= 2*srcstride; \
+    src -= (2-(VTAPS==4))*srcstride; \
 \
-    for (y = 0; y < h+5; y++) { \
+    for (y = 0; y < h+VTAPS-1; y++) { \
         for (x = 0; x < SIZE; x++) \
-            tmp[x] = FILTERX(src, filter, 1); \
+            tmp[x] = FILTER_ ## HTAPS ## TAP(src, filter, 1); \
         tmp += SIZE; \
         src += srcstride; \
     } \
 \
-    tmp = tmp_array + 2*SIZE; \
+    tmp = tmp_array + (2-(VTAPS==4))*SIZE; \
     filter = subpel_filters[my-1]; \
 \
     for (y = 0; y < h; y++) { \
         for (x = 0; x < SIZE; x++) \
-            dst[x] = FILTERY(tmp, filter, SIZE); \
+            dst[x] = FILTER_ ## VTAPS ## TAP(tmp, filter, SIZE); \
         dst += dststride; \
         tmp += SIZE; \
     } \
 }
 
-VP8_EPEL_H(16, FILTER_4TAP, h4)
-VP8_EPEL_H(8,  FILTER_4TAP, h4)
-VP8_EPEL_H(4,  FILTER_4TAP, h4)
-VP8_EPEL_H(16, FILTER_6TAP, h6)
-VP8_EPEL_H(8,  FILTER_6TAP, h6)
-VP8_EPEL_H(4,  FILTER_6TAP, h6)
-VP8_EPEL_V(16, FILTER_4TAP, v4)
-VP8_EPEL_V(8,  FILTER_4TAP, v4)
-VP8_EPEL_V(4,  FILTER_4TAP, v4)
-VP8_EPEL_V(16, FILTER_6TAP, v6)
-VP8_EPEL_V(8,  FILTER_6TAP, v6)
-VP8_EPEL_V(4,  FILTER_6TAP, v6)
-VP8_EPEL_HV(16, FILTER_4TAP, FILTER_4TAP, h4v4)
-VP8_EPEL_HV(8,  FILTER_4TAP, FILTER_4TAP, h4v4)
-VP8_EPEL_HV(4,  FILTER_4TAP, FILTER_4TAP, h4v4)
-VP8_EPEL_HV(16, FILTER_4TAP, FILTER_6TAP, h4v6)
-VP8_EPEL_HV(8,  FILTER_4TAP, FILTER_6TAP, h4v6)
-VP8_EPEL_HV(4,  FILTER_4TAP, FILTER_6TAP, h4v6)
-VP8_EPEL_HV(16, FILTER_6TAP, FILTER_4TAP, h6v4)
-VP8_EPEL_HV(8,  FILTER_6TAP, FILTER_4TAP, h6v4)
-VP8_EPEL_HV(4,  FILTER_6TAP, FILTER_4TAP, h6v4)
-VP8_EPEL_HV(16, FILTER_6TAP, FILTER_6TAP, h6v6)
-VP8_EPEL_HV(8,  FILTER_6TAP, FILTER_6TAP, h6v6)
-VP8_EPEL_HV(4,  FILTER_6TAP, FILTER_6TAP, h6v6)
+VP8_EPEL_H(16, 4)
+VP8_EPEL_H(8,  4)
+VP8_EPEL_H(4,  4)
+VP8_EPEL_H(16, 6)
+VP8_EPEL_H(8,  6)
+VP8_EPEL_H(4,  6)
+VP8_EPEL_V(16, 4)
+VP8_EPEL_V(8,  4)
+VP8_EPEL_V(4,  4)
+VP8_EPEL_V(16, 6)
+VP8_EPEL_V(8,  6)
+VP8_EPEL_V(4,  6)
+VP8_EPEL_HV(16, 4, 4)
+VP8_EPEL_HV(8,  4, 4)
+VP8_EPEL_HV(4,  4, 4)
+VP8_EPEL_HV(16, 4, 6)
+VP8_EPEL_HV(8,  4, 6)
+VP8_EPEL_HV(4,  4, 6)
+VP8_EPEL_HV(16, 6, 4)
+VP8_EPEL_HV(8,  6, 4)
+VP8_EPEL_HV(4,  6, 4)
+VP8_EPEL_HV(16, 6, 6)
+VP8_EPEL_HV(8,  6, 6)
+VP8_EPEL_HV(4,  6, 6)
 
 #define VP8_BILINEAR(SIZE) \
 static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \
@@ -523,4 +523,6 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
         ff_vp8dsp_init_x86(dsp);
     if (HAVE_ALTIVEC)
         ff_vp8dsp_init_altivec(dsp);
+    if (ARCH_ARM)
+        ff_vp8dsp_init_arm(dsp);
 }
diff --git a/ffmpeg-mt/libavcodec/vp8dsp.h b/ffmpeg-mt/libavcodec/vp8dsp.h
index ee5c7ec..e2fb8e7 100644
--- a/ffmpeg-mt/libavcodec/vp8dsp.h
+++ b/ffmpeg-mt/libavcodec/vp8dsp.h
@@ -4,20 +4,20 @@
  * Copyright (C) 2010 David Conrad
  * Copyright (C) 2010 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,5 +79,6 @@ void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, int stride, int h, int x,
 void ff_vp8dsp_init(VP8DSPContext *c);
 void ff_vp8dsp_init_x86(VP8DSPContext *c);
 void ff_vp8dsp_init_altivec(VP8DSPContext *c);
+void ff_vp8dsp_init_arm(VP8DSPContext *c);
 
 #endif /* AVCODEC_VP8DSP_H */
diff --git a/ffmpeg-mt/libavcodec/vqavideo.c b/ffmpeg-mt/libavcodec/vqavideo.c
index 97b8b50..40004a0 100644
--- a/ffmpeg-mt/libavcodec/vqavideo.c
+++ b/ffmpeg-mt/libavcodec/vqavideo.c
@@ -2,20 +2,20 @@
  * Westwood Studios VQA Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -68,7 +68,7 @@
 #include <string.h>
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 
 #define PALETTE_COUNT 256
@@ -609,7 +609,7 @@ static av_cold int vqa_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec vqa_decoder = {
+AVCodec ff_vqa_decoder = {
     "vqavideo",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WS_VQA,
diff --git a/ffmpeg-mt/libavcodec/w32thread.c b/ffmpeg-mt/libavcodec/w32thread.c
index 007508e..023be0e 100644
--- a/ffmpeg-mt/libavcodec/w32thread.c
+++ b/ffmpeg-mt/libavcodec/w32thread.c
@@ -1,25 +1,26 @@
 /*
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 //#define DEBUG
 
 #include "avcodec.h"
+#include "thread.h"
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
@@ -69,10 +70,10 @@ static unsigned WINAPI attribute_align_arg thread_func(void *v){
 }
 
 /**
- * Free what has been allocated by avcodec_thread_init().
+ * Free what has been allocated by ff_thread_init().
  * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running.
  */
-void avcodec_thread_free(AVCodecContext *s){
+void ff_thread_free(AVCodecContext *s){
     ThreadContext *c= s->thread_opaque;
     int i;
 
@@ -124,7 +125,7 @@ static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext
     avcodec_thread_execute(s, NULL, arg, ret, count, 0);
 }
 
-int avcodec_thread_init(AVCodecContext *s, int thread_count){
+int ff_thread_init(AVCodecContext *s){
     int i;
     ThreadContext *c;
     uint32_t threadid;
@@ -134,14 +135,13 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){
         return 0;
     }
 
-    s->thread_count= thread_count;
     s->active_thread_type= FF_THREAD_SLICE;
 
-    if (thread_count <= 1)
+    if (s->thread_count <= 1)
         return 0;
 
     assert(!s->thread_opaque);
-    c= av_mallocz(sizeof(ThreadContext)*thread_count);
+    c= av_mallocz(sizeof(ThreadContext)*s->thread_count);
     s->thread_opaque= c;
     if(!(c[0].work_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL)))
         goto fail;
@@ -150,7 +150,7 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){
     if(!(c[0].done_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL)))
         goto fail;
 
-    for(i=0; i<thread_count; i++){
+    for(i=0; i<s->thread_count; i++){
 //printf("init semaphors %d\n", i); fflush(stdout);
         c[i].avctx= s;
         c[i].work_sem = c[0].work_sem;
@@ -169,6 +169,6 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){
 
     return 0;
 fail:
-    avcodec_thread_free(s);
+    ff_thread_free(s);
     return -1;
 }
diff --git a/ffmpeg-mt/libavcodec/wavpack.c b/ffmpeg-mt/libavcodec/wavpack.c
index f78492c..e4fe217 100644
--- a/ffmpeg-mt/libavcodec/wavpack.c
+++ b/ffmpeg-mt/libavcodec/wavpack.c
@@ -1,27 +1,28 @@
 /*
  * WavPack lossless audio decoder
- * Copyright (c) 2006 Konstantin Shishkov
+ * Copyright (c) 2006,2011 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #define ALT_BITSTREAM_READER_LE
 #include "avcodec.h"
 #include "get_bits.h"
 #include "unary.h"
+#include "libavutil/audioconvert.h"
 
 /**
  * @file
@@ -91,7 +92,7 @@ typedef struct WvChannel {
     int bitrate_acc, bitrate_delta;
 } WvChannel;
 
-typedef struct WavpackContext {
+typedef struct WavpackFrameContext {
     AVCodecContext *avctx;
     int frame_flags;
     int stereo, stereo_in;
@@ -118,6 +119,22 @@ typedef struct WavpackContext {
     int max_samples;
     int pos;
     SavedContext sc, extra_sc;
+} WavpackFrameContext;
+
+#define WV_MAX_FRAME_DECODERS 14
+
+typedef struct WavpackContext {
+    AVCodecContext *avctx;
+
+    WavpackFrameContext *fdec[WV_MAX_FRAME_DECODERS];
+    int fdec_num;
+
+    int multichannel;
+    int mkv_mode;
+    int block;
+    int samples;
+    int samples_left;
+    int ch_offset;
 } WavpackContext;
 
 // exponent table copied from WavPack source
@@ -224,7 +241,7 @@ static av_always_inline int get_tail(GetBitContext *gb, int k)
     return res;
 }
 
-static void update_error_limit(WavpackContext *ctx)
+static void update_error_limit(WavpackFrameContext *ctx)
 {
     int i, br[2], sl[2];
 
@@ -258,7 +275,7 @@ static void update_error_limit(WavpackContext *ctx)
     }
 }
 
-static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int channel, int *last)
+static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel, int *last)
 {
     int t, t2;
     int sign, base, add, ret;
@@ -361,7 +378,7 @@ static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int channel, int
     return sign ? ~ret : ret;
 }
 
-static inline int wv_get_value_integer(WavpackContext *s, uint32_t *crc, int S)
+static inline int wv_get_value_integer(WavpackFrameContext *s, uint32_t *crc, int S)
 {
     int bit;
 
@@ -377,7 +394,7 @@ static inline int wv_get_value_integer(WavpackContext *s, uint32_t *crc, int S)
     return (((S + bit) << s->shift) - bit) << s->post_shift;
 }
 
-static float wv_get_value_float(WavpackContext *s, uint32_t *crc, int S)
+static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
 {
     union {
         float    f;
@@ -450,13 +467,13 @@ static float wv_get_value_float(WavpackContext *s, uint32_t *crc, int S)
     return value.f;
 }
 
-static void wv_reset_saved_context(WavpackContext *s)
+static void wv_reset_saved_context(WavpackFrameContext *s)
 {
     s->pos = 0;
     s->sc.crc = s->extra_sc.crc = 0xFFFFFFFF;
 }
 
-static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *dst, const int type)
+static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type)
 {
     int i, j, count = 0;
     int last, t;
@@ -467,6 +484,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
     int16_t *dst16 = dst;
     int32_t *dst32 = dst;
     float   *dstfl = dst;
+    const int channel_pad = s->avctx->channels - 2;
 
     if(s->samples_left == s->samples)
         s->one = s->zero = s->zeroes = 0;
@@ -549,12 +567,15 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
         if(type == AV_SAMPLE_FMT_FLT){
             *dstfl++ = wv_get_value_float(s, &crc_extra_bits, L);
             *dstfl++ = wv_get_value_float(s, &crc_extra_bits, R);
+            dstfl += channel_pad;
         } else if(type == AV_SAMPLE_FMT_S32){
             *dst32++ = wv_get_value_integer(s, &crc_extra_bits, L);
             *dst32++ = wv_get_value_integer(s, &crc_extra_bits, R);
+            dst32 += channel_pad;
         } else {
             *dst16++ = wv_get_value_integer(s, &crc_extra_bits, L);
             *dst16++ = wv_get_value_integer(s, &crc_extra_bits, R);
+            dst16 += channel_pad;
         }
         count++;
     }while(!last && count < s->max_samples);
@@ -582,7 +603,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
     return count * 2;
 }
 
-static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst, const int type)
+static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type)
 {
     int i, j, count = 0;
     int last, t;
@@ -593,6 +614,7 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst
     int16_t *dst16 = dst;
     int32_t *dst32 = dst;
     float   *dstfl = dst;
+    const int channel_stride = s->avctx->channels;
 
     if(s->samples_left == s->samples)
         s->one = s->zero = s->zeroes = 0;
@@ -623,12 +645,16 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst
         pos = (pos + 1) & 7;
         crc = crc * 3 + S;
 
-        if(type == AV_SAMPLE_FMT_FLT)
-            *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S);
-        else if(type == AV_SAMPLE_FMT_S32)
-            *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S);
-        else
-            *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S);
+        if(type == AV_SAMPLE_FMT_FLT){
+            *dstfl = wv_get_value_float(s, &crc_extra_bits, S);
+            dstfl += channel_stride;
+        }else if(type == AV_SAMPLE_FMT_S32){
+            *dst32 = wv_get_value_integer(s, &crc_extra_bits, S);
+            dst32 += channel_stride;
+        }else{
+            *dst16 = wv_get_value_integer(s, &crc_extra_bits, S);
+            dst16 += channel_stride;
+        }
         count++;
     }while(!last && count < s->max_samples);
 
@@ -655,47 +681,92 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst
     return count;
 }
 
+static av_cold int wv_alloc_frame_context(WavpackContext *c)
+{
+
+    if(c->fdec_num == WV_MAX_FRAME_DECODERS)
+        return -1;
+
+    c->fdec[c->fdec_num] = av_mallocz(sizeof(**c->fdec));
+    if(!c->fdec[c->fdec_num])
+        return -1;
+    c->fdec_num++;
+    c->fdec[c->fdec_num - 1]->avctx = c->avctx;
+    wv_reset_saved_context(c->fdec[c->fdec_num - 1]);
+
+    return 0;
+}
+
 static av_cold int wavpack_decode_init(AVCodecContext *avctx)
 {
     WavpackContext *s = avctx->priv_data;
 
     s->avctx = avctx;
-    if (avctx->channels > 2) {
-        av_log(avctx, AV_LOG_ERROR, "Multichannel WavPack is not supported yet.\n");
-        return -1;
-    }
-    s->stereo = (avctx->channels == 2);
     if(avctx->bits_per_coded_sample <= 16)
         avctx->sample_fmt = AV_SAMPLE_FMT_S16;
     else
         avctx->sample_fmt = AV_SAMPLE_FMT_S32;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
+    if(avctx->channels <= 2 && !avctx->channel_layout)
+        avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
+
+    s->multichannel = avctx->channels > 2;
+    /* lavf demuxer does not provide extradata, Matroska stores 0x403
+       there, use this to detect decoding mode for multichannel */
+    s->mkv_mode = 0;
+    if(s->multichannel && avctx->extradata && avctx->extradata_size == 2){
+        int ver = AV_RL16(avctx->extradata);
+        if(ver >= 0x402 && ver <= 0x410)
+            s->mkv_mode = 1;
+    }
 
-    wv_reset_saved_context(s);
+    s->fdec_num = 0;
 
     return 0;
 }
 
-static int wavpack_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
+static av_cold int wavpack_decode_end(AVCodecContext *avctx)
 {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
     WavpackContext *s = avctx->priv_data;
+    int i;
+
+    for(i = 0; i < s->fdec_num; i++)
+        av_freep(&s->fdec[i]);
+    s->fdec_num = 0;
+
+    return 0;
+}
+
+static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
+                                void *data, int *data_size,
+                                const uint8_t *buf, int buf_size)
+{
+    WavpackContext *wc = avctx->priv_data;
+    WavpackFrameContext *s;
     void *samples = data;
     int samplecount;
     int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0, got_float = 0;
     int got_hybrid = 0;
+    const uint8_t* orig_buf = buf;
     const uint8_t* buf_end = buf + buf_size;
     int i, j, id, size, ssize, weights, t;
-    int bpp;
+    int bpp, chan, chmask;
 
     if (buf_size == 0){
         *data_size = 0;
         return 0;
     }
 
+    if(block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){
+        av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n");
+        return -1;
+    }
+
+    s = wc->fdec[block_no];
+    if(!s){
+        av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n", block_no);
+        return -1;
+    }
+
     if(!s->samples_left){
         memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
         memset(s->ch, 0, sizeof(s->ch));
@@ -704,10 +775,14 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
         s->got_extra_bits = 0;
     }
 
-    s->samples = AV_RL32(buf); buf += 4;
-    if(!s->samples){
-        *data_size = 0;
-        return buf_size;
+    if(!wc->mkv_mode){
+        s->samples = AV_RL32(buf); buf += 4;
+        if(!s->samples){
+            *data_size = 0;
+            return buf_size;
+        }
+    }else{
+        s->samples = wc->samples;
     }
     s->frame_flags = AV_RL32(buf); buf += 4;
     if(s->frame_flags&0x80){
@@ -720,12 +795,19 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
         bpp = 4;
         avctx->sample_fmt = AV_SAMPLE_FMT_S32;
     }
+    samples = (uint8_t*)samples + bpp * wc->ch_offset;
+
+    s->stereo = !(s->frame_flags & WV_MONO);
     s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo;
     s->joint = s->frame_flags & WV_JOINT_STEREO;
     s->hybrid = s->frame_flags & WV_HYBRID_MODE;
     s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE;
     s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f);
     s->CRC = AV_RL32(buf); buf += 4;
+    if(wc->mkv_mode)
+        buf += 4; //skip block size;
+
+    wc->ch_offset += 1 + s->stereo;
 
     s->max_samples = *data_size / (bpp * avctx->channels);
     s->max_samples = FFMIN(s->max_samples, s->samples);
@@ -899,7 +981,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
             got_float = 1;
             break;
         case WP_ID_DATA:
-            s->sc.offset = buf - avpkt->data;
+            s->sc.offset = buf - orig_buf;
             s->sc.size   = size * 8;
             init_get_bits(&s->gb, buf, size * 8);
             s->data_size = size * 8;
@@ -912,13 +994,50 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
                 buf += size;
                 continue;
             }
-            s->extra_sc.offset = buf - avpkt->data;
+            s->extra_sc.offset = buf - orig_buf;
             s->extra_sc.size   = size * 8;
             init_get_bits(&s->gb_extra_bits, buf, size * 8);
             s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32);
             buf += size;
             s->got_extra_bits = 1;
             break;
+        case WP_ID_CHANINFO:
+            if(size <= 1){
+                av_log(avctx, AV_LOG_ERROR, "Insufficient channel information\n");
+                return -1;
+            }
+            chan = *buf++;
+            switch(size - 2){
+            case 0:
+                chmask = *buf;
+                break;
+            case 1:
+                chmask = AV_RL16(buf);
+                break;
+            case 2:
+                chmask = AV_RL24(buf);
+                break;
+            case 3:
+                chmask = AV_RL32(buf);
+                break;
+            case 5:
+                chan |= (buf[1] & 0xF) << 8;
+                chmask = AV_RL24(buf + 2);
+                break;
+            default:
+                av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size);
+                chan = avctx->channels;
+                chmask = avctx->channel_layout;
+            }
+            if(chan != avctx->channels){
+                av_log(avctx, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n",
+                       chan, avctx->channels);
+                return -1;
+            }
+            if(!avctx->channel_layout)
+                avctx->channel_layout = chmask;
+            buf += size - 1;
+            break;
         default:
             buf += size;
         }
@@ -963,10 +1082,10 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
         }
         s->samples_left = s->samples;
     }else{
-        init_get_bits(&s->gb, avpkt->data + s->sc.offset, s->sc.size);
+        init_get_bits(&s->gb, orig_buf + s->sc.offset, s->sc.size);
         skip_bits_long(&s->gb, s->sc.bits_used);
         if(s->got_extra_bits){
-            init_get_bits(&s->gb_extra_bits, avpkt->data + s->extra_sc.offset,
+            init_get_bits(&s->gb_extra_bits, orig_buf + s->extra_sc.offset,
                           s->extra_sc.size);
             skip_bits_long(&s->gb_extra_bits, s->extra_sc.bits_used);
         }
@@ -979,8 +1098,10 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
             samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32);
         else
             samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
-
+        samplecount >>= 1;
     }else{
+        const int channel_stride = avctx->channels;
+
         if(avctx->sample_fmt == AV_SAMPLE_FMT_S16)
             samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16);
         else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32)
@@ -989,47 +1110,93 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
             samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
 
         if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){
-            int16_t *dst = (int16_t*)samples + samplecount * 2;
-            int16_t *src = (int16_t*)samples + samplecount;
+            int16_t *dst = (int16_t*)samples + 1;
+            int16_t *src = (int16_t*)samples;
             int cnt = samplecount;
             while(cnt--){
-                *--dst = *--src;
-                *--dst = *src;
+                *dst = *src;
+                src += channel_stride;
+                dst += channel_stride;
             }
-            samplecount *= 2;
         }else if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S32){
-            int32_t *dst = (int32_t*)samples + samplecount * 2;
-            int32_t *src = (int32_t*)samples + samplecount;
+            int32_t *dst = (int32_t*)samples + 1;
+            int32_t *src = (int32_t*)samples;
             int cnt = samplecount;
             while(cnt--){
-                *--dst = *--src;
-                *--dst = *src;
+                *dst = *src;
+                src += channel_stride;
+                dst += channel_stride;
             }
-            samplecount *= 2;
         }else if(s->stereo){
-            float *dst = (float*)samples + samplecount * 2;
-            float *src = (float*)samples + samplecount;
+            float *dst = (float*)samples + 1;
+            float *src = (float*)samples;
             int cnt = samplecount;
             while(cnt--){
-                *--dst = *--src;
-                *--dst = *src;
+                *dst = *src;
+                src += channel_stride;
+                dst += channel_stride;
+            }
+        }
+    }
+
+    wc->samples_left = s->samples_left;
+
+    return samplecount * bpp;
+}
+
+static int wavpack_decode_frame(AVCodecContext *avctx,
+                            void *data, int *data_size,
+                            AVPacket *avpkt)
+{
+    WavpackContext *s = avctx->priv_data;
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
+    int frame_size;
+    int samplecount = 0;
+
+    s->block = 0;
+    s->samples_left = 0;
+    s->ch_offset = 0;
+
+    if(s->mkv_mode){
+        s->samples = AV_RL32(buf); buf += 4;
+    }
+    while(buf_size > 0){
+        if(!s->multichannel){
+            frame_size = buf_size;
+        }else{
+            if(!s->mkv_mode){
+                frame_size = AV_RL32(buf) - 12; buf += 4; buf_size -= 4;
+            }else{
+                if(buf_size < 12) //MKV files can have zero flags after last block
+                    break;
+                frame_size = AV_RL32(buf + 8) + 12;
             }
-            samplecount *= 2;
         }
+        if(frame_size < 0 || frame_size > buf_size){
+            av_log(avctx, AV_LOG_ERROR, "Block %d has invalid size (size %d vs. %d bytes left)\n",
+                   s->block, frame_size, buf_size);
+            return -1;
+        }
+        if((samplecount = wavpack_decode_block(avctx, s->block, data,
+                                               data_size, buf, frame_size)) < 0)
+            return -1;
+        s->block++;
+        buf += frame_size; buf_size -= frame_size;
     }
-    *data_size = samplecount * bpp;
+    *data_size = samplecount * avctx->channels;
 
-    return s->samples_left > 0 ? 0 : buf_size;
+    return s->samples_left > 0 ? 0 : avpkt->size;
 }
 
-AVCodec wavpack_decoder = {
+AVCodec ff_wavpack_decoder = {
     "wavpack",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_WAVPACK,
     sizeof(WavpackContext),
     wavpack_decode_init,
     NULL,
-    NULL,
+    wavpack_decode_end,
     wavpack_decode_frame,
     .capabilities = CODEC_CAP_SUBFRAMES,
     .long_name = NULL_IF_CONFIG_SMALL("WavPack"),
diff --git a/ffmpeg-mt/libavcodec/wma.c b/ffmpeg-mt/libavcodec/wma.c
index e2d153b..bed47ec 100644
--- a/ffmpeg-mt/libavcodec/wma.c
+++ b/ffmpeg-mt/libavcodec/wma.c
@@ -1,25 +1,26 @@
 /*
  * WMA compatible codec
- * Copyright (c) 2002-2007 The FFmpeg Project
+ * Copyright (c) 2002-2007 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avcodec.h"
+#include "sinewin.h"
 #include "wma.h"
 #include "wmadata.h"
 
@@ -126,6 +127,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
     s->block_align = avctx->block_align;
 
     dsputil_init(&s->dsp, avctx);
+    ff_fmt_convert_init(&s->fmt_conv, avctx);
 
     if (avctx->codec->id == CODEC_ID_WMAV1) {
         s->version = 1;
@@ -217,13 +219,13 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
             high_freq = high_freq * 0.5;
         }
     }
-    dprintf(s->avctx, "flags2=0x%x\n", flags2);
-    dprintf(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
+    av_dlog(s->avctx, "flags2=0x%x\n", flags2);
+    av_dlog(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
             s->version, s->nb_channels, s->sample_rate, s->bit_rate,
             s->block_align);
-    dprintf(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
+    av_dlog(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
             bps, bps1, high_freq, s->byte_offset_bits);
-    dprintf(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
+    av_dlog(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
             s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes);
 
     /* compute the scale factor band sizes for each MDCT block size */
diff --git a/ffmpeg-mt/libavcodec/wma.h b/ffmpeg-mt/libavcodec/wma.h
index 11274ad..d12c55c 100644
--- a/ffmpeg-mt/libavcodec/wma.h
+++ b/ffmpeg-mt/libavcodec/wma.h
@@ -1,21 +1,21 @@
 /*
  * WMA compatible codec
- * Copyright (c) 2002-2007 The FFmpeg Project
+ * Copyright (c) 2002-2007 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,6 +26,7 @@
 #include "put_bits.h"
 #include "dsputil.h"
 #include "fft.h"
+#include "fmtconvert.h"
 
 /* size of blocks */
 #define BLOCK_MIN_BITS 7
@@ -134,6 +135,7 @@ typedef struct WMACodecContext {
     float lsp_pow_m_table1[(1 << LSP_POW_BITS)];
     float lsp_pow_m_table2[(1 << LSP_POW_BITS)];
     DSPContext dsp;
+    FmtConvertContext fmt_conv;
 
 #ifdef TRACE
     int frame_count;
diff --git a/ffmpeg-mt/libavcodec/wmadata.h b/ffmpeg-mt/libavcodec/wmadata.h
index 381f182..07a1afe 100644
--- a/ffmpeg-mt/libavcodec/wmadata.h
+++ b/ffmpeg-mt/libavcodec/wmadata.h
@@ -1,21 +1,21 @@
 /*
  * WMA compatible decoder
- * copyright (c) 2002 The FFmpeg Project
+ * copyright (c) 2002 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/wmadec.c b/ffmpeg-mt/libavcodec/wmadec.c
index 694b15d..f6ed26c 100644
--- a/ffmpeg-mt/libavcodec/wmadec.c
+++ b/ffmpeg-mt/libavcodec/wmadec.c
@@ -1,21 +1,21 @@
 /*
  * WMA compatible decoder
- * Copyright (c) 2002 The FFmpeg Project
+ * Copyright (c) 2002 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -447,6 +447,7 @@ static int wma_decode_block(WMACodecContext *s)
     int coef_nb_bits, total_gain;
     int nb_coefs[MAX_CHANNELS];
     float mdct_norm;
+    FFTContext *mdct;
 
 #ifdef TRACE
     tprintf(s->avctx, "***decode_block: %d:%d\n", s->frame_count - 1, s->block_num);
@@ -742,12 +743,14 @@ static int wma_decode_block(WMACodecContext *s)
     }
 
 next:
+    mdct = &s->mdct_ctx[bsize];
+
     for(ch = 0; ch < s->nb_channels; ch++) {
         int n4, index;
 
         n4 = s->block_len / 2;
         if(s->channel_coded[ch]){
-            ff_imdct_calc(&s->mdct_ctx[bsize], s->output, s->coefs[ch]);
+            mdct->imdct_calc(mdct, s->output, s->coefs[ch]);
         }else if(!(s->ms_stereo && ch==1))
             memset(s->output, 0, sizeof(s->output));
 
@@ -768,9 +771,8 @@ next:
 /* decode a frame of frame_len samples */
 static int wma_decode_frame(WMACodecContext *s, int16_t *samples)
 {
-    int ret, i, n, ch, incr;
-    int16_t *ptr;
-    float *iptr;
+    int ret, n, ch, incr;
+    const float *output[MAX_CHANNELS];
 
 #ifdef TRACE
     tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len);
@@ -790,28 +792,12 @@ static int wma_decode_frame(WMACodecContext *s, int16_t *samples)
     /* convert frame to integer */
     n = s->frame_len;
     incr = s->nb_channels;
-    if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        for(ch = 0; ch < s->nb_channels; ch++) {
-            ptr = samples + ch;
-            iptr = s->frame_out[ch];
-
-            for(i=0;i<n;i++) {
-                *ptr = av_clip_int16(lrintf(*iptr++));
-                ptr += incr;
-            }
-            /* prepare for next block */
-            memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len],
-                    s->frame_len * sizeof(float));
-        }
-    } else {
-        const float *output[MAX_CHANNELS];
-        for (ch = 0; ch < MAX_CHANNELS; ch++)
-            output[ch] = s->frame_out[ch];
-        s->dsp.float_to_int16_interleave(samples, output, n, incr);
-        for(ch = 0; ch < incr; ch++) {
-            /* prepare for next block */
-            memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float));
-        }
+    for (ch = 0; ch < MAX_CHANNELS; ch++)
+        output[ch] = s->frame_out[ch];
+    s->fmt_conv.float_to_int16_interleave(samples, output, n, incr);
+    for (ch = 0; ch < incr; ch++) {
+        /* prepare for next block */
+        memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float));
     }
 
 #ifdef TRACE
@@ -939,7 +925,7 @@ static av_cold void flush(AVCodecContext *avctx)
     s->last_superframe_len= 0;
 }
 
-AVCodec wmav1_decoder =
+AVCodec ff_wmav1_decoder =
 {
     "wmav1",
     AVMEDIA_TYPE_AUDIO,
@@ -953,7 +939,7 @@ AVCodec wmav1_decoder =
     .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
 };
 
-AVCodec wmav2_decoder =
+AVCodec ff_wmav2_decoder =
 {
     "wmav2",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/wmaenc.c b/ffmpeg-mt/libavcodec/wmaenc.c
index f96aa3a..d2e811f 100644
--- a/ffmpeg-mt/libavcodec/wmaenc.c
+++ b/ffmpeg-mt/libavcodec/wmaenc.c
@@ -2,20 +2,20 @@
  * WMA compatible encoder
  * Copyright (c) 2007 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -77,6 +77,7 @@ static int encode_init(AVCodecContext * avctx){
 static void apply_window_and_mdct(AVCodecContext * avctx, const signed short * audio, int len) {
     WMACodecContext *s = avctx->priv_data;
     int window_index= s->frame_len_bits - s->block_len_bits;
+    FFTContext *mdct = &s->mdct_ctx[window_index];
     int i, j, channel;
     const float * win = s->windows[window_index];
     int window_len = 1 << s->block_len_bits;
@@ -89,7 +90,7 @@ static void apply_window_and_mdct(AVCodecContext * avctx, const signed short * a
             s->output[i+window_len]  = audio[j] / n * win[window_len - i - 1];
             s->frame_out[channel][i] = audio[j] / n * win[i];
         }
-        ff_mdct_calc(&s->mdct_ctx[window_index], s->coefs[channel], s->output);
+        mdct->mdct_calc(mdct, s->coefs[channel], s->output);
     }
 }
 
@@ -383,7 +384,7 @@ static int encode_superframe(AVCodecContext *avctx,
     return put_bits_ptr(&s->pb) - s->pb.buf;
 }
 
-AVCodec wmav1_encoder =
+AVCodec ff_wmav1_encoder =
 {
     "wmav1",
     AVMEDIA_TYPE_AUDIO,
@@ -396,7 +397,7 @@ AVCodec wmav1_encoder =
     .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
 };
 
-AVCodec wmav2_encoder =
+AVCodec ff_wmav2_encoder =
 {
     "wmav2",
     AVMEDIA_TYPE_AUDIO,
diff --git a/ffmpeg-mt/libavcodec/wmaprodata.h b/ffmpeg-mt/libavcodec/wmaprodata.h
index 5382479..f8a52bf 100644
--- a/ffmpeg-mt/libavcodec/wmaprodata.h
+++ b/ffmpeg-mt/libavcodec/wmaprodata.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
  * Copyright (c) 2008 - 2009 Sascha Sommer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/wmaprodec.c b/ffmpeg-mt/libavcodec/wmaprodec.c
index 5941781..c9048a9 100644
--- a/ffmpeg-mt/libavcodec/wmaprodec.c
+++ b/ffmpeg-mt/libavcodec/wmaprodec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
  * Copyright (c) 2008 - 2011 Sascha Sommer, Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -92,6 +92,7 @@
 #include "put_bits.h"
 #include "wmaprodata.h"
 #include "dsputil.h"
+#include "sinewin.h"
 #include "wma.h"
 
 /** current decoder limitations */
@@ -288,8 +289,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
         s->bits_per_sample = AV_RL16(edata_ptr);
         /** dump the extradata */
         for (i = 0; i < avctx->extradata_size; i++)
-            dprintf(avctx, "[%x] ", avctx->extradata[i]);
-        dprintf(avctx, "\n");
+            av_dlog(avctx, "[%x] ", avctx->extradata[i]);
+        av_dlog(avctx, "\n");
 
     } else {
         av_log_ask_for_sample(avctx, "Unknown extradata size\n");
@@ -582,7 +583,7 @@ static int decode_tilehdr(WMAProDecodeCtx *s)
         int i;
         int offset = 0;
         for (i = 0; i < s->channel[c].num_subframes; i++) {
-            dprintf(s->avctx, "frame[%i] channel[%i] subframe[%i]"
+            av_dlog(s->avctx, "frame[%i] channel[%i] subframe[%i]"
                     " len %i\n", s->frame_num, c, i,
                     s->channel[c].subframe_len[i]);
             s->channel[c].subframe_offset[i] = offset;
@@ -781,7 +782,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c)
     const uint16_t* run;
     const float* level;
 
-    dprintf(s->avctx, "decode coefficients for channel %i\n", c);
+    av_dlog(s->avctx, "decode coefficients for channel %i\n", c);
 
     vlctable = get_bits1(&s->gb);
     vlc = &coef_vlc[vlctable];
@@ -1031,7 +1032,7 @@ static void wmapro_window(WMAProDecodeCtx *s)
         winlen >>= 1;
 
         s->dsp.vector_fmul_window(start, start, start + winlen,
-                                  window, 0, winlen);
+                                  window, winlen);
 
         s->channel[c].prev_block_len = s->subframe_len;
     }
@@ -1066,7 +1067,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
         }
     }
 
-    dprintf(s->avctx,
+    av_dlog(s->avctx,
             "processing subframe with offset %i len %i\n", offset, subframe_len);
 
     /** get a list of all channels that contain the estimated block */
@@ -1093,7 +1094,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
         s->parsed_all_subframes = 1;
 
 
-    dprintf(s->avctx, "subframe is part of %i channels\n",
+    av_dlog(s->avctx, "subframe is part of %i channels\n",
             s->channels_for_cur_subframe);
 
     /** calculate number of scale factor bands and their offsets */
@@ -1204,7 +1205,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
             return AVERROR_INVALIDDATA;
     }
 
-    dprintf(s->avctx, "BITSTREAM: subframe header length was %i\n",
+    av_dlog(s->avctx, "BITSTREAM: subframe header length was %i\n",
             get_bits_count(&s->gb) - s->subframe_offset);
 
     /** parse coefficients */
@@ -1218,10 +1219,11 @@ static int decode_subframe(WMAProDecodeCtx *s)
                    sizeof(*s->channel[c].coeffs) * subframe_len);
     }
 
-    dprintf(s->avctx, "BITSTREAM: subframe length was %i\n",
+    av_dlog(s->avctx, "BITSTREAM: subframe length was %i\n",
             get_bits_count(&s->gb) - s->subframe_offset);
 
     if (transmit_coeffs) {
+        FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS];
         /** reconstruct the per channel data */
         inverse_channel_transform(s);
         for (i = 0; i < s->channels_for_cur_subframe; i++) {
@@ -1246,9 +1248,8 @@ static int decode_subframe(WMAProDecodeCtx *s)
                                           quant, end - start);
             }
 
-            /** apply imdct (ff_imdct_half == DCTIV with reverse) */
-            ff_imdct_half(&s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS],
-                          s->channel[c].coeffs, s->tmp);
+            /** apply imdct (imdct_half == DCTIV with reverse) */
+            mdct->imdct_half(mdct, s->channel[c].coeffs, s->tmp);
         }
     }
 
@@ -1294,7 +1295,7 @@ static int decode_frame(WMAProDecodeCtx *s)
     if (s->len_prefix)
         len = get_bits(gb, s->log2_frame_size);
 
-    dprintf(s->avctx, "decoding frame with length %x\n", len);
+    av_dlog(s->avctx, "decoding frame with length %x\n", len);
 
     /** decode tile information */
     if (decode_tilehdr(s)) {
@@ -1313,7 +1314,7 @@ static int decode_frame(WMAProDecodeCtx *s)
     /** read drc info */
     if (s->dynamic_range_compression) {
         s->drc_gain = get_bits(gb, 8);
-        dprintf(s->avctx, "drc_gain %i\n", s->drc_gain);
+        av_dlog(s->avctx, "drc_gain %i\n", s->drc_gain);
     }
 
     /** no idea what these are for, might be the number of samples
@@ -1324,18 +1325,18 @@ static int decode_frame(WMAProDecodeCtx *s)
         /** usually true for the first frame */
         if (get_bits1(gb)) {
             skip = get_bits(gb, av_log2(s->samples_per_frame * 2));
-            dprintf(s->avctx, "start skip: %i\n", skip);
+            av_dlog(s->avctx, "start skip: %i\n", skip);
         }
 
         /** sometimes true for the last frame */
         if (get_bits1(gb)) {
             skip = get_bits(gb, av_log2(s->samples_per_frame * 2));
-            dprintf(s->avctx, "end skip: %i\n", skip);
+            av_dlog(s->avctx, "end skip: %i\n", skip);
         }
 
     }
 
-    dprintf(s->avctx, "BITSTREAM: frame header length was %i\n",
+    av_dlog(s->avctx, "BITSTREAM: frame header length was %i\n",
             get_bits_count(gb) - s->frame_offset);
 
     /** reset subframe states */
@@ -1505,7 +1506,7 @@ static int decode_packet(AVCodecContext *avctx,
 
         /** get number of bits that need to be added to the previous frame */
         num_bits_prev_frame = get_bits(gb, s->log2_frame_size);
-        dprintf(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number,
+        av_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number,
                 num_bits_prev_frame);
 
         /** check for packet loss */
@@ -1527,14 +1528,14 @@ static int decode_packet(AVCodecContext *avctx,
             /** append the previous frame data to the remaining data from the
                 previous packet to create a full frame */
             save_bits(s, gb, num_bits_prev_frame, 1);
-            dprintf(avctx, "accumulated %x bits of frame data\n",
+            av_dlog(avctx, "accumulated %x bits of frame data\n",
                     s->num_saved_bits - s->frame_offset);
 
             /** decode the cross packet frame if it is valid */
             if (!s->packet_loss)
                 decode_frame(s);
         } else if (s->num_saved_bits - s->frame_offset) {
-            dprintf(avctx, "ignoring %x previously saved bits\n",
+            av_dlog(avctx, "ignoring %x previously saved bits\n",
                     s->num_saved_bits - s->frame_offset);
         }
 
@@ -1603,7 +1604,7 @@ static void flush(AVCodecContext *avctx)
 /**
  *@brief wmapro decoder
  */
-AVCodec wmapro_decoder = {
+AVCodec ff_wmapro_decoder = {
     "wmapro",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_WMAPRO,
diff --git a/ffmpeg-mt/libavcodec/wmavoice.c b/ffmpeg-mt/libavcodec/wmavoice.c
index aa3b2b8..ea8260c 100644
--- a/ffmpeg-mt/libavcodec/wmavoice.c
+++ b/ffmpeg-mt/libavcodec/wmavoice.c
@@ -2,20 +2,20 @@
  * Windows Media Audio Voice decoder.
  * Copyright (c) 2009 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,8 +36,9 @@
 #include "acelp_filters.h"
 #include "lsp.h"
 #include "libavutil/lzo.h"
-#include "avfft.h"
-#include "fft.h"
+#include "dct.h"
+#include "rdft.h"
+#include "sinewin.h"
 
 #define MAX_BLOCKS           8   ///< maximum number of blocks per frame
 #define MAX_LSPS             16  ///< maximum filter order
@@ -558,7 +559,7 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
     int n, idx;
 
     /* Create frequency power spectrum of speech input (i.e. RDFT of LPCs) */
-    ff_rdft_calc(&s->rdft, lpcs);
+    s->rdft.rdft_calc(&s->rdft, lpcs);
 #define log_range(var, assign) do { \
         float tmp = log10f(assign);  var = tmp; \
         max       = FFMAX(max, tmp); min = FFMIN(min, tmp); \
@@ -601,8 +602,8 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
      * is a sinus input) by doing a phase shift (in theory, H(sin())=cos()).
      * Hilbert_Transform(RDFT(x)) = Laplace_Transform(x), which calculates the
      * "moment" of the LPCs in this filter. */
-    ff_dct_calc(&s->dct, lpcs);
-    ff_dct_calc(&s->dst, lpcs);
+    s->dct.dct_calc(&s->dct, lpcs);
+    s->dst.dct_calc(&s->dst, lpcs);
 
     /* Split out the coefficient indexes into phase/magnitude pairs */
     idx = 255 + av_clip(lpcs[64],               -255, 255);
@@ -623,7 +624,7 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
     coeffs[1] = last_coeff;
 
     /* move into real domain */
-    ff_rdft_calc(&s->irdft, coeffs);
+    s->irdft.rdft_calc(&s->irdft, coeffs);
 
     /* tilt correction and normalize scale */
     memset(&coeffs[remainder], 0, sizeof(coeffs[0]) * (128 - remainder));
@@ -693,8 +694,8 @@ static void wiener_denoise(WMAVoiceContext *s, int fcb_type,
         /* apply coefficients (in frequency spectrum domain), i.e. complex
          * number multiplication */
         memset(&synth_pf[size], 0, sizeof(synth_pf[0]) * (128 - size));
-        ff_rdft_calc(&s->rdft, synth_pf);
-        ff_rdft_calc(&s->rdft, coeffs);
+        s->rdft.rdft_calc(&s->rdft, synth_pf);
+        s->rdft.rdft_calc(&s->rdft, coeffs);
         synth_pf[0] *= coeffs[0];
         synth_pf[1] *= coeffs[1];
         for (n = 1; n < 64; n++) {
@@ -702,7 +703,7 @@ static void wiener_denoise(WMAVoiceContext *s, int fcb_type,
             synth_pf[n * 2]     = v1 * coeffs[n * 2] - v2 * coeffs[n * 2 + 1];
             synth_pf[n * 2 + 1] = v2 * coeffs[n * 2] + v1 * coeffs[n * 2 + 1];
         }
-        ff_rdft_calc(&s->irdft, synth_pf);
+        s->irdft.rdft_calc(&s->irdft, synth_pf);
     }
 
     /* merge filter output with the history of previous runs */
@@ -2018,7 +2019,7 @@ static av_cold void wmavoice_flush(AVCodecContext *ctx)
     }
 }
 
-AVCodec wmavoice_decoder = {
+AVCodec ff_wmavoice_decoder = {
     "wmavoice",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_WMAVOICE,
diff --git a/ffmpeg-mt/libavcodec/wmavoice_data.h b/ffmpeg-mt/libavcodec/wmavoice_data.h
index cbf65b0..7f14fb8 100644
--- a/ffmpeg-mt/libavcodec/wmavoice_data.h
+++ b/ffmpeg-mt/libavcodec/wmavoice_data.h
@@ -2,20 +2,20 @@
  * Windows Media Voice (WMAVoice) tables.
  * Copyright (c) 2009 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/wmv2.c b/ffmpeg-mt/libavcodec/wmv2.c
index e872b44..74389ef 100644
--- a/ffmpeg-mt/libavcodec/wmv2.c
+++ b/ffmpeg-mt/libavcodec/wmv2.c
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2002 The FFmpeg Project
+ * Copyright (c) 2002 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -102,7 +102,7 @@ void ff_mspel_motion(MpegEncContext *s,
     if(s->flags&CODEC_FLAG_EMU_EDGE){
         if(src_x<1 || src_y<1 || src_x + 17  >= s->h_edge_pos
                               || src_y + h+1 >= v_edge_pos){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19,
+            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19,
                              src_x-1, src_y-1, s->h_edge_pos, s->v_edge_pos);
             ptr= s->edge_emu_buffer + 1 + s->linesize;
             emu=1;
@@ -143,7 +143,7 @@ void ff_mspel_motion(MpegEncContext *s,
     offset = (src_y * uvlinesize) + src_x;
     ptr = ref_picture[1] + offset;
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
                          src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
         ptr= s->edge_emu_buffer;
     }
@@ -151,7 +151,7 @@ void ff_mspel_motion(MpegEncContext *s,
 
     ptr = ref_picture[2] + offset;
     if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
+        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
                          src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
         ptr= s->edge_emu_buffer;
     }
diff --git a/ffmpeg-mt/libavcodec/wmv2.h b/ffmpeg-mt/libavcodec/wmv2.h
index c69c9f4..80f36cc 100644
--- a/ffmpeg-mt/libavcodec/wmv2.h
+++ b/ffmpeg-mt/libavcodec/wmv2.h
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2002 The FFmpeg Project
+ * Copyright (c) 2002 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/wmv2dec.c b/ffmpeg-mt/libavcodec/wmv2dec.c
index 7dba7c5..578cce9 100644
--- a/ffmpeg-mt/libavcodec/wmv2dec.c
+++ b/ffmpeg-mt/libavcodec/wmv2dec.c
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2002 The FFmpeg Project
+ * Copyright (c) 2002 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -484,7 +484,7 @@ static av_cold int wmv2_decode_end(AVCodecContext *avctx)
     return ff_h263_decode_end(avctx);
 }
 
-AVCodec wmv2_decoder = {
+AVCodec ff_wmv2_decoder = {
     "wmv2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WMV2,
diff --git a/ffmpeg-mt/libavcodec/wmv2enc.c b/ffmpeg-mt/libavcodec/wmv2enc.c
index 7416f85..d59cbaf 100644
--- a/ffmpeg-mt/libavcodec/wmv2enc.c
+++ b/ffmpeg-mt/libavcodec/wmv2enc.c
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2002 The FFmpeg Project
+ * Copyright (c) 2002 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -211,7 +211,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
     }
 }
 
-AVCodec wmv2_encoder = {
+AVCodec ff_wmv2_encoder = {
     "wmv2",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WMV2,
diff --git a/ffmpeg-mt/libavcodec/wnv1.c b/ffmpeg-mt/libavcodec/wnv1.c
index 56634d1..7c0a537 100644
--- a/ffmpeg-mt/libavcodec/wnv1.c
+++ b/ffmpeg-mt/libavcodec/wnv1.c
@@ -2,20 +2,20 @@
  * Winnov WNV1 codec
  * Copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -154,7 +154,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec wnv1_decoder = {
+AVCodec ff_wnv1_decoder = {
     "wnv1",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_WNV1,
diff --git a/ffmpeg-mt/libavcodec/ws-snd1.c b/ffmpeg-mt/libavcodec/ws-snd1.c
index c16c99a..534be56 100644
--- a/ffmpeg-mt/libavcodec/ws-snd1.c
+++ b/ffmpeg-mt/libavcodec/ws-snd1.c
@@ -2,20 +2,20 @@
  * Westwood SNDx codecs
  * Copyright (c) 2005 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -146,7 +146,7 @@ static int ws_snd_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-AVCodec ws_snd1_decoder = {
+AVCodec ff_ws_snd1_decoder = {
     "ws_snd1",
     AVMEDIA_TYPE_AUDIO,
     CODEC_ID_WESTWOOD_SND1,
diff --git a/ffmpeg-mt/libavcodec/x86/Makefile b/ffmpeg-mt/libavcodec/x86/Makefile
index 943edcb..f8d456d 100644
--- a/ffmpeg-mt/libavcodec/x86/Makefile
+++ b/ffmpeg-mt/libavcodec/x86/Makefile
@@ -17,6 +17,8 @@ MMX-OBJS-$(CONFIG_H264PRED)            += x86/h264_intrapred_init.o
 
 YASM-OBJS-$(CONFIG_VC1_DECODER)        += x86/vc1dsp_yasm.o
 
+MMX-OBJS-$(CONFIG_AC3DSP)              += x86/ac3dsp_mmx.o
+YASM-OBJS-$(CONFIG_AC3DSP)             += x86/ac3dsp.o
 MMX-OBJS-$(CONFIG_CAVS_DECODER)        += x86/cavsdsp_mmx.o
 MMX-OBJS-$(CONFIG_MP1FLOAT_DECODER)    += x86/mpegaudiodec_mmx.o
 MMX-OBJS-$(CONFIG_MP2FLOAT_DECODER)    += x86/mpegaudiodec_mmx.o
@@ -39,6 +41,7 @@ YASM-OBJS-$(CONFIG_VP8_DECODER)        += x86/vp8dsp.o
 MMX-OBJS-$(CONFIG_VP8_DECODER)         += x86/vp8dsp-init.o
 MMX-OBJS-$(HAVE_YASM)                  += x86/dsputil_yasm.o            \
                                           x86/deinterlace.o             \
+                                          x86/fmtconvert.o              \
                                           x86/h264_chromamc.o           \
                                           $(YASM-OBJS-yes)
 
@@ -47,6 +50,7 @@ MMX-OBJS-$(CONFIG_FFT)                 += x86/fft.o
 OBJS-$(HAVE_MMX)                       += x86/dnxhd_mmx.o               \
                                           x86/dsputil_mmx.o             \
                                           x86/fdct_mmx.o                \
+                                          x86/fmtconvert_mmx.o          \
                                           x86/idct_mmx_xvid.o           \
                                           x86/idct_sse2_xvid.o          \
                                           x86/motion_est_mmx.o          \
diff --git a/ffmpeg-mt/libavcodec/x86/ac3dsp.asm b/ffmpeg-mt/libavcodec/x86/ac3dsp.asm
new file mode 100644
index 0000000..1b34751
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/x86/ac3dsp.asm
@@ -0,0 +1,295 @@
+;*****************************************************************************
+;* x86-optimized AC-3 DSP utils
+;* Copyright (c) 2011 Justin Ruggles
+;*
+;* This file is part of Libav.
+;*
+;* Libav is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* Libav is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with Libav; if not, write to the Free Software
+;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;******************************************************************************
+
+%include "x86inc.asm"
+%include "x86util.asm"
+
+SECTION_RODATA
+
+; 16777216.0f - used in ff_float_to_fixed24()
+pf_1_24: times 4 dd 0x4B800000
+
+SECTION .text
+
+;-----------------------------------------------------------------------------
+; void ff_ac3_exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
+;-----------------------------------------------------------------------------
+
+%macro AC3_EXPONENT_MIN 1
+cglobal ac3_exponent_min_%1, 3,4,2, exp, reuse_blks, expn, offset
+    shl  reuse_blksq, 8
+    jz .end
+    LOOP_ALIGN
+.nextexp:
+    mov      offsetq, reuse_blksq
+    mova          m0, [expq+offsetq]
+    sub      offsetq, 256
+    LOOP_ALIGN
+.nextblk:
+    PMINUB        m0, [expq+offsetq], m1
+    sub      offsetq, 256
+    jae .nextblk
+    mova      [expq], m0
+    add         expq, mmsize
+    sub        expnq, mmsize
+    jg .nextexp
+.end:
+    REP_RET
+%endmacro
+
+%define PMINUB PMINUB_MMX
+%define LOOP_ALIGN
+INIT_MMX
+AC3_EXPONENT_MIN mmx
+%ifdef HAVE_MMX2
+%define PMINUB PMINUB_MMXEXT
+%define LOOP_ALIGN ALIGN 16
+AC3_EXPONENT_MIN mmxext
+%endif
+%ifdef HAVE_SSE
+INIT_XMM
+AC3_EXPONENT_MIN sse2
+%endif
+%undef PMINUB
+%undef LOOP_ALIGN
+
+;-----------------------------------------------------------------------------
+; int ff_ac3_max_msb_abs_int16(const int16_t *src, int len)
+;
+; This function uses 2 different methods to calculate a valid result.
+; 1) logical 'or' of abs of each element
+;        This is used for ssse3 because of the pabsw instruction.
+;        It is also used for mmx because of the lack of min/max instructions.
+; 2) calculate min/max for the array, then or(abs(min),abs(max))
+;        This is used for mmxext and sse2 because they have pminsw/pmaxsw.
+;-----------------------------------------------------------------------------
+
+%macro AC3_MAX_MSB_ABS_INT16 2
+cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len
+    pxor        m2, m2
+    pxor        m3, m3
+.loop:
+%ifidn %2, min_max
+    mova        m0, [srcq]
+    mova        m1, [srcq+mmsize]
+    pminsw      m2, m0
+    pminsw      m2, m1
+    pmaxsw      m3, m0
+    pmaxsw      m3, m1
+%else ; or_abs
+%ifidn %1, mmx
+    mova        m0, [srcq]
+    mova        m1, [srcq+mmsize]
+    ABS2        m0, m1, m3, m4
+%else ; ssse3
+    ; using memory args is faster for ssse3
+    pabsw       m0, [srcq]
+    pabsw       m1, [srcq+mmsize]
+%endif
+    por         m2, m0
+    por         m2, m1
+%endif
+    add       srcq, mmsize*2
+    sub       lend, mmsize
+    ja .loop
+%ifidn %2, min_max
+    ABS2        m2, m3, m0, m1
+    por         m2, m3
+%endif
+%ifidn mmsize, 16
+    movhlps     m0, m2
+    por         m2, m0
+%endif
+    PSHUFLW     m0, m2, 0xe
+    por         m2, m0
+    PSHUFLW     m0, m2, 0x1
+    por         m2, m0
+    movd       eax, m2
+    and        eax, 0xFFFF
+    RET
+%endmacro
+
+INIT_MMX
+%define ABS2 ABS2_MMX
+%define PSHUFLW pshufw
+AC3_MAX_MSB_ABS_INT16 mmx, or_abs
+%define ABS2 ABS2_MMX2
+AC3_MAX_MSB_ABS_INT16 mmxext, min_max
+INIT_XMM
+%define PSHUFLW pshuflw
+AC3_MAX_MSB_ABS_INT16 sse2, min_max
+%define ABS2 ABS2_SSSE3
+AC3_MAX_MSB_ABS_INT16 ssse3, or_abs
+
+;-----------------------------------------------------------------------------
+; macro used for ff_ac3_lshift_int16() and ff_ac3_rshift_int32()
+;-----------------------------------------------------------------------------
+
+%macro AC3_SHIFT 4 ; l/r, 16/32, shift instruction, instruction set
+cglobal ac3_%1shift_int%2_%4, 3,3,5, src, len, shift
+    movd      m0, shiftd
+.loop:
+    mova      m1, [srcq         ]
+    mova      m2, [srcq+mmsize  ]
+    mova      m3, [srcq+mmsize*2]
+    mova      m4, [srcq+mmsize*3]
+    %3        m1, m0
+    %3        m2, m0
+    %3        m3, m0
+    %3        m4, m0
+    mova  [srcq         ], m1
+    mova  [srcq+mmsize  ], m2
+    mova  [srcq+mmsize*2], m3
+    mova  [srcq+mmsize*3], m4
+    add     srcq, mmsize*4
+    sub     lend, mmsize*32/%2
+    ja .loop
+.end:
+    REP_RET
+%endmacro
+
+;-----------------------------------------------------------------------------
+; void ff_ac3_lshift_int16(int16_t *src, unsigned int len, unsigned int shift)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+AC3_SHIFT l, 16, psllw, mmx
+INIT_XMM
+AC3_SHIFT l, 16, psllw, sse2
+
+;-----------------------------------------------------------------------------
+; void ff_ac3_rshift_int32(int32_t *src, unsigned int len, unsigned int shift)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+AC3_SHIFT r, 32, psrad, mmx
+INIT_XMM
+AC3_SHIFT r, 32, psrad, sse2
+
+;-----------------------------------------------------------------------------
+; void ff_float_to_fixed24(int32_t *dst, const float *src, unsigned int len)
+;-----------------------------------------------------------------------------
+
+; The 3DNow! version is not bit-identical because pf2id uses truncation rather
+; than round-to-nearest.
+INIT_MMX
+cglobal float_to_fixed24_3dnow, 3,3,0, dst, src, len
+    movq   m0, [pf_1_24]
+.loop:
+    movq   m1, [srcq   ]
+    movq   m2, [srcq+8 ]
+    movq   m3, [srcq+16]
+    movq   m4, [srcq+24]
+    pfmul  m1, m0
+    pfmul  m2, m0
+    pfmul  m3, m0
+    pfmul  m4, m0
+    pf2id  m1, m1
+    pf2id  m2, m2
+    pf2id  m3, m3
+    pf2id  m4, m4
+    movq  [dstq   ], m1
+    movq  [dstq+8 ], m2
+    movq  [dstq+16], m3
+    movq  [dstq+24], m4
+    add  srcq, 32
+    add  dstq, 32
+    sub  lend, 8
+    ja .loop
+    REP_RET
+
+INIT_XMM
+cglobal float_to_fixed24_sse, 3,3,3, dst, src, len
+    movaps     m0, [pf_1_24]
+.loop:
+    movaps     m1, [srcq   ]
+    movaps     m2, [srcq+16]
+    mulps      m1, m0
+    mulps      m2, m0
+    cvtps2pi  mm0, m1
+    movhlps    m1, m1
+    cvtps2pi  mm1, m1
+    cvtps2pi  mm2, m2
+    movhlps    m2, m2
+    cvtps2pi  mm3, m2
+    movq  [dstq   ], mm0
+    movq  [dstq+ 8], mm1
+    movq  [dstq+16], mm2
+    movq  [dstq+24], mm3
+    add      srcq, 32
+    add      dstq, 32
+    sub      lend, 8
+    ja .loop
+    REP_RET
+
+INIT_XMM
+cglobal float_to_fixed24_sse2, 3,3,9, dst, src, len
+    movaps     m0, [pf_1_24]
+.loop:
+    movaps     m1, [srcq    ]
+    movaps     m2, [srcq+16 ]
+    movaps     m3, [srcq+32 ]
+    movaps     m4, [srcq+48 ]
+%ifdef m8
+    movaps     m5, [srcq+64 ]
+    movaps     m6, [srcq+80 ]
+    movaps     m7, [srcq+96 ]
+    movaps     m8, [srcq+112]
+%endif
+    mulps      m1, m0
+    mulps      m2, m0
+    mulps      m3, m0
+    mulps      m4, m0
+%ifdef m8
+    mulps      m5, m0
+    mulps      m6, m0
+    mulps      m7, m0
+    mulps      m8, m0
+%endif
+    cvtps2dq   m1, m1
+    cvtps2dq   m2, m2
+    cvtps2dq   m3, m3
+    cvtps2dq   m4, m4
+%ifdef m8
+    cvtps2dq   m5, m5
+    cvtps2dq   m6, m6
+    cvtps2dq   m7, m7
+    cvtps2dq   m8, m8
+%endif
+    movdqa  [dstq    ], m1
+    movdqa  [dstq+16 ], m2
+    movdqa  [dstq+32 ], m3
+    movdqa  [dstq+48 ], m4
+%ifdef m8
+    movdqa  [dstq+64 ], m5
+    movdqa  [dstq+80 ], m6
+    movdqa  [dstq+96 ], m7
+    movdqa  [dstq+112], m8
+    add      srcq, 128
+    add      dstq, 128
+    sub      lenq, 32
+%else
+    add      srcq, 64
+    add      dstq, 64
+    sub      lenq, 16
+%endif
+    ja .loop
+    REP_RET
diff --git a/ffmpeg-mt/libavcodec/x86/ac3dsp_mmx.c b/ffmpeg-mt/libavcodec/x86/ac3dsp_mmx.c
new file mode 100644
index 0000000..4750423
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/x86/ac3dsp_mmx.c
@@ -0,0 +1,81 @@
+/*
+ * x86-optimized AC-3 DSP utils
+ * Copyright (c) 2011 Justin Ruggles
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/x86_cpu.h"
+#include "dsputil_mmx.h"
+#include "libavcodec/ac3dsp.h"
+
+extern void ff_ac3_exponent_min_mmx   (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+extern void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+extern void ff_ac3_exponent_min_sse2  (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+
+extern int ff_ac3_max_msb_abs_int16_mmx   (const int16_t *src, int len);
+extern int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len);
+extern int ff_ac3_max_msb_abs_int16_sse2  (const int16_t *src, int len);
+extern int ff_ac3_max_msb_abs_int16_ssse3 (const int16_t *src, int len);
+
+extern void ff_ac3_lshift_int16_mmx (int16_t *src, unsigned int len, unsigned int shift);
+extern void ff_ac3_lshift_int16_sse2(int16_t *src, unsigned int len, unsigned int shift);
+
+extern void ff_ac3_rshift_int32_mmx (int32_t *src, unsigned int len, unsigned int shift);
+extern void ff_ac3_rshift_int32_sse2(int32_t *src, unsigned int len, unsigned int shift);
+
+extern void ff_float_to_fixed24_3dnow(int32_t *dst, const float *src, unsigned int len);
+extern void ff_float_to_fixed24_sse  (int32_t *dst, const float *src, unsigned int len);
+extern void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int len);
+
+av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
+{
+    int mm_flags = av_get_cpu_flags();
+
+#if HAVE_YASM
+    if (mm_flags & AV_CPU_FLAG_MMX) {
+        c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
+        c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
+        c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
+        c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
+    }
+    if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
+        if (!bit_exact) {
+            c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
+        }
+    }
+    if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) {
+        c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
+        c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext;
+    }
+    if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
+        c->float_to_fixed24 = ff_float_to_fixed24_sse;
+    }
+    if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) {
+        c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
+        c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
+        c->float_to_fixed24 = ff_float_to_fixed24_sse2;
+        if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
+            c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;
+            c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
+        }
+    }
+    if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
+        c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
+    }
+#endif
+}
diff --git a/ffmpeg-mt/libavcodec/x86/cavsdsp_mmx.c b/ffmpeg-mt/libavcodec/x86/cavsdsp_mmx.c
index 0f5fdaa..3bc62ea 100644
--- a/ffmpeg-mt/libavcodec/x86/cavsdsp_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/cavsdsp_mmx.c
@@ -5,20 +5,20 @@
  * MMX-optimized DSP functions, based on H.264 optimizations by
  * Michael Niedermayer and Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/dct32_sse.c b/ffmpeg-mt/libavcodec/x86/dct32_sse.c
index 74338d6..5303c6d 100644
--- a/ffmpeg-mt/libavcodec/x86/dct32_sse.c
+++ b/ffmpeg-mt/libavcodec/x86/dct32_sse.c
@@ -2,20 +2,20 @@
  * 32 point SSE-optimized DCT transform
  * Copyright (c) 2010 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/deinterlace.asm b/ffmpeg-mt/libavcodec/x86/deinterlace.asm
index 76a096e..4eb2c2d 100644
--- a/ffmpeg-mt/libavcodec/x86/deinterlace.asm
+++ b/ffmpeg-mt/libavcodec/x86/deinterlace.asm
@@ -3,20 +3,20 @@
 ;* Copyright (c) 2010 Vitor Sessak
 ;* Copyright (c) 2002 Michael Niedermayer
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/dnxhd_mmx.c b/ffmpeg-mt/libavcodec/x86/dnxhd_mmx.c
index 1256bee..f00ce9b 100644
--- a/ffmpeg-mt/libavcodec/x86/dnxhd_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/dnxhd_mmx.c
@@ -4,20 +4,20 @@
  *
  * VC-3 encoder funded by the British Broadcasting Corporation
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/dsputil_mmx.c b/ffmpeg-mt/libavcodec/x86/dsputil_mmx.c
index d56c2a9..f98e6ae 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputil_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/dsputil_mmx.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000, 2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  *
  * MMX optimization by Nick Kurshev <nickols_k at mail.ru>
@@ -28,6 +28,7 @@
 #include "libavcodec/h264dsp.h"
 #include "libavcodec/mpegvideo.h"
 #include "libavcodec/simple_idct.h"
+#include "libavcodec/ac3dec.h"
 #include "dsputil_mmx.h"
 #include "idct_xvid.h"
 
@@ -80,7 +81,7 @@ DECLARE_ALIGNED(16, const xmm_reg,  ff_pb_FE ) = {0xFEFEFEFEFEFEFEFEULL, 0xFEFEF
 DECLARE_ALIGNED(16, const double, ff_pd_1)[2] = { 1.0, 1.0 };
 DECLARE_ALIGNED(16, const double, ff_pd_2)[2] = { 2.0, 2.0 };
 
-#define JUMPALIGN() __asm__ volatile (ASMALIGN(3)::)
+#define JUMPALIGN() __asm__ volatile (".p2align 3"::)
 #define MOVQ_ZERO(regd)  __asm__ volatile ("pxor %%" #regd ", %%" #regd ::)
 
 #define MOVQ_BFE(regd) \
@@ -285,9 +286,6 @@ void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_s
             :"memory");
 }
 
-DECLARE_ASM_CONST(8, uint8_t, ff_vector128)[8] =
-  { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
-
 #define put_signed_pixels_clamped_mmx_half(off) \
             "movq    "#off"(%2), %%mm1          \n\t"\
             "movq 16+"#off"(%2), %%mm2          \n\t"\
@@ -312,7 +310,7 @@ void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int
     x86_reg line_skip3;
 
     __asm__ volatile (
-            "movq "MANGLE(ff_vector128)", %%mm0 \n\t"
+            "movq "MANGLE(ff_pb_80)", %%mm0 \n\t"
             "lea (%3, %3, 2), %1                \n\t"
             put_signed_pixels_clamped_mmx_half(0)
             "lea (%0, %3, 4), %0                \n\t"
@@ -367,7 +365,7 @@ static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size
 {
     __asm__ volatile(
          "lea (%3, %3), %%"REG_a"       \n\t"
-         ASMALIGN(3)
+         ".p2align 3                    \n\t"
          "1:                            \n\t"
          "movd (%1), %%mm0              \n\t"
          "movd (%1, %3), %%mm1          \n\t"
@@ -393,7 +391,7 @@ static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size
 {
     __asm__ volatile(
          "lea (%3, %3), %%"REG_a"       \n\t"
-         ASMALIGN(3)
+         ".p2align 3                    \n\t"
          "1:                            \n\t"
          "movq (%1), %%mm0              \n\t"
          "movq (%1, %3), %%mm1          \n\t"
@@ -419,7 +417,7 @@ static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_siz
 {
     __asm__ volatile(
          "lea (%3, %3), %%"REG_a"       \n\t"
-         ASMALIGN(3)
+         ".p2align 3                    \n\t"
          "1:                            \n\t"
          "movq (%1), %%mm0              \n\t"
          "movq 8(%1), %%mm4             \n\t"
@@ -838,9 +836,9 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w,
         );
     }
 
-    for(i=0;i<w;i+=4) {
-        /* top and bottom (and hopefully also the corners) */
-        if (sides&EDGE_TOP) {
+    /* top and bottom (and hopefully also the corners) */
+    if (sides&EDGE_TOP) {
+        for(i = 0; i < w; i += 4) {
             ptr= buf - (i + 1) * wrap - w;
             __asm__ volatile(
                     "1:                             \n\t"
@@ -856,8 +854,10 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w,
                     : "r" ((x86_reg)buf - (x86_reg)ptr - w), "r" ((x86_reg)-wrap), "r" ((x86_reg)-wrap*3), "r" (ptr+width+2*w)
             );
         }
+    }
 
-        if (sides&EDGE_BOTTOM) {
+    if (sides&EDGE_BOTTOM) {
+        for(i = 0; i < w; i += 4) {
             ptr= last_line + (i + 1) * wrap - w;
             __asm__ volatile(
                     "1:                             \n\t"
@@ -1668,8 +1668,80 @@ QPEL_2TAP(avg_,  8, 3dnow)
 static void just_return(void) { return; }
 #endif
 
-static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
-                    int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height){
+#if HAVE_YASM
+typedef void emu_edge_core_func (uint8_t *buf, const uint8_t *src,
+                                 x86_reg linesize, x86_reg start_y,
+                                 x86_reg end_y, x86_reg block_h,
+                                 x86_reg start_x, x86_reg end_x,
+                                 x86_reg block_w);
+extern emu_edge_core_func ff_emu_edge_core_mmx;
+extern emu_edge_core_func ff_emu_edge_core_sse;
+
+static av_always_inline
+void emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize,
+                      int block_w, int block_h,
+                      int src_x, int src_y, int w, int h,
+                      emu_edge_core_func *core_fn)
+{
+    int start_y, start_x, end_y, end_x, src_y_add=0;
+
+    if(src_y>= h){
+        src_y_add = h-1-src_y;
+        src_y=h-1;
+    }else if(src_y<=-block_h){
+        src_y_add = 1-block_h-src_y;
+        src_y=1-block_h;
+    }
+    if(src_x>= w){
+        src+= (w-1-src_x);
+        src_x=w-1;
+    }else if(src_x<=-block_w){
+        src+= (1-block_w-src_x);
+        src_x=1-block_w;
+    }
+
+    start_y= FFMAX(0, -src_y);
+    start_x= FFMAX(0, -src_x);
+    end_y= FFMIN(block_h, h-src_y);
+    end_x= FFMIN(block_w, w-src_x);
+    assert(start_x < end_x && block_w > 0);
+    assert(start_y < end_y && block_h > 0);
+
+    // fill in the to-be-copied part plus all above/below
+    src += (src_y_add+start_y)*linesize + start_x;
+    buf += start_x;
+    core_fn(buf, src, linesize, start_y, end_y, block_h, start_x, end_x, block_w);
+}
+
+#if ARCH_X86_32
+static av_noinline
+void emulated_edge_mc_mmx(uint8_t *buf, const uint8_t *src, int linesize,
+                          int block_w, int block_h,
+                          int src_x, int src_y, int w, int h)
+{
+    emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y,
+                     w, h, &ff_emu_edge_core_mmx);
+}
+#endif
+static av_noinline
+void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src, int linesize,
+                          int block_w, int block_h,
+                          int src_x, int src_y, int w, int h)
+{
+    emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y,
+                     w, h, &ff_emu_edge_core_sse);
+}
+#endif /* HAVE_YASM */
+
+typedef void emulated_edge_mc_func (uint8_t *dst, const uint8_t *src,
+                                    int linesize, int block_w, int block_h,
+                                    int src_x, int src_y, int w, int h);
+
+static av_always_inline
+void gmc(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
+         int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height,
+         emulated_edge_mc_func *emu_edge_fn)
+{
     const int w = 8;
     const int ix = ox>>(16+shift);
     const int iy = oy>>(16+shift);
@@ -1705,7 +1777,7 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o
     if( (unsigned)ix >= width-w ||
         (unsigned)iy >= height-h )
     {
-        ff_emulated_edge_mc(edge_buf, src, stride, w+1, h+1, ix, iy, width, height);
+        emu_edge_fn(edge_buf, src, stride, w+1, h+1, ix, iy, width, height);
         src = edge_buf;
     }
 
@@ -1786,6 +1858,30 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o
     }
 }
 
+#if HAVE_YASM
+#if ARCH_X86_32
+static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
+                    int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
+{
+    gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
+        width, height, &emulated_edge_mc_mmx);
+}
+#endif
+static void gmc_sse(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
+                    int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
+{
+    gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
+        width, height, &emulated_edge_mc_sse);
+}
+#else
+static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
+                    int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
+{
+    gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
+        width, height, &ff_emulated_edge_mc);
+}
+#endif
+
 #define PREFETCH(name, op) \
 static void name(void *mem, int stride, int h){\
     const uint8_t *p= mem;\
@@ -1802,20 +1898,14 @@ PREFETCH(prefetch_3dnow, prefetch)
 
 void ff_put_h264_chroma_mc8_mmx_rnd   (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
-void ff_put_vc1_chroma_mc8_mmx_nornd  (uint8_t *dst, uint8_t *src,
-                                       int stride, int h, int x, int y);
 void ff_put_rv40_chroma_mc8_mmx       (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
 void ff_avg_h264_chroma_mc8_mmx2_rnd  (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
-void ff_avg_vc1_chroma_mc8_mmx2_nornd (uint8_t *dst, uint8_t *src,
-                                       int stride, int h, int x, int y);
 void ff_avg_rv40_chroma_mc8_mmx2      (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
 void ff_avg_h264_chroma_mc8_3dnow_rnd (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
-void ff_avg_vc1_chroma_mc8_3dnow_nornd(uint8_t *dst, uint8_t *src,
-                                       int stride, int h, int x, int y);
 void ff_avg_rv40_chroma_mc8_3dnow     (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
 
@@ -1839,15 +1929,11 @@ void ff_avg_h264_chroma_mc2_mmx2      (uint8_t *dst, uint8_t *src,
 
 void ff_put_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
-void ff_put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src,
-                                       int stride, int h, int x, int y);
 void ff_put_h264_chroma_mc4_ssse3     (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
 
 void ff_avg_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
-void ff_avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src,
-                                       int stride, int h, int x, int y);
 void ff_avg_h264_chroma_mc4_ssse3     (uint8_t *dst, uint8_t *src,
                                        int stride, int h, int x, int y);
 
@@ -2054,7 +2140,7 @@ static void ac3_downmix_sse(float (*samples)[256], float (*matrix)[2], int out_c
     } else if(in_ch == 5 && out_ch == 1 && matrix_cmp[0][0]==matrix_cmp[2][0] && matrix_cmp[3][0]==matrix_cmp[4][0]) {
         MIX5(IF1,IF0);
     } else {
-        DECLARE_ALIGNED(16, float, matrix_simd)[in_ch][2][4];
+        DECLARE_ALIGNED(16, float, matrix_simd)[AC3_MAX_CHANNELS][2][4];
         j = 2*in_ch*sizeof(float);
         __asm__ volatile(
             "1: \n"
@@ -2078,38 +2164,38 @@ static void ac3_downmix_sse(float (*samples)[256], float (*matrix)[2], int out_c
     }
 }
 
-static void vector_fmul_3dnow(float *dst, const float *src, int len){
+static void vector_fmul_3dnow(float *dst, const float *src0, const float *src1, int len){
     x86_reg i = (len-4)*4;
     __asm__ volatile(
         "1: \n\t"
-        "movq    (%1,%0), %%mm0 \n\t"
-        "movq   8(%1,%0), %%mm1 \n\t"
-        "pfmul   (%2,%0), %%mm0 \n\t"
-        "pfmul  8(%2,%0), %%mm1 \n\t"
+        "movq    (%2,%0), %%mm0 \n\t"
+        "movq   8(%2,%0), %%mm1 \n\t"
+        "pfmul   (%3,%0), %%mm0 \n\t"
+        "pfmul  8(%3,%0), %%mm1 \n\t"
         "movq   %%mm0,  (%1,%0) \n\t"
         "movq   %%mm1, 8(%1,%0) \n\t"
         "sub  $16, %0 \n\t"
         "jge 1b \n\t"
         "femms  \n\t"
         :"+r"(i)
-        :"r"(dst), "r"(src)
+        :"r"(dst), "r"(src0), "r"(src1)
         :"memory"
     );
 }
-static void vector_fmul_sse(float *dst, const float *src, int len){
+static void vector_fmul_sse(float *dst, const float *src0, const float *src1, int len){
     x86_reg i = (len-8)*4;
     __asm__ volatile(
         "1: \n\t"
-        "movaps    (%1,%0), %%xmm0 \n\t"
-        "movaps  16(%1,%0), %%xmm1 \n\t"
-        "mulps     (%2,%0), %%xmm0 \n\t"
-        "mulps   16(%2,%0), %%xmm1 \n\t"
+        "movaps    (%2,%0), %%xmm0 \n\t"
+        "movaps  16(%2,%0), %%xmm1 \n\t"
+        "mulps     (%3,%0), %%xmm0 \n\t"
+        "mulps   16(%3,%0), %%xmm1 \n\t"
         "movaps  %%xmm0,   (%1,%0) \n\t"
         "movaps  %%xmm1, 16(%1,%0) \n\t"
         "sub  $32, %0 \n\t"
         "jge 1b \n\t"
         :"+r"(i)
-        :"r"(dst), "r"(src)
+        :"r"(dst), "r"(src0), "r"(src1)
         :"memory"
     );
 }
@@ -2194,120 +2280,68 @@ static void vector_fmul_add_sse(float *dst, const float *src0, const float *src1
     );
 }
 
-static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1,
-                                      const float *win, float add_bias, int len){
-#if HAVE_6REGS
-    if(add_bias == 0){
-        x86_reg i = -len*4;
-        x86_reg j = len*4-8;
-        __asm__ volatile(
-            "1: \n"
-            "pswapd  (%5,%1), %%mm1 \n"
-            "movq    (%5,%0), %%mm0 \n"
-            "pswapd  (%4,%1), %%mm5 \n"
-            "movq    (%3,%0), %%mm4 \n"
-            "movq      %%mm0, %%mm2 \n"
-            "movq      %%mm1, %%mm3 \n"
-            "pfmul     %%mm4, %%mm2 \n" // src0[len+i]*win[len+i]
-            "pfmul     %%mm5, %%mm3 \n" // src1[    j]*win[len+j]
-            "pfmul     %%mm4, %%mm1 \n" // src0[len+i]*win[len+j]
-            "pfmul     %%mm5, %%mm0 \n" // src1[    j]*win[len+i]
-            "pfadd     %%mm3, %%mm2 \n"
-            "pfsub     %%mm0, %%mm1 \n"
-            "pswapd    %%mm2, %%mm2 \n"
-            "movq      %%mm1, (%2,%0) \n"
-            "movq      %%mm2, (%2,%1) \n"
-            "sub $8, %1 \n"
-            "add $8, %0 \n"
-            "jl 1b \n"
-            "femms \n"
-            :"+r"(i), "+r"(j)
-            :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
-        );
-    }else
-#endif
-        ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len);
-}
-
-static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1,
-                                   const float *win, float add_bias, int len){
 #if HAVE_6REGS
-    if(add_bias == 0){
-        x86_reg i = -len*4;
-        x86_reg j = len*4-16;
-        __asm__ volatile(
-            "1: \n"
-            "movaps       (%5,%1), %%xmm1 \n"
-            "movaps       (%5,%0), %%xmm0 \n"
-            "movaps       (%4,%1), %%xmm5 \n"
-            "movaps       (%3,%0), %%xmm4 \n"
-            "shufps $0x1b, %%xmm1, %%xmm1 \n"
-            "shufps $0x1b, %%xmm5, %%xmm5 \n"
-            "movaps        %%xmm0, %%xmm2 \n"
-            "movaps        %%xmm1, %%xmm3 \n"
-            "mulps         %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i]
-            "mulps         %%xmm5, %%xmm3 \n" // src1[    j]*win[len+j]
-            "mulps         %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j]
-            "mulps         %%xmm5, %%xmm0 \n" // src1[    j]*win[len+i]
-            "addps         %%xmm3, %%xmm2 \n"
-            "subps         %%xmm0, %%xmm1 \n"
-            "shufps $0x1b, %%xmm2, %%xmm2 \n"
-            "movaps        %%xmm1, (%2,%0) \n"
-            "movaps        %%xmm2, (%2,%1) \n"
-            "sub $16, %1 \n"
-            "add $16, %0 \n"
-            "jl 1b \n"
-            :"+r"(i), "+r"(j)
-            :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
-        );
-    }else
-#endif
-        ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len);
-}
-
-static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len)
-{
-    x86_reg i = -4*len;
+static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1,
+                                      const float *win, int len){
+    x86_reg i = -len*4;
+    x86_reg j = len*4-8;
     __asm__ volatile(
-        "movss  %3, %%xmm4 \n"
-        "shufps $0, %%xmm4, %%xmm4 \n"
         "1: \n"
-        "cvtpi2ps   (%2,%0), %%xmm0 \n"
-        "cvtpi2ps  8(%2,%0), %%xmm1 \n"
-        "cvtpi2ps 16(%2,%0), %%xmm2 \n"
-        "cvtpi2ps 24(%2,%0), %%xmm3 \n"
-        "movlhps  %%xmm1,    %%xmm0 \n"
-        "movlhps  %%xmm3,    %%xmm2 \n"
-        "mulps    %%xmm4,    %%xmm0 \n"
-        "mulps    %%xmm4,    %%xmm2 \n"
-        "movaps   %%xmm0,   (%1,%0) \n"
-        "movaps   %%xmm2, 16(%1,%0) \n"
-        "add $32, %0 \n"
+        "pswapd  (%5,%1), %%mm1 \n"
+        "movq    (%5,%0), %%mm0 \n"
+        "pswapd  (%4,%1), %%mm5 \n"
+        "movq    (%3,%0), %%mm4 \n"
+        "movq      %%mm0, %%mm2 \n"
+        "movq      %%mm1, %%mm3 \n"
+        "pfmul     %%mm4, %%mm2 \n" // src0[len+i]*win[len+i]
+        "pfmul     %%mm5, %%mm3 \n" // src1[    j]*win[len+j]
+        "pfmul     %%mm4, %%mm1 \n" // src0[len+i]*win[len+j]
+        "pfmul     %%mm5, %%mm0 \n" // src1[    j]*win[len+i]
+        "pfadd     %%mm3, %%mm2 \n"
+        "pfsub     %%mm0, %%mm1 \n"
+        "pswapd    %%mm2, %%mm2 \n"
+        "movq      %%mm1, (%2,%0) \n"
+        "movq      %%mm2, (%2,%1) \n"
+        "sub $8, %1 \n"
+        "add $8, %0 \n"
         "jl 1b \n"
-        :"+r"(i)
-        :"r"(dst+len), "r"(src+len), "m"(mul)
+        "femms \n"
+        :"+r"(i), "+r"(j)
+        :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
     );
 }
 
-static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len)
-{
-    x86_reg i = -4*len;
+static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1,
+                                   const float *win, int len){
+    x86_reg i = -len*4;
+    x86_reg j = len*4-16;
     __asm__ volatile(
-        "movss  %3, %%xmm4 \n"
-        "shufps $0, %%xmm4, %%xmm4 \n"
         "1: \n"
-        "cvtdq2ps   (%2,%0), %%xmm0 \n"
-        "cvtdq2ps 16(%2,%0), %%xmm1 \n"
-        "mulps    %%xmm4,    %%xmm0 \n"
-        "mulps    %%xmm4,    %%xmm1 \n"
-        "movaps   %%xmm0,   (%1,%0) \n"
-        "movaps   %%xmm1, 16(%1,%0) \n"
-        "add $32, %0 \n"
+        "movaps       (%5,%1), %%xmm1 \n"
+        "movaps       (%5,%0), %%xmm0 \n"
+        "movaps       (%4,%1), %%xmm5 \n"
+        "movaps       (%3,%0), %%xmm4 \n"
+        "shufps $0x1b, %%xmm1, %%xmm1 \n"
+        "shufps $0x1b, %%xmm5, %%xmm5 \n"
+        "movaps        %%xmm0, %%xmm2 \n"
+        "movaps        %%xmm1, %%xmm3 \n"
+        "mulps         %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i]
+        "mulps         %%xmm5, %%xmm3 \n" // src1[    j]*win[len+j]
+        "mulps         %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j]
+        "mulps         %%xmm5, %%xmm0 \n" // src1[    j]*win[len+i]
+        "addps         %%xmm3, %%xmm2 \n"
+        "subps         %%xmm0, %%xmm1 \n"
+        "shufps $0x1b, %%xmm2, %%xmm2 \n"
+        "movaps        %%xmm1, (%2,%0) \n"
+        "movaps        %%xmm2, (%2,%1) \n"
+        "sub $16, %1 \n"
+        "add $16, %0 \n"
         "jl 1b \n"
-        :"+r"(i)
-        :"r"(dst+len), "r"(src+len), "m"(mul)
+        :"+r"(i), "+r"(j)
+        :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
     );
 }
+#endif /* HAVE_6REGS */
 
 static void vector_clipf_sse(float *dst, const float *src, float min, float max,
                              int len)
@@ -2343,70 +2377,6 @@ static void vector_clipf_sse(float *dst, const float *src, float min, float max,
     );
 }
 
-static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){
-    x86_reg reglen = len;
-    // not bit-exact: pf2id uses different rounding than C and SSE
-    __asm__ volatile(
-        "add        %0          , %0        \n\t"
-        "lea         (%2,%0,2)  , %2        \n\t"
-        "add        %0          , %1        \n\t"
-        "neg        %0                      \n\t"
-        "1:                                 \n\t"
-        "pf2id       (%2,%0,2)  , %%mm0     \n\t"
-        "pf2id      8(%2,%0,2)  , %%mm1     \n\t"
-        "pf2id     16(%2,%0,2)  , %%mm2     \n\t"
-        "pf2id     24(%2,%0,2)  , %%mm3     \n\t"
-        "packssdw   %%mm1       , %%mm0     \n\t"
-        "packssdw   %%mm3       , %%mm2     \n\t"
-        "movq       %%mm0       ,  (%1,%0)  \n\t"
-        "movq       %%mm2       , 8(%1,%0)  \n\t"
-        "add        $16         , %0        \n\t"
-        " js 1b                             \n\t"
-        "femms                              \n\t"
-        :"+r"(reglen), "+r"(dst), "+r"(src)
-    );
-}
-static void float_to_int16_sse(int16_t *dst, const float *src, long len){
-    x86_reg reglen = len;
-    __asm__ volatile(
-        "add        %0          , %0        \n\t"
-        "lea         (%2,%0,2)  , %2        \n\t"
-        "add        %0          , %1        \n\t"
-        "neg        %0                      \n\t"
-        "1:                                 \n\t"
-        "cvtps2pi    (%2,%0,2)  , %%mm0     \n\t"
-        "cvtps2pi   8(%2,%0,2)  , %%mm1     \n\t"
-        "cvtps2pi  16(%2,%0,2)  , %%mm2     \n\t"
-        "cvtps2pi  24(%2,%0,2)  , %%mm3     \n\t"
-        "packssdw   %%mm1       , %%mm0     \n\t"
-        "packssdw   %%mm3       , %%mm2     \n\t"
-        "movq       %%mm0       ,  (%1,%0)  \n\t"
-        "movq       %%mm2       , 8(%1,%0)  \n\t"
-        "add        $16         , %0        \n\t"
-        " js 1b                             \n\t"
-        "emms                               \n\t"
-        :"+r"(reglen), "+r"(dst), "+r"(src)
-    );
-}
-
-static void float_to_int16_sse2(int16_t *dst, const float *src, long len){
-    x86_reg reglen = len;
-    __asm__ volatile(
-        "add        %0          , %0        \n\t"
-        "lea         (%2,%0,2)  , %2        \n\t"
-        "add        %0          , %1        \n\t"
-        "neg        %0                      \n\t"
-        "1:                                 \n\t"
-        "cvtps2dq    (%2,%0,2)  , %%xmm0    \n\t"
-        "cvtps2dq  16(%2,%0,2)  , %%xmm1    \n\t"
-        "packssdw   %%xmm1      , %%xmm0    \n\t"
-        "movdqa     %%xmm0      ,  (%1,%0)  \n\t"
-        "add        $16         , %0        \n\t"
-        " js 1b                             \n\t"
-        :"+r"(reglen), "+r"(dst), "+r"(src)
-    );
-}
-
 void ff_vp3_idct_mmx(int16_t *input_data);
 void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block);
 void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block);
@@ -2420,114 +2390,29 @@ void ff_vp3_idct_sse2(int16_t *input_data);
 void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block);
 void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block);
 
-void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len);
-void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len);
-void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len);
 int32_t ff_scalarproduct_int16_mmx2(const int16_t *v1, const int16_t *v2, int order, int shift);
 int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, int order, int shift);
 int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
 int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
 int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
+
+void ff_apply_window_int16_mmxext    (int16_t *output, const int16_t *input,
+                                      const int16_t *window, unsigned int len);
+void ff_apply_window_int16_mmxext_ba (int16_t *output, const int16_t *input,
+                                      const int16_t *window, unsigned int len);
+void ff_apply_window_int16_sse2      (int16_t *output, const int16_t *input,
+                                      const int16_t *window, unsigned int len);
+void ff_apply_window_int16_sse2_ba   (int16_t *output, const int16_t *input,
+                                      const int16_t *window, unsigned int len);
+void ff_apply_window_int16_ssse3     (int16_t *output, const int16_t *input,
+                                      const int16_t *window, unsigned int len);
+void ff_apply_window_int16_ssse3_atom(int16_t *output, const int16_t *input,
+                                      const int16_t *window, unsigned int len);
+
 void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
 int  ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, int w, int left);
 int  ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, int left);
 
-#if !HAVE_YASM
-#define ff_float_to_int16_interleave6_sse(a,b,c)   float_to_int16_interleave_misc_sse(a,b,c,6)
-#define ff_float_to_int16_interleave6_3dnow(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6)
-#define ff_float_to_int16_interleave6_3dn2(a,b,c)  float_to_int16_interleave_misc_3dnow(a,b,c,6)
-#endif
-#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse
-
-#define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \
-/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\
-static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\
-    DECLARE_ALIGNED(16, int16_t, tmp)[len];\
-    int i,j,c;\
-    for(c=0; c<channels; c++){\
-        float_to_int16_##cpu(tmp, src[c], len);\
-        for(i=0, j=c; i<len; i++, j+=channels)\
-            dst[j] = tmp[i];\
-    }\
-}\
-\
-static void float_to_int16_interleave_##cpu(int16_t *dst, const float **src, long len, int channels){\
-    if(channels==1)\
-        float_to_int16_##cpu(dst, src[0], len);\
-    else if(channels==2){\
-        x86_reg reglen = len; \
-        const float *src0 = src[0];\
-        const float *src1 = src[1];\
-        __asm__ volatile(\
-            "shl $2, %0 \n"\
-            "add %0, %1 \n"\
-            "add %0, %2 \n"\
-            "add %0, %3 \n"\
-            "neg %0 \n"\
-            body\
-            :"+r"(reglen), "+r"(dst), "+r"(src0), "+r"(src1)\
-        );\
-    }else if(channels==6){\
-        ff_float_to_int16_interleave6_##cpu(dst, src, len);\
-    }else\
-        float_to_int16_interleave_misc_##cpu(dst, src, len, channels);\
-}
-
-FLOAT_TO_INT16_INTERLEAVE(3dnow,
-    "1:                         \n"
-    "pf2id     (%2,%0), %%mm0   \n"
-    "pf2id    8(%2,%0), %%mm1   \n"
-    "pf2id     (%3,%0), %%mm2   \n"
-    "pf2id    8(%3,%0), %%mm3   \n"
-    "packssdw    %%mm1, %%mm0   \n"
-    "packssdw    %%mm3, %%mm2   \n"
-    "movq        %%mm0, %%mm1   \n"
-    "punpcklwd   %%mm2, %%mm0   \n"
-    "punpckhwd   %%mm2, %%mm1   \n"
-    "movq        %%mm0,  (%1,%0)\n"
-    "movq        %%mm1, 8(%1,%0)\n"
-    "add $16, %0                \n"
-    "js 1b                      \n"
-    "femms                      \n"
-)
-
-FLOAT_TO_INT16_INTERLEAVE(sse,
-    "1:                         \n"
-    "cvtps2pi  (%2,%0), %%mm0   \n"
-    "cvtps2pi 8(%2,%0), %%mm1   \n"
-    "cvtps2pi  (%3,%0), %%mm2   \n"
-    "cvtps2pi 8(%3,%0), %%mm3   \n"
-    "packssdw    %%mm1, %%mm0   \n"
-    "packssdw    %%mm3, %%mm2   \n"
-    "movq        %%mm0, %%mm1   \n"
-    "punpcklwd   %%mm2, %%mm0   \n"
-    "punpckhwd   %%mm2, %%mm1   \n"
-    "movq        %%mm0,  (%1,%0)\n"
-    "movq        %%mm1, 8(%1,%0)\n"
-    "add $16, %0                \n"
-    "js 1b                      \n"
-    "emms                       \n"
-)
-
-FLOAT_TO_INT16_INTERLEAVE(sse2,
-    "1:                         \n"
-    "cvtps2dq  (%2,%0), %%xmm0  \n"
-    "cvtps2dq  (%3,%0), %%xmm1  \n"
-    "packssdw   %%xmm1, %%xmm0  \n"
-    "movhlps    %%xmm0, %%xmm1  \n"
-    "punpcklwd  %%xmm1, %%xmm0  \n"
-    "movdqa     %%xmm0, (%1,%0) \n"
-    "add $16, %0                \n"
-    "js 1b                      \n"
-)
-
-static void float_to_int16_interleave_3dn2(int16_t *dst, const float **src, long len, int channels){
-    if(channels==6)
-        ff_float_to_int16_interleave6_3dn2(dst, src, len);
-    else
-        float_to_int16_interleave_3dnow(dst, src, len, channels);
-}
-
 float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order);
 
 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
@@ -2638,7 +2523,12 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
         SET_HPEL_FUNCS(avg, 1, 8, mmx);
         SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx);
 
+#if ARCH_X86_32 || !HAVE_YASM
         c->gmc= gmc_mmx;
+#endif
+#if ARCH_X86_32 && HAVE_YASM
+        c->emulated_edge_mc = emulated_edge_mc_mmx;
+#endif
 
         c->add_bytes= add_bytes_mmx;
         c->add_bytes_l2= add_bytes_l2_mmx;
@@ -2653,7 +2543,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
 #if HAVE_YASM
         c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_mmx_rnd;
         c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_mmx;
-        c->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
 
         c->put_rv40_chroma_pixels_tab[0]= ff_put_rv40_chroma_mc8_mmx;
         c->put_rv40_chroma_pixels_tab[1]= ff_put_rv40_chroma_mc4_mmx;
@@ -2740,8 +2629,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
             c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_mmx2;
             c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_mmx2;
 
-            c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;
-
             c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_mmx2_rnd;
             c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_mmx2;
             c->avg_h264_chroma_pixels_tab[2]= ff_avg_h264_chroma_mc2_mmx2;
@@ -2754,9 +2641,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
                 c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
 #endif
 
-            if (CONFIG_VC1_DECODER)
-                ff_vc1dsp_init_mmx(c, avctx);
-
             c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2;
         } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
             c->prefetch = prefetch_3dnow;
@@ -2813,8 +2697,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
             c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_3dnow_rnd;
             c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_3dnow;
 
-            c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;
-
             c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_3dnow;
             c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_3dnow;
 #endif
@@ -2863,8 +2745,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
             H264_QPEL_FUNCS(3, 3, ssse3);
             c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3;
 #if HAVE_YASM
-            c->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd;
-            c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd;
             c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_ssse3_rnd;
             c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_ssse3_rnd;
             c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_ssse3;
@@ -2879,22 +2759,22 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
         if(mm_flags & AV_CPU_FLAG_3DNOW){
             c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow;
             c->vector_fmul = vector_fmul_3dnow;
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->float_to_int16 = float_to_int16_3dnow;
-                c->float_to_int16_interleave = float_to_int16_interleave_3dnow;
-            }
         }
         if(mm_flags & AV_CPU_FLAG_3DNOWEXT){
             c->vector_fmul_reverse = vector_fmul_reverse_3dnow2;
+#if HAVE_6REGS
             c->vector_fmul_window = vector_fmul_window_3dnow2;
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->float_to_int16_interleave = float_to_int16_interleave_3dn2;
-            }
+#endif
         }
         if(mm_flags & AV_CPU_FLAG_MMX2){
 #if HAVE_YASM
             c->scalarproduct_int16 = ff_scalarproduct_int16_mmx2;
             c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmx2;
+            if (avctx->flags & CODEC_FLAG_BITEXACT) {
+                c->apply_window_int16 = ff_apply_window_int16_mmxext_ba;
+            } else {
+                c->apply_window_int16 = ff_apply_window_int16_mmxext;
+            }
 #endif
         }
         if(mm_flags & AV_CPU_FLAG_SSE){
@@ -2903,11 +2783,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
             c->vector_fmul = vector_fmul_sse;
             c->vector_fmul_reverse = vector_fmul_reverse_sse;
             c->vector_fmul_add = vector_fmul_add_sse;
+#if HAVE_6REGS
             c->vector_fmul_window = vector_fmul_window_sse;
-            c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse;
+#endif
             c->vector_clipf = vector_clipf_sse;
-            c->float_to_int16 = float_to_int16_sse;
-            c->float_to_int16_interleave = float_to_int16_interleave_sse;
 #if HAVE_YASM
             c->scalarproduct_float = ff_scalarproduct_float_sse;
 #endif
@@ -2915,16 +2794,33 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
         if(mm_flags & AV_CPU_FLAG_3DNOW)
             c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse
         if(mm_flags & AV_CPU_FLAG_SSE2){
-            c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2;
-            c->float_to_int16 = float_to_int16_sse2;
-            c->float_to_int16_interleave = float_to_int16_interleave_sse2;
 #if HAVE_YASM
             c->scalarproduct_int16 = ff_scalarproduct_int16_sse2;
             c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2;
+            if (avctx->flags & CODEC_FLAG_BITEXACT) {
+                c->apply_window_int16 = ff_apply_window_int16_sse2_ba;
+            } else {
+                if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
+                    c->apply_window_int16 = ff_apply_window_int16_sse2;
+                }
+            }
+
+            c->emulated_edge_mc = emulated_edge_mc_sse;
+            c->gmc= gmc_sse;
+#endif
+        }
+        if (mm_flags & AV_CPU_FLAG_SSSE3) {
+#if HAVE_YASM
+            if (mm_flags & AV_CPU_FLAG_ATOM) {
+                c->apply_window_int16 = ff_apply_window_int16_ssse3_atom;
+            } else {
+                c->apply_window_int16 = ff_apply_window_int16_ssse3;
+            }
+            if (!(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW))) { // cachesplit
+                c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3;
+            }
 #endif
         }
-        if((mm_flags & AV_CPU_FLAG_SSSE3) && !(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW)) && HAVE_YASM) // cachesplit
-            c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3;
     }
 
     if (CONFIG_ENCODERS)
diff --git a/ffmpeg-mt/libavcodec/x86/dsputil_mmx.h b/ffmpeg-mt/libavcodec/x86/dsputil_mmx.h
index c57bbbf..7ab55e7 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputil_mmx.h
+++ b/ffmpeg-mt/libavcodec/x86/dsputil_mmx.h
@@ -2,20 +2,20 @@
  * MMX optimized DSP utils
  * Copyright (c) 2007  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -196,13 +196,9 @@ void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
 void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
 void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
 
-void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx);
 void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd);
 void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd);
 
-void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag,
-                                   double *autoc);
-
 void ff_mmx_idct(DCTELEM *block);
 void ff_mmxext_idct(DCTELEM *block);
 
diff --git a/ffmpeg-mt/libavcodec/x86/dsputil_mmx_avg_template.c b/ffmpeg-mt/libavcodec/x86/dsputil_mmx_avg_template.c
index 69575e3..8b116b7 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputil_mmx_avg_template.c
+++ b/ffmpeg-mt/libavcodec/x86/dsputil_mmx_avg_template.c
@@ -7,20 +7,20 @@
  * mostly rewritten by Michael Niedermayer <michaelni at gmx.at>
  * and improved by Zdenek Kabelac <kabi at users.sf.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -838,7 +838,7 @@ static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line
         "lea (%3, %3), %%"REG_a"        \n\t"
         "movq (%1), %%mm0               \n\t"
         PAVGB" 1(%1), %%mm0             \n\t"
-         ASMALIGN(3)
+         ".p2align 3                    \n\t"
         "1:                             \n\t"
         "movq (%1, %%"REG_a"), %%mm2    \n\t"
         "movq (%1, %3), %%mm1           \n\t"
diff --git a/ffmpeg-mt/libavcodec/x86/dsputil_mmx_qns_template.c b/ffmpeg-mt/libavcodec/x86/dsputil_mmx_qns_template.c
index d2dbfc5..20a40a1 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputil_mmx_qns_template.c
+++ b/ffmpeg-mt/libavcodec/x86/dsputil_mmx_qns_template.c
@@ -5,20 +5,20 @@
  * MMX optimization by Michael Niedermayer <michaelni at gmx.at>
  * 3DNow! and SSSE3 optimization by Zuxy Meng <zuxy.meng at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -37,7 +37,7 @@ static int DEF(try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[
         "movd  %4, %%mm5                \n\t"
         "punpcklwd %%mm5, %%mm5         \n\t"
         "punpcklwd %%mm5, %%mm5         \n\t"
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq  (%1, %0), %%mm0          \n\t"
         "movq  8(%1, %0), %%mm1         \n\t"
@@ -77,7 +77,7 @@ static void DEF(add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale)
                 "movd  %3, %%mm5        \n\t"
                 "punpcklwd %%mm5, %%mm5 \n\t"
                 "punpcklwd %%mm5, %%mm5 \n\t"
-                ASMALIGN(4)
+                ".p2align 4             \n\t"
                 "1:                     \n\t"
                 "movq  (%1, %0), %%mm0  \n\t"
                 "movq  8(%1, %0), %%mm1 \n\t"
diff --git a/ffmpeg-mt/libavcodec/x86/dsputil_mmx_rnd_template.c b/ffmpeg-mt/libavcodec/x86/dsputil_mmx_rnd_template.c
index 2fc1756..34a2c0b 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputil_mmx_rnd_template.c
+++ b/ffmpeg-mt/libavcodec/x86/dsputil_mmx_rnd_template.c
@@ -7,20 +7,20 @@
  * mostly rewritten by Michael Niedermayer <michaelni at gmx.at>
  * and improved by Zdenek Kabelac <kabi at users.sf.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,7 +30,7 @@ static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line
     MOVQ_BFE(mm6);
     __asm__ volatile(
         "lea    (%3, %3), %%"REG_a"     \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1), %%mm0             \n\t"
         "movq   1(%1), %%mm1            \n\t"
@@ -71,7 +71,7 @@ static void av_unused DEF(put, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t
         "movq   %%mm4, (%3)             \n\t"
         "add    %5, %3                  \n\t"
         "decl   %0                      \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1), %%mm0             \n\t"
         "movq   (%2), %%mm1             \n\t"
@@ -112,7 +112,7 @@ static void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int lin
     MOVQ_BFE(mm6);
     __asm__ volatile(
         "lea        (%3, %3), %%"REG_a" \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1), %%mm0             \n\t"
         "movq   1(%1), %%mm1            \n\t"
@@ -170,7 +170,7 @@ static void av_unused DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t
         "movq   %%mm5, 8(%3)            \n\t"
         "add    %5, %3                  \n\t"
         "decl   %0                      \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1), %%mm0             \n\t"
         "movq   (%2), %%mm1             \n\t"
@@ -208,7 +208,7 @@ static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line
     __asm__ volatile(
         "lea (%3, %3), %%"REG_a"        \n\t"
         "movq (%1), %%mm0               \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1, %3), %%mm1         \n\t"
         "movq   (%1, %%"REG_a"),%%mm2   \n\t"
@@ -248,7 +248,7 @@ static void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin
         "paddusw %%mm1, %%mm5           \n\t"
         "xor    %%"REG_a", %%"REG_a"    \n\t"
         "add    %3, %1                  \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1, %%"REG_a"), %%mm0  \n\t"
         "movq   1(%1, %%"REG_a"), %%mm2 \n\t"
@@ -460,7 +460,7 @@ static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line
     __asm__ volatile(
         "lea    (%3, %3), %%"REG_a"     \n\t"
         "movq   (%1), %%mm0             \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1, %3), %%mm1         \n\t"
         "movq   (%1, %%"REG_a"), %%mm2  \n\t"
@@ -511,7 +511,7 @@ static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin
         "paddusw %%mm1, %%mm5           \n\t"
         "xor    %%"REG_a", %%"REG_a"    \n\t"
         "add    %3, %1                  \n\t"
-        ASMALIGN(3)
+        ".p2align 3                     \n\t"
         "1:                             \n\t"
         "movq   (%1, %%"REG_a"), %%mm0  \n\t"
         "movq   1(%1, %%"REG_a"), %%mm2 \n\t"
diff --git a/ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm b/ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm
index bda0472..f2c205b 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm
+++ b/ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm
@@ -2,20 +2,20 @@
 ;* MMX optimized DSP utils
 ;* Copyright (c) 2008 Loren Merritt
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
@@ -27,78 +27,11 @@ pb_zzzzzzzz77777777: times 8 db -1
 pb_7: times 8 db 7
 pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11
 pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13
+pb_revwords: db 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1
+pd_16384: times 4 dd 16384
 
 section .text align=16
 
-%macro PSWAPD_SSE 2
-    pshufw %1, %2, 0x4e
-%endmacro
-%macro PSWAPD_3DN1 2
-    movq  %1, %2
-    psrlq %1, 32
-    punpckldq %1, %2
-%endmacro
-
-%macro FLOAT_TO_INT16_INTERLEAVE6 1
-; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
-cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5
-%ifdef ARCH_X86_64
-    %define lend r10d
-    mov     lend, r2d
-%else
-    %define lend dword r2m
-%endif
-    mov src1q, [srcq+1*gprsize]
-    mov src2q, [srcq+2*gprsize]
-    mov src3q, [srcq+3*gprsize]
-    mov src4q, [srcq+4*gprsize]
-    mov src5q, [srcq+5*gprsize]
-    mov srcq,  [srcq]
-    sub src1q, srcq
-    sub src2q, srcq
-    sub src3q, srcq
-    sub src4q, srcq
-    sub src5q, srcq
-.loop:
-    cvtps2pi   mm0, [srcq]
-    cvtps2pi   mm1, [srcq+src1q]
-    cvtps2pi   mm2, [srcq+src2q]
-    cvtps2pi   mm3, [srcq+src3q]
-    cvtps2pi   mm4, [srcq+src4q]
-    cvtps2pi   mm5, [srcq+src5q]
-    packssdw   mm0, mm3
-    packssdw   mm1, mm4
-    packssdw   mm2, mm5
-    pswapd     mm3, mm0
-    punpcklwd  mm0, mm1
-    punpckhwd  mm1, mm2
-    punpcklwd  mm2, mm3
-    pswapd     mm3, mm0
-    punpckldq  mm0, mm2
-    punpckhdq  mm2, mm1
-    punpckldq  mm1, mm3
-    movq [dstq   ], mm0
-    movq [dstq+16], mm2
-    movq [dstq+ 8], mm1
-    add srcq, 8
-    add dstq, 24
-    sub lend, 2
-    jg .loop
-    emms
-    RET
-%endmacro ; FLOAT_TO_INT16_INTERLEAVE6
-
-%define pswapd PSWAPD_SSE
-FLOAT_TO_INT16_INTERLEAVE6 sse
-%define cvtps2pi pf2id
-%define pswapd PSWAPD_3DN1
-FLOAT_TO_INT16_INTERLEAVE6 3dnow
-%undef pswapd
-FLOAT_TO_INT16_INTERLEAVE6 3dn2
-%undef cvtps2pi
-
-
-
 %macro SCALARPRODUCT 1
 ; int scalarproduct_int16(int16_t *v1, int16_t *v2, int order, int shift)
 cglobal scalarproduct_int16_%1, 3,3,4, v1, v2, order, shift
@@ -271,6 +204,130 @@ SCALARPRODUCT_LOOP 0
     RET
 
 
+;-----------------------------------------------------------------------------
+; void ff_apply_window_int16(int16_t *output, const int16_t *input,
+;                            const int16_t *window, unsigned int len)
+;-----------------------------------------------------------------------------
+
+%macro REVERSE_WORDS_MMXEXT 1-2
+    pshufw   %1, %1, 0x1B
+%endmacro
+
+%macro REVERSE_WORDS_SSE2 1-2
+    pshuflw  %1, %1, 0x1B
+    pshufhw  %1, %1, 0x1B
+    pshufd   %1, %1, 0x4E
+%endmacro
+
+%macro REVERSE_WORDS_SSSE3 2
+    pshufb  %1, %2
+%endmacro
+
+; dst = (dst * src) >> 15
+; pmulhw cuts off the bottom bit, so we have to lshift by 1 and add it back
+; in from the pmullw result.
+%macro MUL16FIXED_MMXEXT 3 ; dst, src, temp
+    mova    %3, %1
+    pmulhw  %1, %2
+    pmullw  %3, %2
+    psrlw   %3, 15
+    psllw   %1, 1
+    por     %1, %3
+%endmacro
+
+; dst = ((dst * src) + (1<<14)) >> 15
+%macro MUL16FIXED_SSSE3 3 ; dst, src, unused
+    pmulhrsw   %1, %2
+%endmacro
+
+%macro APPLY_WINDOW_INT16 3 ; %1=instruction set, %2=mmxext/sse2 bit exact version, %3=has_ssse3
+cglobal apply_window_int16_%1, 4,5,6, output, input, window, offset, offset2
+    lea     offset2q, [offsetq-mmsize]
+%if %2
+    mova          m5, [pd_16384]
+%elifidn %1, ssse3
+    mova          m5, [pb_revwords]
+    ALIGN 16
+%endif
+.loop:
+%if %2
+    ; This version expands 16-bit to 32-bit, multiplies by the window,
+    ; adds 16384 for rounding, right shifts 15, then repacks back to words to
+    ; save to the output. The window is reversed for the second half.
+    mova          m3, [windowq+offset2q]
+    mova          m4, [ inputq+offset2q]
+    pxor          m0, m0
+    punpcklwd     m0, m3
+    punpcklwd     m1, m4
+    pmaddwd       m0, m1
+    paddd         m0, m5
+    psrad         m0, 15
+    pxor          m2, m2
+    punpckhwd     m2, m3
+    punpckhwd     m1, m4
+    pmaddwd       m2, m1
+    paddd         m2, m5
+    psrad         m2, 15
+    packssdw      m0, m2
+    mova  [outputq+offset2q], m0
+    REVERSE_WORDS m3
+    mova          m4, [ inputq+offsetq]
+    pxor          m0, m0
+    punpcklwd     m0, m3
+    punpcklwd     m1, m4
+    pmaddwd       m0, m1
+    paddd         m0, m5
+    psrad         m0, 15
+    pxor          m2, m2
+    punpckhwd     m2, m3
+    punpckhwd     m1, m4
+    pmaddwd       m2, m1
+    paddd         m2, m5
+    psrad         m2, 15
+    packssdw      m0, m2
+    mova  [outputq+offsetq], m0
+%elif %3
+    ; This version does the 16x16->16 multiplication in-place without expanding
+    ; to 32-bit. The ssse3 version is bit-identical.
+    mova          m0, [windowq+offset2q]
+    mova          m1, [ inputq+offset2q]
+    pmulhrsw      m1, m0
+    REVERSE_WORDS m0, m5
+    pmulhrsw      m0, [ inputq+offsetq ]
+    mova  [outputq+offset2q], m1
+    mova  [outputq+offsetq ], m0
+%else
+    ; This version does the 16x16->16 multiplication in-place without expanding
+    ; to 32-bit. The mmxext and sse2 versions do not use rounding, and
+    ; therefore are not bit-identical to the C version.
+    mova          m0, [windowq+offset2q]
+    mova          m1, [ inputq+offset2q]
+    mova          m2, [ inputq+offsetq ]
+    MUL16FIXED    m1, m0, m3
+    REVERSE_WORDS m0
+    MUL16FIXED    m2, m0, m3
+    mova  [outputq+offset2q], m1
+    mova  [outputq+offsetq ], m2
+%endif
+    add      offsetd, mmsize
+    sub     offset2d, mmsize
+    jae .loop
+    REP_RET
+%endmacro
+
+INIT_MMX
+%define REVERSE_WORDS REVERSE_WORDS_MMXEXT
+%define MUL16FIXED MUL16FIXED_MMXEXT
+APPLY_WINDOW_INT16 mmxext,     0, 0
+APPLY_WINDOW_INT16 mmxext_ba,  1, 0
+INIT_XMM
+%define REVERSE_WORDS REVERSE_WORDS_SSE2
+APPLY_WINDOW_INT16 sse2,       0, 0
+APPLY_WINDOW_INT16 sse2_ba,    1, 0
+APPLY_WINDOW_INT16 ssse3_atom, 0, 1
+%define REVERSE_WORDS REVERSE_WORDS_SSSE3
+APPLY_WINDOW_INT16 ssse3,      0, 1
+
 
 ; void add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top)
 cglobal add_hfyu_median_prediction_mmx2, 6,6,0, dst, top, diff, w, left, left_top
@@ -421,3 +478,573 @@ cglobal scalarproduct_float_sse, 3,3,2, v1, v2, offset
     fld     dword r0m
 %endif
     RET
+
+; extern void ff_emu_edge_core(uint8_t *buf, const uint8_t *src, x86_reg linesize,
+;                              x86_reg start_y, x86_reg end_y, x86_reg block_h,
+;                              x86_reg start_x, x86_reg end_x, x86_reg block_w);
+;
+; The actual function itself is below. It basically wraps a very simple
+; w = end_x - start_x
+; if (w) {
+;   if (w > 22) {
+;     jump to the slow loop functions
+;   } else {
+;     jump to the fast loop functions
+;   }
+; }
+;
+; ... and then the same for left/right extend also. See below for loop
+; function implementations. Fast are fixed-width, slow is variable-width
+
+%macro EMU_EDGE_FUNC 1
+%ifdef ARCH_X86_64
+%define w_reg r10
+cglobal emu_edge_core_%1, 6, 7, 1
+    mov        r11, r5          ; save block_h
+%else
+%define w_reg r6
+cglobal emu_edge_core_%1, 2, 7, 0
+    mov         r4, r4m         ; end_y
+    mov         r5, r5m         ; block_h
+%endif
+
+    ; start with vertical extend (top/bottom) and body pixel copy
+    mov      w_reg, r7m
+    sub      w_reg, r6m         ; w = start_x - end_x
+    sub         r5, r4
+%ifdef ARCH_X86_64
+    sub         r4, r3
+%else
+    sub         r4, dword r3m
+%endif
+    cmp      w_reg, 22
+    jg .slow_v_extend_loop
+%ifdef ARCH_X86_32
+    mov         r2, r2m         ; linesize
+%endif
+    sal      w_reg, 7           ; w * 128
+%ifdef PIC
+    lea        rax, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)]
+    add      w_reg, rax
+%else
+    lea      w_reg, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)+w_reg]
+%endif
+    call     w_reg              ; fast top extend, body copy and bottom extend
+.v_extend_end:
+
+    ; horizontal extend (left/right)
+    mov      w_reg, r6m         ; start_x
+    sub         r0, w_reg
+%ifdef ARCH_X86_64
+    mov         r3, r0          ; backup of buf+block_h*linesize
+    mov         r5, r11
+%else
+    mov        r0m, r0          ; backup of buf+block_h*linesize
+    mov         r5, r5m
+%endif
+    test     w_reg, w_reg
+    jz .right_extend
+    cmp      w_reg, 22
+    jg .slow_left_extend_loop
+    mov         r1, w_reg
+    dec      w_reg
+    ; FIXME we can do a if size == 1 here if that makes any speed difference, test me
+    sar      w_reg, 1
+    sal      w_reg, 6
+    ; r0=buf+block_h*linesize,r10(64)/r6(32)=start_x offset for funcs
+    ; r6(rax)/r3(ebx)=val,r2=linesize,r1=start_x,r5=block_h
+%ifdef PIC
+    lea        rax, [.emuedge_extend_left_2]
+    add      w_reg, rax
+%else
+    lea      w_reg, [.emuedge_extend_left_2+w_reg]
+%endif
+    call     w_reg
+
+    ; now r3(64)/r0(32)=buf,r2=linesize,r11/r5=block_h,r6/r3=val, r10/r6=end_x, r1=block_w
+.right_extend:
+%ifdef ARCH_X86_32
+    mov         r0, r0m
+    mov         r5, r5m
+%endif
+    mov      w_reg, r7m         ; end_x
+    mov         r1, r8m         ; block_w
+    mov         r4, r1
+    sub         r1, w_reg
+    jz .h_extend_end            ; if (end_x == block_w) goto h_extend_end
+    cmp         r1, 22
+    jg .slow_right_extend_loop
+    dec         r1
+    ; FIXME we can do a if size == 1 here if that makes any speed difference, test me
+    sar         r1, 1
+    sal         r1, 6
+%ifdef PIC
+    lea        rax, [.emuedge_extend_right_2]
+    add         r1, rax
+%else
+    lea         r1, [.emuedge_extend_right_2+r1]
+%endif
+    call        r1
+.h_extend_end:
+    RET
+
+%ifdef ARCH_X86_64
+%define vall  al
+%define valh  ah
+%define valw  ax
+%define valw2 r10w
+%define valw3 r3w
+%ifdef WIN64
+%define valw4 r4w
+%else ; unix64
+%define valw4 r3w
+%endif
+%define vald eax
+%else
+%define vall  bl
+%define valh  bh
+%define valw  bx
+%define valw2 r6w
+%define valw3 valw2
+%define valw4 valw3
+%define vald ebx
+%define stack_offset 0x14
+%endif
+
+%endmacro
+
+; macro to read/write a horizontal number of pixels (%2) to/from registers
+; on x86-64, - fills xmm0-15 for consecutive sets of 16 pixels
+;            - if (%2 & 15 == 8) fills the last 8 bytes into rax
+;            - else if (%2 & 8)  fills 8 bytes into mm0
+;            - if (%2 & 7 == 4)  fills the last 4 bytes into rax
+;            - else if (%2 & 4)  fills 4 bytes into mm0-1
+;            - if (%2 & 3 == 3)  fills 2 bytes into r10/r3, and 1 into eax
+;              (note that we're using r3 for body/bottom because it's a shorter
+;               opcode, and then the loop fits in 128 bytes)
+;            - else              fills remaining bytes into rax
+; on x86-32, - fills mm0-7 for consecutive sets of 8 pixels
+;            - if (%2 & 7 == 4)  fills 4 bytes into ebx
+;            - else if (%2 & 4)  fills 4 bytes into mm0-7
+;            - if (%2 & 3 == 3)  fills 2 bytes into r6, and 1 into ebx
+;            - else              fills remaining bytes into ebx
+; writing data out is in the same way
+%macro READ_NUM_BYTES 3
+%assign %%src_off 0 ; offset in source buffer
+%assign %%smidx   0 ; mmx register idx
+%assign %%sxidx   0 ; xmm register idx
+
+%ifnidn %3, mmx
+%rep %2/16
+    movdqu xmm %+ %%sxidx, [r1+%%src_off]
+%assign %%src_off %%src_off+16
+%assign %%sxidx   %%sxidx+1
+%endrep ; %2/16
+%endif ; !mmx
+
+%ifdef ARCH_X86_64
+%if (%2-%%src_off) == 8
+    mov           rax, [r1+%%src_off]
+%assign %%src_off %%src_off+8
+%endif ; (%2-%%src_off) == 8
+%endif ; x86-64
+
+%rep (%2-%%src_off)/8
+    movq    mm %+ %%smidx, [r1+%%src_off]
+%assign %%src_off %%src_off+8
+%assign %%smidx   %%smidx+1
+%endrep ; (%2-%%dst_off)/8
+
+%if (%2-%%src_off) == 4
+    mov          vald, [r1+%%src_off]
+%elif (%2-%%src_off) & 4
+    movd    mm %+ %%smidx, [r1+%%src_off]
+%assign %%src_off %%src_off+4
+%endif ; (%2-%%src_off) ==/& 4
+
+%if (%2-%%src_off) == 1
+    mov          vall, [r1+%%src_off]
+%elif (%2-%%src_off) == 2
+    mov          valw, [r1+%%src_off]
+%elif (%2-%%src_off) == 3
+%ifidn %1, top
+    mov         valw2, [r1+%%src_off]
+%elifidn %1, body
+    mov         valw3, [r1+%%src_off]
+%elifidn %1, bottom
+    mov         valw4, [r1+%%src_off]
+%endif ; %1 ==/!= top
+    mov          vall, [r1+%%src_off+2]
+%endif ; (%2-%%src_off) == 1/2/3
+%endmacro ; READ_NUM_BYTES
+
+%macro WRITE_NUM_BYTES 3
+%assign %%dst_off 0 ; offset in destination buffer
+%assign %%dmidx   0 ; mmx register idx
+%assign %%dxidx   0 ; xmm register idx
+
+%ifnidn %3, mmx
+%rep %2/16
+    movdqu [r0+%%dst_off], xmm %+ %%dxidx
+%assign %%dst_off %%dst_off+16
+%assign %%dxidx   %%dxidx+1
+%endrep ; %2/16
+%endif
+
+%ifdef ARCH_X86_64
+%if (%2-%%dst_off) == 8
+    mov    [r0+%%dst_off], rax
+%assign %%dst_off %%dst_off+8
+%endif ; (%2-%%dst_off) == 8
+%endif ; x86-64
+
+%rep (%2-%%dst_off)/8
+    movq   [r0+%%dst_off], mm %+ %%dmidx
+%assign %%dst_off %%dst_off+8
+%assign %%dmidx   %%dmidx+1
+%endrep ; (%2-%%dst_off)/8
+
+%if (%2-%%dst_off) == 4
+    mov    [r0+%%dst_off], vald
+%elif (%2-%%dst_off) & 4
+    movd   [r0+%%dst_off], mm %+ %%dmidx
+%assign %%dst_off %%dst_off+4
+%endif ; (%2-%%dst_off) ==/& 4
+
+%if (%2-%%dst_off) == 1
+    mov    [r0+%%dst_off], vall
+%elif (%2-%%dst_off) == 2
+    mov    [r0+%%dst_off], valw
+%elif (%2-%%dst_off) == 3
+%ifidn %1, top
+    mov    [r0+%%dst_off], valw2
+%elifidn %1, body
+    mov    [r0+%%dst_off], valw3
+%elifidn %1, bottom
+    mov    [r0+%%dst_off], valw4
+%endif ; %1 ==/!= top
+    mov  [r0+%%dst_off+2], vall
+%endif ; (%2-%%dst_off) == 1/2/3
+%endmacro ; WRITE_NUM_BYTES
+
+; vertical top/bottom extend and body copy fast loops
+; these are function pointers to set-width line copy functions, i.e.
+; they read a fixed number of pixels into set registers, and write
+; those out into the destination buffer
+; r0=buf,r1=src,r2=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h
+; r6(eax/64)/r3(ebx/32)=val_reg
+%macro VERTICAL_EXTEND 1
+%assign %%n 1
+%rep 22
+ALIGN 128
+.emuedge_v_extend_ %+ %%n:
+    ; extend pixels above body
+%ifdef ARCH_X86_64
+    test           r3 , r3                   ; if (!start_y)
+    jz .emuedge_copy_body_ %+ %%n %+ _loop   ;   goto body
+%else ; ARCH_X86_32
+    cmp      dword r3m, 0
+    je .emuedge_copy_body_ %+ %%n %+ _loop
+%endif ; ARCH_X86_64/32
+    READ_NUM_BYTES  top,    %%n, %1          ; read bytes
+.emuedge_extend_top_ %+ %%n %+ _loop:        ; do {
+    WRITE_NUM_BYTES top,    %%n, %1          ;   write bytes
+    add            r0 , r2                   ;   dst += linesize
+%ifdef ARCH_X86_64
+    dec            r3d
+%else ; ARCH_X86_32
+    dec      dword r3m
+%endif ; ARCH_X86_64/32
+    jnz .emuedge_extend_top_ %+ %%n %+ _loop ; } while (--start_y)
+
+    ; copy body pixels
+.emuedge_copy_body_ %+ %%n %+ _loop:         ; do {
+    READ_NUM_BYTES  body,   %%n, %1          ;   read bytes
+    WRITE_NUM_BYTES body,   %%n, %1          ;   write bytes
+    add            r0 , r2                   ;   dst += linesize
+    add            r1 , r2                   ;   src += linesize
+    dec            r4d
+    jnz .emuedge_copy_body_ %+ %%n %+ _loop  ; } while (--end_y)
+
+    ; copy bottom pixels
+    test           r5 , r5                   ; if (!block_h)
+    jz .emuedge_v_extend_end_ %+ %%n         ;   goto end
+    sub            r1 , r2                   ; src -= linesize
+    READ_NUM_BYTES  bottom, %%n, %1          ; read bytes
+.emuedge_extend_bottom_ %+ %%n %+ _loop:     ; do {
+    WRITE_NUM_BYTES bottom, %%n, %1          ;   write bytes
+    add            r0 , r2                   ;   dst += linesize
+    dec            r5d
+    jnz .emuedge_extend_bottom_ %+ %%n %+ _loop ; } while (--block_h)
+
+.emuedge_v_extend_end_ %+ %%n:
+%ifdef ARCH_X86_64
+    ret
+%else ; ARCH_X86_32
+    rep ret
+%endif ; ARCH_X86_64/32
+%assign %%n %%n+1
+%endrep
+%endmacro VERTICAL_EXTEND
+
+; left/right (horizontal) fast extend functions
+; these are essentially identical to the vertical extend ones above,
+; just left/right separated because number of pixels to extend is
+; obviously not the same on both sides.
+; for reading, pixels are placed in eax (x86-64) or ebx (x86-64) in the
+; lowest two bytes of the register (so val*0x0101), and are splatted
+; into each byte of mm0 as well if n_pixels >= 8
+
+%macro READ_V_PIXEL 3
+    mov        vall, %2
+    mov        valh, vall
+%if %1 >= 8
+    movd        mm0, vald
+%ifidn %3, mmx
+    punpcklwd   mm0, mm0
+    punpckldq   mm0, mm0
+%else ; !mmx
+    pshufw      mm0, mm0, 0
+%endif ; mmx
+%endif ; %1 >= 8
+%endmacro
+
+%macro WRITE_V_PIXEL 2
+%assign %%dst_off 0
+%rep %1/8
+    movq [%2+%%dst_off], mm0
+%assign %%dst_off %%dst_off+8
+%endrep
+%if %1 & 4
+%if %1 >= 8
+    movd [%2+%%dst_off], mm0
+%else ; %1 < 8
+    mov  [%2+%%dst_off]  , valw
+    mov  [%2+%%dst_off+2], valw
+%endif ; %1 >=/< 8
+%assign %%dst_off %%dst_off+4
+%endif ; %1 & 4
+%if %1&2
+    mov  [%2+%%dst_off], valw
+%endif ; %1 & 2
+%endmacro
+
+; r0=buf+block_h*linesize, r1=start_x, r2=linesize, r5=block_h, r6/r3=val
+%macro LEFT_EXTEND 1
+%assign %%n 2
+%rep 11
+ALIGN 64
+.emuedge_extend_left_ %+ %%n:          ; do {
+    sub         r0, r2                 ;   dst -= linesize
+    READ_V_PIXEL  %%n, [r0+r1], %1     ;   read pixels
+    WRITE_V_PIXEL %%n, r0              ;   write pixels
+    dec         r5
+    jnz .emuedge_extend_left_ %+ %%n   ; } while (--block_h)
+%ifdef ARCH_X86_64
+    ret
+%else ; ARCH_X86_32
+    rep ret
+%endif ; ARCH_X86_64/32
+%assign %%n %%n+2
+%endrep
+%endmacro ; LEFT_EXTEND
+
+; r3/r0=buf+block_h*linesize, r2=linesize, r11/r5=block_h, r0/r6=end_x, r6/r3=val
+%macro RIGHT_EXTEND 1
+%assign %%n 2
+%rep 11
+ALIGN 64
+.emuedge_extend_right_ %+ %%n:          ; do {
+%ifdef ARCH_X86_64
+    sub        r3, r2                   ;   dst -= linesize
+    READ_V_PIXEL  %%n, [r3+w_reg-1], %1 ;   read pixels
+    WRITE_V_PIXEL %%n, r3+r4-%%n        ;   write pixels
+    dec       r11
+%else ; ARCH_X86_32
+    sub        r0, r2                   ;   dst -= linesize
+    READ_V_PIXEL  %%n, [r0+w_reg-1], %1 ;   read pixels
+    WRITE_V_PIXEL %%n, r0+r4-%%n        ;   write pixels
+    dec     r5
+%endif ; ARCH_X86_64/32
+    jnz .emuedge_extend_right_ %+ %%n   ; } while (--block_h)
+%ifdef ARCH_X86_64
+    ret
+%else ; ARCH_X86_32
+    rep ret
+%endif ; ARCH_X86_64/32
+%assign %%n %%n+2
+%endrep
+
+%ifdef ARCH_X86_32
+%define stack_offset 0x10
+%endif
+%endmacro ; RIGHT_EXTEND
+
+; below follow the "slow" copy/extend functions, these act on a non-fixed
+; width specified in a register, and run a loop to copy the full amount
+; of bytes. They are optimized for copying of large amounts of pixels per
+; line, so they unconditionally splat data into mm registers to copy 8
+; bytes per loop iteration. It could be considered to use xmm for x86-64
+; also, but I haven't optimized this as much (i.e. FIXME)
+%macro V_COPY_NPX 4-5
+%if %0 == 4
+    test     w_reg, %4
+    jz .%1_skip_%4_px
+%else ; %0 == 5
+.%1_%4_px_loop:
+%endif
+    %3          %2, [r1+cnt_reg]
+    %3 [r0+cnt_reg], %2
+    add    cnt_reg, %4
+%if %0 == 5
+    sub      w_reg, %4
+    test     w_reg, %5
+    jnz .%1_%4_px_loop
+%endif
+.%1_skip_%4_px:
+%endmacro
+
+%macro V_COPY_ROW 3
+%ifidn %1, bottom
+    sub         r1, linesize
+%endif
+.%1_copy_loop:
+    xor    cnt_reg, cnt_reg
+%ifidn %3, mmx
+%define linesize r2m
+    V_COPY_NPX %1,  mm0, movq,    8, 0xFFFFFFF8
+%else ; !mmx
+    V_COPY_NPX %1, xmm0, movdqu, 16, 0xFFFFFFF0
+%ifdef ARCH_X86_64
+%define linesize r2
+    V_COPY_NPX %1, rax , mov,     8
+%else ; ARCH_X86_32
+%define linesize r2m
+    V_COPY_NPX %1,  mm0, movq,    8
+%endif ; ARCH_X86_64/32
+%endif ; mmx
+    V_COPY_NPX %1, vald, mov,     4
+    V_COPY_NPX %1, valw, mov,     2
+    V_COPY_NPX %1, vall, mov,     1
+    mov      w_reg, cnt_reg
+%ifidn %1, body
+    add         r1, linesize
+%endif
+    add         r0, linesize
+    dec         %2
+    jnz .%1_copy_loop
+%endmacro
+
+%macro SLOW_V_EXTEND 1
+.slow_v_extend_loop:
+; r0=buf,r1=src,r2(64)/r2m(32)=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h
+; r11(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r10(64)/r6(32)=w=end_x-start_x
+%ifdef ARCH_X86_64
+    push       r11              ; save old value of block_h
+    test        r3, r3
+%define cnt_reg r11
+    jz .do_body_copy            ; if (!start_y) goto do_body_copy
+    V_COPY_ROW top, r3, %1
+%else
+    cmp  dword r3m, 0
+%define cnt_reg r2
+    je .do_body_copy            ; if (!start_y) goto do_body_copy
+    V_COPY_ROW top, dword r3m, %1
+%endif
+
+.do_body_copy:
+    V_COPY_ROW body, r4, %1
+
+%ifdef ARCH_X86_64
+    pop        r11              ; restore old value of block_h
+%define cnt_reg r3
+%endif
+    test        r5, r5
+%ifdef ARCH_X86_64
+    jz .v_extend_end
+%else
+    jz .skip_bottom_extend
+%endif
+    V_COPY_ROW bottom, r5, %1
+%ifdef ARCH_X86_32
+.skip_bottom_extend:
+    mov         r2, r2m
+%endif
+    jmp .v_extend_end
+%endmacro
+
+%macro SLOW_LEFT_EXTEND 1
+.slow_left_extend_loop:
+; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r10/r6=start_x
+    mov         r4, 8
+    sub         r0, linesize
+    READ_V_PIXEL 8, [r0+w_reg], %1
+.left_extend_8px_loop:
+    movq [r0+r4-8], mm0
+    add         r4, 8
+    cmp         r4, w_reg
+    jle .left_extend_8px_loop
+    sub         r4, 8
+    cmp         r4, w_reg
+    jge .left_extend_loop_end
+.left_extend_2px_loop:
+    mov    [r0+r4], valw
+    add         r4, 2
+    cmp         r4, w_reg
+    jl .left_extend_2px_loop
+.left_extend_loop_end:
+    dec         r5
+    jnz .slow_left_extend_loop
+%ifdef ARCH_X86_32
+    mov         r2, r2m
+%endif
+    jmp .right_extend
+%endmacro
+
+%macro SLOW_RIGHT_EXTEND 1
+.slow_right_extend_loop:
+; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r11(64)/r5(32)=block_h,
+; r10(64)/r6(32)=end_x,r6/r3=val,r1=cntr
+%ifdef ARCH_X86_64
+%define buf_reg r3
+%define bh_reg r11
+%else
+%define buf_reg r0
+%define bh_reg r5
+%endif
+    lea         r1, [r4-8]
+    sub    buf_reg, linesize
+    READ_V_PIXEL 8, [buf_reg+w_reg-1], %1
+.right_extend_8px_loop:
+    movq [buf_reg+r1], mm0
+    sub         r1, 8
+    cmp         r1, w_reg
+    jge .right_extend_8px_loop
+    add         r1, 8
+    cmp         r1, w_reg
+    je .right_extend_loop_end
+.right_extend_2px_loop:
+    sub         r1, 2
+    mov [buf_reg+r1], valw
+    cmp         r1, w_reg
+    jg .right_extend_2px_loop
+.right_extend_loop_end:
+    dec         bh_reg
+    jnz .slow_right_extend_loop
+    jmp .h_extend_end
+%endmacro
+
+%macro emu_edge 1
+EMU_EDGE_FUNC     %1
+VERTICAL_EXTEND   %1
+LEFT_EXTEND       %1
+RIGHT_EXTEND      %1
+SLOW_V_EXTEND     %1
+SLOW_LEFT_EXTEND  %1
+SLOW_RIGHT_EXTEND %1
+%endmacro
+
+emu_edge sse
+%ifdef ARCH_X86_32
+emu_edge mmx
+%endif
diff --git a/ffmpeg-mt/libavcodec/x86/dsputilenc_mmx.c b/ffmpeg-mt/libavcodec/x86/dsputilenc_mmx.c
index f02d1ca..0373891 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputilenc_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/dsputilenc_mmx.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000, 2001 Fabrice Bellard
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  *
  * MMX optimization by Nick Kurshev <nickols_k at mail.ru>
@@ -35,7 +35,7 @@ static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
     __asm__ volatile(
         "mov $-128, %%"REG_a"           \n\t"
         "pxor %%mm7, %%mm7              \n\t"
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%0), %%mm0               \n\t"
         "movq (%0, %2), %%mm2           \n\t"
@@ -97,7 +97,7 @@ static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint
     __asm__ volatile(
         "pxor %%mm7, %%mm7              \n\t"
         "mov $-128, %%"REG_a"           \n\t"
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%0), %%mm0               \n\t"
         "movq (%1), %%mm2               \n\t"
@@ -1166,10 +1166,6 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
 #endif
         }
 
-        if (CONFIG_LPC && mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
-            c->lpc_compute_autocorr = ff_lpc_compute_autocorr_sse2;
-        }
-
 #if HAVE_SSSE3
         if(mm_flags & AV_CPU_FLAG_SSSE3){
             if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
diff --git a/ffmpeg-mt/libavcodec/x86/dsputilenc_yasm.asm b/ffmpeg-mt/libavcodec/x86/dsputilenc_yasm.asm
index b2844a5..eddfd36 100644
--- a/ffmpeg-mt/libavcodec/x86/dsputilenc_yasm.asm
+++ b/ffmpeg-mt/libavcodec/x86/dsputilenc_yasm.asm
@@ -4,20 +4,20 @@
 ;* Copyright (c) 2000, 2001 Fabrice Bellard
 ;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;*****************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/fdct_mmx.c b/ffmpeg-mt/libavcodec/x86/fdct_mmx.c
index c79a8df..f35a059 100644
--- a/ffmpeg-mt/libavcodec/x86/fdct_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/fdct_mmx.c
@@ -13,20 +13,20 @@
  * a page about fdct at http://www.geocities.com/ssavekar/dct.htm
  * Skal's fdct at http://skal.planet-d.net/coding/dct.html
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/fft.c b/ffmpeg-mt/libavcodec/x86/fft.c
index 771b1e6..2426a3d 100644
--- a/ffmpeg-mt/libavcodec/x86/fft.c
+++ b/ffmpeg-mt/libavcodec/x86/fft.c
@@ -1,23 +1,24 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/cpu.h"
 #include "libavcodec/dsputil.h"
+#include "libavcodec/dct.h"
 #include "fft.h"
 
 av_cold void ff_fft_init_mmx(FFTContext *s)
@@ -30,6 +31,7 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
         s->imdct_half  = ff_imdct_half_sse;
         s->fft_permute = ff_fft_permute_sse;
         s->fft_calc    = ff_fft_calc_sse;
+        s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
     } else if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {
         /* 3DNowEx for K7 */
         s->imdct_calc = ff_imdct_calc_3dn2;
diff --git a/ffmpeg-mt/libavcodec/x86/fft.h b/ffmpeg-mt/libavcodec/x86/fft.h
index 2affacb..073d408 100644
--- a/ffmpeg-mt/libavcodec/x86/fft.h
+++ b/ffmpeg-mt/libavcodec/x86/fft.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/fft_3dn.c b/ffmpeg-mt/libavcodec/x86/fft_3dn.c
index 6f2e2e8..5a4d3ad 100644
--- a/ffmpeg-mt/libavcodec/x86/fft_3dn.c
+++ b/ffmpeg-mt/libavcodec/x86/fft_3dn.c
@@ -2,20 +2,20 @@
  * FFT/MDCT transform with 3DNow! optimizations
  * Copyright (c) 2008 Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/fft_3dn2.c b/ffmpeg-mt/libavcodec/x86/fft_3dn2.c
index 2abb8cf..05c0467 100644
--- a/ffmpeg-mt/libavcodec/x86/fft_3dn2.c
+++ b/ffmpeg-mt/libavcodec/x86/fft_3dn2.c
@@ -2,20 +2,20 @@
  * FFT/MDCT transform with Extended 3DNow! optimizations
  * Copyright (c) 2006-2008 Zuxy MENG Jie, Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/fft_mmx.asm b/ffmpeg-mt/libavcodec/x86/fft_mmx.asm
index 1dcd629..e3829b8 100644
--- a/ffmpeg-mt/libavcodec/x86/fft_mmx.asm
+++ b/ffmpeg-mt/libavcodec/x86/fft_mmx.asm
@@ -5,20 +5,20 @@
 ;* This algorithm (though not any of the implementation details) is
 ;* based on libdjbfft by D. J. Bernstein.
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
@@ -51,6 +51,7 @@ SECTION_RODATA
 %define M_SQRT1_2 0.70710678118654752440
 ps_root2: times 4 dd M_SQRT1_2
 ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
+ps_p1p1m1p1: dd 0, 0, 1<<31, 0
 ps_m1p1: dd 1<<31, 0
 
 %assign i 16
@@ -95,54 +96,51 @@ section .text align=16
     SWAP     %3, %6
 %endmacro
 
-; in:  %1={r0,i0,r1,i1} %2={r2,i2,r3,i3}
+; in:  %1={r0,i0,r2,i2} %2={r1,i1,r3,i3}
 ; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3}
 %macro T4_SSE 3
     mova     %3, %1
-    shufps   %1, %2, 0x64 ; {r0,i0,r3,i2}
-    shufps   %3, %2, 0xce ; {r1,i1,r2,i3}
+    addps    %1, %2       ; {t1,t2,t6,t5}
+    subps    %3, %2       ; {t3,t4,-t8,t7}
+    xorps    %3, [ps_p1p1m1p1]
     mova     %2, %1
-    addps    %1, %3       ; {t1,t2,t6,t5}
-    subps    %2, %3       ; {t3,t4,t8,t7}
+    shufps   %1, %3, 0x44 ; {t1,t2,t3,t4}
+    shufps   %2, %3, 0xbe ; {t6,t5,t7,t8}
     mova     %3, %1
-    shufps   %1, %2, 0x44 ; {t1,t2,t3,t4}
-    shufps   %3, %2, 0xbe ; {t6,t5,t7,t8}
+    addps    %1, %2       ; {r0,i0,r1,i1}
+    subps    %3, %2       ; {r2,i2,r3,i3}
     mova     %2, %1
-    addps    %1, %3       ; {r0,i0,r1,i1}
-    subps    %2, %3       ; {r2,i2,r3,i3}
-    mova     %3, %1
-    shufps   %1, %2, 0x88 ; {r0,r1,r2,r3}
-    shufps   %3, %2, 0xdd ; {i0,i1,i2,i3}
-    SWAP     %2, %3
+    shufps   %1, %3, 0x88 ; {r0,r1,r2,r3}
+    shufps   %2, %3, 0xdd ; {i0,i1,i2,i3}
 %endmacro
 
-%macro T8_SSE 6 ; r0,i0,r1,i1,t0,t1
-    mova     %5, %3
-    shufps   %3, %4, 0x44 ; {r4,i4,r6,i6}
-    shufps   %5, %4, 0xee ; {r5,i5,r7,i7}
+; in:  %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %3={r4,i4,r6,i6} %4={r5,i5,r7,i7}
+; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %1={r4,r5,r6,r7} %2={i4,i5,i6,i7}
+%macro T8_SSE 6
     mova     %6, %3
-    subps    %3, %5       ; {r5,i5,r7,i7}
-    addps    %6, %5       ; {t1,t2,t3,t4}
-    mova     %5, %3
-    shufps   %5, %5, 0xb1 ; {i5,r5,i7,r7}
+    subps    %3, %4       ; {r5,i5,r7,i7}
+    addps    %6, %4       ; {t1,t2,t3,t4}
+    mova     %4, %3
+    shufps   %4, %4, 0xb1 ; {i5,r5,i7,r7}
     mulps    %3, [ps_root2mppm] ; {-r5,i5,r7,-i7}
-    mulps    %5, [ps_root2]
-    addps    %3, %5       ; {t8,t7,ta,t9}
-    mova     %5, %6
+    mulps    %4, [ps_root2]
+    addps    %3, %4       ; {t8,t7,ta,t9}
+    mova     %4, %6
     shufps   %6, %3, 0x36 ; {t3,t2,t9,t8}
-    shufps   %5, %3, 0x9c ; {t1,t4,t7,ta}
+    shufps   %4, %3, 0x9c ; {t1,t4,t7,ta}
     mova     %3, %6
-    addps    %6, %5       ; {t1,t2,t9,ta}
-    subps    %3, %5       ; {t6,t5,tc,tb}
-    mova     %5, %6
+    addps    %6, %4       ; {t1,t2,t9,ta}
+    subps    %3, %4       ; {t6,t5,tc,tb}
+    mova     %4, %6
     shufps   %6, %3, 0xd8 ; {t1,t9,t5,tb}
-    shufps   %5, %3, 0x8d ; {t2,ta,t6,tc}
+    shufps   %4, %3, 0x8d ; {t2,ta,t6,tc}
     mova     %3, %1
-    mova     %4, %2
+    mova     %5, %2
     addps    %1, %6       ; {r0,r1,r2,r3}
-    addps    %2, %5       ; {i0,i1,i2,i3}
+    addps    %2, %4       ; {i0,i1,i2,i3}
     subps    %3, %6       ; {r4,r5,r6,r7}
-    subps    %4, %5       ; {i4,i5,i6,i7}
+    subps    %5, %4       ; {i4,i5,i6,i7}
+    SWAP     %4, %5
 %endmacro
 
 ; scheduled for cpu-bound sizes
diff --git a/ffmpeg-mt/libavcodec/x86/fft_sse.c b/ffmpeg-mt/libavcodec/x86/fft_sse.c
index 9f02816..9de4e4c 100644
--- a/ffmpeg-mt/libavcodec/x86/fft_sse.c
+++ b/ffmpeg-mt/libavcodec/x86/fft_sse.c
@@ -2,20 +2,20 @@
  * FFT/MDCT transform with SSE optimizations
  * Copyright (c) 2008 Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 #include "libavcodec/dsputil.h"
 #include "fft.h"
 
-DECLARE_ALIGNED(16, static const int, m1m1m1m1)[4] =
+DECLARE_ASM_CONST(16, int, ff_m1m1m1m1)[4] =
     { 1 << 31, 1 << 31, 1 << 31, 1 << 31 };
 
 void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
@@ -82,7 +82,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
     j = -n;
     k = n-16;
     __asm__ volatile(
-        "movaps %4, %%xmm7 \n"
+        "movaps "MANGLE(ff_m1m1m1m1)", %%xmm7 \n"
         "1: \n"
         "movaps       (%2,%1), %%xmm0 \n"
         "movaps       (%3,%0), %%xmm1 \n"
@@ -95,8 +95,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
         "add $16, %0 \n"
         "jl 1b \n"
         :"+r"(j), "+r"(k)
-        :"r"(output+n4), "r"(output+n4*3),
-         "m"(*m1m1m1m1)
+        :"r"(output+n4), "r"(output+n4*3)
         XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm7")
     );
 }
diff --git a/ffmpeg-mt/libavcodec/x86/fmtconvert.asm b/ffmpeg-mt/libavcodec/x86/fmtconvert.asm
new file mode 100644
index 0000000..ddcbab4
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/x86/fmtconvert.asm
@@ -0,0 +1,91 @@
+;******************************************************************************
+;* x86 optimized Format Conversion Utils
+;* Copyright (c) 2008 Loren Merritt
+;*
+;* This file is part of Libav.
+;*
+;* Libav is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* Libav is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with Libav; if not, write to the Free Software
+;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;******************************************************************************
+
+%include "x86inc.asm"
+
+section .text align=16
+
+%macro PSWAPD_SSE 2
+    pshufw %1, %2, 0x4e
+%endmacro
+%macro PSWAPD_3DN1 2
+    movq  %1, %2
+    psrlq %1, 32
+    punpckldq %1, %2
+%endmacro
+
+%macro FLOAT_TO_INT16_INTERLEAVE6 1
+; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
+cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5
+%ifdef ARCH_X86_64
+    %define lend r10d
+    mov     lend, r2d
+%else
+    %define lend dword r2m
+%endif
+    mov src1q, [srcq+1*gprsize]
+    mov src2q, [srcq+2*gprsize]
+    mov src3q, [srcq+3*gprsize]
+    mov src4q, [srcq+4*gprsize]
+    mov src5q, [srcq+5*gprsize]
+    mov srcq,  [srcq]
+    sub src1q, srcq
+    sub src2q, srcq
+    sub src3q, srcq
+    sub src4q, srcq
+    sub src5q, srcq
+.loop:
+    cvtps2pi   mm0, [srcq]
+    cvtps2pi   mm1, [srcq+src1q]
+    cvtps2pi   mm2, [srcq+src2q]
+    cvtps2pi   mm3, [srcq+src3q]
+    cvtps2pi   mm4, [srcq+src4q]
+    cvtps2pi   mm5, [srcq+src5q]
+    packssdw   mm0, mm3
+    packssdw   mm1, mm4
+    packssdw   mm2, mm5
+    pswapd     mm3, mm0
+    punpcklwd  mm0, mm1
+    punpckhwd  mm1, mm2
+    punpcklwd  mm2, mm3
+    pswapd     mm3, mm0
+    punpckldq  mm0, mm2
+    punpckhdq  mm2, mm1
+    punpckldq  mm1, mm3
+    movq [dstq   ], mm0
+    movq [dstq+16], mm2
+    movq [dstq+ 8], mm1
+    add srcq, 8
+    add dstq, 24
+    sub lend, 2
+    jg .loop
+    emms
+    RET
+%endmacro ; FLOAT_TO_INT16_INTERLEAVE6
+
+%define pswapd PSWAPD_SSE
+FLOAT_TO_INT16_INTERLEAVE6 sse
+%define cvtps2pi pf2id
+%define pswapd PSWAPD_3DN1
+FLOAT_TO_INT16_INTERLEAVE6 3dnow
+%undef pswapd
+FLOAT_TO_INT16_INTERLEAVE6 3dn2
+%undef cvtps2pi
diff --git a/ffmpeg-mt/libavcodec/x86/fmtconvert_mmx.c b/ffmpeg-mt/libavcodec/x86/fmtconvert_mmx.c
new file mode 100644
index 0000000..847bd80
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/x86/fmtconvert_mmx.c
@@ -0,0 +1,266 @@
+/*
+ * Format Conversion Utils
+ * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * MMX optimization by Nick Kurshev <nickols_k at mail.ru>
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86_cpu.h"
+#include "libavcodec/fmtconvert.h"
+
+static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len)
+{
+    x86_reg i = -4*len;
+    __asm__ volatile(
+        "movss  %3, %%xmm4 \n"
+        "shufps $0, %%xmm4, %%xmm4 \n"
+        "1: \n"
+        "cvtpi2ps   (%2,%0), %%xmm0 \n"
+        "cvtpi2ps  8(%2,%0), %%xmm1 \n"
+        "cvtpi2ps 16(%2,%0), %%xmm2 \n"
+        "cvtpi2ps 24(%2,%0), %%xmm3 \n"
+        "movlhps  %%xmm1,    %%xmm0 \n"
+        "movlhps  %%xmm3,    %%xmm2 \n"
+        "mulps    %%xmm4,    %%xmm0 \n"
+        "mulps    %%xmm4,    %%xmm2 \n"
+        "movaps   %%xmm0,   (%1,%0) \n"
+        "movaps   %%xmm2, 16(%1,%0) \n"
+        "add $32, %0 \n"
+        "jl 1b \n"
+        :"+r"(i)
+        :"r"(dst+len), "r"(src+len), "m"(mul)
+    );
+}
+
+static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len)
+{
+    x86_reg i = -4*len;
+    __asm__ volatile(
+        "movss  %3, %%xmm4 \n"
+        "shufps $0, %%xmm4, %%xmm4 \n"
+        "1: \n"
+        "cvtdq2ps   (%2,%0), %%xmm0 \n"
+        "cvtdq2ps 16(%2,%0), %%xmm1 \n"
+        "mulps    %%xmm4,    %%xmm0 \n"
+        "mulps    %%xmm4,    %%xmm1 \n"
+        "movaps   %%xmm0,   (%1,%0) \n"
+        "movaps   %%xmm1, 16(%1,%0) \n"
+        "add $32, %0 \n"
+        "jl 1b \n"
+        :"+r"(i)
+        :"r"(dst+len), "r"(src+len), "m"(mul)
+    );
+}
+
+static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){
+    x86_reg reglen = len;
+    // not bit-exact: pf2id uses different rounding than C and SSE
+    __asm__ volatile(
+        "add        %0          , %0        \n\t"
+        "lea         (%2,%0,2)  , %2        \n\t"
+        "add        %0          , %1        \n\t"
+        "neg        %0                      \n\t"
+        "1:                                 \n\t"
+        "pf2id       (%2,%0,2)  , %%mm0     \n\t"
+        "pf2id      8(%2,%0,2)  , %%mm1     \n\t"
+        "pf2id     16(%2,%0,2)  , %%mm2     \n\t"
+        "pf2id     24(%2,%0,2)  , %%mm3     \n\t"
+        "packssdw   %%mm1       , %%mm0     \n\t"
+        "packssdw   %%mm3       , %%mm2     \n\t"
+        "movq       %%mm0       ,  (%1,%0)  \n\t"
+        "movq       %%mm2       , 8(%1,%0)  \n\t"
+        "add        $16         , %0        \n\t"
+        " js 1b                             \n\t"
+        "femms                              \n\t"
+        :"+r"(reglen), "+r"(dst), "+r"(src)
+    );
+}
+
+static void float_to_int16_sse(int16_t *dst, const float *src, long len){
+    x86_reg reglen = len;
+    __asm__ volatile(
+        "add        %0          , %0        \n\t"
+        "lea         (%2,%0,2)  , %2        \n\t"
+        "add        %0          , %1        \n\t"
+        "neg        %0                      \n\t"
+        "1:                                 \n\t"
+        "cvtps2pi    (%2,%0,2)  , %%mm0     \n\t"
+        "cvtps2pi   8(%2,%0,2)  , %%mm1     \n\t"
+        "cvtps2pi  16(%2,%0,2)  , %%mm2     \n\t"
+        "cvtps2pi  24(%2,%0,2)  , %%mm3     \n\t"
+        "packssdw   %%mm1       , %%mm0     \n\t"
+        "packssdw   %%mm3       , %%mm2     \n\t"
+        "movq       %%mm0       ,  (%1,%0)  \n\t"
+        "movq       %%mm2       , 8(%1,%0)  \n\t"
+        "add        $16         , %0        \n\t"
+        " js 1b                             \n\t"
+        "emms                               \n\t"
+        :"+r"(reglen), "+r"(dst), "+r"(src)
+    );
+}
+
+static void float_to_int16_sse2(int16_t *dst, const float *src, long len){
+    x86_reg reglen = len;
+    __asm__ volatile(
+        "add        %0          , %0        \n\t"
+        "lea         (%2,%0,2)  , %2        \n\t"
+        "add        %0          , %1        \n\t"
+        "neg        %0                      \n\t"
+        "1:                                 \n\t"
+        "cvtps2dq    (%2,%0,2)  , %%xmm0    \n\t"
+        "cvtps2dq  16(%2,%0,2)  , %%xmm1    \n\t"
+        "packssdw   %%xmm1      , %%xmm0    \n\t"
+        "movdqa     %%xmm0      ,  (%1,%0)  \n\t"
+        "add        $16         , %0        \n\t"
+        " js 1b                             \n\t"
+        :"+r"(reglen), "+r"(dst), "+r"(src)
+    );
+}
+
+void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len);
+void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len);
+void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len);
+
+#if !HAVE_YASM
+#define ff_float_to_int16_interleave6_sse(a,b,c)   float_to_int16_interleave_misc_sse(a,b,c,6)
+#define ff_float_to_int16_interleave6_3dnow(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6)
+#define ff_float_to_int16_interleave6_3dn2(a,b,c)  float_to_int16_interleave_misc_3dnow(a,b,c,6)
+#endif
+#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse
+
+#define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \
+/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\
+static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\
+    DECLARE_ALIGNED(16, int16_t, tmp)[len];\
+    int i,j,c;\
+    for(c=0; c<channels; c++){\
+        float_to_int16_##cpu(tmp, src[c], len);\
+        for(i=0, j=c; i<len; i++, j+=channels)\
+            dst[j] = tmp[i];\
+    }\
+}\
+\
+static void float_to_int16_interleave_##cpu(int16_t *dst, const float **src, long len, int channels){\
+    if(channels==1)\
+        float_to_int16_##cpu(dst, src[0], len);\
+    else if(channels==2){\
+        x86_reg reglen = len; \
+        const float *src0 = src[0];\
+        const float *src1 = src[1];\
+        __asm__ volatile(\
+            "shl $2, %0 \n"\
+            "add %0, %1 \n"\
+            "add %0, %2 \n"\
+            "add %0, %3 \n"\
+            "neg %0 \n"\
+            body\
+            :"+r"(reglen), "+r"(dst), "+r"(src0), "+r"(src1)\
+        );\
+    }else if(channels==6){\
+        ff_float_to_int16_interleave6_##cpu(dst, src, len);\
+    }else\
+        float_to_int16_interleave_misc_##cpu(dst, src, len, channels);\
+}
+
+FLOAT_TO_INT16_INTERLEAVE(3dnow,
+    "1:                         \n"
+    "pf2id     (%2,%0), %%mm0   \n"
+    "pf2id    8(%2,%0), %%mm1   \n"
+    "pf2id     (%3,%0), %%mm2   \n"
+    "pf2id    8(%3,%0), %%mm3   \n"
+    "packssdw    %%mm1, %%mm0   \n"
+    "packssdw    %%mm3, %%mm2   \n"
+    "movq        %%mm0, %%mm1   \n"
+    "punpcklwd   %%mm2, %%mm0   \n"
+    "punpckhwd   %%mm2, %%mm1   \n"
+    "movq        %%mm0,  (%1,%0)\n"
+    "movq        %%mm1, 8(%1,%0)\n"
+    "add $16, %0                \n"
+    "js 1b                      \n"
+    "femms                      \n"
+)
+
+FLOAT_TO_INT16_INTERLEAVE(sse,
+    "1:                         \n"
+    "cvtps2pi  (%2,%0), %%mm0   \n"
+    "cvtps2pi 8(%2,%0), %%mm1   \n"
+    "cvtps2pi  (%3,%0), %%mm2   \n"
+    "cvtps2pi 8(%3,%0), %%mm3   \n"
+    "packssdw    %%mm1, %%mm0   \n"
+    "packssdw    %%mm3, %%mm2   \n"
+    "movq        %%mm0, %%mm1   \n"
+    "punpcklwd   %%mm2, %%mm0   \n"
+    "punpckhwd   %%mm2, %%mm1   \n"
+    "movq        %%mm0,  (%1,%0)\n"
+    "movq        %%mm1, 8(%1,%0)\n"
+    "add $16, %0                \n"
+    "js 1b                      \n"
+    "emms                       \n"
+)
+
+FLOAT_TO_INT16_INTERLEAVE(sse2,
+    "1:                         \n"
+    "cvtps2dq  (%2,%0), %%xmm0  \n"
+    "cvtps2dq  (%3,%0), %%xmm1  \n"
+    "packssdw   %%xmm1, %%xmm0  \n"
+    "movhlps    %%xmm0, %%xmm1  \n"
+    "punpcklwd  %%xmm1, %%xmm0  \n"
+    "movdqa     %%xmm0, (%1,%0) \n"
+    "add $16, %0                \n"
+    "js 1b                      \n"
+)
+
+static void float_to_int16_interleave_3dn2(int16_t *dst, const float **src, long len, int channels){
+    if(channels==6)
+        ff_float_to_int16_interleave6_3dn2(dst, src, len);
+    else
+        float_to_int16_interleave_3dnow(dst, src, len, channels);
+}
+
+void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx)
+{
+    int mm_flags = av_get_cpu_flags();
+
+    if (mm_flags & AV_CPU_FLAG_MMX) {
+
+        if(mm_flags & AV_CPU_FLAG_3DNOW){
+            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
+                c->float_to_int16 = float_to_int16_3dnow;
+                c->float_to_int16_interleave = float_to_int16_interleave_3dnow;
+            }
+        }
+        if(mm_flags & AV_CPU_FLAG_3DNOWEXT){
+            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
+                c->float_to_int16_interleave = float_to_int16_interleave_3dn2;
+            }
+        }
+        if(mm_flags & AV_CPU_FLAG_SSE){
+            c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse;
+            c->float_to_int16 = float_to_int16_sse;
+            c->float_to_int16_interleave = float_to_int16_interleave_sse;
+        }
+        if(mm_flags & AV_CPU_FLAG_SSE2){
+            c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2;
+            c->float_to_int16 = float_to_int16_sse2;
+            c->float_to_int16_interleave = float_to_int16_interleave_sse2;
+        }
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/x86/h264_chromamc.asm b/ffmpeg-mt/libavcodec/x86/h264_chromamc.asm
index 3bb5ed4..99faf44 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_chromamc.asm
+++ b/ffmpeg-mt/libavcodec/x86/h264_chromamc.asm
@@ -3,20 +3,20 @@
 ;* Copyright (c) 2005 Zoltan Hidvegi <hzoli -a- hzoli -d- com>,
 ;*               2005-2008 Loren Merritt
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/h264_deblock.asm b/ffmpeg-mt/libavcodec/x86/h264_deblock.asm
index fb9cacf..01778a4 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_deblock.asm
+++ b/ffmpeg-mt/libavcodec/x86/h264_deblock.asm
@@ -6,20 +6,20 @@
 ;* Authors: Loren Merritt <lorenm at u.washington.edu>
 ;*          Jason Garrett-Glaser <darkshikari at gmail.com>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/h264_i386.h b/ffmpeg-mt/libavcodec/x86/h264_i386.h
index 26c163b..c850dc2 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_i386.h
+++ b/ffmpeg-mt/libavcodec/x86/h264_i386.h
@@ -2,20 +2,20 @@
  * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/h264_idct.asm b/ffmpeg-mt/libavcodec/x86/h264_idct.asm
index fdb3500..a1adb9e 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_idct.asm
+++ b/ffmpeg-mt/libavcodec/x86/h264_idct.asm
@@ -9,20 +9,20 @@
 ;*          Holger Lubitz <hal at duncan.ol.sub.de>
 ;*          Min Chen <chenm001.163.com>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;*****************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/h264_intrapred.asm b/ffmpeg-mt/libavcodec/x86/h264_intrapred.asm
index afe6426..1b18932 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_intrapred.asm
+++ b/ffmpeg-mt/libavcodec/x86/h264_intrapred.asm
@@ -5,20 +5,20 @@
 ;* Copyright (c) 2010 Loren Merritt
 ;* Copyright (c) 2010 Ronald S. Bultje
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
@@ -637,10 +637,6 @@ cglobal pred8x8_plane_%1, 2, 7, %2
 %endif
     paddw        m0, m1           ; sum of H coefficients
 
-    pmullw       m0, [pw_17]
-    paddw        m0, [pw_16]
-    psraw        m0, 5
-
     lea          r4, [r0+r2*4-1]
     lea          r3, [r0     -1]
     add          r4, r2
@@ -694,6 +690,10 @@ cglobal pred8x8_plane_%1, 2, 7, %2
     shl          r3, 4
     movd        r1d, m0
     movsx       r1d, r1w
+    imul        r1d, 17
+    add         r1d, 16
+    sar         r1d, 5
+    movd         m0, r1d
     add         r1d, r5d
     sub         r3d, r1d
     add         r1d, r1d
@@ -1249,7 +1249,10 @@ cglobal pred8x8l_horizontal_%1, 4,4
     sub          r0, r3
     lea          r2, [r0+r3*2]
     movq        mm0, [r0+r3*1-8]
-    punpckhbw   mm0, [r0+r3*0-8]
+    test         r1, r1
+    lea          r1, [r0+r3]
+    cmovnz       r1, r0
+    punpckhbw   mm0, [r1+r3*0-8]
     movq        mm1, [r2+r3*1-8]
     punpckhbw   mm1, [r0+r3*2-8]
     mov          r2, r0
@@ -1264,21 +1267,12 @@ cglobal pred8x8l_horizontal_%1, 4,4
     punpckhdq   mm3, mm1
     lea          r0, [r0+r3*2]
     movq        mm0, [r0+r3*0-8]
-    movq        mm1, [r2]
+    movq        mm1, [r1+r3*0-8]
     mov          r0, r2
     movq        mm4, mm3
     movq        mm2, mm3
     PALIGNR     mm4, mm0, 7, mm0
     PALIGNR     mm1, mm2, 1, mm2
-    test        r1, r1 ; top_left
-    jnz .do_left
-.fix_lt_1:
-    movq        mm5, mm3
-    pxor        mm5, mm4
-    psrlq       mm5, 56
-    psllq       mm5, 48
-    pxor        mm1, mm5
-.do_left:
     movq        mm0, mm4
     PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
     movq        mm4, mm0
@@ -2153,7 +2147,10 @@ cglobal pred8x8l_horizontal_up_%1, 4,4
     sub          r0, r3
     lea          r2, [r0+r3*2]
     movq        mm0, [r0+r3*1-8]
-    punpckhbw   mm0, [r0+r3*0-8]
+    test         r1, r1
+    lea          r1, [r0+r3]
+    cmovnz       r1, r0
+    punpckhbw   mm0, [r1+r3*0-8]
     movq        mm1, [r2+r3*1-8]
     punpckhbw   mm1, [r0+r3*2-8]
     mov          r2, r0
@@ -2168,21 +2165,12 @@ cglobal pred8x8l_horizontal_up_%1, 4,4
     punpckhdq   mm3, mm1
     lea          r0, [r0+r3*2]
     movq        mm0, [r0+r3*0-8]
-    movq        mm1, [r2]
+    movq        mm1, [r1+r3*0-8]
     mov          r0, r2
     movq        mm4, mm3
     movq        mm2, mm3
     PALIGNR     mm4, mm0, 7, mm0
     PALIGNR     mm1, mm2, 1, mm2
-    test        r1, r1
-    jnz .do_left
-.fix_lt_1:
-    movq        mm5, mm3
-    pxor        mm5, mm4
-    psrlq       mm5, 56
-    psllq       mm5, 48
-    pxor        mm1, mm5
-.do_left:
     movq       mm0, mm4
     PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
     movq       mm4, mm0
diff --git a/ffmpeg-mt/libavcodec/x86/h264_intrapred_init.c b/ffmpeg-mt/libavcodec/x86/h264_intrapred_init.c
index e93fb91..4142cc1 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_intrapred_init.c
+++ b/ffmpeg-mt/libavcodec/x86/h264_intrapred_init.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Jason Garrett-Glaser
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/h264_qpel_mmx.c b/ffmpeg-mt/libavcodec/x86/h264_qpel_mmx.c
index d8ceca1..066f794 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_qpel_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/h264_qpel_mmx.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/h264_weight.asm b/ffmpeg-mt/libavcodec/x86/h264_weight.asm
index 53aa210..05769fc 100644
--- a/ffmpeg-mt/libavcodec/x86/h264_weight.asm
+++ b/ffmpeg-mt/libavcodec/x86/h264_weight.asm
@@ -4,20 +4,20 @@
 ;* Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
 ;* Copyright (C) 2010 Eli Friedman <eli.friedman at gmail.com>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/h264dsp_mmx.c b/ffmpeg-mt/libavcodec/x86/h264dsp_mmx.c
index d9e45f8..9f004a5 100644
--- a/ffmpeg-mt/libavcodec/x86/h264dsp_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/h264dsp_mmx.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/idct_mmx_xvid.c b/ffmpeg-mt/libavcodec/x86/idct_mmx_xvid.c
index 466cf75..3055205 100644
--- a/ffmpeg-mt/libavcodec/x86/idct_mmx_xvid.c
+++ b/ffmpeg-mt/libavcodec/x86/idct_mmx_xvid.c
@@ -22,20 +22,20 @@
  *
  * conversion to gcc syntax by Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public License
- * along with FFmpeg; if not, write to the Free Software Foundation,
+ * along with Libav; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/idct_sse2_xvid.c b/ffmpeg-mt/libavcodec/x86/idct_sse2_xvid.c
index edf6581..4b6885f 100644
--- a/ffmpeg-mt/libavcodec/x86/idct_sse2_xvid.c
+++ b/ffmpeg-mt/libavcodec/x86/idct_sse2_xvid.c
@@ -9,7 +9,7 @@
  *
  * Originally from dct/x86_asm/fdct_sse2_skal.asm in Xvid.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
  * Vertical pass is an implementation of the scheme:
  *  Loeffler C., Ligtenberg A., and Moschytz C.S.:
@@ -23,18 +23,18 @@
  *
  * More details at http://skal.planet-d.net/coding/dct.html
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public License
- * along with FFmpeg; if not, write to the Free Software Foundation,
+ * along with Libav; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -356,7 +356,7 @@ inline void ff_idct_xvid_sse2(short *block)
     TEST_TWO_ROWS("5*16(%0)", "6*16(%0)", "%%eax", "%%edx", CLEAR_ODD(ROW5), CLEAR_EVEN(ROW6))
     TEST_ONE_ROW("7*16(%0)", "%%esi", CLEAR_ODD(ROW7))
     iLLM_HEAD
-    ASMALIGN(4)
+    ".p2align 4 \n\t"
     JNZ("%%ecx", "2f")
     JNZ("%%eax", "3f")
     JNZ("%%edx", "4f")
diff --git a/ffmpeg-mt/libavcodec/x86/idct_xvid.h b/ffmpeg-mt/libavcodec/x86/idct_xvid.h
index 5fdc20d..1ff039d 100644
--- a/ffmpeg-mt/libavcodec/x86/idct_xvid.h
+++ b/ffmpeg-mt/libavcodec/x86/idct_xvid.h
@@ -1,20 +1,20 @@
 /*
  * XVID MPEG-4 VIDEO CODEC
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/lpc_mmx.c b/ffmpeg-mt/libavcodec/x86/lpc_mmx.c
index 49eb569..d41c19b 100644
--- a/ffmpeg-mt/libavcodec/x86/lpc_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/lpc_mmx.c
@@ -2,27 +2,29 @@
  * MMX optimized LPC DSP utils
  * Copyright (c) 2007 Loren Merritt
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/x86_cpu.h"
-#include "dsputil_mmx.h"
+#include "libavutil/cpu.h"
+#include "libavcodec/lpc.h"
 
-static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data)
+static void lpc_apply_welch_window_sse2(const int32_t *data, int len,
+                                        double *w_data)
 {
     double c = 2.0 / (len-1.0);
     int n2 = len>>1;
@@ -68,21 +70,13 @@ static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data
 #undef WELCH
 }
 
-void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag,
-                                   double *autoc)
+static void lpc_compute_autocorr_sse2(const double *data, int len, int lag,
+                                      double *autoc)
 {
-    double tmp[len + lag + 2];
-    double *data1 = tmp + lag;
     int j;
 
-    if((x86_reg)data1 & 15)
-        data1++;
-
-    apply_welch_window_sse2(data, len, data1);
-
-    for(j=0; j<lag; j++)
-        data1[j-lag]= 0.0;
-    data1[len] = 0.0;
+    if((x86_reg)data & 15)
+        data++;
 
     for(j=0; j<lag; j+=2){
         x86_reg i = -len*sizeof(double);
@@ -113,7 +107,7 @@ void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag,
                 "movsd     %%xmm1,  8(%1)           \n\t"
                 "movsd     %%xmm2, 16(%1)           \n\t"
                 :"+&r"(i)
-                :"r"(autoc+j), "r"(data1+len), "r"(data1+len-j)
+                :"r"(autoc+j), "r"(data+len), "r"(data+len-j)
                 :"memory"
             );
         } else {
@@ -136,8 +130,18 @@ void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag,
                 "movsd     %%xmm0, %1               \n\t"
                 "movsd     %%xmm1, %2               \n\t"
                 :"+&r"(i), "=m"(autoc[j]), "=m"(autoc[j+1])
-                :"r"(data1+len), "r"(data1+len-j)
+                :"r"(data+len), "r"(data+len-j)
             );
         }
     }
 }
+
+av_cold void ff_lpc_init_x86(LPCContext *c)
+{
+    int mm_flags = av_get_cpu_flags();
+
+    if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
+        c->lpc_apply_welch_window = lpc_apply_welch_window_sse2;
+        c->lpc_compute_autocorr   = lpc_compute_autocorr_sse2;
+    }
+}
diff --git a/ffmpeg-mt/libavcodec/x86/mathops.h b/ffmpeg-mt/libavcodec/x86/mathops.h
index 5949dfe..50b0283 100644
--- a/ffmpeg-mt/libavcodec/x86/mathops.h
+++ b/ffmpeg-mt/libavcodec/x86/mathops.h
@@ -2,20 +2,20 @@
  * simple math operations
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,24 +26,45 @@
 #include "libavutil/common.h"
 
 #if ARCH_X86_32
-#define MULL(ra, rb, shift) \
-        ({ int rt, dummy; __asm__ (\
-            "imull %3               \n\t"\
-            "shrdl %4, %%edx, %%eax \n\t"\
-            : "=a"(rt), "=d"(dummy)\
-            : "a" ((int)(ra)), "rm" ((int)(rb)), "i"(shift));\
-         rt; })
 
-#define MULH(ra, rb) \
-    ({ int rt, dummy;\
-     __asm__ ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" ((int)(ra)), "rm" ((int)(rb)));\
-     rt; })
+#define MULL MULL
+static av_always_inline av_const int MULL(int a, int b, unsigned shift)
+{
+    int rt, dummy;
+    __asm__ (
+        "imull %3               \n\t"
+        "shrdl %4, %%edx, %%eax \n\t"
+        :"=a"(rt), "=d"(dummy)
+        :"a"(a), "rm"(b), "ci"((uint8_t)shift)
+    );
+    return rt;
+}
 
-#define MUL64(ra, rb) \
-    ({ int64_t rt;\
-     __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)(ra)), "g" ((int)(rb)));\
-     rt; })
-#endif
+#define MULH MULH
+static av_always_inline av_const int MULH(int a, int b)
+{
+    int rt, dummy;
+    __asm__ (
+        "imull %3"
+        :"=d"(rt), "=a"(dummy)
+        :"a"(a), "rm"(b)
+    );
+    return rt;
+}
+
+#define MUL64 MUL64
+static av_always_inline av_const int64_t MUL64(int a, int b)
+{
+    int64_t rt;
+    __asm__ (
+        "imull %2"
+        :"=A"(rt)
+        :"a"(a), "rm"(b)
+    );
+    return rt;
+}
+
+#endif /* ARCH_X86_32 */
 
 #if HAVE_CMOV
 /* median of 3 */
diff --git a/ffmpeg-mt/libavcodec/x86/mlpdsp.c b/ffmpeg-mt/libavcodec/x86/mlpdsp.c
index 486a927..333dc56 100644
--- a/ffmpeg-mt/libavcodec/x86/mlpdsp.c
+++ b/ffmpeg-mt/libavcodec/x86/mlpdsp.c
@@ -2,20 +2,20 @@
  * MLP DSP functions x86-optimized
  * Copyright (c) 2009 Ramiro Polla
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/motion_est_mmx.c b/ffmpeg-mt/libavcodec/x86/motion_est_mmx.c
index e1314ae..948af98 100644
--- a/ffmpeg-mt/libavcodec/x86/motion_est_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/motion_est_mmx.c
@@ -5,20 +5,20 @@
  *
  * mostly by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -38,7 +38,7 @@ static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
 {
     x86_reg len= -(stride*h);
     __asm__ volatile(
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%1, %%"REG_a"), %%mm0    \n\t"
         "movq (%2, %%"REG_a"), %%mm2    \n\t"
@@ -73,7 +73,7 @@ static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
 static inline void sad8_1_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
 {
     __asm__ volatile(
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%1), %%mm0               \n\t"
         "movq (%1, %3), %%mm1           \n\t"
@@ -95,7 +95,7 @@ static int sad16_sse2(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)
     int ret;
     __asm__ volatile(
         "pxor %%xmm2, %%xmm2            \n\t"
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movdqu (%1), %%xmm0            \n\t"
         "movdqu (%1, %4), %%xmm1        \n\t"
@@ -119,7 +119,7 @@ static int sad16_sse2(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)
 static inline void sad8_x2a_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
 {
     __asm__ volatile(
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%1), %%mm0               \n\t"
         "movq (%1, %3), %%mm1           \n\t"
@@ -143,7 +143,7 @@ static inline void sad8_y2a_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h
     __asm__ volatile(
         "movq (%1), %%mm0               \n\t"
         "add %3, %1                     \n\t"
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%1), %%mm1               \n\t"
         "movq (%1, %3), %%mm2           \n\t"
@@ -170,7 +170,7 @@ static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
         "movq (%1), %%mm0               \n\t"
         "pavgb 1(%1), %%mm0             \n\t"
         "add %3, %1                     \n\t"
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%1), %%mm1               \n\t"
         "movq (%1,%3), %%mm2            \n\t"
@@ -197,7 +197,7 @@ static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int
 {
     x86_reg len= -(stride*h);
     __asm__ volatile(
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%1, %%"REG_a"), %%mm0    \n\t"
         "movq (%2, %%"REG_a"), %%mm1    \n\t"
@@ -245,7 +245,7 @@ static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
         "punpckhbw %%mm7, %%mm3         \n\t"
         "paddw %%mm2, %%mm0             \n\t"
         "paddw %%mm3, %%mm1             \n\t"
-        ASMALIGN(4)
+        ".p2align 4                     \n\t"
         "1:                             \n\t"
         "movq (%2, %%"REG_a"), %%mm2    \n\t"
         "movq 1(%2, %%"REG_a"), %%mm4   \n\t"
diff --git a/ffmpeg-mt/libavcodec/x86/mpegaudiodec_mmx.c b/ffmpeg-mt/libavcodec/x86/mpegaudiodec_mmx.c
index 2f34281..ce5b7d6 100644
--- a/ffmpeg-mt/libavcodec/x86/mpegaudiodec_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/mpegaudiodec_mmx.c
@@ -2,20 +2,20 @@
  * MMX optimized MP3 decoding functions
  * Copyright (c) 2010 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx.c b/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx.c
index a32e35b..7dd9a66 100644
--- a/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx.c
@@ -5,20 +5,20 @@
  * Optimized for ia32 CPUs by Nick Kurshev <nickols_k at mail.ru>
  * h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -66,7 +66,7 @@ __asm__ volatile(
                 "packssdw %%mm5, %%mm5          \n\t"
                 "psubw %%mm5, %%mm7             \n\t"
                 "pxor %%mm4, %%mm4              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %3), %%mm0           \n\t"
                 "movq 8(%0, %3), %%mm1          \n\t"
@@ -129,7 +129,7 @@ __asm__ volatile(
                 "packssdw %%mm5, %%mm5          \n\t"
                 "psubw %%mm5, %%mm7             \n\t"
                 "pxor %%mm4, %%mm4              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %3), %%mm0           \n\t"
                 "movq 8(%0, %3), %%mm1          \n\t"
@@ -222,7 +222,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
@@ -285,7 +285,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
@@ -357,7 +357,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
@@ -418,7 +418,7 @@ __asm__ volatile(
                 "packssdw %%mm6, %%mm6          \n\t"
                 "packssdw %%mm6, %%mm6          \n\t"
                 "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
+                ".p2align 4                     \n\t"
                 "1:                             \n\t"
                 "movq (%0, %%"REG_a"), %%mm0    \n\t"
                 "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
diff --git a/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx_template.c b/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx_template.c
index b292c9d..ddda07a 100644
--- a/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx_template.c
+++ b/ffmpeg-mt/libavcodec/x86/mpegvideo_mmx_template.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2002 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -158,7 +158,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
             "pxor "MM"6, "MM"6                  \n\t"
             "psubw (%3), "MM"6                  \n\t" // -bias[0]
             "mov $-128, %%"REG_a"               \n\t"
-            ASMALIGN(4)
+            ".p2align 4                         \n\t"
             "1:                                 \n\t"
             MOVQ" (%1, %%"REG_a"), "MM"0        \n\t" // block[i]
             SAVE_SIGN(MM"1", MM"0")                   // ABS(block[i])
@@ -190,7 +190,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
             "pxor "MM"7, "MM"7                  \n\t" // 0
             "pxor "MM"4, "MM"4                  \n\t" // 0
             "mov $-128, %%"REG_a"               \n\t"
-            ASMALIGN(4)
+            ".p2align 4                         \n\t"
             "1:                                 \n\t"
             MOVQ" (%1, %%"REG_a"), "MM"0        \n\t" // block[i]
             SAVE_SIGN(MM"1", MM"0")                   // ABS(block[i])
diff --git a/ffmpeg-mt/libavcodec/x86/simple_idct_mmx.c b/ffmpeg-mt/libavcodec/x86/simple_idct_mmx.c
index fb6a5ff..d78ae6b 100644
--- a/ffmpeg-mt/libavcodec/x86/simple_idct_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/simple_idct_mmx.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2001, 2002 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "libavcodec/dsputil.h"
@@ -789,7 +789,7 @@ IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
 IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
         "jmp 9f                         \n\t"
 
-        "#" ASMALIGN(4)                      \
+        "# .p2align 4                   \n\t"\
         "4:                             \n\t"
 Z_COND_IDCT(  64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 6f)
 Z_COND_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 5f)
@@ -864,7 +864,7 @@ IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
 IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
         "jmp 9f                         \n\t"
 
-        "#" ASMALIGN(4)                      \
+        "# .p2align 4                   \n\t"\
         "6:                             \n\t"
 Z_COND_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 7f)
 
@@ -930,7 +930,7 @@ IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
 IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
         "jmp 9f                         \n\t"
 
-        "#" ASMALIGN(4)                      \
+        "# .p2align 4                   \n\t"\
         "2:                             \n\t"
 Z_COND_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 3f)
 
@@ -1007,7 +1007,7 @@ IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
 IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
         "jmp 9f                         \n\t"
 
-        "#" ASMALIGN(4)                      \
+        "# .p2align 4                   \n\t"\
         "3:                             \n\t"
 #undef IDCT
 #define IDCT(src0, src4, src1, src5, dst, shift) \
@@ -1071,7 +1071,7 @@ IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
 IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
         "jmp 9f                         \n\t"
 
-        "#" ASMALIGN(4)                      \
+        "# .p2align 4                   \n\t"\
         "5:                             \n\t"
 #undef IDCT
 #define IDCT(src0, src4, src1, src5, dst, shift) \
@@ -1136,7 +1136,7 @@ IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
         "jmp 9f                         \n\t"
 
 
-        "#" ASMALIGN(4)                      \
+        "# .p2align 4                   \n\t"\
         "1:                             \n\t"
 #undef IDCT
 #define IDCT(src0, src4, src1, src5, dst, shift) \
@@ -1210,7 +1210,7 @@ IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
         "jmp 9f                         \n\t"
 
 
-        "#" ASMALIGN(4)
+        "# .p2align 4                   \n\t"
         "7:                             \n\t"
 #undef IDCT
 #define IDCT(src0, src4, src1, src5, dst, shift) \
diff --git a/ffmpeg-mt/libavcodec/x86/snowdsp_mmx.c b/ffmpeg-mt/libavcodec/x86/snowdsp_mmx.c
index 9c1fa42..3e6bc99 100644
--- a/ffmpeg-mt/libavcodec/x86/snowdsp_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/snowdsp_mmx.c
@@ -2,20 +2,20 @@
  * MMX and SSE2 optimized snow DSP utils
  * Copyright (c) 2005-2006 Robert Edele <yartrebo at earthlink.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/vc1dsp_mmx.c b/ffmpeg-mt/libavcodec/x86/vc1dsp_mmx.c
index 8889bb3..a525aee 100644
--- a/ffmpeg-mt/libavcodec/x86/vc1dsp_mmx.c
+++ b/ffmpeg-mt/libavcodec/x86/vc1dsp_mmx.c
@@ -28,6 +28,7 @@
 #include "libavutil/x86_cpu.h"
 #include "libavcodec/dsputil.h"
 #include "dsputil_mmx.h"
+#include "libavcodec/vc1dsp.h"
 
 #define OP_PUT(S,D)
 #define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
@@ -275,7 +276,7 @@ vc1_put_ver_16b_ ## NAME ## _mmx(int16_t *dst, const uint8_t *src,      \
         LOAD_ROUNDER_MMX("%5")                                          \
         "movq      "MANGLE(ff_pw_53)", %%mm5\n\t"                       \
         "movq      "MANGLE(ff_pw_18)", %%mm6\n\t"                       \
-        ASMALIGN(3)                                                     \
+        ".p2align 3                \n\t"                                \
         "1:                        \n\t"                                \
         MSPEL_FILTER13_CORE(DO_UNPACK, "movd  1", A1, A2, A3, A4)       \
         NORMALIZE_MMX("%6")                                             \
@@ -331,7 +332,7 @@ OPNAME ## vc1_hor_16b_ ## NAME ## _mmx(uint8_t *dst, x86_reg stride,    \
         LOAD_ROUNDER_MMX("%4")                                          \
         "movq      "MANGLE(ff_pw_18)", %%mm6   \n\t"                    \
         "movq      "MANGLE(ff_pw_53)", %%mm5   \n\t"                    \
-        ASMALIGN(3)                                                     \
+        ".p2align 3                \n\t"                                \
         "1:                        \n\t"                                \
         MSPEL_FILTER13_CORE(DONT_UNPACK, "movq 2", A1, A2, A3, A4)      \
         NORMALIZE_MMX("$7")                                             \
@@ -369,7 +370,7 @@ OPNAME ## vc1_## NAME ## _mmx(uint8_t *dst, const uint8_t *src,         \
         LOAD_ROUNDER_MMX("%6")                                          \
         "movq      "MANGLE(ff_pw_53)", %%mm5       \n\t"                \
         "movq      "MANGLE(ff_pw_18)", %%mm6       \n\t"                \
-        ASMALIGN(3)                                                     \
+        ".p2align 3                \n\t"                                \
         "1:                        \n\t"                                \
         MSPEL_FILTER13_CORE(DO_UNPACK, "movd   1", A1, A2, A3, A4)      \
         NORMALIZE_MMX("$6")                                             \
@@ -712,30 +713,45 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq)
     ff_vc1_h_loop_filter8_sse4(src,          stride, pq);
     ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
 }
+
 #endif
 
-void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) {
+void ff_put_vc1_chroma_mc8_mmx_nornd  (uint8_t *dst, uint8_t *src,
+                                       int stride, int h, int x, int y);
+void ff_avg_vc1_chroma_mc8_mmx2_nornd (uint8_t *dst, uint8_t *src,
+                                       int stride, int h, int x, int y);
+void ff_avg_vc1_chroma_mc8_3dnow_nornd(uint8_t *dst, uint8_t *src,
+                                       int stride, int h, int x, int y);
+void ff_put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src,
+                                       int stride, int h, int x, int y);
+void ff_avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src,
+                                       int stride, int h, int x, int y);
+
+void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
+{
     int mm_flags = av_get_cpu_flags();
 
-    dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
-    dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;
-
-    dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;
-    dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;
-
-    dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;
-    dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;
-    dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;
-
-    dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
-    dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
-    dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
+    if (mm_flags & AV_CPU_FLAG_MMX) {
+        dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
+        dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
+        dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
+        dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;
+
+        dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;
+        dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;
+        dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;
+        dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;
+
+        dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;
+        dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;
+        dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;
+        dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;
+
+        dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;
+        dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
+        dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
+        dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
+    }
 
     if (mm_flags & AV_CPU_FLAG_MMX2){
         dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
@@ -775,11 +791,16 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) {
 #if HAVE_YASM
     if (mm_flags & AV_CPU_FLAG_MMX) {
         ASSIGN_LF(mmx);
+        dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
     }
     return;
     if (mm_flags & AV_CPU_FLAG_MMX2) {
         ASSIGN_LF(mmx2);
+        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;
+    } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
+        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;
     }
+
     if (mm_flags & AV_CPU_FLAG_SSE2) {
         dsp->vc1_v_loop_filter8  = ff_vc1_v_loop_filter8_sse2;
         dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_sse2;
@@ -788,6 +809,8 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) {
     }
     if (mm_flags & AV_CPU_FLAG_SSSE3) {
         ASSIGN_LF(ssse3);
+        dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd;
+        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd;
     }
     if (mm_flags & AV_CPU_FLAG_SSE4) {
         dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_sse4;
diff --git a/ffmpeg-mt/libavcodec/x86/vc1dsp_yasm.asm b/ffmpeg-mt/libavcodec/x86/vc1dsp_yasm.asm
index 3ea9d8d..0bd5a3b 100644
--- a/ffmpeg-mt/libavcodec/x86/vc1dsp_yasm.asm
+++ b/ffmpeg-mt/libavcodec/x86/vc1dsp_yasm.asm
@@ -2,20 +2,20 @@
 ;* VC1 deblocking optimizations
 ;* Copyright (c) 2009 David Conrad
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/vp3dsp.asm b/ffmpeg-mt/libavcodec/x86/vp3dsp.asm
index f2b0af3..0fe65de 100644
--- a/ffmpeg-mt/libavcodec/x86/vp3dsp.asm
+++ b/ffmpeg-mt/libavcodec/x86/vp3dsp.asm
@@ -2,20 +2,20 @@
 ;* MMX/SSE2-optimized functions for the VP3 decoder
 ;* Copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/vp56_arith.h b/ffmpeg-mt/libavcodec/x86/vp56_arith.h
index ddbf38b..be2dd30 100644
--- a/ffmpeg-mt/libavcodec/x86/vp56_arith.h
+++ b/ffmpeg-mt/libavcodec/x86/vp56_arith.h
@@ -4,20 +4,20 @@
  * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
  * Copyright (C) 2010  Eli Friedman
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/vp56dsp.asm b/ffmpeg-mt/libavcodec/x86/vp56dsp.asm
index 0543ba0..1cc62a6 100644
--- a/ffmpeg-mt/libavcodec/x86/vp56dsp.asm
+++ b/ffmpeg-mt/libavcodec/x86/vp56dsp.asm
@@ -3,20 +3,20 @@
 ;* Copyright (C) 2009  Sebastien Lucas <sebastien.lucas at gmail.com>
 ;* Copyright (C) 2009  Zuxy Meng <zuxy.meng at gmail.com>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/vp56dsp_init.c b/ffmpeg-mt/libavcodec/x86/vp56dsp_init.c
index 87fc935..2989281 100644
--- a/ffmpeg-mt/libavcodec/x86/vp56dsp_init.c
+++ b/ffmpeg-mt/libavcodec/x86/vp56dsp_init.c
@@ -3,20 +3,20 @@
  * Copyright (C) 2009  Sebastien Lucas <sebastien.lucas at gmail.com>
  * Copyright (C) 2009  Zuxy Meng <zuxy.meng at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/vp8dsp-init.c b/ffmpeg-mt/libavcodec/x86/vp8dsp-init.c
index 201b34e..8b27b0d 100644
--- a/ffmpeg-mt/libavcodec/x86/vp8dsp-init.c
+++ b/ffmpeg-mt/libavcodec/x86/vp8dsp-init.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2010 Ronald S. Bultje <rsbultje at gmail.com>
  * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/x86/vp8dsp.asm b/ffmpeg-mt/libavcodec/x86/vp8dsp.asm
index bc5ccc8..12e592f 100644
--- a/ffmpeg-mt/libavcodec/x86/vp8dsp.asm
+++ b/ffmpeg-mt/libavcodec/x86/vp8dsp.asm
@@ -3,20 +3,20 @@
 ;* Copyright (c) 2010 Ronald S. Bultje <rsbultje at gmail.com>
 ;* Copyright (c) 2010 Jason Garrett-Glaser <darkshikari at gmail.com>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
diff --git a/ffmpeg-mt/libavcodec/x86/x86util.asm b/ffmpeg-mt/libavcodec/x86/x86util.asm
index 7cabc70..f731616 100644
--- a/ffmpeg-mt/libavcodec/x86/x86util.asm
+++ b/ffmpeg-mt/libavcodec/x86/x86util.asm
@@ -6,20 +6,20 @@
 ;* Authors: Loren Merritt <lorenm at u.washington.edu>
 ;*          Holger Lubitz <holger at lubitz.org>
 ;*
-;* This file is part of FFmpeg.
+;* This file is part of Libav.
 ;*
-;* FFmpeg is free software; you can redistribute it and/or
+;* Libav is free software; you can redistribute it and/or
 ;* modify it under the terms of the GNU Lesser General Public
 ;* License as published by the Free Software Foundation; either
 ;* version 2.1 of the License, or (at your option) any later version.
 ;*
-;* FFmpeg is distributed in the hope that it will be useful,
+;* Libav is distributed in the hope that it will be useful,
 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;* Lesser General Public License for more details.
 ;*
 ;* You should have received a copy of the GNU Lesser General Public
-;* License along with FFmpeg; if not, write to the Free Software
+;* License along with Libav; if not, write to the Free Software
 ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 ;******************************************************************************
 
@@ -434,3 +434,13 @@
     movh     [%7], %3
     movh  [%7+%8], %4
 %endmacro
+
+%macro PMINUB_MMX 3 ; dst, src, tmp
+    mova     %3, %1
+    psubusb  %3, %2
+    psubb    %1, %3
+%endmacro
+
+%macro PMINUB_MMXEXT 3 ; dst, src, ignored
+    pminub   %1, %2
+%endmacro
diff --git a/ffmpeg-mt/libavcodec/xan.c b/ffmpeg-mt/libavcodec/xan.c
index fbd383f..876a9a5 100644
--- a/ffmpeg-mt/libavcodec/xan.c
+++ b/ffmpeg-mt/libavcodec/xan.c
@@ -2,20 +2,20 @@
  * Wing Commander/Xan Video Decoder
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -358,9 +358,6 @@ static void xan_wc3_decode_frame(XanContext *s) {
     }
 }
 
-static void xan_wc4_decode_frame(XanContext *s) {
-}
-
 #if RUNTIME_GAMMA
 static inline unsigned mul(unsigned a, unsigned b)
 {
@@ -515,23 +512,12 @@ static int xan_decode_frame(AVCodecContext *avctx,
     if (!s->frame_size)
         s->frame_size = s->current_frame.linesize[0] * s->avctx->height;
 
-    if (avctx->codec->id == CODEC_ID_XAN_WC3) {
-        memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE);
-    } else {
-        AVPaletteControl *palette_control = avctx->palctrl;
-        palette_control->palette_changed = 0;
-        memcpy(s->current_frame.data[1], palette_control->palette,
-               AVPALETTE_SIZE);
-        s->current_frame.palette_has_changed = 1;
-    }
+    memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE);
 
     s->buf = buf;
     s->size = buf_size;
 
-    if (avctx->codec->id == CODEC_ID_XAN_WC3)
-        xan_wc3_decode_frame(s);
-    else if (avctx->codec->id == CODEC_ID_XAN_WC4)
-        xan_wc4_decode_frame(s);
+    xan_wc3_decode_frame(s);
 
     /* release the last frame if it is allocated */
     if (s->last_frame.data[0])
@@ -564,7 +550,7 @@ static av_cold int xan_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec xan_wc3_decoder = {
+AVCodec ff_xan_wc3_decoder = {
     "xan_wc3",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_XAN_WC3,
@@ -577,17 +563,3 @@ AVCodec xan_wc3_decoder = {
     .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"),
 };
 
-/*
-AVCodec xan_wc4_decoder = {
-    "xan_wc4",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_XAN_WC4,
-    sizeof(XanContext),
-    xan_decode_init,
-    NULL,
-    xan_decode_end,
-    xan_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"),
-};
-*/
diff --git a/ffmpeg-mt/libavcodec/xiph.c b/ffmpeg-mt/libavcodec/xiph.c
index 2f4f25c..0bcfd45 100644
--- a/ffmpeg-mt/libavcodec/xiph.c
+++ b/ffmpeg-mt/libavcodec/xiph.c
@@ -1,20 +1,20 @@
 /*
- * Copyright (C) 2007  FFmpeg Project
+ * Copyright (C) 2007  Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/xiph.h b/ffmpeg-mt/libavcodec/xiph.h
index 0cbb870..da18c9c 100644
--- a/ffmpeg-mt/libavcodec/xiph.h
+++ b/ffmpeg-mt/libavcodec/xiph.h
@@ -1,20 +1,20 @@
 /*
- * Copyright (C) 2007  FFmpeg Project
+ * Copyright (C) 2007  Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/xl.c b/ffmpeg-mt/libavcodec/xl.c
index f7d025e..c7093aa 100644
--- a/ffmpeg-mt/libavcodec/xl.c
+++ b/ffmpeg-mt/libavcodec/xl.c
@@ -2,20 +2,20 @@
  * Miro VideoXL codec
  * Copyright (c) 2004 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -138,7 +138,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
-AVCodec xl_decoder = {
+AVCodec ff_xl_decoder = {
     "xl",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_VIXL,
diff --git a/ffmpeg-mt/libavcodec/xsubdec.c b/ffmpeg-mt/libavcodec/xsubdec.c
index 22f9898..097cbc6 100644
--- a/ffmpeg-mt/libavcodec/xsubdec.c
+++ b/ffmpeg-mt/libavcodec/xsubdec.c
@@ -2,23 +2,23 @@
  * XSUB subtitle decoder
  * Copyright (c) 2007 Reimar Döffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "get_bits.h"
 #include "bytestream.h"
@@ -131,7 +131,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     return buf_size;
 }
 
-AVCodec xsub_decoder = {
+AVCodec ff_xsub_decoder = {
     "xsub",
     AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_XSUB,
diff --git a/ffmpeg-mt/libavcodec/xsubenc.c b/ffmpeg-mt/libavcodec/xsubenc.c
index 60f4979..87dc75c 100644
--- a/ffmpeg-mt/libavcodec/xsubenc.c
+++ b/ffmpeg-mt/libavcodec/xsubenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2005 DivX, Inc.
  * Copyright (c) 2009 Bjorn Axelsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -210,7 +210,7 @@ static av_cold int xsub_encoder_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec xsub_encoder = {
+AVCodec ff_xsub_encoder = {
     "xsub",
     AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_XSUB,
diff --git a/ffmpeg-mt/libavcodec/xvmc.h b/ffmpeg-mt/libavcodec/xvmc.h
index 29c010b..6e18a88 100644
--- a/ffmpeg-mt/libavcodec/xvmc.h
+++ b/ffmpeg-mt/libavcodec/xvmc.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003 Ivan Kalvachev
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/xvmc_internal.h b/ffmpeg-mt/libavcodec/xvmc_internal.h
index 9bb8909..7a4e908 100644
--- a/ffmpeg-mt/libavcodec/xvmc_internal.h
+++ b/ffmpeg-mt/libavcodec/xvmc_internal.h
@@ -1,20 +1,20 @@
 /*
  * XVideo Motion Compensation internal functions
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavcodec/xxan.c b/ffmpeg-mt/libavcodec/xxan.c
new file mode 100644
index 0000000..28c868d
--- /dev/null
+++ b/ffmpeg-mt/libavcodec/xxan.c
@@ -0,0 +1,429 @@
+/*
+ * Wing Commander/Xan Video Decoder
+ * Copyright (C) 2011 Konstantin Shishkov
+ * based on work by Mike Melanson
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "libavutil/intreadwrite.h"
+#include "bytestream.h"
+#define ALT_BITSTREAM_READER_LE
+#include "get_bits.h"
+// for av_memcpy_backptr
+#include "libavutil/lzo.h"
+
+typedef struct XanContext {
+    AVCodecContext *avctx;
+    AVFrame pic;
+
+    uint8_t *y_buffer;
+    uint8_t *scratch_buffer;
+    int     buffer_size;
+} XanContext;
+
+static av_cold int xan_decode_init(AVCodecContext *avctx)
+{
+    XanContext *s = avctx->priv_data;
+
+    s->avctx = avctx;
+
+    avctx->pix_fmt = PIX_FMT_YUV420P;
+
+    s->buffer_size = avctx->width * avctx->height;
+    s->y_buffer = av_malloc(s->buffer_size);
+    if (!s->y_buffer)
+        return AVERROR(ENOMEM);
+    s->scratch_buffer = av_malloc(s->buffer_size + 130);
+    if (!s->scratch_buffer) {
+        av_freep(&s->y_buffer);
+        return AVERROR(ENOMEM);
+    }
+
+    return 0;
+}
+
+static int xan_unpack_luma(const uint8_t *src, const int src_size,
+                           uint8_t *dst, const int dst_size)
+{
+   int tree_size, eof;
+   const uint8_t *tree;
+   int bits, mask;
+   int tree_root, node;
+   const uint8_t *dst_end = dst + dst_size;
+   const uint8_t *src_end = src + src_size;
+
+   tree_size = *src++;
+   eof       = *src++;
+   tree      = src - eof * 2 - 2;
+   tree_root = eof + tree_size;
+   src += tree_size * 2;
+
+   node = tree_root;
+   bits = *src++;
+   mask = 0x80;
+   for (;;) {
+       int bit = !!(bits & mask);
+       mask >>= 1;
+       node = tree[node*2 + bit];
+       if (node == eof)
+           break;
+       if (node < eof) {
+           *dst++ = node;
+           if (dst > dst_end)
+               break;
+           node = tree_root;
+       }
+       if (!mask) {
+           bits = *src++;
+           if (src > src_end)
+               break;
+           mask = 0x80;
+       }
+   }
+   return dst != dst_end;
+}
+
+/* almost the same as in xan_wc3 decoder */
+static int xan_unpack(uint8_t *dest, const int dest_len,
+                      const uint8_t *src, const int src_len)
+{
+    uint8_t opcode;
+    int size;
+    uint8_t *orig_dest = dest;
+    const uint8_t *src_end = src + src_len;
+    const uint8_t *dest_end = dest + dest_len;
+
+    while (dest < dest_end) {
+        opcode = *src++;
+
+        if (opcode < 0xe0) {
+            int size2, back;
+            if ((opcode & 0x80) == 0) {
+                size  = opcode & 3;
+                back  = ((opcode & 0x60) << 3) + *src++ + 1;
+                size2 = ((opcode & 0x1c) >> 2) + 3;
+            } else if ((opcode & 0x40) == 0) {
+                size  = *src >> 6;
+                back  = (bytestream_get_be16(&src) & 0x3fff) + 1;
+                size2 = (opcode & 0x3f) + 4;
+            } else {
+                size  = opcode & 3;
+                back  = ((opcode & 0x10) << 12) + bytestream_get_be16(&src) + 1;
+                size2 = ((opcode & 0x0c) <<  6) + *src++ + 5;
+                if (size + size2 > dest_end - dest)
+                    break;
+            }
+            if (src + size > src_end || dest + size + size2 > dest_end)
+                return -1;
+            bytestream_get_buffer(&src, dest, size);
+            dest += size;
+            av_memcpy_backptr(dest, back, size2);
+            dest += size2;
+        } else {
+            int finish = opcode >= 0xfc;
+
+            size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
+            if (src + size > src_end || dest + size > dest_end)
+                return -1;
+            bytestream_get_buffer(&src, dest, size);
+            dest += size;
+            if (finish)
+                break;
+        }
+    }
+    return dest - orig_dest;
+}
+
+static int xan_decode_chroma(AVCodecContext *avctx, AVPacket *avpkt)
+{
+    const uint8_t *buf = avpkt->data;
+    XanContext *s = avctx->priv_data;
+    uint8_t *U, *V;
+    unsigned chroma_off;
+    int val, uval, vval;
+    int i, j;
+    const uint8_t *src, *src_end;
+    const uint8_t *table;
+    int mode, offset, dec_size;
+
+    chroma_off = AV_RL32(buf + 4);
+    if (!chroma_off)
+        return 0;
+    if (chroma_off + 10 >= avpkt->size) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid chroma block position\n");
+        return -1;
+    }
+    src    = avpkt->data + 4 + chroma_off;
+    table  = src + 2;
+    mode   = bytestream_get_le16(&src);
+    offset = bytestream_get_le16(&src) * 2;
+
+    if (src - avpkt->data >= avpkt->size - offset) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid chroma block offset\n");
+        return -1;
+    }
+
+    memset(s->scratch_buffer, 0, s->buffer_size);
+    dec_size = xan_unpack(s->scratch_buffer, s->buffer_size, src + offset,
+                          avpkt->size - offset - (src - avpkt->data));
+    if (dec_size < 0) {
+        av_log(avctx, AV_LOG_ERROR, "Chroma unpacking failed\n");
+        return -1;
+    }
+
+    U = s->pic.data[1];
+    V = s->pic.data[2];
+    src     = s->scratch_buffer;
+    src_end = src + dec_size;
+    if (mode) {
+        for (j = 0; j < avctx->height >> 1; j++) {
+            for (i = 0; i < avctx->width >> 1; i++) {
+                val = *src++;
+                if (val) {
+                    val  = AV_RL16(table + (val << 1));
+                    uval = (val >> 3) & 0xF8;
+                    vval = (val >> 8) & 0xF8;
+                    U[i] = uval | (uval >> 5);
+                    V[i] = vval | (vval >> 5);
+                }
+                if (src == src_end)
+                    return 0;
+            }
+            U += s->pic.linesize[1];
+            V += s->pic.linesize[2];
+        }
+    } else {
+        uint8_t *U2 = U + s->pic.linesize[1];
+        uint8_t *V2 = V + s->pic.linesize[2];
+
+        for (j = 0; j < avctx->height >> 2; j++) {
+            for (i = 0; i < avctx->width >> 1; i += 2) {
+                val = *src++;
+                if (val) {
+                    val  = AV_RL16(table + (val << 1));
+                    uval = (val >> 3) & 0xF8;
+                    vval = (val >> 8) & 0xF8;
+                    U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5);
+                    V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5);
+                }
+            }
+            U  += s->pic.linesize[1] * 2;
+            V  += s->pic.linesize[2] * 2;
+            U2 += s->pic.linesize[1] * 2;
+            V2 += s->pic.linesize[2] * 2;
+        }
+    }
+
+    return 0;
+}
+
+static int xan_decode_frame_type0(AVCodecContext *avctx, AVPacket *avpkt)
+{
+    const uint8_t *buf = avpkt->data;
+    XanContext *s = avctx->priv_data;
+    uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;
+    unsigned  chroma_off, corr_off;
+    int cur, last, size;
+    int i, j;
+    int ret;
+
+    corr_off   = AV_RL32(buf + 8);
+    chroma_off = AV_RL32(buf + 4);
+
+    if ((ret = xan_decode_chroma(avctx, avpkt)) != 0)
+        return ret;
+
+    size = avpkt->size - 4;
+    if (corr_off >= avpkt->size) {
+        av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n");
+        corr_off = 0;
+    }
+    if (corr_off)
+        size = corr_off;
+    if (chroma_off)
+        size = FFMIN(size, chroma_off);
+    ret = xan_unpack_luma(buf + 12, size, src, s->buffer_size >> 1);
+    if (ret) {
+        av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n");
+        return ret;
+    }
+
+    ybuf = s->y_buffer;
+    last = *src++;
+    ybuf[0] = last << 1;
+    for (j = 1; j < avctx->width - 1; j += 2) {
+        cur = (last + *src++) & 0x1F;
+        ybuf[j]   = last + cur;
+        ybuf[j+1] = cur << 1;
+        last = cur;
+    }
+    ybuf[j]  = last << 1;
+    prev_buf = ybuf;
+    ybuf += avctx->width;
+
+    for (i = 1; i < avctx->height; i++) {
+        last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
+        ybuf[0] = last << 1;
+        for (j = 1; j < avctx->width - 1; j += 2) {
+            cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
+            ybuf[j]   = last + cur;
+            ybuf[j+1] = cur << 1;
+            last = cur;
+        }
+        ybuf[j] = last << 1;
+        prev_buf = ybuf;
+        ybuf += avctx->width;
+    }
+
+    if (corr_off) {
+        int corr_end, dec_size;
+
+        corr_end = avpkt->size;
+        if (chroma_off > corr_off)
+            corr_end = chroma_off;
+        dec_size = xan_unpack(s->scratch_buffer, s->buffer_size,
+                              avpkt->data + 8 + corr_off,
+                              corr_end - corr_off);
+        if (dec_size < 0)
+            dec_size = 0;
+        for (i = 0; i < dec_size; i++)
+            s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F;
+    }
+
+    src  = s->y_buffer;
+    ybuf = s->pic.data[0];
+    for (j = 0; j < avctx->height; j++) {
+        for (i = 0; i < avctx->width; i++)
+            ybuf[i] = (src[i] << 2) | (src[i] >> 3);
+        src  += avctx->width;
+        ybuf += s->pic.linesize[0];
+    }
+
+    return 0;
+}
+
+static int xan_decode_frame_type1(AVCodecContext *avctx, AVPacket *avpkt)
+{
+    const uint8_t *buf = avpkt->data;
+    XanContext *s = avctx->priv_data;
+    uint8_t *ybuf, *src = s->scratch_buffer;
+    int cur, last;
+    int i, j;
+    int ret;
+
+    if ((ret = xan_decode_chroma(avctx, avpkt)) != 0)
+        return ret;
+
+    ret = xan_unpack_luma(buf + 16, avpkt->size - 16, src,
+                          s->buffer_size >> 1);
+    if (ret) {
+        av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n");
+        return ret;
+    }
+
+    ybuf = s->y_buffer;
+    for (i = 0; i < avctx->height; i++) {
+        last = (ybuf[0] + (*src++ << 1)) & 0x3F;
+        ybuf[0] = last;
+        for (j = 1; j < avctx->width - 1; j += 2) {
+            cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F;
+            ybuf[j]   = (last + cur) >> 1;
+            ybuf[j+1] = cur;
+            last = cur;
+        }
+        ybuf[j] = last;
+        ybuf += avctx->width;
+    }
+
+    src = s->y_buffer;
+    ybuf = s->pic.data[0];
+    for (j = 0; j < avctx->height; j++) {
+        for (i = 0; i < avctx->width; i++)
+            ybuf[i] = (src[i] << 2) | (src[i] >> 3);
+        src  += avctx->width;
+        ybuf += s->pic.linesize[0];
+    }
+
+    return 0;
+}
+
+static int xan_decode_frame(AVCodecContext *avctx,
+                            void *data, int *data_size,
+                            AVPacket *avpkt)
+{
+    XanContext *s = avctx->priv_data;
+    int ftype;
+    int ret;
+
+    s->pic.reference = 1;
+    s->pic.buffer_hints = FF_BUFFER_HINTS_VALID |
+                          FF_BUFFER_HINTS_PRESERVE |
+                          FF_BUFFER_HINTS_REUSABLE;
+    if ((ret = avctx->reget_buffer(avctx, &s->pic))) {
+        av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+        return ret;
+    }
+
+    ftype = AV_RL32(avpkt->data);
+    switch (ftype) {
+    case 0:
+        ret = xan_decode_frame_type0(avctx, avpkt);
+        break;
+    case 1:
+        ret = xan_decode_frame_type1(avctx, avpkt);
+        break;
+    default:
+        av_log(avctx, AV_LOG_ERROR, "Unknown frame type %d\n", ftype);
+        return -1;
+    }
+    if (ret)
+        return ret;
+
+    *data_size = sizeof(AVFrame);
+    *(AVFrame*)data = s->pic;
+
+    return avpkt->size;
+}
+
+static av_cold int xan_decode_end(AVCodecContext *avctx)
+{
+    XanContext *s = avctx->priv_data;
+
+    if (s->pic.data[0])
+        avctx->release_buffer(avctx, &s->pic);
+
+    av_freep(&s->y_buffer);
+    av_freep(&s->scratch_buffer);
+
+    return 0;
+}
+
+AVCodec ff_xan_wc4_decoder = {
+    "xan_wc4",
+    AVMEDIA_TYPE_VIDEO,
+    CODEC_ID_XAN_WC4,
+    sizeof(XanContext),
+    xan_decode_init,
+    NULL,
+    xan_decode_end,
+    xan_decode_frame,
+    CODEC_CAP_DR1,
+    .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"),
+};
+
diff --git a/ffmpeg-mt/libavcodec/yop.c b/ffmpeg-mt/libavcodec/yop.c
index 57d100c..1f1314b 100644
--- a/ffmpeg-mt/libavcodec/yop.c
+++ b/ffmpeg-mt/libavcodec/yop.c
@@ -6,25 +6,25 @@
  * derived from the code by
  * Copyright (C) 2009 Thomas P. Higdon <thomas.p.higdon at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 #include "avcodec.h"
 #include "get_bits.h"
@@ -248,7 +248,7 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     return avpkt->size;
 }
 
-AVCodec yop_decoder = {
+AVCodec ff_yop_decoder = {
     "yop",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_YOP,
diff --git a/ffmpeg-mt/libavcodec/zmbv.c b/ffmpeg-mt/libavcodec/zmbv.c
index 6ac9089..eec7025 100644
--- a/ffmpeg-mt/libavcodec/zmbv.c
+++ b/ffmpeg-mt/libavcodec/zmbv.c
@@ -2,20 +2,20 @@
  * Zip Motion Blocks Video (ZMBV) decoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -650,7 +650,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec zmbv_decoder = {
+AVCodec ff_zmbv_decoder = {
     "zmbv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ZMBV,
diff --git a/ffmpeg-mt/libavcodec/zmbvenc.c b/ffmpeg-mt/libavcodec/zmbvenc.c
index 95f2906..9caa6b8 100644
--- a/ffmpeg-mt/libavcodec/zmbvenc.c
+++ b/ffmpeg-mt/libavcodec/zmbvenc.c
@@ -2,20 +2,20 @@
  * Zip Motion Blocks Video (ZMBV) encoder
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -323,7 +323,7 @@ static av_cold int encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec zmbv_encoder = {
+AVCodec ff_zmbv_encoder = {
     "zmbv",
     AVMEDIA_TYPE_VIDEO,
     CODEC_ID_ZMBV,
diff --git a/ffmpeg-mt/libavcore/Makefile b/ffmpeg-mt/libavcore/Makefile
deleted file mode 100644
index f2e8297..0000000
--- a/ffmpeg-mt/libavcore/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = avcore
-FFLIBS = avutil
-
-HEADERS = \
-          audioconvert.h                                                \
-          avcore.h                                                      \
-          imgutils.h                                                    \
-          parseutils.h                                                  \
-          samplefmt.h                                                   \
-
-OBJS = \
-       audioconvert.o                                                   \
-       imgutils.o                                                       \
-       parseutils.o                                                     \
-       samplefmt.o                                                      \
-       utils.o                                                          \
-
-include $(SUBDIR)../subdir.mak
diff --git a/ffmpeg-mt/libavcore/audioconvert.c b/ffmpeg-mt/libavcore/audioconvert.c
deleted file mode 100644
index c720733..0000000
--- a/ffmpeg-mt/libavcore/audioconvert.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * audio conversion routines
- */
-
-#include "libavutil/avstring.h"
-#include "audioconvert.h"
-
-static const char * const channel_names[] = {
-    "FL", "FR", "FC", "LFE", "BL",  "BR",  "FLC", "FRC",
-    "BC", "SL", "SR", "TC",  "TFL", "TFC", "TFR", "TBL",
-    "TBC", "TBR",
-    [29] = "DL",
-    [30] = "DR",
-};
-
-static const char *get_channel_name(int channel_id)
-{
-    if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
-        return NULL;
-    return channel_names[channel_id];
-}
-
-static const struct {
-    const char *name;
-    int         nb_channels;
-    int64_t     layout;
-} channel_layout_map[] = {
-    { "mono",        1,  AV_CH_LAYOUT_MONO },
-    { "stereo",      2,  AV_CH_LAYOUT_STEREO },
-    { "4.0",         4,  AV_CH_LAYOUT_4POINT0 },
-    { "quad",        4,  AV_CH_LAYOUT_QUAD },
-    { "5.0",         5,  AV_CH_LAYOUT_5POINT0 },
-    { "5.0",         5,  AV_CH_LAYOUT_5POINT0_BACK },
-    { "5.1",         6,  AV_CH_LAYOUT_5POINT1 },
-    { "5.1",         6,  AV_CH_LAYOUT_5POINT1_BACK },
-    { "5.1+downmix", 8,  AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, },
-    { "7.1",         8,  AV_CH_LAYOUT_7POINT1 },
-    { "7.1(wide)",   8,  AV_CH_LAYOUT_7POINT1_WIDE },
-    { "7.1+downmix", 10, AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, },
-    { 0 }
-};
-
-int64_t av_get_channel_layout(const char *name)
-{
-    int i = 0;
-    do {
-        if (!strcmp(channel_layout_map[i].name, name))
-            return channel_layout_map[i].layout;
-        i++;
-    } while (channel_layout_map[i].name);
-
-    return 0;
-}
-
-void av_get_channel_layout_string(char *buf, int buf_size,
-                                  int nb_channels, int64_t channel_layout)
-{
-    int i;
-
-    if (nb_channels <= 0)
-        nb_channels = av_get_channel_layout_nb_channels(channel_layout);
-
-    for (i = 0; channel_layout_map[i].name; i++)
-        if (nb_channels    == channel_layout_map[i].nb_channels &&
-            channel_layout == channel_layout_map[i].layout) {
-            av_strlcpy(buf, channel_layout_map[i].name, buf_size);
-            return;
-        }
-
-    snprintf(buf, buf_size, "%d channels", nb_channels);
-    if (channel_layout) {
-        int i,ch;
-        av_strlcat(buf, " (", buf_size);
-        for(i=0,ch=0; i<64; i++) {
-            if ((channel_layout & (1L<<i))) {
-                const char *name = get_channel_name(i);
-                if (name) {
-                    if (ch>0) av_strlcat(buf, "|", buf_size);
-                    av_strlcat(buf, name, buf_size);
-                }
-                ch++;
-            }
-        }
-        av_strlcat(buf, ")", buf_size);
-    }
-}
-
-int av_get_channel_layout_nb_channels(int64_t channel_layout)
-{
-    int count;
-    uint64_t x = channel_layout;
-    for (count = 0; x; count++)
-        x &= x-1; // unset lowest set bit
-    return count;
-}
diff --git a/ffmpeg-mt/libavcore/audioconvert.h b/ffmpeg-mt/libavcore/audioconvert.h
deleted file mode 100644
index 89e9c55..0000000
--- a/ffmpeg-mt/libavcore/audioconvert.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2008 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCORE_AUDIOCONVERT_H
-#define AVCORE_AUDIOCONVERT_H
-
-/**
- * @file
- * audio conversion routines
- */
-
-#include "avcore.h"
-
-/* Audio channel masks */
-#define AV_CH_FRONT_LEFT             0x00000001
-#define AV_CH_FRONT_RIGHT            0x00000002
-#define AV_CH_FRONT_CENTER           0x00000004
-#define AV_CH_LOW_FREQUENCY          0x00000008
-#define AV_CH_BACK_LEFT              0x00000010
-#define AV_CH_BACK_RIGHT             0x00000020
-#define AV_CH_FRONT_LEFT_OF_CENTER   0x00000040
-#define AV_CH_FRONT_RIGHT_OF_CENTER  0x00000080
-#define AV_CH_BACK_CENTER            0x00000100
-#define AV_CH_SIDE_LEFT              0x00000200
-#define AV_CH_SIDE_RIGHT             0x00000400
-#define AV_CH_TOP_CENTER             0x00000800
-#define AV_CH_TOP_FRONT_LEFT         0x00001000
-#define AV_CH_TOP_FRONT_CENTER       0x00002000
-#define AV_CH_TOP_FRONT_RIGHT        0x00004000
-#define AV_CH_TOP_BACK_LEFT          0x00008000
-#define AV_CH_TOP_BACK_CENTER        0x00010000
-#define AV_CH_TOP_BACK_RIGHT         0x00020000
-#define AV_CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
-#define AV_CH_STEREO_RIGHT           0x40000000  ///< See AV_CH_STEREO_LEFT.
-
-/** Channel mask value used for AVCodecContext.request_channel_layout
-    to indicate that the user requests the channel order of the decoder output
-    to be the native codec channel order. */
-#define AV_CH_LAYOUT_NATIVE          0x8000000000000000LL
-
-/* Audio channel convenience macros */
-#define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
-#define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
-#define AV_CH_LAYOUT_2_1               (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_SURROUND          (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
-#define AV_CH_LAYOUT_4POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_2_2               (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
-#define AV_CH_LAYOUT_QUAD              (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_5POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
-#define AV_CH_LAYOUT_5POINT1           (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_5POINT0_BACK      (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_5POINT1_BACK      (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_7POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_7POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_7POINT1_WIDE      (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
-#define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
-
-/**
- * Return a channel layout id that matches name, 0 if no match.
- */
-int64_t av_get_channel_layout(const char *name);
-
-/**
- * Return a description of a channel layout.
- * If nb_channels is <= 0, it is guessed from the channel_layout.
- *
- * @param buf put here the string containing the channel layout
- * @param buf_size size in bytes of the buffer
- */
-void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout);
-
-/**
- * Return the number of channels in the channel layout.
- */
-int av_get_channel_layout_nb_channels(int64_t channel_layout);
-
-#endif /* AVCORE_AUDIOCONVERT_H */
diff --git a/ffmpeg-mt/libavcore/avcore.h b/ffmpeg-mt/libavcore/avcore.h
deleted file mode 100644
index 9b02c3b..0000000
--- a/ffmpeg-mt/libavcore/avcore.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCORE_AVCORE_H
-#define AVCORE_AVCORE_H
-
-/**
- * @file
- * shared media utilities for the libav* libraries
- */
-
-#include "libavutil/avutil.h"
-
-#define LIBAVCORE_VERSION_MAJOR  0
-#define LIBAVCORE_VERSION_MINOR 16
-#define LIBAVCORE_VERSION_MICRO  1
-
-#define LIBAVCORE_VERSION_INT   AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \
-                                               LIBAVCORE_VERSION_MINOR, \
-                                               LIBAVCORE_VERSION_MICRO)
-#define LIBAVCORE_VERSION       AV_VERSION(LIBAVCORE_VERSION_MAJOR,     \
-                                           LIBAVCORE_VERSION_MINOR,     \
-                                           LIBAVCORE_VERSION_MICRO)
-#define LIBAVCORE_BUILD         LIBAVCORE_VERSION_INT
-
-#define LIBAVCORE_IDENT         "Lavcore" AV_STRINGIFY(LIBAVCORE_VERSION)
-
-/**
- * Return the LIBAVCORE_VERSION_INT constant.
- */
-unsigned avcore_version(void);
-
-/**
- * Return the libavcore build-time configuration.
- */
-const char *avcore_configuration(void);
-
-/**
- * Return the libavcore license.
- */
-const char *avcore_license(void);
-
-#define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
-#define AV_TIME_BASE            1000000
-#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
-
-/**
- * Those FF_API_* defines are not part of public API.
- * They may change, break or disappear at any time.
- */
-#ifndef FF_API_OLD_IMAGE_NAMES
-#define FF_API_OLD_IMAGE_NAMES (LIBAVCORE_VERSION_MAJOR < 1)
-#endif
-
-#endif /* AVCORE_AVCORE_H */
diff --git a/ffmpeg-mt/libavcore/imgutils.c b/ffmpeg-mt/libavcore/imgutils.c
deleted file mode 100644
index 0f449ff..0000000
--- a/ffmpeg-mt/libavcore/imgutils.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * misc image utilities
- */
-
-#include "imgutils.h"
-#include "internal.h"
-#include "libavutil/pixdesc.h"
-
-void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
-                                const AVPixFmtDescriptor *pixdesc)
-{
-    int i;
-    memset(max_pixsteps, 0, 4*sizeof(max_pixsteps[0]));
-    if (max_pixstep_comps)
-        memset(max_pixstep_comps, 0, 4*sizeof(max_pixstep_comps[0]));
-
-    for (i = 0; i < 4; i++) {
-        const AVComponentDescriptor *comp = &(pixdesc->comp[i]);
-        if ((comp->step_minus1+1) > max_pixsteps[comp->plane]) {
-            max_pixsteps[comp->plane] = comp->step_minus1+1;
-            if (max_pixstep_comps)
-                max_pixstep_comps[comp->plane] = i;
-        }
-    }
-}
-
-int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane)
-{
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-    int max_step     [4];       /* max pixel step for each plane */
-    int max_step_comp[4];       /* the component for each plane which has the max pixel step */
-    int s;
-
-    if (desc->flags & PIX_FMT_BITSTREAM)
-        return (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
-
-    av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
-    s = (max_step_comp[plane] == 1 || max_step_comp[plane] == 2) ? desc->log2_chroma_w : 0;
-    return max_step[plane] * (((width + (1 << s) - 1)) >> s);
-}
-
-int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
-{
-    int i;
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-    int max_step     [4];       /* max pixel step for each plane */
-    int max_step_comp[4];       /* the component for each plane which has the max pixel step */
-
-    memset(linesizes, 0, 4*sizeof(linesizes[0]));
-
-    if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
-        return AVERROR(EINVAL);
-
-    if (desc->flags & PIX_FMT_BITSTREAM) {
-        if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1))
-            return AVERROR(EINVAL);
-        linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
-        return 0;
-    }
-
-    av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
-    for (i = 0; i < 4; i++) {
-        int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0;
-        int shifted_w = ((width + (1 << s) - 1)) >> s;
-        if (max_step[i] > INT_MAX / shifted_w)
-            return AVERROR(EINVAL);
-        linesizes[i] = max_step[i] * shifted_w;
-    }
-
-    return 0;
-}
-
-int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
-                           uint8_t *ptr, const int linesizes[4])
-{
-    int i, total_size, size[4], has_plane[4];
-
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-    memset(data     , 0, sizeof(data[0])*4);
-    memset(size     , 0, sizeof(size));
-    memset(has_plane, 0, sizeof(has_plane));
-
-    if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
-        return AVERROR(EINVAL);
-
-    data[0] = ptr;
-    if (linesizes[0] > (INT_MAX - 1024) / height)
-        return AVERROR(EINVAL);
-    size[0] = linesizes[0] * height;
-
-    if (desc->flags & PIX_FMT_PAL) {
-        size[0] = (size[0] + 3) & ~3;
-        data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
-        return size[0] + 256 * 4;
-    }
-
-    for (i = 0; i < 4; i++)
-        has_plane[desc->comp[i].plane] = 1;
-
-    total_size = size[0];
-    for (i = 1; has_plane[i] && i < 4; i++) {
-        int h, s = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
-        data[i] = data[i-1] + size[i-1];
-        h = (height + (1 << s) - 1) >> s;
-        if (linesizes[i] > INT_MAX / h)
-            return AVERROR(EINVAL);
-        size[i] = h * linesizes[i];
-        if (total_size > INT_MAX - size[i])
-            return AVERROR(EINVAL);
-        total_size += size[i];
-    }
-
-    return total_size;
-}
-
-int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt)
-{
-    int i;
-
-    for (i = 0; i < 256; i++) {
-        int r, g, b;
-
-        switch (pix_fmt) {
-        case PIX_FMT_RGB8:
-            r = (i>>5    )*36;
-            g = ((i>>2)&7)*36;
-            b = (i&3     )*85;
-            break;
-        case PIX_FMT_BGR8:
-            b = (i>>6    )*85;
-            g = ((i>>3)&7)*36;
-            r = (i&7     )*36;
-            break;
-        case PIX_FMT_RGB4_BYTE:
-            r = (i>>3    )*255;
-            g = ((i>>1)&3)*85;
-            b = (i&1     )*255;
-            break;
-        case PIX_FMT_BGR4_BYTE:
-            b = (i>>3    )*255;
-            g = ((i>>1)&3)*85;
-            r = (i&1     )*255;
-            break;
-        case PIX_FMT_GRAY8:
-            r = b = g = i;
-            break;
-        default:
-            return AVERROR(EINVAL);
-        }
-        pal[i] = b + (g<<8) + (r<<16);
-    }
-
-    return 0;
-}
-
-int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
-                   int w, int h, enum PixelFormat pix_fmt, int align)
-{
-    int i, ret;
-    uint8_t *buf;
-
-    if ((ret = av_image_check_size(w, h, 0, NULL)) < 0)
-        return ret;
-    if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, w)) < 0)
-        return ret;
-
-    for (i = 0; i < 4; i++)
-        linesizes[i] = FFALIGN(linesizes[i], align);
-
-    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, NULL, linesizes)) < 0)
-        return ret;
-    buf = av_malloc(ret + align);
-    if (!buf)
-        return AVERROR(ENOMEM);
-    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, buf, linesizes)) < 0) {
-        av_free(buf);
-        return ret;
-    }
-    if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)
-        ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
-
-    return ret;
-}
-
-typedef struct ImgUtils {
-    const AVClass *class;
-    int   log_offset;
-    void *log_ctx;
-} ImgUtils;
-
-static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) };
-
-int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
-{
-    ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx };
-
-    if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
-        return 0;
-
-    av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h);
-    return AVERROR(EINVAL);
-}
-
-void av_image_copy_plane(uint8_t       *dst, int dst_linesize,
-                         const uint8_t *src, int src_linesize,
-                         int bytewidth, int height)
-{
-    if (!dst || !src)
-        return;
-    for (;height > 0; height--) {
-        memcpy(dst, src, bytewidth);
-        dst += dst_linesize;
-        src += src_linesize;
-    }
-}
-
-void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
-                   const uint8_t *src_data[4], const int src_linesizes[4],
-                   enum PixelFormat pix_fmt, int width, int height)
-{
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-
-    if (desc->flags & PIX_FMT_HWACCEL)
-        return;
-
-    if (desc->flags & PIX_FMT_PAL) {
-        av_image_copy_plane(dst_data[0], dst_linesizes[0],
-                            src_data[0], src_linesizes[0],
-                            width, height);
-        /* copy the palette */
-        memcpy(dst_data[1], src_data[1], 4*256);
-    } else {
-        int i, planes_nb = 0;
-
-        for (i = 0; i < desc->nb_components; i++)
-            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
-
-        for (i = 0; i < planes_nb; i++) {
-            int h = height;
-            int bwidth = av_image_get_linesize(pix_fmt, width, i);
-            if (i == 1 || i == 2) {
-                h= -((-height)>>desc->log2_chroma_h);
-            }
-            av_image_copy_plane(dst_data[i], dst_linesizes[i],
-                                src_data[i], src_linesizes[i],
-                                bwidth, h);
-        }
-    }
-}
-
-#if FF_API_OLD_IMAGE_NAMES
-void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
-                                const AVPixFmtDescriptor *pixdesc)
-{
-    av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc);
-}
-
-int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane)
-{
-    return av_image_get_linesize(pix_fmt, width, plane);
-}
-
-int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
-{
-    return av_image_fill_linesizes(linesizes, pix_fmt, width);
-}
-
-int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
-                           uint8_t *ptr, const int linesizes[4])
-{
-    return av_image_fill_pointers(data, pix_fmt, height, ptr, linesizes);
-}
-
-int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
-{
-    return av_image_check_size(w, h, log_offset, log_ctx);
-}
-#endif
diff --git a/ffmpeg-mt/libavcore/imgutils.h b/ffmpeg-mt/libavcore/imgutils.h
deleted file mode 100644
index 6c39d53..0000000
--- a/ffmpeg-mt/libavcore/imgutils.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCORE_IMGUTILS_H
-#define AVCORE_IMGUTILS_H
-
-/**
- * @file
- * misc image utilities
- */
-
-#include "libavutil/pixdesc.h"
-#include "avcore.h"
-
-/**
- * Compute the max pixel step for each plane of an image with a
- * format described by pixdesc.
- *
- * The pixel step is the distance in bytes between the first byte of
- * the group of bytes which describe a pixel component and the first
- * byte of the successive group in the same plane for the same
- * component.
- *
- * @param max_pixsteps an array which is filled with the max pixel step
- * for each plane. Since a plane may contain different pixel
- * components, the computed max_pixsteps[plane] is relative to the
- * component in the plane with the max pixel step.
- * @param max_pixstep_comps an array which is filled with the component
- * for each plane which has the max pixel step. May be NULL.
- */
-void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
-                                const AVPixFmtDescriptor *pixdesc);
-
-/**
- * Compute the size of an image line with format pix_fmt and width
- * width for the plane plane.
- *
- * @return the computed size in bytes
- */
-int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
-
-/**
- * Fill plane linesizes for an image with pixel format pix_fmt and
- * width width.
- *
- * @param linesizes array to be filled with the linesize for each plane
- * @return >= 0 in case of success, a negative error code otherwise
- */
-int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
-
-/**
- * Fill plane data pointers for an image with pixel format pix_fmt and
- * height height.
- *
- * @param data pointers array to be filled with the pointer for each image plane
- * @param ptr the pointer to a buffer which will contain the image
- * @param linesizes[4] the array containing the linesize for each
- * plane, should be filled by av_image_fill_linesizes()
- * @return the size in bytes required for the image buffer, a negative
- * error code in case of failure
- */
-int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
-                           uint8_t *ptr, const int linesizes[4]);
-
-/**
- * Allocate an image with size w and h and pixel format pix_fmt, and
- * fill pointers and linesizes accordingly.
- * The allocated image buffer has to be freed by using
- * av_freep(&pointers[0]).
- *
- * @param align the value to use for buffer size alignment
- * @return the size in bytes required for the image buffer, a negative
- * error code in case of failure
- */
-int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
-                   int w, int h, enum PixelFormat pix_fmt, int align);
-
-/**
- * Copy image plane from src to dst.
- * That is, copy "height" number of lines of "bytewidth" bytes each.
- * The first byte of each successive line is separated by *_linesize
- * bytes.
- *
- * @param dst_linesize linesize for the image plane in dst
- * @param src_linesize linesize for the image plane in src
- */
-void av_image_copy_plane(uint8_t       *dst, int dst_linesize,
-                         const uint8_t *src, int src_linesize,
-                         int bytewidth, int height);
-
-/**
- * Copy image in src_data to dst_data.
- *
- * @param dst_linesize linesizes for the image in dst_data
- * @param src_linesize linesizes for the image in src_data
- */
-void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
-                   const uint8_t *src_data[4], const int src_linesizes[4],
-                   enum PixelFormat pix_fmt, int width, int height);
-
-/**
- * Check if the given dimension of an image is valid, meaning that all
- * bytes of the image can be addressed with a signed int.
- *
- * @param w the width of the picture
- * @param h the height of the picture
- * @param log_offset the offset to sum to the log level for logging with log_ctx
- * @param log_ctx the parent logging context, it may be NULL
- * @return >= 0 if valid, a negative error code otherwise
- */
-int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
-
-#if FF_API_OLD_IMAGE_NAMES
-attribute_deprecated
-void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
-                                const AVPixFmtDescriptor *pixdesc);
-
-attribute_deprecated
-int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
-
-attribute_deprecated
-int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
-
-attribute_deprecated
-int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
-                           uint8_t *ptr, const int linesizes[4]);
-
-attribute_deprecated
-int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
-#endif
-
-#endif /* AVCORE_IMGUTILS_H */
diff --git a/ffmpeg-mt/libavcore/internal.h b/ffmpeg-mt/libavcore/internal.h
deleted file mode 100644
index 3960bd3..0000000
--- a/ffmpeg-mt/libavcore/internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCORE_INTERNAL_H
-#define AVCORE_INTERNAL_H
-
-/**
- * @file
- * internal functions
- */
-
-#include "avcore.h"
-
-int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
-
-#endif /* AVCORE_INTERNAL_H */
diff --git a/ffmpeg-mt/libavcore/libavcore.v b/ffmpeg-mt/libavcore/libavcore.v
deleted file mode 100644
index dc84cc4..0000000
--- a/ffmpeg-mt/libavcore/libavcore.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBAVCORE_$MAJOR {
-        global: av_*; ff_*; avcore*;
-        local: *;
-};
diff --git a/ffmpeg-mt/libavcore/parseutils.c b/ffmpeg-mt/libavcore/parseutils.c
deleted file mode 100644
index abf0422..0000000
--- a/ffmpeg-mt/libavcore/parseutils.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * misc parsing utilities for libavcore
- */
-
-#include <strings.h>
-#include "parseutils.h"
-#include "libavutil/avutil.h"
-#include "libavutil/eval.h"
-#include "libavutil/avstring.h"
-#include "libavutil/random_seed.h"
-
-typedef struct {
-    const char *abbr;
-    int width, height;
-} VideoSizeAbbr;
-
-typedef struct {
-    const char *abbr;
-    AVRational rate;
-} VideoRateAbbr;
-
-static const VideoSizeAbbr video_size_abbrs[] = {
-    { "ntsc",      720, 480 },
-    { "pal",       720, 576 },
-    { "qntsc",     352, 240 }, /* VCD compliant NTSC */
-    { "qpal",      352, 288 }, /* VCD compliant PAL */
-    { "sntsc",     640, 480 }, /* square pixel NTSC */
-    { "spal",      768, 576 }, /* square pixel PAL */
-    { "film",      352, 240 },
-    { "ntsc-film", 352, 240 },
-    { "sqcif",     128,  96 },
-    { "qcif",      176, 144 },
-    { "cif",       352, 288 },
-    { "4cif",      704, 576 },
-    { "16cif",    1408,1152 },
-    { "qqvga",     160, 120 },
-    { "qvga",      320, 240 },
-    { "vga",       640, 480 },
-    { "svga",      800, 600 },
-    { "xga",      1024, 768 },
-    { "uxga",     1600,1200 },
-    { "qxga",     2048,1536 },
-    { "sxga",     1280,1024 },
-    { "qsxga",    2560,2048 },
-    { "hsxga",    5120,4096 },
-    { "wvga",      852, 480 },
-    { "wxga",     1366, 768 },
-    { "wsxga",    1600,1024 },
-    { "wuxga",    1920,1200 },
-    { "woxga",    2560,1600 },
-    { "wqsxga",   3200,2048 },
-    { "wquxga",   3840,2400 },
-    { "whsxga",   6400,4096 },
-    { "whuxga",   7680,4800 },
-    { "cga",       320, 200 },
-    { "ega",       640, 350 },
-    { "hd480",     852, 480 },
-    { "hd720",    1280, 720 },
-    { "hd1080",   1920,1080 },
-};
-
-static const VideoRateAbbr video_rate_abbrs[]= {
-    { "ntsc",      { 30000, 1001 } },
-    { "pal",       {    25,    1 } },
-    { "qntsc",     { 30000, 1001 } }, /* VCD compliant NTSC */
-    { "qpal",      {    25,    1 } }, /* VCD compliant PAL */
-    { "sntsc",     { 30000, 1001 } }, /* square pixel NTSC */
-    { "spal",      {    25,    1 } }, /* square pixel PAL */
-    { "film",      {    24,    1 } },
-    { "ntsc-film", { 24000, 1001 } },
-};
-
-int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
-{
-    int i;
-    int n = FF_ARRAY_ELEMS(video_size_abbrs);
-    char *p;
-    int width = 0, height = 0;
-
-    for (i = 0; i < n; i++) {
-        if (!strcmp(video_size_abbrs[i].abbr, str)) {
-            width  = video_size_abbrs[i].width;
-            height = video_size_abbrs[i].height;
-            break;
-        }
-    }
-    if (i == n) {
-        p = str;
-        width = strtol(p, &p, 10);
-        if (*p)
-            p++;
-        height = strtol(p, &p, 10);
-    }
-    if (width <= 0 || height <= 0)
-        return AVERROR(EINVAL);
-    *width_ptr  = width;
-    *height_ptr = height;
-    return 0;
-}
-
-int av_parse_video_rate(AVRational *rate, const char *arg)
-{
-    int i, ret;
-    int n = FF_ARRAY_ELEMS(video_rate_abbrs);
-    double res;
-
-    /* First, we check our abbreviation table */
-    for (i = 0; i < n; ++i)
-        if (!strcmp(video_rate_abbrs[i].abbr, arg)) {
-            *rate = video_rate_abbrs[i].rate;
-            return 0;
-        }
-
-    /* Then, we try to parse it as fraction */
-    if ((ret = av_expr_parse_and_eval(&res, arg, NULL, NULL, NULL, NULL, NULL, NULL,
-                                      NULL, 0, NULL)) < 0)
-        return ret;
-    *rate = av_d2q(res, 1001000);
-    if (rate->num <= 0 || rate->den <= 0)
-        return AVERROR(EINVAL);
-    return 0;
-}
-
-typedef struct {
-    const char *name;            ///< a string representing the name of the color
-    uint8_t     rgb_color[3];    ///< RGB values for the color
-} ColorEntry;
-
-static ColorEntry color_table[] = {
-    { "AliceBlue",            { 0xF0, 0xF8, 0xFF } },
-    { "AntiqueWhite",         { 0xFA, 0xEB, 0xD7 } },
-    { "Aqua",                 { 0x00, 0xFF, 0xFF } },
-    { "Aquamarine",           { 0x7F, 0xFF, 0xD4 } },
-    { "Azure",                { 0xF0, 0xFF, 0xFF } },
-    { "Beige",                { 0xF5, 0xF5, 0xDC } },
-    { "Bisque",               { 0xFF, 0xE4, 0xC4 } },
-    { "Black",                { 0x00, 0x00, 0x00 } },
-    { "BlanchedAlmond",       { 0xFF, 0xEB, 0xCD } },
-    { "Blue",                 { 0x00, 0x00, 0xFF } },
-    { "BlueViolet",           { 0x8A, 0x2B, 0xE2 } },
-    { "Brown",                { 0xA5, 0x2A, 0x2A } },
-    { "BurlyWood",            { 0xDE, 0xB8, 0x87 } },
-    { "CadetBlue",            { 0x5F, 0x9E, 0xA0 } },
-    { "Chartreuse",           { 0x7F, 0xFF, 0x00 } },
-    { "Chocolate",            { 0xD2, 0x69, 0x1E } },
-    { "Coral",                { 0xFF, 0x7F, 0x50 } },
-    { "CornflowerBlue",       { 0x64, 0x95, 0xED } },
-    { "Cornsilk",             { 0xFF, 0xF8, 0xDC } },
-    { "Crimson",              { 0xDC, 0x14, 0x3C } },
-    { "Cyan",                 { 0x00, 0xFF, 0xFF } },
-    { "DarkBlue",             { 0x00, 0x00, 0x8B } },
-    { "DarkCyan",             { 0x00, 0x8B, 0x8B } },
-    { "DarkGoldenRod",        { 0xB8, 0x86, 0x0B } },
-    { "DarkGray",             { 0xA9, 0xA9, 0xA9 } },
-    { "DarkGreen",            { 0x00, 0x64, 0x00 } },
-    { "DarkKhaki",            { 0xBD, 0xB7, 0x6B } },
-    { "DarkMagenta",          { 0x8B, 0x00, 0x8B } },
-    { "DarkOliveGreen",       { 0x55, 0x6B, 0x2F } },
-    { "Darkorange",           { 0xFF, 0x8C, 0x00 } },
-    { "DarkOrchid",           { 0x99, 0x32, 0xCC } },
-    { "DarkRed",              { 0x8B, 0x00, 0x00 } },
-    { "DarkSalmon",           { 0xE9, 0x96, 0x7A } },
-    { "DarkSeaGreen",         { 0x8F, 0xBC, 0x8F } },
-    { "DarkSlateBlue",        { 0x48, 0x3D, 0x8B } },
-    { "DarkSlateGray",        { 0x2F, 0x4F, 0x4F } },
-    { "DarkTurquoise",        { 0x00, 0xCE, 0xD1 } },
-    { "DarkViolet",           { 0x94, 0x00, 0xD3 } },
-    { "DeepPink",             { 0xFF, 0x14, 0x93 } },
-    { "DeepSkyBlue",          { 0x00, 0xBF, 0xFF } },
-    { "DimGray",              { 0x69, 0x69, 0x69 } },
-    { "DodgerBlue",           { 0x1E, 0x90, 0xFF } },
-    { "FireBrick",            { 0xB2, 0x22, 0x22 } },
-    { "FloralWhite",          { 0xFF, 0xFA, 0xF0 } },
-    { "ForestGreen",          { 0x22, 0x8B, 0x22 } },
-    { "Fuchsia",              { 0xFF, 0x00, 0xFF } },
-    { "Gainsboro",            { 0xDC, 0xDC, 0xDC } },
-    { "GhostWhite",           { 0xF8, 0xF8, 0xFF } },
-    { "Gold",                 { 0xFF, 0xD7, 0x00 } },
-    { "GoldenRod",            { 0xDA, 0xA5, 0x20 } },
-    { "Gray",                 { 0x80, 0x80, 0x80 } },
-    { "Green",                { 0x00, 0x80, 0x00 } },
-    { "GreenYellow",          { 0xAD, 0xFF, 0x2F } },
-    { "HoneyDew",             { 0xF0, 0xFF, 0xF0 } },
-    { "HotPink",              { 0xFF, 0x69, 0xB4 } },
-    { "IndianRed",            { 0xCD, 0x5C, 0x5C } },
-    { "Indigo",               { 0x4B, 0x00, 0x82 } },
-    { "Ivory",                { 0xFF, 0xFF, 0xF0 } },
-    { "Khaki",                { 0xF0, 0xE6, 0x8C } },
-    { "Lavender",             { 0xE6, 0xE6, 0xFA } },
-    { "LavenderBlush",        { 0xFF, 0xF0, 0xF5 } },
-    { "LawnGreen",            { 0x7C, 0xFC, 0x00 } },
-    { "LemonChiffon",         { 0xFF, 0xFA, 0xCD } },
-    { "LightBlue",            { 0xAD, 0xD8, 0xE6 } },
-    { "LightCoral",           { 0xF0, 0x80, 0x80 } },
-    { "LightCyan",            { 0xE0, 0xFF, 0xFF } },
-    { "LightGoldenRodYellow", { 0xFA, 0xFA, 0xD2 } },
-    { "LightGrey",            { 0xD3, 0xD3, 0xD3 } },
-    { "LightGreen",           { 0x90, 0xEE, 0x90 } },
-    { "LightPink",            { 0xFF, 0xB6, 0xC1 } },
-    { "LightSalmon",          { 0xFF, 0xA0, 0x7A } },
-    { "LightSeaGreen",        { 0x20, 0xB2, 0xAA } },
-    { "LightSkyBlue",         { 0x87, 0xCE, 0xFA } },
-    { "LightSlateGray",       { 0x77, 0x88, 0x99 } },
-    { "LightSteelBlue",       { 0xB0, 0xC4, 0xDE } },
-    { "LightYellow",          { 0xFF, 0xFF, 0xE0 } },
-    { "Lime",                 { 0x00, 0xFF, 0x00 } },
-    { "LimeGreen",            { 0x32, 0xCD, 0x32 } },
-    { "Linen",                { 0xFA, 0xF0, 0xE6 } },
-    { "Magenta",              { 0xFF, 0x00, 0xFF } },
-    { "Maroon",               { 0x80, 0x00, 0x00 } },
-    { "MediumAquaMarine",     { 0x66, 0xCD, 0xAA } },
-    { "MediumBlue",           { 0x00, 0x00, 0xCD } },
-    { "MediumOrchid",         { 0xBA, 0x55, 0xD3 } },
-    { "MediumPurple",         { 0x93, 0x70, 0xD8 } },
-    { "MediumSeaGreen",       { 0x3C, 0xB3, 0x71 } },
-    { "MediumSlateBlue",      { 0x7B, 0x68, 0xEE } },
-    { "MediumSpringGreen",    { 0x00, 0xFA, 0x9A } },
-    { "MediumTurquoise",      { 0x48, 0xD1, 0xCC } },
-    { "MediumVioletRed",      { 0xC7, 0x15, 0x85 } },
-    { "MidnightBlue",         { 0x19, 0x19, 0x70 } },
-    { "MintCream",            { 0xF5, 0xFF, 0xFA } },
-    { "MistyRose",            { 0xFF, 0xE4, 0xE1 } },
-    { "Moccasin",             { 0xFF, 0xE4, 0xB5 } },
-    { "NavajoWhite",          { 0xFF, 0xDE, 0xAD } },
-    { "Navy",                 { 0x00, 0x00, 0x80 } },
-    { "OldLace",              { 0xFD, 0xF5, 0xE6 } },
-    { "Olive",                { 0x80, 0x80, 0x00 } },
-    { "OliveDrab",            { 0x6B, 0x8E, 0x23 } },
-    { "Orange",               { 0xFF, 0xA5, 0x00 } },
-    { "OrangeRed",            { 0xFF, 0x45, 0x00 } },
-    { "Orchid",               { 0xDA, 0x70, 0xD6 } },
-    { "PaleGoldenRod",        { 0xEE, 0xE8, 0xAA } },
-    { "PaleGreen",            { 0x98, 0xFB, 0x98 } },
-    { "PaleTurquoise",        { 0xAF, 0xEE, 0xEE } },
-    { "PaleVioletRed",        { 0xD8, 0x70, 0x93 } },
-    { "PapayaWhip",           { 0xFF, 0xEF, 0xD5 } },
-    { "PeachPuff",            { 0xFF, 0xDA, 0xB9 } },
-    { "Peru",                 { 0xCD, 0x85, 0x3F } },
-    { "Pink",                 { 0xFF, 0xC0, 0xCB } },
-    { "Plum",                 { 0xDD, 0xA0, 0xDD } },
-    { "PowderBlue",           { 0xB0, 0xE0, 0xE6 } },
-    { "Purple",               { 0x80, 0x00, 0x80 } },
-    { "Red",                  { 0xFF, 0x00, 0x00 } },
-    { "RosyBrown",            { 0xBC, 0x8F, 0x8F } },
-    { "RoyalBlue",            { 0x41, 0x69, 0xE1 } },
-    { "SaddleBrown",          { 0x8B, 0x45, 0x13 } },
-    { "Salmon",               { 0xFA, 0x80, 0x72 } },
-    { "SandyBrown",           { 0xF4, 0xA4, 0x60 } },
-    { "SeaGreen",             { 0x2E, 0x8B, 0x57 } },
-    { "SeaShell",             { 0xFF, 0xF5, 0xEE } },
-    { "Sienna",               { 0xA0, 0x52, 0x2D } },
-    { "Silver",               { 0xC0, 0xC0, 0xC0 } },
-    { "SkyBlue",              { 0x87, 0xCE, 0xEB } },
-    { "SlateBlue",            { 0x6A, 0x5A, 0xCD } },
-    { "SlateGray",            { 0x70, 0x80, 0x90 } },
-    { "Snow",                 { 0xFF, 0xFA, 0xFA } },
-    { "SpringGreen",          { 0x00, 0xFF, 0x7F } },
-    { "SteelBlue",            { 0x46, 0x82, 0xB4 } },
-    { "Tan",                  { 0xD2, 0xB4, 0x8C } },
-    { "Teal",                 { 0x00, 0x80, 0x80 } },
-    { "Thistle",              { 0xD8, 0xBF, 0xD8 } },
-    { "Tomato",               { 0xFF, 0x63, 0x47 } },
-    { "Turquoise",            { 0x40, 0xE0, 0xD0 } },
-    { "Violet",               { 0xEE, 0x82, 0xEE } },
-    { "Wheat",                { 0xF5, 0xDE, 0xB3 } },
-    { "White",                { 0xFF, 0xFF, 0xFF } },
-    { "WhiteSmoke",           { 0xF5, 0xF5, 0xF5 } },
-    { "Yellow",               { 0xFF, 0xFF, 0x00 } },
-    { "YellowGreen",          { 0x9A, 0xCD, 0x32 } },
-};
-
-static int color_table_compare(const void *lhs, const void *rhs)
-{
-    return strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
-}
-
-#define ALPHA_SEP '@'
-
-int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
-                   void *log_ctx)
-{
-    char *tail, color_string2[128];
-    const ColorEntry *entry;
-    int len, hex_offset = 0;
-
-    if (color_string[0] == '#') {
-        hex_offset = 1;
-    } else if (!strncmp(color_string, "0x", 2))
-        hex_offset = 2;
-
-    if (slen < 0)
-        slen = strlen(color_string);
-    av_strlcpy(color_string2, color_string + hex_offset,
-               FFMIN(slen-hex_offset+1, sizeof(color_string2)));
-    if ((tail = strchr(color_string2, ALPHA_SEP)))
-        *tail++ = 0;
-    len = strlen(color_string2);
-    rgba_color[3] = 255;
-
-    if (!strcasecmp(color_string2, "random") || !strcasecmp(color_string2, "bikeshed")) {
-        int rgba = av_get_random_seed();
-        rgba_color[0] = rgba >> 24;
-        rgba_color[1] = rgba >> 16;
-        rgba_color[2] = rgba >> 8;
-        rgba_color[3] = rgba;
-    } else if (hex_offset ||
-               strspn(color_string2, "0123456789ABCDEFabcdef") == len) {
-        char *tail;
-        unsigned int rgba = strtoul(color_string2, &tail, 16);
-
-        if (*tail || (len != 6 && len != 8)) {
-            av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string2);
-            return AVERROR(EINVAL);
-        }
-        if (len == 8) {
-            rgba_color[3] = rgba;
-            rgba >>= 8;
-        }
-        rgba_color[0] = rgba >> 16;
-        rgba_color[1] = rgba >> 8;
-        rgba_color[2] = rgba;
-    } else {
-        entry = bsearch(color_string2,
-                        color_table,
-                        FF_ARRAY_ELEMS(color_table),
-                        sizeof(ColorEntry),
-                        color_table_compare);
-        if (!entry) {
-            av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string2);
-            return AVERROR(EINVAL);
-        }
-        memcpy(rgba_color, entry->rgb_color, 3);
-    }
-
-    if (tail) {
-        unsigned long int alpha;
-        const char *alpha_string = tail;
-        if (!strncmp(alpha_string, "0x", 2)) {
-            alpha = strtoul(alpha_string, &tail, 16);
-        } else {
-            alpha = 255 * strtod(alpha_string, &tail);
-        }
-
-        if (tail == alpha_string || *tail || alpha > 255) {
-            av_log(log_ctx, AV_LOG_ERROR, "Invalid alpha value specifier '%s' in '%s'\n",
-                   alpha_string, color_string);
-            return AVERROR(EINVAL);
-        }
-        rgba_color[3] = alpha;
-    }
-
-    return 0;
-}
-
-#ifdef TEST
-
-#undef printf
-
-int main(void)
-{
-    printf("Testing av_parse_video_rate()\n");
-    {
-        int i;
-        const char *rates[] = {
-            "-inf",
-            "inf",
-            "nan",
-            "123/0",
-            "-123 / 0",
-            "",
-            "/",
-            " 123  /  321",
-            "foo/foo",
-            "foo/1",
-            "1/foo",
-            "0/0",
-            "/0",
-            "1/",
-            "1",
-            "0",
-            "-123/123",
-            "-foo",
-            "123.23",
-            ".23",
-            "-.23",
-            "-0.234",
-            "-0.0000001",
-            "  21332.2324   ",
-            " -21332.2324   ",
-        };
-
-        for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
-            int ret;
-            AVRational q = (AVRational){0, 0};
-            ret = av_parse_video_rate(&q, rates[i]),
-            printf("'%s' -> %d/%d ret:%d\n",
-                   rates[i], q.num, q.den, ret);
-        }
-    }
-
-    printf("\nTesting av_parse_color()\n");
-    {
-        int i;
-        uint8_t rgba[4];
-        const char *color_names[] = {
-            "bikeshed",
-            "RaNdOm",
-            "foo",
-            "red",
-            "Red ",
-            "RED",
-            "Violet",
-            "Yellow",
-            "Red",
-            "0x000000",
-            "0x0000000",
-            "0xff000000",
-            "0x3e34ff",
-            "0x3e34ffaa",
-            "0xffXXee",
-            "0xfoobar",
-            "0xffffeeeeeeee",
-            "#ff0000",
-            "#ffXX00",
-            "ff0000",
-            "ffXX00",
-            "red at foo",
-            "random at 10",
-            "0xff0000 at 1.0",
-            "red@",
-            "red at 0xfff",
-            "red at 0xf",
-            "red at 2",
-            "red at 0.1",
-            "red at -1",
-            "red at 0.5",
-            "red at 1.0",
-            "red at 256",
-            "red at 10foo",
-            "red at -1.0",
-            "red at -0.0",
-        };
-
-        av_log_set_level(AV_LOG_DEBUG);
-
-        for (i = 0;  i < FF_ARRAY_ELEMS(color_names); i++) {
-            if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
-                printf("%s -> R(%d) G(%d) B(%d) A(%d)\n", color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
-        }
-    }
-
-    return 0;
-}
-
-#endif /* TEST */
diff --git a/ffmpeg-mt/libavcore/parseutils.h b/ffmpeg-mt/libavcore/parseutils.h
deleted file mode 100644
index 052427b..0000000
--- a/ffmpeg-mt/libavcore/parseutils.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCORE_PARSEUTILS_H
-#define AVCORE_PARSEUTILS_H
-
-#include "libavutil/rational.h"
-
-/**
- * @file
- * misc parsing utilities for libavcore
- */
-
-/**
- * Parse str and put in width_ptr and height_ptr the detected values.
- *
- * @param[in,out] width_ptr pointer to the variable which will contain the detected
- * width value
- * @param[in,out] height_ptr pointer to the variable which will contain the detected
- * height value
- * @param[in] str the string to parse: it has to be a string in the format
- * width x height or a valid video size abbreviation.
- * @return >= 0 on success, a negative error code otherwise
- */
-int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str);
-
-/**
- * Parse str and store the detected values in *rate.
- *
- * @param[in,out] rate pointer to the AVRational which will contain the detected
- * frame rate
- * @param[in] str the string to parse: it has to be a string in the format
- * rate_num / rate_den, a float number or a valid video rate abbreviation
- * @return >= 0 on success, a negative error code otherwise
- */
-int av_parse_video_rate(AVRational *rate, const char *str);
-
-/**
- * Put the RGBA values that correspond to color_string in rgba_color.
- *
- * @param color_string a string specifying a color. It can be the name of
- * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence,
- * possibly followed by "@" and a string representing the alpha
- * component.
- * The alpha component may be a string composed by "0x" followed by an
- * hexadecimal number or a decimal number between 0.0 and 1.0, which
- * represents the opacity value (0x00/0.0 means completely transparent,
- * 0xff/1.0 completely opaque).
- * If the alpha component is not specified then 0xff is assumed.
- * The string "random" will result in a random color.
- * @param slen length of the initial part of color_string containing the
- * color. It can be set to -1 if color_string is a null terminated string
- * containing nothing else than the color.
- * @return >= 0 in case of success, a negative value in case of
- * failure (for example if color_string cannot be parsed).
- */
-int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
-                   void *log_ctx);
-
-#endif /* AVCORE_PARSEUTILS_H */
diff --git a/ffmpeg-mt/libavcore/samplefmt.c b/ffmpeg-mt/libavcore/samplefmt.c
deleted file mode 100644
index 532acd9..0000000
--- a/ffmpeg-mt/libavcore/samplefmt.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcore.h"
-#include "samplefmt.h"
-
-typedef struct SampleFmtInfo {
-    const char *name;
-    int bits;
-} SampleFmtInfo;
-
-/** this table gives more information about formats */
-static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = {
-    [AV_SAMPLE_FMT_U8]  = { .name = "u8",  .bits = 8 },
-    [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 },
-    [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 },
-    [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 },
-    [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 },
-};
-
-const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
-{
-    if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
-        return NULL;
-    return sample_fmt_info[sample_fmt].name;
-}
-
-enum AVSampleFormat av_get_sample_fmt(const char *name)
-{
-    int i;
-
-    for (i = 0; i < AV_SAMPLE_FMT_NB; i++)
-        if (!strcmp(sample_fmt_info[i].name, name))
-            return i;
-    return AV_SAMPLE_FMT_NONE;
-}
-
-char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt)
-{
-    /* print header */
-    if (sample_fmt < 0)
-        snprintf(buf, buf_size, "name  " " depth");
-    else if (sample_fmt < AV_SAMPLE_FMT_NB) {
-        SampleFmtInfo info = sample_fmt_info[sample_fmt];
-        snprintf (buf, buf_size, "%-6s" "   %2d ", info.name, info.bits);
-    }
-
-    return buf;
-}
-
-int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt)
-{
-    return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ?
-        0 : sample_fmt_info[sample_fmt].bits;
-}
diff --git a/ffmpeg-mt/libavcore/samplefmt.h b/ffmpeg-mt/libavcore/samplefmt.h
deleted file mode 100644
index 9701efe..0000000
--- a/ffmpeg-mt/libavcore/samplefmt.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCORE_SAMPLEFMT_H
-#define AVCORE_SAMPLEFMT_H
-
-#include "avcore.h"
-
-/**
- * all in native-endian format
- */
-enum AVSampleFormat {
-    AV_SAMPLE_FMT_NONE = -1,
-    AV_SAMPLE_FMT_U8,          ///< unsigned 8 bits
-    AV_SAMPLE_FMT_S16,         ///< signed 16 bits
-    AV_SAMPLE_FMT_S32,         ///< signed 32 bits
-    AV_SAMPLE_FMT_FLT,         ///< float
-    AV_SAMPLE_FMT_DBL,         ///< double
-    AV_SAMPLE_FMT_NB           ///< Number of sample formats. DO NOT USE if dynamically linking to libavcore
-};
-
-/**
- * Return the name of sample_fmt, or NULL if sample_fmt is not
- * recognized.
- */
-const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
-
-/**
- * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
- * on error.
- */
-enum AVSampleFormat av_get_sample_fmt(const char *name);
-
-/**
- * Generate a string corresponding to the sample format with
- * sample_fmt, or a header if sample_fmt is negative.
- *
- * @param buf the buffer where to write the string
- * @param buf_size the size of buf
- * @param sample_fmt the number of the sample format to print the
- * corresponding info string, or a negative value to print the
- * corresponding header.
- * @return the pointer to the filled buffer or NULL if sample_fmt is
- * unknown or in case of other errors
- */
-char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
-
-/**
- * Return sample format bits per sample.
- *
- * @param sample_fmt the sample format
- * @return number of bits per sample or zero if unknown for the given
- * sample format
- */
-int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt);
-
-#endif /* AVCORE_SAMPLEFMT_H */
diff --git a/ffmpeg-mt/libavcore/utils.c b/ffmpeg-mt/libavcore/utils.c
deleted file mode 100644
index 8350a9b..0000000
--- a/ffmpeg-mt/libavcore/utils.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "avcore.h"
-
-/**
- * @file
- * various utility functions
- */
-
-unsigned avcore_version(void)
-{
-    return LIBAVCORE_VERSION_INT;
-}
-
-const char *avcore_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char *avcore_license(void)
-{
-#define LICENSE_PREFIX "libavcore license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
diff --git a/ffmpeg-mt/libavdevice/Makefile b/ffmpeg-mt/libavdevice/Makefile
index 1c0630b..5cfc5e8 100644
--- a/ffmpeg-mt/libavdevice/Makefile
+++ b/ffmpeg-mt/libavdevice/Makefile
@@ -1,7 +1,7 @@
 include $(SUBDIR)../config.mak
 
 NAME    = avdevice
-FFLIBS  = avformat avcodec avcore avutil
+FFLIBS  = avformat avcodec avutil
 
 HEADERS = avdevice.h
 
@@ -14,9 +14,12 @@ OBJS-$(CONFIG_ALSA_OUTDEV)               += alsa-audio-common.o \
                                             alsa-audio-enc.o
 OBJS-$(CONFIG_BKTR_INDEV)                += bktr.o
 OBJS-$(CONFIG_DV1394_INDEV)              += dv1394.o
+OBJS-$(CONFIG_FBDEV_INDEV)               += fbdev.o
 OBJS-$(CONFIG_JACK_INDEV)                += jack_audio.o
 OBJS-$(CONFIG_OSS_INDEV)                 += oss_audio.o
 OBJS-$(CONFIG_OSS_OUTDEV)                += oss_audio.o
+OBJS-$(CONFIG_SNDIO_INDEV)               += sndio_common.o sndio_dec.o
+OBJS-$(CONFIG_SNDIO_OUTDEV)              += sndio_common.o sndio_enc.o
 OBJS-$(CONFIG_V4L2_INDEV)                += v4l2.o
 OBJS-$(CONFIG_V4L_INDEV)                 += v4l.o
 OBJS-$(CONFIG_VFWCAP_INDEV)              += vfwcap.o
@@ -26,5 +29,6 @@ OBJS-$(CONFIG_X11_GRAB_DEVICE_INDEV)     += x11grab.o
 OBJS-$(CONFIG_LIBDC1394_INDEV)           += libdc1394.o
 
 SKIPHEADERS-$(HAVE_ALSA_ASOUNDLIB_H)     += alsa-audio.h
+SKIPHEADERS-$(HAVE_SNDIO_H)              += sndio_common.h
 
 include $(SUBDIR)../subdir.mak
diff --git a/ffmpeg-mt/libavdevice/alldevices.c b/ffmpeg-mt/libavdevice/alldevices.c
index de3bc82..0e2cf6d 100644
--- a/ffmpeg-mt/libavdevice/alldevices.c
+++ b/ffmpeg-mt/libavdevice/alldevices.c
@@ -1,20 +1,20 @@
 /*
  * Register all the grabbing devices.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,11 +23,11 @@
 #include "avdevice.h"
 
 #define REGISTER_OUTDEV(X,x) { \
-          extern AVOutputFormat x##_muxer; \
-          if(CONFIG_##X##_OUTDEV)  av_register_output_format(&x##_muxer); }
+          extern AVOutputFormat ff_##x##_muxer; \
+          if(CONFIG_##X##_OUTDEV)  av_register_output_format(&ff_##x##_muxer); }
 #define REGISTER_INDEV(X,x) { \
-          extern AVInputFormat x##_demuxer; \
-          if(CONFIG_##X##_INDEV)   av_register_input_format(&x##_demuxer); }
+          extern AVInputFormat ff_##x##_demuxer; \
+          if(CONFIG_##X##_INDEV)   av_register_input_format(&ff_##x##_demuxer); }
 #define REGISTER_INOUTDEV(X,x)  REGISTER_OUTDEV(X,x); REGISTER_INDEV(X,x)
 
 void avdevice_register_all(void)
@@ -42,8 +42,10 @@ void avdevice_register_all(void)
     REGISTER_INOUTDEV (ALSA, alsa);
     REGISTER_INDEV    (BKTR, bktr);
     REGISTER_INDEV    (DV1394, dv1394);
+    REGISTER_INDEV    (FBDEV, fbdev);
     REGISTER_INDEV    (JACK, jack);
     REGISTER_INOUTDEV (OSS, oss);
+    REGISTER_INOUTDEV (SNDIO, sndio);
     REGISTER_INDEV    (V4L2, v4l2);
     REGISTER_INDEV    (V4L, v4l);
     REGISTER_INDEV    (VFWCAP, vfwcap);
diff --git a/ffmpeg-mt/libavdevice/alsa-audio-common.c b/ffmpeg-mt/libavdevice/alsa-audio-common.c
index 38cb0de..ff6c9f8 100644
--- a/ffmpeg-mt/libavdevice/alsa-audio-common.c
+++ b/ffmpeg-mt/libavdevice/alsa-audio-common.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
  * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavdevice/alsa-audio-dec.c b/ffmpeg-mt/libavdevice/alsa-audio-dec.c
index f1dd29b..c467fc0 100644
--- a/ffmpeg-mt/libavdevice/alsa-audio-dec.c
+++ b/ffmpeg-mt/libavdevice/alsa-audio-dec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
  * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -163,7 +163,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat alsa_demuxer = {
+AVInputFormat ff_alsa_demuxer = {
     "alsa",
     NULL_IF_CONFIG_SMALL("ALSA audio input"),
     sizeof(AlsaData),
diff --git a/ffmpeg-mt/libavdevice/alsa-audio-enc.c b/ffmpeg-mt/libavdevice/alsa-audio-enc.c
index 7c07bf7..ebe598c 100644
--- a/ffmpeg-mt/libavdevice/alsa-audio-enc.c
+++ b/ffmpeg-mt/libavdevice/alsa-audio-enc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
  * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -93,7 +93,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
     return 0;
 }
 
-AVOutputFormat alsa_muxer = {
+AVOutputFormat ff_alsa_muxer = {
     "alsa",
     NULL_IF_CONFIG_SMALL("ALSA audio output"),
     "",
diff --git a/ffmpeg-mt/libavdevice/alsa-audio.h b/ffmpeg-mt/libavdevice/alsa-audio.h
index 9493831..7a1b018 100644
--- a/ffmpeg-mt/libavdevice/alsa-audio.h
+++ b/ffmpeg-mt/libavdevice/alsa-audio.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
  * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavdevice/avdevice.c b/ffmpeg-mt/libavdevice/avdevice.c
index 3d67b4b..4813a3d 100644
--- a/ffmpeg-mt/libavdevice/avdevice.c
+++ b/ffmpeg-mt/libavdevice/avdevice.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,11 +25,11 @@ unsigned avdevice_version(void)
 
 const char * avdevice_configuration(void)
 {
-    return FFMPEG_CONFIGURATION;
+    return LIBAV_CONFIGURATION;
 }
 
 const char * avdevice_license(void)
 {
 #define LICENSE_PREFIX "libavdevice license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+    return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
diff --git a/ffmpeg-mt/libavdevice/avdevice.h b/ffmpeg-mt/libavdevice/avdevice.h
index 5c3739f..497683a 100644
--- a/ffmpeg-mt/libavdevice/avdevice.h
+++ b/ffmpeg-mt/libavdevice/avdevice.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -22,8 +22,8 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVDEVICE_VERSION_MAJOR 52
-#define LIBAVDEVICE_VERSION_MINOR  2
-#define LIBAVDEVICE_VERSION_MICRO  3
+#define LIBAVDEVICE_VERSION_MINOR  4
+#define LIBAVDEVICE_VERSION_MICRO  0
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
                                                LIBAVDEVICE_VERSION_MINOR, \
diff --git a/ffmpeg-mt/libavdevice/bktr.c b/ffmpeg-mt/libavdevice/bktr.c
index afb94b6..3e705a0 100644
--- a/ffmpeg-mt/libavdevice/bktr.c
+++ b/ffmpeg-mt/libavdevice/bktr.c
@@ -7,20 +7,20 @@
  * and
  *           simple_grab.c Copyright (c) 1999 Roger Hardiman
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -314,7 +314,7 @@ static int grab_read_close(AVFormatContext *s1)
     return 0;
 }
 
-AVInputFormat bktr_demuxer = {
+AVInputFormat ff_bktr_demuxer = {
     "bktr",
     NULL_IF_CONFIG_SMALL("video grab"),
     sizeof(VideoData),
diff --git a/ffmpeg-mt/libavdevice/dv1394.c b/ffmpeg-mt/libavdevice/dv1394.c
index a55fa97..70f928e 100644
--- a/ffmpeg-mt/libavdevice/dv1394.c
+++ b/ffmpeg-mt/libavdevice/dv1394.c
@@ -2,20 +2,20 @@
  * Linux DV1394 interface
  * Copyright (c) 2003 Max Krasnyansky <maxk at qualcomm.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -227,7 +227,7 @@ static int dv1394_close(AVFormatContext * context)
     return 0;
 }
 
-AVInputFormat dv1394_demuxer = {
+AVInputFormat ff_dv1394_demuxer = {
     .name           = "dv1394",
     .long_name      = NULL_IF_CONFIG_SMALL("DV1394 A/V grab"),
     .priv_data_size = sizeof(struct dv1394_data),
diff --git a/ffmpeg-mt/libavdevice/dv1394.h b/ffmpeg-mt/libavdevice/dv1394.h
index 00706f7..5ccc68a 100644
--- a/ffmpeg-mt/libavdevice/dv1394.h
+++ b/ffmpeg-mt/libavdevice/dv1394.h
@@ -8,20 +8,20 @@
  *   Copyright (C)1999,2000 Sebastien Rougeaux <sebastien.rougeaux at anu.edu.au>
  *                          Peter Schlaile <udbz at rz.uni-karlsruhe.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavdevice/fbdev.c b/ffmpeg-mt/libavdevice/fbdev.c
new file mode 100644
index 0000000..6b03be4
--- /dev/null
+++ b/ffmpeg-mt/libavdevice/fbdev.c
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2011 Stefano Sabatini
+ * Copyright (c) 2009 Giliard B. de Freitas <giliarde at gmail.com>
+ * Copyright (C) 2002 Gunnar Monell <gmo at linux.nu>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Linux framebuffer input device,
+ * inspired by code from fbgrab.c by Gunnar Monell.
+ * See also http://linux-fbdev.sourceforge.net/.
+ */
+
+/* #define DEBUG */
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/mman.h>
+#include <time.h>
+#include <linux/fb.h>
+
+#include "libavutil/mem.h"
+#include "libavutil/pixdesc.h"
+#include "libavformat/avformat.h"
+
+struct rgb_pixfmt_map_entry {
+    int bits_per_pixel;
+    int red_offset, green_offset, blue_offset, alpha_offset;
+    enum PixelFormat pixfmt;
+};
+
+static struct rgb_pixfmt_map_entry rgb_pixfmt_map[] = {
+    // bpp, red_offset,  green_offset, blue_offset, alpha_offset, pixfmt
+    {  32,       0,           8,          16,           24,   PIX_FMT_RGBA  },
+    {  32,      16,           8,           0,           24,   PIX_FMT_BGRA  },
+    {  32,       8,          16,          24,            0,   PIX_FMT_ARGB  },
+    {  32,       3,           2,           8,            0,   PIX_FMT_ABGR  },
+    {  24,       0,           8,          16,            0,   PIX_FMT_RGB24 },
+    {  24,      16,           8,           0,            0,   PIX_FMT_BGR24 },
+};
+
+static enum PixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo)
+{
+    int i;
+
+    for (i = 0; i < FF_ARRAY_ELEMS(rgb_pixfmt_map); i++) {
+        struct rgb_pixfmt_map_entry *entry = &rgb_pixfmt_map[i];
+        if (entry->bits_per_pixel == varinfo->bits_per_pixel &&
+            entry->red_offset     == varinfo->red.offset     &&
+            entry->green_offset   == varinfo->green.offset   &&
+            entry->blue_offset    == varinfo->blue.offset)
+            return entry->pixfmt;
+    }
+
+    return PIX_FMT_NONE;
+}
+
+typedef struct {
+    int frame_size;          ///< size in bytes of a grabbed frame
+    AVRational time_base;    ///< time base
+    int64_t time_frame;      ///< time for the next frame to output (in 1/1000000 units)
+
+    int fd;                  ///< framebuffer device file descriptor
+    int width, heigth;       ///< assumed frame resolution
+    int frame_linesize;      ///< linesize of the output frame, it is assumed to be constant
+    int bytes_per_pixel;
+
+    struct fb_var_screeninfo varinfo; ///< variable info;
+    struct fb_fix_screeninfo fixinfo; ///< fixed    info;
+
+    uint8_t *data;           ///< framebuffer data
+} FBDevContext;
+
+av_cold static int fbdev_read_header(AVFormatContext *avctx,
+                                     AVFormatParameters *ap)
+{
+    FBDevContext *fbdev = avctx->priv_data;
+    AVStream *st = NULL;
+    enum PixelFormat pix_fmt;
+    int ret, flags = O_RDONLY;
+
+    if (!(st = av_new_stream(avctx, 0)))
+        return AVERROR(ENOMEM);
+    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
+
+    if (ap->time_base.den <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid time base %d/%d\n",
+               ap->time_base.num, ap->time_base.den);
+        return AVERROR(EINVAL);
+    }
+
+    /* NONBLOCK is ignored by the fbdev driver, only set for consistency */
+    if (avctx->flags & AVFMT_FLAG_NONBLOCK)
+        flags |= O_NONBLOCK;
+
+    if ((fbdev->fd = open(avctx->filename, flags)) == -1) {
+        ret = AVERROR(errno);
+        av_log(avctx, AV_LOG_ERROR,
+               "Could not open framebuffer device '%s': %s\n",
+               avctx->filename, strerror(ret));
+        return ret;
+    }
+
+    if (ioctl(fbdev->fd, FBIOGET_VSCREENINFO, &fbdev->varinfo) < 0) {
+        ret = AVERROR(errno);
+        av_log(avctx, AV_LOG_ERROR,
+               "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
+        goto fail;
+    }
+
+    if (ioctl(fbdev->fd, FBIOGET_FSCREENINFO, &fbdev->fixinfo) < 0) {
+        ret = AVERROR(errno);
+        av_log(avctx, AV_LOG_ERROR,
+               "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
+        goto fail;
+    }
+
+    pix_fmt = get_pixfmt_from_fb_varinfo(&fbdev->varinfo);
+    if (pix_fmt == PIX_FMT_NONE) {
+        ret = AVERROR(EINVAL);
+        av_log(avctx, AV_LOG_ERROR,
+               "Framebuffer pixel format not supported.\n");
+        goto fail;
+    }
+
+    fbdev->width           = fbdev->varinfo.xres;
+    fbdev->heigth          = fbdev->varinfo.yres;
+    fbdev->bytes_per_pixel = (fbdev->varinfo.bits_per_pixel + 7) >> 3;
+    fbdev->frame_linesize  = fbdev->width * fbdev->bytes_per_pixel;
+    fbdev->frame_size      = fbdev->frame_linesize * fbdev->heigth;
+    fbdev->time_base       = ap->time_base;
+    fbdev->time_frame      = AV_NOPTS_VALUE;
+    fbdev->data = mmap(NULL, fbdev->fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->fd, 0);
+    if (fbdev->data == MAP_FAILED) {
+        ret = AVERROR(errno);
+        av_log(avctx, AV_LOG_ERROR, "Error in mmap(): %s\n", strerror(errno));
+        goto fail;
+    }
+
+    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+    st->codec->codec_id   = CODEC_ID_RAWVIDEO;
+    st->codec->width      = fbdev->width;
+    st->codec->height     = fbdev->heigth;
+    st->codec->pix_fmt    = pix_fmt;
+    st->codec->time_base  = ap->time_base;
+    st->codec->bit_rate   =
+        fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel / av_q2d(ap->time_base) * 8;
+
+    av_log(avctx, AV_LOG_INFO,
+           "w:%d h:%d bpp:%d pixfmt:%s tb:%d/%d bit_rate:%d\n",
+           fbdev->width, fbdev->heigth, fbdev->varinfo.bits_per_pixel,
+           av_pix_fmt_descriptors[pix_fmt].name,
+           ap->time_base.num, ap->time_base.den,
+           st->codec->bit_rate);
+    return 0;
+
+fail:
+    close(fbdev->fd);
+    return ret;
+}
+
+static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
+{
+    FBDevContext *fbdev = avctx->priv_data;
+    int64_t curtime, delay;
+    struct timespec ts;
+    int i, ret;
+    uint8_t *pin, *pout;
+
+    if (fbdev->time_frame == AV_NOPTS_VALUE)
+        fbdev->time_frame = av_gettime();
+
+    /* wait based on the frame rate */
+    curtime = av_gettime();
+    delay = fbdev->time_frame - curtime;
+    av_dlog(avctx,
+            "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
+            fbdev->time_frame, curtime, delay);
+    if (delay > 0) {
+        if (avctx->flags & AVFMT_FLAG_NONBLOCK)
+            return AVERROR(EAGAIN);
+        ts.tv_sec  =  delay / 1000000;
+        ts.tv_nsec = (delay % 1000000) * 1000;
+        while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
+    }
+    /* compute the time of the next frame */
+    fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
+
+    if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0)
+        return ret;
+
+    /* refresh fbdev->varinfo, visible data position may change at each call */
+    if (ioctl(fbdev->fd, FBIOGET_VSCREENINFO, &fbdev->varinfo) < 0)
+        av_log(avctx, AV_LOG_WARNING,
+               "Error refreshing variable info: %s\n", strerror(errno));
+
+    pkt->pts = curtime;
+
+    /* compute visible data offset */
+    pin = fbdev->data + fbdev->bytes_per_pixel * fbdev->varinfo.xoffset +
+                        fbdev->varinfo.yoffset * fbdev->fixinfo.line_length;
+    pout = pkt->data;
+
+    // TODO it'd be nice if the lines were aligned
+    for (i = 0; i < fbdev->heigth; i++) {
+        memcpy(pout, pin, fbdev->frame_linesize);
+        pin  += fbdev->fixinfo.line_length;
+        pout += fbdev->frame_linesize;
+    }
+
+    return fbdev->frame_size;
+}
+
+av_cold static int fbdev_read_close(AVFormatContext *avctx)
+{
+    FBDevContext *fbdev = avctx->priv_data;
+
+    munmap(fbdev->data, fbdev->frame_size);
+    close(fbdev->fd);
+
+    return 0;
+}
+
+AVInputFormat ff_fbdev_demuxer = {
+    .name           = "fbdev",
+    .long_name      = NULL_IF_CONFIG_SMALL("Linux framebuffer"),
+    .priv_data_size = sizeof(FBDevContext),
+    .read_header    = fbdev_read_header,
+    .read_packet    = fbdev_read_packet,
+    .read_close     = fbdev_read_close,
+    .flags          = AVFMT_NOFILE,
+};
diff --git a/ffmpeg-mt/libavdevice/jack_audio.c b/ffmpeg-mt/libavdevice/jack_audio.c
index b41bbdf..4af89bd 100644
--- a/ffmpeg-mt/libavdevice/jack_audio.c
+++ b/ffmpeg-mt/libavdevice/jack_audio.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Samalyse
  * Author: Olivier Guilyardi <olivier samalyse com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -314,7 +314,7 @@ static int audio_read_close(AVFormatContext *context)
     return 0;
 }
 
-AVInputFormat jack_demuxer = {
+AVInputFormat ff_jack_demuxer = {
     "jack",
     NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
     sizeof(JackData),
diff --git a/ffmpeg-mt/libavdevice/libdc1394.c b/ffmpeg-mt/libavdevice/libdc1394.c
index 1f35135..e637af5 100644
--- a/ffmpeg-mt/libavdevice/libdc1394.c
+++ b/ffmpeg-mt/libavdevice/libdc1394.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2004 Roman Shaposhnik
  * Copyright (c) 2008 Alessandro Sappia
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -348,7 +348,7 @@ static int dc1394_v2_close(AVFormatContext * context)
     return 0;
 }
 
-AVInputFormat libdc1394_demuxer = {
+AVInputFormat ff_libdc1394_demuxer = {
     .name           = "libdc1394",
     .long_name      = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"),
     .priv_data_size = sizeof(struct dc1394_data),
@@ -360,7 +360,7 @@ AVInputFormat libdc1394_demuxer = {
 
 #endif
 #if HAVE_LIBDC1394_1
-AVInputFormat libdc1394_demuxer = {
+AVInputFormat ff_libdc1394_demuxer = {
     .name           = "libdc1394",
     .long_name      = NULL_IF_CONFIG_SMALL("dc1394 v.1 A/V grab"),
     .priv_data_size = sizeof(struct dc1394_data),
diff --git a/ffmpeg-mt/libavdevice/oss_audio.c b/ffmpeg-mt/libavdevice/oss_audio.c
index 9d00710..7c4a65d 100644
--- a/ffmpeg-mt/libavdevice/oss_audio.c
+++ b/ffmpeg-mt/libavdevice/oss_audio.c
@@ -2,20 +2,20 @@
  * Linux audio play and grab interface
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -293,7 +293,7 @@ static int audio_read_close(AVFormatContext *s1)
 }
 
 #if CONFIG_OSS_INDEV
-AVInputFormat oss_demuxer = {
+AVInputFormat ff_oss_demuxer = {
     "oss",
     NULL_IF_CONFIG_SMALL("Open Sound System capture"),
     sizeof(AudioData),
@@ -306,7 +306,7 @@ AVInputFormat oss_demuxer = {
 #endif
 
 #if CONFIG_OSS_OUTDEV
-AVOutputFormat oss_muxer = {
+AVOutputFormat ff_oss_muxer = {
     "oss",
     NULL_IF_CONFIG_SMALL("Open Sound System playback"),
     "",
diff --git a/ffmpeg-mt/libavdevice/sndio_common.c b/ffmpeg-mt/libavdevice/sndio_common.c
new file mode 100644
index 0000000..56c37c7
--- /dev/null
+++ b/ffmpeg-mt/libavdevice/sndio_common.c
@@ -0,0 +1,120 @@
+/*
+ * sndio play and grab interface
+ * Copyright (c) 2010 Jacob Meuser
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include <sndio.h>
+
+#include "libavformat/avformat.h"
+
+#include "sndio_common.h"
+
+static inline void movecb(void *addr, int delta)
+{
+    SndioData *s = addr;
+
+    s->hwpos += delta * s->channels * s->bps;
+}
+
+av_cold int ff_sndio_open(AVFormatContext *s1, int is_output,
+                          const char *audio_device)
+{
+    SndioData *s = s1->priv_data;
+    struct sio_hdl *hdl;
+    struct sio_par par;
+
+    hdl = sio_open(audio_device, is_output ? SIO_PLAY : SIO_REC, 0);
+    if (!hdl) {
+        av_log(s1, AV_LOG_ERROR, "Could not open sndio device\n");
+        return AVERROR(EIO);
+    }
+
+    sio_initpar(&par);
+
+    par.bits = 16;
+    par.sig  = 1;
+    par.le   = SIO_LE_NATIVE;
+
+    if (is_output)
+        par.pchan = s->channels;
+    else
+        par.rchan = s->channels;
+    par.rate = s->sample_rate;
+
+    if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
+        av_log(s1, AV_LOG_ERROR, "Impossible to set sndio parameters, "
+               "channels: %d sample rate: %d\n", s->channels, s->sample_rate);
+        goto fail;
+    }
+
+    if (par.bits != 16 || par.sig != 1 ||
+        (is_output  && (par.pchan != s->channels)) ||
+        (!is_output && (par.rchan != s->channels)) ||
+        (par.rate != s->sample_rate)) {
+        av_log(s1, AV_LOG_ERROR, "Could not set appropriate sndio parameters, "
+               "channels: %d sample rate: %d\n", s->channels, s->sample_rate);
+        goto fail;
+    }
+
+    s->buffer_size = par.round * par.bps *
+                     (is_output ? par.pchan : par.rchan);
+
+    if (is_output) {
+        s->buffer = av_malloc(s->buffer_size);
+        if (!s->buffer) {
+            av_log(s1, AV_LOG_ERROR, "Could not allocate buffer\n");
+            goto fail;
+        }
+    }
+
+    s->codec_id    = par.le ? CODEC_ID_PCM_S16LE : CODEC_ID_PCM_S16BE;
+    s->channels    = is_output ? par.pchan : par.rchan;
+    s->sample_rate = par.rate;
+    s->bps         = par.bps;
+
+    sio_onmove(hdl, movecb, s);
+
+    if (!sio_start(hdl)) {
+        av_log(s1, AV_LOG_ERROR, "Could not start sndio\n");
+        goto fail;
+    }
+
+    s->hdl = hdl;
+
+    return 0;
+
+fail:
+    av_freep(&s->buffer);
+
+    if (hdl)
+        sio_close(hdl);
+
+    return AVERROR(EIO);
+}
+
+int ff_sndio_close(SndioData *s)
+{
+    av_freep(&s->buffer);
+
+    if (s->hdl)
+        sio_close(s->hdl);
+
+    return 0;
+}
diff --git a/ffmpeg-mt/libavdevice/sndio_common.h b/ffmpeg-mt/libavdevice/sndio_common.h
new file mode 100644
index 0000000..41c984b
--- /dev/null
+++ b/ffmpeg-mt/libavdevice/sndio_common.h
@@ -0,0 +1,46 @@
+/*
+ * sndio play and grab interface
+ * Copyright (c) 2010 Jacob Meuser
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVDEVICE_SNDIO_COMMON_H
+#define AVDEVICE_SNDIO_COMMON_H
+
+#include <stdint.h>
+#include <sndio.h>
+
+#include "libavformat/avformat.h"
+
+typedef struct {
+    struct sio_hdl *hdl;
+    enum CodecID codec_id;
+    int64_t hwpos;
+    int64_t softpos;
+    uint8_t *buffer;
+    int bps;
+    int buffer_size;
+    int buffer_offset;
+    int channels;
+    int sample_rate;
+} SndioData;
+
+int ff_sndio_open(AVFormatContext *s1, int is_output, const char *audio_device);
+int ff_sndio_close(SndioData *s);
+
+#endif /* AVDEVICE_SNDIO_COMMON_H */
diff --git a/ffmpeg-mt/libavdevice/sndio_dec.c b/ffmpeg-mt/libavdevice/sndio_dec.c
new file mode 100644
index 0000000..ff2adeb
--- /dev/null
+++ b/ffmpeg-mt/libavdevice/sndio_dec.c
@@ -0,0 +1,108 @@
+/*
+ * sndio play and grab interface
+ * Copyright (c) 2010 Jacob Meuser
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include <sndio.h>
+
+#include "libavformat/avformat.h"
+
+#include "sndio_common.h"
+
+static av_cold int audio_read_header(AVFormatContext *s1,
+                                     AVFormatParameters *ap)
+{
+    SndioData *s = s1->priv_data;
+    AVStream *st;
+    int ret;
+
+    if (ap->sample_rate <= 0 || ap->channels <= 0)
+        return AVERROR(EINVAL);
+
+    st = av_new_stream(s1, 0);
+    if (!st)
+        return AVERROR(ENOMEM);
+
+    s->sample_rate = ap->sample_rate;
+    s->channels    = ap->channels;
+
+    ret = ff_sndio_open(s1, 0, s1->filename);
+    if (ret < 0)
+        return ret;
+
+    /* take real parameters */
+    st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
+    st->codec->codec_id    = s->codec_id;
+    st->codec->sample_rate = s->sample_rate;
+    st->codec->channels    = s->channels;
+
+    av_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
+
+    return 0;
+}
+
+static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
+{
+    SndioData *s = s1->priv_data;
+    int64_t bdelay, cur_time;
+    int ret;
+
+    if ((ret = av_new_packet(pkt, s->buffer_size)) < 0)
+        return ret;
+
+    ret = sio_read(s->hdl, pkt->data, pkt->size);
+    if (ret == 0 || sio_eof(s->hdl)) {
+        av_free_packet(pkt);
+        return AVERROR_EOF;
+    }
+
+    pkt->size   = ret;
+    s->softpos += ret;
+
+    /* compute pts of the start of the packet */
+    cur_time = av_gettime();
+
+    bdelay = ret + s->hwpos - s->softpos;
+
+    /* convert to pts */
+    pkt->pts = cur_time - ((bdelay * 1000000) /
+        (s->bps * s->channels * s->sample_rate));
+
+    return 0;
+}
+
+static av_cold int audio_read_close(AVFormatContext *s1)
+{
+    SndioData *s = s1->priv_data;
+
+    ff_sndio_close(s);
+
+    return 0;
+}
+
+AVInputFormat ff_sndio_demuxer = {
+    .name           = "sndio",
+    .long_name      = NULL_IF_CONFIG_SMALL("sndio audio capture"),
+    .priv_data_size = sizeof(SndioData),
+    .read_header    = audio_read_header,
+    .read_packet    = audio_read_packet,
+    .read_close     = audio_read_close,
+    .flags          = AVFMT_NOFILE,
+};
diff --git a/ffmpeg-mt/libavdevice/sndio_enc.c b/ffmpeg-mt/libavdevice/sndio_enc.c
new file mode 100644
index 0000000..6745ba4
--- /dev/null
+++ b/ffmpeg-mt/libavdevice/sndio_enc.c
@@ -0,0 +1,95 @@
+/*
+ * sndio play and grab interface
+ * Copyright (c) 2010 Jacob Meuser
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include <sndio.h>
+
+#include "libavformat/avformat.h"
+
+#include "sndio_common.h"
+
+static av_cold int audio_write_header(AVFormatContext *s1)
+{
+    SndioData *s = s1->priv_data;
+    AVStream *st;
+    int ret;
+
+    st             = s1->streams[0];
+    s->sample_rate = st->codec->sample_rate;
+    s->channels    = st->codec->channels;
+
+    ret = ff_sndio_open(s1, 1, s1->filename);
+
+    return ret;
+}
+
+static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
+{
+    SndioData *s = s1->priv_data;
+    uint8_t *buf= pkt->data;
+    int size = pkt->size;
+    int len, ret;
+
+    while (size > 0) {
+        len = s->buffer_size - s->buffer_offset;
+        if (len > size)
+            len = size;
+        memcpy(s->buffer + s->buffer_offset, buf, len);
+        buf  += len;
+        size -= len;
+        s->buffer_offset += len;
+        if (s->buffer_offset >= s->buffer_size) {
+            ret = sio_write(s->hdl, s->buffer, s->buffer_size);
+            if (ret == 0 || sio_eof(s->hdl))
+                return AVERROR(EIO);
+            s->softpos      += ret;
+            s->buffer_offset = 0;
+        }
+    }
+
+    return 0;
+}
+
+static int audio_write_trailer(AVFormatContext *s1)
+{
+    SndioData *s = s1->priv_data;
+
+    sio_write(s->hdl, s->buffer, s->buffer_offset);
+
+    ff_sndio_close(s);
+
+    return 0;
+}
+
+AVOutputFormat ff_sndio_muxer = {
+    .name           = "sndio",
+    .long_name      = NULL_IF_CONFIG_SMALL("sndio audio playback"),
+    .priv_data_size = sizeof(SndioData),
+    /* XXX: we make the assumption that the soundcard accepts this format */
+    /* XXX: find better solution with "preinit" method, needed also in
+       other formats */
+    .audio_codec    = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
+    .video_codec    = CODEC_ID_NONE,
+    .write_header   = audio_write_header,
+    .write_packet   = audio_write_packet,
+    .write_trailer  = audio_write_trailer,
+    .flags          = AVFMT_NOFILE,
+};
diff --git a/ffmpeg-mt/libavdevice/v4l.c b/ffmpeg-mt/libavdevice/v4l.c
index f640c76..b3725eb 100644
--- a/ffmpeg-mt/libavdevice/v4l.c
+++ b/ffmpeg-mt/libavdevice/v4l.c
@@ -2,27 +2,27 @@
  * Linux video grab interface
  * Copyright (c) 2000,2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #undef __STRICT_ANSI__ //workaround due to broken kernel headers
 #include "config.h"
 #include "libavutil/rational.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "libavformat/avformat.h"
 #include "libavcodec/dsputil.h"
 #include <unistd.h>
@@ -339,7 +339,7 @@ static int grab_read_close(AVFormatContext *s1)
     return 0;
 }
 
-AVInputFormat v4l_demuxer = {
+AVInputFormat ff_v4l_demuxer = {
     "video4linux",
     NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
     sizeof(VideoData),
diff --git a/ffmpeg-mt/libavdevice/v4l2.c b/ffmpeg-mt/libavdevice/v4l2.c
index 1e41c44..8e0a6e6 100644
--- a/ffmpeg-mt/libavdevice/v4l2.c
+++ b/ffmpeg-mt/libavdevice/v4l2.c
@@ -10,20 +10,20 @@
  * V4L2_PIX_FMT_* and PIX_FMT_*
  *
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -43,7 +43,7 @@
 #endif
 #include <time.h>
 #include <strings.h>
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 static const int desired_video_buffers = 256;
 
@@ -680,7 +680,7 @@ static int v4l2_read_close(AVFormatContext *s1)
     return 0;
 }
 
-AVInputFormat v4l2_demuxer = {
+AVInputFormat ff_v4l2_demuxer = {
     "video4linux2",
     NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
     sizeof(struct video_data),
diff --git a/ffmpeg-mt/libavdevice/vfwcap.c b/ffmpeg-mt/libavdevice/vfwcap.c
index 7b54490..8eecf5b 100644
--- a/ffmpeg-mt/libavdevice/vfwcap.c
+++ b/ffmpeg-mt/libavdevice/vfwcap.c
@@ -2,20 +2,20 @@
  * VFW capture interface
  * Copyright (c) 2006-2008 Ramiro Polla
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -452,7 +452,7 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
     return pkt->size;
 }
 
-AVInputFormat vfwcap_demuxer = {
+AVInputFormat ff_vfwcap_demuxer = {
     "vfwcap",
     NULL_IF_CONFIG_SMALL("VFW video capture"),
     sizeof(struct vfw_ctx),
diff --git a/ffmpeg-mt/libavdevice/x11grab.c b/ffmpeg-mt/libavdevice/x11grab.c
index ee3b8e9..aaad729 100644
--- a/ffmpeg-mt/libavdevice/x11grab.c
+++ b/ffmpeg-mt/libavdevice/x11grab.c
@@ -1,9 +1,9 @@
 /*
  * X11 video grab interface
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg integration:
+ * Libav integration:
  * Copyright (C) 2006 Clemens Fruhwirth <clemens at endorphin.org>
  *                    Edouard Gomez <ed.gomez at free.fr>
  *
@@ -14,18 +14,18 @@
  * Copyright (C) 1997-1998 Rasca, Berlin
  *               2003-2004 Karl H. Beckers, Frankfurt
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with FFmpeg; if not, write to the Free Software
+ * along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -442,7 +442,7 @@ x11grab_read_close(AVFormatContext *s1)
 }
 
 /** x11 grabber device demuxer declaration */
-AVInputFormat x11_grab_device_demuxer =
+AVInputFormat ff_x11_grab_device_demuxer =
 {
     "x11grab",
     NULL_IF_CONFIG_SMALL("X11grab"),
diff --git a/ffmpeg-mt/libavfilter/Makefile b/ffmpeg-mt/libavfilter/Makefile
index fdb181e..f7bc98d 100644
--- a/ffmpeg-mt/libavfilter/Makefile
+++ b/ffmpeg-mt/libavfilter/Makefile
@@ -1,7 +1,8 @@
 include $(SUBDIR)../config.mak
 
 NAME = avfilter
-FFLIBS = avcore avutil
+FFLIBS = avutil
+FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
 FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
 
 HEADERS = avfilter.h avfiltergraph.h
@@ -10,6 +11,7 @@ OBJS = allfilters.o                                                     \
        avfilter.o                                                       \
        avfiltergraph.o                                                  \
        defaults.o                                                       \
+       drawutils.o                                                      \
        formats.o                                                        \
        graphparser.o                                                    \
 
@@ -24,6 +26,7 @@ OBJS-$(CONFIG_COPY_FILTER)                   += vf_copy.o
 OBJS-$(CONFIG_CROP_FILTER)                   += vf_crop.o
 OBJS-$(CONFIG_CROPDETECT_FILTER)             += vf_cropdetect.o
 OBJS-$(CONFIG_DRAWBOX_FILTER)                += vf_drawbox.o
+OBJS-$(CONFIG_FADE_FILTER)                   += vf_fade.o
 OBJS-$(CONFIG_FIFO_FILTER)                   += vf_fifo.o
 OBJS-$(CONFIG_FORMAT_FILTER)                 += vf_format.o
 OBJS-$(CONFIG_FREI0R_FILTER)                 += vf_frei0r.o
@@ -48,8 +51,9 @@ OBJS-$(CONFIG_VFLIP_FILTER)                  += vf_vflip.o
 OBJS-$(CONFIG_YADIF_FILTER)                  += vf_yadif.o
 
 OBJS-$(CONFIG_BUFFER_FILTER)                 += vsrc_buffer.o
-OBJS-$(CONFIG_COLOR_FILTER)                  += vf_pad.o
+OBJS-$(CONFIG_COLOR_FILTER)                  += vsrc_color.o
 OBJS-$(CONFIG_FREI0R_SRC_FILTER)             += vf_frei0r.o
+OBJS-$(CONFIG_MOVIE_FILTER)                  += vsrc_movie.o
 OBJS-$(CONFIG_NULLSRC_FILTER)                += vsrc_nullsrc.o
 
 OBJS-$(CONFIG_NULLSINK_FILTER)               += vsink_nullsink.o
diff --git a/ffmpeg-mt/libavfilter/af_anull.c b/ffmpeg-mt/libavfilter/af_anull.c
index 94e7e17..e2bed36 100644
--- a/ffmpeg-mt/libavfilter/af_anull.c
+++ b/ffmpeg-mt/libavfilter/af_anull.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/allfilters.c b/ffmpeg-mt/libavfilter/allfilters.c
index 1dffb80..34e87f5 100644
--- a/ffmpeg-mt/libavfilter/allfilters.c
+++ b/ffmpeg-mt/libavfilter/allfilters.c
@@ -2,20 +2,20 @@
  * filter registration
  * Copyright (c) 2008 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -45,6 +45,7 @@ void avfilter_register_all(void)
     REGISTER_FILTER (CROP,        crop,        vf);
     REGISTER_FILTER (CROPDETECT,  cropdetect,  vf);
     REGISTER_FILTER (DRAWBOX,     drawbox,     vf);
+    REGISTER_FILTER (FADE,        fade,        vf);
     REGISTER_FILTER (FIFO,        fifo,        vf);
     REGISTER_FILTER (FORMAT,      format,      vf);
     REGISTER_FILTER (FREI0R,      frei0r,      vf);
@@ -71,6 +72,7 @@ void avfilter_register_all(void)
     REGISTER_FILTER (BUFFER,      buffer,      vsrc);
     REGISTER_FILTER (COLOR,       color,       vsrc);
     REGISTER_FILTER (FREI0R,      frei0r_src,  vsrc);
+    REGISTER_FILTER (MOVIE,       movie,       vsrc);
     REGISTER_FILTER (NULLSRC,     nullsrc,     vsrc);
 
     REGISTER_FILTER (NULLSINK,    nullsink,    vsink);
diff --git a/ffmpeg-mt/libavfilter/asink_anullsink.c b/ffmpeg-mt/libavfilter/asink_anullsink.c
index 5a89c27..3a505e7 100644
--- a/ffmpeg-mt/libavfilter/asink_anullsink.c
+++ b/ffmpeg-mt/libavfilter/asink_anullsink.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/asrc_anullsrc.c b/ffmpeg-mt/libavfilter/asrc_anullsrc.c
index 306e0a3..dd671c5 100644
--- a/ffmpeg-mt/libavfilter/asrc_anullsrc.c
+++ b/ffmpeg-mt/libavfilter/asrc_anullsrc.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -22,7 +22,7 @@
  */
 
 #include "avfilter.h"
-#include "libavcore/audioconvert.h"
+#include "libavutil/audioconvert.h"
 
 typedef struct {
     int64_t channel_layout;
diff --git a/ffmpeg-mt/libavfilter/avfilter.c b/ffmpeg-mt/libavfilter/avfilter.c
index 456ac9c..135b9ff 100644
--- a/ffmpeg-mt/libavfilter/avfilter.c
+++ b/ffmpeg-mt/libavfilter/avfilter.c
@@ -2,20 +2,20 @@
  * filter layer
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,8 +23,8 @@
 
 #include "libavutil/pixdesc.h"
 #include "libavutil/rational.h"
-#include "libavcore/audioconvert.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/audioconvert.h"
+#include "libavutil/imgutils.h"
 #include "avfilter.h"
 #include "internal.h"
 
@@ -34,13 +34,13 @@ unsigned avfilter_version(void) {
 
 const char *avfilter_configuration(void)
 {
-    return FFMPEG_CONFIGURATION;
+    return LIBAV_CONFIGURATION;
 }
 
 const char *avfilter_license(void)
 {
 #define LICENSE_PREFIX "libavfilter license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+    return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
 
 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
@@ -194,6 +194,16 @@ int avfilter_config_links(AVFilterContext *filter)
                 link->time_base = link->src && link->src->input_count ?
                     link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
 
+            if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0)
+                link->sample_aspect_ratio = link->src->input_count ?
+                    link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
+
+            if (link->sample_rate == 0 && link->src && link->src->input_count)
+                link->sample_rate = link->src->inputs[0]->sample_rate;
+
+            if (link->channel_layout == 0 && link->src && link->src->input_count)
+                link->channel_layout = link->src->inputs[0]->channel_layout;
+
             if ((config_link = link->dstpad->config_props))
                 if ((ret = config_link(link)) < 0)
                     return ret;
@@ -205,7 +215,7 @@ int avfilter_config_links(AVFilterContext *filter)
     return 0;
 }
 
-char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
+static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
 {
     snprintf(buf, buf_size, "%s%s%s%s%s%s",
              perms & AV_PERM_READ      ? "r" : "",
@@ -217,24 +227,24 @@ char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
     return buf;
 }
 
-void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end)
+static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
 {
     av_unused char buf[16];
-    dprintf(ctx,
+    av_dlog(ctx,
             "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64,
             ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0],
             ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3],
             ref->pts, ref->pos);
 
     if (ref->video) {
-        dprintf(ctx, " a:%d/%d s:%dx%d i:%c",
+        av_dlog(ctx, " a:%d/%d s:%dx%d i:%c",
                 ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
                 ref->video->w, ref->video->h,
                 !ref->video->interlaced     ? 'P' :         /* Progressive  */
                 ref->video->top_field_first ? 'T' : 'B');   /* Top / Bottom */
     }
     if (ref->audio) {
-        dprintf(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d",
+        av_dlog(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d",
                 ref->audio->channel_layout,
                 ref->audio->nb_samples,
                 ref->audio->size,
@@ -242,13 +252,13 @@ void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end)
                 ref->audio->planar);
     }
 
-    dprintf(ctx, "]%s", end ? "\n" : "");
+    av_dlog(ctx, "]%s", end ? "\n" : "");
 }
 
-void ff_dprintf_link(void *ctx, AVFilterLink *link, int end)
+static void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
 {
     if (link->type == AVMEDIA_TYPE_VIDEO) {
-        dprintf(ctx,
+        av_dlog(ctx,
                 "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
                 link, link->w, link->h,
                 av_pix_fmt_descriptors[link->format].name,
@@ -259,7 +269,7 @@ void ff_dprintf_link(void *ctx, AVFilterLink *link, int end)
         char buf[128];
         av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
 
-        dprintf(ctx,
+        av_dlog(ctx,
                 "link[%p r:%"PRId64" cl:%s fmt:%-16s %-16s->%-16s]%s",
                 link, link->sample_rate, buf,
                 av_get_sample_fmt_name(link->format),
@@ -269,13 +279,15 @@ void ff_dprintf_link(void *ctx, AVFilterLink *link, int end)
     }
 }
 
+#define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
+
 AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
 {
     AVFilterBufferRef *ret = NULL;
 
     av_unused char buf[16];
-    FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0);
-    dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
+    FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
+    av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
 
     if (link->dstpad->get_video_buffer)
         ret = link->dstpad->get_video_buffer(link, perms, w, h);
@@ -286,7 +298,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
     if (ret)
         ret->type = AVMEDIA_TYPE_VIDEO;
 
-    FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1);
+    FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
 
     return ret;
 }
@@ -351,7 +363,7 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
 
 int avfilter_request_frame(AVFilterLink *link)
 {
-    FF_DPRINTF_START(NULL, request_frame); ff_dprintf_link(NULL, link, 1);
+    FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
 
     if (link->srcpad->request_frame)
         return link->srcpad->request_frame(link);
@@ -386,7 +398,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
     AVFilterPad *dst = link->dstpad;
     int perms = picref->perms;
 
-    FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_ref(NULL, picref, 1);
+    FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1);
 
     if (!(start_frame = dst->start_frame))
         start_frame = avfilter_default_start_frame;
@@ -433,7 +445,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
     int i, j, vsub;
     void (*draw_slice)(AVFilterLink *, int, int, int);
 
-    FF_DPRINTF_START(NULL, draw_slice); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
+    FF_DPRINTF_START(NULL, draw_slice); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
 
     /* copy the slice if needed for permission reasons */
     if (link->src_buf) {
@@ -473,6 +485,8 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
     void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);
     AVFilterPad *dst = link->dstpad;
 
+    FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
+
     if (!(filter_samples = dst->filter_samples))
         filter_samples = avfilter_default_filter_samples;
 
diff --git a/ffmpeg-mt/libavfilter/avfilter.h b/ffmpeg-mt/libavfilter/avfilter.h
index 22b8b1c..7443581 100644
--- a/ffmpeg-mt/libavfilter/avfilter.h
+++ b/ffmpeg-mt/libavfilter/avfilter.h
@@ -2,20 +2,20 @@
  * filter layer
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,11 +23,10 @@
 #define AVFILTER_AVFILTER_H
 
 #include "libavutil/avutil.h"
-#include "libavcore/avcore.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/samplefmt.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  1
-#define LIBAVFILTER_VERSION_MINOR 74
+#define LIBAVFILTER_VERSION_MINOR 77
 #define LIBAVFILTER_VERSION_MICRO  0
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -227,7 +226,7 @@ typedef struct AVFilterFormats {
 
     unsigned refcount;          ///< number of references to this list
     struct AVFilterFormats ***refs; ///< references to this list
-}  AVFilterFormats;;
+}  AVFilterFormats;
 
 /**
  * Create a list of supported formats. This is intended for use in
@@ -249,7 +248,7 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts);
 int avfilter_add_format(AVFilterFormats **avff, int fmt);
 
 /**
- * Return a list of all formats supported by FFmpeg for the given media type.
+ * Return a list of all formats supported by Libav for the given media type.
  */
 AVFilterFormats *avfilter_all_formats(enum AVMediaType type);
 
@@ -580,11 +579,12 @@ struct AVFilterLink {
 
     enum AVMediaType type;      ///< filter media type
 
-    /* These two parameters apply only to video */
+    /* These parameters apply only to video */
     int w;                      ///< agreed upon image width
     int h;                      ///< agreed upon image height
+    AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
     /* These two parameters apply only to audio */
-    int64_t channel_layout;     ///< channel layout of current buffer (see libavcore/audioconvert.h)
+    int64_t channel_layout;     ///< channel layout of current buffer (see libavutil/audioconvert.h)
     int64_t sample_rate;        ///< samples per second
 
     int format;                 ///< agreed upon media format
diff --git a/ffmpeg-mt/libavfilter/avfiltergraph.c b/ffmpeg-mt/libavfilter/avfiltergraph.c
index a62fe2f..b503c36 100644
--- a/ffmpeg-mt/libavfilter/avfiltergraph.c
+++ b/ffmpeg-mt/libavfilter/avfiltergraph.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008 Vitor Sessak
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,14 +32,15 @@ AVFilterGraph *avfilter_graph_alloc(void)
     return av_mallocz(sizeof(AVFilterGraph));
 }
 
-void avfilter_graph_free(AVFilterGraph *graph)
+void avfilter_graph_free(AVFilterGraph **graph)
 {
-    if (!graph)
+    if (!*graph)
         return;
-    for (; graph->filter_count > 0; graph->filter_count --)
-        avfilter_free(graph->filters[graph->filter_count - 1]);
-    av_freep(&graph->scale_sws_opts);
-    av_freep(&graph->filters);
+    for (; (*graph)->filter_count > 0; (*graph)->filter_count--)
+        avfilter_free((*graph)->filters[(*graph)->filter_count - 1]);
+    av_freep(&(*graph)->scale_sws_opts);
+    av_freep(&(*graph)->filters);
+    av_freep(graph);
 }
 
 int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
diff --git a/ffmpeg-mt/libavfilter/avfiltergraph.h b/ffmpeg-mt/libavfilter/avfiltergraph.h
index 1b0d242..801e501 100644
--- a/ffmpeg-mt/libavfilter/avfiltergraph.h
+++ b/ffmpeg-mt/libavfilter/avfiltergraph.h
@@ -2,20 +2,20 @@
  * Filter graphs
  * copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,9 +79,10 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt,
 int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx);
 
 /**
- * Free a graph and destroy its links, graph may be NULL.
+ * Free a graph, destroy its links, and set *graph to NULL.
+ * If *graph is NULL, do nothing.
  */
-void avfilter_graph_free(AVFilterGraph *graph);
+void avfilter_graph_free(AVFilterGraph **graph);
 
 /**
  * A linked-list of the inputs/outputs of the filter chain.
diff --git a/ffmpeg-mt/libavfilter/defaults.c b/ffmpeg-mt/libavfilter/defaults.c
index 98339b6..146f1c7 100644
--- a/ffmpeg-mt/libavfilter/defaults.c
+++ b/ffmpeg-mt/libavfilter/defaults.c
@@ -2,26 +2,26 @@
  * Filter layer - default implementations
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/audioconvert.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/audioconvert.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/samplefmt.h"
 #include "avfilter.h"
 #include "internal.h"
 
@@ -126,7 +126,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per
     return ref;
 
 fail:
-    if (ref && ref->audio)
+    if (ref)
         av_free(ref->audio);
     av_free(ref);
     av_free(samples);
diff --git a/ffmpeg-mt/libavfilter/drawutils.c b/ffmpeg-mt/libavfilter/drawutils.c
new file mode 100644
index 0000000..6aaf5c5
--- /dev/null
+++ b/ffmpeg-mt/libavfilter/drawutils.c
@@ -0,0 +1,117 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avutil.h"
+#include "libavutil/colorspace.h"
+#include "libavutil/pixdesc.h"
+#include "drawutils.h"
+
+enum { RED = 0, GREEN, BLUE, ALPHA };
+
+int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],
+                            enum PixelFormat pix_fmt, uint8_t rgba_color[4],
+                            int *is_packed_rgba, uint8_t rgba_map_ptr[4])
+{
+    uint8_t rgba_map[4] = {0};
+    int i;
+    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
+    int hsub = pix_desc->log2_chroma_w;
+
+    *is_packed_rgba = 1;
+    switch (pix_fmt) {
+    case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
+    case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
+    case PIX_FMT_RGBA:
+    case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
+    case PIX_FMT_BGRA:
+    case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
+    default:
+        *is_packed_rgba = 0;
+    }
+
+    if (*is_packed_rgba) {
+        pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
+        for (i = 0; i < 4; i++)
+            dst_color[rgba_map[i]] = rgba_color[i];
+
+        line[0] = av_malloc(w * pixel_step[0]);
+        for (i = 0; i < w; i++)
+            memcpy(line[0] + i * pixel_step[0], dst_color, pixel_step[0]);
+        if (rgba_map_ptr)
+            memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4);
+    } else {
+        int plane;
+
+        dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
+        dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
+        dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
+        dst_color[3] = rgba_color[3];
+
+        for (plane = 0; plane < 4; plane++) {
+            int line_size;
+            int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
+
+            pixel_step[plane] = 1;
+            line_size = (w >> hsub1) * pixel_step[plane];
+            line[plane] = av_malloc(line_size);
+            memset(line[plane], dst_color[plane], line_size);
+        }
+    }
+
+    return 0;
+}
+
+void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
+                       uint8_t *src[4], int pixelstep[4],
+                       int hsub, int vsub, int x, int y, int w, int h)
+{
+    int i, plane;
+    uint8_t *p;
+
+    for (plane = 0; plane < 4 && dst[plane]; plane++) {
+        int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
+        int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
+
+        p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
+        for (i = 0; i < (h >> vsub1); i++) {
+            memcpy(p + (x >> hsub1) * pixelstep[plane],
+                   src[plane], (w >> hsub1) * pixelstep[plane]);
+            p += dst_linesize[plane];
+        }
+    }
+}
+
+void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
+                       uint8_t *src[4], int src_linesize[4], int pixelstep[4],
+                       int hsub, int vsub, int x, int y, int y2, int w, int h)
+{
+    int i, plane;
+    uint8_t *p;
+
+    for (plane = 0; plane < 4 && dst[plane]; plane++) {
+        int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
+        int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
+
+        p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
+        for (i = 0; i < (h >> vsub1); i++) {
+            memcpy(p + (x >> hsub1) * pixelstep[plane],
+                   src[plane] + src_linesize[plane]*(i+(y2>>vsub1)), (w >> hsub1) * pixelstep[plane]);
+            p += dst_linesize[plane];
+        }
+    }
+}
diff --git a/ffmpeg-mt/libavfilter/drawutils.h b/ffmpeg-mt/libavfilter/drawutils.h
new file mode 100644
index 0000000..7b11c06
--- /dev/null
+++ b/ffmpeg-mt/libavfilter/drawutils.h
@@ -0,0 +1,43 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFILTER_DRAWUTILS_H
+#define AVFILTER_DRAWUTILS_H
+
+/**
+ * @file
+ * misc drawing utilities
+ */
+
+#include <stdint.h>
+#include "libavutil/pixfmt.h"
+
+int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w,
+                            uint8_t dst_color[4],
+                            enum PixelFormat pix_fmt, uint8_t rgba_color[4],
+                            int *is_packed_rgba, uint8_t rgba_map[4]);
+
+void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
+                       uint8_t *src[4], int pixelstep[4],
+                       int hsub, int vsub, int x, int y, int w, int h);
+
+void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
+                       uint8_t *src[4], int src_linesize[4], int pixelstep[4],
+                       int hsub, int vsub, int x, int y, int y2, int w, int h);
+
+#endif /* AVFILTER_DRAWUTILS_H */
diff --git a/ffmpeg-mt/libavfilter/formats.c b/ffmpeg-mt/libavfilter/formats.c
index 101ef09..bb7b921 100644
--- a/ffmpeg-mt/libavfilter/formats.c
+++ b/ffmpeg-mt/libavfilter/formats.c
@@ -2,20 +2,20 @@
  * Filter layer - format negotiation
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/gradfun.h b/ffmpeg-mt/libavfilter/gradfun.h
index 3dacbcb..6b192a3 100644
--- a/ffmpeg-mt/libavfilter/gradfun.h
+++ b/ffmpeg-mt/libavfilter/gradfun.h
@@ -2,20 +2,20 @@
  * Copyright (c) 2010 Nolan Lum <nol888 at gmail.com>
  * Copyright (c) 2009 Loren Merritt <lorenm at u.washignton.edu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/graphparser.c b/ffmpeg-mt/libavfilter/graphparser.c
index 7151e4f..dddb0a2 100644
--- a/ffmpeg-mt/libavfilter/graphparser.c
+++ b/ffmpeg-mt/libavfilter/graphparser.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008 Vitor Sessak
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -393,7 +393,9 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
     return 0;
 
  fail:
-    avfilter_graph_free(graph);
+    for (; graph->filter_count > 0; graph->filter_count--)
+        avfilter_free(graph->filters[graph->filter_count - 1]);
+    av_freep(&graph->filters);
     free_inout(open_inputs);
     free_inout(open_outputs);
     free_inout(curr_inputs);
diff --git a/ffmpeg-mt/libavfilter/internal.h b/ffmpeg-mt/libavfilter/internal.h
index 8f352ef..0406a0d 100644
--- a/ffmpeg-mt/libavfilter/internal.h
+++ b/ffmpeg-mt/libavfilter/internal.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,14 +27,6 @@
 #include "avfilter.h"
 #include "avfiltergraph.h"
 
-void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end);
-
-char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms);
-
-void ff_dprintf_link(void *ctx, AVFilterLink *link, int end);
-
-#define FF_DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func)
-
 /**
  * Check for the validity of graph.
  *
diff --git a/ffmpeg-mt/libavfilter/vf_aspect.c b/ffmpeg-mt/libavfilter/vf_aspect.c
index 6f86bf2..8f52d90 100644
--- a/ffmpeg-mt/libavfilter/vf_aspect.c
+++ b/ffmpeg-mt/libavfilter/vf_aspect.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Bobby Bingham
 
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -82,6 +82,9 @@ static int setdar_config_props(AVFilterLink *inlink)
 
     av_log(inlink->dst, AV_LOG_INFO, "w:%d h:%d -> dar:%d/%d par:%d/%d\n",
            inlink->w, inlink->h, dar.num, dar.den, aspect->aspect.num, aspect->aspect.den);
+
+    inlink->sample_aspect_ratio = aspect->aspect;
+
     return 0;
 }
 
@@ -108,6 +111,16 @@ AVFilter avfilter_vf_setdar = {
 #endif /* CONFIG_SETDAR_FILTER */
 
 #if CONFIG_SETSAR_FILTER
+/* for setdar filter, convert from frame aspect ratio to pixel aspect ratio */
+static int setsar_config_props(AVFilterLink *inlink)
+{
+    AspectContext *aspect = inlink->dst->priv;
+
+    inlink->sample_aspect_ratio = aspect->aspect;
+
+    return 0;
+}
+
 AVFilter avfilter_vf_setsar = {
     .name      = "setsar",
     .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
@@ -118,6 +131,7 @@ AVFilter avfilter_vf_setsar = {
 
     .inputs    = (AVFilterPad[]) {{ .name             = "default",
                                     .type             = AVMEDIA_TYPE_VIDEO,
+                                    .config_props     = setsar_config_props,
                                     .get_video_buffer = avfilter_null_get_video_buffer,
                                     .start_frame      = start_frame,
                                     .end_frame        = avfilter_null_end_frame },
diff --git a/ffmpeg-mt/libavfilter/vf_blackframe.c b/ffmpeg-mt/libavfilter/vf_blackframe.c
index 658c30f..770eec9 100644
--- a/ffmpeg-mt/libavfilter/vf_blackframe.c
+++ b/ffmpeg-mt/libavfilter/vf_blackframe.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2006 Julian Hall
  * Copyright (c) 2002-2003 Brian J. Murrell
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_copy.c b/ffmpeg-mt/libavfilter/vf_copy.c
index 480ebcc..705ad1e 100644
--- a/ffmpeg-mt/libavfilter/vf_copy.c
+++ b/ffmpeg-mt/libavfilter/vf_copy.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_crop.c b/ffmpeg-mt/libavfilter/vf_crop.c
index e768fbb..105c390 100644
--- a/ffmpeg-mt/libavfilter/vf_crop.c
+++ b/ffmpeg-mt/libavfilter/vf_crop.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,7 +29,7 @@
 #include "libavutil/eval.h"
 #include "libavutil/avstring.h"
 #include "libavutil/libm.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 static const char *var_names[] = {
     "E",
diff --git a/ffmpeg-mt/libavfilter/vf_cropdetect.c b/ffmpeg-mt/libavfilter/vf_cropdetect.c
index 62c6864..34b5dc9 100644
--- a/ffmpeg-mt/libavfilter/vf_cropdetect.c
+++ b/ffmpeg-mt/libavfilter/vf_cropdetect.c
@@ -1,19 +1,19 @@
 /*
  * Copyright (c) 2002 A'rpi
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
@@ -23,7 +23,7 @@
  * Ported from MPlayer libmpcodecs/vf_cropdetect.c.
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avfilter.h"
 
 typedef struct {
diff --git a/ffmpeg-mt/libavfilter/vf_drawbox.c b/ffmpeg-mt/libavfilter/vf_drawbox.c
index 40d5e16..37c48c5 100644
--- a/ffmpeg-mt/libavfilter/vf_drawbox.c
+++ b/ffmpeg-mt/libavfilter/vf_drawbox.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Affine Systems, Inc (Michael Sullivan, Bobby Impollonia)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,7 +26,7 @@
 
 #include "libavutil/colorspace.h"
 #include "libavutil/pixdesc.h"
-#include "libavcore/parseutils.h"
+#include "libavutil/parseutils.h"
 #include "avfilter.h"
 
 enum { Y, U, V, A };
diff --git a/ffmpeg-mt/libavfilter/vf_fade.c b/ffmpeg-mt/libavfilter/vf_fade.c
new file mode 100644
index 0000000..203a186
--- /dev/null
+++ b/ffmpeg-mt/libavfilter/vf_fade.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2010 Brandon Mintern
+ * Copyright (c) 2007 Bobby Bingham
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * video fade filter
+ * based heavily on vf_negate.c by Bobby Bingham
+ */
+
+#include "libavutil/pixdesc.h"
+#include "avfilter.h"
+
+typedef struct {
+    int factor, fade_per_frame;
+    unsigned int frame_index, start_frame, stop_frame;
+    int hsub, vsub, bpp;
+} FadeContext;
+
+static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+    FadeContext *fade = ctx->priv;
+    unsigned int nb_frames;
+    char in_out[4];
+
+    if (!args ||
+        sscanf(args, " %3[^:]:%u:%u", in_out, &fade->start_frame, &nb_frames) != 3) {
+        av_log(ctx, AV_LOG_ERROR,
+               "Expected 3 arguments '(in|out):#:#':'%s'\n", args);
+        return AVERROR(EINVAL);
+    }
+
+    nb_frames = nb_frames ? nb_frames : 1;
+    fade->fade_per_frame = (1 << 16) / nb_frames;
+    if (!strcmp(in_out, "in"))
+        fade->factor = 0;
+    else if (!strcmp(in_out, "out")) {
+        fade->fade_per_frame = -fade->fade_per_frame;
+        fade->factor = (1 << 16);
+    } else {
+        av_log(ctx, AV_LOG_ERROR,
+               "first argument must be 'in' or 'out':'%s'\n", in_out);
+        return AVERROR(EINVAL);
+    }
+    fade->stop_frame = fade->start_frame + nb_frames;
+
+    av_log(ctx, AV_LOG_INFO,
+           "type:%s start_frame:%d nb_frames:%d\n",
+           in_out, fade->start_frame, nb_frames);
+    return 0;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+    const static enum PixelFormat pix_fmts[] = {
+        PIX_FMT_YUV444P,  PIX_FMT_YUV422P,  PIX_FMT_YUV420P,
+        PIX_FMT_YUV411P,  PIX_FMT_YUV410P,
+        PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
+        PIX_FMT_YUV440P,  PIX_FMT_YUVJ440P,
+        PIX_FMT_RGB24,    PIX_FMT_BGR24,
+        PIX_FMT_NONE
+    };
+
+    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+    return 0;
+}
+
+static int config_props(AVFilterLink *inlink)
+{
+    FadeContext *fade = inlink->dst->priv;
+    const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[inlink->format];
+
+    fade->hsub = pixdesc->log2_chroma_w;
+    fade->vsub = pixdesc->log2_chroma_h;
+
+    fade->bpp = av_get_bits_per_pixel(pixdesc) >> 3;
+    return 0;
+}
+
+static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+{
+    FadeContext *fade = inlink->dst->priv;
+    AVFilterBufferRef *outpic = inlink->cur_buf;
+    uint8_t *p;
+    int i, j, plane;
+
+    if (fade->factor < 65536) {
+        /* luma or rgb plane */
+        for (i = 0; i < h; i++) {
+            p = outpic->data[0] + (y+i) * outpic->linesize[0];
+            for (j = 0; j < inlink->w * fade->bpp; j++) {
+                /* fade->factor is using 16 lower-order bits for decimal
+                 * places. 32768 = 1 << 15, it is an integer representation
+                 * of 0.5 and is for rounding. */
+                *p = (*p * fade->factor + 32768) >> 16;
+                p++;
+            }
+        }
+
+        if (outpic->data[0] && outpic->data[1]) {
+            /* chroma planes */
+            for (plane = 1; plane < 3; plane++) {
+                for (i = 0; i < h; i++) {
+                    p = outpic->data[plane] + ((y+i) >> fade->vsub) * outpic->linesize[plane];
+                    for (j = 0; j < inlink->w >> fade->hsub; j++) {
+                        /* 8421367 = ((128 << 1) + 1) << 15. It is an integer
+                         * representation of 128.5. The .5 is for rounding
+                         * purposes. */
+                        *p = ((*p - 128) * fade->factor + 8421367) >> 16;
+                        p++;
+                    }
+                }
+            }
+        }
+    }
+
+    avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
+}
+
+static void end_frame(AVFilterLink *inlink)
+{
+    FadeContext *fade = inlink->dst->priv;
+
+    avfilter_end_frame(inlink->dst->outputs[0]);
+
+    if (fade->frame_index >= fade->start_frame &&
+        fade->frame_index <= fade->stop_frame)
+        fade->factor += fade->fade_per_frame;
+    fade->factor = av_clip_uint16(fade->factor);
+    fade->frame_index++;
+}
+
+AVFilter avfilter_vf_fade = {
+    .name          = "fade",
+    .description   = NULL_IF_CONFIG_SMALL("Fade in/out input video"),
+    .init          = init,
+    .priv_size     = sizeof(FadeContext),
+    .query_formats = query_formats,
+
+    .inputs    = (AVFilterPad[]) {{ .name            = "default",
+                                    .type            = AVMEDIA_TYPE_VIDEO,
+                                    .config_props    = config_props,
+                                    .get_video_buffer = avfilter_null_get_video_buffer,
+                                    .start_frame      = avfilter_null_start_frame,
+                                    .draw_slice      = draw_slice,
+                                    .end_frame       = end_frame,
+                                    .min_perms       = AV_PERM_READ | AV_PERM_WRITE,
+                                    .rej_perms       = AV_PERM_PRESERVE, },
+                                  { .name = NULL}},
+    .outputs   = (AVFilterPad[]) {{ .name            = "default",
+                                    .type            = AVMEDIA_TYPE_VIDEO, },
+                                  { .name = NULL}},
+};
diff --git a/ffmpeg-mt/libavfilter/vf_fifo.c b/ffmpeg-mt/libavfilter/vf_fifo.c
index 32199ed..836cce2 100644
--- a/ffmpeg-mt/libavfilter/vf_fifo.c
+++ b/ffmpeg-mt/libavfilter/vf_fifo.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_format.c b/ffmpeg-mt/libavfilter/vf_format.c
index c42e0bb..0b0d094 100644
--- a/ffmpeg-mt/libavfilter/vf_format.c
+++ b/ffmpeg-mt/libavfilter/vf_format.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_frei0r.c b/ffmpeg-mt/libavfilter/vf_frei0r.c
index 03d4f28..48683f4 100644
--- a/ffmpeg-mt/libavfilter/vf_frei0r.c
+++ b/ffmpeg-mt/libavfilter/vf_frei0r.c
@@ -1,19 +1,19 @@
 /*
  * Copyright (c) 2010 Stefano Sabatini
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,8 +27,8 @@
 #include <dlfcn.h>
 #include <frei0r.h>
 #include "libavutil/avstring.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/parseutils.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/parseutils.h"
 #include "avfilter.h"
 
 typedef f0r_instance_t (*f0r_construct_f)(unsigned int width, unsigned int height);
diff --git a/ffmpeg-mt/libavfilter/vf_gradfun.c b/ffmpeg-mt/libavfilter/vf_gradfun.c
index 3a400a0..c6663c4 100644
--- a/ffmpeg-mt/libavfilter/vf_gradfun.c
+++ b/ffmpeg-mt/libavfilter/vf_gradfun.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2010 Nolan Lum <nol888 at gmail.com>
  * Copyright (c) 2009 Loren Merritt <lorenm at u.washignton.edu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,7 +32,7 @@
  * Dither it back to 8bit.
  */
 
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/cpu.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
diff --git a/ffmpeg-mt/libavfilter/vf_hflip.c b/ffmpeg-mt/libavfilter/vf_hflip.c
index 4deb14a..a232d26 100644
--- a/ffmpeg-mt/libavfilter/vf_hflip.c
+++ b/ffmpeg-mt/libavfilter/vf_hflip.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2007 Benoit Fouet
  * Copyright (c) 2010 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 #include "avfilter.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/intreadwrite.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 typedef struct {
     int max_step[4];    ///< max pixel step for each plane, expressed as a number of bytes
diff --git a/ffmpeg-mt/libavfilter/vf_hqdn3d.c b/ffmpeg-mt/libavfilter/vf_hqdn3d.c
index 78a7bf7..2e9a895 100644
--- a/ffmpeg-mt/libavfilter/vf_hqdn3d.c
+++ b/ffmpeg-mt/libavfilter/vf_hqdn3d.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2003 Daniel Moreno <comac AT comac DOT darktech DOT org>
  * Copyright (c) 2010 Baptiste Coudurier
  *
- * This file is part of FFmpeg, ported from MPlayer.
+ * This file is part of Libav, ported from MPlayer.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_libopencv.c b/ffmpeg-mt/libavfilter/vf_libopencv.c
index 8401b4d..509b1d9 100644
--- a/ffmpeg-mt/libavfilter/vf_libopencv.c
+++ b/ffmpeg-mt/libavfilter/vf_libopencv.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_null.c b/ffmpeg-mt/libavfilter/vf_null.c
index 989cd86..8414c5f 100644
--- a/ffmpeg-mt/libavfilter/vf_null.c
+++ b/ffmpeg-mt/libavfilter/vf_null.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_overlay.c b/ffmpeg-mt/libavfilter/vf_overlay.c
index a170e81..c8bdf51 100644
--- a/ffmpeg-mt/libavfilter/vf_overlay.c
+++ b/ffmpeg-mt/libavfilter/vf_overlay.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2010 Baptiste Coudurier
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,7 +29,7 @@
 #include "libavutil/eval.h"
 #include "libavutil/avstring.h"
 #include "libavutil/pixdesc.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "internal.h"
 
 static const char *var_names[] = {
diff --git a/ffmpeg-mt/libavfilter/vf_pad.c b/ffmpeg-mt/libavfilter/vf_pad.c
index 467db5b..4f8e645 100644
--- a/ffmpeg-mt/libavfilter/vf_pad.c
+++ b/ffmpeg-mt/libavfilter/vf_pad.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2008 vmrsss
  * Copyright (c) 2009 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,96 +28,9 @@
 #include "libavutil/pixdesc.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/avassert.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/parseutils.h"
-
-enum { RED = 0, GREEN, BLUE, ALPHA };
-
-static int fill_line_with_color(uint8_t *line[4], int line_step[4], int w, uint8_t color[4],
-                                enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba)
-{
-    uint8_t rgba_map[4] = {0};
-    int i;
-    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
-    int hsub = pix_desc->log2_chroma_w;
-
-    *is_packed_rgba = 1;
-    switch (pix_fmt) {
-    case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
-    case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
-    case PIX_FMT_RGBA:
-    case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
-    case PIX_FMT_BGRA:
-    case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
-    default:
-        *is_packed_rgba = 0;
-    }
-
-    if (*is_packed_rgba) {
-        line_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
-        for (i = 0; i < 4; i++)
-            color[rgba_map[i]] = rgba_color[i];
-
-        line[0] = av_malloc(w * line_step[0]);
-        for (i = 0; i < w; i++)
-            memcpy(line[0] + i * line_step[0], color, line_step[0]);
-    } else {
-        int plane;
-
-        color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
-        color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
-        color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
-        color[ALPHA] = rgba_color[3];
-
-        for (plane = 0; plane < 4; plane++) {
-            int line_size;
-            int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
-
-            line_step[plane] = 1;
-            line_size = (w >> hsub1) * line_step[plane];
-            line[plane] = av_malloc(line_size);
-            memset(line[plane], color[plane], line_size);
-        }
-    }
-
-    return 0;
-}
-
-static void draw_rectangle(AVFilterBufferRef *outpic, uint8_t *line[4], int line_step[4],
-                           int hsub, int vsub, int x, int y, int w, int h)
-{
-    int i, plane;
-    uint8_t *p;
-
-    for (plane = 0; plane < 4 && outpic->data[plane]; plane++) {
-        int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
-        int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
-
-        p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane];
-        for (i = 0; i < (h >> vsub1); i++) {
-            memcpy(p + (x >> hsub1) * line_step[plane], line[plane], (w >> hsub1) * line_step[plane]);
-            p += outpic->linesize[plane];
-        }
-    }
-}
-
-static void copy_rectangle(AVFilterBufferRef *outpic,uint8_t *line[4], int line_step[4], int linesize[4],
-                           int hsub, int vsub, int x, int y, int y2, int w, int h)
-{
-    int i, plane;
-    uint8_t *p;
-
-    for (plane = 0; plane < 4 && outpic->data[plane]; plane++) {
-        int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
-        int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
-
-        p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane];
-        for (i = 0; i < (h >> vsub1); i++) {
-            memcpy(p + (x >> hsub1) * line_step[plane], line[plane] + linesize[plane]*(i+(y2>>vsub1)), (w >> hsub1) * line_step[plane]);
-            p += outpic->linesize[plane];
-        }
-    }
-}
+#include "libavutil/imgutils.h"
+#include "libavutil/parseutils.h"
+#include "drawutils.h"
 
 static int query_formats(AVFilterContext *ctx)
 {
@@ -140,8 +53,6 @@ static int query_formats(AVFilterContext *ctx)
     return 0;
 }
 
-#if CONFIG_PAD_FILTER
-
 typedef struct {
     int w, h;               ///< output dimensions, a value of 0 will result in the input size
     int x, y;               ///< offsets of the input area with respect to the padded area
@@ -210,8 +121,8 @@ static int config_input(AVFilterLink *inlink)
     pad->in_h = inlink->h & ~((1 << pad->vsub) - 1);
 
     memcpy(rgba_color, pad->color, sizeof(rgba_color));
-    fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color,
-                         inlink->format, rgba_color, &is_packed_rgba);
+    ff_fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color,
+                            inlink->format, rgba_color, &is_packed_rgba, NULL);
 
     av_log(ctx, AV_LOG_INFO, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X[%s]\n",
            inlink->w, inlink->h, pad->w, pad->h, pad->x, pad->y,
@@ -351,9 +262,10 @@ static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir,
     }
 
     if (bar_h) {
-        draw_rectangle(link->dst->outputs[0]->out_buf,
-                       pad->line, pad->line_step, pad->hsub, pad->vsub,
-                       0, bar_y, pad->w, bar_h);
+        ff_draw_rectangle(link->dst->outputs[0]->out_buf->data,
+                          link->dst->outputs[0]->out_buf->linesize,
+                          pad->line, pad->line_step, pad->hsub, pad->vsub,
+                          0, bar_y, pad->w, bar_h);
         avfilter_draw_slice(link->dst->outputs[0], bar_y, bar_h, slice_dir);
     }
 }
@@ -374,18 +286,20 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
     draw_send_bar_slice(link, y, h, slice_dir, 1);
 
     /* left border */
-    draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub,
-                   0, y, pad->x, h);
+    ff_draw_rectangle(outpic->data, outpic->linesize, pad->line, pad->line_step,
+                      pad->hsub, pad->vsub, 0, y, pad->x, h);
 
     if(pad->needs_copy){
-        copy_rectangle(outpic,
-                       inpic->data, pad->line_step, inpic->linesize, pad->hsub, pad->vsub,
-                       pad->x, y, y-pad->y, inpic->video->w, h);
+        ff_copy_rectangle(outpic->data, outpic->linesize,
+                          inpic->data, inpic->linesize, pad->line_step,
+                          pad->hsub, pad->vsub,
+                          pad->x, y, y-pad->y, inpic->video->w, h);
     }
 
     /* right border */
-    draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub,
-                   pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h);
+    ff_draw_rectangle(outpic->data, outpic->linesize,
+                      pad->line, pad->line_step, pad->hsub, pad->vsub,
+                      pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h);
     avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
 
     draw_send_bar_slice(link, y, h, slice_dir, -1);
@@ -414,129 +328,3 @@ AVFilter avfilter_vf_pad = {
                                     .config_props     = config_output, },
                                   { .name = NULL}},
 };
-
-#endif /* CONFIG_PAD_FILTER */
-
-#if CONFIG_COLOR_FILTER
-
-typedef struct {
-    int w, h;
-    uint8_t color[4];
-    AVRational time_base;
-    uint8_t *line[4];
-    int      line_step[4];
-    int hsub, vsub;         ///< chroma subsampling values
-    uint64_t pts;
-} ColorContext;
-
-static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    ColorContext *color = ctx->priv;
-    char color_string[128] = "black";
-    char frame_size  [128] = "320x240";
-    char frame_rate  [128] = "25";
-    AVRational frame_rate_q;
-    int ret;
-
-    if (args)
-        sscanf(args, "%127[^:]:%127[^:]:%127s", color_string, frame_size, frame_rate);
-
-    if (av_parse_video_size(&color->w, &color->h, frame_size) < 0) {
-        av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", frame_size);
-        return AVERROR(EINVAL);
-    }
-
-    if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 ||
-        frame_rate_q.den <= 0 || frame_rate_q.num <= 0) {
-        av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", frame_rate);
-        return AVERROR(EINVAL);
-    }
-    color->time_base.num = frame_rate_q.den;
-    color->time_base.den = frame_rate_q.num;
-
-    if ((ret = av_parse_color(color->color, color_string, -1, ctx)) < 0)
-        return ret;
-
-    return 0;
-}
-
-static av_cold void color_uninit(AVFilterContext *ctx)
-{
-    ColorContext *color = ctx->priv;
-    int i;
-
-    for (i = 0; i < 4; i++) {
-        av_freep(&color->line[i]);
-        color->line_step[i] = 0;
-    }
-}
-
-static int color_config_props(AVFilterLink *inlink)
-{
-    AVFilterContext *ctx = inlink->src;
-    ColorContext *color = ctx->priv;
-    uint8_t rgba_color[4];
-    int is_packed_rgba;
-    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
-
-    color->hsub = pix_desc->log2_chroma_w;
-    color->vsub = pix_desc->log2_chroma_h;
-
-    color->w &= ~((1 << color->hsub) - 1);
-    color->h &= ~((1 << color->vsub) - 1);
-    if (av_image_check_size(color->w, color->h, 0, ctx) < 0)
-        return AVERROR(EINVAL);
-
-    memcpy(rgba_color, color->color, sizeof(rgba_color));
-    fill_line_with_color(color->line, color->line_step, color->w, color->color,
-                         inlink->format, rgba_color, &is_packed_rgba);
-
-    av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n",
-           color->w, color->h, color->time_base.den, color->time_base.num,
-           color->color[0], color->color[1], color->color[2], color->color[3],
-           is_packed_rgba ? "rgba" : "yuva");
-    inlink->w = color->w;
-    inlink->h = color->h;
-
-    return 0;
-}
-
-static int color_request_frame(AVFilterLink *link)
-{
-    ColorContext *color = link->src->priv;
-    AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
-    picref->video->pixel_aspect = (AVRational) {1, 1};
-    picref->pts                 = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);
-    picref->pos                 = 0;
-
-    avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
-    draw_rectangle(picref,
-                   color->line, color->line_step, color->hsub, color->vsub,
-                   0, 0, color->w, color->h);
-    avfilter_draw_slice(link, 0, color->h, 1);
-    avfilter_end_frame(link);
-    avfilter_unref_buffer(picref);
-
-    return 0;
-}
-
-AVFilter avfilter_vsrc_color = {
-    .name        = "color",
-    .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input, syntax is: [color[:size[:rate]]]"),
-
-    .priv_size = sizeof(ColorContext),
-    .init      = color_init,
-    .uninit    = color_uninit,
-
-    .query_formats = query_formats,
-
-    .inputs    = (AVFilterPad[]) {{ .name = NULL}},
-
-    .outputs   = (AVFilterPad[]) {{ .name            = "default",
-                                    .type            = AVMEDIA_TYPE_VIDEO,
-                                    .request_frame   = color_request_frame,
-                                    .config_props    = color_config_props },
-                                  { .name = NULL}},
-};
-
-#endif /* CONFIG_COLOR_FILTER */
diff --git a/ffmpeg-mt/libavfilter/vf_pixdesctest.c b/ffmpeg-mt/libavfilter/vf_pixdesctest.c
index 1fb577e..344f664 100644
--- a/ffmpeg-mt/libavfilter/vf_pixdesctest.c
+++ b/ffmpeg-mt/libavfilter/vf_pixdesctest.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_scale.c b/ffmpeg-mt/libavfilter/vf_scale.c
index 3f54913..b2b0b63 100644
--- a/ffmpeg-mt/libavfilter/vf_scale.c
+++ b/ffmpeg-mt/libavfilter/vf_scale.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_setpts.c b/ffmpeg-mt/libavfilter/vf_setpts.c
index 0921df7..bece373 100644
--- a/ffmpeg-mt/libavfilter/vf_setpts.c
+++ b/ffmpeg-mt/libavfilter/vf_setpts.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2010 Stefano Sabatini
  * Copyright (c) 2008 Victor Paesa
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -116,10 +116,10 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
 
 #ifdef DEBUG
     av_log(inlink->dst, AV_LOG_DEBUG,
-           "n:%"PRId64" interlaced:%d pos:%d pts:%"PRId64" t:%f -> pts:%"PRId64" t:%f\n",
+           "n:%"PRId64" interlaced:%d pos:%"PRId64" pts:%"PRId64" t:%f -> pts:%"PRId64" t:%f\n",
            (int64_t)setpts->var_values[VAR_N],
            (int)setpts->var_values[VAR_INTERLACED],
-           (int)setpts->var_values[VAR_POS],
+           inpicref ->pos,
            inpicref ->pts, inpicref ->pts * av_q2d(inlink->time_base),
            outpicref->pts, outpicref->pts * av_q2d(inlink->time_base));
 #endif
diff --git a/ffmpeg-mt/libavfilter/vf_settb.c b/ffmpeg-mt/libavfilter/vf_settb.c
index 3e48ac4..9575483 100644
--- a/ffmpeg-mt/libavfilter/vf_settb.c
+++ b/ffmpeg-mt/libavfilter/vf_settb.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_slicify.c b/ffmpeg-mt/libavfilter/vf_slicify.c
index 177ac1f..cc56fe8 100644
--- a/ffmpeg-mt/libavfilter/vf_slicify.c
+++ b/ffmpeg-mt/libavfilter/vf_slicify.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_transpose.c b/ffmpeg-mt/libavfilter/vf_transpose.c
index 970c381..a0ec67c 100644
--- a/ffmpeg-mt/libavfilter/vf_transpose.c
+++ b/ffmpeg-mt/libavfilter/vf_transpose.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2010 Stefano Sabatini
  * Copyright (c) 2008 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/pixdesc.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "avfilter.h"
 
 typedef struct {
@@ -102,6 +102,11 @@ static int config_props_output(AVFilterLink *outlink)
     outlink->w = inlink->h;
     outlink->h = inlink->w;
 
+    if (inlink->sample_aspect_ratio.num){
+        outlink->sample_aspect_ratio = av_div_q((AVRational){1,1}, inlink->sample_aspect_ratio);
+    } else
+        outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
+
     av_log(ctx, AV_LOG_INFO, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
            inlink->w, inlink->h, trans->dir, outlink->w, outlink->h,
            trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise",
diff --git a/ffmpeg-mt/libavfilter/vf_unsharp.c b/ffmpeg-mt/libavfilter/vf_unsharp.c
index 7aa7a43..274b13c 100644
--- a/ffmpeg-mt/libavfilter/vf_unsharp.c
+++ b/ffmpeg-mt/libavfilter/vf_unsharp.c
@@ -3,26 +3,26 @@
  * Port copyright (c) 2010 Daniel G. Taylor <dan at programmer-art.org>
  * Relicensed to the LGPL with permission from Remi Guyomarch.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
  * @file
- * blur / sharpen filter, ported to FFmpeg from MPlayer
+ * blur / sharpen filter, ported to Libav from MPlayer
  * libmpcodecs/unsharp.c.
  *
  * This code is based on:
diff --git a/ffmpeg-mt/libavfilter/vf_vflip.c b/ffmpeg-mt/libavfilter/vf_vflip.c
index e5cede8..09ba303 100644
--- a/ffmpeg-mt/libavfilter/vf_vflip.c
+++ b/ffmpeg-mt/libavfilter/vf_vflip.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vf_yadif.c b/ffmpeg-mt/libavfilter/vf_yadif.c
index bd0a9de..176349a 100644
--- a/ffmpeg-mt/libavfilter/vf_yadif.c
+++ b/ffmpeg-mt/libavfilter/vf_yadif.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2006-2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
@@ -50,42 +50,42 @@ typedef struct {
     AVFilterBufferRef *out;
     void (*filter_line)(uint8_t *dst,
                         uint8_t *prev, uint8_t *cur, uint8_t *next,
-                        int w, int refs, int parity, int mode);
+                        int w, int prefs, int mrefs, int parity, int mode);
 } YADIFContext;
 
 static void filter_line_c(uint8_t *dst,
                           uint8_t *prev, uint8_t *cur, uint8_t *next,
-                          int w, int refs, int parity, int mode)
+                          int w, int prefs, int mrefs, int parity, int mode)
 {
     int x;
     uint8_t *prev2 = parity ? prev : cur ;
     uint8_t *next2 = parity ? cur  : next;
     for (x = 0;  x < w; x++) {
-        int c = cur[-refs];
+        int c = cur[mrefs];
         int d = (prev2[0] + next2[0])>>1;
-        int e = cur[+refs];
+        int e = cur[prefs];
         int temporal_diff0 = FFABS(prev2[0] - next2[0]);
-        int temporal_diff1 =(FFABS(prev[-refs] - c) + FFABS(prev[+refs] - e) )>>1;
-        int temporal_diff2 =(FFABS(next[-refs] - c) + FFABS(next[+refs] - e) )>>1;
+        int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1;
+        int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1;
         int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
         int spatial_pred = (c+e)>>1;
-        int spatial_score = FFABS(cur[-refs-1] - cur[+refs-1]) + FFABS(c-e)
-                          + FFABS(cur[-refs+1] - cur[+refs+1]) - 1;
+        int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e)
+                          + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1;
 
 #define CHECK(j)\
-    {   int score = FFABS(cur[-refs-1+j] - cur[+refs-1-j])\
-                  + FFABS(cur[-refs  +j] - cur[+refs  -j])\
-                  + FFABS(cur[-refs+1+j] - cur[+refs+1-j]);\
+    {   int score = FFABS(cur[mrefs-1+(j)] - cur[prefs-1-(j)])\
+                  + FFABS(cur[mrefs  +(j)] - cur[prefs  -(j)])\
+                  + FFABS(cur[mrefs+1+(j)] - cur[prefs+1-(j)]);\
         if (score < spatial_score) {\
             spatial_score= score;\
-            spatial_pred= (cur[-refs  +j] + cur[+refs  -j])>>1;\
+            spatial_pred= (cur[mrefs  +(j)] + cur[prefs  -(j)])>>1;\
 
         CHECK(-1) CHECK(-2) }} }}
         CHECK( 1) CHECK( 2) }} }}
 
         if (mode < 2) {
-            int b = (prev2[-2*refs] + next2[-2*refs])>>1;
-            int f = (prev2[+2*refs] + next2[+2*refs])>>1;
+            int b = (prev2[2*mrefs] + next2[2*mrefs])>>1;
+            int f = (prev2[2*prefs] + next2[2*prefs])>>1;
 #if 0
             int a = cur[-3*refs];
             int g = cur[+3*refs];
@@ -133,7 +133,8 @@ static void filter(AVFilterContext *ctx, AVFilterBufferRef *dstpic,
                 uint8_t *cur  = &yadif->cur ->data[i][y*refs];
                 uint8_t *next = &yadif->next->data[i][y*refs];
                 uint8_t *dst  = &dstpic->data[i][y*dstpic->linesize[i]];
-                yadif->filter_line(dst, prev, cur, next, w, refs, parity ^ tff, yadif->mode);
+                int     mode  = y==1 || y+2==h ? 2 : yadif->mode;
+                yadif->filter_line(dst, prev, cur, next, w, y+1<h ? refs : -refs, y ? -refs : refs, parity ^ tff, mode);
             } else {
                 memcpy(&dstpic->data[i][y*dstpic->linesize[i]],
                        &yadif->cur->data[i][y*refs], w);
diff --git a/ffmpeg-mt/libavfilter/vsink_nullsink.c b/ffmpeg-mt/libavfilter/vsink_nullsink.c
index 0998bd0..bdfcb8a 100644
--- a/ffmpeg-mt/libavfilter/vsink_nullsink.c
+++ b/ffmpeg-mt/libavfilter/vsink_nullsink.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vsrc_buffer.c b/ffmpeg-mt/libavfilter/vsrc_buffer.c
index 74d9bf6..93f2367 100644
--- a/ffmpeg-mt/libavfilter/vsrc_buffer.c
+++ b/ffmpeg-mt/libavfilter/vsrc_buffer.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
 
 #include "avfilter.h"
 #include "vsrc_buffer.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 typedef struct {
     int64_t           pts;
diff --git a/ffmpeg-mt/libavfilter/vsrc_buffer.h b/ffmpeg-mt/libavfilter/vsrc_buffer.h
index a77e42f..c7fc382 100644
--- a/ffmpeg-mt/libavfilter/vsrc_buffer.h
+++ b/ffmpeg-mt/libavfilter/vsrc_buffer.h
@@ -2,20 +2,20 @@
  * Memory buffer source filter
  * Copyright (c) 2008 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavfilter/vsrc_color.c b/ffmpeg-mt/libavfilter/vsrc_color.c
new file mode 100644
index 0000000..6d41c8a
--- /dev/null
+++ b/ffmpeg-mt/libavfilter/vsrc_color.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2010 Stefano Sabatini
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avfilter.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/colorspace.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/parseutils.h"
+#include "drawutils.h"
+
+typedef struct {
+    int w, h;
+    uint8_t color[4];
+    AVRational time_base;
+    uint8_t *line[4];
+    int      line_step[4];
+    int hsub, vsub;         ///< chroma subsampling values
+    uint64_t pts;
+} ColorContext;
+
+static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+    ColorContext *color = ctx->priv;
+    char color_string[128] = "black";
+    char frame_size  [128] = "320x240";
+    char frame_rate  [128] = "25";
+    AVRational frame_rate_q;
+    int ret;
+
+    if (args)
+        sscanf(args, "%127[^:]:%127[^:]:%127s", color_string, frame_size, frame_rate);
+
+    if (av_parse_video_size(&color->w, &color->h, frame_size) < 0) {
+        av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", frame_size);
+        return AVERROR(EINVAL);
+    }
+
+    if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 ||
+        frame_rate_q.den <= 0 || frame_rate_q.num <= 0) {
+        av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", frame_rate);
+        return AVERROR(EINVAL);
+    }
+    color->time_base.num = frame_rate_q.den;
+    color->time_base.den = frame_rate_q.num;
+
+    if ((ret = av_parse_color(color->color, color_string, -1, ctx)) < 0)
+        return ret;
+
+    return 0;
+}
+
+static av_cold void color_uninit(AVFilterContext *ctx)
+{
+    ColorContext *color = ctx->priv;
+    int i;
+
+    for (i = 0; i < 4; i++) {
+        av_freep(&color->line[i]);
+        color->line_step[i] = 0;
+    }
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+    static const enum PixelFormat pix_fmts[] = {
+        PIX_FMT_ARGB,         PIX_FMT_RGBA,
+        PIX_FMT_ABGR,         PIX_FMT_BGRA,
+        PIX_FMT_RGB24,        PIX_FMT_BGR24,
+
+        PIX_FMT_YUV444P,      PIX_FMT_YUV422P,
+        PIX_FMT_YUV420P,      PIX_FMT_YUV411P,
+        PIX_FMT_YUV410P,      PIX_FMT_YUV440P,
+        PIX_FMT_YUVJ444P,     PIX_FMT_YUVJ422P,
+        PIX_FMT_YUVJ420P,     PIX_FMT_YUVJ440P,
+        PIX_FMT_YUVA420P,
+
+        PIX_FMT_NONE
+    };
+
+    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+    return 0;
+}
+
+static int color_config_props(AVFilterLink *inlink)
+{
+    AVFilterContext *ctx = inlink->src;
+    ColorContext *color = ctx->priv;
+    uint8_t rgba_color[4];
+    int is_packed_rgba;
+    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
+
+    color->hsub = pix_desc->log2_chroma_w;
+    color->vsub = pix_desc->log2_chroma_h;
+
+    color->w &= ~((1 << color->hsub) - 1);
+    color->h &= ~((1 << color->vsub) - 1);
+    if (av_image_check_size(color->w, color->h, 0, ctx) < 0)
+        return AVERROR(EINVAL);
+
+    memcpy(rgba_color, color->color, sizeof(rgba_color));
+    ff_fill_line_with_color(color->line, color->line_step, color->w, color->color,
+                            inlink->format, rgba_color, &is_packed_rgba, NULL);
+
+    av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n",
+           color->w, color->h, color->time_base.den, color->time_base.num,
+           color->color[0], color->color[1], color->color[2], color->color[3],
+           is_packed_rgba ? "rgba" : "yuva");
+    inlink->w = color->w;
+    inlink->h = color->h;
+
+    return 0;
+}
+
+static int color_request_frame(AVFilterLink *link)
+{
+    ColorContext *color = link->src->priv;
+    AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
+    picref->video->pixel_aspect = (AVRational) {1, 1};
+    picref->pts                 = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);
+    picref->pos                 = 0;
+
+    avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
+    ff_draw_rectangle(picref->data, picref->linesize,
+                      color->line, color->line_step, color->hsub, color->vsub,
+                      0, 0, color->w, color->h);
+    avfilter_draw_slice(link, 0, color->h, 1);
+    avfilter_end_frame(link);
+    avfilter_unref_buffer(picref);
+
+    return 0;
+}
+
+AVFilter avfilter_vsrc_color = {
+    .name        = "color",
+    .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input, syntax is: [color[:size[:rate]]]"),
+
+    .priv_size = sizeof(ColorContext),
+    .init      = color_init,
+    .uninit    = color_uninit,
+
+    .query_formats = query_formats,
+
+    .inputs    = (AVFilterPad[]) {{ .name = NULL}},
+
+    .outputs   = (AVFilterPad[]) {{ .name            = "default",
+                                    .type            = AVMEDIA_TYPE_VIDEO,
+                                    .request_frame   = color_request_frame,
+                                    .config_props    = color_config_props },
+                                  { .name = NULL}},
+};
diff --git a/ffmpeg-mt/libavfilter/vsrc_movie.c b/ffmpeg-mt/libavfilter/vsrc_movie.c
new file mode 100644
index 0000000..25bbd47
--- /dev/null
+++ b/ffmpeg-mt/libavfilter/vsrc_movie.c
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2010 Stefano Sabatini
+ * Copyright (c) 2008 Victor Paesa
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * movie video source
+ *
+ * @todo use direct rendering (no allocation of a new frame)
+ * @todo support a PTS correction mechanism
+ * @todo support more than one output stream
+ */
+
+/* #define DEBUG */
+
+#include <float.h>
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/imgutils.h"
+#include "libavformat/avformat.h"
+#include "avfilter.h"
+
+typedef struct {
+    const AVClass *class;
+    int64_t seek_point;   ///< seekpoint in microseconds
+    double seek_point_d;
+    char *format_name;
+    char *file_name;
+    int stream_index;
+
+    AVFormatContext *format_ctx;
+    AVCodecContext *codec_ctx;
+    int is_done;
+    AVFrame *frame;   ///< video frame to store the decoded images in
+
+    int w, h;
+    AVFilterBufferRef *picref;
+} MovieContext;
+
+#define OFFSET(x) offsetof(MovieContext, x)
+
+static const AVOption movie_options[]= {
+{"format_name",  "set format name",         OFFSET(format_name),  FF_OPT_TYPE_STRING, 0,  CHAR_MIN, CHAR_MAX },
+{"f",            "set format name",         OFFSET(format_name),  FF_OPT_TYPE_STRING, 0,  CHAR_MIN, CHAR_MAX },
+{"stream_index", "set stream index",        OFFSET(stream_index), FF_OPT_TYPE_INT,   -1,  -1,       INT_MAX  },
+{"si",           "set stream index",        OFFSET(stream_index), FF_OPT_TYPE_INT,   -1,  -1,       INT_MAX  },
+{"seek_point",   "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, 0,  0,        (INT64_MAX-1) / 1000000 },
+{"sp",           "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, 0,  0,        (INT64_MAX-1) / 1000000 },
+{NULL},
+};
+
+static const char *movie_get_name(void *ctx)
+{
+    return "movie";
+}
+
+static const AVClass movie_class = {
+    "MovieContext",
+    movie_get_name,
+    movie_options
+};
+
+static int movie_init(AVFilterContext *ctx)
+{
+    MovieContext *movie = ctx->priv;
+    AVInputFormat *iformat = NULL;
+    AVCodec *codec;
+    int ret;
+    int64_t timestamp;
+
+    av_register_all();
+
+    // Try to find the movie format (container)
+    iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
+
+    movie->format_ctx = NULL;
+    if ((ret = av_open_input_file(&movie->format_ctx, movie->file_name, iformat, 0, NULL)) < 0) {
+        av_log(ctx, AV_LOG_ERROR,
+               "Failed to av_open_input_file '%s'\n", movie->file_name);
+        return ret;
+    }
+    if ((ret = av_find_stream_info(movie->format_ctx)) < 0)
+        av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
+
+    // if seeking requested, we execute it
+    if (movie->seek_point > 0) {
+        timestamp = movie->seek_point;
+        // add the stream start time, should it exist
+        if (movie->format_ctx->start_time != AV_NOPTS_VALUE) {
+            if (timestamp > INT64_MAX - movie->format_ctx->start_time) {
+                av_log(ctx, AV_LOG_ERROR,
+                       "%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n",
+                       movie->file_name, movie->format_ctx->start_time, movie->seek_point);
+                return AVERROR(EINVAL);
+            }
+            timestamp += movie->format_ctx->start_time;
+        }
+        if ((ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD)) < 0) {
+            av_log(ctx, AV_LOG_ERROR, "%s: could not seek to position %"PRId64"\n",
+                   movie->file_name, timestamp);
+            return ret;
+        }
+    }
+
+    /* select the video stream */
+    if ((ret = av_find_best_stream(movie->format_ctx, AVMEDIA_TYPE_VIDEO,
+                                   movie->stream_index, -1, NULL, 0)) < 0) {
+        av_log(ctx, AV_LOG_ERROR, "No video stream with index '%d' found\n",
+               movie->stream_index);
+        return ret;
+    }
+    movie->stream_index = ret;
+    movie->codec_ctx = movie->format_ctx->streams[movie->stream_index]->codec;
+
+    /*
+     * So now we've got a pointer to the so-called codec context for our video
+     * stream, but we still have to find the actual codec and open it.
+     */
+    codec = avcodec_find_decoder(movie->codec_ctx->codec_id);
+    if (!codec) {
+        av_log(ctx, AV_LOG_ERROR, "Failed to find any codec\n");
+        return AVERROR(EINVAL);
+    }
+
+    if ((ret = avcodec_open(movie->codec_ctx, codec)) < 0) {
+        av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
+        return ret;
+    }
+
+    if (!(movie->frame = avcodec_alloc_frame()) ) {
+        av_log(ctx, AV_LOG_ERROR, "Failed to alloc frame\n");
+        return AVERROR(ENOMEM);
+    }
+
+    movie->w = movie->codec_ctx->width;
+    movie->h = movie->codec_ctx->height;
+
+    av_log(ctx, AV_LOG_INFO, "seek_point:%lld format_name:%s file_name:%s stream_index:%d\n",
+           movie->seek_point, movie->format_name, movie->file_name,
+           movie->stream_index);
+
+    return 0;
+}
+
+static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+    MovieContext *movie = ctx->priv;
+    int ret;
+    movie->class = &movie_class;
+    av_opt_set_defaults2(movie, 0, 0);
+
+    if (args)
+        movie->file_name = av_get_token(&args, ":");
+    if (!movie->file_name || !*movie->file_name) {
+        av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0) {
+        av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args);
+        return ret;
+    }
+
+    movie->seek_point = movie->seek_point_d * 1000000 + 0.5;
+
+    return movie_init(ctx);
+}
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+    MovieContext *movie = ctx->priv;
+
+    av_free(movie->file_name);
+    av_free(movie->format_name);
+    if (movie->codec_ctx)
+        avcodec_close(movie->codec_ctx);
+    if (movie->format_ctx)
+        av_close_input_file(movie->format_ctx);
+    avfilter_unref_buffer(movie->picref);
+    av_freep(&movie->frame);
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+    MovieContext *movie = ctx->priv;
+    enum PixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, PIX_FMT_NONE };
+
+    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+    return 0;
+}
+
+static int config_output_props(AVFilterLink *outlink)
+{
+    MovieContext *movie = outlink->src->priv;
+
+    outlink->w = movie->w;
+    outlink->h = movie->h;
+    outlink->time_base = movie->format_ctx->streams[movie->stream_index]->time_base;
+
+    return 0;
+}
+
+static int movie_get_frame(AVFilterLink *outlink)
+{
+    MovieContext *movie = outlink->src->priv;
+    AVPacket pkt;
+    int ret, frame_decoded;
+    AVStream *st = movie->format_ctx->streams[movie->stream_index];
+
+    if (movie->is_done == 1)
+        return 0;
+
+    while ((ret = av_read_frame(movie->format_ctx, &pkt)) >= 0) {
+        // Is this a packet from the video stream?
+        if (pkt.stream_index == movie->stream_index) {
+            movie->codec_ctx->reordered_opaque = pkt.pos;
+            avcodec_decode_video2(movie->codec_ctx, movie->frame, &frame_decoded, &pkt);
+
+            if (frame_decoded) {
+                /* FIXME: avoid the memcpy */
+                movie->picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE |
+                                                          AV_PERM_REUSE2, outlink->w, outlink->h);
+                av_image_copy(movie->picref->data, movie->picref->linesize,
+                              movie->frame->data,  movie->frame->linesize,
+                              movie->picref->format, outlink->w, outlink->h);
+
+                /* FIXME: use a PTS correction mechanism as that in
+                 * ffplay.c when some API will be available for that */
+                /* use pkt_dts if pkt_pts is not available */
+                movie->picref->pts = movie->frame->pkt_pts == AV_NOPTS_VALUE ?
+                    movie->frame->pkt_dts : movie->frame->pkt_pts;
+
+                movie->picref->pos                    = movie->frame->reordered_opaque;
+                movie->picref->video->pixel_aspect = st->sample_aspect_ratio.num ?
+                    st->sample_aspect_ratio : movie->codec_ctx->sample_aspect_ratio;
+                movie->picref->video->interlaced      = movie->frame->interlaced_frame;
+                movie->picref->video->top_field_first = movie->frame->top_field_first;
+                av_dlog(outlink->src,
+                        "movie_get_frame(): file:'%s' pts:%"PRId64" time:%lf pos:%"PRId64" aspect:%d/%d\n",
+                        movie->file_name, movie->picref->pts,
+                        (double)movie->picref->pts * av_q2d(st->time_base),
+                        movie->picref->pos,
+                        movie->picref->video->pixel_aspect.num, movie->picref->video->pixel_aspect.den);
+                // We got it. Free the packet since we are returning
+                av_free_packet(&pkt);
+
+                return 0;
+            }
+        }
+        // Free the packet that was allocated by av_read_frame
+        av_free_packet(&pkt);
+    }
+
+    // On multi-frame source we should stop the mixing process when
+    // the movie source does not have more frames
+    if (ret == AVERROR_EOF)
+        movie->is_done = 1;
+    return ret;
+}
+
+static int request_frame(AVFilterLink *outlink)
+{
+    AVFilterBufferRef *outpicref;
+    MovieContext *movie = outlink->src->priv;
+    int ret;
+
+    if (movie->is_done)
+        return AVERROR_EOF;
+    if ((ret = movie_get_frame(outlink)) < 0)
+        return ret;
+
+    outpicref = avfilter_ref_buffer(movie->picref, ~0);
+    avfilter_start_frame(outlink, outpicref);
+    avfilter_draw_slice(outlink, 0, outlink->h, 1);
+    avfilter_end_frame(outlink);
+
+    return 0;
+}
+
+AVFilter avfilter_vsrc_movie = {
+    .name          = "movie",
+    .description   = NULL_IF_CONFIG_SMALL("Read from a movie source."),
+    .priv_size     = sizeof(MovieContext),
+    .init          = init,
+    .uninit        = uninit,
+    .query_formats = query_formats,
+
+    .inputs    = (AVFilterPad[]) {{ .name = NULL }},
+    .outputs   = (AVFilterPad[]) {{ .name            = "default",
+                                    .type            = AVMEDIA_TYPE_VIDEO,
+                                    .request_frame   = request_frame,
+                                    .config_props    = config_output_props, },
+                                  { .name = NULL}},
+};
diff --git a/ffmpeg-mt/libavfilter/vsrc_nullsrc.c b/ffmpeg-mt/libavfilter/vsrc_nullsrc.c
index 1cd06e1..629de78 100644
--- a/ffmpeg-mt/libavfilter/vsrc_nullsrc.c
+++ b/ffmpeg-mt/libavfilter/vsrc_nullsrc.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 
 #include "libavutil/avstring.h"
 #include "libavutil/eval.h"
-#include "libavcore/parseutils.h"
+#include "libavutil/parseutils.h"
 #include "avfilter.h"
 
 static const char *var_names[] = {
diff --git a/ffmpeg-mt/libavfilter/x86/gradfun.c b/ffmpeg-mt/libavfilter/x86/gradfun.c
index 894a44b..c9ade82 100644
--- a/ffmpeg-mt/libavfilter/x86/gradfun.c
+++ b/ffmpeg-mt/libavfilter/x86/gradfun.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
diff --git a/ffmpeg-mt/libavfilter/x86/yadif.c b/ffmpeg-mt/libavfilter/x86/yadif.c
index 2b55c00..7cd7e19 100644
--- a/ffmpeg-mt/libavfilter/x86/yadif.c
+++ b/ffmpeg-mt/libavfilter/x86/yadif.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
diff --git a/ffmpeg-mt/libavfilter/x86/yadif_template.c b/ffmpeg-mt/libavfilter/x86/yadif_template.c
index 3e520cb..962a7c7 100644
--- a/ffmpeg-mt/libavfilter/x86/yadif_template.c
+++ b/ffmpeg-mt/libavfilter/x86/yadif_template.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
@@ -105,7 +105,7 @@
 
 void RENAME(ff_yadif_filter_line)(uint8_t *dst,
                                   uint8_t *prev, uint8_t *cur, uint8_t *next,
-                                  int w, int refs, int parity, int mode)
+                                  int w, int prefs, int mrefs, int parity, int mode)
 {
     DECLARE_ALIGNED(16, uint8_t, tmp0[16]);
     DECLARE_ALIGNED(16, uint8_t, tmp1[16]);
@@ -226,8 +226,8 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
             :[prev] "r"(prev),\
              [cur]  "r"(cur),\
              [next] "r"(next),\
-             [prefs]"r"((x86_reg)refs),\
-             [mrefs]"r"((x86_reg)-refs),\
+             [prefs]"r"((x86_reg)prefs),\
+             [mrefs]"r"((x86_reg)mrefs),\
              [mode] "g"(mode)\
         );\
         __asm__ volatile(MOV" "MM"1, %0" :"=m"(*dst));\
diff --git a/ffmpeg-mt/libavfilter/yadif.h b/ffmpeg-mt/libavfilter/yadif.h
index 072812c..d658b68 100644
--- a/ffmpeg-mt/libavfilter/yadif.h
+++ b/ffmpeg-mt/libavfilter/yadif.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * with Libav; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
@@ -23,14 +23,14 @@
 
 void ff_yadif_filter_line_mmx(uint8_t *dst,
                               uint8_t *prev, uint8_t *cur, uint8_t *next,
-                              int w, int refs, int parity, int mode);
+                              int w, int prefs, int mrefs, int parity, int mode);
 
 void ff_yadif_filter_line_sse2(uint8_t *dst,
                                uint8_t *prev, uint8_t *cur, uint8_t *next,
-                               int w, int refs, int parity, int mode);
+                               int w, int prefs, int mrefs, int parity, int mode);
 
 void ff_yadif_filter_line_ssse3(uint8_t *dst,
                                 uint8_t *prev, uint8_t *cur, uint8_t *next,
-                                int w, int refs, int parity, int mode);
+                                int w, int prefs, int mrefs, int parity, int mode);
 
 #endif /* AVFILTER_YADIF_H */
diff --git a/ffmpeg-mt/libavformat/4xm.c b/ffmpeg-mt/libavformat/4xm.c
index dfbf032..ff0baae 100644
--- a/ffmpeg-mt/libavformat/4xm.c
+++ b/ffmpeg-mt/libavformat/4xm.c
@@ -2,20 +2,20 @@
  * 4X Technologies .4xm File Demuxer (no muxer)
  * Copyright (c) 2003  The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -54,11 +54,11 @@
 #define strk_SIZE 0x28
 
 #define GET_LIST_HEADER() \
-    fourcc_tag = get_le32(pb); \
-    size = get_le32(pb); \
+    fourcc_tag = avio_rl32(pb); \
+    size = avio_rl32(pb); \
     if (fourcc_tag != LIST_TAG) \
         return AVERROR_INVALIDDATA; \
-    fourcc_tag = get_le32(pb);
+    fourcc_tag = avio_rl32(pb);
 
 typedef struct AudioTrack {
     int sample_rate;
@@ -92,7 +92,7 @@ static int fourxm_probe(AVProbeData *p)
 static int fourxm_read_header(AVFormatContext *s,
                               AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int fourcc_tag;
     unsigned int size;
     int header_size;
@@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s,
     fourxm->fps = 1.0;
 
     /* skip the first 3 32-bit numbers */
-    url_fseek(pb, 12, SEEK_CUR);
+    avio_skip(pb, 12);
 
     /* check for LIST-HEAD */
     GET_LIST_HEADER();
@@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s,
     header = av_malloc(header_size);
     if (!header)
         return AVERROR(ENOMEM);
-    if (get_buffer(pb, header, header_size) != header_size){
+    if (avio_read(pb, header, header_size) != header_size){
         av_free(header);
         return AVERROR(EIO);
     }
@@ -244,7 +244,7 @@ static int fourxm_read_packet(AVFormatContext *s,
                               AVPacket *pkt)
 {
     FourxmDemuxContext *fourxm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int fourcc_tag;
     unsigned int size, out_size;
     int ret = 0;
@@ -255,11 +255,11 @@ static int fourxm_read_packet(AVFormatContext *s,
 
     while (!packet_read) {
 
-        if ((ret = get_buffer(s->pb, header, 8)) < 0)
+        if ((ret = avio_read(s->pb, header, 8)) < 0)
             return ret;
         fourcc_tag = AV_RL32(&header[0]);
         size = AV_RL32(&header[4]);
-        if (url_feof(pb))
+        if (pb->eof_reached)
             return AVERROR(EIO);
         switch (fourcc_tag) {
 
@@ -268,7 +268,7 @@ static int fourxm_read_packet(AVFormatContext *s,
             fourxm->video_pts ++;
 
             /* skip the LIST-* tag and move on to the next fourcc */
-            get_le32(pb);
+            avio_rl32(pb);
             break;
 
         case ifrm_TAG:
@@ -283,9 +283,9 @@ static int fourxm_read_packet(AVFormatContext *s,
                 return AVERROR(EIO);
             pkt->stream_index = fourxm->video_stream_index;
             pkt->pts = fourxm->video_pts;
-            pkt->pos = url_ftell(s->pb);
+            pkt->pos = avio_tell(s->pb);
             memcpy(pkt->data, header, 8);
-            ret = get_buffer(s->pb, &pkt->data[8], size);
+            ret = avio_read(s->pb, &pkt->data[8], size);
 
             if (ret < 0){
                 av_free_packet(pkt);
@@ -294,8 +294,8 @@ static int fourxm_read_packet(AVFormatContext *s,
             break;
 
         case snd__TAG:
-            track_number = get_le32(pb);
-            out_size= get_le32(pb);
+            track_number = avio_rl32(pb);
+            out_size= avio_rl32(pb);
             size-=8;
 
             if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
@@ -322,12 +322,12 @@ static int fourxm_read_packet(AVFormatContext *s,
                 fourxm->tracks[track_number].audio_pts += audio_frame_count;
 
             } else {
-                url_fseek(pb, size, SEEK_CUR);
+                avio_skip(pb, size);
             }
             break;
 
         default:
-            url_fseek(pb, size, SEEK_CUR);
+            avio_skip(pb, size);
             break;
         }
     }
@@ -343,7 +343,7 @@ static int fourxm_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat fourxm_demuxer = {
+AVInputFormat ff_fourxm_demuxer = {
     "4xm",
     NULL_IF_CONFIG_SMALL("4X Technologies format"),
     sizeof(FourxmDemuxContext),
diff --git a/ffmpeg-mt/libavformat/Makefile b/ffmpeg-mt/libavformat/Makefile
index 67462c4..719783c 100644
--- a/ffmpeg-mt/libavformat/Makefile
+++ b/ffmpeg-mt/libavformat/Makefile
@@ -1,9 +1,9 @@
 include $(SUBDIR)../config.mak
 
 NAME = avformat
-FFLIBS = avcodec avcore avutil
+FFLIBS = avcodec avutil
 
-HEADERS = avformat.h avio.h
+HEADERS = avformat.h avio.h version.h
 
 OBJS = allformats.o         \
        cutils.o             \
@@ -55,6 +55,7 @@ OBJS-$(CONFIG_CDG_DEMUXER)               += cdg.o
 OBJS-$(CONFIG_CRC_MUXER)                 += crcenc.o
 OBJS-$(CONFIG_DAUD_DEMUXER)              += daud.o
 OBJS-$(CONFIG_DAUD_MUXER)                += daud.o
+OBJS-$(CONFIG_DFA_DEMUXER)               += dfa.o
 OBJS-$(CONFIG_DIRAC_DEMUXER)             += diracdec.o rawdec.o
 OBJS-$(CONFIG_DIRAC_MUXER)               += rawenc.o
 OBJS-$(CONFIG_DNXHD_DEMUXER)             += dnxhddec.o rawdec.o
@@ -109,6 +110,8 @@ OBJS-$(CONFIG_IPMOVIE_DEMUXER)           += ipmovie.o
 OBJS-$(CONFIG_ISS_DEMUXER)               += iss.o
 OBJS-$(CONFIG_IV8_DEMUXER)               += iv8.o
 OBJS-$(CONFIG_IVF_DEMUXER)               += ivfdec.o riff.o
+OBJS-$(CONFIG_IVF_MUXER)                 += ivfenc.o
+OBJS-$(CONFIG_JV_DEMUXER)                += jvdec.o
 OBJS-$(CONFIG_LMLM4_DEMUXER)             += lmlm4.o
 OBJS-$(CONFIG_LXF_DEMUXER)               += lxfdec.o
 OBJS-$(CONFIG_M4V_DEMUXER)               += m4vdec.o rawdec.o
@@ -127,10 +130,11 @@ OBJS-$(CONFIG_MM_DEMUXER)                += mm.o
 OBJS-$(CONFIG_MMF_DEMUXER)               += mmf.o pcm.o
 OBJS-$(CONFIG_MMF_MUXER)                 += mmf.o riff.o
 OBJS-$(CONFIG_MOV_DEMUXER)               += mov.o riff.o isom.o
-OBJS-$(CONFIG_MOV_MUXER)                 += movenc.o riff.o isom.o avc.o movenchint.o
-OBJS-$(CONFIG_MP2_MUXER)                 += mp3.o
-OBJS-$(CONFIG_MP3_DEMUXER)               += mp3.o
-OBJS-$(CONFIG_MP3_MUXER)                 += mp3.o
+OBJS-$(CONFIG_MOV_MUXER)                 += movenc.o riff.o isom.o avc.o \
+                                            movenchint.o rtpenc_chain.o
+OBJS-$(CONFIG_MP2_MUXER)                 += mp3enc.o rawenc.o
+OBJS-$(CONFIG_MP3_DEMUXER)               += mp3dec.o
+OBJS-$(CONFIG_MP3_MUXER)                 += mp3enc.o rawenc.o
 OBJS-$(CONFIG_MPC_DEMUXER)               += mpc.o apetag.o
 OBJS-$(CONFIG_MPC8_DEMUXER)              += mpc8.o
 OBJS-$(CONFIG_MPEG1SYSTEM_MUXER)         += mpegenc.o
@@ -306,6 +310,7 @@ OBJS-$(CONFIG_LIBNUT_MUXER)              += libnut.o riff.o
 # protocols I/O
 OBJS+= avio.o aviobuf.o
 
+OBJS-$(CONFIG_APPLEHTTP_PROTOCOL)        += applehttpproto.o
 OBJS-$(CONFIG_CONCAT_PROTOCOL)           += concat.o
 OBJS-$(CONFIG_FILE_PROTOCOL)             += file.o
 OBJS-$(CONFIG_GOPHER_PROTOCOL)           += gopher.o
diff --git a/ffmpeg-mt/libavformat/a64.c b/ffmpeg-mt/libavformat/a64.c
index 2dc475c..0e5576b 100644
--- a/ffmpeg-mt/libavformat/a64.c
+++ b/ffmpeg-mt/libavformat/a64.c
@@ -2,20 +2,20 @@
  * a64 muxer
  * Copyright (c) 2009 Tobias Bindhammer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -57,7 +57,7 @@ static int a64_write_header(struct AVFormatContext *s)
         return AVERROR(EINVAL);
         break;
     }
-    put_buffer(s->pb, header, 2);
+    avio_write(s->pb, header, 2);
     c->prev_pkt.size = 0;
     c->prev_frame_count = 0;
     return 0;
@@ -110,18 +110,18 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
             for(i = 0; i < num_frames; i++) {
                 if(pkt->data) {
                     /* if available, put newest charset chunk into buffer */
-                    put_buffer(s->pb, pkt->data + ch_chunksize * i, ch_chunksize);
+                    avio_write(s->pb, pkt->data + ch_chunksize * i, ch_chunksize);
                 } else {
                     /* a bit ugly, but is there an alternative to put many zeros? */
-                    for(j = 0; j < ch_chunksize; j++) put_byte(s->pb, 0);
+                    for(j = 0; j < ch_chunksize; j++) avio_w8(s->pb, 0);
                 }
 
                 if(c->prev_pkt.data) {
                     /* put frame (screen + colram) from last packet into buffer */
-                    put_buffer(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size);
+                    avio_write(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size);
                 } else {
                     /* a bit ugly, but is there an alternative to put many zeros? */
-                    for(j = 0; j < frame_size; j++) put_byte(s->pb, 0);
+                    for(j = 0; j < frame_size; j++) avio_w8(s->pb, 0);
                 }
             }
 
@@ -145,11 +145,11 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
         default:
             /* Write things as is. Nice for self-contained frames from non-multicolor modes or if played
              * directly from ram and not from a streaming device (rrnet/mmc) */
-            if(pkt) put_buffer(s->pb, pkt->data, pkt->size);
+            if(pkt) avio_write(s->pb, pkt->data, pkt->size);
         break;
     }
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -164,7 +164,7 @@ static int a64_write_trailer(struct AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat a64_muxer = {
+AVOutputFormat ff_a64_muxer = {
     .name = "a64",
     .long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"),
     .mime_type = NULL,
diff --git a/ffmpeg-mt/libavformat/aacdec.c b/ffmpeg-mt/libavformat/aacdec.c
index 64ac3d1..0dc1c5c 100644
--- a/ffmpeg-mt/libavformat/aacdec.c
+++ b/ffmpeg-mt/libavformat/aacdec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2009 Robert Swain ( rob opendot cl )
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -81,7 +81,7 @@ static int adts_aac_read_header(AVFormatContext *s,
     return 0;
 }
 
-AVInputFormat aac_demuxer = {
+AVInputFormat ff_aac_demuxer = {
     "aac",
     NULL_IF_CONFIG_SMALL("raw ADTS AAC"),
     0,
diff --git a/ffmpeg-mt/libavformat/ac3dec.c b/ffmpeg-mt/libavformat/ac3dec.c
index b8a2bdd..7ed0102 100644
--- a/ffmpeg-mt/libavformat/ac3dec.c
+++ b/ffmpeg-mt/libavformat/ac3dec.c
@@ -2,20 +2,20 @@
  * RAW AC-3 and E-AC-3 demuxer
  * Copyright (c) 2007 Justin Ruggles <justin.ruggles at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -70,7 +70,7 @@ static int ac3_probe(AVProbeData *p)
     return ac3_eac3_probe(p, CODEC_ID_AC3);
 }
 
-AVInputFormat ac3_demuxer = {
+AVInputFormat ff_ac3_demuxer = {
     "ac3",
     NULL_IF_CONFIG_SMALL("raw AC-3"),
     0,
@@ -89,7 +89,7 @@ static int eac3_probe(AVProbeData *p)
     return ac3_eac3_probe(p, CODEC_ID_EAC3);
 }
 
-AVInputFormat eac3_demuxer = {
+AVInputFormat ff_eac3_demuxer = {
     "eac3",
     NULL_IF_CONFIG_SMALL("raw E-AC-3"),
     0,
diff --git a/ffmpeg-mt/libavformat/adts.h b/ffmpeg-mt/libavformat/adts.h
index 1da57be..78b42c7 100644
--- a/ffmpeg-mt/libavformat/adts.h
+++ b/ffmpeg-mt/libavformat/adts.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at smartjog.com>
  *                    Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/adtsenc.c b/ffmpeg-mt/libavformat/adtsenc.c
index 232d322..e858a81 100644
--- a/ffmpeg-mt/libavformat/adtsenc.c
+++ b/ffmpeg-mt/libavformat/adtsenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at smartjog.com>
  *                    Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -118,26 +118,26 @@ int ff_adts_write_frame_header(ADTSContext *ctx,
 static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     ADTSContext *adts = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint8_t buf[ADTS_HEADER_SIZE];
 
     if (!pkt->size)
         return 0;
     if (adts->write_adts) {
         ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size);
-        put_buffer(pb, buf, ADTS_HEADER_SIZE);
+        avio_write(pb, buf, ADTS_HEADER_SIZE);
         if (adts->pce_size) {
-            put_buffer(pb, adts->pce_data, adts->pce_size);
+            avio_write(pb, adts->pce_data, adts->pce_size);
             adts->pce_size = 0;
         }
     }
-    put_buffer(pb, pkt->data, pkt->size);
-    put_flush_packet(pb);
+    avio_write(pb, pkt->data, pkt->size);
+    avio_flush(pb);
 
     return 0;
 }
 
-AVOutputFormat adts_muxer = {
+AVOutputFormat ff_adts_muxer = {
     "adts",
     NULL_IF_CONFIG_SMALL("ADTS AAC"),
     "audio/aac",
diff --git a/ffmpeg-mt/libavformat/aea.c b/ffmpeg-mt/libavformat/aea.c
index 2c4f471..c6dfbb1 100644
--- a/ffmpeg-mt/libavformat/aea.c
+++ b/ffmpeg-mt/libavformat/aea.c
@@ -3,26 +3,27 @@
  *
  * Copyright (c) 2009 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
 #include "pcm.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/audioconvert.h"
 
 #define AT1_SU_SIZE     212
 
@@ -61,9 +62,9 @@ static int aea_read_header(AVFormatContext *s,
         return AVERROR(ENOMEM);
 
     /* Parse the amount of channels and skip to pos 2048(0x800) */
-    url_fskip(s->pb, 264);
-    st->codec->channels = get_byte(s->pb);
-    url_fskip(s->pb, 1783);
+    avio_skip(s->pb, 264);
+    st->codec->channels = avio_r8(s->pb);
+    avio_skip(s->pb, 1783);
 
 
     st->codec->codec_type     = AVMEDIA_TYPE_AUDIO;
@@ -76,7 +77,7 @@ static int aea_read_header(AVFormatContext *s,
         return -1;
     }
 
-    st->codec->channel_layout = (st->codec->channels == 1) ? CH_LAYOUT_MONO : CH_LAYOUT_STEREO;
+    st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
 
     st->codec->block_align = AT1_SU_SIZE * st->codec->channels;
     return 0;
@@ -93,7 +94,7 @@ static int aea_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat aea_demuxer = {
+AVInputFormat ff_aea_demuxer = {
     "aea",
     NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
     0,
diff --git a/ffmpeg-mt/libavformat/aiff.h b/ffmpeg-mt/libavformat/aiff.h
index 047f81d..cd2bd25 100644
--- a/ffmpeg-mt/libavformat/aiff.h
+++ b/ffmpeg-mt/libavformat/aiff.h
@@ -2,20 +2,20 @@
  * AIFF/AIFF-C muxer/demuxer common header
  * Copyright (c) 2006  Patrick Guimond
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/aiffdec.c b/ffmpeg-mt/libavformat/aiffdec.c
index 255caa3..8678f9b 100644
--- a/ffmpeg-mt/libavformat/aiffdec.c
+++ b/ffmpeg-mt/libavformat/aiffdec.c
@@ -2,20 +2,20 @@
  * AIFF/AIFF-C demuxer
  * Copyright (c) 2006  Patrick Guimond
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -47,15 +47,15 @@ static enum CodecID aiff_codec_get_id(int bps)
 }
 
 /* returns the size of the found tag */
-static int get_tag(ByteIOContext *pb, uint32_t * tag)
+static int get_tag(AVIOContext *pb, uint32_t * tag)
 {
     int size;
 
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return AVERROR(EIO);
 
-    *tag = get_le32(pb);
-    size = get_be32(pb);
+    *tag = avio_rl32(pb);
+    size = avio_rb32(pb);
 
     if (size < 0)
         size = 0x7fffffff;
@@ -70,11 +70,11 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
     int res;
 
     if (!str) {
-        url_fskip(s->pb, size);
+        avio_skip(s->pb, size);
         return;
     }
 
-    res = get_buffer(s->pb, str, size);
+    res = avio_read(s->pb, str, size);
     if (res < 0)
         return;
 
@@ -83,7 +83,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
 }
 
 /* Returns the number of sound data frames or negative on error */
-static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
+static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
                              int size, unsigned version)
 {
     AVExtFloat ext;
@@ -93,18 +93,18 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
     if (size & 1)
         size++;
     codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    codec->channels = get_be16(pb);
-    num_frames = get_be32(pb);
-    codec->bits_per_coded_sample = get_be16(pb);
+    codec->channels = avio_rb16(pb);
+    num_frames = avio_rb32(pb);
+    codec->bits_per_coded_sample = avio_rb16(pb);
 
-    get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
+    avio_read(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
     sample_rate = av_ext2dbl(ext);          /* 80 bits BE IEEE extended float */
     codec->sample_rate = sample_rate;
     size -= 18;
 
     /* Got an AIFF-C? */
     if (version == AIFF_C_VERSION1) {
-        codec->codec_tag = get_le32(pb);
+        codec->codec_tag = avio_rl32(pb);
         codec->codec_id  = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag);
 
         switch (codec->codec_id) {
@@ -152,7 +152,7 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
 
     /* Chunk is over */
     if (size)
-        url_fseek(pb, size, SEEK_CUR);
+        avio_skip(pb, size);
 
     return num_frames;
 }
@@ -177,7 +177,7 @@ static int aiff_read_header(AVFormatContext *s,
     int64_t offset = 0;
     uint32_t tag;
     unsigned version = AIFF_C_VERSION1;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream * st;
     AIFFInputContext *aiff = s->priv_data;
 
@@ -187,7 +187,7 @@ static int aiff_read_header(AVFormatContext *s,
         return AVERROR_INVALIDDATA;
 
     /* AIFF data type */
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
     if (tag == MKTAG('A', 'I', 'F', 'F'))       /* Got an AIFF file */
         version = AIFF;
     else if (tag != MKTAG('A', 'I', 'F', 'C'))  /* An AIFF-C file then */
@@ -217,7 +217,7 @@ static int aiff_read_header(AVFormatContext *s,
                 goto got_sound;
             break;
         case MKTAG('F', 'V', 'E', 'R'):     /* Version chunk */
-            version = get_be32(pb);
+            version = avio_rb32(pb);
             break;
         case MKTAG('N', 'A', 'M', 'E'):     /* Sample name chunk */
             get_meta(s, "title"    , size);
@@ -232,17 +232,17 @@ static int aiff_read_header(AVFormatContext *s,
             get_meta(s, "comment"  , size);
             break;
         case MKTAG('S', 'S', 'N', 'D'):     /* Sampled sound chunk */
-            aiff->data_end = url_ftell(pb) + size;
-            offset = get_be32(pb);      /* Offset of sound data */
-            get_be32(pb);               /* BlockSize... don't care */
-            offset += url_ftell(pb);    /* Compute absolute data offset */
+            aiff->data_end = avio_tell(pb) + size;
+            offset = avio_rb32(pb);      /* Offset of sound data */
+            avio_rb32(pb);               /* BlockSize... don't care */
+            offset += avio_tell(pb);    /* Compute absolute data offset */
             if (st->codec->block_align)    /* Assume COMM already parsed */
                 goto got_sound;
-            if (url_is_streamed(pb)) {
+            if (!pb->seekable) {
                 av_log(s, AV_LOG_ERROR, "file is not seekable\n");
                 return -1;
             }
-            url_fskip(pb, size - 8);
+            avio_skip(pb, size - 8);
             break;
         case MKTAG('w', 'a', 'v', 'e'):
             if ((uint64_t)size > (1<<30))
@@ -251,12 +251,12 @@ static int aiff_read_header(AVFormatContext *s,
             if (!st->codec->extradata)
                 return AVERROR(ENOMEM);
             st->codec->extradata_size = size;
-            get_buffer(pb, st->codec->extradata, size);
+            avio_read(pb, st->codec->extradata, size);
             break;
         default: /* Jump */
             if (size & 1)   /* Always even aligned */
                 size++;
-            url_fskip (pb, size);
+            avio_skip(pb, size);
         }
     }
 
@@ -276,7 +276,7 @@ got_sound:
         st->nb_frames * st->codec->frame_size : st->nb_frames;
 
     /* Position the stream at the first block */
-    url_fseek(pb, offset, SEEK_SET);
+    avio_seek(pb, offset, SEEK_SET);
 
     return 0;
 }
@@ -292,7 +292,7 @@ static int aiff_read_packet(AVFormatContext *s,
     int res, size;
 
     /* calculate size of remaining data */
-    max_size = aiff->data_end - url_ftell(s->pb);
+    max_size = aiff->data_end - avio_tell(s->pb);
     if (max_size <= 0)
         return AVERROR_EOF;
 
@@ -311,7 +311,7 @@ static int aiff_read_packet(AVFormatContext *s,
     return 0;
 }
 
-AVInputFormat aiff_demuxer = {
+AVInputFormat ff_aiff_demuxer = {
     "aiff",
     NULL_IF_CONFIG_SMALL("Audio IFF"),
     sizeof(AIFFInputContext),
diff --git a/ffmpeg-mt/libavformat/aiffenc.c b/ffmpeg-mt/libavformat/aiffenc.c
index e3c6a0b..3bdb4f4 100644
--- a/ffmpeg-mt/libavformat/aiffenc.c
+++ b/ffmpeg-mt/libavformat/aiffenc.c
@@ -2,25 +2,26 @@
  * AIFF/AIFF-C muxer
  * Copyright (c) 2006  Patrick Guimond
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
 #include "aiff.h"
+#include "avio_internal.h"
 
 typedef struct {
     int64_t form;
@@ -31,7 +32,7 @@ typedef struct {
 static int aiff_write_header(AVFormatContext *s)
 {
     AIFFOutputContext *aiff = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *enc = s->streams[0]->codec;
     AVExtFloat sample_rate;
     int aifc = 0;
@@ -43,10 +44,10 @@ static int aiff_write_header(AVFormatContext *s)
         aifc = 1;
 
     /* FORM AIFF header */
-    put_tag(pb, "FORM");
-    aiff->form = url_ftell(pb);
-    put_be32(pb, 0);                    /* file length */
-    put_tag(pb, aifc ? "AIFC" : "AIFF");
+    ffio_wfourcc(pb, "FORM");
+    aiff->form = avio_tell(pb);
+    avio_wb32(pb, 0);                    /* file length */
+    ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF");
 
     if (aifc) { // compressed audio
         enc->bits_per_coded_sample = 16;
@@ -55,18 +56,18 @@ static int aiff_write_header(AVFormatContext *s)
             return -1;
         }
         /* Version chunk */
-        put_tag(pb, "FVER");
-        put_be32(pb, 4);
-        put_be32(pb, 0xA2805140);
+        ffio_wfourcc(pb, "FVER");
+        avio_wb32(pb, 4);
+        avio_wb32(pb, 0xA2805140);
     }
 
     /* Common chunk */
-    put_tag(pb, "COMM");
-    put_be32(pb, aifc ? 24 : 18); /* size */
-    put_be16(pb, enc->channels);  /* Number of channels */
+    ffio_wfourcc(pb, "COMM");
+    avio_wb32(pb, aifc ? 24 : 18); /* size */
+    avio_wb16(pb, enc->channels);  /* Number of channels */
 
-    aiff->frames = url_ftell(pb);
-    put_be32(pb, 0);              /* Number of frames */
+    aiff->frames = avio_tell(pb);
+    avio_wb32(pb, 0);              /* Number of frames */
 
     if (!enc->bits_per_coded_sample)
         enc->bits_per_coded_sample = av_get_bits_per_sample(enc->codec_id);
@@ -77,75 +78,75 @@ static int aiff_write_header(AVFormatContext *s)
     if (!enc->block_align)
         enc->block_align = (enc->bits_per_coded_sample * enc->channels) >> 3;
 
-    put_be16(pb, enc->bits_per_coded_sample); /* Sample size */
+    avio_wb16(pb, enc->bits_per_coded_sample); /* Sample size */
 
     sample_rate = av_dbl2ext((double)enc->sample_rate);
-    put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
+    avio_write(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
 
     if (aifc) {
-        put_le32(pb, enc->codec_tag);
-        put_be16(pb, 0);
+        avio_wl32(pb, enc->codec_tag);
+        avio_wb16(pb, 0);
     }
 
     /* Sound data chunk */
-    put_tag(pb, "SSND");
-    aiff->ssnd = url_ftell(pb);         /* Sound chunk size */
-    put_be32(pb, 0);                    /* Sound samples data size */
-    put_be32(pb, 0);                    /* Data offset */
-    put_be32(pb, 0);                    /* Block-size (block align) */
+    ffio_wfourcc(pb, "SSND");
+    aiff->ssnd = avio_tell(pb);         /* Sound chunk size */
+    avio_wb32(pb, 0);                    /* Sound samples data size */
+    avio_wb32(pb, 0);                    /* Data offset */
+    avio_wb32(pb, 0);                    /* Block-size (block align) */
 
     av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
 
     /* Data is starting here */
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
 static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
+    AVIOContext *pb = s->pb;
+    avio_write(pb, pkt->data, pkt->size);
     return 0;
 }
 
 static int aiff_write_trailer(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AIFFOutputContext *aiff = s->priv_data;
     AVCodecContext *enc = s->streams[0]->codec;
 
     /* Chunks sizes must be even */
     int64_t file_size, end_size;
-    end_size = file_size = url_ftell(pb);
+    end_size = file_size = avio_tell(pb);
     if (file_size & 1) {
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
         end_size++;
     }
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
         /* File length */
-        url_fseek(pb, aiff->form, SEEK_SET);
-        put_be32(pb, file_size - aiff->form - 4);
+        avio_seek(pb, aiff->form, SEEK_SET);
+        avio_wb32(pb, file_size - aiff->form - 4);
 
         /* Number of sample frames */
-        url_fseek(pb, aiff->frames, SEEK_SET);
-        put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align);
+        avio_seek(pb, aiff->frames, SEEK_SET);
+        avio_wb32(pb, (file_size-aiff->ssnd-12)/enc->block_align);
 
         /* Sound Data chunk size */
-        url_fseek(pb, aiff->ssnd, SEEK_SET);
-        put_be32(pb, file_size - aiff->ssnd - 4);
+        avio_seek(pb, aiff->ssnd, SEEK_SET);
+        avio_wb32(pb, file_size - aiff->ssnd - 4);
 
         /* return to the end */
-        url_fseek(pb, end_size, SEEK_SET);
+        avio_seek(pb, end_size, SEEK_SET);
 
-        put_flush_packet(pb);
+        avio_flush(pb);
     }
 
     return 0;
 }
 
-AVOutputFormat aiff_muxer = {
+AVOutputFormat ff_aiff_muxer = {
     "aiff",
     NULL_IF_CONFIG_SMALL("Audio IFF"),
     "audio/aiff",
diff --git a/ffmpeg-mt/libavformat/allformats.c b/ffmpeg-mt/libavformat/allformats.c
index d543ad1..9398d34 100644
--- a/ffmpeg-mt/libavformat/allformats.c
+++ b/ffmpeg-mt/libavformat/allformats.c
@@ -2,39 +2,40 @@
  * Register all the formats and protocols
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
 #include "rtp.h"
 #include "rdt.h"
+#include "url.h"
 
 #define REGISTER_MUXER(X,x) { \
-    extern AVOutputFormat x##_muxer; \
-    if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); }
+    extern AVOutputFormat ff_##x##_muxer; \
+    if(CONFIG_##X##_MUXER) av_register_output_format(&ff_##x##_muxer); }
 
 #define REGISTER_DEMUXER(X,x) { \
-    extern AVInputFormat x##_demuxer; \
-    if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }
+    extern AVInputFormat ff_##x##_demuxer; \
+    if(CONFIG_##X##_DEMUXER) av_register_input_format(&ff_##x##_demuxer); }
 
 #define REGISTER_MUXDEMUX(X,x)  REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
 
 #define REGISTER_PROTOCOL(X,x) { \
-    extern URLProtocol x##_protocol; \
-    if(CONFIG_##X##_PROTOCOL) av_register_protocol2(&x##_protocol, sizeof(x##_protocol)); }
+    extern URLProtocol ff_##x##_protocol; \
+    if(CONFIG_##X##_PROTOCOL) ffurl_register_protocol(&ff_##x##_protocol, sizeof(ff_##x##_protocol)); }
 
 void av_register_all(void)
 {
@@ -75,6 +76,7 @@ void av_register_all(void)
     REGISTER_DEMUXER  (CDG, cdg);
     REGISTER_MUXER    (CRC, crc);
     REGISTER_MUXDEMUX (DAUD, daud);
+    REGISTER_DEMUXER  (DFA, dfa);
     REGISTER_MUXDEMUX (DIRAC, dirac);
     REGISTER_MUXDEMUX (DNXHD, dnxhd);
     REGISTER_DEMUXER  (DSICIN, dsicin);
@@ -109,7 +111,8 @@ void av_register_all(void)
     REGISTER_MUXER    (IPOD, ipod);
     REGISTER_DEMUXER  (ISS, iss);
     REGISTER_DEMUXER  (IV8, iv8);
-    REGISTER_DEMUXER  (IVF, ivf);
+    REGISTER_MUXDEMUX (IVF, ivf);
+    REGISTER_DEMUXER  (JV, jv);
     REGISTER_DEMUXER  (LMLM4, lmlm4);
     REGISTER_DEMUXER  (LXF, lxf);
     REGISTER_MUXDEMUX (M4V, m4v);
@@ -229,6 +232,7 @@ void av_register_all(void)
     REGISTER_MUXDEMUX (LIBNUT, libnut);
 
     /* protocols */
+    REGISTER_PROTOCOL (APPLEHTTP, applehttp);
     REGISTER_PROTOCOL (CONCAT, concat);
     REGISTER_PROTOCOL (FILE, file);
     REGISTER_PROTOCOL (GOPHER, gopher);
diff --git a/ffmpeg-mt/libavformat/amr.c b/ffmpeg-mt/libavformat/amr.c
index f78aacc..260bd6a 100644
--- a/ffmpeg-mt/libavformat/amr.c
+++ b/ffmpeg-mt/libavformat/amr.c
@@ -2,20 +2,20 @@
  * amr file format
  * Copyright (c) 2001 ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,31 +33,31 @@ static const char AMRWB_header [] = "#!AMR-WB\n";
 #if CONFIG_AMR_MUXER
 static int amr_write_header(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *enc = s->streams[0]->codec;
 
     s->priv_data = NULL;
 
     if (enc->codec_id == CODEC_ID_AMR_NB)
     {
-        put_tag(pb, AMR_header);       /* magic number */
+        avio_write(pb, AMR_header,   sizeof(AMR_header)   - 1); /* magic number */
     }
     else if(enc->codec_id == CODEC_ID_AMR_WB)
     {
-        put_tag(pb, AMRWB_header);       /* magic number */
+        avio_write(pb, AMRWB_header, sizeof(AMRWB_header) - 1); /* magic number */
     }
     else
     {
         return -1;
     }
-    put_flush_packet(pb);
+    avio_flush(pb);
     return 0;
 }
 
 static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
+    avio_write(s->pb, pkt->data, pkt->size);
+    avio_flush(s->pb);
     return 0;
 }
 #endif /* CONFIG_AMR_MUXER */
@@ -78,11 +78,11 @@ static int amr_probe(AVProbeData *p)
 static int amr_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     uint8_t header[9];
 
-    get_buffer(pb, header, 6);
+    avio_read(pb, header, 6);
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -91,7 +91,7 @@ static int amr_read_header(AVFormatContext *s,
     }
     if(memcmp(header,AMR_header,6)!=0)
     {
-        get_buffer(pb, header+6, 3);
+        avio_read(pb, header+6, 3);
         if(memcmp(header,AMRWB_header,9)!=0)
         {
             return -1;
@@ -121,14 +121,15 @@ static int amr_read_packet(AVFormatContext *s,
 {
     AVCodecContext *enc = s->streams[0]->codec;
     int read, size = 0, toc, mode;
+    int64_t pos = avio_tell(s->pb);
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
     {
         return AVERROR(EIO);
     }
 
 //FIXME this is wrong, this should rather be in a AVParset
-    toc=get_byte(s->pb);
+    toc=avio_r8(s->pb);
     mode = (toc >> 3) & 0x0F;
 
     if (enc->codec_id == CODEC_ID_AMR_NB)
@@ -153,11 +154,14 @@ static int amr_read_packet(AVFormatContext *s,
         return AVERROR(EIO);
     }
 
+    /* Both AMR formats have 50 frames per second */
+    s->streams[0]->codec->bit_rate = size*8*50;
+
     pkt->stream_index = 0;
-    pkt->pos= url_ftell(s->pb);
+    pkt->pos = pos;
     pkt->data[0]=toc;
     pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
-    read = get_buffer(s->pb, pkt->data+1, size-1);
+    read = avio_read(s->pb, pkt->data+1, size-1);
 
     if (read != size-1)
     {
@@ -169,7 +173,7 @@ static int amr_read_packet(AVFormatContext *s,
 }
 
 #if CONFIG_AMR_DEMUXER
-AVInputFormat amr_demuxer = {
+AVInputFormat ff_amr_demuxer = {
     "amr",
     NULL_IF_CONFIG_SMALL("3GPP AMR file format"),
     0, /*priv_data_size*/
@@ -177,11 +181,12 @@ AVInputFormat amr_demuxer = {
     amr_read_header,
     amr_read_packet,
     NULL,
+    .flags = AVFMT_GENERIC_INDEX,
 };
 #endif
 
 #if CONFIG_AMR_MUXER
-AVOutputFormat amr_muxer = {
+AVOutputFormat ff_amr_muxer = {
     "amr",
     NULL_IF_CONFIG_SMALL("3GPP AMR file format"),
     "audio/amr",
diff --git a/ffmpeg-mt/libavformat/anm.c b/ffmpeg-mt/libavformat/anm.c
index 82430e5..4d1b5f7 100644
--- a/ffmpeg-mt/libavformat/anm.c
+++ b/ffmpeg-mt/libavformat/anm.c
@@ -2,20 +2,20 @@
  * Deluxe Paint Animation demuxer
  * Copyright (c) 2009 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,21 +79,21 @@ static int read_header(AVFormatContext *s,
                        AVFormatParameters *ap)
 {
     AnmDemuxContext *anm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     int i, ret;
 
-    url_fskip(pb, 4); /* magic number */
-    if (get_le16(pb) != MAX_PAGES) {
+    avio_skip(pb, 4); /* magic number */
+    if (avio_rl16(pb) != MAX_PAGES) {
         av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
         return AVERROR_INVALIDDATA;
     }
 
-    anm->nb_pages   = get_le16(pb);
-    anm->nb_records = get_le32(pb);
-    url_fskip(pb, 2); /* max records per page */
-    anm->page_table_offset = get_le16(pb);
-    if (get_le32(pb) != ANIM_TAG)
+    anm->nb_pages   = avio_rl16(pb);
+    anm->nb_records = avio_rl32(pb);
+    avio_skip(pb, 2); /* max records per page */
+    anm->page_table_offset = avio_rl16(pb);
+    if (avio_rl32(pb) != ANIM_TAG)
         return AVERROR_INVALIDDATA;
 
     /* video stream */
@@ -103,33 +103,33 @@ static int read_header(AVFormatContext *s,
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id   = CODEC_ID_ANM;
     st->codec->codec_tag  = 0; /* no fourcc */
-    st->codec->width      = get_le16(pb);
-    st->codec->height     = get_le16(pb);
-    if (get_byte(pb) != 0)
+    st->codec->width      = avio_rl16(pb);
+    st->codec->height     = avio_rl16(pb);
+    if (avio_r8(pb) != 0)
         goto invalid;
-    url_fskip(pb, 1); /* frame rate multiplier info */
+    avio_skip(pb, 1); /* frame rate multiplier info */
 
     /* ignore last delta record (used for looping) */
-    if (get_byte(pb))  /* has_last_delta */
+    if (avio_r8(pb))  /* has_last_delta */
         anm->nb_records = FFMAX(anm->nb_records - 1, 0);
 
-    url_fskip(pb, 1); /* last_delta_valid */
+    avio_skip(pb, 1); /* last_delta_valid */
 
-    if (get_byte(pb) != 0)
+    if (avio_r8(pb) != 0)
         goto invalid;
 
-    if (get_byte(pb) != 1)
+    if (avio_r8(pb) != 1)
         goto invalid;
 
-    url_fskip(pb, 1); /* other recs per frame */
+    avio_skip(pb, 1); /* other recs per frame */
 
-    if (get_byte(pb) != 1)
+    if (avio_r8(pb) != 1)
         goto invalid;
 
-    url_fskip(pb, 32); /* record_types */
-    st->nb_frames = get_le32(pb);
-    av_set_pts_info(st, 64, 1, get_le16(pb));
-    url_fskip(pb, 58);
+    avio_skip(pb, 32); /* record_types */
+    st->nb_frames = avio_rl32(pb);
+    av_set_pts_info(st, 64, 1, avio_rl16(pb));
+    avio_skip(pb, 58);
 
     /* color cycling and palette data */
     st->codec->extradata_size = 16*8 + 4*256;
@@ -138,20 +138,20 @@ static int read_header(AVFormatContext *s,
         ret = AVERROR(ENOMEM);
         goto close_and_return;
     }
-    ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
+    ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
     if (ret < 0)
         goto close_and_return;
 
     /* read page table */
-    ret = url_fseek(pb, anm->page_table_offset, SEEK_SET);
+    ret = avio_seek(pb, anm->page_table_offset, SEEK_SET);
     if (ret < 0)
         goto close_and_return;
 
     for (i = 0; i < MAX_PAGES; i++) {
         Page *p = &anm->pt[i];
-        p->base_record = get_le16(pb);
-        p->nb_records  = get_le16(pb);
-        p->size        = get_le16(pb);
+        p->base_record = avio_rl16(pb);
+        p->nb_records  = avio_rl16(pb);
+        p->size        = avio_rl16(pb);
     }
 
     /* find page of first frame */
@@ -177,11 +177,11 @@ static int read_packet(AVFormatContext *s,
                        AVPacket *pkt)
 {
     AnmDemuxContext *anm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     Page *p;
     int tmp, record_size;
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR(EIO);
 
     if (anm->page < 0)
@@ -192,8 +192,8 @@ repeat:
 
     /* parse page header */
     if (anm->record < 0) {
-        url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
-        url_fskip(pb, 8 + 2*p->nb_records);
+        avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
+        avio_skip(pb, 8 + 2*p->nb_records);
         anm->record = 0;
     }
 
@@ -208,11 +208,11 @@ repeat:
     }
 
     /* fetch record size */
-    tmp = url_ftell(pb);
-    url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
+    tmp = avio_tell(pb);
+    avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
               8 + anm->record * 2, SEEK_SET);
-    record_size = get_le16(pb);
-    url_fseek(pb, tmp, SEEK_SET);
+    record_size = avio_rl16(pb);
+    avio_seek(pb, tmp, SEEK_SET);
 
     /* fetch record */
     pkt->size = av_get_packet(s->pb, pkt, record_size);
@@ -225,7 +225,7 @@ repeat:
     return 0;
 }
 
-AVInputFormat anm_demuxer = {
+AVInputFormat ff_anm_demuxer = {
     "anm",
     NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
     sizeof(AnmDemuxContext),
diff --git a/ffmpeg-mt/libavformat/apc.c b/ffmpeg-mt/libavformat/apc.c
index 9b4a8ad..40c6f0c 100644
--- a/ffmpeg-mt/libavformat/apc.c
+++ b/ffmpeg-mt/libavformat/apc.c
@@ -2,20 +2,20 @@
  * CRYO APC audio format demuxer
  * Copyright (c) 2007 Anssi Hannula <anssi.hannula at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,12 +32,12 @@ static int apc_probe(AVProbeData *p)
 
 static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
 
-    get_le32(pb); /* CRYO */
-    get_le32(pb); /* _APC */
-    get_le32(pb); /* 1.20 */
+    avio_rl32(pb); /* CRYO */
+    avio_rl32(pb); /* _APC */
+    avio_rl32(pb); /* 1.20 */
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -46,8 +46,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
 
-    get_le32(pb); /* number of samples */
-    st->codec->sample_rate = get_le32(pb);
+    avio_rl32(pb); /* number of samples */
+    st->codec->sample_rate = avio_rl32(pb);
 
     st->codec->extradata_size = 2 * 4;
     st->codec->extradata = av_malloc(st->codec->extradata_size +
@@ -56,10 +56,10 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return AVERROR(ENOMEM);
 
     /* initial predictor values for adpcm decoder */
-    get_buffer(pb, st->codec->extradata, 2 * 4);
+    avio_read(pb, st->codec->extradata, 2 * 4);
 
     st->codec->channels = 1;
-    if (get_le32(pb))
+    if (avio_rl32(pb))
         st->codec->channels = 2;
 
     st->codec->bits_per_coded_sample = 4;
@@ -80,7 +80,7 @@ static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat apc_demuxer = {
+AVInputFormat ff_apc_demuxer = {
     "apc",
     NULL_IF_CONFIG_SMALL("CRYO APC format"),
     0,
diff --git a/ffmpeg-mt/libavformat/ape.c b/ffmpeg-mt/libavformat/ape.c
index 91acf72..956036d 100644
--- a/ffmpeg-mt/libavformat/ape.c
+++ b/ffmpeg-mt/libavformat/ape.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
  *  based upon libdemac from Dave Chapman.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -151,7 +151,7 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx)
 
 static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     APEContext *ape = s->priv_data;
     AVStream *st;
     uint32_t tag;
@@ -162,11 +162,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
     /* TODO: Skip any leading junk such as id3v2 tags */
     ape->junklength = 0;
 
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
     if (tag != MKTAG('M', 'A', 'C', ' '))
         return -1;
 
-    ape->fileversion = get_le16(pb);
+    ape->fileversion = avio_rl16(pb);
 
     if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {
         av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10);
@@ -174,50 +174,50 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
     }
 
     if (ape->fileversion >= 3980) {
-        ape->padding1             = get_le16(pb);
-        ape->descriptorlength     = get_le32(pb);
-        ape->headerlength         = get_le32(pb);
-        ape->seektablelength      = get_le32(pb);
-        ape->wavheaderlength      = get_le32(pb);
-        ape->audiodatalength      = get_le32(pb);
-        ape->audiodatalength_high = get_le32(pb);
-        ape->wavtaillength        = get_le32(pb);
-        get_buffer(pb, ape->md5, 16);
+        ape->padding1             = avio_rl16(pb);
+        ape->descriptorlength     = avio_rl32(pb);
+        ape->headerlength         = avio_rl32(pb);
+        ape->seektablelength      = avio_rl32(pb);
+        ape->wavheaderlength      = avio_rl32(pb);
+        ape->audiodatalength      = avio_rl32(pb);
+        ape->audiodatalength_high = avio_rl32(pb);
+        ape->wavtaillength        = avio_rl32(pb);
+        avio_read(pb, ape->md5, 16);
 
         /* Skip any unknown bytes at the end of the descriptor.
            This is for future compatibility */
         if (ape->descriptorlength > 52)
-            url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
+            avio_skip(pb, ape->descriptorlength - 52);
 
         /* Read header data */
-        ape->compressiontype      = get_le16(pb);
-        ape->formatflags          = get_le16(pb);
-        ape->blocksperframe       = get_le32(pb);
-        ape->finalframeblocks     = get_le32(pb);
-        ape->totalframes          = get_le32(pb);
-        ape->bps                  = get_le16(pb);
-        ape->channels             = get_le16(pb);
-        ape->samplerate           = get_le32(pb);
+        ape->compressiontype      = avio_rl16(pb);
+        ape->formatflags          = avio_rl16(pb);
+        ape->blocksperframe       = avio_rl32(pb);
+        ape->finalframeblocks     = avio_rl32(pb);
+        ape->totalframes          = avio_rl32(pb);
+        ape->bps                  = avio_rl16(pb);
+        ape->channels             = avio_rl16(pb);
+        ape->samplerate           = avio_rl32(pb);
     } else {
         ape->descriptorlength = 0;
         ape->headerlength = 32;
 
-        ape->compressiontype      = get_le16(pb);
-        ape->formatflags          = get_le16(pb);
-        ape->channels             = get_le16(pb);
-        ape->samplerate           = get_le32(pb);
-        ape->wavheaderlength      = get_le32(pb);
-        ape->wavtaillength        = get_le32(pb);
-        ape->totalframes          = get_le32(pb);
-        ape->finalframeblocks     = get_le32(pb);
+        ape->compressiontype      = avio_rl16(pb);
+        ape->formatflags          = avio_rl16(pb);
+        ape->channels             = avio_rl16(pb);
+        ape->samplerate           = avio_rl32(pb);
+        ape->wavheaderlength      = avio_rl32(pb);
+        ape->wavtaillength        = avio_rl32(pb);
+        ape->totalframes          = avio_rl32(pb);
+        ape->finalframeblocks     = avio_rl32(pb);
 
         if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
-            url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
+            avio_skip(pb, 4); /* Skip the peak level */
             ape->headerlength += 4;
         }
 
         if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {
-            ape->seektablelength = get_le32(pb);
+            ape->seektablelength = avio_rl32(pb);
             ape->headerlength += 4;
             ape->seektablelength *= sizeof(int32_t);
         } else
@@ -239,13 +239,22 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
 
         /* Skip any stored wav header */
         if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
-            url_fskip(pb, ape->wavheaderlength);
+            avio_skip(pb, ape->wavheaderlength);
     }
 
+    if(!ape->totalframes){
+        av_log(s, AV_LOG_ERROR, "No frames in the file!\n");
+        return AVERROR(EINVAL);
+    }
     if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
         av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
         return -1;
     }
+    if (ape->seektablelength && (ape->seektablelength / sizeof(*ape->seektable)) < ape->totalframes) {
+        av_log(s, AV_LOG_ERROR, "Number of seek entries is less than number of frames: %d vs. %d\n",
+               ape->seektablelength / sizeof(*ape->seektable), ape->totalframes);
+        return AVERROR_INVALIDDATA;
+    }
     ape->frames       = av_malloc(ape->totalframes * sizeof(APEFrame));
     if(!ape->frames)
         return AVERROR(ENOMEM);
@@ -260,7 +269,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
     if (ape->seektablelength > 0) {
         ape->seektable = av_malloc(ape->seektablelength);
         for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
-            ape->seektable[i] = get_le32(pb);
+            ape->seektable[i] = avio_rl32(pb);
     }
 
     ape->frames[0].pos     = ape->firstframe;
@@ -287,9 +296,9 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
     ape_dumpinfo(s, ape);
 
     /* try to read APE tags */
-    if (!url_is_streamed(pb)) {
+    if (pb->seekable) {
         ff_ape_parse_tag(s);
-        url_fseek(pb, 0, SEEK_SET);
+        avio_seek(pb, 0, SEEK_SET);
     }
 
     av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype);
@@ -337,12 +346,12 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
     APEContext *ape = s->priv_data;
     uint32_t extra_size = 8;
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR(EIO);
     if (ape->currentframe > ape->totalframes)
         return AVERROR(EIO);
 
-    url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
+    avio_seek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
 
     /* Calculate how many blocks there are in this frame */
     if (ape->currentframe == (ape->totalframes - 1))
@@ -355,7 +364,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
 
     AV_WL32(pkt->data    , nblocks);
     AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
-    ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
+    ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
 
     pkt->pts = ape->frames[ape->currentframe].pts;
     pkt->stream_index = 0;
@@ -391,7 +400,7 @@ static int ape_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-AVInputFormat ape_demuxer = {
+AVInputFormat ff_ape_demuxer = {
     "ape",
     NULL_IF_CONFIG_SMALL("Monkey's Audio"),
     sizeof(APEContext),
diff --git a/ffmpeg-mt/libavformat/apetag.c b/ffmpeg-mt/libavformat/apetag.c
index d30c132..b8a460a 100644
--- a/ffmpeg-mt/libavformat/apetag.c
+++ b/ffmpeg-mt/libavformat/apetag.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
  *  based upon libdemac from Dave Chapman.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,15 +33,15 @@
 
 static int ape_tag_read_field(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint8_t key[1024], *value;
     uint32_t size, flags;
     int i, c;
 
-    size = get_le32(pb);  /* field size */
-    flags = get_le32(pb); /* field flags */
+    size = avio_rl32(pb);  /* field size */
+    flags = avio_rl32(pb); /* field flags */
     for (i = 0; i < sizeof(key) - 1; i++) {
-        c = get_byte(pb);
+        c = avio_r8(pb);
         if (c < 0x20 || c > 0x7E)
             break;
         else
@@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s)
     value = av_malloc(size+1);
     if (!value)
         return AVERROR(ENOMEM);
-    get_buffer(pb, value, size);
+    avio_read(pb, value, size);
     value[size] = 0;
     av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
     return 0;
@@ -65,8 +65,8 @@ static int ape_tag_read_field(AVFormatContext *s)
 
 void ff_ape_parse_tag(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
-    int file_size = url_fsize(pb);
+    AVIOContext *pb = s->pb;
+    int file_size = avio_size(pb);
     uint32_t val, fields, tag_bytes;
     uint8_t buf[8];
     int i;
@@ -74,38 +74,38 @@ void ff_ape_parse_tag(AVFormatContext *s)
     if (file_size < APE_TAG_FOOTER_BYTES)
         return;
 
-    url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
+    avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
 
-    get_buffer(pb, buf, 8);    /* APETAGEX */
+    avio_read(pb, buf, 8);     /* APETAGEX */
     if (strncmp(buf, "APETAGEX", 8)) {
         return;
     }
 
-    val = get_le32(pb);        /* APE tag version */
+    val = avio_rl32(pb);       /* APE tag version */
     if (val > APE_TAG_VERSION) {
         av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION);
         return;
     }
 
-    tag_bytes = get_le32(pb);  /* tag size */
+    tag_bytes = avio_rl32(pb); /* tag size */
     if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {
         av_log(s, AV_LOG_ERROR, "Tag size is way too big\n");
         return;
     }
 
-    fields = get_le32(pb);     /* number of fields */
+    fields = avio_rl32(pb);    /* number of fields */
     if (fields > 65536) {
         av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
         return;
     }
 
-    val = get_le32(pb);        /* flags */
+    val = avio_rl32(pb);       /* flags */
     if (val & APE_TAG_FLAG_IS_HEADER) {
         av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
         return;
     }
 
-    url_fseek(pb, file_size - tag_bytes, SEEK_SET);
+    avio_seek(pb, file_size - tag_bytes, SEEK_SET);
 
     for (i=0; i<fields; i++)
         if (ape_tag_read_field(s) < 0) break;
diff --git a/ffmpeg-mt/libavformat/apetag.h b/ffmpeg-mt/libavformat/apetag.h
index 8aaef68..9a39d02 100644
--- a/ffmpeg-mt/libavformat/apetag.h
+++ b/ffmpeg-mt/libavformat/apetag.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
  *  based upon libdemac from Dave Chapman.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/applehttp.c b/ffmpeg-mt/libavformat/applehttp.c
index 4a4611c..243f4a6 100644
--- a/ffmpeg-mt/libavformat/applehttp.c
+++ b/ffmpeg-mt/libavformat/applehttp.c
@@ -2,20 +2,20 @@
  * Apple HTTP Live Streaming demuxer
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,6 +30,10 @@
 #include "avformat.h"
 #include "internal.h"
 #include <unistd.h>
+#include "avio_internal.h"
+#include "url.h"
+
+#define INITIAL_BUFFER_SIZE 32768
 
 /*
  * An apple http stream consists of a playlist with media segment files,
@@ -50,35 +54,40 @@ struct segment {
 
 /*
  * Each variant has its own demuxer. If it currently is active,
- * it has an open ByteIOContext too, and potentially an AVPacket
+ * it has an open AVIOContext too, and potentially an AVPacket
  * containing the next packet from this stream.
  */
 struct variant {
     int bandwidth;
     char url[MAX_URL_SIZE];
-    ByteIOContext *pb;
+    AVIOContext pb;
+    uint8_t* read_buffer;
+    URLContext *input;
+    AVFormatContext *parent;
+    int index;
     AVFormatContext *ctx;
     AVPacket pkt;
     int stream_offset;
 
+    int finished;
+    int target_duration;
     int start_seq_no;
     int n_segments;
     struct segment **segments;
-    int needed;
+    int needed, cur_needed;
+    int cur_seq_no;
+    int64_t last_load_time;
 };
 
 typedef struct AppleHTTPContext {
-    int target_duration;
-    int finished;
     int n_variants;
     struct variant **variants;
     int cur_seq_no;
-    int64_t last_load_time;
-    int64_t last_packet_dts;
-    int max_start_seq, min_end_seq;
+    int end_of_segment;
+    int first_packet;
 } AppleHTTPContext;
 
-static int read_chomp_line(ByteIOContext *s, char *buf, int maxlen)
+static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
 {
     int len = ff_get_line(s, buf, maxlen);
     while (len > 0 && isspace(buf[len - 1]))
@@ -86,43 +95,6 @@ static int read_chomp_line(ByteIOContext *s, char *buf, int maxlen)
     return len;
 }
 
-static void make_absolute_url(char *buf, int size, const char *base,
-                              const char *rel)
-{
-    char *sep;
-    /* If rel actually is an absolute url, just copy it */
-    if (!base || strstr(rel, "://") || rel[0] == '/') {
-        av_strlcpy(buf, rel, size);
-        return;
-    }
-    if (base != buf)
-        av_strlcpy(buf, base, size);
-    /* Remove the file name from the base url */
-    sep = strrchr(buf, '/');
-    if (sep)
-        sep[1] = '\0';
-    else
-        buf[0] = '\0';
-    while (av_strstart(rel, "../", NULL) && sep) {
-        /* Remove the path delimiter at the end */
-        sep[0] = '\0';
-        sep = strrchr(buf, '/');
-        /* If the next directory name to pop off is "..", break here */
-        if (!strcmp(sep ? &sep[1] : buf, "..")) {
-            /* Readd the slash we just removed */
-            av_strlcat(buf, "/", size);
-            break;
-        }
-        /* Cut off the directory name */
-        if (sep)
-            sep[1] = '\0';
-        else
-            buf[0] = '\0';
-        rel += 3;
-    }
-    av_strlcat(buf, rel, size);
-}
-
 static void free_segment_list(struct variant *var)
 {
     int i;
@@ -139,8 +111,9 @@ static void free_variant_list(AppleHTTPContext *c)
         struct variant *var = c->variants[i];
         free_segment_list(var);
         av_free_packet(&var->pkt);
-        if (var->pb)
-            url_fclose(var->pb);
+        av_free(var->pb.buffer);
+        if (var->input)
+            ffurl_close(var->input);
         if (var->ctx) {
             var->ctx->pb = NULL;
             av_close_input_file(var->ctx);
@@ -169,7 +142,7 @@ static struct variant *new_variant(AppleHTTPContext *c, int bandwidth,
         return NULL;
     reset_packet(&var->pkt);
     var->bandwidth = bandwidth;
-    make_absolute_url(var->url, sizeof(var->url), base, url);
+    ff_make_absolute_url(var->url, sizeof(var->url), base, url);
     dynarray_add(&c->variants, &c->n_variants, var);
     return var;
 }
@@ -181,14 +154,14 @@ struct variant_info {
 static void handle_variant_args(struct variant_info *info, const char *key,
                                 int key_len, char **dest, int *dest_len)
 {
-    if (strncmp(key, "BANDWIDTH", key_len)) {
+    if (!strncmp(key, "BANDWIDTH=", key_len)) {
         *dest     =        info->bandwidth;
         *dest_len = sizeof(info->bandwidth);
     }
 }
 
 static int parse_playlist(AppleHTTPContext *c, const char *url,
-                          struct variant *var, ByteIOContext *in)
+                          struct variant *var, AVIOContext *in)
 {
     int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
     char line[1024];
@@ -197,7 +170,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
 
     if (!in) {
         close_in = 1;
-        if ((ret = url_fopen(&in, url, URL_RDONLY)) < 0)
+        if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
             return ret;
     }
 
@@ -207,10 +180,11 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
         goto fail;
     }
 
-    if (var)
+    if (var) {
         free_segment_list(var);
-    c->finished = 0;
-    while (!url_feof(in)) {
+        var->finished = 0;
+    }
+    while (!in->eof_reached) {
         read_chomp_line(in, line, sizeof(line));
         if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
             struct variant_info info = {{0}};
@@ -219,7 +193,14 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
                                &info);
             bandwidth = atoi(info.bandwidth);
         } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
-            c->target_duration = atoi(ptr);
+            if (!var) {
+                var = new_variant(c, 0, url, NULL);
+                if (!var) {
+                    ret = AVERROR(ENOMEM);
+                    goto fail;
+                }
+            }
+            var->target_duration = atoi(ptr);
         } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
             if (!var) {
                 var = new_variant(c, 0, url, NULL);
@@ -230,7 +211,8 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
             }
             var->start_seq_no = atoi(ptr);
         } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
-            c->finished = 1;
+            if (var)
+                var->finished = 1;
         } else if (av_strstart(line, "#EXTINF:", &ptr)) {
             is_segment = 1;
             duration   = atoi(ptr);
@@ -260,20 +242,86 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
                     goto fail;
                 }
                 seg->duration = duration;
-                make_absolute_url(seg->url, sizeof(seg->url), url, line);
+                ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
                 dynarray_add(&var->segments, &var->n_segments, seg);
                 is_segment = 0;
             }
         }
     }
-    c->last_load_time = av_gettime();
+    if (var)
+        var->last_load_time = av_gettime();
 
 fail:
     if (close_in)
-        url_fclose(in);
+        avio_close(in);
     return ret;
 }
 
+static int read_data(void *opaque, uint8_t *buf, int buf_size)
+{
+    struct variant *v = opaque;
+    AppleHTTPContext *c = v->parent->priv_data;
+    int ret, i;
+
+restart:
+    if (!v->input) {
+reload:
+        /* If this is a live stream and target_duration has elapsed since
+         * the last playlist reload, reload the variant playlists now. */
+        if (!v->finished &&
+            av_gettime() - v->last_load_time >= v->target_duration*1000000 &&
+            (ret = parse_playlist(c, v->url, v, NULL)) < 0)
+                return ret;
+        if (v->cur_seq_no < v->start_seq_no) {
+            av_log(NULL, AV_LOG_WARNING,
+                   "skipping %d segments ahead, expired from playlists\n",
+                   v->start_seq_no - v->cur_seq_no);
+            v->cur_seq_no = v->start_seq_no;
+        }
+        if (v->cur_seq_no >= v->start_seq_no + v->n_segments) {
+            if (v->finished)
+                return AVERROR_EOF;
+            while (av_gettime() - v->last_load_time <
+                   v->target_duration*1000000) {
+                if (url_interrupt_cb())
+                    return AVERROR_EXIT;
+                usleep(100*1000);
+            }
+            /* Enough time has elapsed since the last reload */
+            goto reload;
+        }
+
+        ret = ffurl_open(&v->input,
+                         v->segments[v->cur_seq_no - v->start_seq_no]->url,
+                         AVIO_RDONLY);
+        if (ret < 0)
+            return ret;
+    }
+    ret = ffurl_read(v->input, buf, buf_size);
+    if (ret > 0)
+        return ret;
+    if (ret < 0 && ret != AVERROR_EOF)
+        return ret;
+    ffurl_close(v->input);
+    v->input = NULL;
+    v->cur_seq_no++;
+
+    c->end_of_segment = 1;
+    c->cur_seq_no = v->cur_seq_no;
+
+    v->needed = 0;
+    for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; i++) {
+        if (v->parent->streams[i]->discard < AVDISCARD_ALL)
+            v->needed = 1;
+    }
+    if (!v->needed) {
+        av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n",
+               v->index);
+        return AVERROR_EOF;
+    }
+    goto restart;
+}
+
 static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     AppleHTTPContext *c = s->priv_data;
@@ -305,27 +353,42 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     /* If this isn't a live stream, calculate the total duration of the
      * stream. */
-    if (c->finished) {
-        int duration = 0;
+    if (c->variants[0]->finished) {
+        int64_t duration = 0;
         for (i = 0; i < c->variants[0]->n_segments; i++)
             duration += c->variants[0]->segments[i]->duration;
         s->duration = duration * AV_TIME_BASE;
     }
 
-    c->min_end_seq = INT_MAX;
     /* Open the demuxer for each variant */
     for (i = 0; i < c->n_variants; i++) {
         struct variant *v = c->variants[i];
+        AVInputFormat *in_fmt = NULL;
         if (v->n_segments == 0)
             continue;
-        c->max_start_seq = FFMAX(c->max_start_seq, v->start_seq_no);
-        c->min_end_seq   = FFMIN(c->min_end_seq,   v->start_seq_no +
-                                                   v->n_segments);
-        ret = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL);
+
+        v->index  = i;
+        v->needed = 1;
+        v->parent = s;
+
+        /* If this is a live stream with more than 3 segments, start at the
+         * third last segment. */
+        v->cur_seq_no = v->start_seq_no;
+        if (!v->finished && v->n_segments > 3)
+            v->cur_seq_no = v->start_seq_no + v->n_segments - 3;
+
+        v->read_buffer = av_malloc(INITIAL_BUFFER_SIZE);
+        ffio_init_context(&v->pb, v->read_buffer, INITIAL_BUFFER_SIZE, 0, v,
+                          read_data, NULL, NULL);
+        v->pb.seekable = 0;
+        ret = av_probe_input_buffer(&v->pb, &in_fmt, v->segments[0]->url,
+                                    NULL, 0, 0);
+        if (ret < 0)
+            goto fail;
+        ret = av_open_input_stream(&v->ctx, &v->pb, v->segments[0]->url,
+                                   in_fmt, NULL);
         if (ret < 0)
             goto fail;
-        url_fclose(v->ctx->pb);
-        v->ctx->pb = NULL;
         v->stream_offset = stream_offset;
         /* Create new AVStreams for each stream in this variant */
         for (j = 0; j < v->ctx->nb_streams; j++) {
@@ -338,13 +401,8 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
         }
         stream_offset += v->ctx->nb_streams;
     }
-    c->last_packet_dts = AV_NOPTS_VALUE;
 
-    c->cur_seq_no = c->max_start_seq;
-    /* If this is a live stream with more than 3 segments, start at the
-     * third last segment. */
-    if (!c->finished && c->min_end_seq - c->max_start_seq > 3)
-        c->cur_seq_no = c->min_end_seq - 2;
+    c->first_packet = 1;
 
     return 0;
 fail:
@@ -352,98 +410,61 @@ fail:
     return ret;
 }
 
-static int open_variant(AppleHTTPContext *c, struct variant *var, int skip)
+static int recheck_discard_flags(AVFormatContext *s, int first)
 {
-    int ret;
+    AppleHTTPContext *c = s->priv_data;
+    int i, changed = 0;
 
-    if (c->cur_seq_no < var->start_seq_no) {
-        av_log(NULL, AV_LOG_WARNING,
-               "seq %d not available in variant %s, skipping\n",
-               var->start_seq_no, var->url);
-        return 0;
+    /* Check if any new streams are needed */
+    for (i = 0; i < c->n_variants; i++)
+        c->variants[i]->cur_needed = 0;;
+
+    for (i = 0; i < s->nb_streams; i++) {
+        AVStream *st = s->streams[i];
+        struct variant *var = c->variants[s->streams[i]->id];
+        if (st->discard < AVDISCARD_ALL)
+            var->cur_needed = 1;
     }
-    if (c->cur_seq_no - var->start_seq_no >= var->n_segments)
-        return c->finished ? AVERROR_EOF : 0;
-    ret = url_fopen(&var->pb,
-                    var->segments[c->cur_seq_no - var->start_seq_no]->url,
-                    URL_RDONLY);
-    if (ret < 0)
-        return ret;
-    var->ctx->pb = var->pb;
-    /* If this is a new segment in parallel with another one already opened,
-     * skip ahead so they're all at the same dts. */
-    if (skip && c->last_packet_dts != AV_NOPTS_VALUE) {
-        while (1) {
-            ret = av_read_frame(var->ctx, &var->pkt);
-            if (ret < 0) {
-                if (ret == AVERROR_EOF) {
-                    reset_packet(&var->pkt);
-                    return 0;
-                }
-                return ret;
-            }
-            if (var->pkt.dts >= c->last_packet_dts)
-                break;
-            av_free_packet(&var->pkt);
+    for (i = 0; i < c->n_variants; i++) {
+        struct variant *v = c->variants[i];
+        if (v->cur_needed && !v->needed) {
+            v->needed = 1;
+            changed = 1;
+            v->cur_seq_no = c->cur_seq_no;
+            v->pb.eof_reached = 0;
+            av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i);
+        } else if (first && !v->cur_needed && v->needed) {
+            if (v->input)
+                ffurl_close(v->input);
+            v->input = NULL;
+            v->needed = 0;
+            changed = 1;
+            av_log(s, AV_LOG_INFO, "No longer receiving variant %d\n", i);
         }
     }
-    return 0;
+    return changed;
 }
 
 static int applehttp_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     AppleHTTPContext *c = s->priv_data;
-    int ret, i, minvariant = -1, first = 1, needed = 0, changed = 0,
-        variants = 0;
+    int ret, i, minvariant = -1;
 
-    /* Recheck the discard flags - which streams are desired at the moment */
-    for (i = 0; i < c->n_variants; i++)
-        c->variants[i]->needed = 0;
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        struct variant *var = c->variants[s->streams[i]->id];
-        if (st->discard < AVDISCARD_ALL) {
-            var->needed = 1;
-            needed++;
-        }
-        /* Copy the discard flag to the chained demuxer, to indicate which
-         * streams are desired. */
-        var->ctx->streams[i - var->stream_offset]->discard = st->discard;
+    if (c->first_packet) {
+        recheck_discard_flags(s, 1);
+        c->first_packet = 0;
     }
-    if (!needed)
-        return AVERROR_EOF;
+
 start:
+    c->end_of_segment = 0;
     for (i = 0; i < c->n_variants; i++) {
         struct variant *var = c->variants[i];
-        /* Close unneeded streams, open newly requested streams */
-        if (var->pb && !var->needed) {
-            av_log(s, AV_LOG_DEBUG,
-                   "Closing variant stream %d, no longer needed\n", i);
-            av_free_packet(&var->pkt);
-            reset_packet(&var->pkt);
-            url_fclose(var->pb);
-            var->pb = NULL;
-            changed = 1;
-        } else if (!var->pb && var->needed) {
-            if (first)
-                av_log(s, AV_LOG_DEBUG, "Opening variant stream %d\n", i);
-            if (first && !c->finished)
-                if ((ret = parse_playlist(c, var->url, var, NULL)) < 0)
-                    return ret;
-            ret = open_variant(c, var, first);
-            if (ret < 0)
-                return ret;
-            changed = 1;
-        }
-        /* Count the number of open variants */
-        if (var->pb)
-            variants++;
         /* Make sure we've got one buffered packet from each open variant
          * stream */
-        if (var->pb && !var->pkt.data) {
+        if (var->needed && !var->pkt.data) {
             ret = av_read_frame(var->ctx, &var->pkt);
             if (ret < 0) {
-                if (!url_feof(var->pb))
+                if (!var->pb.eof_reached)
                     return ret;
                 reset_packet(&var->pkt);
             }
@@ -455,70 +476,18 @@ start:
                 minvariant = i;
         }
     }
-    if (first && changed)
-        av_log(s, AV_LOG_INFO, "Receiving %d variant streams\n", variants);
+    if (c->end_of_segment) {
+        if (recheck_discard_flags(s, 0))
+            goto start;
+    }
     /* If we got a packet, return it */
     if (minvariant >= 0) {
         *pkt = c->variants[minvariant]->pkt;
         pkt->stream_index += c->variants[minvariant]->stream_offset;
         reset_packet(&c->variants[minvariant]->pkt);
-        c->last_packet_dts = pkt->dts;
         return 0;
     }
-    /* No more packets - eof reached in all variant streams, close the
-     * current segments. */
-    for (i = 0; i < c->n_variants; i++) {
-        struct variant *var = c->variants[i];
-        if (var->pb) {
-            url_fclose(var->pb);
-            var->pb = NULL;
-        }
-    }
-    /* Indicate that we're opening the next segment, not opening a new
-     * variant stream in parallel, so we shouldn't try to skip ahead. */
-    first = 0;
-    c->cur_seq_no++;
-reload:
-    if (!c->finished) {
-        /* If this is a live stream and target_duration has elapsed since
-         * the last playlist reload, reload the variant playlists now. */
-        int64_t now = av_gettime();
-        if (now - c->last_load_time >= c->target_duration*1000000) {
-            c->max_start_seq = 0;
-            c->min_end_seq   = INT_MAX;
-            for (i = 0; i < c->n_variants; i++) {
-                struct variant *var = c->variants[i];
-                if (var->needed) {
-                    if ((ret = parse_playlist(c, var->url, var, NULL)) < 0)
-                        return ret;
-                    c->max_start_seq = FFMAX(c->max_start_seq,
-                                             var->start_seq_no);
-                    c->min_end_seq   = FFMIN(c->min_end_seq,
-                                             var->start_seq_no + var->n_segments);
-                }
-            }
-        }
-    }
-    if (c->cur_seq_no < c->max_start_seq) {
-        av_log(NULL, AV_LOG_WARNING,
-               "skipping %d segments ahead, expired from playlists\n",
-               c->max_start_seq - c->cur_seq_no);
-        c->cur_seq_no = c->max_start_seq;
-    }
-    /* If more segments exit, open the next one */
-    if (c->cur_seq_no < c->min_end_seq)
-        goto start;
-    /* We've reached the end of the playlists - return eof if this is a
-     * non-live stream, wait until the next playlist reload if it is live. */
-    if (c->finished)
-        return AVERROR_EOF;
-    while (av_gettime() - c->last_load_time < c->target_duration*1000000) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        usleep(100*1000);
-    }
-    /* Enough time has elapsed since the last reload */
-    goto reload;
+    return AVERROR_EOF;
 }
 
 static int applehttp_close(AVFormatContext *s)
@@ -533,37 +502,40 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index,
                                int64_t timestamp, int flags)
 {
     AppleHTTPContext *c = s->priv_data;
-    int pos = 0, i;
-    struct variant *var = c->variants[0];
+    int i, j, ret;
 
-    if ((flags & AVSEEK_FLAG_BYTE) || !c->finished)
+    if ((flags & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished)
         return AVERROR(ENOSYS);
 
-    /* Reset the variants */
-    c->last_packet_dts = AV_NOPTS_VALUE;
+    timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ?
+                               s->streams[stream_index]->time_base.den :
+                               AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ?
+                               AV_ROUND_DOWN : AV_ROUND_UP);
+    ret = AVERROR(EIO);
     for (i = 0; i < c->n_variants; i++) {
+        /* Reset reading */
         struct variant *var = c->variants[i];
-        if (var->pb) {
-            url_fclose(var->pb);
-            var->pb = NULL;
+        int64_t pos = 0;
+        if (var->input) {
+            ffurl_close(var->input);
+            var->input = NULL;
         }
         av_free_packet(&var->pkt);
         reset_packet(&var->pkt);
-    }
-
-    timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ?
-                               s->streams[stream_index]->time_base.den :
-                               AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ?
-                               AV_ROUND_DOWN : AV_ROUND_UP);
-    /* Locate the segment that contains the target timestamp */
-    for (i = 0; i < var->n_segments; i++) {
-        if (timestamp >= pos && timestamp < pos + var->segments[i]->duration) {
-            c->cur_seq_no = var->start_seq_no + i;
-            return 0;
+        var->pb.eof_reached = 0;
+
+        /* Locate the segment that contains the target timestamp */
+        for (j = 0; j < var->n_segments; j++) {
+            if (timestamp >= pos &&
+                timestamp < pos + var->segments[j]->duration) {
+                var->cur_seq_no = var->start_seq_no + j;
+                ret = 0;
+                break;
+            }
+            pos += var->segments[j]->duration;
         }
-        pos += var->segments[i]->duration;
     }
-    return AVERROR(EIO);
+    return ret;
 }
 
 static int applehttp_probe(AVProbeData *p)
@@ -579,7 +551,7 @@ static int applehttp_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat applehttp_demuxer = {
+AVInputFormat ff_applehttp_demuxer = {
     "applehttp",
     NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming format"),
     sizeof(AppleHTTPContext),
diff --git a/ffmpeg-mt/libavformat/applehttpproto.c b/ffmpeg-mt/libavformat/applehttpproto.c
new file mode 100644
index 0000000..8842bd4
--- /dev/null
+++ b/ffmpeg-mt/libavformat/applehttpproto.c
@@ -0,0 +1,306 @@
+/*
+ * Apple HTTP Live Streaming Protocol Handler
+ * Copyright (c) 2010 Martin Storsjo
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Apple HTTP Live Streaming Protocol Handler
+ * http://tools.ietf.org/html/draft-pantos-http-live-streaming
+ */
+
+#define _XOPEN_SOURCE 600
+#include "libavutil/avstring.h"
+#include "avformat.h"
+#include "internal.h"
+#include "url.h"
+#include <unistd.h>
+
+/*
+ * An apple http stream consists of a playlist with media segment files,
+ * played sequentially. There may be several playlists with the same
+ * video content, in different bandwidth variants, that are played in
+ * parallel (preferrably only one bandwidth variant at a time). In this case,
+ * the user supplied the url to a main playlist that only lists the variant
+ * playlists.
+ *
+ * If the main playlist doesn't point at any variants, we still create
+ * one anonymous toplevel variant for this, to maintain the structure.
+ */
+
+struct segment {
+    int duration;
+    char url[MAX_URL_SIZE];
+};
+
+struct variant {
+    int bandwidth;
+    char url[MAX_URL_SIZE];
+};
+
+typedef struct AppleHTTPContext {
+    char playlisturl[MAX_URL_SIZE];
+    int target_duration;
+    int start_seq_no;
+    int finished;
+    int n_segments;
+    struct segment **segments;
+    int n_variants;
+    struct variant **variants;
+    int cur_seq_no;
+    URLContext *seg_hd;
+    int64_t last_load_time;
+} AppleHTTPContext;
+
+static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
+{
+    int len = ff_get_line(s, buf, maxlen);
+    while (len > 0 && isspace(buf[len - 1]))
+        buf[--len] = '\0';
+    return len;
+}
+
+static void free_segment_list(AppleHTTPContext *s)
+{
+    int i;
+    for (i = 0; i < s->n_segments; i++)
+        av_free(s->segments[i]);
+    av_freep(&s->segments);
+    s->n_segments = 0;
+}
+
+static void free_variant_list(AppleHTTPContext *s)
+{
+    int i;
+    for (i = 0; i < s->n_variants; i++)
+        av_free(s->variants[i]);
+    av_freep(&s->variants);
+    s->n_variants = 0;
+}
+
+struct variant_info {
+    char bandwidth[20];
+};
+
+static void handle_variant_args(struct variant_info *info, const char *key,
+                                int key_len, char **dest, int *dest_len)
+{
+    if (!strncmp(key, "BANDWIDTH=", key_len)) {
+        *dest     =        info->bandwidth;
+        *dest_len = sizeof(info->bandwidth);
+    }
+}
+
+static int parse_playlist(URLContext *h, const char *url)
+{
+    AppleHTTPContext *s = h->priv_data;
+    AVIOContext *in;
+    int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
+    char line[1024];
+    const char *ptr;
+
+    if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
+        return ret;
+
+    read_chomp_line(in, line, sizeof(line));
+    if (strcmp(line, "#EXTM3U"))
+        return AVERROR_INVALIDDATA;
+
+    free_segment_list(s);
+    s->finished = 0;
+    while (!in->eof_reached) {
+        read_chomp_line(in, line, sizeof(line));
+        if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
+            struct variant_info info = {{0}};
+            is_variant = 1;
+            ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
+                               &info);
+            bandwidth = atoi(info.bandwidth);
+        } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
+            s->target_duration = atoi(ptr);
+        } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
+            s->start_seq_no = atoi(ptr);
+        } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
+            s->finished = 1;
+        } else if (av_strstart(line, "#EXTINF:", &ptr)) {
+            is_segment = 1;
+            duration = atoi(ptr);
+        } else if (av_strstart(line, "#", NULL)) {
+            continue;
+        } else if (line[0]) {
+            if (is_segment) {
+                struct segment *seg = av_malloc(sizeof(struct segment));
+                if (!seg) {
+                    ret = AVERROR(ENOMEM);
+                    goto fail;
+                }
+                seg->duration = duration;
+                ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
+                dynarray_add(&s->segments, &s->n_segments, seg);
+                is_segment = 0;
+            } else if (is_variant) {
+                struct variant *var = av_malloc(sizeof(struct variant));
+                if (!var) {
+                    ret = AVERROR(ENOMEM);
+                    goto fail;
+                }
+                var->bandwidth = bandwidth;
+                ff_make_absolute_url(var->url, sizeof(var->url), url, line);
+                dynarray_add(&s->variants, &s->n_variants, var);
+                is_variant = 0;
+            }
+        }
+    }
+    s->last_load_time = av_gettime();
+
+fail:
+    avio_close(in);
+    return ret;
+}
+
+static int applehttp_open(URLContext *h, const char *uri, int flags)
+{
+    AppleHTTPContext *s;
+    int ret, i;
+    const char *nested_url;
+
+    if (flags & (AVIO_WRONLY | AVIO_RDWR))
+        return AVERROR(ENOSYS);
+
+    s = av_mallocz(sizeof(AppleHTTPContext));
+    if (!s)
+        return AVERROR(ENOMEM);
+    h->priv_data = s;
+    h->is_streamed = 1;
+
+    if (av_strstart(uri, "applehttp+", &nested_url)) {
+        av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl));
+    } else if (av_strstart(uri, "applehttp://", &nested_url)) {
+        av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl));
+        av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl));
+    } else {
+        av_log(NULL, AV_LOG_ERROR, "Unsupported url %s\n", uri);
+        ret = AVERROR(EINVAL);
+        goto fail;
+    }
+
+    if ((ret = parse_playlist(h, s->playlisturl)) < 0)
+        goto fail;
+
+    if (s->n_segments == 0 && s->n_variants > 0) {
+        int max_bandwidth = 0, maxvar = -1;
+        for (i = 0; i < s->n_variants; i++) {
+            if (s->variants[i]->bandwidth > max_bandwidth || i == 0) {
+                max_bandwidth = s->variants[i]->bandwidth;
+                maxvar = i;
+            }
+        }
+        av_strlcpy(s->playlisturl, s->variants[maxvar]->url,
+                   sizeof(s->playlisturl));
+        if ((ret = parse_playlist(h, s->playlisturl)) < 0)
+            goto fail;
+    }
+
+    if (s->n_segments == 0) {
+        av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
+        ret = AVERROR(EIO);
+        goto fail;
+    }
+    s->cur_seq_no = s->start_seq_no;
+    if (!s->finished && s->n_segments >= 3)
+        s->cur_seq_no = s->start_seq_no + s->n_segments - 3;
+
+    return 0;
+
+fail:
+    av_free(s);
+    return ret;
+}
+
+static int applehttp_read(URLContext *h, uint8_t *buf, int size)
+{
+    AppleHTTPContext *s = h->priv_data;
+    const char *url;
+    int ret;
+
+start:
+    if (s->seg_hd) {
+        ret = ffurl_read(s->seg_hd, buf, size);
+        if (ret > 0)
+            return ret;
+    }
+    if (s->seg_hd) {
+        ffurl_close(s->seg_hd);
+        s->seg_hd = NULL;
+        s->cur_seq_no++;
+    }
+retry:
+    if (!s->finished) {
+        int64_t now = av_gettime();
+        if (now - s->last_load_time >= s->target_duration*1000000)
+            if ((ret = parse_playlist(h, s->playlisturl)) < 0)
+                return ret;
+    }
+    if (s->cur_seq_no < s->start_seq_no) {
+        av_log(NULL, AV_LOG_WARNING,
+               "skipping %d segments ahead, expired from playlist\n",
+               s->start_seq_no - s->cur_seq_no);
+        s->cur_seq_no = s->start_seq_no;
+    }
+    if (s->cur_seq_no - s->start_seq_no >= s->n_segments) {
+        if (s->finished)
+            return AVERROR_EOF;
+        while (av_gettime() - s->last_load_time < s->target_duration*1000000) {
+            if (url_interrupt_cb())
+                return AVERROR_EXIT;
+            usleep(100*1000);
+        }
+        goto retry;
+    }
+    url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
+    av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url);
+    ret = ffurl_open(&s->seg_hd, url, AVIO_RDONLY);
+    if (ret < 0) {
+        if (url_interrupt_cb())
+            return AVERROR_EXIT;
+        av_log(NULL, AV_LOG_WARNING, "Unable to open %s\n", url);
+        s->cur_seq_no++;
+        goto retry;
+    }
+    goto start;
+}
+
+static int applehttp_close(URLContext *h)
+{
+    AppleHTTPContext *s = h->priv_data;
+
+    free_segment_list(s);
+    free_variant_list(s);
+    ffurl_close(s->seg_hd);
+    av_free(s);
+    return 0;
+}
+
+URLProtocol ff_applehttp_protocol = {
+    .name      = "applehttp",
+    .url_open  = applehttp_open,
+    .url_read  = applehttp_read,
+    .url_close = applehttp_close,
+    .flags     = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+};
diff --git a/ffmpeg-mt/libavformat/asf.c b/ffmpeg-mt/libavformat/asf.c
index 58e17e9..cc2833d 100644
--- a/ffmpeg-mt/libavformat/asf.c
+++ b/ffmpeg-mt/libavformat/asf.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -153,23 +153,8 @@ const AVMetadataConv ff_asf_metadata_conv[] = {
     { "WM/Tool"            , "encoder"     },
     { "WM/TrackNumber"     , "track"       },
     { "WM/Track"           , "track"       },
+    { "WM/MediaStationCallSign", "service_provider" },
+    { "WM/MediaStationName", "service_name" },
 //  { "Year"               , "date"        }, TODO: conversion year<->date
     { 0 }
 };
-
-int ff_put_str16_nolen(ByteIOContext *s, const char *tag)
-{
-    const uint8_t *q = tag;
-    int ret = 0;
-
-    while (*q) {
-        uint32_t ch;
-        uint16_t tmp;
-
-        GET_UTF8(ch, *q++, break;)
-        PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;)
-    }
-    put_le16(s, 0);
-    ret += 2;
-    return ret;
-}
diff --git a/ffmpeg-mt/libavformat/asf.h b/ffmpeg-mt/libavformat/asf.h
index f3705e9..b563459 100644
--- a/ffmpeg-mt/libavformat/asf.h
+++ b/ffmpeg-mt/libavformat/asf.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,64 +79,6 @@ typedef struct {
     uint16_t packet_count;
 } ASFIndex;
 
-
-typedef struct {
-    uint32_t seqno;
-    int is_streamed;
-    int asfid2avid[128];                 ///< conversion table from asf ID 2 AVStream ID
-    ASFStream streams[128];              ///< it's max number and it's not that big
-    uint32_t stream_bitrates[128];       ///< max number of streams, bitrate for each (for streaming)
-    char stream_languages[128][6];       ///< max number of streams, language for each (RFC1766, e.g. en-US)
-    /* non streamed additonnal info */
-    uint64_t nb_packets;                 ///< how many packets are there in the file, invalid if broadcasting
-    int64_t duration;                    ///< in 100ns units
-    /* packet filling */
-    unsigned char multi_payloads_present;
-    int packet_size_left;
-    int packet_timestamp_start;
-    int packet_timestamp_end;
-    unsigned int packet_nb_payloads;
-    int packet_nb_frames;
-    uint8_t packet_buf[PACKET_SIZE];
-    ByteIOContext pb;
-    /* only for reading */
-    uint64_t data_offset;                ///< beginning of the first data packet
-    uint64_t data_object_offset;         ///< data object offset (excl. GUID & size)
-    uint64_t data_object_size;           ///< size of the data object
-    int index_read;
-
-    ASFMainHeader hdr;
-
-    int packet_flags;
-    int packet_property;
-    int packet_timestamp;
-    int packet_segsizetype;
-    int packet_segments;
-    int packet_seq;
-    int packet_replic_size;
-    int packet_key_frame;
-    int packet_padsize;
-    unsigned int packet_frag_offset;
-    unsigned int packet_frag_size;
-    int64_t packet_frag_timestamp;
-    int packet_multi_size;
-    int packet_obj_size;
-    int packet_time_delta;
-    int packet_time_start;
-    int64_t packet_pos;
-
-    int stream_index;
-
-
-    int64_t last_indexed_pts;
-    ASFIndex* index_ptr;
-    uint32_t nb_index_count;
-    uint32_t nb_index_memory_alloc;
-    uint16_t maximum_packet;
-
-    ASFStream* asf_st;                   ///< currently decoded stream
-} ASFContext;
-
 extern const ff_asf_guid ff_asf_header;
 extern const ff_asf_guid ff_asf_file_header;
 extern const ff_asf_guid ff_asf_stream_header;
@@ -229,9 +171,13 @@ extern const AVMetadataConv ff_asf_metadata_conv[];
 
 #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000
 
-extern AVInputFormat asf_demuxer;
-int ff_put_str16_nolen(ByteIOContext *s, const char *tag);
-int ff_guidcmp(const void *g1, const void *g2);
-void ff_get_guid(ByteIOContext *s, ff_asf_guid *g);
+extern AVInputFormat ff_asf_demuxer;
+
+static av_always_inline int ff_guidcmp(const void *g1, const void *g2)
+{
+    return memcmp(g1, g2, sizeof(ff_asf_guid));
+}
+
+void ff_get_guid(AVIOContext *s, ff_asf_guid *g);
 
 #endif /* AVFORMAT_ASF_H */
diff --git a/ffmpeg-mt/libavformat/asfcrypt.c b/ffmpeg-mt/libavformat/asfcrypt.c
index 59986e0..52cfc17 100644
--- a/ffmpeg-mt/libavformat/asfcrypt.c
+++ b/ffmpeg-mt/libavformat/asfcrypt.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Reimar Doeffinger
  * This is a rewrite of code contained in freeme/freeme2
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/asfcrypt.h b/ffmpeg-mt/libavformat/asfcrypt.h
index 8b80d63..53388b4 100644
--- a/ffmpeg-mt/libavformat/asfcrypt.h
+++ b/ffmpeg-mt/libavformat/asfcrypt.h
@@ -2,20 +2,20 @@
  * ASF decryption
  * Copyright (c) 2007 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/asfdec.c b/ffmpeg-mt/libavformat/asfdec.c
index 6ae4e99..20b4987 100644
--- a/ffmpeg-mt/libavformat/asfdec.c
+++ b/ffmpeg-mt/libavformat/asfdec.c
@@ -2,20 +2,20 @@
  * ASF compatible demuxer
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,12 +25,51 @@
 #include "libavutil/avstring.h"
 #include "libavcodec/mpegaudio.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "riff.h"
 #include "asf.h"
 #include "asfcrypt.h"
 #include "avlanguage.h"
 
-void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format);
+typedef struct {
+    int asfid2avid[128];                 ///< conversion table from asf ID 2 AVStream ID
+    ASFStream streams[128];              ///< it's max number and it's not that big
+    uint32_t stream_bitrates[128];       ///< max number of streams, bitrate for each (for streaming)
+    AVRational dar[128];
+    char stream_languages[128][6];       ///< max number of streams, language for each (RFC1766, e.g. en-US)
+    /* non streamed additonnal info */
+    /* packet filling */
+    int packet_size_left;
+    /* only for reading */
+    uint64_t data_offset;                ///< beginning of the first data packet
+    uint64_t data_object_offset;         ///< data object offset (excl. GUID & size)
+    uint64_t data_object_size;           ///< size of the data object
+    int index_read;
+
+    ASFMainHeader hdr;
+
+    int packet_flags;
+    int packet_property;
+    int packet_timestamp;
+    int packet_segsizetype;
+    int packet_segments;
+    int packet_seq;
+    int packet_replic_size;
+    int packet_key_frame;
+    int packet_padsize;
+    unsigned int packet_frag_offset;
+    unsigned int packet_frag_size;
+    int64_t packet_frag_timestamp;
+    int packet_multi_size;
+    int packet_obj_size;
+    int packet_time_delta;
+    int packet_time_start;
+    int64_t packet_pos;
+
+    int stream_index;
+
+    ASFStream* asf_st;                   ///< currently decoded stream
+} ASFContext;
 
 #undef NDEBUG
 #include <assert.h>
@@ -49,15 +88,10 @@ static const ff_asf_guid stream_bitrate_guid = { /* (http://get.to/sdp) */
 /**********************************/
 /* decoding */
 
-int ff_guidcmp(const void *g1, const void *g2)
-{
-    return memcmp(g1, g2, sizeof(ff_asf_guid));
-}
-
 #ifdef DEBUG
 #define PRINT_IF_GUID(g,cmp) \
 if (!ff_guidcmp(g, &cmp)) \
-    dprintf(NULL, "(GUID: %s) ", #cmp)
+    av_dlog(NULL, "(GUID: %s) ", #cmp)
 
 static void print_guid(const ff_asf_guid *g)
 {
@@ -87,53 +121,20 @@ static void print_guid(const ff_asf_guid *g)
     else PRINT_IF_GUID(g, stream_bitrate_guid);
     else PRINT_IF_GUID(g, ff_asf_language_guid);
     else
-        dprintf(NULL, "(GUID: unknown) ");
+        av_dlog(NULL, "(GUID: unknown) ");
     for(i=0;i<16;i++)
-        dprintf(NULL, " 0x%02x,", (*g)[i]);
-    dprintf(NULL, "}\n");
+        av_dlog(NULL, " 0x%02x,", (*g)[i]);
+    av_dlog(NULL, "}\n");
 }
 #undef PRINT_IF_GUID
 #else
 #define print_guid(g)
 #endif
 
-void ff_get_guid(ByteIOContext *s, ff_asf_guid *g)
+void ff_get_guid(AVIOContext *s, ff_asf_guid *g)
 {
     assert(sizeof(*g) == 16);
-    get_buffer(s, *g, sizeof(*g));
-}
-
-#if 0
-static void get_str16(ByteIOContext *pb, char *buf, int buf_size)
-{
-    int len, c;
-    char *q;
-
-    len = get_le16(pb);
-    q = buf;
-    while (len > 0) {
-        c = get_le16(pb);
-        if ((q - buf) < buf_size - 1)
-            *q++ = c;
-        len--;
-    }
-    *q = '\0';
-}
-#endif
-
-static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size)
-{
-    char* q = buf;
-    while (len > 1) {
-        uint8_t tmp;
-        uint32_t ch;
-
-        GET_UTF16(ch, (len -= 2) >= 0 ? get_le16(pb) : 0, break;)
-        PUT_UTF8(ch, tmp, if (q - buf < buf_size - 1) *q++ = tmp;)
-    }
-    if (len > 0)
-        url_fskip(pb, len);
-    *q = '\0';
+    avio_read(s, *g, sizeof(*g));
 }
 
 static int asf_probe(AVProbeData *pd)
@@ -145,12 +146,12 @@ static int asf_probe(AVProbeData *pd)
         return 0;
 }
 
-static int get_value(ByteIOContext *pb, int type){
+static int get_value(AVIOContext *pb, int type){
     switch(type){
-        case 2: return get_le32(pb);
-        case 3: return get_le32(pb);
-        case 4: return get_le64(pb);
-        case 5: return get_le16(pb);
+        case 2: return avio_rl32(pb);
+        case 3: return avio_rl32(pb);
+        case 4: return avio_rl64(pb);
+        case 5: return avio_rl16(pb);
         default:return INT_MIN;
     }
 }
@@ -158,61 +159,450 @@ static int get_value(ByteIOContext *pb, int type){
 static void get_tag(AVFormatContext *s, const char *key, int type, int len)
 {
     char *value;
+    int64_t off = avio_tell(s->pb);
 
     if ((unsigned)len >= (UINT_MAX - 1)/2)
         return;
 
     value = av_malloc(2*len+1);
     if (!value)
-        return;
+        goto finish;
 
     if (type == 0) {         // UTF16-LE
-        get_str16_nolen(s->pb, len, value, 2*len + 1);
+        avio_get_str16le(s->pb, len, value, 2*len + 1);
     } else if (type > 1 && type <= 5) {  // boolean or DWORD or QWORD or WORD
         uint64_t num = get_value(s->pb, type);
         snprintf(value, len, "%"PRIu64, num);
     } else {
-        url_fskip(s->pb, len);
-        av_freep(&value);
         av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key);
-        return;
+        goto finish;
     }
-    av_metadata_set2(&s->metadata, key, value, 0);
+    if (*value)
+        av_metadata_set2(&s->metadata, key, value, 0);
+finish:
     av_freep(&value);
+    avio_seek(s->pb, off + len, SEEK_SET);
 }
 
-static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int asf_read_file_properties(AVFormatContext *s, int64_t size)
 {
     ASFContext *asf = s->priv_data;
-    ff_asf_guid g;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
+
+    ff_get_guid(pb, &asf->hdr.guid);
+    asf->hdr.file_size          = avio_rl64(pb);
+    asf->hdr.create_time        = avio_rl64(pb);
+    avio_rl64(pb);                               /* number of packets */
+    asf->hdr.play_time          = avio_rl64(pb);
+    asf->hdr.send_time          = avio_rl64(pb);
+    asf->hdr.preroll            = avio_rl32(pb);
+    asf->hdr.ignore             = avio_rl32(pb);
+    asf->hdr.flags              = avio_rl32(pb);
+    asf->hdr.min_pktsize        = avio_rl32(pb);
+    asf->hdr.max_pktsize        = avio_rl32(pb);
+    asf->hdr.max_bitrate        = avio_rl32(pb);
+    s->packet_size = asf->hdr.max_pktsize;
+
+    return 0;
+}
+
+static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
+{
+    ASFContext *asf = s->priv_data;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     ASFStream *asf_st;
-    int size, i;
-    int64_t gsize;
-    AVRational dar[128];
-    uint32_t bitrate[128];
+    ff_asf_guid g;
+    enum AVMediaType type;
+    int type_specific_size, sizeX;
+    uint64_t total_size;
+    unsigned int tag1;
+    int64_t pos1, pos2, start_time;
+    int test_for_ext_stream_audio, is_dvr_ms_audio=0;
+
+    if (s->nb_streams == ASF_MAX_STREAMS) {
+        av_log(s, AV_LOG_ERROR, "too many streams\n");
+        return AVERROR(EINVAL);
+    }
+
+    pos1 = avio_tell(pb);
+
+    st = av_new_stream(s, 0);
+    if (!st)
+        return AVERROR(ENOMEM);
+    av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+    asf_st = av_mallocz(sizeof(ASFStream));
+    if (!asf_st)
+        return AVERROR(ENOMEM);
+    st->priv_data = asf_st;
+    st->start_time = 0;
+    start_time = asf->hdr.preroll;
+
+    asf_st->stream_language_index = 128; // invalid stream index means no language info
 
-    memset(dar, 0, sizeof(dar));
-    memset(bitrate, 0, sizeof(bitrate));
+    if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming...
+        st->duration = asf->hdr.play_time /
+            (10000000 / 1000) - start_time;
+    }
+    ff_get_guid(pb, &g);
+
+    test_for_ext_stream_audio = 0;
+    if (!ff_guidcmp(&g, &ff_asf_audio_stream)) {
+        type = AVMEDIA_TYPE_AUDIO;
+    } else if (!ff_guidcmp(&g, &ff_asf_video_stream)) {
+        type = AVMEDIA_TYPE_VIDEO;
+    } else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) {
+        type = AVMEDIA_TYPE_VIDEO;
+        st->codec->codec_id = CODEC_ID_MJPEG;
+    } else if (!ff_guidcmp(&g, &ff_asf_command_stream)) {
+        type = AVMEDIA_TYPE_DATA;
+    } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) {
+        test_for_ext_stream_audio = 1;
+        type = AVMEDIA_TYPE_UNKNOWN;
+    } else {
+        return -1;
+    }
+    ff_get_guid(pb, &g);
+    total_size = avio_rl64(pb);
+    type_specific_size = avio_rl32(pb);
+    avio_rl32(pb);
+    st->id = avio_rl16(pb) & 0x7f; /* stream id */
+    // mapping of asf ID to AV stream ID;
+    asf->asfid2avid[st->id] = s->nb_streams - 1;
+
+    avio_rl32(pb);
+
+    if (test_for_ext_stream_audio) {
+        ff_get_guid(pb, &g);
+        if (!ff_guidcmp(&g, &ff_asf_ext_stream_audio_stream)) {
+            type = AVMEDIA_TYPE_AUDIO;
+            is_dvr_ms_audio=1;
+            ff_get_guid(pb, &g);
+            avio_rl32(pb);
+            avio_rl32(pb);
+            avio_rl32(pb);
+            ff_get_guid(pb, &g);
+            avio_rl32(pb);
+        }
+    }
+
+    st->codec->codec_type = type;
+    if (type == AVMEDIA_TYPE_AUDIO) {
+        ff_get_wav_header(pb, st->codec, type_specific_size);
+        if (is_dvr_ms_audio) {
+            // codec_id and codec_tag are unreliable in dvr_ms
+            // files. Set them later by probing stream.
+            st->codec->codec_id = CODEC_ID_PROBE;
+            st->codec->codec_tag = 0;
+        }
+        if (st->codec->codec_id == CODEC_ID_AAC) {
+            st->need_parsing = AVSTREAM_PARSE_NONE;
+        } else {
+            st->need_parsing = AVSTREAM_PARSE_FULL;
+        }
+        /* We have to init the frame size at some point .... */
+        pos2 = avio_tell(pb);
+        if (size >= (pos2 + 8 - pos1 + 24)) {
+            asf_st->ds_span = avio_r8(pb);
+            asf_st->ds_packet_size = avio_rl16(pb);
+            asf_st->ds_chunk_size = avio_rl16(pb);
+            avio_rl16(pb); //ds_data_size
+            avio_r8(pb);   //ds_silence_data
+        }
+        //printf("Descrambling: ps:%d cs:%d ds:%d s:%d  sd:%d\n",
+        //       asf_st->ds_packet_size, asf_st->ds_chunk_size,
+        //       asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data);
+        if (asf_st->ds_span > 1) {
+            if (!asf_st->ds_chunk_size
+                    || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)
+                    || asf_st->ds_packet_size % asf_st->ds_chunk_size)
+                asf_st->ds_span = 0; // disable descrambling
+        }
+        switch (st->codec->codec_id) {
+            case CODEC_ID_MP3:
+                st->codec->frame_size = MPA_FRAME_SIZE;
+                break;
+            case CODEC_ID_PCM_S16LE:
+            case CODEC_ID_PCM_S16BE:
+            case CODEC_ID_PCM_U16LE:
+            case CODEC_ID_PCM_U16BE:
+            case CODEC_ID_PCM_S8:
+            case CODEC_ID_PCM_U8:
+            case CODEC_ID_PCM_ALAW:
+            case CODEC_ID_PCM_MULAW:
+                st->codec->frame_size = 1;
+                break;
+            default:
+                /* This is probably wrong, but it prevents a crash later */
+                st->codec->frame_size = 1;
+                break;
+        }
+    } else if (type == AVMEDIA_TYPE_VIDEO &&
+            size - (avio_tell(pb) - pos1 + 24) >= 51) {
+        avio_rl32(pb);
+        avio_rl32(pb);
+        avio_r8(pb);
+        avio_rl16(pb);        /* size */
+        sizeX= avio_rl32(pb); /* size */
+        st->codec->width = avio_rl32(pb);
+        st->codec->height = avio_rl32(pb);
+        /* not available for asf */
+        avio_rl16(pb); /* panes */
+        st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
+        tag1 = avio_rl32(pb);
+        avio_skip(pb, 20);
+        //                av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
+        if (sizeX > 40) {
+            st->codec->extradata_size = sizeX - 40;
+            st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+            avio_read(pb, st->codec->extradata, st->codec->extradata_size);
+        }
+
+        /* Extract palette from extradata if bpp <= 8 */
+        /* This code assumes that extradata contains only palette */
+        /* This is true for all paletted codecs implemented in ffmpeg */
+        if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
+            int av_unused i;
+            st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
+#if HAVE_BIGENDIAN
+            for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
+                st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
+#else
+            memcpy(st->codec->palctrl->palette, st->codec->extradata,
+                    FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
+#endif
+            st->codec->palctrl->palette_changed = 1;
+        }
+
+        st->codec->codec_tag = tag1;
+        st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1);
+        if(tag1 == MKTAG('D', 'V', 'R', ' ')){
+            st->need_parsing = AVSTREAM_PARSE_FULL;
+            // issue658 containse wrong w/h and MS even puts a fake seq header with wrong w/h in extradata while a correct one is in te stream. maximum lameness
+            st->codec->width  =
+                st->codec->height = 0;
+            av_freep(&st->codec->extradata);
+            st->codec->extradata_size=0;
+        }
+        if(st->codec->codec_id == CODEC_ID_H264)
+            st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
+    }
+    pos2 = avio_tell(pb);
+    avio_skip(pb, size - (pos2 - pos1 + 24));
+
+    return 0;
+}
+
+static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
+{
+    ASFContext *asf = s->priv_data;
+    AVIOContext *pb = s->pb;
+    ff_asf_guid g;
+    int ext_len, payload_ext_ct, stream_ct, i;
+    uint32_t ext_d, leak_rate, stream_num;
+    unsigned int stream_languageid_index;
+
+    avio_rl64(pb); // starttime
+    avio_rl64(pb); // endtime
+    leak_rate = avio_rl32(pb); // leak-datarate
+    avio_rl32(pb); // bucket-datasize
+    avio_rl32(pb); // init-bucket-fullness
+    avio_rl32(pb); // alt-leak-datarate
+    avio_rl32(pb); // alt-bucket-datasize
+    avio_rl32(pb); // alt-init-bucket-fullness
+    avio_rl32(pb); // max-object-size
+    avio_rl32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
+    stream_num = avio_rl16(pb); // stream-num
+
+    stream_languageid_index = avio_rl16(pb); // stream-language-id-index
+    if (stream_num < 128)
+        asf->streams[stream_num].stream_language_index = stream_languageid_index;
+
+    avio_rl64(pb); // avg frametime in 100ns units
+    stream_ct = avio_rl16(pb); //stream-name-count
+    payload_ext_ct = avio_rl16(pb); //payload-extension-system-count
+
+    if (stream_num < 128)
+        asf->stream_bitrates[stream_num] = leak_rate;
+
+    for (i=0; i<stream_ct; i++){
+        avio_rl16(pb);
+        ext_len = avio_rl16(pb);
+        avio_skip(pb, ext_len);
+    }
+
+    for (i=0; i<payload_ext_ct; i++){
+        ff_get_guid(pb, &g);
+        ext_d=avio_rl16(pb);
+        ext_len=avio_rl32(pb);
+        avio_skip(pb, ext_len);
+    }
+
+    return 0;
+}
+
+static int asf_read_content_desc(AVFormatContext *s, int64_t size)
+{
+    AVIOContext *pb = s->pb;
+    int len1, len2, len3, len4, len5;
+
+    len1 = avio_rl16(pb);
+    len2 = avio_rl16(pb);
+    len3 = avio_rl16(pb);
+    len4 = avio_rl16(pb);
+    len5 = avio_rl16(pb);
+    get_tag(s, "title"    , 0, len1);
+    get_tag(s, "author"   , 0, len2);
+    get_tag(s, "copyright", 0, len3);
+    get_tag(s, "comment"  , 0, len4);
+    avio_skip(pb, len5);
+
+    return 0;
+}
+
+static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size)
+{
+    AVIOContext *pb = s->pb;
+    ASFContext *asf = s->priv_data;
+    int desc_count, i, ret;
+
+    desc_count = avio_rl16(pb);
+    for(i=0;i<desc_count;i++) {
+        int name_len,value_type,value_len;
+        char name[1024];
+
+        name_len = avio_rl16(pb);
+        if (name_len%2)     // must be even, broken lavf versions wrote len-1
+            name_len += 1;
+        if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
+            avio_skip(pb, name_len - ret);
+        value_type = avio_rl16(pb);
+        value_len  = avio_rl16(pb);
+        if (!value_type && value_len%2)
+            value_len += 1;
+        /**
+         * My sample has that stream set to 0 maybe that mean the container.
+         * Asf stream count start at 1. I am using 0 to the container value since it's unused
+         */
+        if (!strcmp(name, "AspectRatioX")){
+            asf->dar[0].num= get_value(s->pb, value_type);
+        } else if(!strcmp(name, "AspectRatioY")){
+            asf->dar[0].den= get_value(s->pb, value_type);
+        } else
+            get_tag(s, name, value_type, value_len);
+    }
+
+    return 0;
+}
+
+static int asf_read_language_list(AVFormatContext *s, int64_t size)
+{
+    AVIOContext *pb = s->pb;
+    ASFContext *asf = s->priv_data;
+    int j, ret;
+    int stream_count = avio_rl16(pb);
+    for(j = 0; j < stream_count; j++) {
+        char lang[6];
+        unsigned int lang_len = avio_r8(pb);
+        if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len)
+            avio_skip(pb, lang_len - ret);
+        if (j < 128)
+            av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages));
+    }
+
+    return 0;
+}
+
+static int asf_read_metadata(AVFormatContext *s, int64_t size)
+{
+    AVIOContext *pb = s->pb;
+    ASFContext *asf = s->priv_data;
+    int n, stream_num, name_len, value_len, value_type, value_num;
+    int ret, i;
+    n = avio_rl16(pb);
+
+    for(i=0;i<n;i++) {
+        char name[1024];
+
+        avio_rl16(pb); //lang_list_index
+        stream_num= avio_rl16(pb);
+        name_len=   avio_rl16(pb);
+        value_type= avio_rl16(pb);
+        value_len=  avio_rl32(pb);
+
+        if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
+            avio_skip(pb, name_len - ret);
+        //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
+        value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
+        avio_skip(pb, value_len - 2);
+
+        if(stream_num<128){
+            if     (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num;
+            else if(!strcmp(name, "AspectRatioY")) asf->dar[stream_num].den= value_num;
+        }
+    }
+
+    return 0;
+}
+
+static int asf_read_marker(AVFormatContext *s, int64_t size)
+{
+    AVIOContext *pb = s->pb;
+    int i, count, name_len, ret;
+    char name[1024];
+
+    avio_rl64(pb);            // reserved 16 bytes
+    avio_rl64(pb);            // ...
+    count = avio_rl32(pb);    // markers count
+    avio_rl16(pb);            // reserved 2 bytes
+    name_len = avio_rl16(pb); // name length
+    for(i=0;i<name_len;i++){
+        avio_r8(pb); // skip the name
+    }
+
+    for(i=0;i<count;i++){
+        int64_t pres_time;
+        int name_len;
+
+        avio_rl64(pb);             // offset, 8 bytes
+        pres_time = avio_rl64(pb); // presentation time
+        avio_rl16(pb);             // entry length
+        avio_rl32(pb);             // send time
+        avio_rl32(pb);             // flags
+        name_len = avio_rl32(pb);  // name length
+        if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)
+            avio_skip(pb, name_len - ret);
+        ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
+    }
+
+    return 0;
+}
+
+static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
+{
+    ASFContext *asf = s->priv_data;
+    ff_asf_guid g;
+    AVIOContext *pb = s->pb;
+    int i;
+    int64_t gsize;
 
     ff_get_guid(pb, &g);
     if (ff_guidcmp(&g, &ff_asf_header))
         return -1;
-    get_le64(pb);
-    get_le32(pb);
-    get_byte(pb);
-    get_byte(pb);
+    avio_rl64(pb);
+    avio_rl32(pb);
+    avio_r8(pb);
+    avio_r8(pb);
     memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
     for(;;) {
-        uint64_t gpos= url_ftell(pb);
+        uint64_t gpos= avio_tell(pb);
         ff_get_guid(pb, &g);
-        gsize = get_le64(pb);
-        dprintf(s, "%08"PRIx64": ", gpos);
+        gsize = avio_rl64(pb);
+        av_dlog(s, "%08"PRIx64": ", gpos);
         print_guid(&g);
-        dprintf(s, "  size=0x%"PRIx64"\n", gsize);
+        av_dlog(s, "  size=0x%"PRIx64"\n", gsize);
         if (!ff_guidcmp(&g, &ff_asf_data_header)) {
-            asf->data_object_offset = url_ftell(pb);
+            asf->data_object_offset = avio_tell(pb);
             // if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
             if (!(asf->hdr.flags & 0x01) && gsize >= 100) {
                 asf->data_object_size = gsize - 24;
@@ -224,323 +614,19 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
         if (gsize < 24)
             return -1;
         if (!ff_guidcmp(&g, &ff_asf_file_header)) {
-            ff_get_guid(pb, &asf->hdr.guid);
-            asf->hdr.file_size          = get_le64(pb);
-            asf->hdr.create_time        = get_le64(pb);
-            asf->nb_packets             = get_le64(pb);
-            asf->hdr.play_time          = get_le64(pb);
-            asf->hdr.send_time          = get_le64(pb);
-            asf->hdr.preroll            = get_le32(pb);
-            asf->hdr.ignore             = get_le32(pb);
-            asf->hdr.flags              = get_le32(pb);
-            asf->hdr.min_pktsize        = get_le32(pb);
-            asf->hdr.max_pktsize        = get_le32(pb);
-            asf->hdr.max_bitrate        = get_le32(pb);
-            s->packet_size = asf->hdr.max_pktsize;
+            asf_read_file_properties(s, gsize);
         } else if (!ff_guidcmp(&g, &ff_asf_stream_header)) {
-            enum AVMediaType type;
-            int type_specific_size, sizeX;
-            uint64_t total_size;
-            unsigned int tag1;
-            int64_t pos1, pos2, start_time;
-            int test_for_ext_stream_audio, is_dvr_ms_audio=0;
-
-            if (s->nb_streams == ASF_MAX_STREAMS) {
-                av_log(s, AV_LOG_ERROR, "too many streams\n");
-                return AVERROR(EINVAL);
-            }
-
-            pos1 = url_ftell(pb);
-
-            st = av_new_stream(s, 0);
-            if (!st)
-                return AVERROR(ENOMEM);
-            av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
-            asf_st = av_mallocz(sizeof(ASFStream));
-            if (!asf_st)
-                return AVERROR(ENOMEM);
-            st->priv_data = asf_st;
-            start_time = asf->hdr.preroll;
-
-            asf_st->stream_language_index = 128; // invalid stream index means no language info
-
-            if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming...
-                st->duration = asf->hdr.play_time /
-                    (10000000 / 1000) - start_time;
-            }
-            ff_get_guid(pb, &g);
-
-            test_for_ext_stream_audio = 0;
-            if (!ff_guidcmp(&g, &ff_asf_audio_stream)) {
-                type = AVMEDIA_TYPE_AUDIO;
-            } else if (!ff_guidcmp(&g, &ff_asf_video_stream)) {
-                type = AVMEDIA_TYPE_VIDEO;
-            } else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) {
-                type = AVMEDIA_TYPE_VIDEO;
-                st->codec->codec_id = CODEC_ID_MJPEG;
-            } else if (!ff_guidcmp(&g, &ff_asf_command_stream)) {
-                type = AVMEDIA_TYPE_DATA;
-            } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) {
-                test_for_ext_stream_audio = 1;
-                type = AVMEDIA_TYPE_UNKNOWN;
-            } else {
-                return -1;
-            }
-            ff_get_guid(pb, &g);
-            total_size = get_le64(pb);
-            type_specific_size = get_le32(pb);
-            get_le32(pb);
-            st->id = get_le16(pb) & 0x7f; /* stream id */
-            // mapping of asf ID to AV stream ID;
-            asf->asfid2avid[st->id] = s->nb_streams - 1;
-
-            get_le32(pb);
-
-            if (test_for_ext_stream_audio) {
-                ff_get_guid(pb, &g);
-                if (!ff_guidcmp(&g, &ff_asf_ext_stream_audio_stream)) {
-                    type = AVMEDIA_TYPE_AUDIO;
-                    is_dvr_ms_audio=1;
-                    ff_get_guid(pb, &g);
-                    get_le32(pb);
-                    get_le32(pb);
-                    get_le32(pb);
-                    ff_get_guid(pb, &g);
-                    get_le32(pb);
-                }
-            }
-
-            st->codec->codec_type = type;
-            if (type == AVMEDIA_TYPE_AUDIO) {
-                ff_get_wav_header(pb, st->codec, type_specific_size);
-                if (is_dvr_ms_audio) {
-                    // codec_id and codec_tag are unreliable in dvr_ms
-                    // files. Set them later by probing stream.
-                    st->codec->codec_id = CODEC_ID_PROBE;
-                    st->codec->codec_tag = 0;
-                }
-                if (st->codec->codec_id == CODEC_ID_AAC) {
-                    st->need_parsing = AVSTREAM_PARSE_NONE;
-                } else {
-                    st->need_parsing = AVSTREAM_PARSE_FULL;
-                }
-                /* We have to init the frame size at some point .... */
-                pos2 = url_ftell(pb);
-                if (gsize >= (pos2 + 8 - pos1 + 24)) {
-                    asf_st->ds_span = get_byte(pb);
-                    asf_st->ds_packet_size = get_le16(pb);
-                    asf_st->ds_chunk_size = get_le16(pb);
-                    get_le16(pb); //ds_data_size
-                    get_byte(pb); //ds_silence_data
-                }
-                //printf("Descrambling: ps:%d cs:%d ds:%d s:%d  sd:%d\n",
-                //       asf_st->ds_packet_size, asf_st->ds_chunk_size,
-                //       asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data);
-                if (asf_st->ds_span > 1) {
-                    if (!asf_st->ds_chunk_size
-                        || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)
-                        || asf_st->ds_packet_size % asf_st->ds_chunk_size)
-                        asf_st->ds_span = 0; // disable descrambling
-                }
-                switch (st->codec->codec_id) {
-                case CODEC_ID_MP3:
-                    st->codec->frame_size = MPA_FRAME_SIZE;
-                    break;
-                case CODEC_ID_PCM_S16LE:
-                case CODEC_ID_PCM_S16BE:
-                case CODEC_ID_PCM_U16LE:
-                case CODEC_ID_PCM_U16BE:
-                case CODEC_ID_PCM_S8:
-                case CODEC_ID_PCM_U8:
-                case CODEC_ID_PCM_ALAW:
-                case CODEC_ID_PCM_MULAW:
-                    st->codec->frame_size = 1;
-                    break;
-                default:
-                    /* This is probably wrong, but it prevents a crash later */
-                    st->codec->frame_size = 1;
-                    break;
-                }
-            } else if (type == AVMEDIA_TYPE_VIDEO &&
-                       gsize - (url_ftell(pb) - pos1 + 24) >= 51) {
-                get_le32(pb);
-                get_le32(pb);
-                get_byte(pb);
-                size = get_le16(pb); /* size */
-                sizeX= get_le32(pb); /* size */
-                st->codec->width = get_le32(pb);
-                st->codec->height = get_le32(pb);
-                /* not available for asf */
-                get_le16(pb); /* panes */
-                st->codec->bits_per_coded_sample = get_le16(pb); /* depth */
-                tag1 = get_le32(pb);
-                url_fskip(pb, 20);
-//                av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
-                size= sizeX;
-                if (size > 40) {
-                    st->codec->extradata_size = size - 40;
-                    st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                    get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
-                }
-
-                /* Extract palette from extradata if bpp <= 8 */
-                /* This code assumes that extradata contains only palette */
-                /* This is true for all paletted codecs implemented in ffmpeg */
-                if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
-                    st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
-#if HAVE_BIGENDIAN
-                    for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
-                        st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
-#else
-                    memcpy(st->codec->palctrl->palette, st->codec->extradata,
-                           FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
-#endif
-                    st->codec->palctrl->palette_changed = 1;
-                }
-
-                st->codec->codec_tag = tag1;
-                st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1);
-                if(tag1 == MKTAG('D', 'V', 'R', ' ')){
-                    st->need_parsing = AVSTREAM_PARSE_FULL;
-                    // issue658 containse wrong w/h and MS even puts a fake seq header with wrong w/h in extradata while a correct one is in te stream. maximum lameness
-                    st->codec->width  =
-                    st->codec->height = 0;
-                    av_freep(&st->codec->extradata);
-                    st->codec->extradata_size=0;
-                }
-                if(st->codec->codec_id == CODEC_ID_H264)
-                    st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
-            }
-            pos2 = url_ftell(pb);
-            url_fskip(pb, gsize - (pos2 - pos1 + 24));
+            asf_read_stream_properties(s, gsize);
         } else if (!ff_guidcmp(&g, &ff_asf_comment_header)) {
-            int len1, len2, len3, len4, len5;
-
-            len1 = get_le16(pb);
-            len2 = get_le16(pb);
-            len3 = get_le16(pb);
-            len4 = get_le16(pb);
-            len5 = get_le16(pb);
-            get_tag(s, "title"    , 0, len1);
-            get_tag(s, "author"   , 0, len2);
-            get_tag(s, "copyright", 0, len3);
-            get_tag(s, "comment"  , 0, len4);
-            url_fskip(pb, len5);
-        } else if (!ff_guidcmp(&g, &stream_bitrate_guid)) {
-            int stream_count = get_le16(pb);
-            int j;
-
-//            av_log(s, AV_LOG_ERROR, "stream bitrate properties\n");
-//            av_log(s, AV_LOG_ERROR, "streams %d\n", streams);
-            for(j = 0; j < stream_count; j++) {
-                int flags, bitrate, stream_id;
-
-                flags= get_le16(pb);
-                bitrate= get_le32(pb);
-                stream_id= (flags & 0x7f);
-//                av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate);
-                asf->stream_bitrates[stream_id]= bitrate;
-            }
+            asf_read_content_desc(s, gsize);
         } else if (!ff_guidcmp(&g, &ff_asf_language_guid)) {
-            int j;
-            int stream_count = get_le16(pb);
-            for(j = 0; j < stream_count; j++) {
-                char lang[6];
-                unsigned int lang_len = get_byte(pb);
-                get_str16_nolen(pb, lang_len, lang, sizeof(lang));
-                if (j < 128)
-                    av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages));
-            }
+            asf_read_language_list(s, gsize);
         } else if (!ff_guidcmp(&g, &ff_asf_extended_content_header)) {
-            int desc_count, i;
-
-            desc_count = get_le16(pb);
-            for(i=0;i<desc_count;i++) {
-                    int name_len,value_type,value_len;
-                    char name[1024];
-
-                    name_len = get_le16(pb);
-                    if (name_len%2)     // must be even, broken lavf versions wrote len-1
-                        name_len += 1;
-                    get_str16_nolen(pb, name_len, name, sizeof(name));
-                    value_type = get_le16(pb);
-                    value_len  = get_le16(pb);
-                    if (!value_type && value_len%2)
-                        value_len += 1;
-                    /**
-                     * My sample has that stream set to 0 maybe that mean the container.
-                     * Asf stream count start at 1. I am using 0 to the container value since it's unused
-                     */
-                    if (!strcmp(name, "AspectRatioX")){
-                        dar[0].num= get_value(s->pb, value_type);
-                    } else if(!strcmp(name, "AspectRatioY")){
-                        dar[0].den= get_value(s->pb, value_type);
-                    } else
-                        get_tag(s, name, value_type, value_len);
-            }
+            asf_read_ext_content_desc(s, gsize);
         } else if (!ff_guidcmp(&g, &ff_asf_metadata_header)) {
-            int n, stream_num, name_len, value_len, value_type, value_num;
-            n = get_le16(pb);
-
-            for(i=0;i<n;i++) {
-                char name[1024];
-
-                get_le16(pb); //lang_list_index
-                stream_num= get_le16(pb);
-                name_len=   get_le16(pb);
-                value_type= get_le16(pb);
-                value_len=  get_le32(pb);
-
-                get_str16_nolen(pb, name_len, name, sizeof(name));
-//av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
-                value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
-                url_fskip(pb, value_len - 2);
-
-                if(stream_num<128){
-                    if     (!strcmp(name, "AspectRatioX")) dar[stream_num].num= value_num;
-                    else if(!strcmp(name, "AspectRatioY")) dar[stream_num].den= value_num;
-                }
-            }
+            asf_read_metadata(s, gsize);
         } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_header)) {
-            int ext_len, payload_ext_ct, stream_ct;
-            uint32_t ext_d, leak_rate, stream_num;
-            unsigned int stream_languageid_index;
-
-            get_le64(pb); // starttime
-            get_le64(pb); // endtime
-            leak_rate = get_le32(pb); // leak-datarate
-            get_le32(pb); // bucket-datasize
-            get_le32(pb); // init-bucket-fullness
-            get_le32(pb); // alt-leak-datarate
-            get_le32(pb); // alt-bucket-datasize
-            get_le32(pb); // alt-init-bucket-fullness
-            get_le32(pb); // max-object-size
-            get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
-            stream_num = get_le16(pb); // stream-num
-
-            stream_languageid_index = get_le16(pb); // stream-language-id-index
-            if (stream_num < 128)
-                asf->streams[stream_num].stream_language_index = stream_languageid_index;
-
-            get_le64(pb); // avg frametime in 100ns units
-            stream_ct = get_le16(pb); //stream-name-count
-            payload_ext_ct = get_le16(pb); //payload-extension-system-count
-
-            if (stream_num < 128)
-                bitrate[stream_num] = leak_rate;
-
-            for (i=0; i<stream_ct; i++){
-                get_le16(pb);
-                ext_len = get_le16(pb);
-                url_fseek(pb, ext_len, SEEK_CUR);
-            }
-
-            for (i=0; i<payload_ext_ct; i++){
-                ff_get_guid(pb, &g);
-                ext_d=get_le16(pb);
-                ext_len=get_le32(pb);
-                url_fseek(pb, ext_len, SEEK_CUR);
-            }
+            asf_read_ext_stream_properties(s, gsize);
 
             // there could be a optional stream properties object to follow
             // if so the next iteration will pick it up
@@ -548,61 +634,12 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
         } else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) {
             int v1, v2;
             ff_get_guid(pb, &g);
-            v1 = get_le32(pb);
-            v2 = get_le16(pb);
+            v1 = avio_rl32(pb);
+            v2 = avio_rl16(pb);
             continue;
         } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
-            int i, count, name_len;
-            char name[1024];
-
-            get_le64(pb);            // reserved 16 bytes
-            get_le64(pb);            // ...
-            count = get_le32(pb);    // markers count
-            get_le16(pb);            // reserved 2 bytes
-            name_len = get_le16(pb); // name length
-            for(i=0;i<name_len;i++){
-                get_byte(pb); // skip the name
-            }
-
-            for(i=0;i<count;i++){
-                int64_t pres_time;
-                int name_len;
-
-                get_le64(pb);             // offset, 8 bytes
-                pres_time = get_le64(pb); // presentation time
-                get_le16(pb);             // entry length
-                get_le32(pb);             // send time
-                get_le32(pb);             // flags
-                name_len = get_le32(pb);  // name length
-                get_str16_nolen(pb, name_len * 2, name, sizeof(name));
-                ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
-            }
-#if 0
-        } else if (!ff_guidcmp(&g, &ff_asf_codec_comment_header)) {
-            int len, v1, n, num;
-            char str[256], *q;
-            char tag[16];
-
-            ff_get_guid(pb, &g);
-            print_guid(&g);
-
-            n = get_le32(pb);
-            for(i=0;i<n;i++) {
-                num = get_le16(pb); /* stream number */
-                get_str16(pb, str, sizeof(str));
-                get_str16(pb, str, sizeof(str));
-                len = get_le16(pb);
-                q = tag;
-                while (len > 0) {
-                    v1 = get_byte(pb);
-                    if ((q - tag) < sizeof(tag) - 1)
-                        *q++ = v1;
-                    len--;
-                }
-                *q = '\0';
-            }
-#endif
-        } else if (url_feof(pb)) {
+            asf_read_marker(s, gsize);
+        } else if (pb->eof_reached) {
             return -1;
         } else {
             if (!s->keylen) {
@@ -615,17 +652,17 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 }
             }
         }
-        if(url_ftell(pb) != gpos + gsize)
-            av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize);
-        url_fseek(pb, gpos + gsize, SEEK_SET);
+        if(avio_tell(pb) != gpos + gsize)
+            av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", avio_tell(pb)-gpos, gsize);
+        avio_seek(pb, gpos + gsize, SEEK_SET);
     }
     ff_get_guid(pb, &g);
-    get_le64(pb);
-    get_byte(pb);
-    get_byte(pb);
-    if (url_feof(pb))
+    avio_rl64(pb);
+    avio_r8(pb);
+    avio_r8(pb);
+    if (pb->eof_reached)
         return -1;
-    asf->data_offset = url_ftell(pb);
+    asf->data_offset = avio_tell(pb);
     asf->packet_size_left = 0;
 
 
@@ -634,15 +671,15 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
         if(stream_num>=0){
             AVStream *st = s->streams[stream_num];
             if (!st->codec->bit_rate)
-                st->codec->bit_rate = bitrate[i];
-            if (dar[i].num > 0 && dar[i].den > 0){
+                st->codec->bit_rate = asf->stream_bitrates[i];
+            if (asf->dar[i].num > 0 && asf->dar[i].den > 0){
                 av_reduce(&st->sample_aspect_ratio.num,
                           &st->sample_aspect_ratio.den,
-                          dar[i].num, dar[i].den, INT_MAX);
-            } else if ((dar[0].num > 0) && (dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set.
+                          asf->dar[i].num, asf->dar[i].den, INT_MAX);
+            } else if ((asf->dar[0].num > 0) && (asf->dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set.
                 av_reduce(&st->sample_aspect_ratio.num,
                           &st->sample_aspect_ratio.den,
-                          dar[0].num, dar[0].den, INT_MAX);
+                          asf->dar[0].num, asf->dar[0].den, INT_MAX);
 
 //av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
 
@@ -667,9 +704,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 #define DO_2BITS(bits, var, defval) \
     switch (bits & 3) \
     { \
-    case 3: var = get_le32(pb); rsize += 4; break; \
-    case 2: var = get_le16(pb); rsize += 2; break; \
-    case 1: var = get_byte(pb); rsize++; break; \
+    case 3: var = avio_rl32(pb); rsize += 4; break; \
+    case 2: var = avio_rl16(pb); rsize += 2; break; \
+    case 1: var = avio_r8(pb);   rsize++; break; \
     default: var = defval; break; \
     }
 
@@ -679,7 +716,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
  * @param pb context to read data from
  * @return 0 on success, <0 on error
  */
-static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
+static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
 {
     ASFContext *asf = s->priv_data;
     uint32_t packet_length, padsize;
@@ -689,12 +726,12 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
     // if we do not know packet size, allow skipping up to 32 kB
     off= 32768;
     if (s->packet_size > 0)
-        off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3;
+        off= (avio_tell(pb) - s->data_offset) % s->packet_size + 3;
 
     c=d=e=-1;
     while(off-- > 0){
         c=d; d=e;
-        e= get_byte(pb);
+        e= avio_r8(pb);
         if(c == 0x82 && !d && !e)
             break;
     }
@@ -706,22 +743,22 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
          * imply complete -EAGAIN handling support at random positions in
          * the stream.
          */
-        if (url_ferror(pb) == AVERROR(EAGAIN))
+        if (pb->error == AVERROR(EAGAIN))
             return AVERROR(EAGAIN);
-        if (!url_feof(pb))
-            av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, url_ftell(pb));
+        if (!pb->eof_reached)
+            av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, avio_tell(pb));
     }
     if ((c & 0x8f) == 0x82) {
         if (d || e) {
-            if (!url_feof(pb))
+            if (!pb->eof_reached)
                 av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
             return -1;
         }
-        c= get_byte(pb);
-        d= get_byte(pb);
+        c= avio_r8(pb);
+        d= avio_r8(pb);
         rsize+=3;
     }else{
-        url_fseek(pb, -1, SEEK_CUR); //FIXME
+        avio_seek(pb, -1, SEEK_CUR); //FIXME
     }
 
     asf->packet_flags    = c;
@@ -733,20 +770,20 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
 
     //the following checks prevent overflows and infinite loops
     if(!packet_length || packet_length >= (1U<<29)){
-        av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, url_ftell(pb));
+        av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, avio_tell(pb));
         return -1;
     }
     if(padsize >= packet_length){
-        av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, url_ftell(pb));
+        av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb));
         return -1;
     }
 
-    asf->packet_timestamp = get_le32(pb);
-    get_le16(pb); /* duration */
+    asf->packet_timestamp = avio_rl32(pb);
+    avio_rl16(pb); /* duration */
     // rsize has at least 11 bytes which have to be present
 
     if (asf->packet_flags & 0x01) {
-        asf->packet_segsizetype = get_byte(pb); rsize++;
+        asf->packet_segsizetype = avio_r8(pb); rsize++;
         asf->packet_segments = asf->packet_segsizetype & 0x3f;
     } else {
         asf->packet_segments = 1;
@@ -756,7 +793,7 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
     if (packet_length < asf->hdr.min_pktsize)
         padsize += asf->hdr.min_pktsize - packet_length;
     asf->packet_padsize = padsize;
-    dprintf(s, "packet: size=%d padsize=%d  left=%d\n", s->packet_size, asf->packet_padsize, asf->packet_size_left);
+    av_dlog(s, "packet: size=%d padsize=%d  left=%d\n", s->packet_size, asf->packet_padsize, asf->packet_size_left);
     return 0;
 }
 
@@ -764,10 +801,10 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
  *
  * @return <0 if error
  */
-static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
+static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
     ASFContext *asf = s->priv_data;
     int rsize = 1;
-    int num = get_byte(pb);
+    int num = avio_r8(pb);
     int64_t ts0, ts1;
 
     asf->packet_segments--;
@@ -779,26 +816,26 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
     DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
 //printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size);
     if (asf->packet_replic_size >= 8) {
-        asf->packet_obj_size = get_le32(pb);
+        asf->packet_obj_size = avio_rl32(pb);
         if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){
             av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n");
             return -1;
         }
-        asf->packet_frag_timestamp = get_le32(pb); // timestamp
+        asf->packet_frag_timestamp = avio_rl32(pb); // timestamp
         if(asf->packet_replic_size >= 8+38+4){
 //            for(i=0; i<asf->packet_replic_size-8; i++)
-//                av_log(s, AV_LOG_DEBUG, "%02X ",get_byte(pb));
+//                av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb));
 //            av_log(s, AV_LOG_DEBUG, "\n");
-            url_fskip(pb, 10);
-            ts0= get_le64(pb);
-            ts1= get_le64(pb);
-            url_fskip(pb, 12);
-            get_le32(pb);
-            url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4);
+            avio_skip(pb, 10);
+            ts0= avio_rl64(pb);
+            ts1= avio_rl64(pb);
+            avio_skip(pb, 12);
+            avio_rl32(pb);
+            avio_skip(pb, asf->packet_replic_size - 8 - 38 - 4);
             if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
             else         asf->packet_frag_timestamp= AV_NOPTS_VALUE;
         }else
-            url_fskip(pb, asf->packet_replic_size - 8);
+            avio_skip(pb, asf->packet_replic_size - 8);
         rsize += asf->packet_replic_size; // FIXME - check validity
     } else if (asf->packet_replic_size==1){
         // multipacket - frag_offset is beginning timestamp
@@ -806,7 +843,7 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
         asf->packet_frag_offset = 0;
         asf->packet_frag_timestamp = asf->packet_timestamp;
 
-        asf->packet_time_delta = get_byte(pb);
+        asf->packet_time_delta = avio_r8(pb);
         rsize++;
     }else if(asf->packet_replic_size!=0){
         av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size);
@@ -843,24 +880,24 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
  * @return 0 if data was stored in pkt, <0 on error or 1 if more ASF
  *          packets need to be loaded (through asf_get_packet())
  */
-static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt)
+static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
 {
     ASFContext *asf = s->priv_data;
     ASFStream *asf_st = 0;
     for (;;) {
         int ret;
-        if(url_feof(pb))
+        if(pb->eof_reached)
             return AVERROR_EOF;
         if (asf->packet_size_left < FRAME_HEADER_SIZE
             || asf->packet_segments < 1) {
             //asf->packet_size_left <= asf->packet_padsize) {
             int ret = asf->packet_size_left + asf->packet_padsize;
-            //printf("PacketLeftSize:%d  Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
+            //printf("PacketLeftSize:%d  Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb));
             assert(ret>=0);
             /* fail safe */
-            url_fskip(pb, ret);
+            avio_skip(pb, ret);
 
-            asf->packet_pos= url_ftell(pb);
+            asf->packet_pos= avio_tell(pb);
             if (asf->data_object_size != (uint64_t)-1 &&
                 (asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
                 return AVERROR_EOF; /* Do not exceed the size of the data object */
@@ -877,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *
                 ) {
                 asf->packet_time_start = 0;
                 /* unhandled packet (should not happen) */
-                url_fskip(pb, asf->packet_frag_size);
+                avio_skip(pb, asf->packet_frag_size);
                 asf->packet_size_left -= asf->packet_frag_size;
                 if(asf->stream_index < 0)
                     av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size);
@@ -891,13 +928,13 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *
             // frag_offset is here used as the beginning timestamp
             asf->packet_frag_timestamp = asf->packet_time_start;
             asf->packet_time_start += asf->packet_time_delta;
-            asf->packet_obj_size = asf->packet_frag_size = get_byte(pb);
+            asf->packet_obj_size = asf->packet_frag_size = avio_r8(pb);
             asf->packet_size_left--;
             asf->packet_multi_size--;
             if (asf->packet_multi_size < asf->packet_obj_size)
             {
                 asf->packet_time_start = 0;
-                url_fskip(pb, asf->packet_multi_size);
+                avio_skip(pb, asf->packet_multi_size);
                 asf->packet_size_left -= asf->packet_multi_size;
                 continue;
             }
@@ -923,7 +960,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *
             /* new packet */
             av_new_packet(&asf_st->pkt, asf->packet_obj_size);
             asf_st->seq = asf->packet_seq;
-            asf_st->pkt.dts = asf->packet_frag_timestamp;
+            asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll;
             asf_st->pkt.stream_index = asf->stream_index;
             asf_st->pkt.pos =
             asf_st->packet_pos= asf->packet_pos;
@@ -951,7 +988,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *
             continue;
         }
 
-        ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
+        ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset,
                          asf->packet_frag_size);
         if (ret != asf->packet_frag_size) {
             if (ret < 0 || asf->packet_frag_offset + ret == 0)
@@ -1053,7 +1090,6 @@ static void asf_reset_header(AVFormatContext *s)
     ASFStream *asf_st;
     int i;
 
-    asf->packet_nb_frames = 0;
     asf->packet_size_left = 0;
     asf->packet_segments = 0;
     asf->packet_flags = 0;
@@ -1110,7 +1146,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
     if (s->packet_size > 0)
         pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
     *ppos= pos;
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
 
 //printf("asf_read_pts\n");
     asf_reset_header(s);
@@ -1149,49 +1185,49 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
 {
     ff_asf_guid g;
     ASFContext *asf = s->priv_data;
-    int64_t current_pos= url_ftell(s->pb);
+    int64_t current_pos= avio_tell(s->pb);
     int i;
 
-    url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
+    avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
     ff_get_guid(s->pb, &g);
 
     /* the data object can be followed by other top-level objects,
        skip them until the simple index object is reached */
     while (ff_guidcmp(&g, &index_guid)) {
-        int64_t gsize= get_le64(s->pb);
-        if (gsize < 24 || url_feof(s->pb)) {
-            url_fseek(s->pb, current_pos, SEEK_SET);
+        int64_t gsize= avio_rl64(s->pb);
+        if (gsize < 24 || s->pb->eof_reached) {
+            avio_seek(s->pb, current_pos, SEEK_SET);
             return;
         }
-        url_fseek(s->pb, gsize-24, SEEK_CUR);
+        avio_skip(s->pb, gsize-24);
         ff_get_guid(s->pb, &g);
     }
 
     {
         int64_t itime, last_pos=-1;
         int pct, ict;
-        int64_t av_unused gsize= get_le64(s->pb);
+        int64_t av_unused gsize= avio_rl64(s->pb);
         ff_get_guid(s->pb, &g);
-        itime=get_le64(s->pb);
-        pct=get_le32(s->pb);
-        ict=get_le32(s->pb);
+        itime=avio_rl64(s->pb);
+        pct=avio_rl32(s->pb);
+        ict=avio_rl32(s->pb);
         av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);
 
         for (i=0;i<ict;i++){
-            int pktnum=get_le32(s->pb);
-            int pktct =get_le16(s->pb);
+            int pktnum=avio_rl32(s->pb);
+            int pktct =avio_rl16(s->pb);
             int64_t pos      = s->data_offset + s->packet_size*(int64_t)pktnum;
-            int64_t index_pts= av_rescale(itime, i, 10000);
+            int64_t index_pts= FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
 
             if(pos != last_pos){
-            av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct);
+            av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d  pts: %"PRId64"\n", pktnum, pktct, index_pts);
             av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME);
             last_pos=pos;
             }
         }
         asf->index_read= 1;
     }
-    url_fseek(s->pb, current_pos, SEEK_SET);
+    avio_seek(s->pb, current_pos, SEEK_SET);
 }
 
 static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
@@ -1206,7 +1242,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
 
     /* Try using the protocol's read_seek if available */
     if(s->pb) {
-        int ret = av_url_read_fseek(s->pb, stream_index, pts, flags);
+        int ret = ffio_read_seek(s->pb, stream_index, pts, flags);
         if(ret >= 0)
             asf_reset_header(s);
         if (ret != AVERROR(ENOSYS))
@@ -1229,10 +1265,10 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
 
     // various attempts to find key frame have failed so far
     //    asf_reset_header(s);
-    //    url_fseek(s->pb, pos, SEEK_SET);
+    //    avio_seek(s->pb, pos, SEEK_SET);
     //    key_pos = pos;
     //     for(i=0;i<16;i++){
-    //         pos = url_ftell(s->pb);
+    //         pos = avio_tell(s->pb);
     //         if (av_read_frame(s, &pkt) < 0){
     //             av_log(s, AV_LOG_INFO, "seek failed\n");
     //             return -1;
@@ -1250,13 +1286,13 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
 
         /* do the seek */
         av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
-        url_fseek(s->pb, pos, SEEK_SET);
+        avio_seek(s->pb, pos, SEEK_SET);
     }
     asf_reset_header(s);
     return 0;
 }
 
-AVInputFormat asf_demuxer = {
+AVInputFormat ff_asf_demuxer = {
     "asf",
     NULL_IF_CONFIG_SMALL("ASF format"),
     sizeof(ASFContext),
diff --git a/ffmpeg-mt/libavformat/asfenc.c b/ffmpeg-mt/libavformat/asfenc.c
index b964953..f9cc609 100644
--- a/ffmpeg-mt/libavformat/asfenc.c
+++ b/ffmpeg-mt/libavformat/asfenc.c
@@ -2,26 +2,27 @@
  * ASF muxer
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
 #include "metadata.h"
 #include "riff.h"
 #include "asf.h"
+#include "avio_internal.h"
 
 #undef NDEBUG
 #include <assert.h>
@@ -188,6 +189,31 @@
                 2*PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS \
                 )
 
+typedef struct {
+    uint32_t seqno;
+    int is_streamed;
+    ASFStream streams[128];              ///< it's max number and it's not that big
+    /* non streamed additonnal info */
+    uint64_t nb_packets;                 ///< how many packets are there in the file, invalid if broadcasting
+    int64_t duration;                    ///< in 100ns units
+    /* packet filling */
+    unsigned char multi_payloads_present;
+    int packet_size_left;
+    int packet_timestamp_start;
+    int packet_timestamp_end;
+    unsigned int packet_nb_payloads;
+    uint8_t packet_buf[PACKET_SIZE];
+    AVIOContext pb;
+    /* only for reading */
+    uint64_t data_offset;                ///< beginning of the first data packet
+
+    int64_t last_indexed_pts;
+    ASFIndex* index_ptr;
+    uint32_t nb_index_count;
+    uint32_t nb_index_memory_alloc;
+    uint16_t maximum_packet;
+} ASFContext;
+
 static const AVCodecTag codec_asf_bmp_tags[] = {
     { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
     { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
@@ -197,61 +223,61 @@ static const AVCodecTag codec_asf_bmp_tags[] = {
 
 #define PREROLL_TIME 3100
 
-static void put_guid(ByteIOContext *s, const ff_asf_guid *g)
+static void put_guid(AVIOContext *s, const ff_asf_guid *g)
 {
     assert(sizeof(*g) == 16);
-    put_buffer(s, *g, sizeof(*g));
+    avio_write(s, *g, sizeof(*g));
 }
 
-static void put_str16(ByteIOContext *s, const char *tag)
+static void put_str16(AVIOContext *s, const char *tag)
 {
     int len;
     uint8_t *pb;
-    ByteIOContext *dyn_buf;
-    if (url_open_dyn_buf(&dyn_buf) < 0)
+    AVIOContext *dyn_buf;
+    if (avio_open_dyn_buf(&dyn_buf) < 0)
         return;
 
-    ff_put_str16_nolen(dyn_buf, tag);
-    len = url_close_dyn_buf(dyn_buf, &pb);
-    put_le16(s, len);
-    put_buffer(s, pb, len);
+    avio_put_str16le(dyn_buf, tag);
+    len = avio_close_dyn_buf(dyn_buf, &pb);
+    avio_wl16(s, len);
+    avio_write(s, pb, len);
     av_freep(&pb);
 }
 
-static int64_t put_header(ByteIOContext *pb, const ff_asf_guid *g)
+static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g)
 {
     int64_t pos;
 
-    pos = url_ftell(pb);
+    pos = avio_tell(pb);
     put_guid(pb, g);
-    put_le64(pb, 24);
+    avio_wl64(pb, 24);
     return pos;
 }
 
 /* update header size */
-static void end_header(ByteIOContext *pb, int64_t pos)
+static void end_header(AVIOContext *pb, int64_t pos)
 {
     int64_t pos1;
 
-    pos1 = url_ftell(pb);
-    url_fseek(pb, pos + 16, SEEK_SET);
-    put_le64(pb, pos1 - pos);
-    url_fseek(pb, pos1, SEEK_SET);
+    pos1 = avio_tell(pb);
+    avio_seek(pb, pos + 16, SEEK_SET);
+    avio_wl64(pb, pos1 - pos);
+    avio_seek(pb, pos1, SEEK_SET);
 }
 
 /* write an asf chunk (only used in streaming case) */
 static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags)
 {
     ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int length;
 
     length = payload_length + 8;
-    put_le16(pb, type);
-    put_le16(pb, length);    //size
-    put_le32(pb, asf->seqno);//sequence number
-    put_le16(pb, flags); /* unknown bytes */
-    put_le16(pb, length);    //size_confirm
+    avio_wl16(pb, type);
+    avio_wl16(pb, length);    //size
+    avio_wl32(pb, asf->seqno);//sequence number
+    avio_wl16(pb, flags); /* unknown bytes */
+    avio_wl16(pb, length);    //size_confirm
     asf->seqno++;
 }
 
@@ -269,7 +295,7 @@ static int64_t unix_to_file_time(int ti)
 static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size)
 {
     ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVMetadataTag *tags[5];
     int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
     int has_title;
@@ -305,62 +331,62 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
     }
 
     put_guid(pb, &ff_asf_header);
-    put_le64(pb, -1); /* header length, will be patched after */
-    put_le32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */
-    put_byte(pb, 1); /* ??? */
-    put_byte(pb, 2); /* ??? */
+    avio_wl64(pb, -1); /* header length, will be patched after */
+    avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */
+    avio_w8(pb, 1); /* ??? */
+    avio_w8(pb, 2); /* ??? */
 
     /* file header */
-    header_offset = url_ftell(pb);
+    header_offset = avio_tell(pb);
     hpos = put_header(pb, &ff_asf_file_header);
     put_guid(pb, &ff_asf_my_guid);
-    put_le64(pb, file_size);
+    avio_wl64(pb, file_size);
     file_time = 0;
-    put_le64(pb, unix_to_file_time(file_time));
-    put_le64(pb, asf->nb_packets); /* number of packets */
-    put_le64(pb, duration); /* end time stamp (in 100ns units) */
-    put_le64(pb, asf->duration); /* duration (in 100ns units) */
-    put_le64(pb, PREROLL_TIME); /* start time stamp */
-    put_le32(pb, (asf->is_streamed || url_is_streamed(pb)) ? 3 : 2); /* ??? */
-    put_le32(pb, s->packet_size); /* packet size */
-    put_le32(pb, s->packet_size); /* packet size */
-    put_le32(pb, bit_rate); /* Nominal data rate in bps */
+    avio_wl64(pb, unix_to_file_time(file_time));
+    avio_wl64(pb, asf->nb_packets); /* number of packets */
+    avio_wl64(pb, duration); /* end time stamp (in 100ns units) */
+    avio_wl64(pb, asf->duration); /* duration (in 100ns units) */
+    avio_wl64(pb, PREROLL_TIME); /* start time stamp */
+    avio_wl32(pb, (asf->is_streamed || !pb->seekable ) ? 3 : 2); /* ??? */
+    avio_wl32(pb, s->packet_size); /* packet size */
+    avio_wl32(pb, s->packet_size); /* packet size */
+    avio_wl32(pb, bit_rate); /* Nominal data rate in bps */
     end_header(pb, hpos);
 
     /* unknown headers */
     hpos = put_header(pb, &ff_asf_head1_guid);
     put_guid(pb, &ff_asf_head2_guid);
-    put_le32(pb, 6);
-    put_le16(pb, 0);
+    avio_wl32(pb, 6);
+    avio_wl16(pb, 0);
     end_header(pb, hpos);
 
     /* title and other infos */
     if (has_title) {
         int len;
         uint8_t *buf;
-        ByteIOContext *dyn_buf;
+        AVIOContext *dyn_buf;
 
-        if (url_open_dyn_buf(&dyn_buf) < 0)
+        if (avio_open_dyn_buf(&dyn_buf) < 0)
             return AVERROR(ENOMEM);
 
         hpos = put_header(pb, &ff_asf_comment_header);
 
         for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) {
-            len = tags[n] ? ff_put_str16_nolen(dyn_buf, tags[n]->value) : 0;
-            put_le16(pb, len);
+            len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0;
+            avio_wl16(pb, len);
         }
-        len = url_close_dyn_buf(dyn_buf, &buf);
-        put_buffer(pb, buf, len);
+        len = avio_close_dyn_buf(dyn_buf, &buf);
+        avio_write(pb, buf, len);
         av_freep(&buf);
         end_header(pb, hpos);
     }
     if (metadata_count) {
         AVMetadataTag *tag = NULL;
         hpos = put_header(pb, &ff_asf_extended_content_header);
-        put_le16(pb, metadata_count);
+        avio_wl16(pb, metadata_count);
         while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
             put_str16(pb, tag->key);
-            put_le16(pb, 0);
+            avio_wl16(pb, 0);
             put_str16(pb, tag->value);
         }
         end_header(pb, hpos);
@@ -398,45 +424,45 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
             put_guid(pb, &ff_asf_video_stream);
             put_guid(pb, &ff_asf_video_conceal_none);
         }
-        put_le64(pb, 0); /* ??? */
-        es_pos = url_ftell(pb);
-        put_le32(pb, extra_size); /* wav header len */
-        put_le32(pb, extra_size2); /* additional data len */
-        put_le16(pb, n + 1); /* stream number */
-        put_le32(pb, 0); /* ??? */
+        avio_wl64(pb, 0); /* ??? */
+        es_pos = avio_tell(pb);
+        avio_wl32(pb, extra_size); /* wav header len */
+        avio_wl32(pb, extra_size2); /* additional data len */
+        avio_wl16(pb, n + 1); /* stream number */
+        avio_wl32(pb, 0); /* ??? */
 
         if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
             /* WAVEFORMATEX header */
             int wavsize = ff_put_wav_header(pb, enc);
             if ((enc->codec_id != CODEC_ID_MP3) && (enc->codec_id != CODEC_ID_MP2) && (enc->codec_id != CODEC_ID_ADPCM_IMA_WAV) && (enc->extradata_size==0)) {
                 wavsize += 2;
-                put_le16(pb, 0);
+                avio_wl16(pb, 0);
             }
 
             if (wavsize < 0)
                 return -1;
             if (wavsize != extra_size) {
-                cur_pos = url_ftell(pb);
-                url_fseek(pb, es_pos, SEEK_SET);
-                put_le32(pb, wavsize); /* wav header len */
-                url_fseek(pb, cur_pos, SEEK_SET);
+                cur_pos = avio_tell(pb);
+                avio_seek(pb, es_pos, SEEK_SET);
+                avio_wl32(pb, wavsize); /* wav header len */
+                avio_seek(pb, cur_pos, SEEK_SET);
             }
             /* ERROR Correction */
-            put_byte(pb, 0x01);
+            avio_w8(pb, 0x01);
             if(enc->codec_id == CODEC_ID_ADPCM_G726 || !enc->block_align){
-                put_le16(pb, 0x0190);
-                put_le16(pb, 0x0190);
+                avio_wl16(pb, 0x0190);
+                avio_wl16(pb, 0x0190);
             }else{
-                put_le16(pb, enc->block_align);
-                put_le16(pb, enc->block_align);
+                avio_wl16(pb, enc->block_align);
+                avio_wl16(pb, enc->block_align);
             }
-            put_le16(pb, 0x01);
-            put_byte(pb, 0x00);
+            avio_wl16(pb, 0x01);
+            avio_w8(pb, 0x00);
         } else {
-            put_le32(pb, enc->width);
-            put_le32(pb, enc->height);
-            put_byte(pb, 2); /* ??? */
-            put_le16(pb, 40 + enc->extradata_size); /* size */
+            avio_wl32(pb, enc->width);
+            avio_wl32(pb, enc->height);
+            avio_w8(pb, 2); /* ??? */
+            avio_wl16(pb, 40 + enc->extradata_size); /* size */
 
             /* BITMAPINFOHEADER header */
             ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1);
@@ -448,49 +474,49 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
 
     hpos = put_header(pb, &ff_asf_codec_comment_header);
     put_guid(pb, &ff_asf_codec_comment1_header);
-    put_le32(pb, s->nb_streams);
+    avio_wl32(pb, s->nb_streams);
     for(n=0;n<s->nb_streams;n++) {
         AVCodec *p;
         const char *desc;
         int len;
         uint8_t *buf;
-        ByteIOContext *dyn_buf;
+        AVIOContext *dyn_buf;
 
         enc = s->streams[n]->codec;
         p = avcodec_find_encoder(enc->codec_id);
 
         if(enc->codec_type == AVMEDIA_TYPE_AUDIO)
-            put_le16(pb, 2);
+            avio_wl16(pb, 2);
         else if(enc->codec_type == AVMEDIA_TYPE_VIDEO)
-            put_le16(pb, 1);
+            avio_wl16(pb, 1);
         else
-            put_le16(pb, -1);
+            avio_wl16(pb, -1);
 
         if(enc->codec_id == CODEC_ID_WMAV2)
             desc = "Windows Media Audio V8";
         else
             desc = p ? p->name : enc->codec_name;
 
-        if ( url_open_dyn_buf(&dyn_buf) < 0)
+        if ( avio_open_dyn_buf(&dyn_buf) < 0)
             return AVERROR(ENOMEM);
 
-        ff_put_str16_nolen(dyn_buf, desc);
-        len = url_close_dyn_buf(dyn_buf, &buf);
-        put_le16(pb, len / 2); // "number of characters" = length in bytes / 2
+        avio_put_str16le(dyn_buf, desc);
+        len = avio_close_dyn_buf(dyn_buf, &buf);
+        avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2
 
-        put_buffer(pb, buf, len);
+        avio_write(pb, buf, len);
         av_freep(&buf);
 
-        put_le16(pb, 0); /* no parameters */
+        avio_wl16(pb, 0); /* no parameters */
 
 
         /* id */
         if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            put_le16(pb, 2);
-            put_le16(pb, enc->codec_tag);
+            avio_wl16(pb, 2);
+            avio_wl16(pb, enc->codec_tag);
         } else {
-            put_le16(pb, 4);
-            put_le32(pb, enc->codec_tag);
+            avio_wl16(pb, 4);
+            avio_wl32(pb, enc->codec_tag);
         }
         if(!enc->codec_tag)
             return -1;
@@ -499,31 +525,31 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
 
     /* patch the header size fields */
 
-    cur_pos = url_ftell(pb);
+    cur_pos = avio_tell(pb);
     header_size = cur_pos - header_offset;
     if (asf->is_streamed) {
         header_size += 8 + 30 + 50;
 
-        url_fseek(pb, header_offset - 10 - 30, SEEK_SET);
-        put_le16(pb, header_size);
-        url_fseek(pb, header_offset - 2 - 30, SEEK_SET);
-        put_le16(pb, header_size);
+        avio_seek(pb, header_offset - 10 - 30, SEEK_SET);
+        avio_wl16(pb, header_size);
+        avio_seek(pb, header_offset - 2 - 30, SEEK_SET);
+        avio_wl16(pb, header_size);
 
         header_size -= 8 + 30 + 50;
     }
     header_size += 24 + 6;
-    url_fseek(pb, header_offset - 14, SEEK_SET);
-    put_le64(pb, header_size);
-    url_fseek(pb, cur_pos, SEEK_SET);
+    avio_seek(pb, header_offset - 14, SEEK_SET);
+    avio_wl64(pb, header_size);
+    avio_seek(pb, cur_pos, SEEK_SET);
 
     /* movie chunk, followed by packets of packet_size */
     asf->data_offset = cur_pos;
     put_guid(pb, &ff_asf_data_header);
-    put_le64(pb, data_chunk_size);
+    avio_wl64(pb, data_chunk_size);
     put_guid(pb, &ff_asf_my_guid);
-    put_le64(pb, asf->nb_packets); /* nb packets */
-    put_byte(pb, 1); /* ??? */
-    put_byte(pb, 1); /* ??? */
+    avio_wl64(pb, asf->nb_packets); /* nb packets */
+    avio_w8(pb, 1); /* ??? */
+    avio_w8(pb, 1); /* ??? */
     return 0;
 }
 
@@ -548,12 +574,12 @@ static int asf_write_header(AVFormatContext *s)
         return -1;
     }
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     asf->packet_nb_payloads = 0;
     asf->packet_timestamp_start = -1;
     asf->packet_timestamp_end = -1;
-    init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1,
+    ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1,
                   NULL, NULL, NULL, NULL);
 
     return 0;
@@ -577,9 +603,9 @@ static int put_payload_parsing_info(
             )
 {
     ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ppi_size, i;
-    int64_t start= url_ftell(pb);
+    int64_t start= avio_tell(pb);
 
     int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS;
 
@@ -588,9 +614,9 @@ static int put_payload_parsing_info(
         padsize--;
     assert(padsize>=0);
 
-    put_byte(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS);
+    avio_w8(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS);
     for (i = 0; i < ASF_PACKET_ERROR_CORRECTION_DATA_SIZE; i++){
-        put_byte(pb, 0x0);
+        avio_w8(pb, 0x0);
     }
 
     if (asf->multi_payloads_present)
@@ -602,21 +628,21 @@ static int put_payload_parsing_info(
         else
             iLengthTypeFlags |= ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD;
     }
-    put_byte(pb, iLengthTypeFlags);
+    avio_w8(pb, iLengthTypeFlags);
 
-    put_byte(pb, ASF_PPI_PROPERTY_FLAGS);
+    avio_w8(pb, ASF_PPI_PROPERTY_FLAGS);
 
     if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD)
-        put_le16(pb, padsize - 2);
+        avio_wl16(pb, padsize - 2);
     if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE)
-        put_byte(pb, padsize - 1);
+        avio_w8(pb, padsize - 1);
 
-    put_le32(pb, sendtime);
-    put_le16(pb, duration);
+    avio_wl32(pb, sendtime);
+    avio_wl16(pb, duration);
     if (asf->multi_payloads_present)
-        put_byte(pb, nb_payloads | ASF_PAYLOAD_FLAGS);
+        avio_w8(pb, nb_payloads | ASF_PAYLOAD_FLAGS);
 
-    ppi_size = url_ftell(pb) - start;
+    ppi_size = avio_tell(pb) - start;
 
     return ppi_size;
 }
@@ -644,14 +670,14 @@ static void flush_packet(AVFormatContext *s)
     assert(packet_hdr_size <= asf->packet_size_left);
     memset(asf->packet_buf + packet_filled_size, 0, asf->packet_size_left);
 
-    put_buffer(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size);
+    avio_write(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     asf->nb_packets++;
     asf->packet_nb_payloads = 0;
     asf->packet_timestamp_start = -1;
     asf->packet_timestamp_end = -1;
-    init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1,
+    ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1,
                   NULL, NULL, NULL, NULL);
 }
 
@@ -666,29 +692,29 @@ static void put_payload_header(
             )
 {
     ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = &asf->pb;
+    AVIOContext *pb = &asf->pb;
     int val;
 
     val = stream->num;
     if (flags & AV_PKT_FLAG_KEY)
         val |= ASF_PL_FLAG_KEY_FRAME;
-    put_byte(pb, val);
+    avio_w8(pb, val);
 
-    put_byte(pb, stream->seq);  //Media object number
-    put_le32(pb, m_obj_offset); //Offset Into Media Object
+    avio_w8(pb, stream->seq);  //Media object number
+    avio_wl32(pb, m_obj_offset); //Offset Into Media Object
 
     // Replicated Data shall be at least 8 bytes long.
     // The first 4 bytes of data shall contain the
     // Size of the Media Object that the payload belongs to.
     // The next 4 bytes of data shall contain the
     // Presentation Time for the media object that the payload belongs to.
-    put_byte(pb, ASF_PAYLOAD_REPLICATED_DATA_LENGTH);
+    avio_w8(pb, ASF_PAYLOAD_REPLICATED_DATA_LENGTH);
 
-    put_le32(pb, m_obj_size);       //Replicated Data - Media Object Size
-    put_le32(pb, presentation_time);//Replicated Data - Presentation Time
+    avio_wl32(pb, m_obj_size);       //Replicated Data - Media Object Size
+    avio_wl32(pb, presentation_time);//Replicated Data - Presentation Time
 
     if (asf->multi_payloads_present){
-        put_le16(pb, payload_len);   //payload length
+        avio_wl16(pb, payload_len);   //payload length
     }
 }
 
@@ -736,7 +762,7 @@ static void put_frame(
                 payload_len = frag_len1 - 2;  //additional byte need to put padding length
 
             put_payload_header(s, stream, timestamp+PREROLL_TIME, m_obj_size, m_obj_offset, payload_len, flags);
-            put_buffer(&asf->pb, buf, payload_len);
+            avio_write(&asf->pb, buf, payload_len);
 
             if (asf->multi_payloads_present)
                 asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS);
@@ -807,18 +833,18 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
 //
 static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i;
 
     put_guid(pb, &ff_asf_simple_index_header);
-    put_le64(pb, 24 + 16 + 8 + 4 + 4 + (4 + 2)*count);
+    avio_wl64(pb, 24 + 16 + 8 + 4 + 4 + (4 + 2)*count);
     put_guid(pb, &ff_asf_my_guid);
-    put_le64(pb, ASF_INDEXED_INTERVAL);
-    put_le32(pb, max);
-    put_le32(pb, count);
+    avio_wl64(pb, ASF_INDEXED_INTERVAL);
+    avio_wl32(pb, max);
+    avio_wl32(pb, count);
     for(i=0; i<count; i++) {
-        put_le32(pb, index[i].packet_number);
-        put_le16(pb, index[i].packet_count);
+        avio_wl32(pb, index[i].packet_number);
+        avio_wl16(pb, index[i].packet_count);
     }
 
     return 0;
@@ -834,28 +860,28 @@ static int asf_write_trailer(AVFormatContext *s)
         flush_packet(s);
 
     /* write index */
-    data_size = url_ftell(s->pb);
+    data_size = avio_tell(s->pb);
     if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
         asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
     }
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
-    if (asf->is_streamed || url_is_streamed(s->pb)) {
+    if (asf->is_streamed || !s->pb->seekable) {
         put_chunk(s, 0x4524, 0, 0); /* end of stream */
     } else {
         /* rewrite an updated header */
-        file_size = url_ftell(s->pb);
-        url_fseek(s->pb, 0, SEEK_SET);
+        file_size = avio_tell(s->pb);
+        avio_seek(s->pb, 0, SEEK_SET);
         asf_write_header1(s, file_size, data_size - asf->data_offset);
     }
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     av_free(asf->index_ptr);
     return 0;
 }
 
 #if CONFIG_ASF_MUXER
-AVOutputFormat asf_muxer = {
+AVOutputFormat ff_asf_muxer = {
     "asf",
     NULL_IF_CONFIG_SMALL("ASF format"),
     "video/x-ms-asf",
@@ -876,7 +902,7 @@ AVOutputFormat asf_muxer = {
 #endif
 
 #if CONFIG_ASF_STREAM_MUXER
-AVOutputFormat asf_stream_muxer = {
+AVOutputFormat ff_asf_stream_muxer = {
     "asf_stream",
     NULL_IF_CONFIG_SMALL("ASF format"),
     "video/x-ms-asf",
diff --git a/ffmpeg-mt/libavformat/assdec.c b/ffmpeg-mt/libavformat/assdec.c
index ffce157..b270200 100644
--- a/ffmpeg-mt/libavformat/assdec.c
+++ b/ffmpeg-mt/libavformat/assdec.c
@@ -2,20 +2,20 @@
  * SSA/ASS demuxer
  * Copyright (c) 2008 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -76,7 +76,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     int i, len, header_remaining;
     ASSContext *ass = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     int allocated[2]={0};
     uint8_t *p, **dst[2]={0};
@@ -92,7 +92,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     header_remaining= INT_MAX;
     dst[0] = &st->codec->extradata;
     dst[1] = &ass->event_buffer;
-    while(!url_feof(pb)){
+    while(!pb->eof_reached){
         uint8_t line[MAX_LINESIZE];
 
         len = ff_get_line(pb, line, sizeof(line));
@@ -168,7 +168,7 @@ static int read_seek2(AVFormatContext *s, int stream_index,
     ASSContext *ass = s->priv_data;
 
     if (flags & AVSEEK_FLAG_BYTE) {
-        return AVERROR_NOTSUPP;
+        return AVERROR(ENOSYS);
     } else if (flags & AVSEEK_FLAG_FRAME) {
         if (ts < 0 || ts >= ass->event_count)
             return AVERROR(ERANGE);
@@ -202,7 +202,7 @@ static int read_seek2(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-AVInputFormat ass_demuxer = {
+AVInputFormat ff_ass_demuxer = {
     .name           = "ass",
     .long_name      = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"),
     .priv_data_size = sizeof(ASSContext),
diff --git a/ffmpeg-mt/libavformat/assenc.c b/ffmpeg-mt/libavformat/assenc.c
index bc1d7de..c53af16 100644
--- a/ffmpeg-mt/libavformat/assenc.c
+++ b/ffmpeg-mt/libavformat/assenc.c
@@ -2,20 +2,20 @@
  * SSA/ASS muxer
  * Copyright (c) 2008 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -42,7 +42,7 @@ static int write_header(AVFormatContext *s)
         if(!end) end= avctx->extradata + avctx->extradata_size;
         else     end++;
 
-        put_buffer(s->pb, p, end-p);
+        avio_write(s->pb, p, end-p);
         ass->extra_index += end-p;
 
         if(last && !memcmp(last, "[Events]", 8))
@@ -50,16 +50,16 @@ static int write_header(AVFormatContext *s)
         last=p;
     }
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     return 0;
 }
 
 static int write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    put_buffer(s->pb, pkt->data, pkt->size);
+    avio_write(s->pb, pkt->data, pkt->size);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     return 0;
 }
@@ -69,15 +69,15 @@ static int write_trailer(AVFormatContext *s)
     ASSContext *ass = s->priv_data;
     AVCodecContext *avctx= s->streams[0]->codec;
 
-    put_buffer(s->pb, avctx->extradata      + ass->extra_index,
+    avio_write(s->pb, avctx->extradata      + ass->extra_index,
                       avctx->extradata_size - ass->extra_index);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     return 0;
 }
 
-AVOutputFormat ass_muxer = {
+AVOutputFormat ff_ass_muxer = {
     .name           = "ass",
     .long_name      = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"),
     .mime_type      = "text/x-ssa",
diff --git a/ffmpeg-mt/libavformat/au.c b/ffmpeg-mt/libavformat/au.c
index cb1c31d..6cffe1c 100644
--- a/ffmpeg-mt/libavformat/au.c
+++ b/ffmpeg-mt/libavformat/au.c
@@ -2,20 +2,20 @@
  * AU muxer and demuxer
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,6 +28,7 @@
  */
 
 #include "avformat.h"
+#include "avio_internal.h"
 #include "pcm.h"
 #include "riff.h"
 
@@ -49,22 +50,22 @@ static const AVCodecTag codec_au_tags[] = {
 
 #if CONFIG_AU_MUXER
 /* AUDIO_FILE header */
-static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
+static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
 {
     if(!enc->codec_tag)
         return -1;
-    put_tag(pb, ".snd");       /* magic number */
-    put_be32(pb, 24);           /* header size */
-    put_be32(pb, AU_UNKNOWN_SIZE); /* data size */
-    put_be32(pb, (uint32_t)enc->codec_tag);     /* codec ID */
-    put_be32(pb, enc->sample_rate);
-    put_be32(pb, (uint32_t)enc->channels);
+    ffio_wfourcc(pb, ".snd");    /* magic number */
+    avio_wb32(pb, 24);           /* header size */
+    avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */
+    avio_wb32(pb, (uint32_t)enc->codec_tag);     /* codec ID */
+    avio_wb32(pb, enc->sample_rate);
+    avio_wb32(pb, (uint32_t)enc->channels);
     return 0;
 }
 
 static int au_write_header(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     s->priv_data = NULL;
 
@@ -73,32 +74,32 @@ static int au_write_header(AVFormatContext *s)
         return -1;
     }
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
 static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
+    AVIOContext *pb = s->pb;
+    avio_write(pb, pkt->data, pkt->size);
     return 0;
 }
 
 static int au_write_trailer(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t file_size;
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
 
         /* update file size */
-        file_size = url_ftell(pb);
-        url_fseek(pb, 8, SEEK_SET);
-        put_be32(pb, (uint32_t)(file_size - 24));
-        url_fseek(pb, file_size, SEEK_SET);
+        file_size = avio_tell(pb);
+        avio_seek(pb, 8, SEEK_SET);
+        avio_wb32(pb, (uint32_t)(file_size - 24));
+        avio_seek(pb, file_size, SEEK_SET);
 
-        put_flush_packet(pb);
+        avio_flush(pb);
     }
 
     return 0;
@@ -121,21 +122,21 @@ static int au_read_header(AVFormatContext *s,
 {
     int size;
     unsigned int tag;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int id, channels, rate;
     enum CodecID codec;
     AVStream *st;
 
     /* check ".snd" header */
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
     if (tag != MKTAG('.', 's', 'n', 'd'))
         return -1;
-    size = get_be32(pb); /* header size */
-    get_be32(pb); /* data size */
+    size = avio_rb32(pb); /* header size */
+    avio_rb32(pb); /* data size */
 
-    id = get_be32(pb);
-    rate = get_be32(pb);
-    channels = get_be32(pb);
+    id = avio_rb32(pb);
+    rate = avio_rb32(pb);
+    channels = avio_rb32(pb);
 
     codec = ff_codec_get_id(codec_au_tags, id);
 
@@ -146,7 +147,7 @@ static int au_read_header(AVFormatContext *s,
 
     if (size >= 24) {
         /* skip unused data */
-        url_fseek(pb, size - 24, SEEK_CUR);
+        avio_skip(pb, size - 24);
     }
 
     /* now we are ready: build format streams */
@@ -183,7 +184,7 @@ static int au_read_packet(AVFormatContext *s,
 }
 
 #if CONFIG_AU_DEMUXER
-AVInputFormat au_demuxer = {
+AVInputFormat ff_au_demuxer = {
     "au",
     NULL_IF_CONFIG_SMALL("SUN AU format"),
     0,
@@ -197,7 +198,7 @@ AVInputFormat au_demuxer = {
 #endif
 
 #if CONFIG_AU_MUXER
-AVOutputFormat au_muxer = {
+AVOutputFormat ff_au_muxer = {
     "au",
     NULL_IF_CONFIG_SMALL("SUN AU format"),
     "audio/basic",
diff --git a/ffmpeg-mt/libavformat/audiointerleave.c b/ffmpeg-mt/libavformat/audiointerleave.c
index 3c235c0..e4cb1b8 100644
--- a/ffmpeg-mt/libavformat/audiointerleave.c
+++ b/ffmpeg-mt/libavformat/audiointerleave.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/audiointerleave.h b/ffmpeg-mt/libavformat/audiointerleave.h
index c948c36..af29629 100644
--- a/ffmpeg-mt/libavformat/audiointerleave.h
+++ b/ffmpeg-mt/libavformat/audiointerleave.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,7 +39,6 @@ typedef struct {
 int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base);
 void ff_audio_interleave_close(AVFormatContext *s);
 
-int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt);
 /**
  * Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame
  * and interleave them correctly.
diff --git a/ffmpeg-mt/libavformat/avc.c b/ffmpeg-mt/libavformat/avc.c
index 7c99196..70a05ec 100644
--- a/ffmpeg-mt/libavformat/avc.c
+++ b/ffmpeg-mt/libavformat/avc.c
@@ -2,20 +2,20 @@
  * AVC helper functions for muxers
  * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at smartjog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -67,7 +67,7 @@ const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end){
     return out;
 }
 
-int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
+int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
 {
     const uint8_t *p = buf_in;
     const uint8_t *end = p + size;
@@ -78,8 +78,8 @@ int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
     while (nal_start < end) {
         while(!*(nal_start++));
         nal_end = ff_avc_find_startcode(nal_start, end);
-        put_be32(pb, nal_end - nal_start);
-        put_buffer(pb, nal_start, nal_end - nal_start);
+        avio_wb32(pb, nal_end - nal_start);
+        avio_write(pb, nal_start, nal_end - nal_start);
         size += 4 + nal_end - nal_start;
         nal_start = nal_end;
     }
@@ -88,19 +88,19 @@ int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
 
 int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
 {
-    ByteIOContext *pb;
-    int ret = url_open_dyn_buf(&pb);
+    AVIOContext *pb;
+    int ret = avio_open_dyn_buf(&pb);
     if(ret < 0)
         return ret;
 
     ff_avc_parse_nal_units(pb, buf_in, *size);
 
     av_freep(buf);
-    *size = url_close_dyn_buf(pb, buf);
+    *size = avio_close_dyn_buf(pb, buf);
     return 0;
 }
 
-int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len)
+int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
 {
     if (len > 6) {
         /* check for h264 start code */
@@ -134,21 +134,21 @@ int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len)
             assert(sps);
             assert(pps);
 
-            put_byte(pb, 1); /* version */
-            put_byte(pb, sps[1]); /* profile */
-            put_byte(pb, sps[2]); /* profile compat */
-            put_byte(pb, sps[3]); /* level */
-            put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
-            put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
-
-            put_be16(pb, sps_size);
-            put_buffer(pb, sps, sps_size);
-            put_byte(pb, 1); /* number of pps */
-            put_be16(pb, pps_size);
-            put_buffer(pb, pps, pps_size);
+            avio_w8(pb, 1); /* version */
+            avio_w8(pb, sps[1]); /* profile */
+            avio_w8(pb, sps[2]); /* profile compat */
+            avio_w8(pb, sps[3]); /* level */
+            avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
+            avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
+
+            avio_wb16(pb, sps_size);
+            avio_write(pb, sps, sps_size);
+            avio_w8(pb, 1); /* number of pps */
+            avio_wb16(pb, pps_size);
+            avio_write(pb, pps, pps_size);
             av_free(start);
         } else {
-            put_buffer(pb, data, len);
+            avio_write(pb, data, len);
         }
     }
     return 0;
diff --git a/ffmpeg-mt/libavformat/avc.h b/ffmpeg-mt/libavformat/avc.h
index 2deb77d..5612212 100644
--- a/ffmpeg-mt/libavformat/avc.h
+++ b/ffmpeg-mt/libavformat/avc.h
@@ -2,20 +2,20 @@
  * AVC helper functions for muxers
  * Copyright (c) 2008 Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,9 +25,9 @@
 #include <stdint.h>
 #include "avio.h"
 
-int ff_avc_parse_nal_units(ByteIOContext *s, const uint8_t *buf, int size);
+int ff_avc_parse_nal_units(AVIOContext *s, const uint8_t *buf, int size);
 int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size);
-int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len);
+int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len);
 const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end);
 
 #endif /* AVFORMAT_AVC_H */
diff --git a/ffmpeg-mt/libavformat/avformat.h b/ffmpeg-mt/libavformat/avformat.h
index 919933f..24c7958 100644
--- a/ffmpeg-mt/libavformat/avformat.h
+++ b/ffmpeg-mt/libavformat/avformat.h
@@ -1,89 +1,26 @@
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef AVFORMAT_AVFORMAT_H
 #define AVFORMAT_AVFORMAT_H
 
-#define LIBAVFORMAT_VERSION_MAJOR 52
-#define LIBAVFORMAT_VERSION_MINOR 93
-#define LIBAVFORMAT_VERSION_MICRO  0
-
-#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-                                               LIBAVFORMAT_VERSION_MINOR, \
-                                               LIBAVFORMAT_VERSION_MICRO)
-#define LIBAVFORMAT_VERSION     AV_VERSION(LIBAVFORMAT_VERSION_MAJOR,   \
-                                           LIBAVFORMAT_VERSION_MINOR,   \
-                                           LIBAVFORMAT_VERSION_MICRO)
-#define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
-
-#define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
-
-/**
- * Those FF_API_* defines are not part of public API.
- * They may change, break or disappear at any time.
- */
-#ifndef FF_API_MAX_STREAMS
-#define FF_API_MAX_STREAMS             (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_OLD_METADATA
-#define FF_API_OLD_METADATA            (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_URL_CLASS
-#define FF_API_URL_CLASS               (LIBAVFORMAT_VERSION_MAJOR >= 53)
-#endif
-#ifndef FF_API_URL_RESETBUF
-#define FF_API_URL_RESETBUF            (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_REGISTER_PROTOCOL
-#define FF_API_REGISTER_PROTOCOL       (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_GUESS_FORMAT
-#define FF_API_GUESS_FORMAT            (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_UDP_GET_FILE
-#define FF_API_UDP_GET_FILE            (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_URL_SPLIT
-#define FF_API_URL_SPLIT               (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_ALLOC_FORMAT_CONTEXT
-#define FF_API_ALLOC_FORMAT_CONTEXT    (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_PARSE_FRAME_PARAM
-#define FF_API_PARSE_FRAME_PARAM       (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_READ_SEEK
-#define FF_API_READ_SEEK               (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_LAVF_UNUSED
-#define FF_API_LAVF_UNUSED             (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_PARAMETERS_CODEC_ID
-#define FF_API_PARAMETERS_CODEC_ID     (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_FIRST_FORMAT
-#define FF_API_FIRST_FORMAT            (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
-#ifndef FF_API_SYMVER
-#define FF_API_SYMVER                  (LIBAVFORMAT_VERSION_MAJOR < 53)
-#endif
 
 /**
  * I return the LIBAVFORMAT_VERSION_INT constant.  You got
@@ -106,6 +43,7 @@ const char *avformat_license(void);
 #include "libavcodec/avcodec.h"
 
 #include "avio.h"
+#include "libavformat/version.h"
 
 struct AVFormatContext;
 
@@ -113,7 +51,7 @@ struct AVFormatContext;
 /*
  * Public Metadata API.
  * The metadata API allows libavformat to export metadata tags to a client
- * application using a sequence of key/value pairs. Like all strings in FFmpeg,
+ * application using a sequence of key/value pairs. Like all strings in Libav,
  * metadata must be stored as UTF-8 encoded Unicode. Note that metadata
  * exported by demuxers isn't checked to be valid UTF-8 in most cases.
  * Important concepts to keep in mind:
@@ -156,11 +94,14 @@ struct AVFormatContext;
  * filename     -- original name of the file.
  * genre        -- <self-evident>.
  * language     -- main language in which the work is performed, preferably
- *                 in ISO 639-2 format.
+ *                 in ISO 639-2 format. Multiple languages can be specified by
+ *                 separating them with commas.
  * performer    -- artist who performed the work, if different from artist.
  *                 E.g for "Also sprach Zarathustra", artist would be "Richard
  *                 Strauss" and performer "London Philharmonic Orchestra".
  * publisher    -- name of the label/publisher.
+ * service_name     -- name of the service in broadcasting (channel name).
+ * service_provider -- name of the service provider in broadcasting.
  * title        -- name of the work.
  * track        -- number of this work in the set, can be in form current/total.
  */
@@ -253,7 +194,7 @@ void av_metadata_free(AVMetadata **m);
  * @param size desired payload size
  * @return >0 (read size) if OK, AVERROR_xxx otherwise
  */
-int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
+int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);
 
 
 /**
@@ -269,7 +210,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
  * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data
  *         will not be lost even if an error occurs.
  */
-int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size);
+int av_append_packet(AVIOContext *s, AVPacket *pkt, int size);
 
 /*************************************************/
 /* fractional numbers for exact pts handling */
@@ -321,7 +262,7 @@ typedef struct AVFormatParameters {
 #endif
 } AVFormatParameters;
 
-//! Demuxer will use url_fopen, no opened file should be provided by the caller.
+//! Demuxer will use avio_open, no opened file should be provided by the caller.
 #define AVFMT_NOFILE        0x0001
 #define AVFMT_NEEDNUMBER    0x0002 /**< Needs '%d' in filename. */
 #define AVFMT_SHOW_IDS      0x0008 /**< Show format stream IDs numbers. */
@@ -356,7 +297,9 @@ typedef struct AVOutputFormat {
     int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
     int (*write_trailer)(struct AVFormatContext *);
     /**
-     * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER
+     * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
+     * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
+     * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS
      */
     int flags;
     /**
@@ -532,6 +475,9 @@ typedef struct AVIndexEntry {
  * even when user did not explicitly ask for subtitles.
  */
 #define AV_DISPOSITION_FORCED    0x0040
+#define AV_DISPOSITION_HEARING_IMPAIRED  0x0080  /**< stream for hearing impaired audiences */
+#define AV_DISPOSITION_VISUAL_IMPAIRED   0x0100  /**< stream for visual impaired audiences */
+#define AV_DISPOSITION_CLEAN_EFFECTS     0x0200  /**< stream without voice */
 
 /**
  * Stream structure.
@@ -567,6 +513,8 @@ typedef struct AVStream {
      * This is the fundamental unit of time (in seconds) in terms
      * of which frame timestamps are represented. For fixed-fps content,
      * time base should be 1/framerate and timestamp increments should be 1.
+     * decoding: set by libavformat
+     * encoding: set by libavformat in av_write_header
      */
     AVRational time_base;
     int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
@@ -586,8 +534,6 @@ typedef struct AVStream {
      * Only set this if you are absolutely 100% sure that the value you set
      * it to really is the pts of the first frame.
      * This may be undefined (AV_NOPTS_VALUE).
-     * @note The ASF header does NOT contain a correct start_time the ASF
-     * demuxer must NOT set this.
      */
     int64_t start_time;
 
@@ -743,7 +689,7 @@ typedef struct AVFormatContext {
     struct AVInputFormat *iformat;
     struct AVOutputFormat *oformat;
     void *priv_data;
-    ByteIOContext *pb;
+    AVIOContext *pb;
     unsigned int nb_streams;
 #if FF_API_MAX_STREAMS
     AVStream *streams[MAX_STREAMS];
@@ -810,7 +756,9 @@ typedef struct AVFormatContext {
 
     /* av_seek_frame() support */
     int64_t data_offset; /**< offset of the first packet */
-    int index_built;
+#if FF_API_INDEX_BUILT
+    attribute_deprecated int index_built;
+#endif
 
     int mux_rate;
     unsigned int packet_size;
@@ -951,7 +899,9 @@ AVInputFormat  *av_iformat_next(AVInputFormat  *f);
  */
 AVOutputFormat *av_oformat_next(AVOutputFormat *f);
 
-enum CodecID av_guess_image2_codec(const char *filename);
+#if FF_API_GUESS_IMG2_CODEC
+attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename);
+#endif
 
 /* XXX: Use automatic init with either ELF sections or C file parser */
 /* modules. */
@@ -1002,7 +952,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
  * @param buf buffer
  * @param size buffer size
  *
- * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log
+ * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2
  */
 void av_hex_dump(FILE *f, uint8_t *buf, int size);
 
@@ -1016,7 +966,7 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size);
  * @param buf buffer
  * @param size buffer size
  *
- * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log
+ * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2
  */
 void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);
 
@@ -1026,8 +976,10 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);
  * @param f The file stream pointer where the dump should be sent to.
  * @param pkt packet to dump
  * @param dump_payload True if the payload must be displayed, too.
+ * @param st AVStream that the packet belongs to
  */
-void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
+void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st);
+
 
 /**
  * Send a nice dump of a packet to the log.
@@ -1038,8 +990,16 @@ void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
  * higher importance.
  * @param pkt packet to dump
  * @param dump_payload True if the payload must be displayed, too.
+ * @param st AVStream that the packet belongs to
  */
-void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload);
+void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
+                      AVStream *st);
+
+#if FF_API_PKT_DUMP
+attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
+attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt,
+                                          int dump_payload);
+#endif
 
 /**
  * Initialize libavformat and register all the muxers, demuxers and
@@ -1099,11 +1059,30 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
 AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
 
 /**
+ * Probe a bytestream to determine the input format. Each time a probe returns
+ * with a score that is too low, the probe buffer size is increased and another
+ * attempt is made. When the maximum probe size is reached, the input format
+ * with the highest score is returned.
+ *
+ * @param pb the bytestream to probe
+ * @param fmt the input format is put here
+ * @param filename the filename of the stream
+ * @param logctx the log context
+ * @param offset the offset within the bytestream to probe from
+ * @param max_probe_size the maximum probe buffer size (zero for default)
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code otherwise
+ */
+int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
+                          const char *filename, void *logctx,
+                          unsigned int offset, unsigned int max_probe_size);
+
+/**
  * Allocate all the structures needed to read an input stream.
  *        This does not open the needed codecs for decoding the stream[s].
  */
 int av_open_input_stream(AVFormatContext **ic_ptr,
-                         ByteIOContext *pb, const char *filename,
+                         AVIOContext *pb, const char *filename,
                          AVInputFormat *fmt, AVFormatParameters *ap);
 
 /**
@@ -1132,8 +1111,8 @@ attribute_deprecated AVFormatContext *av_alloc_format_context(void);
 
 /**
  * Allocate an AVFormatContext.
- * Can be freed with av_free() but do not forget to free everything you
- * explicitly allocated as well!
+ * avformat_free_context() can be used to free the context and everything
+ * allocated by the framework within it.
  */
 AVFormatContext *avformat_alloc_context(void);
 
@@ -1290,6 +1269,12 @@ void av_close_input_stream(AVFormatContext *s);
 void av_close_input_file(AVFormatContext *s);
 
 /**
+ * Free an AVFormatContext and all its streams.
+ * @param s context to free
+ */
+void avformat_free_context(AVFormatContext *s);
+
+/**
  * Add a new stream to a media file.
  *
  * Can only be called in the read_header() function. If the flag
@@ -1303,23 +1288,8 @@ AVStream *av_new_stream(AVFormatContext *s, int id);
 AVProgram *av_new_program(AVFormatContext *s, int id);
 
 /**
- * Add a new chapter.
- * This function is NOT part of the public API
- * and should ONLY be used by demuxers.
- *
- * @param s media file handle
- * @param id unique ID for this chapter
- * @param start chapter start time in time_base units
- * @param end chapter end time in time_base units
- * @param title chapter title
- *
- * @return AVChapter or NULL on error
- */
-AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
-                          int64_t start, int64_t end, const char *title);
-
-/**
- * Set the pts for a given stream.
+ * Set the pts for a given stream. If the new values would be invalid
+ * (<= 0), it leaves the AVStream unchanged.
  *
  * @param s stream
  * @param pts_wrap_bits number of bits effectively used by the pts
@@ -1348,15 +1318,6 @@ int av_find_default_stream_index(AVFormatContext *s);
 int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
 
 /**
- * Ensure the index uses less memory than the maximum specified in
- * AVFormatContext.max_index_size by discarding entries if it grows
- * too large.
- * This function is not part of the public API and should only be called
- * by demuxers.
- */
-void ff_reduce_index(AVFormatContext *s, int stream_index);
-
-/**
  * Add an index entry into a sorted list. Update the entry if the list
  * already contains it.
  *
@@ -1434,6 +1395,8 @@ void av_url_split(char *proto,         int proto_size,
 /**
  * Allocate the stream private data and write the stream header to an
  * output media file.
+ * @note: this sets stream time-bases, if possible to stream->codec->time_base
+ * but for some formats it might also be some other time base
  *
  * @param s media file handle
  * @return 0 if OK, AVERROR_xxx on error
@@ -1500,10 +1463,17 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
  */
 int av_write_trailer(AVFormatContext *s);
 
-void dump_format(AVFormatContext *ic,
-                 int index,
-                 const char *url,
-                 int is_output);
+#if FF_API_DUMP_FORMAT
+attribute_deprecated void dump_format(AVFormatContext *ic,
+                                      int index,
+                                      const char *url,
+                                      int is_output);
+#endif
+
+void av_dump_format(AVFormatContext *ic,
+                    int index,
+                    const char *url,
+                    int is_output);
 
 #if FF_API_PARSE_FRAME_PARAM
 /**
@@ -1521,53 +1491,29 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
                                           const char *arg);
 #endif
 
+#if FF_API_PARSE_DATE
 /**
  * Parse datestr and return a corresponding number of microseconds.
+ *
  * @param datestr String representing a date or a duration.
- * - If a date the syntax is:
- * @code
- *  now|{[{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z|z]}
- * @endcode
- * If the value is "now" it takes the current time.
- * Time is local time unless Z is appended, in which case it is
- * interpreted as UTC.
- * If the year-month-day part is not specified it takes the current
- * year-month-day.
- * @return the number of microseconds since 1st of January, 1970 up to
- * the time of the parsed date or INT64_MIN if datestr cannot be
- * successfully parsed.
- * - If a duration the syntax is:
- * @code
- *  [-]HH[:MM[:SS[.m...]]]
- *  [-]S+[.m...]
- * @endcode
- * @return the number of microseconds contained in a time interval
- * with the specified duration or INT64_MIN if datestr cannot be
- * successfully parsed.
- * @param duration Flag which tells how to interpret datestr, if
- * not zero datestr is interpreted as a duration, otherwise as a
- * date.
+ * See av_parse_time() for the syntax of the provided string.
+ * @deprecated in favor of av_parse_time()
  */
+attribute_deprecated
 int64_t parse_date(const char *datestr, int duration);
+#endif
 
 /**
  * Get the current time in microseconds.
  */
 int64_t av_gettime(void);
 
-/* ffm-specific for ffserver */
-#define FFM_PACKET_SIZE 4096
-int64_t ffm_read_write_index(int fd);
-int ffm_write_write_index(int fd, int64_t pos);
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
-
+#if FF_API_FIND_INFO_TAG
 /**
- * Attempt to find a specific tag in a URL.
- *
- * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
- * Return 1 if found.
+ * @deprecated use av_find_info_tag in libavutil instead.
  */
-int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
+attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
+#endif
 
 /**
  * Return in 'buf' the path with '%d' replaced by a number.
@@ -1601,12 +1547,16 @@ int av_filename_number_test(const char *filename);
  *           all the contexts in the array (an AVCodecContext per RTP stream)
  *           must contain only one AVStream.
  * @param n_files number of AVCodecContexts contained in ac
- * @param buff buffer where the SDP will be stored (must be allocated by
- *             the caller)
+ * @param buf buffer where the SDP will be stored (must be allocated by
+ *            the caller)
  * @param size the size of the buffer
  * @return 0 if OK, AVERROR_xxx on error
  */
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
+int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size);
+
+#if FF_API_SDP_CREATE
+attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
+#endif
 
 /**
  * Return a positive value if the given filename has one of the given
diff --git a/ffmpeg-mt/libavformat/avi.c b/ffmpeg-mt/libavformat/avi.c
index 705ad03..9f36b27 100644
--- a/ffmpeg-mt/libavformat/avi.c
+++ b/ffmpeg-mt/libavformat/avi.c
@@ -2,20 +2,20 @@
  * AVI common data
  * Copyright (c) 2010 Anton Khirnov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/avi.h b/ffmpeg-mt/libavformat/avi.h
index f345c14..05e0297 100644
--- a/ffmpeg-mt/libavformat/avi.h
+++ b/ffmpeg-mt/libavformat/avi.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,6 +32,7 @@
 
 #define AVI_MAX_RIFF_SIZE       0x40000000LL
 #define AVI_MASTER_INDEX_SIZE   256
+#define AVI_MAX_STREAM_COUNT    100
 
 /* index flags */
 #define AVIIF_INDEX             0x10
diff --git a/ffmpeg-mt/libavformat/avidec.c b/ffmpeg-mt/libavformat/avidec.c
index 15f48e8..ae8d320 100644
--- a/ffmpeg-mt/libavformat/avidec.c
+++ b/ffmpeg-mt/libavformat/avidec.c
@@ -2,20 +2,20 @@
  * AVI demuxer
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,6 @@
 #include <strings.h>
 #include "libavutil/intreadwrite.h"
 #include "libavutil/bswap.h"
-#include "libavcodec/bytestream.h"
 #include "avformat.h"
 #include "avi.h"
 #include "dv.h"
@@ -84,17 +83,13 @@ static const char avi_headers[][8] = {
 static int avi_load_index(AVFormatContext *s);
 static int guess_ni_flag(AVFormatContext *s);
 
-#ifdef DEBUG
-static void print_tag(const char *str, unsigned int tag, int size)
-{
-    dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n",
-           str, tag & 0xff,
-           (tag >> 8) & 0xff,
-           (tag >> 16) & 0xff,
-           (tag >> 24) & 0xff,
-           size);
-}
-#endif
+#define print_tag(str, tag, size)                       \
+    av_dlog(NULL, "%s: tag=%c%c%c%c size=0x%x\n",       \
+           str, tag & 0xff,                             \
+           (tag >> 8) & 0xff,                           \
+           (tag >> 16) & 0xff,                          \
+           (tag >> 24) & 0xff,                          \
+           size)
 
 static inline int get_duration(AVIStream *ast, int len){
     if(ast->sample_size){
@@ -105,17 +100,17 @@ static inline int get_duration(AVIStream *ast, int len){
         return 1;
 }
 
-static int get_riff(AVFormatContext *s, ByteIOContext *pb)
+static int get_riff(AVFormatContext *s, AVIOContext *pb)
 {
     AVIContext *avi = s->priv_data;
     char header[8];
     int i;
 
     /* check RIFF header */
-    get_buffer(pb, header, 4);
-    avi->riff_end = get_le32(pb);   /* RIFF chunk size */
-    avi->riff_end += url_ftell(pb); /* RIFF chunk end */
-    get_buffer(pb, header+4, 4);
+    avio_read(pb, header, 4);
+    avi->riff_end = avio_rl32(pb);  /* RIFF chunk size */
+    avi->riff_end += avio_tell(pb); /* RIFF chunk end */
+    avio_read(pb, header+4, 4);
 
     for(i=0; avi_headers[i][0]; i++)
         if(!memcmp(header, avi_headers[i], 8))
@@ -131,19 +126,19 @@ static int get_riff(AVFormatContext *s, ByteIOContext *pb)
 
 static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int longs_pre_entry= get_le16(pb);
-    int index_sub_type = get_byte(pb);
-    int index_type     = get_byte(pb);
-    int entries_in_use = get_le32(pb);
-    int chunk_id       = get_le32(pb);
-    int64_t base       = get_le64(pb);
+    AVIOContext *pb = s->pb;
+    int longs_pre_entry= avio_rl16(pb);
+    int index_sub_type = avio_r8(pb);
+    int index_type     = avio_r8(pb);
+    int entries_in_use = avio_rl32(pb);
+    int chunk_id       = avio_rl32(pb);
+    int64_t base       = avio_rl64(pb);
     int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0');
     AVStream *st;
     AVIStream *ast;
     int i;
     int64_t last_pos= -1;
-    int64_t filesize= url_fsize(s->pb);
+    int64_t filesize= avio_size(s->pb);
 
 #ifdef DEBUG_SEEK
     av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
@@ -158,7 +153,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
     if(index_sub_type)
         return -1;
 
-    get_le32(pb);
+    avio_rl32(pb);
 
     if(index_type && longs_pre_entry != 2)
         return -1;
@@ -175,15 +170,15 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
 
     for(i=0; i<entries_in_use; i++){
         if(index_type){
-            int64_t pos= get_le32(pb) + base - 8;
-            int len    = get_le32(pb);
+            int64_t pos= avio_rl32(pb) + base - 8;
+            int len    = avio_rl32(pb);
             int key= len >= 0;
             len &= 0x7FFFFFFF;
 
 #ifdef DEBUG_SEEK
             av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len);
 #endif
-            if(url_feof(pb))
+            if(pb->eof_reached)
                 return -1;
 
             if(last_pos == pos || pos == base - 8)
@@ -196,27 +191,27 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
         }else{
             int64_t offset, pos;
             int duration;
-            offset = get_le64(pb);
-            get_le32(pb);       /* size */
-            duration = get_le32(pb);
+            offset = avio_rl64(pb);
+            avio_rl32(pb);       /* size */
+            duration = avio_rl32(pb);
 
-            if(url_feof(pb))
+            if(pb->eof_reached)
                 return -1;
 
-            pos = url_ftell(pb);
+            pos = avio_tell(pb);
 
             if(avi->odml_depth > MAX_ODML_DEPTH){
                 av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n");
                 return -1;
             }
 
-            url_fseek(pb, offset+8, SEEK_SET);
+            avio_seek(pb, offset+8, SEEK_SET);
             avi->odml_depth++;
             read_braindead_odml_indx(s, frame_num);
             avi->odml_depth--;
             frame_num += duration;
 
-            url_fseek(pb, pos, SEEK_SET);
+            avio_seek(pb, pos, SEEK_SET);
         }
     }
     avi->index_loaded=1;
@@ -251,7 +246,7 @@ static void clean_index(AVFormatContext *s){
 
 static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     char key[5] = {0}, *value;
 
     size += (size & 1);
@@ -261,7 +256,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t
     value = av_malloc(size+1);
     if (!value)
         return -1;
-    get_buffer(pb, value, size);
+    avio_read(pb, value, size);
     value[size]=0;
 
     AV_WL32(key, tag);
@@ -272,9 +267,9 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t
 
 static void avi_read_info(AVFormatContext *s, uint64_t end)
 {
-    while (url_ftell(s->pb) < end) {
-        uint32_t tag  = get_le32(s->pb);
-        uint32_t size = get_le32(s->pb);
+    while (avio_tell(s->pb) < end) {
+        uint32_t tag  = avio_rl32(s->pb);
+        uint32_t size = avio_rl32(s->pb);
         avi_read_tag(s, NULL, tag, size);
     }
 }
@@ -303,18 +298,18 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date)
 
 static void avi_read_nikon(AVFormatContext *s, uint64_t end)
 {
-    while (url_ftell(s->pb) < end) {
-        uint32_t tag  = get_le32(s->pb);
-        uint32_t size = get_le32(s->pb);
+    while (avio_tell(s->pb) < end) {
+        uint32_t tag  = avio_rl32(s->pb);
+        uint32_t size = avio_rl32(s->pb);
         switch (tag) {
         case MKTAG('n', 'c', 't', 'g'): {  /* Nikon Tags */
-            uint64_t tag_end = url_ftell(s->pb) + size;
-            while (url_ftell(s->pb) < tag_end) {
-                uint16_t tag  = get_le16(s->pb);
-                uint16_t size = get_le16(s->pb);
+            uint64_t tag_end = avio_tell(s->pb) + size;
+            while (avio_tell(s->pb) < tag_end) {
+                uint16_t tag  = avio_rl16(s->pb);
+                uint16_t size = avio_rl16(s->pb);
                 const char *name = NULL;
                 char buffer[64] = {0};
-                size -= get_buffer(s->pb, buffer,
+                size -= avio_read(s->pb, buffer,
                                    FFMIN(size, sizeof(buffer)-1));
                 switch (tag) {
                 case 0x03:  name = "maker";  break;
@@ -326,12 +321,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
                 }
                 if (name)
                     av_metadata_set2(&s->metadata, name, buffer, 0);
-                url_fskip(s->pb, size);
+                avio_skip(s->pb, size);
             }
             break;
         }
         default:
-            url_fskip(s->pb, size);
+            avio_skip(s->pb, size);
             break;
         }
     }
@@ -340,7 +335,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
 static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int tag, tag1, handler;
     int codec_type, stream_index, frame_period, bit_rate;
     unsigned int size;
@@ -356,7 +351,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
     if (get_riff(s, pb) < 0)
         return -1;
 
-    avi->fsize = url_fsize(pb);
+    avi->fsize = avio_size(pb);
     if(avi->fsize<=0)
         avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end;
 
@@ -365,27 +360,26 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
     codec_type = -1;
     frame_period = 0;
     for(;;) {
-        if (url_feof(pb))
+        if (pb->eof_reached)
             goto fail;
-        tag = get_le32(pb);
-        size = get_le32(pb);
-#ifdef DEBUG
+        tag = avio_rl32(pb);
+        size = avio_rl32(pb);
+
         print_tag("tag", tag, size);
-#endif
 
         switch(tag) {
         case MKTAG('L', 'I', 'S', 'T'):
-            list_end = url_ftell(pb) + size;
+            list_end = avio_tell(pb) + size;
             /* Ignored, except at start of video packets. */
-            tag1 = get_le32(pb);
-#ifdef DEBUG
+            tag1 = avio_rl32(pb);
+
             print_tag("list", tag1, 0);
-#endif
+
             if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
-                avi->movi_list = url_ftell(pb) - 4;
+                avi->movi_list = avio_tell(pb) - 4;
                 if(size) avi->movi_end = avi->movi_list + size + (size & 1);
-                else     avi->movi_end = url_fsize(pb);
-                dprintf(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
+                else     avi->movi_end = avio_size(pb);
+                av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
                 goto end_of_header;
             }
             else if (tag1 == MKTAG('I', 'N', 'F', 'O'))
@@ -397,41 +391,41 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
         case MKTAG('I', 'D', 'I', 'T'): {
             unsigned char date[64] = {0};
             size += (size & 1);
-            size -= get_buffer(pb, date, FFMIN(size, sizeof(date)-1));
-            url_fskip(pb, size);
+            size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1));
+            avio_skip(pb, size);
             avi_metadata_creation_time(&s->metadata, date);
             break;
         }
         case MKTAG('d', 'm', 'l', 'h'):
             avi->is_odml = 1;
-            url_fskip(pb, size + (size & 1));
+            avio_skip(pb, size + (size & 1));
             break;
         case MKTAG('a', 'm', 'v', 'h'):
             amv_file_format=1;
         case MKTAG('a', 'v', 'i', 'h'):
             /* AVI header */
             /* using frame_period is bad idea */
-            frame_period = get_le32(pb);
-            bit_rate = get_le32(pb) * 8;
-            get_le32(pb);
-            avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX;
-
-            url_fskip(pb, 2 * 4);
-            get_le32(pb);
-            get_le32(pb);
-            avih_width=get_le32(pb);
-            avih_height=get_le32(pb);
-
-            url_fskip(pb, size - 10 * 4);
+            frame_period = avio_rl32(pb);
+            bit_rate = avio_rl32(pb) * 8;
+            avio_rl32(pb);
+            avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX;
+
+            avio_skip(pb, 2 * 4);
+            avio_rl32(pb);
+            avio_rl32(pb);
+            avih_width=avio_rl32(pb);
+            avih_height=avio_rl32(pb);
+
+            avio_skip(pb, size - 10 * 4);
             break;
         case MKTAG('s', 't', 'r', 'h'):
             /* stream header */
 
-            tag1 = get_le32(pb);
-            handler = get_le32(pb); /* codec tag */
+            tag1 = avio_rl32(pb);
+            handler = avio_rl32(pb); /* codec tag */
 
             if(tag1 == MKTAG('p', 'a', 'd', 's')){
-                url_fskip(pb, size - 8);
+                avio_skip(pb, size - 8);
                 break;
             }else{
                 stream_index++;
@@ -447,9 +441,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
             if(amv_file_format)
                 tag1 = stream_index ? MKTAG('a','u','d','s') : MKTAG('v','i','d','s');
 
-#ifdef DEBUG
             print_tag("strh", tag1, -1);
-#endif
+
             if(tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')){
                 int64_t dv_dur;
 
@@ -476,12 +469,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                         goto fail;
                 }
                 s->streams[0]->priv_data = ast;
-                url_fskip(pb, 3 * 4);
-                ast->scale = get_le32(pb);
-                ast->rate = get_le32(pb);
-                url_fskip(pb, 4);  /* start time */
+                avio_skip(pb, 3 * 4);
+                ast->scale = avio_rl32(pb);
+                ast->rate = avio_rl32(pb);
+                avio_skip(pb, 4);  /* start time */
 
-                dv_dur = get_le32(pb);
+                dv_dur = avio_rl32(pb);
                 if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
                     dv_dur *= AV_TIME_BASE;
                     s->duration = av_rescale(dv_dur, ast->scale, ast->rate);
@@ -492,19 +485,19 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                  */
 
                 stream_index = s->nb_streams - 1;
-                url_fskip(pb, size - 9*4);
+                avio_skip(pb, size - 9*4);
                 break;
             }
 
             assert(stream_index < s->nb_streams);
             st->codec->stream_codec_tag= handler;
 
-            get_le32(pb); /* flags */
-            get_le16(pb); /* priority */
-            get_le16(pb); /* language */
-            get_le32(pb); /* initial frame */
-            ast->scale = get_le32(pb);
-            ast->rate = get_le32(pb);
+            avio_rl32(pb); /* flags */
+            avio_rl16(pb); /* priority */
+            avio_rl16(pb); /* language */
+            avio_rl32(pb); /* initial frame */
+            ast->scale = avio_rl32(pb);
+            ast->rate = avio_rl32(pb);
             if(!(ast->scale && ast->rate)){
                 av_log(s, AV_LOG_WARNING, "scale/rate is %u/%u which is invalid. (This file has been generated by broken software.)\n", ast->scale, ast->rate);
                 if(frame_period){
@@ -517,13 +510,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
             }
             av_set_pts_info(st, 64, ast->scale, ast->rate);
 
-            ast->cum_len=get_le32(pb); /* start */
-            st->nb_frames = get_le32(pb);
+            ast->cum_len=avio_rl32(pb); /* start */
+            st->nb_frames = avio_rl32(pb);
 
             st->start_time = 0;
-            get_le32(pb); /* buffer size */
-            get_le32(pb); /* quality */
-            ast->sample_size = get_le32(pb); /* sample ssize */
+            avio_rl32(pb); /* buffer size */
+            avio_rl32(pb); /* quality */
+            ast->sample_size = avio_rl32(pb); /* sample ssize */
             ast->cum_len *= FFMAX(1, ast->sample_size);
 //            av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
 
@@ -549,14 +542,14 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
             if(ast->sample_size == 0)
                 st->duration = st->nb_frames;
             ast->frame_offset= ast->cum_len;
-            url_fskip(pb, size - 12 * 4);
+            avio_skip(pb, size - 12 * 4);
             break;
         case MKTAG('s', 't', 'r', 'f'):
             /* stream header */
             if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
-                url_fskip(pb, size);
+                avio_skip(pb, size);
             } else {
-                uint64_t cur_pos = url_ftell(pb);
+                uint64_t cur_pos = avio_tell(pb);
                 if (cur_pos < list_end)
                     size = FFMIN(size, list_end - cur_pos);
                 st = s->streams[stream_index];
@@ -567,7 +560,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                         st->codec->height=avih_height;
                         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
                         st->codec->codec_id = CODEC_ID_AMV;
-                        url_fskip(pb, size);
+                        avio_skip(pb, size);
                         break;
                     }
                     tag1 = ff_get_bmp_header(pb, st);
@@ -586,11 +579,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                             st->codec->extradata_size= 0;
                             return AVERROR(ENOMEM);
                         }
-                        get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
+                        avio_read(pb, st->codec->extradata, st->codec->extradata_size);
                     }
 
                     if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly
-                        get_byte(pb);
+                        avio_r8(pb);
 
                     /* Extract palette from extradata if bpp <= 8. */
                     /* This code assumes that extradata contains only palette. */
@@ -607,9 +600,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                         st->codec->palctrl->palette_changed = 1;
                     }
 
-#ifdef DEBUG
                     print_tag("video", tag1, 0);
-#endif
+
                     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
                     st->codec->codec_tag = tag1;
                     st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1);
@@ -628,7 +620,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                     }
                     st->codec->height= FFABS(st->codec->height);
 
-//                    url_fskip(pb, size - 5 * 4);
+//                    avio_skip(pb, size - 5 * 4);
                     break;
                 case AVMEDIA_TYPE_AUDIO:
                     ff_get_wav_header(pb, st->codec, size);
@@ -638,7 +630,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                         ast->sample_size= st->codec->block_align;
                     }
                     if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
-                        url_fskip(pb, 1);
+                        avio_skip(pb, 1);
                     /* Force parsing as several audio frames can be in
                      * one packet and timestamps refer to packet start. */
                     st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
@@ -666,34 +658,34 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                     st->codec->codec_type = AVMEDIA_TYPE_DATA;
                     st->codec->codec_id= CODEC_ID_NONE;
                     st->codec->codec_tag= 0;
-                    url_fskip(pb, size);
+                    avio_skip(pb, size);
                     break;
                 }
             }
             break;
         case MKTAG('i', 'n', 'd', 'x'):
-            i= url_ftell(pb);
-            if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){
+            i= avio_tell(pb);
+            if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX)){
                 read_braindead_odml_indx(s, 0);
             }
-            url_fseek(pb, i+size, SEEK_SET);
+            avio_seek(pb, i+size, SEEK_SET);
             break;
         case MKTAG('v', 'p', 'r', 'p'):
             if(stream_index < (unsigned)s->nb_streams && size > 9*4){
                 AVRational active, active_aspect;
 
                 st = s->streams[stream_index];
-                get_le32(pb);
-                get_le32(pb);
-                get_le32(pb);
-                get_le32(pb);
-                get_le32(pb);
-
-                active_aspect.den= get_le16(pb);
-                active_aspect.num= get_le16(pb);
-                active.num       = get_le32(pb);
-                active.den       = get_le32(pb);
-                get_le32(pb); //nbFieldsPerFrame
+                avio_rl32(pb);
+                avio_rl32(pb);
+                avio_rl32(pb);
+                avio_rl32(pb);
+                avio_rl32(pb);
+
+                active_aspect.den= avio_rl16(pb);
+                active_aspect.num= avio_rl16(pb);
+                active.num       = avio_rl32(pb);
+                active.den       = avio_rl32(pb);
+                avio_rl32(pb); //nbFieldsPerFrame
 
                 if(active_aspect.num && active_aspect.den && active.num && active.den){
                     st->sample_aspect_ratio= av_div_q(active_aspect, active);
@@ -701,7 +693,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 }
                 size -= 9*4;
             }
-            url_fseek(pb, size, SEEK_CUR);
+            avio_skip(pb, size);
             break;
         case MKTAG('s', 't', 'r', 'n'):
             if(s->nb_streams){
@@ -712,13 +704,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
             if(size > 1000000){
                 av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "
                                         "I will ignore it and try to continue anyway.\n");
-                avi->movi_list = url_ftell(pb) - 4;
-                avi->movi_end  = url_fsize(pb);
+                avi->movi_list = avio_tell(pb) - 4;
+                avi->movi_end  = avio_size(pb);
                 goto end_of_header;
             }
             /* skip tag */
             size += (size & 1);
-            url_fskip(pb, size);
+            avio_skip(pb, size);
             break;
         }
     }
@@ -729,7 +721,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return -1;
     }
 
-    if(!avi->index_loaded && !url_is_streamed(pb))
+    if(!avi->index_loaded && pb->seekable)
         avi_load_index(s);
     avi->index_loaded = 1;
     avi->non_interleaved |= guess_ni_flag(s);
@@ -755,39 +747,32 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
 static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
     if (!strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data+5) == 2) {
-        uint8_t desc[256], *d = desc;
-        uint8_t *end, *ptr = pkt->data+7;
-        unsigned int size, desc_len = bytestream_get_le32(&ptr);
-        int score = AVPROBE_SCORE_MAX / 2;
+        uint8_t desc[256];
+        int score = AVPROBE_SCORE_MAX / 2, ret;
         AVIStream *ast = st->priv_data;
         AVInputFormat *sub_demuxer;
         AVRational time_base;
-        ByteIOContext *pb;
+        AVIOContext *pb = avio_alloc_context( pkt->data + 7,
+                                              pkt->size - 7,
+                                              0, NULL, NULL, NULL, NULL);
         AVProbeData pd;
+        unsigned int desc_len = avio_rl32(pb);
 
-        if (desc_len > FFMAX(pkt->size-17, 0))
-            return 0;
+        if (desc_len > pb->buf_end - pb->buf_ptr)
+            goto error;
 
-        end = ptr + desc_len;
-        while (ptr < end-1) {
-            uint8_t tmp;
-            uint32_t ch;
-            GET_UTF16(ch, ptr < end-1 ? bytestream_get_le16(&ptr) : 0, break;);
-            PUT_UTF8(ch, tmp, if(d-desc < sizeof(desc)-1)  *d++ = tmp;);
-        }
-        *d = 0;
+        ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc));
+        avio_skip(pb, desc_len - ret);
         if (*desc)
             av_metadata_set2(&st->metadata, "title", desc, 0);
 
-        ptr = end + 2;
-        size = bytestream_get_le32(&ptr);
-        size = FFMIN(size, pkt->size+pkt->data-ptr);
+        avio_rl16(pb);   /* flags? */
+        avio_rl32(pb);   /* data size */
 
-        pd = (AVProbeData) { .buf = ptr, .buf_size = size };
+        pd = (AVProbeData) { .buf = pb->buf_ptr, .buf_size = pb->buf_end - pb->buf_ptr };
         if (!(sub_demuxer = av_probe_input_format2(&pd, 1, &score)))
-            return 0;
+            goto error;
 
-        pb = av_alloc_put_byte(ptr, size, 0, NULL, NULL, NULL, NULL);
         if (!av_open_input_stream(&ast->sub_ctx, pb, "", sub_demuxer, NULL)) {
             av_read_packet(ast->sub_ctx, &ast->sub_pkt);
             *st->codec = *ast->sub_ctx->streams[0]->codec;
@@ -798,6 +783,8 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
         ast->sub_buffer = pkt->data;
         memset(pkt, 0, sizeof(*pkt));
         return 1;
+error:
+        av_freep(&pb);
     }
     return 0;
 }
@@ -847,7 +834,7 @@ static int get_stream_idx(int *d){
 static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int n, d[8];
     unsigned int size;
     int64_t i, sync;
@@ -905,7 +892,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
         if(i>=0){
             int64_t pos= best_st->index_entries[i].pos;
             pos += best_ast->packet_size - best_ast->remaining;
-            url_fseek(s->pb, pos + 8, SEEK_SET);
+            avio_seek(s->pb, pos + 8, SEEK_SET);
 //        av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
 
             assert(best_ast->remaining <= best_ast->packet_size);
@@ -936,7 +923,7 @@ resync:
 
         if(size > ast->remaining)
             size= ast->remaining;
-        avi->last_pkt_pos= url_ftell(pb);
+        avi->last_pkt_pos= avio_tell(pb);
         err= av_get_packet(pb, pkt, size);
         if(err<0)
             return err;
@@ -1002,12 +989,12 @@ resync:
     }
 
     memset(d, -1, sizeof(int)*8);
-    for(i=sync=url_ftell(pb); !url_feof(pb); i++) {
+    for(i=sync=avio_tell(pb); !pb->eof_reached; i++) {
         int j;
 
         for(j=0; j<7; j++)
             d[j]= d[j+1];
-        d[7]= get_byte(pb);
+        d[7]= avio_r8(pb);
 
         size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
 
@@ -1021,14 +1008,14 @@ resync:
         //parse JUNK
            ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
            ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
-            url_fskip(pb, size);
+            avio_skip(pb, size);
 //av_log(s, AV_LOG_DEBUG, "SKIP\n");
             goto resync;
         }
 
         //parse stray LIST
         if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){
-            url_fskip(pb, 4);
+            avio_skip(pb, 4);
             goto resync;
         }
 
@@ -1039,7 +1026,7 @@ resync:
 
         //detect ##ix chunk and skip
         if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){
-            url_fskip(pb, size);
+            avio_skip(pb, size);
             goto resync;
         }
 
@@ -1073,18 +1060,18 @@ resync:
                /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
                || st->discard >= AVDISCARD_ALL){
                 ast->frame_offset += get_duration(ast, size);
-                url_fskip(pb, size);
+                avio_skip(pb, size);
                 goto resync;
             }
 
             if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) {
-                int k = get_byte(pb);
-                int last = (k + get_byte(pb) - 1) & 0xFF;
+                int k = avio_r8(pb);
+                int last = (k + avio_r8(pb) - 1) & 0xFF;
 
-                get_le16(pb); //flags
+                avio_rl16(pb); //flags
 
                 for (; k <= last; k++)
-                    ast->pal[k] = get_be32(pb)>>8;// b + (g << 8) + (r << 16);
+                    ast->pal[k] = avio_rb32(pb)>>8;// b + (g << 8) + (r << 16);
                 ast->has_pal= 1;
                 goto resync;
             } else if(   ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) ||
@@ -1105,7 +1092,7 @@ resync:
                 ast->remaining= size;
 
                 if(size || !ast->sample_size){
-                    uint64_t pos= url_ftell(pb) - 8;
+                    uint64_t pos= avio_tell(pb) - 8;
                     if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
                         av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
                     }
@@ -1123,7 +1110,7 @@ resync:
 static int avi_read_idx1(AVFormatContext *s, int size)
 {
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int nb_index_entries, i;
     AVStream *st;
     AVIStream *ast;
@@ -1136,10 +1123,10 @@ static int avi_read_idx1(AVFormatContext *s, int size)
 
     /* Read the entries and sort them in each stream component. */
     for(i = 0; i < nb_index_entries; i++) {
-        tag = get_le32(pb);
-        flags = get_le32(pb);
-        pos = get_le32(pb);
-        len = get_le32(pb);
+        tag = avio_rl32(pb);
+        flags = avio_rl32(pb);
+        pos = avio_rl32(pb);
+        len = avio_rl32(pb);
 #if defined(DEBUG_SEEK)
         av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
                i, tag, flags, pos, len);
@@ -1158,7 +1145,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
 #if defined(DEBUG_SEEK)
         av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
 #endif
-        if(url_feof(pb))
+        if(pb->eof_reached)
             return -1;
 
         if(last_pos == pos)
@@ -1175,7 +1162,7 @@ static int guess_ni_flag(AVFormatContext *s){
     int i;
     int64_t last_start=0;
     int64_t first_end= INT64_MAX;
-    int64_t oldpos= url_ftell(s->pb);
+    int64_t oldpos= avio_tell(s->pb);
 
     for(i=0; i<s->nb_streams; i++){
         AVStream *st = s->streams[i];
@@ -1187,8 +1174,8 @@ static int guess_ni_flag(AVFormatContext *s){
 
         if(n >= 2){
             int64_t pos= st->index_entries[0].pos;
-            url_fseek(s->pb, pos + 4, SEEK_SET);
-            size= get_le32(s->pb);
+            avio_seek(s->pb, pos + 4, SEEK_SET);
+            size= avio_rl32(s->pb);
             if(pos + size > st->index_entries[1].pos)
                 last_start= INT64_MAX;
         }
@@ -1198,28 +1185,28 @@ static int guess_ni_flag(AVFormatContext *s){
         if(st->index_entries[n-1].pos < first_end)
             first_end= st->index_entries[n-1].pos;
     }
-    url_fseek(s->pb, oldpos, SEEK_SET);
+    avio_seek(s->pb, oldpos, SEEK_SET);
     return last_start > first_end;
 }
 
 static int avi_load_index(AVFormatContext *s)
 {
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint32_t tag, size;
-    int64_t pos= url_ftell(pb);
+    int64_t pos= avio_tell(pb);
     int ret = -1;
 
-    if (url_fseek(pb, avi->movi_end, SEEK_SET) < 0)
+    if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
         goto the_end; // maybe truncated file
 #ifdef DEBUG_SEEK
     printf("movi_end=0x%"PRIx64"\n", avi->movi_end);
 #endif
     for(;;) {
-        if (url_feof(pb))
+        if (pb->eof_reached)
             break;
-        tag = get_le32(pb);
-        size = get_le32(pb);
+        tag = avio_rl32(pb);
+        size = avio_rl32(pb);
 #ifdef DEBUG_SEEK
         printf("tag=%c%c%c%c size=0x%x\n",
                tag & 0xff,
@@ -1238,13 +1225,13 @@ static int avi_load_index(AVFormatContext *s)
         default:
         skip:
             size += (size & 1);
-            if (url_fseek(pb, size, SEEK_CUR) < 0)
+            if (avio_skip(pb, size) < 0)
                 goto the_end; // something is wrong here
             break;
         }
     }
  the_end:
-    url_fseek(pb, pos, SEEK_SET);
+    avio_seek(pb, pos, SEEK_SET);
     return ret;
 }
 
@@ -1295,7 +1282,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
         /* DV demux so it can synthesize correct timestamps.        */
         dv_offset_reset(avi->dv_demux, timestamp);
 
-        url_fseek(s->pb, pos, SEEK_SET);
+        avio_seek(s->pb, pos, SEEK_SET);
         avi->stream_index= -1;
         return 0;
     }
@@ -1337,7 +1324,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     }
 
     /* do the seek */
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
     avi->stream_index= -1;
     return 0;
 }
@@ -1361,8 +1348,7 @@ static int avi_read_close(AVFormatContext *s)
         }
     }
 
-    if (avi->dv_demux)
-        av_free(avi->dv_demux);
+    av_free(avi->dv_demux);
 
     return 0;
 }
@@ -1380,7 +1366,7 @@ static int avi_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat avi_demuxer = {
+AVInputFormat ff_avi_demuxer = {
     "avi",
     NULL_IF_CONFIG_SMALL("AVI format"),
     sizeof(AVIContext),
diff --git a/ffmpeg-mt/libavformat/avienc.c b/ffmpeg-mt/libavformat/avienc.c
index c9476d5..1b6f645 100644
--- a/ffmpeg-mt/libavformat/avienc.c
+++ b/ffmpeg-mt/libavformat/avienc.c
@@ -2,24 +2,25 @@
  * AVI muxer
  * Copyright (c) 2000 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
 #include "avi.h"
+#include "avio_internal.h"
 #include "riff.h"
 #include "libavutil/intreadwrite.h"
 
@@ -63,7 +64,7 @@ static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
     return &idx->cluster[cl][id];
 }
 
-static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb,
+static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb,
                                   const char* riff_tag, const char* list_tag)
 {
     AVIContext *avi= s->priv_data;
@@ -77,16 +78,16 @@ static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb,
     }
 
     avi->riff_start = ff_start_tag(pb, "RIFF");
-    put_tag(pb, riff_tag);
+    ffio_wfourcc(pb, riff_tag);
     loff = ff_start_tag(pb, "LIST");
-    put_tag(pb, list_tag);
+    ffio_wfourcc(pb, list_tag);
     return loff;
 }
 
 static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
 {
-    tag[0] = '0';
-    tag[1] = '0' + index;
+    tag[0] = '0' + index/10;
+    tag[1] = '0' + index%10;
     if (type == AVMEDIA_TYPE_VIDEO) {
         tag[2] = 'd';
         tag[3] = 'c';
@@ -102,49 +103,49 @@ static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
     return tag;
 }
 
-static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str)
+static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
 {
     int len = strlen(str);
     if (len > 0) {
         len++;
-        put_tag(pb, tag);
-        put_le32(pb, len);
-        put_strz(pb, str);
+        ffio_wfourcc(pb, tag);
+        avio_wl32(pb, len);
+        avio_put_str(pb, str);
         if (len & 1)
-            put_byte(pb, 0);
+            avio_w8(pb, 0);
     }
 }
 
 static int avi_write_counters(AVFormatContext* s, int riff_id)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVIContext *avi = s->priv_data;
     int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
     int64_t file_size;
     AVCodecContext* stream;
 
-    file_size = url_ftell(pb);
+    file_size = avio_tell(pb);
     for(n = 0; n < s->nb_streams; n++) {
         AVIStream *avist= s->streams[n]->priv_data;
 
         assert(avist->frames_hdr_strm);
         stream = s->streams[n]->codec;
-        url_fseek(pb, avist->frames_hdr_strm, SEEK_SET);
+        avio_seek(pb, avist->frames_hdr_strm, SEEK_SET);
         ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
         if(au_ssize == 0) {
-            put_le32(pb, avist->packet_count);
+            avio_wl32(pb, avist->packet_count);
         } else {
-            put_le32(pb, avist->audio_strm_length / au_ssize);
+            avio_wl32(pb, avist->audio_strm_length / au_ssize);
         }
         if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
             nb_frames = FFMAX(nb_frames, avist->packet_count);
     }
     if(riff_id == 1) {
         assert(avi->frames_hdr_all);
-        url_fseek(pb, avi->frames_hdr_all, SEEK_SET);
-        put_le32(pb, nb_frames);
+        avio_seek(pb, avi->frames_hdr_all, SEEK_SET);
+        avio_wl32(pb, nb_frames);
     }
-    url_fseek(pb, file_size, SEEK_SET);
+    avio_seek(pb, file_size, SEEK_SET);
 
     return 0;
 }
@@ -152,12 +153,18 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
 static int avi_write_header(AVFormatContext *s)
 {
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
     AVCodecContext *stream, *video_enc;
     int64_t list1, list2, strh, strf;
     AVMetadataTag *t = NULL;
 
+    if (s->nb_streams > AVI_MAX_STREAM_COUNT) {
+        av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n",
+               AVI_MAX_STREAM_COUNT);
+        return -1;
+    }
+
     for(n=0;n<s->nb_streams;n++) {
         s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream));
         if(!s->streams[n]->priv_data)
@@ -169,8 +176,8 @@ static int avi_write_header(AVFormatContext *s)
     list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl");
 
     /* avi header */
-    put_tag(pb, "avih");
-    put_le32(pb, 14 * 4);
+    ffio_wfourcc(pb, "avih");
+    avio_wl32(pb, 14 * 4);
     bitrate = 0;
 
     video_enc = NULL;
@@ -184,38 +191,38 @@ static int avi_write_header(AVFormatContext *s)
     nb_frames = 0;
 
     if(video_enc){
-        put_le32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den));
+        avio_wl32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den));
     } else {
-        put_le32(pb, 0);
+        avio_wl32(pb, 0);
     }
-    put_le32(pb, bitrate / 8); /* XXX: not quite exact */
-    put_le32(pb, 0); /* padding */
-    if (url_is_streamed(pb))
-        put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
+    avio_wl32(pb, bitrate / 8); /* XXX: not quite exact */
+    avio_wl32(pb, 0); /* padding */
+    if (!pb->seekable)
+        avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
     else
-        put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
-    avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
-    put_le32(pb, nb_frames); /* nb frames, filled later */
-    put_le32(pb, 0); /* initial frame */
-    put_le32(pb, s->nb_streams); /* nb streams */
-    put_le32(pb, 1024 * 1024); /* suggested buffer size */
+        avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
+    avi->frames_hdr_all = avio_tell(pb); /* remember this offset to fill later */
+    avio_wl32(pb, nb_frames); /* nb frames, filled later */
+    avio_wl32(pb, 0); /* initial frame */
+    avio_wl32(pb, s->nb_streams); /* nb streams */
+    avio_wl32(pb, 1024 * 1024); /* suggested buffer size */
     if(video_enc){
-        put_le32(pb, video_enc->width);
-        put_le32(pb, video_enc->height);
+        avio_wl32(pb, video_enc->width);
+        avio_wl32(pb, video_enc->height);
     } else {
-        put_le32(pb, 0);
-        put_le32(pb, 0);
+        avio_wl32(pb, 0);
+        avio_wl32(pb, 0);
     }
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
 
     /* stream list */
     for(i=0;i<n;i++) {
         AVIStream *avist= s->streams[i]->priv_data;
         list2 = ff_start_tag(pb, "LIST");
-        put_tag(pb, "strl");
+        ffio_wfourcc(pb, "strl");
 
         stream = s->streams[i]->codec;
 
@@ -229,46 +236,46 @@ static int avi_write_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n");
                 return AVERROR_PATCHWELCOME;
             }
-        case AVMEDIA_TYPE_VIDEO: put_tag(pb, "vids"); break;
-        case AVMEDIA_TYPE_AUDIO: put_tag(pb, "auds"); break;
-//        case AVMEDIA_TYPE_TEXT : put_tag(pb, "txts"); break;
-        case AVMEDIA_TYPE_DATA : put_tag(pb, "dats"); break;
+        case AVMEDIA_TYPE_VIDEO: ffio_wfourcc(pb, "vids"); break;
+        case AVMEDIA_TYPE_AUDIO: ffio_wfourcc(pb, "auds"); break;
+//      case AVMEDIA_TYPE_TEXT : ffio_wfourcc(pb, "txts"); break;
+        case AVMEDIA_TYPE_DATA : ffio_wfourcc(pb, "dats"); break;
         }
         if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
            stream->codec_id == CODEC_ID_XSUB)
-            put_le32(pb, stream->codec_tag);
+            avio_wl32(pb, stream->codec_tag);
         else
-            put_le32(pb, 1);
-        put_le32(pb, 0); /* flags */
-        put_le16(pb, 0); /* priority */
-        put_le16(pb, 0); /* language */
-        put_le32(pb, 0); /* initial frame */
+            avio_wl32(pb, 1);
+        avio_wl32(pb, 0); /* flags */
+        avio_wl16(pb, 0); /* priority */
+        avio_wl16(pb, 0); /* language */
+        avio_wl32(pb, 0); /* initial frame */
 
         ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
 
-        put_le32(pb, au_scale); /* scale */
-        put_le32(pb, au_byterate); /* rate */
+        avio_wl32(pb, au_scale); /* scale */
+        avio_wl32(pb, au_byterate); /* rate */
         av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
 
-        put_le32(pb, 0); /* start */
-        avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */
-        if (url_is_streamed(pb))
-            put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
+        avio_wl32(pb, 0); /* start */
+        avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */
+        if (!pb->seekable)
+            avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
         else
-            put_le32(pb, 0); /* length, XXX: filled later */
+            avio_wl32(pb, 0); /* length, XXX: filled later */
 
         /* suggested buffer size */ //FIXME set at the end to largest chunk
         if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
-            put_le32(pb, 1024 * 1024);
+            avio_wl32(pb, 1024 * 1024);
         else if(stream->codec_type == AVMEDIA_TYPE_AUDIO)
-            put_le32(pb, 12 * 1024);
+            avio_wl32(pb, 12 * 1024);
         else
-            put_le32(pb, 0);
-        put_le32(pb, -1); /* quality */
-        put_le32(pb, au_ssize); /* sample size */
-        put_le32(pb, 0);
-        put_le16(pb, stream->width);
-        put_le16(pb, stream->height);
+            avio_wl32(pb, 0);
+        avio_wl32(pb, -1); /* quality */
+        avio_wl32(pb, au_ssize); /* sample size */
+        avio_wl32(pb, 0);
+        avio_wl16(pb, stream->width);
+        avio_wl16(pb, stream->height);
         ff_end_tag(pb, strh);
 
       if(stream->codec_type != AVMEDIA_TYPE_DATA){
@@ -296,7 +303,7 @@ static int avi_write_header(AVFormatContext *s)
         }
       }
 
-        if (!url_is_streamed(pb)) {
+        if (pb->seekable) {
             unsigned char tag[5];
             int j;
 
@@ -307,16 +314,16 @@ static int avi_write_header(AVFormatContext *s)
              */
             avist->indexes.entry = avist->indexes.ents_allocated = 0;
             avist->indexes.indx_start = ff_start_tag(pb, "JUNK");
-            put_le16(pb, 4);        /* wLongsPerEntry */
-            put_byte(pb, 0);        /* bIndexSubType (0 == frame index) */
-            put_byte(pb, 0);        /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
-            put_le32(pb, 0);        /* nEntriesInUse (will fill out later on) */
-            put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
+            avio_wl16(pb, 4);        /* wLongsPerEntry */
+            avio_w8(pb, 0);          /* bIndexSubType (0 == frame index) */
+            avio_w8(pb, 0);          /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
+            avio_wl32(pb, 0);        /* nEntriesInUse (will fill out later on) */
+            ffio_wfourcc(pb, avi_stream2fourcc(tag, i, stream->codec_type));
                                     /* dwChunkId */
-            put_le64(pb, 0);        /* dwReserved[3]
-            put_le32(pb, 0);           Must be 0.    */
+            avio_wl64(pb, 0);        /* dwReserved[3]
+            avio_wl32(pb, 0);           Must be 0.    */
             for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++)
-                 put_le64(pb, 0);
+                 avio_wl64(pb, 0);
             ff_end_tag(pb, avist->indexes.indx_start);
         }
 
@@ -329,47 +336,47 @@ static int avi_write_header(AVFormatContext *s)
             int num, den;
             av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
 
-            put_le32(pb, 0); //video format  = unknown
-            put_le32(pb, 0); //video standard= unknown
-            put_le32(pb, lrintf(1.0/av_q2d(stream->time_base)));
-            put_le32(pb, stream->width );
-            put_le32(pb, stream->height);
-            put_le16(pb, den);
-            put_le16(pb, num);
-            put_le32(pb, stream->width );
-            put_le32(pb, stream->height);
-            put_le32(pb, 1); //progressive FIXME
-
-            put_le32(pb, stream->height);
-            put_le32(pb, stream->width );
-            put_le32(pb, stream->height);
-            put_le32(pb, stream->width );
-            put_le32(pb, 0);
-            put_le32(pb, 0);
-
-            put_le32(pb, 0);
-            put_le32(pb, 0);
+            avio_wl32(pb, 0); //video format  = unknown
+            avio_wl32(pb, 0); //video standard= unknown
+            avio_wl32(pb, lrintf(1.0/av_q2d(stream->time_base)));
+            avio_wl32(pb, stream->width );
+            avio_wl32(pb, stream->height);
+            avio_wl16(pb, den);
+            avio_wl16(pb, num);
+            avio_wl32(pb, stream->width );
+            avio_wl32(pb, stream->height);
+            avio_wl32(pb, 1); //progressive FIXME
+
+            avio_wl32(pb, stream->height);
+            avio_wl32(pb, stream->width );
+            avio_wl32(pb, stream->height);
+            avio_wl32(pb, stream->width );
+            avio_wl32(pb, 0);
+            avio_wl32(pb, 0);
+
+            avio_wl32(pb, 0);
+            avio_wl32(pb, 0);
             ff_end_tag(pb, vprp);
         }
 
         ff_end_tag(pb, list2);
     }
 
-    if (!url_is_streamed(pb)) {
+    if (pb->seekable) {
         /* AVI could become an OpenDML one, if it grows beyond 2Gb range */
         avi->odml_list = ff_start_tag(pb, "JUNK");
-        put_tag(pb, "odml");
-        put_tag(pb, "dmlh");
-        put_le32(pb, 248);
+        ffio_wfourcc(pb, "odml");
+        ffio_wfourcc(pb, "dmlh");
+        avio_wl32(pb, 248);
         for (i = 0; i < 248; i+= 4)
-             put_le32(pb, 0);
+             avio_wl32(pb, 0);
         ff_end_tag(pb, avi->odml_list);
     }
 
     ff_end_tag(pb, list1);
 
     list2 = ff_start_tag(pb, "LIST");
-    put_tag(pb, "INFO");
+    ffio_wfourcc(pb, "INFO");
     ff_metadata_conv(&s->metadata, ff_avi_metadata_conv, NULL);
     for (i = 0; *ff_avi_tags[i]; i++) {
         if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE)))
@@ -380,26 +387,26 @@ static int avi_write_header(AVFormatContext *s)
     /* some padding for easier tag editing */
     list2 = ff_start_tag(pb, "JUNK");
     for (i = 0; i < 1016; i += 4)
-        put_le32(pb, 0);
+        avio_wl32(pb, 0);
     ff_end_tag(pb, list2);
 
     avi->movi_list = ff_start_tag(pb, "LIST");
-    put_tag(pb, "movi");
+    ffio_wfourcc(pb, "movi");
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
 static int avi_write_ix(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVIContext *avi = s->priv_data;
     char tag[5];
     char ix_tag[] = "ix00";
     int i, j;
 
-    assert(!url_is_streamed(pb));
+    assert(pb->seekable);
 
     if (avi->riff_id > AVI_MASTER_INDEX_SIZE)
         return -1;
@@ -408,56 +415,56 @@ static int avi_write_ix(AVFormatContext *s)
         AVIStream *avist= s->streams[i]->priv_data;
          int64_t ix, pos;
 
-         avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
+         avi_stream2fourcc(tag, i, s->streams[i]->codec->codec_type);
          ix_tag[3] = '0' + i;
 
          /* Writing AVI OpenDML leaf index chunk */
-         ix = url_ftell(pb);
-         put_tag(pb, &ix_tag[0]);     /* ix?? */
-         put_le32(pb, avist->indexes.entry * 8 + 24);
+         ix = avio_tell(pb);
+         ffio_wfourcc(pb, ix_tag);     /* ix?? */
+         avio_wl32(pb, avist->indexes.entry * 8 + 24);
                                       /* chunk size */
-         put_le16(pb, 2);             /* wLongsPerEntry */
-         put_byte(pb, 0);             /* bIndexSubType (0 == frame index) */
-         put_byte(pb, 1);             /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */
-         put_le32(pb, avist->indexes.entry);
+         avio_wl16(pb, 2);             /* wLongsPerEntry */
+         avio_w8(pb, 0);             /* bIndexSubType (0 == frame index) */
+         avio_w8(pb, 1);             /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */
+         avio_wl32(pb, avist->indexes.entry);
                                       /* nEntriesInUse */
-         put_tag(pb, &tag[0]);        /* dwChunkId */
-         put_le64(pb, avi->movi_list);/* qwBaseOffset */
-         put_le32(pb, 0);             /* dwReserved_3 (must be 0) */
+         ffio_wfourcc(pb, tag);        /* dwChunkId */
+         avio_wl64(pb, avi->movi_list);/* qwBaseOffset */
+         avio_wl32(pb, 0);             /* dwReserved_3 (must be 0) */
 
          for (j=0; j<avist->indexes.entry; j++) {
              AVIIentry* ie = avi_get_ientry(&avist->indexes, j);
-             put_le32(pb, ie->pos + 8);
-             put_le32(pb, ((uint32_t)ie->len & ~0x80000000) |
+             avio_wl32(pb, ie->pos + 8);
+             avio_wl32(pb, ((uint32_t)ie->len & ~0x80000000) |
                           (ie->flags & 0x10 ? 0 : 0x80000000));
          }
-         put_flush_packet(pb);
-         pos = url_ftell(pb);
+         avio_flush(pb);
+         pos = avio_tell(pb);
 
          /* Updating one entry in the AVI OpenDML master index */
-         url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET);
-         put_tag(pb, "indx");                 /* enabling this entry */
-         url_fskip(pb, 8);
-         put_le32(pb, avi->riff_id);          /* nEntriesInUse */
-         url_fskip(pb, 16*avi->riff_id);
-         put_le64(pb, ix);                    /* qwOffset */
-         put_le32(pb, pos - ix);              /* dwSize */
-         put_le32(pb, avist->indexes.entry); /* dwDuration */
-
-         url_fseek(pb, pos, SEEK_SET);
+         avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET);
+         ffio_wfourcc(pb, "indx");            /* enabling this entry */
+         avio_skip(pb, 8);
+         avio_wl32(pb, avi->riff_id);         /* nEntriesInUse */
+         avio_skip(pb, 16*avi->riff_id);
+         avio_wl64(pb, ix);                   /* qwOffset */
+         avio_wl32(pb, pos - ix);             /* dwSize */
+         avio_wl32(pb, avist->indexes.entry); /* dwDuration */
+
+         avio_seek(pb, pos, SEEK_SET);
     }
     return 0;
 }
 
 static int avi_write_idx1(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVIContext *avi = s->priv_data;
     int64_t idx_chunk;
     int i;
     char tag[5];
 
-    if (!url_is_streamed(pb)) {
+    if (pb->seekable) {
         AVIStream *avist;
         AVIIentry* ie = 0, *tie;
         int empty, stream_id = -1;
@@ -484,12 +491,12 @@ static int avi_write_idx1(AVFormatContext *s)
             }
             if (!empty) {
                 avist= s->streams[stream_id]->priv_data;
-                avi_stream2fourcc(&tag[0], stream_id,
+                avi_stream2fourcc(tag, stream_id,
                                   s->streams[stream_id]->codec->codec_type);
-                put_tag(pb, &tag[0]);
-                put_le32(pb, ie->flags);
-                put_le32(pb, ie->pos);
-                put_le32(pb, ie->len);
+                ffio_wfourcc(pb, tag);
+                avio_wl32(pb, ie->flags);
+                avio_wl32(pb, ie->pos);
+                avio_wl32(pb, ie->len);
                 avist->entry++;
             }
         } while (!empty);
@@ -503,7 +510,7 @@ static int avi_write_idx1(AVFormatContext *s)
 static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned char tag[5];
     unsigned int flags=0;
     const int stream_index= pkt->stream_index;
@@ -525,8 +532,8 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
     avist->packet_count++;
 
     // Make sure to put an OpenDML chunk when the file size exceeds the limits
-    if (!url_is_streamed(pb) &&
-        (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
+    if (pb->seekable &&
+        (avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
 
         avi_write_ix(s);
         ff_end_tag(pb, avi->movi_list);
@@ -538,14 +545,14 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
         avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi");
     }
 
-    avi_stream2fourcc(&tag[0], stream_index, enc->codec_type);
+    avi_stream2fourcc(tag, stream_index, enc->codec_type);
     if(pkt->flags&AV_PKT_FLAG_KEY)
         flags = 0x10;
     if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
        avist->audio_strm_length += size;
     }
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
         AVIIndex* idx = &avist->indexes;
         int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE;
         int id = idx->entry % AVI_INDEX_CLUSTER_SIZE;
@@ -560,30 +567,30 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
         }
 
         idx->cluster[cl][id].flags = flags;
-        idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
+        idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list;
         idx->cluster[cl][id].len = size;
         idx->entry++;
     }
 
-    put_buffer(pb, tag, 4);
-    put_le32(pb, size);
-    put_buffer(pb, pkt->data, size);
+    avio_write(pb, tag, 4);
+    avio_wl32(pb, size);
+    avio_write(pb, pkt->data, size);
     if (size & 1)
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
 
-    put_flush_packet(pb);
+    avio_flush(pb);
     return 0;
 }
 
 static int avi_write_trailer(AVFormatContext *s)
 {
     AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int res = 0;
     int i, j, n, nb_frames;
     int64_t file_size;
 
-    if (!url_is_streamed(pb)){
+    if (pb->seekable){
         if (avi->riff_id == 1) {
             ff_end_tag(pb, avi->movi_list);
             res = avi_write_idx1(s);
@@ -593,10 +600,10 @@ static int avi_write_trailer(AVFormatContext *s)
             ff_end_tag(pb, avi->movi_list);
             ff_end_tag(pb, avi->riff_start);
 
-            file_size = url_ftell(pb);
-            url_fseek(pb, avi->odml_list - 8, SEEK_SET);
-            put_tag(pb, "LIST"); /* Making this AVI OpenDML one */
-            url_fskip(pb, 16);
+            file_size = avio_tell(pb);
+            avio_seek(pb, avi->odml_list - 8, SEEK_SET);
+            ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */
+            avio_skip(pb, 16);
 
             for (n=nb_frames=0;n<s->nb_streams;n++) {
                 AVCodecContext *stream = s->streams[n]->codec;
@@ -611,13 +618,13 @@ static int avi_write_trailer(AVFormatContext *s)
                     }
                 }
             }
-            put_le32(pb, nb_frames);
-            url_fseek(pb, file_size, SEEK_SET);
+            avio_wl32(pb, nb_frames);
+            avio_seek(pb, file_size, SEEK_SET);
 
             avi_write_counters(s, avi->riff_id);
         }
     }
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     for (i=0; i<s->nb_streams; i++) {
          AVIStream *avist= s->streams[i]->priv_data;
@@ -630,7 +637,7 @@ static int avi_write_trailer(AVFormatContext *s)
     return res;
 }
 
-AVOutputFormat avi_muxer = {
+AVOutputFormat ff_avi_muxer = {
     "avi",
     NULL_IF_CONFIG_SMALL("AVI format"),
     "video/x-msvideo",
diff --git a/ffmpeg-mt/libavformat/avio.c b/ffmpeg-mt/libavformat/avio.c
index 9a4d735..ad1f1b4 100644
--- a/ffmpeg-mt/libavformat/avio.c
+++ b/ffmpeg-mt/libavformat/avio.c
@@ -2,20 +2,20 @@
  * Unbuffered io for ffmpeg system
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,6 +29,7 @@
 #if CONFIG_NETWORK
 #include "network.h"
 #endif
+#include "url.h"
 
 #if FF_API_URL_CLASS
 /** @name Logging context. */
@@ -48,15 +49,27 @@ static const AVClass urlcontext_class =
 static int default_interrupt_cb(void);
 
 URLProtocol *first_protocol = NULL;
-URLInterruptCB *url_interrupt_cb = default_interrupt_cb;
+int (*url_interrupt_cb)(void) = default_interrupt_cb;
 
+#if FF_API_OLD_AVIO
 URLProtocol *av_protocol_next(URLProtocol *p)
 {
     if(p) return p->next;
     else  return first_protocol;
 }
+#endif
 
-int av_register_protocol2(URLProtocol *protocol, int size)
+const char *avio_enum_protocols(void **opaque, int output)
+{
+    URLProtocol **p = opaque;
+    *p = *p ? (*p)->next : first_protocol;
+    if (!*p) return NULL;
+    if ((output && (*p)->url_write) || (!output && (*p)->url_read))
+        return (*p)->name;
+    return avio_enum_protocols(opaque, output);
+}
+
+int ffurl_register_protocol(URLProtocol *protocol, int size)
 {
     URLProtocol **p;
     if (size < sizeof(URLProtocol)) {
@@ -85,12 +98,12 @@ struct URLProtocol_compat {
 
 int av_register_protocol(URLProtocol *protocol)
 {
-    return av_register_protocol2(protocol, sizeof(struct URLProtocol_compat));
+    return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
 }
 
 int register_protocol(URLProtocol *protocol)
 {
-    return av_register_protocol2(protocol, sizeof(struct URLProtocol_compat));
+    return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
 }
 #endif
 
@@ -136,20 +149,21 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
     return err;
 }
 
-int url_connect(URLContext* uc)
+int ffurl_connect(URLContext* uc)
 {
     int err = uc->prot->url_open(uc, uc->filename, uc->flags);
     if (err)
         return err;
     uc->is_connected = 1;
-    //We must be careful here as url_seek() could be slow, for example for http
-    if(   (uc->flags & (URL_WRONLY | URL_RDWR))
+    //We must be careful here as ffurl_seek() could be slow, for example for http
+    if(   (uc->flags & (AVIO_WRONLY | AVIO_RDWR))
        || !strcmp(uc->prot->name, "file"))
-        if(!uc->is_streamed && url_seek(uc, 0, SEEK_SET) < 0)
+        if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
             uc->is_streamed= 1;
     return 0;
 }
 
+#if FF_API_OLD_AVIO
 int url_open_protocol (URLContext **puc, struct URLProtocol *up,
                        const char *filename, int flags)
 {
@@ -158,24 +172,81 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up,
     ret = url_alloc_for_protocol(puc, up, filename, flags);
     if (ret)
         goto fail;
-    ret = url_connect(*puc);
+    ret = ffurl_connect(*puc);
     if (!ret)
         return 0;
  fail:
-    url_close(*puc);
+    ffurl_close(*puc);
     *puc = NULL;
     return ret;
 }
+int url_alloc(URLContext **puc, const char *filename, int flags)
+{
+    return ffurl_alloc(puc, filename, flags);
+}
+int url_connect(URLContext* uc)
+{
+    return ffurl_connect(uc);
+}
+int url_open(URLContext **puc, const char *filename, int flags)
+{
+    return ffurl_open(puc, filename, flags);
+}
+int url_read(URLContext *h, unsigned char *buf, int size)
+{
+    return ffurl_read(h, buf, size);
+}
+int url_read_complete(URLContext *h, unsigned char *buf, int size)
+{
+    return ffurl_read_complete(h, buf, size);
+}
+int url_write(URLContext *h, const unsigned char *buf, int size)
+{
+    return ffurl_write(h, buf, size);
+}
+int64_t url_seek(URLContext *h, int64_t pos, int whence)
+{
+    return ffurl_seek(h, pos, whence);
+}
+int url_close(URLContext *h)
+{
+    return ffurl_close(h);
+}
+int64_t url_filesize(URLContext *h)
+{
+    return ffurl_size(h);
+}
+int url_get_file_handle(URLContext *h)
+{
+    return ffurl_get_file_handle(h);
+}
+int url_get_max_packet_size(URLContext *h)
+{
+    return h->max_packet_size;
+}
+void url_get_filename(URLContext *h, char *buf, int buf_size)
+{
+    av_strlcpy(buf, h->filename, buf_size);
+}
+void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
+{
+    avio_set_interrupt_cb(interrupt_cb);
+}
+int av_register_protocol2(URLProtocol *protocol, int size)
+{
+    return ffurl_register_protocol(protocol, size);
+}
+#endif
 
 #define URL_SCHEME_CHARS                        \
     "abcdefghijklmnopqrstuvwxyz"                \
     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"                \
     "0123456789+-."
 
-int url_alloc(URLContext **puc, const char *filename, int flags)
+int ffurl_alloc(URLContext **puc, const char *filename, int flags)
 {
     URLProtocol *up;
-    char proto_str[128];
+    char proto_str[128], proto_nested[128], *ptr;
     size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
 
     if (filename[proto_len] != ':' || is_dos_path(filename))
@@ -183,47 +254,49 @@ int url_alloc(URLContext **puc, const char *filename, int flags)
     else
         av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
 
+    av_strlcpy(proto_nested, proto_str, sizeof(proto_nested));
+    if ((ptr = strchr(proto_nested, '+')))
+        *ptr = '\0';
+
     up = first_protocol;
     while (up != NULL) {
         if (!strcmp(proto_str, up->name))
             return url_alloc_for_protocol (puc, up, filename, flags);
+        if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME &&
+            !strcmp(proto_nested, up->name))
+            return url_alloc_for_protocol (puc, up, filename, flags);
         up = up->next;
     }
     *puc = NULL;
     return AVERROR(ENOENT);
 }
 
-int url_open(URLContext **puc, const char *filename, int flags)
+int ffurl_open(URLContext **puc, const char *filename, int flags)
 {
-    int ret = url_alloc(puc, filename, flags);
+    int ret = ffurl_alloc(puc, filename, flags);
     if (ret)
         return ret;
-    ret = url_connect(*puc);
+    ret = ffurl_connect(*puc);
     if (!ret)
         return 0;
-    url_close(*puc);
+    ffurl_close(*puc);
     *puc = NULL;
     return ret;
 }
 
-int url_read(URLContext *h, unsigned char *buf, int size)
-{
-    int ret;
-    if (h->flags & URL_WRONLY)
-        return AVERROR(EIO);
-    ret = h->prot->url_read(h, buf, size);
-    return ret;
-}
-
-static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size,
+static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min,
                                          int (*transfer_func)(URLContext *h, unsigned char *buf, int size))
 {
     int ret, len;
     int fast_retries = 5;
 
     len = 0;
-    while (len < size) {
+    while (len < size_min) {
         ret = transfer_func(h, buf+len, size-len);
+        if (ret == AVERROR(EINTR))
+            continue;
+        if (h->flags & AVIO_FLAG_NONBLOCK)
+            return ret;
         if (ret == AVERROR(EAGAIN)) {
             ret = 0;
             if (fast_retries)
@@ -235,27 +308,38 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
         if (ret)
            fast_retries = FFMAX(fast_retries, 2);
         len += ret;
+        if (url_interrupt_cb())
+            return AVERROR_EXIT;
     }
     return len;
 }
 
-int url_read_complete(URLContext *h, unsigned char *buf, int size)
+int ffurl_read(URLContext *h, unsigned char *buf, int size)
 {
-    return retry_transfer_wrapper(h, buf, size, url_read);
+    if (h->flags & AVIO_WRONLY)
+        return AVERROR(EIO);
+    return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
 }
 
-int url_write(URLContext *h, const unsigned char *buf, int size)
+int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
 {
-    if (!(h->flags & (URL_WRONLY | URL_RDWR)))
+    if (h->flags & AVIO_WRONLY)
+        return AVERROR(EIO);
+    return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
+}
+
+int ffurl_write(URLContext *h, const unsigned char *buf, int size)
+{
+    if (!(h->flags & (AVIO_WRONLY | AVIO_RDWR)))
         return AVERROR(EIO);
     /* avoid sending too big packets */
     if (h->max_packet_size && size > h->max_packet_size)
         return AVERROR(EIO);
 
-    return retry_transfer_wrapper(h, buf, size, h->prot->url_write);
+    return retry_transfer_wrapper(h, buf, size, size, h->prot->url_write);
 }
 
-int64_t url_seek(URLContext *h, int64_t pos, int whence)
+int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
 {
     int64_t ret;
 
@@ -265,10 +349,10 @@ int64_t url_seek(URLContext *h, int64_t pos, int whence)
     return ret;
 }
 
-int url_close(URLContext *h)
+int ffurl_close(URLContext *h)
 {
     int ret = 0;
-    if (!h) return 0; /* can happen when url_open fails */
+    if (!h) return 0; /* can happen when ffurl_open fails */
 
     if (h->is_connected && h->prot->url_close)
         ret = h->prot->url_close(h);
@@ -284,57 +368,47 @@ int url_close(URLContext *h)
 int url_exist(const char *filename)
 {
     URLContext *h;
-    if (url_open(&h, filename, URL_RDONLY) < 0)
+    if (ffurl_open(&h, filename, AVIO_RDONLY) < 0)
         return 0;
-    url_close(h);
+    ffurl_close(h);
     return 1;
 }
 
-int64_t url_filesize(URLContext *h)
+int64_t ffurl_size(URLContext *h)
 {
     int64_t pos, size;
 
-    size= url_seek(h, 0, AVSEEK_SIZE);
+    size= ffurl_seek(h, 0, AVSEEK_SIZE);
     if(size<0){
-        pos = url_seek(h, 0, SEEK_CUR);
-        if ((size = url_seek(h, -1, SEEK_END)) < 0)
+        pos = ffurl_seek(h, 0, SEEK_CUR);
+        if ((size = ffurl_seek(h, -1, SEEK_END)) < 0)
             return size;
         size++;
-        url_seek(h, pos, SEEK_SET);
+        ffurl_seek(h, pos, SEEK_SET);
     }
     return size;
 }
 
-int url_get_file_handle(URLContext *h)
+int ffurl_get_file_handle(URLContext *h)
 {
     if (!h->prot->url_get_file_handle)
         return -1;
     return h->prot->url_get_file_handle(h);
 }
 
-int url_get_max_packet_size(URLContext *h)
-{
-    return h->max_packet_size;
-}
-
-void url_get_filename(URLContext *h, char *buf, int buf_size)
-{
-    av_strlcpy(buf, h->filename, buf_size);
-}
-
-
 static int default_interrupt_cb(void)
 {
     return 0;
 }
 
-void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
+void avio_set_interrupt_cb(int (*interrupt_cb)(void))
 {
     if (!interrupt_cb)
         interrupt_cb = default_interrupt_cb;
     url_interrupt_cb = interrupt_cb;
 }
 
+#if FF_API_OLD_AVIO
 int av_url_read_pause(URLContext *h, int pause)
 {
     if (!h->prot->url_read_pause)
@@ -349,3 +423,4 @@ int64_t av_url_read_seek(URLContext *h,
         return AVERROR(ENOSYS);
     return h->prot->url_read_seek(h, stream_index, timestamp, flags);
 }
+#endif
diff --git a/ffmpeg-mt/libavformat/avio.h b/ffmpeg-mt/libavformat/avio.h
index e65f712..7bb8d17 100644
--- a/ffmpeg-mt/libavformat/avio.h
+++ b/ffmpeg-mt/libavformat/avio.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVFORMAT_AVIO_H
@@ -33,14 +33,18 @@
 #include "libavutil/common.h"
 #include "libavutil/log.h"
 
+#include "libavformat/version.h"
+
 /* unbuffered I/O */
 
+#if FF_API_OLD_AVIO
 /**
  * URL Context.
  * New fields can be added to the end with minor version bumps.
  * Removal, reordering and changes to existing fields require a major
  * version bump.
  * sizeof(URLContext) must not be used outside libav*.
+ * @deprecated This struct will be made private
  */
 typedef struct URLContext {
 #if FF_API_URL_CLASS
@@ -61,117 +65,59 @@ typedef struct URLPollEntry {
     int revents;
 } URLPollEntry;
 
-#define URL_RDONLY 0
-#define URL_WRONLY 1
-#define URL_RDWR   2
-
-typedef int URLInterruptCB(void);
-
-/**
- * Create a URLContext for accessing to the resource indicated by
- * url, and open it using the URLProtocol up.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int url_open_protocol (URLContext **puc, struct URLProtocol *up,
-                       const char *url, int flags);
-
-/**
- * Create a URLContext for accessing to the resource indicated by
- * url, but do not initiate the connection yet.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int url_alloc(URLContext **h, const char *url, int flags);
-
-/**
- * Connect an URLContext that has been allocated by url_alloc
- */
-int url_connect(URLContext *h);
-
-/**
- * Create an URLContext for accessing to the resource indicated by
- * url, and open it.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int url_open(URLContext **h, const char *url, int flags);
-
-/**
- * Read up to size bytes from the resource accessed by h, and store
- * the read bytes in buf.
- *
- * @return The number of bytes actually read, or a negative value
- * corresponding to an AVERROR code in case of error. A value of zero
- * indicates that it is not possible to read more from the accessed
- * resource (except if the value of the size argument is also zero).
- */
-int url_read(URLContext *h, unsigned char *buf, int size);
-
 /**
- * Read as many bytes as possible (up to size), calling the
- * read function multiple times if necessary.
- * Will also retry if the read function returns AVERROR(EAGAIN).
- * This makes special short-read handling in applications
- * unnecessary, if the return value is < size then it is
- * certain there was either an error or the end of file was reached.
+ * @defgroup open_modes URL open modes
+ * The flags argument to url_open and cosins must be one of the following
+ * constants, optionally ORed with other flags.
+ * @{
  */
-int url_read_complete(URLContext *h, unsigned char *buf, int size);
-
+#define URL_RDONLY 0  /**< read-only */
+#define URL_WRONLY 1  /**< write-only */
+#define URL_RDWR   2  /**< read-write */
 /**
- * Write size bytes from buf to the resource accessed by h.
- *
- * @return the number of bytes actually written, or a negative value
- * corresponding to an AVERROR code in case of failure
+ * @}
  */
-int url_write(URLContext *h, const unsigned char *buf, int size);
 
 /**
- * Passing this as the "whence" parameter to a seek function causes it to
- * return the filesize without seeking anywhere. Supporting this is optional.
- * If it is not supported then the seek function will return <0.
+ * Use non-blocking mode.
+ * If this flag is set, operations on the context will return
+ * AVERROR(EAGAIN) if they can not be performed immediately.
+ * If this flag is not set, operations on the context will never return
+ * AVERROR(EAGAIN).
+ * Note that this flag does not affect the opening/connecting of the
+ * context. Connecting a protocol will always block if necessary (e.g. on
+ * network protocols) but never hang (e.g. on busy devices).
+ * Warning: non-blocking protocols is work-in-progress; this flag may be
+ * silently ignored.
  */
-#define AVSEEK_SIZE 0x10000
+#define URL_FLAG_NONBLOCK 4
 
-/**
- * Change the position that will be used by the next read/write
- * operation on the resource accessed by h.
- *
- * @param pos specifies the new position to set
- * @param whence specifies how pos should be interpreted, it must be
- * one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the
- * current position), SEEK_END (seek from the end), or AVSEEK_SIZE
- * (return the filesize of the requested resource, pos is ignored).
- * @return a negative value corresponding to an AVERROR code in case
- * of failure, or the resulting file position, measured in bytes from
- * the beginning of the file. You can use this feature together with
- * SEEK_CUR to read the current file position.
- */
-int64_t url_seek(URLContext *h, int64_t pos, int whence);
+typedef int URLInterruptCB(void);
 
 /**
- * Close the resource accessed by the URLContext h, and free the
- * memory used by it.
- *
- * @return a negative value if an error condition occurred, 0
- * otherwise
- */
-int url_close(URLContext *h);
+ * @defgroup old_url_funcs Old url_* functions
+ * @deprecated use the buffered API based on AVIOContext instead
+ * @{
+ */
+attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
+                                            const char *url, int flags);
+attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
+attribute_deprecated int url_connect(URLContext *h);
+attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
+attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
+attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
+attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
+attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
+attribute_deprecated int url_close(URLContext *h);
+attribute_deprecated int64_t url_filesize(URLContext *h);
+attribute_deprecated int url_get_file_handle(URLContext *h);
+attribute_deprecated int url_get_max_packet_size(URLContext *h);
+attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
+attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
+attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
+                                              int64_t timestamp, int flags);
+attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
+#endif
 
 /**
  * Return a non-zero value if the resource indicated by url
@@ -180,83 +126,24 @@ int url_close(URLContext *h);
 int url_exist(const char *url);
 
 /**
- * Return the filesize of the resource accessed by h, AVERROR(ENOSYS)
- * if the operation is not supported by h, or another negative value
- * corresponding to an AVERROR error code in case of failure.
- */
-int64_t url_filesize(URLContext *h);
-
-/**
- * Return the file descriptor associated with this URL. For RTP, this
- * will return only the RTP file descriptor, not the RTCP file descriptor.
- *
- * @return the file descriptor associated with this URL, or <0 on error.
- */
-int url_get_file_handle(URLContext *h);
-
-/**
- * Return the maximum packet size associated to packetized file
- * handle. If the file is not packetized (stream like HTTP or file on
- * disk), then 0 is returned.
- *
- * @param h file handle
- * @return maximum packet size in bytes
- */
-int url_get_max_packet_size(URLContext *h);
-
-/**
- * Copy the filename of the resource accessed by h to buf.
- *
- * @param buf_size size in bytes of buf
- */
-void url_get_filename(URLContext *h, char *buf, int buf_size);
-
-/**
  * The callback is called in blocking functions to test regulary if
- * asynchronous interruption is needed. AVERROR(EINTR) is returned
+ * asynchronous interruption is needed. AVERROR_EXIT is returned
  * in this case by the interrupted function. 'NULL' means no interrupt
  * callback is given.
  */
-void url_set_interrupt_cb(URLInterruptCB *interrupt_cb);
+void avio_set_interrupt_cb(int (*interrupt_cb)(void));
 
+#if FF_API_OLD_AVIO
 /* not implemented */
-int url_poll(URLPollEntry *poll_table, int n, int timeout);
+attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
 
-/**
- * Pause and resume playing - only meaningful if using a network streaming
- * protocol (e.g. MMS).
- * @param pause 1 for pause, 0 for resume
- */
-int av_url_read_pause(URLContext *h, int pause);
 
-/**
- * Seek to a given timestamp relative to some component stream.
- * Only meaningful if using a network streaming protocol (e.g. MMS.).
- * @param stream_index The stream index that the timestamp is relative to.
- *        If stream_index is (-1) the timestamp should be in AV_TIME_BASE
- *        units from the beginning of the presentation.
- *        If a stream_index >= 0 is used and the protocol does not support
- *        seeking based on component streams, the call will fail with ENOTSUP.
- * @param timestamp timestamp in AVStream.time_base units
- *        or if there is no stream specified then in AV_TIME_BASE units.
- * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
- *        and AVSEEK_FLAG_ANY. The protocol may silently ignore
- *        AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
- *        fail with ENOTSUP if used and not supported.
- * @return >= 0 on success
- * @see AVInputFormat::read_seek
- */
-int64_t av_url_read_seek(URLContext *h, int stream_index,
-                         int64_t timestamp, int flags);
+#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
 
 /**
- * Oring this flag as into the "whence" parameter to a seek function causes it to
- * seek by any means (like reopening and linear reading) or other normally unreasonble
- * means that can be extreemly slow.
- * This may be ignored by the seek code.
+ * @deprecated This struct is to be made private. Use the higher-level
+ *             AVIOContext-based API instead.
  */
-#define AVSEEK_FORCE 0x20000
-
 typedef struct URLProtocol {
     const char *name;
     int (*url_open)(URLContext *h, const char *url, int flags);
@@ -271,20 +158,26 @@ typedef struct URLProtocol {
     int (*url_get_file_handle)(URLContext *h);
     int priv_data_size;
     const AVClass *priv_data_class;
+    int flags;
 } URLProtocol;
+#endif
 
 #if FF_API_REGISTER_PROTOCOL
 extern URLProtocol *first_protocol;
 #endif
 
+#if FF_API_OLD_AVIO
 extern URLInterruptCB *url_interrupt_cb;
+#endif
 
+#if FF_API_OLD_AVIO
 /**
  * If protocol is NULL, returns the first registered protocol,
  * if protocol is non-NULL, returns the next registered protocol after protocol,
  * or NULL if protocol is the last one.
  */
-URLProtocol *av_protocol_next(URLProtocol *p);
+attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p);
+#endif
 
 #if FF_API_REGISTER_PROTOCOL
 /**
@@ -298,19 +191,27 @@ attribute_deprecated int register_protocol(URLProtocol *protocol);
 attribute_deprecated int av_register_protocol(URLProtocol *protocol);
 #endif
 
+#if FF_API_OLD_AVIO
 /**
  * Register the URLProtocol protocol.
  *
  * @param size the size of the URLProtocol struct referenced
  */
-int av_register_protocol2(URLProtocol *protocol, int size);
+attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
+#endif
+
+#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
+
+/**
+ * @}
+ */
 
 /**
  * Bytestream IO Context.
  * New fields can be added to the end with minor version bumps.
  * Removal, reordering and changes to existing fields require a major
  * version bump.
- * sizeof(ByteIOContext) must not be used outside libav*.
+ * sizeof(AVIOContext) must not be used outside libav*.
  */
 typedef struct {
     unsigned char *buffer;
@@ -324,7 +225,9 @@ typedef struct {
     int must_flush; /**< true if the next seek should flush */
     int eof_reached; /**< true if eof reached */
     int write_flag;  /**< true if open for writing */
-    int is_streamed;
+#if FF_API_OLD_AVIO
+    attribute_deprecated int is_streamed;
+#endif
     int max_packet_size;
     unsigned long checksum;
     unsigned char *checksum_ptr;
@@ -333,9 +236,16 @@ typedef struct {
     int (*read_pause)(void *opaque, int pause);
     int64_t (*read_seek)(void *opaque, int stream_index,
                          int64_t timestamp, int flags);
-} ByteIOContext;
+    /**
+     * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
+     */
+    int seekable;
+} AVIOContext;
 
-int init_put_byte(ByteIOContext *s,
+#if FF_API_OLD_AVIO
+typedef attribute_deprecated AVIOContext ByteIOContext;
+
+attribute_deprecated int init_put_byte(AVIOContext *s,
                   unsigned char *buffer,
                   int buffer_size,
                   int write_flag,
@@ -343,7 +253,7 @@ int init_put_byte(ByteIOContext *s,
                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
                   int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
-ByteIOContext *av_alloc_put_byte(
+attribute_deprecated AVIOContext *av_alloc_put_byte(
                   unsigned char *buffer,
                   int buffer_size,
                   int write_flag,
@@ -352,181 +262,322 @@ ByteIOContext *av_alloc_put_byte(
                   int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
 
-void put_byte(ByteIOContext *s, int b);
-void put_nbyte(ByteIOContext *s, int b, int count);
-void put_buffer(ByteIOContext *s, const unsigned char *buf, int size);
-void put_le64(ByteIOContext *s, uint64_t val);
-void put_be64(ByteIOContext *s, uint64_t val);
-void put_le32(ByteIOContext *s, unsigned int val);
-void put_be32(ByteIOContext *s, unsigned int val);
-void put_le24(ByteIOContext *s, unsigned int val);
-void put_be24(ByteIOContext *s, unsigned int val);
-void put_le16(ByteIOContext *s, unsigned int val);
-void put_be16(ByteIOContext *s, unsigned int val);
-void put_tag(ByteIOContext *s, const char *tag);
+/**
+ * @defgroup old_avio_funcs Old put_/get_*() functions
+ * @deprecated use the avio_ -prefixed functions instead.
+ * @{
+ */
+attribute_deprecated int          get_buffer(AVIOContext *s, unsigned char *buf, int size);
+attribute_deprecated int          get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
+attribute_deprecated int          get_byte(AVIOContext *s);
+attribute_deprecated unsigned int get_le16(AVIOContext *s);
+attribute_deprecated unsigned int get_le24(AVIOContext *s);
+attribute_deprecated unsigned int get_le32(AVIOContext *s);
+attribute_deprecated uint64_t     get_le64(AVIOContext *s);
+attribute_deprecated unsigned int get_be16(AVIOContext *s);
+attribute_deprecated unsigned int get_be24(AVIOContext *s);
+attribute_deprecated unsigned int get_be32(AVIOContext *s);
+attribute_deprecated uint64_t     get_be64(AVIOContext *s);
+
+attribute_deprecated void         put_byte(AVIOContext *s, int b);
+attribute_deprecated void         put_nbyte(AVIOContext *s, int b, int count);
+attribute_deprecated void         put_buffer(AVIOContext *s, const unsigned char *buf, int size);
+attribute_deprecated void         put_le64(AVIOContext *s, uint64_t val);
+attribute_deprecated void         put_be64(AVIOContext *s, uint64_t val);
+attribute_deprecated void         put_le32(AVIOContext *s, unsigned int val);
+attribute_deprecated void         put_be32(AVIOContext *s, unsigned int val);
+attribute_deprecated void         put_le24(AVIOContext *s, unsigned int val);
+attribute_deprecated void         put_be24(AVIOContext *s, unsigned int val);
+attribute_deprecated void         put_le16(AVIOContext *s, unsigned int val);
+attribute_deprecated void         put_be16(AVIOContext *s, unsigned int val);
+attribute_deprecated void         put_tag(AVIOContext *s, const char *tag);
+/**
+ * @}
+ */
+
+attribute_deprecated int     av_url_read_fpause(AVIOContext *h,    int pause);
+attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h,    int stream_index,
+                                                int64_t timestamp, int flags);
+
+/**
+ * @defgroup old_url_f_funcs Old url_f* functions
+ * @deprecated use the avio_ -prefixed functions instead.
+ * @{
+ */
+attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
+attribute_deprecated int url_fclose(AVIOContext *s);
+attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
+attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
+attribute_deprecated int64_t url_ftell(AVIOContext *s);
+attribute_deprecated int64_t url_fsize(AVIOContext *s);
+#define URL_EOF (-1)
+attribute_deprecated int url_fgetc(AVIOContext *s);
+attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
+#ifdef __GNUC__
+attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
+#else
+attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...);
+#endif
+attribute_deprecated void put_flush_packet(AVIOContext *s);
+attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
+attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
+attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
+attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
+/**
+ * @}
+ */
+
+/**
+ * @deprecated use AVIOContext.eof_reached
+ */
+attribute_deprecated int url_feof(AVIOContext *s);
+attribute_deprecated int url_ferror(AVIOContext *s);
 
-void put_strz(ByteIOContext *s, const char *buf);
+attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
+attribute_deprecated int udp_get_local_port(URLContext *h);
+
+attribute_deprecated void init_checksum(AVIOContext *s,
+                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
+                   unsigned long checksum);
+attribute_deprecated unsigned long get_checksum(AVIOContext *s);
+#endif
 
 /**
- * fseek() equivalent for ByteIOContext.
- * @return new position or AVERROR.
+ * Allocate and initialize an AVIOContext for buffered I/O. It must be later
+ * freed with av_free().
+ *
+ * @param buffer Memory block for input/output operations via AVIOContext.
+ * @param buffer_size The buffer size is very important for performance.
+ *        For protocols with fixed blocksize it should be set to this blocksize.
+ *        For others a typical size is a cache page, e.g. 4kb.
+ * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
+ * @param opaque An opaque pointer to user-specific data.
+ * @param read_packet  A function for refilling the buffer, may be NULL.
+ * @param write_packet A function for writing the buffer contents, may be NULL.
+ * @param seek A function for seeking to specified byte position, may be NULL.
+ *
+ * @return Allocated AVIOContext or NULL on failure.
  */
-int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence);
+AVIOContext *avio_alloc_context(
+                  unsigned char *buffer,
+                  int buffer_size,
+                  int write_flag,
+                  void *opaque,
+                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
+
+void avio_w8(AVIOContext *s, int b);
+void avio_write(AVIOContext *s, const unsigned char *buf, int size);
+void avio_wl64(AVIOContext *s, uint64_t val);
+void avio_wb64(AVIOContext *s, uint64_t val);
+void avio_wl32(AVIOContext *s, unsigned int val);
+void avio_wb32(AVIOContext *s, unsigned int val);
+void avio_wl24(AVIOContext *s, unsigned int val);
+void avio_wb24(AVIOContext *s, unsigned int val);
+void avio_wl16(AVIOContext *s, unsigned int val);
+void avio_wb16(AVIOContext *s, unsigned int val);
+
+#if FF_API_OLD_AVIO
+attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
+#endif
 
 /**
- * Skip given number of bytes forward.
- * @param offset number of bytes
- * @return 0 on success, <0 on error
+ * Write a NULL-terminated string.
+ * @return number of bytes written.
  */
-int url_fskip(ByteIOContext *s, int64_t offset);
+int avio_put_str(AVIOContext *s, const char *str);
 
 /**
- * ftell() equivalent for ByteIOContext.
- * @return position or AVERROR.
+ * Convert an UTF-8 string to UTF-16LE and write it.
+ * @return number of bytes written.
  */
-int64_t url_ftell(ByteIOContext *s);
+int avio_put_str16le(AVIOContext *s, const char *str);
 
 /**
- * Get the filesize.
- * @return filesize or AVERROR
+ * Passing this as the "whence" parameter to a seek function causes it to
+ * return the filesize without seeking anywhere. Supporting this is optional.
+ * If it is not supported then the seek function will return <0.
  */
-int64_t url_fsize(ByteIOContext *s);
+#define AVSEEK_SIZE 0x10000
 
 /**
- * feof() equivalent for ByteIOContext.
- * @return non zero if and only if end of file
+ * Oring this flag as into the "whence" parameter to a seek function causes it to
+ * seek by any means (like reopening and linear reading) or other normally unreasonble
+ * means that can be extreemly slow.
+ * This may be ignored by the seek code.
  */
-int url_feof(ByteIOContext *s);
+#define AVSEEK_FORCE 0x20000
 
-int url_ferror(ByteIOContext *s);
+/**
+ * fseek() equivalent for AVIOContext.
+ * @return new position or AVERROR.
+ */
+int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
 
-int av_url_read_fpause(ByteIOContext *h, int pause);
-int64_t av_url_read_fseek(ByteIOContext *h, int stream_index,
-                          int64_t timestamp, int flags);
+/**
+ * Skip given number of bytes forward
+ * @return new position or AVERROR.
+ */
+static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
+{
+    return avio_seek(s, offset, SEEK_CUR);
+}
 
-#define URL_EOF (-1)
-/** @note return URL_EOF (-1) if EOF */
-int url_fgetc(ByteIOContext *s);
+/**
+ * ftell() equivalent for AVIOContext.
+ * @return position or AVERROR.
+ */
+static av_always_inline int64_t avio_tell(AVIOContext *s)
+{
+    return avio_seek(s, 0, SEEK_CUR);
+}
+
+/**
+ * Get the filesize.
+ * @return filesize or AVERROR
+ */
+int64_t avio_size(AVIOContext *s);
 
 /** @warning currently size is limited */
 #ifdef __GNUC__
-int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
+int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
 #else
-int url_fprintf(ByteIOContext *s, const char *fmt, ...);
+int avio_printf(AVIOContext *s, const char *fmt, ...);
 #endif
 
+#if FF_API_OLD_AVIO
 /** @note unlike fgets, the EOL character is not returned and a whole
     line is parsed. return NULL if first char read was EOF */
-char *url_fgets(ByteIOContext *s, char *buf, int buf_size);
-
-void put_flush_packet(ByteIOContext *s);
+attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
+#endif
 
+void avio_flush(AVIOContext *s);
 
-/**
- * Read size bytes from ByteIOContext into buf.
- * @return number of bytes read or AVERROR
- */
-int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
 
 /**
- * Read size bytes from ByteIOContext into buf.
- * This reads at most 1 packet. If that is not enough fewer bytes will be
- * returned.
+ * Read size bytes from AVIOContext into buf.
  * @return number of bytes read or AVERROR
  */
-int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size);
+int avio_read(AVIOContext *s, unsigned char *buf, int size);
 
 /** @note return 0 if EOF, so you cannot use it if EOF handling is
     necessary */
-int get_byte(ByteIOContext *s);
-unsigned int get_le24(ByteIOContext *s);
-unsigned int get_le32(ByteIOContext *s);
-uint64_t get_le64(ByteIOContext *s);
-unsigned int get_le16(ByteIOContext *s);
-
-char *get_strz(ByteIOContext *s, char *buf, int maxlen);
-unsigned int get_be16(ByteIOContext *s);
-unsigned int get_be24(ByteIOContext *s);
-unsigned int get_be32(ByteIOContext *s);
-uint64_t get_be64(ByteIOContext *s);
+int          avio_r8  (AVIOContext *s);
+unsigned int avio_rl16(AVIOContext *s);
+unsigned int avio_rl24(AVIOContext *s);
+unsigned int avio_rl32(AVIOContext *s);
+uint64_t     avio_rl64(AVIOContext *s);
+
+/**
+ * Read a string from pb into buf. The reading will terminate when either
+ * a NULL character was encountered, maxlen bytes have been read, or nothing
+ * more can be read from pb. The result is guaranteed to be NULL-terminated, it
+ * will be truncated if buf is too small.
+ * Note that the string is not interpreted or validated in any way, it
+ * might get truncated in the middle of a sequence for multi-byte encodings.
+ *
+ * @return number of bytes read (is always <= maxlen).
+ * If reading ends on EOF or error, the return value will be one more than
+ * bytes actually read.
+ */
+int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
 
-uint64_t ff_get_v(ByteIOContext *bc);
+/**
+ * Read a UTF-16 string from pb and convert it to UTF-8.
+ * The reading will terminate when either a null or invalid character was
+ * encountered or maxlen bytes have been read.
+ * @return number of bytes read (is always <= maxlen)
+ */
+int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
+int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
 
-static inline int url_is_streamed(ByteIOContext *s)
-{
-    return s->is_streamed;
-}
+#if FF_API_OLD_AVIO
+/**
+ * @deprecated use avio_get_str instead
+ */
+attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
+#endif
+unsigned int avio_rb16(AVIOContext *s);
+unsigned int avio_rb24(AVIOContext *s);
+unsigned int avio_rb32(AVIOContext *s);
+uint64_t     avio_rb64(AVIOContext *s);
 
+#if FF_API_OLD_AVIO
 /**
- * Create and initialize a ByteIOContext for accessing the
- * resource referenced by the URLContext h.
- * @note When the URLContext h has been opened in read+write mode, the
- * ByteIOContext can be used only for writing.
- *
- * @param s Used to return the pointer to the created ByteIOContext.
- * In case of failure the pointed to value is set to NULL.
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
+ * @deprecated Use AVIOContext.seekable field directly.
  */
-int url_fdopen(ByteIOContext **s, URLContext *h);
+attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
+{
+    return !s->seekable;
+}
+#endif
 
-/** @warning must be called before any I/O */
-int url_setbufsize(ByteIOContext *s, int buf_size);
 #if FF_API_URL_RESETBUF
 /** Reset the buffer for reading or writing.
  * @note Will drop any data currently in the buffer without transmitting it.
  * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
  *        to set up the buffer for writing. */
-int url_resetbuf(ByteIOContext *s, int flags);
+int url_resetbuf(AVIOContext *s, int flags);
 #endif
 
 /**
- * Rewind the ByteIOContext using the specified buffer containing the first buf_size bytes of the file.
- * Used after probing to avoid seeking.
- * Joins buf and s->buffer, taking any overlap into consideration.
- * @note s->buffer must overlap with buf or they can't be joined and the function fails
- * @note This function is NOT part of the public API
- *
- * @param s The read-only ByteIOContext to rewind
- * @param buf The probe buffer containing the first buf_size bytes of the file
- * @param buf_size The size of buf
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
+ * @defgroup open_modes URL open modes
+ * The flags argument to avio_open must be one of the following
+ * constants, optionally ORed with other flags.
+ * @{
+ */
+#define AVIO_RDONLY 0  /**< read-only */
+#define AVIO_WRONLY 1  /**< write-only */
+#define AVIO_RDWR   2  /**< read-write */
+/**
+ * @}
+ */
+
+/**
+ * Use non-blocking mode.
+ * If this flag is set, operations on the context will return
+ * AVERROR(EAGAIN) if they can not be performed immediately.
+ * If this flag is not set, operations on the context will never return
+ * AVERROR(EAGAIN).
+ * Note that this flag does not affect the opening/connecting of the
+ * context. Connecting a protocol will always block if necessary (e.g. on
+ * network protocols) but never hang (e.g. on busy devices).
+ * Warning: non-blocking protocols is work-in-progress; this flag may be
+ * silently ignored.
  */
-int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size);
+#define AVIO_FLAG_NONBLOCK 4
 
 /**
- * Create and initialize a ByteIOContext for accessing the
+ * Create and initialize a AVIOContext for accessing the
  * resource indicated by url.
  * @note When the resource indicated by url has been opened in
- * read+write mode, the ByteIOContext can be used only for writing.
+ * read+write mode, the AVIOContext can be used only for writing.
  *
- * @param s Used to return the pointer to the created ByteIOContext.
+ * @param s Used to return the pointer to the created AVIOContext.
  * In case of failure the pointed to value is set to NULL.
  * @param flags flags which control how the resource indicated by url
  * is to be opened
  * @return 0 in case of success, a negative value corresponding to an
  * AVERROR code in case of failure
  */
-int url_fopen(ByteIOContext **s, const char *url, int flags);
+int avio_open(AVIOContext **s, const char *url, int flags);
 
-int url_fclose(ByteIOContext *s);
-URLContext *url_fileno(ByteIOContext *s);
+int avio_close(AVIOContext *s);
+
+#if FF_API_OLD_AVIO
+attribute_deprecated URLContext *url_fileno(AVIOContext *s);
 
 /**
- * Return the maximum packet size associated to packetized buffered file
- * handle. If the file is not packetized (stream like http or file on
- * disk), then 0 is returned.
- *
- * @param s buffered file handle
- * @return maximum packet size in bytes
+ * @deprecated use AVIOContext.max_packet_size directly.
  */
-int url_fget_max_packet_size(ByteIOContext *s);
+attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
 
-int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags);
+attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
 
 /** return the written or read size */
-int url_close_buf(ByteIOContext *s);
+attribute_deprecated int url_close_buf(AVIOContext *s);
+#endif
 
 /**
  * Open a write only memory stream.
@@ -534,43 +585,34 @@ int url_close_buf(ByteIOContext *s);
  * @param s new IO context
  * @return zero if no error.
  */
-int url_open_dyn_buf(ByteIOContext **s);
-
-/**
- * Open a write only packetized memory stream with a maximum packet
- * size of 'max_packet_size'.  The stream is stored in a memory buffer
- * with a big endian 4 byte header giving the packet size in bytes.
- *
- * @param s new IO context
- * @param max_packet_size maximum packet size (must be > 0)
- * @return zero if no error.
- */
-int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size);
+int avio_open_dyn_buf(AVIOContext **s);
 
 /**
  * Return the written size and a pointer to the buffer. The buffer
- * must be freed with av_free(). If the buffer is opened with
- * url_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is
- * added; if opened with url_open_dyn_packet_buf, no padding is added.
+ * must be freed with av_free().
+ * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
  *
  * @param s IO context
  * @param pbuffer pointer to a byte buffer
  * @return the length of the byte buffer
  */
-int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer);
-
-unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
-                                    unsigned int len);
-unsigned long get_checksum(ByteIOContext *s);
-void init_checksum(ByteIOContext *s,
-                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
-                   unsigned long checksum);
+int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
 
-/* udp.c */
-int udp_set_remote_url(URLContext *h, const char *uri);
-int udp_get_local_port(URLContext *h);
 #if FF_API_UDP_GET_FILE
 int udp_get_file_handle(URLContext *h);
 #endif
 
+/**
+ * Iterate through names of available protocols.
+ *
+ * @param opaque A private pointer representing current protocol.
+ *        It must be a pointer to NULL on first iteration and will
+ *        be updated by successive calls to avio_enum_protocols.
+ * @param output If set to 1, iterate over output protocols,
+ *               otherwise over input protocols.
+ *
+ * @return A static string containing the name of current protocol or NULL
+ */
+const char *avio_enum_protocols(void **opaque, int output);
+
 #endif /* AVFORMAT_AVIO_H */
diff --git a/ffmpeg-mt/libavformat/avio_internal.h b/ffmpeg-mt/libavformat/avio_internal.h
new file mode 100644
index 0000000..721a3c4
--- /dev/null
+++ b/ffmpeg-mt/libavformat/avio_internal.h
@@ -0,0 +1,127 @@
+/*
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_AVIO_INTERNAL_H
+#define AVFORMAT_AVIO_INTERNAL_H
+
+#include "avio.h"
+#include "url.h"
+
+int ffio_init_context(AVIOContext *s,
+                  unsigned char *buffer,
+                  int buffer_size,
+                  int write_flag,
+                  void *opaque,
+                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
+
+
+/**
+ * Read size bytes from AVIOContext into buf.
+ * This reads at most 1 packet. If that is not enough fewer bytes will be
+ * returned.
+ * @return number of bytes read or AVERROR
+ */
+int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size);
+
+void ffio_fill(AVIOContext *s, int b, int count);
+
+static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
+{
+    avio_wl32(pb, MKTAG(s[0], s[1], s[2], s[3]));
+}
+
+/**
+ * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
+ * Used after probing to avoid seeking.
+ * Joins buf and s->buffer, taking any overlap into consideration.
+ * @note s->buffer must overlap with buf or they can't be joined and the function fails
+ *
+ * @param s The read-only AVIOContext to rewind
+ * @param buf The probe buffer containing the first buf_size bytes of the file
+ * @param buf_size The size of buf
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code in case of failure
+ */
+int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size);
+
+uint64_t ffio_read_varlen(AVIOContext *bc);
+
+/** @warning must be called before any I/O */
+int ffio_set_buf_size(AVIOContext *s, int buf_size);
+
+/**
+ * Pause and resume playing - only meaningful if using a network streaming
+ * protocol (e.g. MMS).
+ * @param pause 1 for pause, 0 for resume
+ */
+int     ffio_read_pause(AVIOContext *h,    int pause);
+/**
+ * Seek to a given timestamp relative to some component stream.
+ * Only meaningful if using a network streaming protocol (e.g. MMS.).
+ * @param stream_index The stream index that the timestamp is relative to.
+ *        If stream_index is (-1) the timestamp should be in AV_TIME_BASE
+ *        units from the beginning of the presentation.
+ *        If a stream_index >= 0 is used and the protocol does not support
+ *        seeking based on component streams, the call will fail with ENOTSUP.
+ * @param timestamp timestamp in AVStream.time_base units
+ *        or if there is no stream specified then in AV_TIME_BASE units.
+ * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
+ *        and AVSEEK_FLAG_ANY. The protocol may silently ignore
+ *        AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
+ *        fail with ENOTSUP if used and not supported.
+ * @return >= 0 on success
+ * @see AVInputFormat::read_seek
+ */
+int64_t ffio_read_seek (AVIOContext *h,    int stream_index,
+                        int64_t timestamp, int flags);
+
+void ffio_init_checksum(AVIOContext *s,
+                        unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
+                        unsigned long checksum);
+unsigned long ffio_get_checksum(AVIOContext *s);
+unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
+                                    unsigned int len);
+
+/**
+ * Open a write only packetized memory stream with a maximum packet
+ * size of 'max_packet_size'.  The stream is stored in a memory buffer
+ * with a big endian 4 byte header giving the packet size in bytes.
+ *
+ * @param s new IO context
+ * @param max_packet_size maximum packet size (must be > 0)
+ * @return zero if no error.
+ */
+int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
+
+/**
+ * Create and initialize a AVIOContext for accessing the
+ * resource referenced by the URLContext h.
+ * @note When the URLContext h has been opened in read+write mode, the
+ * AVIOContext can be used only for writing.
+ *
+ * @param s Used to return the pointer to the created AVIOContext.
+ * In case of failure the pointed to value is set to NULL.
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code in case of failure
+ */
+int ffio_fdopen(AVIOContext **s, URLContext *h);
+
+#endif // AVFORMAT_AVIO_INTERNAL_H
diff --git a/ffmpeg-mt/libavformat/aviobuf.c b/ffmpeg-mt/libavformat/aviobuf.c
index df76507..3814db6 100644
--- a/ffmpeg-mt/libavformat/aviobuf.c
+++ b/ffmpeg-mt/libavformat/aviobuf.c
@@ -2,20 +2,20 @@
  * Buffered I/O for ffmpeg system
  * Copyright (c) 2000,2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,9 @@
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "avio.h"
+#include "avio_internal.h"
 #include "internal.h"
+#include "url.h"
 #include <stdarg.h>
 
 #define IO_BUFFER_SIZE 32768
@@ -35,12 +37,12 @@
  */
 #define SHORT_SEEK_THRESHOLD 4096
 
-static void fill_buffer(ByteIOContext *s);
+static void fill_buffer(AVIOContext *s);
 #if !FF_API_URL_RESETBUF
-static int url_resetbuf(ByteIOContext *s, int flags);
+static int url_resetbuf(AVIOContext *s, int flags);
 #endif
 
-int init_put_byte(ByteIOContext *s,
+int ffio_init_context(AVIOContext *s,
                   unsigned char *buffer,
                   int buffer_size,
                   int write_flag,
@@ -53,7 +55,7 @@ int init_put_byte(ByteIOContext *s,
     s->buffer_size = buffer_size;
     s->buf_ptr = buffer;
     s->opaque = opaque;
-    url_resetbuf(s, write_flag ? URL_WRONLY : URL_RDONLY);
+    url_resetbuf(s, write_flag ? AVIO_WRONLY : AVIO_RDONLY);
     s->write_packet = write_packet;
     s->read_packet = read_packet;
     s->seek = seek;
@@ -61,7 +63,10 @@ int init_put_byte(ByteIOContext *s,
     s->must_flush = 0;
     s->eof_reached = 0;
     s->error = 0;
+#if FF_API_OLD_AVIO
     s->is_streamed = 0;
+#endif
+    s->seekable = AVIO_SEEKABLE_NORMAL;
     s->max_packet_size = 0;
     s->update_checksum= NULL;
     if(!read_packet && !write_flag){
@@ -73,7 +78,34 @@ int init_put_byte(ByteIOContext *s,
     return 0;
 }
 
-ByteIOContext *av_alloc_put_byte(
+#if FF_API_OLD_AVIO
+int init_put_byte(AVIOContext *s,
+                  unsigned char *buffer,
+                  int buffer_size,
+                  int write_flag,
+                  void *opaque,
+                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
+{
+    return ffio_init_context(s, buffer, buffer_size, write_flag, opaque,
+                                read_packet, write_packet, seek);
+}
+AVIOContext *av_alloc_put_byte(
+                  unsigned char *buffer,
+                  int buffer_size,
+                  int write_flag,
+                  void *opaque,
+                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
+                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
+{
+    return avio_alloc_context(buffer, buffer_size, write_flag, opaque,
+                              read_packet, write_packet, seek);
+}
+#endif
+
+AVIOContext *avio_alloc_context(
                   unsigned char *buffer,
                   int buffer_size,
                   int write_flag,
@@ -82,13 +114,13 @@ ByteIOContext *av_alloc_put_byte(
                   int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
                   int64_t (*seek)(void *opaque, int64_t offset, int whence))
 {
-    ByteIOContext *s = av_mallocz(sizeof(ByteIOContext));
-    init_put_byte(s, buffer, buffer_size, write_flag, opaque,
+    AVIOContext *s = av_mallocz(sizeof(AVIOContext));
+    ffio_init_context(s, buffer, buffer_size, write_flag, opaque,
                   read_packet, write_packet, seek);
     return s;
 }
 
-static void flush_buffer(ByteIOContext *s)
+static void flush_buffer(AVIOContext *s)
 {
     if (s->buf_ptr > s->buffer) {
         if (s->write_packet && !s->error){
@@ -106,14 +138,14 @@ static void flush_buffer(ByteIOContext *s)
     s->buf_ptr = s->buffer;
 }
 
-void put_byte(ByteIOContext *s, int b)
+void avio_w8(AVIOContext *s, int b)
 {
     *(s->buf_ptr)++ = b;
     if (s->buf_ptr >= s->buf_end)
         flush_buffer(s);
 }
 
-void put_nbyte(ByteIOContext *s, int b, int count)
+void ffio_fill(AVIOContext *s, int b, int count)
 {
     while (count > 0) {
         int len = FFMIN(s->buf_end - s->buf_ptr, count);
@@ -127,7 +159,7 @@ void put_nbyte(ByteIOContext *s, int b, int count)
     }
 }
 
-void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)
+void avio_write(AVIOContext *s, const unsigned char *buf, int size)
 {
     while (size > 0) {
         int len = FFMIN(s->buf_end - s->buf_ptr, size);
@@ -142,13 +174,13 @@ void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)
     }
 }
 
-void put_flush_packet(ByteIOContext *s)
+void avio_flush(AVIOContext *s)
 {
     flush_buffer(s);
     s->must_flush = 0;
 }
 
-int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
+int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
 {
     int64_t offset1;
     int64_t pos;
@@ -174,7 +206,7 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
         offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
         /* can do the seek inside the buffer */
         s->buf_ptr = s->buffer + offset1;
-    } else if ((s->is_streamed ||
+    } else if ((!s->seekable ||
                offset1 <= s->buf_end + SHORT_SEEK_THRESHOLD - s->buffer) &&
                !s->write_flag && offset1 >= 0 &&
               (whence != SEEK_END || force)) {
@@ -205,18 +237,20 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
     return offset;
 }
 
-int url_fskip(ByteIOContext *s, int64_t offset)
+#if FF_API_OLD_AVIO
+int url_fskip(AVIOContext *s, int64_t offset)
 {
-    int64_t ret = url_fseek(s, offset, SEEK_CUR);
+    int64_t ret = avio_seek(s, offset, SEEK_CUR);
     return ret < 0 ? ret : 0;
 }
 
-int64_t url_ftell(ByteIOContext *s)
+int64_t url_ftell(AVIOContext *s)
 {
-    return url_fseek(s, 0, SEEK_CUR);
+    return avio_seek(s, 0, SEEK_CUR);
 }
+#endif
 
-int64_t url_fsize(ByteIOContext *s)
+int64_t avio_size(AVIOContext *s)
 {
     int64_t size;
 
@@ -235,42 +269,201 @@ int64_t url_fsize(ByteIOContext *s)
     return size;
 }
 
-int url_feof(ByteIOContext *s)
+#if FF_API_OLD_AVIO
+int url_feof(AVIOContext *s)
 {
     if(!s)
         return 0;
     return s->eof_reached;
 }
 
-int url_ferror(ByteIOContext *s)
+int url_ferror(AVIOContext *s)
 {
     if(!s)
         return 0;
     return s->error;
 }
+#endif
 
-void put_le32(ByteIOContext *s, unsigned int val)
+void avio_wl32(AVIOContext *s, unsigned int val)
 {
-    put_byte(s, val);
-    put_byte(s, val >> 8);
-    put_byte(s, val >> 16);
-    put_byte(s, val >> 24);
+    avio_w8(s, val);
+    avio_w8(s, val >> 8);
+    avio_w8(s, val >> 16);
+    avio_w8(s, val >> 24);
 }
 
-void put_be32(ByteIOContext *s, unsigned int val)
+void avio_wb32(AVIOContext *s, unsigned int val)
 {
-    put_byte(s, val >> 24);
-    put_byte(s, val >> 16);
-    put_byte(s, val >> 8);
-    put_byte(s, val);
+    avio_w8(s, val >> 24);
+    avio_w8(s, val >> 16);
+    avio_w8(s, val >> 8);
+    avio_w8(s, val);
 }
 
-void put_strz(ByteIOContext *s, const char *str)
+#if FF_API_OLD_AVIO
+void put_strz(AVIOContext *s, const char *str)
 {
-    if (str)
-        put_buffer(s, (const unsigned char *) str, strlen(str) + 1);
-    else
-        put_byte(s, 0);
+    avio_put_str(s, str);
+}
+
+#define GET(name, type) \
+    type get_be ##name(AVIOContext *s) \
+{\
+    return avio_rb ##name(s);\
+}\
+    type get_le ##name(AVIOContext *s) \
+{\
+    return avio_rl ##name(s);\
+}
+
+GET(16, unsigned int)
+GET(24, unsigned int)
+GET(32, unsigned int)
+GET(64, uint64_t)
+
+#undef GET
+
+#define PUT(name, type ) \
+    void put_le ##name(AVIOContext *s, type val)\
+{\
+        avio_wl ##name(s, val);\
+}\
+    void put_be ##name(AVIOContext *s, type val)\
+{\
+        avio_wb ##name(s, val);\
+}
+
+PUT(16, unsigned int)
+PUT(24, unsigned int)
+PUT(32, unsigned int)
+PUT(64, uint64_t)
+#undef PUT
+
+int get_byte(AVIOContext *s)
+{
+   return avio_r8(s);
+}
+int get_buffer(AVIOContext *s, unsigned char *buf, int size)
+{
+    return avio_read(s, buf, size);
+}
+int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
+{
+    return ffio_read_partial(s, buf, size);
+}
+void put_byte(AVIOContext *s, int val)
+{
+    avio_w8(s, val);
+}
+void put_buffer(AVIOContext *s, const unsigned char *buf, int size)
+{
+    avio_write(s, buf, size);
+}
+void put_nbyte(AVIOContext *s, int b, int count)
+{
+    ffio_fill(s, b, count);
+}
+
+int url_fopen(AVIOContext **s, const char *filename, int flags)
+{
+    return avio_open(s, filename, flags);
+}
+int url_fclose(AVIOContext *s)
+{
+    return avio_close(s);
+}
+int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
+{
+    return avio_seek(s, offset, whence);
+}
+int64_t url_fsize(AVIOContext *s)
+{
+    return avio_size(s);
+}
+int url_setbufsize(AVIOContext *s, int buf_size)
+{
+    return ffio_set_buf_size(s, buf_size);
+}
+int url_fprintf(AVIOContext *s, const char *fmt, ...)
+{
+    va_list ap;
+    char buf[4096];
+    int ret;
+
+    va_start(ap, fmt);
+    ret = vsnprintf(buf, sizeof(buf), fmt, ap);
+    va_end(ap);
+    avio_write(s, buf, strlen(buf));
+    return ret;
+}
+void put_flush_packet(AVIOContext *s)
+{
+    avio_flush(s);
+}
+int av_url_read_fpause(AVIOContext *s, int pause)
+{
+    return ffio_read_pause(s, pause);
+}
+int64_t av_url_read_fseek(AVIOContext *s, int stream_index,
+                         int64_t timestamp, int flags)
+{
+    return ffio_read_seek(s, stream_index, timestamp, flags);
+}
+void init_checksum(AVIOContext *s,
+                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
+                   unsigned long checksum)
+{
+    ffio_init_checksum(s, update_checksum, checksum);
+}
+unsigned long get_checksum(AVIOContext *s)
+{
+    return ffio_get_checksum(s);
+}
+int url_open_dyn_buf(AVIOContext **s)
+{
+    return avio_open_dyn_buf(s);
+}
+int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
+{
+    return ffio_open_dyn_packet_buf(s, max_packet_size);
+}
+int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
+{
+    return avio_close_dyn_buf(s, pbuffer);
+}
+int url_fdopen(AVIOContext **s, URLContext *h)
+{
+    return ffio_fdopen(s, h);
+}
+#endif
+
+int avio_put_str(AVIOContext *s, const char *str)
+{
+    int len = 1;
+    if (str) {
+        len += strlen(str);
+        avio_write(s, (const unsigned char *) str, len);
+    } else
+        avio_w8(s, 0);
+    return len;
+}
+
+int avio_put_str16le(AVIOContext *s, const char *str)
+{
+    const uint8_t *q = str;
+    int ret = 0;
+
+    while (*q) {
+        uint32_t ch;
+        uint16_t tmp;
+
+        GET_UTF8(ch, *q++, break;)
+        PUT_UTF16(ch, tmp, avio_wl16(s, tmp);ret += 2;)
+    }
+    avio_wl16(s, 0);
+    ret += 2;
+    return ret;
 }
 
 int ff_get_v_length(uint64_t val){
@@ -282,63 +475,65 @@ int ff_get_v_length(uint64_t val){
     return i;
 }
 
-void ff_put_v(ByteIOContext *bc, uint64_t val){
+void ff_put_v(AVIOContext *bc, uint64_t val){
     int i= ff_get_v_length(val);
 
     while(--i>0)
-        put_byte(bc, 128 | (val>>(7*i)));
+        avio_w8(bc, 128 | (val>>(7*i)));
 
-    put_byte(bc, val&127);
+    avio_w8(bc, val&127);
 }
 
-void put_le64(ByteIOContext *s, uint64_t val)
+void avio_wl64(AVIOContext *s, uint64_t val)
 {
-    put_le32(s, (uint32_t)(val & 0xffffffff));
-    put_le32(s, (uint32_t)(val >> 32));
+    avio_wl32(s, (uint32_t)(val & 0xffffffff));
+    avio_wl32(s, (uint32_t)(val >> 32));
 }
 
-void put_be64(ByteIOContext *s, uint64_t val)
+void avio_wb64(AVIOContext *s, uint64_t val)
 {
-    put_be32(s, (uint32_t)(val >> 32));
-    put_be32(s, (uint32_t)(val & 0xffffffff));
+    avio_wb32(s, (uint32_t)(val >> 32));
+    avio_wb32(s, (uint32_t)(val & 0xffffffff));
 }
 
-void put_le16(ByteIOContext *s, unsigned int val)
+void avio_wl16(AVIOContext *s, unsigned int val)
 {
-    put_byte(s, val);
-    put_byte(s, val >> 8);
+    avio_w8(s, val);
+    avio_w8(s, val >> 8);
 }
 
-void put_be16(ByteIOContext *s, unsigned int val)
+void avio_wb16(AVIOContext *s, unsigned int val)
 {
-    put_byte(s, val >> 8);
-    put_byte(s, val);
+    avio_w8(s, val >> 8);
+    avio_w8(s, val);
 }
 
-void put_le24(ByteIOContext *s, unsigned int val)
+void avio_wl24(AVIOContext *s, unsigned int val)
 {
-    put_le16(s, val & 0xffff);
-    put_byte(s, val >> 16);
+    avio_wl16(s, val & 0xffff);
+    avio_w8(s, val >> 16);
 }
 
-void put_be24(ByteIOContext *s, unsigned int val)
+void avio_wb24(AVIOContext *s, unsigned int val)
 {
-    put_be16(s, val >> 8);
-    put_byte(s, val);
+    avio_wb16(s, val >> 8);
+    avio_w8(s, val);
 }
 
-void put_tag(ByteIOContext *s, const char *tag)
+#if FF_API_OLD_AVIO
+void put_tag(AVIOContext *s, const char *tag)
 {
     while (*tag) {
-        put_byte(s, *tag++);
+        avio_w8(s, *tag++);
     }
 }
+#endif
 
 /* Input stream */
 
-static void fill_buffer(ByteIOContext *s)
+static void fill_buffer(AVIOContext *s)
 {
-    uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer;
+    uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_end : s->buffer;
     int len= s->buffer_size - (dst - s->buffer);
     int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE;
 
@@ -354,7 +549,7 @@ static void fill_buffer(ByteIOContext *s)
 
     /* make buffer smaller in case it ended up large after probing */
     if (s->buffer_size > max_buffer_size) {
-        url_setbufsize(s, max_buffer_size);
+        ffio_set_buf_size(s, max_buffer_size);
 
         s->checksum_ptr = dst = s->buffer;
         len = s->buffer_size;
@@ -383,14 +578,14 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
     return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len);
 }
 
-unsigned long get_checksum(ByteIOContext *s)
+unsigned long ffio_get_checksum(AVIOContext *s)
 {
     s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
     s->update_checksum= NULL;
     return s->checksum;
 }
 
-void init_checksum(ByteIOContext *s,
+void ffio_init_checksum(AVIOContext *s,
                    unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
                    unsigned long checksum)
 {
@@ -402,7 +597,7 @@ void init_checksum(ByteIOContext *s,
 }
 
 /* XXX: put an inline version */
-int get_byte(ByteIOContext *s)
+int avio_r8(AVIOContext *s)
 {
     if (s->buf_ptr >= s->buf_end)
         fill_buffer(s);
@@ -411,7 +606,8 @@ int get_byte(ByteIOContext *s)
     return 0;
 }
 
-int url_fgetc(ByteIOContext *s)
+#if FF_API_OLD_AVIO
+int url_fgetc(AVIOContext *s)
 {
     if (s->buf_ptr >= s->buf_end)
         fill_buffer(s);
@@ -419,8 +615,9 @@ int url_fgetc(ByteIOContext *s)
         return *s->buf_ptr++;
     return URL_EOF;
 }
+#endif
 
-int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
+int avio_read(AVIOContext *s, unsigned char *buf, int size)
 {
     int len, size1;
 
@@ -461,13 +658,13 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
         }
     }
     if (size1 == size) {
-        if (url_ferror(s)) return url_ferror(s);
-        if (url_feof(s))   return AVERROR_EOF;
+        if (s->error)         return s->error;
+        if (s->eof_reached)   return AVERROR_EOF;
     }
     return size1 - size;
 }
 
-int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
+int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
 {
     int len;
 
@@ -484,89 +681,82 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
     memcpy(buf, s->buf_ptr, len);
     s->buf_ptr += len;
     if (!len) {
-        if (url_ferror(s)) return url_ferror(s);
-        if (url_feof(s))   return AVERROR_EOF;
+        if (s->error)         return s->error;
+        if (s->eof_reached)   return AVERROR_EOF;
     }
     return len;
 }
 
-unsigned int get_le16(ByteIOContext *s)
+unsigned int avio_rl16(AVIOContext *s)
 {
     unsigned int val;
-    val = get_byte(s);
-    val |= get_byte(s) << 8;
+    val = avio_r8(s);
+    val |= avio_r8(s) << 8;
     return val;
 }
 
-unsigned int get_le24(ByteIOContext *s)
+unsigned int avio_rl24(AVIOContext *s)
 {
     unsigned int val;
-    val = get_le16(s);
-    val |= get_byte(s) << 16;
+    val = avio_rl16(s);
+    val |= avio_r8(s) << 16;
     return val;
 }
 
-unsigned int get_le32(ByteIOContext *s)
+unsigned int avio_rl32(AVIOContext *s)
 {
     unsigned int val;
-    val = get_le16(s);
-    val |= get_le16(s) << 16;
+    val = avio_rl16(s);
+    val |= avio_rl16(s) << 16;
     return val;
 }
 
-uint64_t get_le64(ByteIOContext *s)
+uint64_t avio_rl64(AVIOContext *s)
 {
     uint64_t val;
-    val = (uint64_t)get_le32(s);
-    val |= (uint64_t)get_le32(s) << 32;
+    val = (uint64_t)avio_rl32(s);
+    val |= (uint64_t)avio_rl32(s) << 32;
     return val;
 }
 
-unsigned int get_be16(ByteIOContext *s)
+unsigned int avio_rb16(AVIOContext *s)
 {
     unsigned int val;
-    val = get_byte(s) << 8;
-    val |= get_byte(s);
+    val = avio_r8(s) << 8;
+    val |= avio_r8(s);
     return val;
 }
 
-unsigned int get_be24(ByteIOContext *s)
+unsigned int avio_rb24(AVIOContext *s)
 {
     unsigned int val;
-    val = get_be16(s) << 8;
-    val |= get_byte(s);
+    val = avio_rb16(s) << 8;
+    val |= avio_r8(s);
     return val;
 }
-unsigned int get_be32(ByteIOContext *s)
+unsigned int avio_rb32(AVIOContext *s)
 {
     unsigned int val;
-    val = get_be16(s) << 16;
-    val |= get_be16(s);
+    val = avio_rb16(s) << 16;
+    val |= avio_rb16(s);
     return val;
 }
 
-char *get_strz(ByteIOContext *s, char *buf, int maxlen)
+#if FF_API_OLD_AVIO
+char *get_strz(AVIOContext *s, char *buf, int maxlen)
 {
-    int i = 0;
-    char c;
-
-    while ((c = get_byte(s))) {
-        if (i < maxlen-1)
-            buf[i++] = c;
-    }
-
-    buf[i] = 0; /* Ensure null terminated, but may be truncated */
-
+    avio_get_str(s, INT_MAX, buf, maxlen);
     return buf;
 }
+#endif
 
-int ff_get_line(ByteIOContext *s, char *buf, int maxlen)
+int ff_get_line(AVIOContext *s, char *buf, int maxlen)
 {
     int i = 0;
     char c;
 
     do {
-        c = get_byte(s);
+        c = avio_r8(s);
         if (c && i < maxlen-1)
             buf[i++] = c;
     } while (c != '\n' && c);
@@ -575,31 +765,70 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen)
     return i;
 }
 
-uint64_t get_be64(ByteIOContext *s)
+int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen)
+{
+    int i;
+
+    // reserve 1 byte for terminating 0
+    buflen = FFMIN(buflen - 1, maxlen);
+    for (i = 0; i < buflen; i++)
+        if (!(buf[i] = avio_r8(s)))
+            return i + 1;
+    if (buflen)
+        buf[i] = 0;
+    for (; i < maxlen; i++)
+        if (!avio_r8(s))
+            return i + 1;
+    return maxlen;
+}
+
+#define GET_STR16(type, read) \
+    int avio_get_str16 ##type(AVIOContext *pb, int maxlen, char *buf, int buflen)\
+{\
+    char* q = buf;\
+    int ret = 0;\
+    while (ret + 1 < maxlen) {\
+        uint8_t tmp;\
+        uint32_t ch;\
+        GET_UTF16(ch, (ret += 2) <= maxlen ? read(pb) : 0, break;)\
+        if (!ch)\
+            break;\
+        PUT_UTF8(ch, tmp, if (q - buf < buflen - 1) *q++ = tmp;)\
+    }\
+    *q = 0;\
+    return ret;\
+}\
+
+GET_STR16(le, avio_rl16)
+GET_STR16(be, avio_rb16)
+
+#undef GET_STR16
+
+uint64_t avio_rb64(AVIOContext *s)
 {
     uint64_t val;
-    val = (uint64_t)get_be32(s) << 32;
-    val |= (uint64_t)get_be32(s);
+    val = (uint64_t)avio_rb32(s) << 32;
+    val |= (uint64_t)avio_rb32(s);
     return val;
 }
 
-uint64_t ff_get_v(ByteIOContext *bc){
+uint64_t ffio_read_varlen(AVIOContext *bc){
     uint64_t val = 0;
     int tmp;
 
     do{
-        tmp = get_byte(bc);
+        tmp = avio_r8(bc);
         val= (val<<7) + (tmp&127);
     }while(tmp&128);
     return val;
 }
 
-int url_fdopen(ByteIOContext **s, URLContext *h)
+int ffio_fdopen(AVIOContext **s, URLContext *h)
 {
     uint8_t *buffer;
     int buffer_size, max_packet_size;
 
-    max_packet_size = url_get_max_packet_size(h);
+    max_packet_size = h->max_packet_size;
     if (max_packet_size) {
         buffer_size = max_packet_size; /* no need to bufferize more than one packet */
     } else {
@@ -609,20 +838,23 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
     if (!buffer)
         return AVERROR(ENOMEM);
 
-    *s = av_mallocz(sizeof(ByteIOContext));
+    *s = av_mallocz(sizeof(AVIOContext));
     if(!*s) {
         av_free(buffer);
         return AVERROR(ENOMEM);
     }
 
-    if (init_put_byte(*s, buffer, buffer_size,
-                      (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
-                      url_read, url_write, url_seek) < 0) {
+    if (ffio_init_context(*s, buffer, buffer_size,
+                      (h->flags & AVIO_WRONLY || h->flags & AVIO_RDWR), h,
+                      ffurl_read, ffurl_write, ffurl_seek) < 0) {
         av_free(buffer);
         av_freep(s);
         return AVERROR(EIO);
     }
+#if FF_API_OLD_AVIO
     (*s)->is_streamed = h->is_streamed;
+#endif
+    (*s)->seekable = h->is_streamed ? 0 : AVIO_SEEKABLE_NORMAL;
     (*s)->max_packet_size = max_packet_size;
     if(h->prot) {
         (*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause;
@@ -631,7 +863,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
     return 0;
 }
 
-int url_setbufsize(ByteIOContext *s, int buf_size)
+int ffio_set_buf_size(AVIOContext *s, int buf_size)
 {
     uint8_t *buffer;
     buffer = av_malloc(buf_size);
@@ -642,24 +874,24 @@ int url_setbufsize(ByteIOContext *s, int buf_size)
     s->buffer = buffer;
     s->buffer_size = buf_size;
     s->buf_ptr = buffer;
-    url_resetbuf(s, s->write_flag ? URL_WRONLY : URL_RDONLY);
+    url_resetbuf(s, s->write_flag ? AVIO_WRONLY : AVIO_RDONLY);
     return 0;
 }
 
 #if FF_API_URL_RESETBUF
-int url_resetbuf(ByteIOContext *s, int flags)
+int url_resetbuf(AVIOContext *s, int flags)
 #else
-static int url_resetbuf(ByteIOContext *s, int flags)
+static int url_resetbuf(AVIOContext *s, int flags)
 #endif
 {
 #if FF_API_URL_RESETBUF
-    if (flags & URL_RDWR)
+    if (flags & AVIO_RDWR)
         return AVERROR(EINVAL);
 #else
-    assert(flags == URL_WRONLY || flags == URL_RDONLY);
+    assert(flags == AVIO_WRONLY || flags == AVIO_RDONLY);
 #endif
 
-    if (flags & URL_WRONLY) {
+    if (flags & AVIO_WRONLY) {
         s->buf_end = s->buffer + s->buffer_size;
         s->write_flag = 1;
     } else {
@@ -669,7 +901,7 @@ static int url_resetbuf(ByteIOContext *s, int flags)
     return 0;
 }
 
-int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size)
+int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size)
 {
     int64_t buffer_start;
     int buffer_size;
@@ -708,38 +940,39 @@ int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size
     return 0;
 }
 
-int url_fopen(ByteIOContext **s, const char *filename, int flags)
+int avio_open(AVIOContext **s, const char *filename, int flags)
 {
     URLContext *h;
     int err;
 
-    err = url_open(&h, filename, flags);
+    err = ffurl_open(&h, filename, flags);
     if (err < 0)
         return err;
-    err = url_fdopen(s, h);
+    err = ffio_fdopen(s, h);
     if (err < 0) {
-        url_close(h);
+        ffurl_close(h);
         return err;
     }
     return 0;
 }
 
-int url_fclose(ByteIOContext *s)
+int avio_close(AVIOContext *s)
 {
     URLContext *h = s->opaque;
 
     av_free(s->buffer);
     av_free(s);
-    return url_close(h);
+    return ffurl_close(h);
 }
 
-URLContext *url_fileno(ByteIOContext *s)
+#if FF_API_OLD_AVIO
+URLContext *url_fileno(AVIOContext *s)
 {
     return s->opaque;
 }
+#endif
 
-#if CONFIG_MUXERS
-int url_fprintf(ByteIOContext *s, const char *fmt, ...)
+int avio_printf(AVIOContext *s, const char *fmt, ...)
 {
     va_list ap;
     char buf[4096];
@@ -748,46 +981,47 @@ int url_fprintf(ByteIOContext *s, const char *fmt, ...)
     va_start(ap, fmt);
     ret = vsnprintf(buf, sizeof(buf), fmt, ap);
     va_end(ap);
-    put_buffer(s, buf, strlen(buf));
+    avio_write(s, buf, strlen(buf));
     return ret;
 }
-#endif //CONFIG_MUXERS
 
-char *url_fgets(ByteIOContext *s, char *buf, int buf_size)
+#if FF_API_OLD_AVIO
+char *url_fgets(AVIOContext *s, char *buf, int buf_size)
 {
     int c;
     char *q;
 
-    c = url_fgetc(s);
-    if (c == EOF)
+    c = avio_r8(s);
+    if (s->eof_reached)
         return NULL;
     q = buf;
     for(;;) {
-        if (c == EOF || c == '\n')
+        if (s->eof_reached || c == '\n')
             break;
         if ((q - buf) < buf_size - 1)
             *q++ = c;
-        c = url_fgetc(s);
+        c = avio_r8(s);
     }
     if (buf_size > 0)
         *q = '\0';
     return buf;
 }
 
-int url_fget_max_packet_size(ByteIOContext *s)
+int url_fget_max_packet_size(AVIOContext *s)
 {
     return s->max_packet_size;
 }
+#endif
 
-int av_url_read_fpause(ByteIOContext *s, int pause)
+int ffio_read_pause(AVIOContext *s, int pause)
 {
     if (!s->read_pause)
         return AVERROR(ENOSYS);
     return s->read_pause(s->opaque, pause);
 }
 
-int64_t av_url_read_fseek(ByteIOContext *s, int stream_index,
-                          int64_t timestamp, int flags)
+int64_t ffio_read_seek(AVIOContext *s, int stream_index,
+                       int64_t timestamp, int flags)
 {
     URLContext *h = s->opaque;
     int64_t ret;
@@ -806,29 +1040,28 @@ int64_t av_url_read_fseek(ByteIOContext *s, int stream_index,
     return ret;
 }
 
-/* url_open_dyn_buf and url_close_dyn_buf are used in rtp.c to send a response
- * back to the server even if CONFIG_MUXERS is false. */
-#if CONFIG_MUXERS || CONFIG_NETWORK
 /* buffer handling */
-int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags)
+#if FF_API_OLD_AVIO
+int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
 {
     int ret;
-    *s = av_mallocz(sizeof(ByteIOContext));
+    *s = av_mallocz(sizeof(AVIOContext));
     if(!*s)
         return AVERROR(ENOMEM);
-    ret = init_put_byte(*s, buf, buf_size,
-                        (flags & URL_WRONLY || flags & URL_RDWR),
+    ret = ffio_init_context(*s, buf, buf_size,
+                        (flags & AVIO_WRONLY || flags & AVIO_RDWR),
                         NULL, NULL, NULL, NULL);
     if(ret != 0)
         av_freep(s);
     return ret;
 }
 
-int url_close_buf(ByteIOContext *s)
+int url_close_buf(AVIOContext *s)
 {
-    put_flush_packet(s);
+    avio_flush(s);
     return s->buf_ptr - s->buffer;
 }
+#endif
 
 /* output in a dynamic buffer */
 
@@ -898,10 +1131,9 @@ static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence)
     return 0;
 }
 
-static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size)
+static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size)
 {
     DynBuffer *d;
-    int ret;
     unsigned io_buffer_size = max_packet_size ? max_packet_size : 1024;
 
     if(sizeof(DynBuffer) + io_buffer_size < io_buffer_size)
@@ -909,38 +1141,31 @@ static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size)
     d = av_mallocz(sizeof(DynBuffer) + io_buffer_size);
     if (!d)
         return AVERROR(ENOMEM);
-    *s = av_mallocz(sizeof(ByteIOContext));
+    d->io_buffer_size = io_buffer_size;
+    *s = avio_alloc_context(d->io_buffer, d->io_buffer_size, 1, d, NULL,
+                            max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
+                            max_packet_size ? NULL : dyn_buf_seek);
     if(!*s) {
         av_free(d);
         return AVERROR(ENOMEM);
     }
-    d->io_buffer_size = io_buffer_size;
-    ret = init_put_byte(*s, d->io_buffer, io_buffer_size,
-                        1, d, NULL,
-                        max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
-                        max_packet_size ? NULL : dyn_buf_seek);
-    if (ret == 0) {
-        (*s)->max_packet_size = max_packet_size;
-    } else {
-        av_free(d);
-        av_freep(s);
-    }
-    return ret;
+    (*s)->max_packet_size = max_packet_size;
+    return 0;
 }
 
-int url_open_dyn_buf(ByteIOContext **s)
+int avio_open_dyn_buf(AVIOContext **s)
 {
     return url_open_dyn_buf_internal(s, 0);
 }
 
-int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size)
+int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
 {
     if (max_packet_size <= 0)
         return -1;
     return url_open_dyn_buf_internal(s, max_packet_size);
 }
 
-int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
+int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
 {
     DynBuffer *d = s->opaque;
     int size;
@@ -949,11 +1174,11 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
 
     /* don't attempt to pad fixed-size packet buffers */
     if (!s->max_packet_size) {
-        put_buffer(s, padbuf, sizeof(padbuf));
+        avio_write(s, padbuf, sizeof(padbuf));
         padding = FF_INPUT_BUFFER_PADDING_SIZE;
     }
 
-    put_flush_packet(s);
+    avio_flush(s);
 
     *pbuffer = d->buffer;
     size = d->size;
@@ -961,4 +1186,3 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
     av_free(s);
     return size - padding;
 }
-#endif /* CONFIG_MUXERS || CONFIG_NETWORK */
diff --git a/ffmpeg-mt/libavformat/avisynth.c b/ffmpeg-mt/libavformat/avisynth.c
index e2a8a3c..5e6f6bf 100644
--- a/ffmpeg-mt/libavformat/avisynth.c
+++ b/ffmpeg-mt/libavformat/avisynth.c
@@ -2,20 +2,20 @@
  * AVISynth support for ffmpeg system
  * Copyright (c) 2006 DivX, Inc.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -207,7 +207,7 @@ static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t pts,
   return 0;
 }
 
-AVInputFormat avisynth_demuxer = {
+AVInputFormat ff_avisynth_demuxer = {
   "avs",
   NULL_IF_CONFIG_SMALL("AVISynth"),
   sizeof(AVISynthContext),
diff --git a/ffmpeg-mt/libavformat/avlanguage.c b/ffmpeg-mt/libavformat/avlanguage.c
index 525bf07..787382e 100644
--- a/ffmpeg-mt/libavformat/avlanguage.c
+++ b/ffmpeg-mt/libavformat/avlanguage.c
@@ -1,20 +1,20 @@
 /*
  * Cyril Comparon, Larbi Joubala, Resonate-MP4 2009
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/avlanguage.h b/ffmpeg-mt/libavformat/avlanguage.h
index 7fb8968..2ec3e2d 100644
--- a/ffmpeg-mt/libavformat/avlanguage.h
+++ b/ffmpeg-mt/libavformat/avlanguage.h
@@ -1,20 +1,20 @@
 /*
  * Cyril Comparon, Larbi Joubala, Resonate-MP4 2009
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/avs.c b/ffmpeg-mt/libavformat/avs.c
index caf3a89..bd9b31d 100644
--- a/ffmpeg-mt/libavformat/avs.c
+++ b/ffmpeg-mt/libavformat/avs.c
@@ -2,20 +2,20 @@
  * AVS demuxer.
  * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -61,12 +61,12 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
 
     s->ctx_flags |= AVFMTCTX_NOHEADER;
 
-    url_fskip(s->pb, 4);
-    avs->width = get_le16(s->pb);
-    avs->height = get_le16(s->pb);
-    avs->bits_per_sample = get_le16(s->pb);
-    avs->fps = get_le16(s->pb);
-    avs->nb_frames = get_le32(s->pb);
+    avio_skip(s->pb, 4);
+    avs->width = avio_rl16(s->pb);
+    avs->height = avio_rl16(s->pb);
+    avs->bits_per_sample = avio_rl16(s->pb);
+    avs->fps = avio_rl16(s->pb);
+    avs->nb_frames = avio_rl32(s->pb);
     avs->remaining_frame_size = 0;
     avs->remaining_audio_size = 0;
 
@@ -104,7 +104,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
     pkt->data[palette_size + 1] = type;
     pkt->data[palette_size + 2] = size & 0xFF;
     pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
-    ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
+    ret = avio_read(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
     if (ret < size) {
         av_free_packet(pkt);
         return AVERROR(EIO);
@@ -123,9 +123,9 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
     AvsFormat *avs = s->priv_data;
     int ret, size;
 
-    size = url_ftell(s->pb);
+    size = avio_tell(s->pb);
     ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
-    size = url_ftell(s->pb) - size;
+    size = avio_tell(s->pb) - size;
     avs->remaining_audio_size -= size;
 
     if (ret == AVERROR(EIO))
@@ -154,20 +154,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
 
     while (1) {
         if (avs->remaining_frame_size <= 0) {
-            if (!get_le16(s->pb))    /* found EOF */
+            if (!avio_rl16(s->pb))    /* found EOF */
                 return AVERROR(EIO);
-            avs->remaining_frame_size = get_le16(s->pb) - 4;
+            avs->remaining_frame_size = avio_rl16(s->pb) - 4;
         }
 
         while (avs->remaining_frame_size > 0) {
-            sub_type = get_byte(s->pb);
-            type = get_byte(s->pb);
-            size = get_le16(s->pb);
+            sub_type = avio_r8(s->pb);
+            type = avio_r8(s->pb);
+            size = avio_rl16(s->pb);
             avs->remaining_frame_size -= size;
 
             switch (type) {
             case AVS_PALETTE:
-                ret = get_buffer(s->pb, palette, size - 4);
+                ret = avio_read(s->pb, palette, size - 4);
                 if (ret < size - 4)
                     return AVERROR(EIO);
                 palette_size = size;
@@ -204,7 +204,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
                 break;
 
             default:
-                url_fskip(s->pb, size - 4);
+                avio_skip(s->pb, size - 4);
             }
         }
     }
@@ -215,7 +215,7 @@ static int avs_read_close(AVFormatContext * s)
     return 0;
 }
 
-AVInputFormat avs_demuxer = {
+AVInputFormat ff_avs_demuxer = {
     "avs",
     NULL_IF_CONFIG_SMALL("AVS format"),
     sizeof(AvsFormat),
diff --git a/ffmpeg-mt/libavformat/bethsoftvid.c b/ffmpeg-mt/libavformat/bethsoftvid.c
index 4f9d1c1..01e6f55 100644
--- a/ffmpeg-mt/libavformat/bethsoftvid.c
+++ b/ffmpeg-mt/libavformat/bethsoftvid.c
@@ -2,20 +2,20 @@
  * Bethsoft VID format Demuxer
  * Copyright (c) 2007 Nicholas Tung
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -60,15 +60,15 @@ static int vid_read_header(AVFormatContext *s,
                             AVFormatParameters *ap)
 {
     BVID_DemuxContext *vid = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *stream;
 
     /* load main header. Contents:
     *    bytes: 'V' 'I' 'D'
     *    int16s: always_512, nframes, width, height, delay, always_14
     */
-    url_fseek(pb, 5, SEEK_CUR);
-    vid->nframes = get_le16(pb);
+    avio_skip(pb, 5);
+    vid->nframes = avio_rl16(pb);
 
     stream = av_new_stream(s, 0);
     if (!stream)
@@ -76,11 +76,11 @@ static int vid_read_header(AVFormatContext *s,
     av_set_pts_info(stream, 32, 1, 60);     // 16 ms increments, i.e. 60 fps
     stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
-    stream->codec->width = get_le16(pb);
-    stream->codec->height = get_le16(pb);
+    stream->codec->width = avio_rl16(pb);
+    stream->codec->height = avio_rl16(pb);
     stream->codec->pix_fmt = PIX_FMT_PAL8;
-    vid->bethsoft_global_delay = get_le16(pb);
-    get_le16(pb);
+    vid->bethsoft_global_delay = avio_rl16(pb);
+    avio_rl16(pb);
 
     // done with video codec, set up audio codec
     stream = av_new_stream(s, 0);
@@ -97,7 +97,7 @@ static int vid_read_header(AVFormatContext *s,
 }
 
 #define BUFFER_PADDING_SIZE 1000
-static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
+static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
                       uint8_t block_type, AVFormatContext *s, int npixels)
 {
     uint8_t * vidbuf_start = NULL;
@@ -112,16 +112,16 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
         return AVERROR(ENOMEM);
 
     // save the file position for the packet, include block type
-    position = url_ftell(pb) - 1;
+    position = avio_tell(pb) - 1;
 
     vidbuf_start[vidbuf_nbytes++] = block_type;
 
     // get the video delay (next int16), and set the presentation time
-    vid->video_pts += vid->bethsoft_global_delay + get_le16(pb);
+    vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb);
 
     // set the y offset if it exists (decoder header data should be in data section)
     if(block_type == VIDEO_YOFF_P_FRAME){
-        if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
+        if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
             goto fail;
         vidbuf_nbytes += 2;
     }
@@ -131,22 +131,22 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
         if(!vidbuf_start)
             return AVERROR(ENOMEM);
 
-        code = get_byte(pb);
+        code = avio_r8(pb);
         vidbuf_start[vidbuf_nbytes++] = code;
 
         if(code >= 0x80){ // rle sequence
             if(block_type == VIDEO_I_FRAME)
-                vidbuf_start[vidbuf_nbytes++] = get_byte(pb);
+                vidbuf_start[vidbuf_nbytes++] = avio_r8(pb);
         } else if(code){ // plain sequence
-            if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
+            if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
                 goto fail;
             vidbuf_nbytes += code;
         }
         bytes_copied += code & 0x7F;
         if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied
             // may contain a 0 byte even if read all pixels
-            if(get_byte(pb))
-                url_fseek(pb, -1, SEEK_CUR);
+            if(avio_r8(pb))
+                avio_seek(pb, -1, SEEK_CUR);
             break;
         }
         if(bytes_copied > npixels)
@@ -174,18 +174,18 @@ static int vid_read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
     BVID_DemuxContext *vid = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned char block_type;
     int audio_length;
     int ret_value;
 
-    if(vid->is_finished || url_feof(pb))
+    if(vid->is_finished || pb->eof_reached)
         return AVERROR(EIO);
 
-    block_type = get_byte(pb);
+    block_type = avio_r8(pb);
     switch(block_type){
         case PALETTE_BLOCK:
-            url_fseek(pb, -1, SEEK_CUR);     // include block type
+            avio_seek(pb, -1, SEEK_CUR);     // include block type
             ret_value = av_get_packet(pb, pkt, 3 * 256 + 1);
             if(ret_value != 3 * 256 + 1){
                 av_free_packet(pkt);
@@ -195,12 +195,12 @@ static int vid_read_packet(AVFormatContext *s,
             return ret_value;
 
         case FIRST_AUDIO_BLOCK:
-            get_le16(pb);
+            avio_rl16(pb);
             // soundblaster DAC used for sample rate, as on specification page (link above)
-            s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
+            s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb));
             s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
         case AUDIO_BLOCK:
-            audio_length = get_le16(pb);
+            audio_length = avio_rl16(pb);
             ret_value = av_get_packet(pb, pkt, audio_length);
             pkt->stream_index = 1;
             return ret_value != audio_length ? AVERROR(EIO) : ret_value;
@@ -224,7 +224,7 @@ static int vid_read_packet(AVFormatContext *s,
     return 0;
 }
 
-AVInputFormat bethsoftvid_demuxer = {
+AVInputFormat ff_bethsoftvid_demuxer = {
     "bethsoftvid",
     NULL_IF_CONFIG_SMALL("Bethesda Softworks VID format"),
     sizeof(BVID_DemuxContext),
diff --git a/ffmpeg-mt/libavformat/bfi.c b/ffmpeg-mt/libavformat/bfi.c
index 94014a4..bc26d47 100644
--- a/ffmpeg-mt/libavformat/bfi.c
+++ b/ffmpeg-mt/libavformat/bfi.c
@@ -2,20 +2,20 @@
  * Brute Force & Ignorance (BFI) demuxer
  * Copyright (c) 2008 Sisir Koppaka
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -49,7 +49,7 @@ static int bfi_probe(AVProbeData * p)
 static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
 {
     BFIContext *bfi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *vstream;
     AVStream *astream;
     int fps, chunk_header;
@@ -65,25 +65,25 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
         return AVERROR(ENOMEM);
 
     /* Set the total number of frames. */
-    url_fskip(pb, 8);
-    chunk_header           = get_le32(pb);
-    bfi->nframes           = get_le32(pb);
-    get_le32(pb);
-    get_le32(pb);
-    get_le32(pb);
-    fps                    = get_le32(pb);
-    url_fskip(pb, 12);
-    vstream->codec->width  = get_le32(pb);
-    vstream->codec->height = get_le32(pb);
+    avio_skip(pb, 8);
+    chunk_header           = avio_rl32(pb);
+    bfi->nframes           = avio_rl32(pb);
+    avio_rl32(pb);
+    avio_rl32(pb);
+    avio_rl32(pb);
+    fps                    = avio_rl32(pb);
+    avio_skip(pb, 12);
+    vstream->codec->width  = avio_rl32(pb);
+    vstream->codec->height = avio_rl32(pb);
 
     /*Load the palette to extradata */
-    url_fskip(pb, 8);
+    avio_skip(pb, 8);
     vstream->codec->extradata      = av_malloc(768);
     vstream->codec->extradata_size = 768;
-    get_buffer(pb, vstream->codec->extradata,
+    avio_read(pb, vstream->codec->extradata,
                vstream->codec->extradata_size);
 
-    astream->codec->sample_rate = get_le32(pb);
+    astream->codec->sample_rate = avio_rl32(pb);
 
     /* Set up the video codec... */
     av_set_pts_info(vstream, 32, 1, fps);
@@ -98,7 +98,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
     astream->codec->bits_per_coded_sample = 8;
     astream->codec->bit_rate        =
         astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
-    url_fseek(pb, chunk_header - 3, SEEK_SET);
+    avio_seek(pb, chunk_header - 3, SEEK_SET);
     av_set_pts_info(astream, 64, 1, astream->codec->sample_rate);
     return 0;
 }
@@ -107,9 +107,9 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
 static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
 {
     BFIContext *bfi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
-    if (bfi->nframes == 0 || url_feof(pb)) {
+    if (bfi->nframes == 0 || pb->eof_reached) {
         return AVERROR(EIO);
     }
 
@@ -117,16 +117,16 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
     if (!bfi->avflag) {
         uint32_t state = 0;
         while(state != MKTAG('S','A','V','I')){
-            if (url_feof(pb))
+            if (pb->eof_reached)
                 return AVERROR(EIO);
-            state = 256*state + get_byte(pb);
+            state = 256*state + avio_r8(pb);
         }
         /* Now that the chunk's location is confirmed, we proceed... */
-        chunk_size      = get_le32(pb);
-        get_le32(pb);
-        audio_offset    = get_le32(pb);
-        get_le32(pb);
-        video_offset    = get_le32(pb);
+        chunk_size      = avio_rl32(pb);
+        avio_rl32(pb);
+        audio_offset    = avio_rl32(pb);
+        avio_rl32(pb);
+        video_offset    = avio_rl32(pb);
         audio_size      = video_offset - audio_offset;
         bfi->video_size = chunk_size - video_offset;
 
@@ -158,7 +158,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
     return ret;
 }
 
-AVInputFormat bfi_demuxer = {
+AVInputFormat ff_bfi_demuxer = {
     "bfi",
     NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
     sizeof(BFIContext),
diff --git a/ffmpeg-mt/libavformat/bink.c b/ffmpeg-mt/libavformat/bink.c
index afa629f..76b457c 100644
--- a/ffmpeg-mt/libavformat/bink.c
+++ b/ffmpeg-mt/libavformat/bink.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008-2010 Peter Ross (pross at xvid.org)
  * Copyright (c) 2009 Daniel Verkamp (daniel at drv.nu)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -70,7 +70,7 @@ static int probe(AVProbeData *p)
 static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     BinkDemuxContext *bink = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint32_t fps_num, fps_den;
     AVStream *vst, *ast;
     unsigned int i;
@@ -82,29 +82,29 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     if (!vst)
         return AVERROR(ENOMEM);
 
-    vst->codec->codec_tag = get_le32(pb);
+    vst->codec->codec_tag = avio_rl32(pb);
 
-    bink->file_size = get_le32(pb) + 8;
-    vst->duration   = get_le32(pb);
+    bink->file_size = avio_rl32(pb) + 8;
+    vst->duration   = avio_rl32(pb);
 
     if (vst->duration > 1000000) {
         av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n");
         return AVERROR(EIO);
     }
 
-    if (get_le32(pb) > bink->file_size) {
+    if (avio_rl32(pb) > bink->file_size) {
         av_log(s, AV_LOG_ERROR,
                "invalid header: largest frame size greater than file size\n");
         return AVERROR(EIO);
     }
 
-    url_fskip(pb, 4);
+    avio_skip(pb, 4);
 
-    vst->codec->width  = get_le32(pb);
-    vst->codec->height = get_le32(pb);
+    vst->codec->width  = avio_rl32(pb);
+    vst->codec->height = avio_rl32(pb);
 
-    fps_num = get_le32(pb);
-    fps_den = get_le32(pb);
+    fps_num = avio_rl32(pb);
+    fps_den = avio_rl32(pb);
     if (fps_num == 0 || fps_den == 0) {
         av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den);
         return AVERROR(EIO);
@@ -115,9 +115,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     vst->codec->codec_id   = CODEC_ID_BINKVIDEO;
     vst->codec->extradata  = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
     vst->codec->extradata_size = 4;
-    get_buffer(pb, vst->codec->extradata, 4);
+    avio_read(pb, vst->codec->extradata, 4);
 
-    bink->num_audio_tracks = get_le32(pb);
+    bink->num_audio_tracks = avio_rl32(pb);
 
     if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) {
         av_log(s, AV_LOG_ERROR,
@@ -127,34 +127,35 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     }
 
     if (bink->num_audio_tracks) {
-        url_fskip(pb, 4 * bink->num_audio_tracks);
+        avio_skip(pb, 4 * bink->num_audio_tracks);
 
         for (i = 0; i < bink->num_audio_tracks; i++) {
             ast = av_new_stream(s, 1);
             if (!ast)
                 return AVERROR(ENOMEM);
             ast->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-            ast->codec->codec_tag   = 0;
-            ast->codec->sample_rate = get_le16(pb);
+            ast->codec->codec_tag   = vst->codec->codec_tag;
+            ast->codec->sample_rate = avio_rl16(pb);
             av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
-            flags = get_le16(pb);
+            flags = avio_rl16(pb);
             ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
                                    CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
             ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
         }
 
-        url_fskip(pb, 4 * bink->num_audio_tracks);
+        for (i = 0; i < bink->num_audio_tracks; i++)
+            s->streams[i + 1]->id = avio_rl32(pb);
     }
 
     /* frame index table */
-    next_pos = get_le32(pb);
+    next_pos = avio_rl32(pb);
     for (i = 0; i < vst->duration; i++) {
         pos = next_pos;
         if (i == vst->duration - 1) {
             next_pos = bink->file_size;
             keyframe = 0;
         } else {
-            next_pos = get_le32(pb);
+            next_pos = avio_rl32(pb);
             keyframe = pos & 1;
         }
         pos &= ~1;
@@ -168,7 +169,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
                            keyframe ? AVINDEX_KEYFRAME : 0);
     }
 
-    url_fskip(pb, 4);
+    avio_skip(pb, 4);
 
     bink->current_track = -1;
     return 0;
@@ -177,7 +178,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     BinkDemuxContext *bink = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret;
 
     if (bink->current_track < 0) {
@@ -201,7 +202,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     while (bink->current_track < bink->num_audio_tracks) {
-        uint32_t audio_size = get_le32(pb);
+        uint32_t audio_size = avio_rl32(pb);
         if (audio_size > bink->remain_packet_size - 4) {
             av_log(s, AV_LOG_ERROR,
                    "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n",
@@ -224,7 +225,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
                     AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
             return 0;
         } else {
-            url_fseek(pb, audio_size, SEEK_CUR);
+            avio_skip(pb, audio_size);
         }
     }
 
@@ -246,18 +247,18 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
     BinkDemuxContext *bink = s->priv_data;
     AVStream *vst = s->streams[0];
 
-    if (url_is_streamed(s->pb))
+    if (!s->pb->seekable)
         return -1;
 
     /* seek to the first frame */
-    url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET);
+    avio_seek(s->pb, vst->index_entries[0].pos, SEEK_SET);
     bink->video_pts = 0;
     memset(bink->audio_pts, 0, sizeof(bink->audio_pts));
     bink->current_track = -1;
     return 0;
 }
 
-AVInputFormat bink_demuxer = {
+AVInputFormat ff_bink_demuxer = {
     "bink",
     NULL_IF_CONFIG_SMALL("Bink"),
     sizeof(BinkDemuxContext),
diff --git a/ffmpeg-mt/libavformat/c93.c b/ffmpeg-mt/libavformat/c93.c
index 033b36b..097565a 100644
--- a/ffmpeg-mt/libavformat/c93.c
+++ b/ffmpeg-mt/libavformat/c93.c
@@ -2,20 +2,20 @@
  * Interplay C93 demuxer
  * Copyright (c) 2007 Anssi Hannula <anssi.hannula at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -60,15 +60,15 @@ static int read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
     AVStream *video;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     C93DemuxContext *c93 = s->priv_data;
     int i;
     int framecount = 0;
 
     for (i = 0; i < 512; i++) {
-        c93->block_records[i].index = get_le16(pb);
-        c93->block_records[i].length = get_byte(pb);
-        c93->block_records[i].frames = get_byte(pb);
+        c93->block_records[i].index = avio_rl16(pb);
+        c93->block_records[i].length = avio_r8(pb);
+        c93->block_records[i].frames = avio_r8(pb);
         if (c93->block_records[i].frames > 32) {
             av_log(s, AV_LOG_ERROR, "too many frames in block\n");
             return AVERROR_INVALIDDATA;
@@ -89,7 +89,7 @@ static int read_header(AVFormatContext *s,
     video->codec->height = 192;
     /* 4:3 320x200 with 8 empty lines */
     video->sample_aspect_ratio = (AVRational) { 5, 6 };
-    video->time_base = (AVRational) { 2, 25 };
+    av_set_pts_info(video, 64, 2, 25);
     video->nb_frames = framecount;
     video->duration = framecount;
     video->start_time = 0;
@@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s,
 
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     C93DemuxContext *c93 = s->priv_data;
     C93BlockRecord *br = &c93->block_records[c93->current_block];
     int datasize;
@@ -114,7 +114,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     if (c93->next_pkt_is_audio) {
         c93->current_frame++;
         c93->next_pkt_is_audio = 0;
-        datasize = get_le16(pb);
+        datasize = avio_rl16(pb);
         if (datasize > 42) {
             if (!c93->audio) {
                 c93->audio = av_new_stream(s, 1);
@@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
                     return AVERROR(ENOMEM);
                 c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
             }
-            url_fskip(pb, 26); /* VOC header */
+            avio_skip(pb, 26); /* VOC header */
             ret = voc_get_packet(s, pkt, c93->audio, datasize - 26);
             if (ret > 0) {
                 pkt->stream_index = 1;
@@ -140,15 +140,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     if (c93->current_frame == 0) {
-        url_fseek(pb, br->index * 2048, SEEK_SET);
+        avio_seek(pb, br->index * 2048, SEEK_SET);
         for (i = 0; i < 32; i++) {
-            c93->frame_offsets[i] = get_le32(pb);
+            c93->frame_offsets[i] = avio_rl32(pb);
         }
     }
 
-    url_fseek(pb,br->index * 2048 +
+    avio_seek(pb,br->index * 2048 +
             c93->frame_offsets[c93->current_frame], SEEK_SET);
-    datasize = get_le16(pb); /* video frame size */
+    datasize = avio_rl16(pb); /* video frame size */
 
     ret = av_new_packet(pkt, datasize + 768 + 1);
     if (ret < 0)
@@ -156,13 +156,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     pkt->data[0] = 0;
     pkt->size = datasize + 1;
 
-    ret = get_buffer(pb, pkt->data + 1, datasize);
+    ret = avio_read(pb, pkt->data + 1, datasize);
     if (ret < datasize) {
         ret = AVERROR(EIO);
         goto fail;
     }
 
-    datasize = get_le16(pb); /* palette size */
+    datasize = avio_rl16(pb); /* palette size */
     if (datasize) {
         if (datasize != 768) {
             av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize);
@@ -170,7 +170,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
             goto fail;
         }
         pkt->data[0] |= C93_HAS_PALETTE;
-        ret = get_buffer(pb, pkt->data + pkt->size, datasize);
+        ret = avio_read(pb, pkt->data + pkt->size, datasize);
         if (ret < datasize) {
             ret = AVERROR(EIO);
             goto fail;
@@ -192,7 +192,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat c93_demuxer = {
+AVInputFormat ff_c93_demuxer = {
     "c93",
     NULL_IF_CONFIG_SMALL("Interplay C93"),
     sizeof(C93DemuxContext),
diff --git a/ffmpeg-mt/libavformat/caf.c b/ffmpeg-mt/libavformat/caf.c
index 96fb847..c204c90 100644
--- a/ffmpeg-mt/libavformat/caf.c
+++ b/ffmpeg-mt/libavformat/caf.c
@@ -2,20 +2,20 @@
  * CAF common code
  * Copyright (c) 2007  Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/caf.h b/ffmpeg-mt/libavformat/caf.h
index 9c25f2c..7ca4dc5 100644
--- a/ffmpeg-mt/libavformat/caf.h
+++ b/ffmpeg-mt/libavformat/caf.h
@@ -2,20 +2,20 @@
  * CAF common code
  * Copyright (c) 2007  Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/cafdec.c b/ffmpeg-mt/libavformat/cafdec.c
index 201c5f2..c720c34 100644
--- a/ffmpeg-mt/libavformat/cafdec.c
+++ b/ffmpeg-mt/libavformat/cafdec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Justin Ruggles
  * Copyright (c) 2009 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -53,7 +53,7 @@ static int probe(AVProbeData *p)
 /** Read audio description chunk */
 static int read_desc_chunk(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     CaffContext *caf  = s->priv_data;
     AVStream *st;
     int flags;
@@ -65,14 +65,14 @@ static int read_desc_chunk(AVFormatContext *s)
 
     /* parse format description */
     st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-    st->codec->sample_rate = av_int2dbl(get_be64(pb));
-    st->codec->codec_tag   = get_be32(pb);
-    flags = get_be32(pb);
-    caf->bytes_per_packet  = get_be32(pb);
+    st->codec->sample_rate = av_int2dbl(avio_rb64(pb));
+    st->codec->codec_tag   = avio_rb32(pb);
+    flags = avio_rb32(pb);
+    caf->bytes_per_packet  = avio_rb32(pb);
     st->codec->block_align = caf->bytes_per_packet;
-    caf->frames_per_packet = get_be32(pb);
-    st->codec->channels    = get_be32(pb);
-    st->codec->bits_per_coded_sample = get_be32(pb);
+    caf->frames_per_packet = avio_rb32(pb);
+    st->codec->channels    = avio_rb32(pb);
+    st->codec->bits_per_coded_sample = avio_rb32(pb);
 
     /* calculate bit rate for constant size packets */
     if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
@@ -93,7 +93,7 @@ static int read_desc_chunk(AVFormatContext *s)
 /** Read magic cookie chunk */
 static int read_kuki_chunk(AVFormatContext *s, int64_t size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st      = s->streams[0];
 
     if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
@@ -106,35 +106,35 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
         int strt, skip;
         MOVAtom atom;
 
-        strt = url_ftell(pb);
+        strt = avio_tell(pb);
         ff_mov_read_esds(s, pb, atom);
-        skip = size - (url_ftell(pb) - strt);
+        skip = size - (avio_tell(pb) - strt);
         if (skip < 0 || !st->codec->extradata ||
             st->codec->codec_id != CODEC_ID_AAC) {
             av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n");
             return AVERROR_INVALIDDATA;
         }
-        url_fskip(pb, skip);
+        avio_skip(pb, skip);
     } else if (st->codec->codec_id == CODEC_ID_ALAC) {
 #define ALAC_PREAMBLE 12
 #define ALAC_HEADER   36
         if (size < ALAC_PREAMBLE + ALAC_HEADER) {
             av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
-            url_fskip(pb, size);
+            avio_skip(pb, size);
             return AVERROR_INVALIDDATA;
         }
-        url_fskip(pb, ALAC_PREAMBLE);
+        avio_skip(pb, ALAC_PREAMBLE);
         st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
         if (!st->codec->extradata)
             return AVERROR(ENOMEM);
-        get_buffer(pb, st->codec->extradata, ALAC_HEADER);
+        avio_read(pb, st->codec->extradata, ALAC_HEADER);
         st->codec->extradata_size = ALAC_HEADER;
-        url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
+        avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
     } else {
         st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
         if (!st->codec->extradata)
             return AVERROR(ENOMEM);
-        get_buffer(pb, st->codec->extradata, size);
+        avio_read(pb, st->codec->extradata, size);
         st->codec->extradata_size = size;
     }
 
@@ -144,21 +144,21 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
 /** Read packet table chunk */
 static int read_pakt_chunk(AVFormatContext *s, int64_t size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st      = s->streams[0];
     CaffContext *caf  = s->priv_data;
     int64_t pos = 0, ccount;
     int num_packets, i;
 
-    ccount = url_ftell(pb);
+    ccount = avio_tell(pb);
 
-    num_packets = get_be64(pb);
+    num_packets = avio_rb64(pb);
     if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
         return AVERROR_INVALIDDATA;
 
-    st->nb_frames  = get_be64(pb); /* valid frames */
-    st->nb_frames += get_be32(pb); /* priming frames */
-    st->nb_frames += get_be32(pb); /* remainder frames */
+    st->nb_frames  = avio_rb64(pb); /* valid frames */
+    st->nb_frames += avio_rb32(pb); /* priming frames */
+    st->nb_frames += avio_rb32(pb); /* remainder frames */
 
     st->duration = 0;
     for (i = 0; i < num_packets; i++) {
@@ -167,7 +167,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
         st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
     }
 
-    if (url_ftell(pb) - ccount != size) {
+    if (avio_tell(pb) - ccount != size) {
         av_log(s, AV_LOG_ERROR, "error reading packet table\n");
         return -1;
     }
@@ -179,14 +179,14 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
 /** Read information chunk */
 static void read_info_chunk(AVFormatContext *s, int64_t size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int i;
-    unsigned int nb_entries = get_be32(pb);
+    unsigned int nb_entries = avio_rb32(pb);
     for (i = 0; i < nb_entries; i++) {
         char key[32];
         char value[1024];
-        get_strz(pb, key, sizeof(key));
-        get_strz(pb, value, sizeof(value));
+        avio_get_str(pb, INT_MAX, key,   sizeof(key));
+        avio_get_str(pb, INT_MAX, value, sizeof(value));
         av_metadata_set2(&s->metadata, key, value, 0);
     }
 }
@@ -194,21 +194,21 @@ static void read_info_chunk(AVFormatContext *s, int64_t size)
 static int read_header(AVFormatContext *s,
                        AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     CaffContext *caf  = s->priv_data;
     AVStream *st;
     uint32_t tag = 0;
     int found_data, ret;
     int64_t size;
 
-    url_fskip(pb, 8); /* magic, version, file flags */
+    avio_skip(pb, 8); /* magic, version, file flags */
 
     /* audio description chunk */
-    if (get_be32(pb) != MKBETAG('d','e','s','c')) {
+    if (avio_rb32(pb) != MKBETAG('d','e','s','c')) {
         av_log(s, AV_LOG_ERROR, "desc chunk not present\n");
         return AVERROR_INVALIDDATA;
     }
-    size = get_be64(pb);
+    size = avio_rb64(pb);
     if (size != 32)
         return AVERROR_INVALIDDATA;
 
@@ -219,25 +219,25 @@ static int read_header(AVFormatContext *s,
 
     /* parse each chunk */
     found_data = 0;
-    while (!url_feof(pb)) {
+    while (!pb->eof_reached) {
 
         /* stop at data chunk if seeking is not supported or
            data chunk size is unknown */
-        if (found_data && (caf->data_size < 0 || url_is_streamed(pb)))
+        if (found_data && (caf->data_size < 0 || !pb->seekable))
             break;
 
-        tag  = get_be32(pb);
-        size = get_be64(pb);
-        if (url_feof(pb))
+        tag  = avio_rb32(pb);
+        size = avio_rb64(pb);
+        if (pb->eof_reached)
             break;
 
         switch (tag) {
         case MKBETAG('d','a','t','a'):
-            url_fskip(pb, 4); /* edit count */
-            caf->data_start = url_ftell(pb);
+            avio_skip(pb, 4); /* edit count */
+            caf->data_start = avio_tell(pb);
             caf->data_size  = size < 0 ? -1 : size - 4;
-            if (caf->data_size > 0 && !url_is_streamed(pb))
-                url_fskip(pb, caf->data_size);
+            if (caf->data_size > 0 && pb->seekable)
+                avio_skip(pb, caf->data_size);
             found_data = 1;
             break;
 
@@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s,
         case MKBETAG('f','r','e','e'):
             if (size < 0)
                 return AVERROR_INVALIDDATA;
-            url_fskip(pb, size);
+            avio_skip(pb, size);
             break;
         }
     }
@@ -284,7 +284,7 @@ static int read_header(AVFormatContext *s,
                                 "block size or frame size are variable.\n");
         return AVERROR_INVALIDDATA;
     }
-    s->file_size = url_fsize(pb);
+    s->file_size = avio_size(pb);
     s->file_size = FFMAX(0, s->file_size);
 
     av_set_pts_info(st, 64, 1, st->codec->sample_rate);
@@ -292,7 +292,7 @@ static int read_header(AVFormatContext *s,
 
     /* position the stream at the start of data */
     if (caf->data_size >= 0)
-        url_fseek(pb, caf->data_start, SEEK_SET);
+        avio_seek(pb, caf->data_start, SEEK_SET);
 
     return 0;
 }
@@ -301,18 +301,18 @@ static int read_header(AVFormatContext *s,
 
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st      = s->streams[0];
     CaffContext *caf  = s->priv_data;
     int res, pkt_size = 0, pkt_frames = 0;
     int64_t left      = CAF_MAX_PKT_SIZE;
 
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return AVERROR(EIO);
 
     /* don't read past end of data chunk */
     if (caf->data_size > 0) {
-        left = (caf->data_start + caf->data_size) - url_ftell(pb);
+        left = (caf->data_start + caf->data_size) - avio_tell(pb);
         if (left <= 0)
             return AVERROR(EIO);
     }
@@ -377,11 +377,11 @@ static int read_seek(AVFormatContext *s, int stream_index,
         return -1;
     }
 
-    url_fseek(s->pb, pos + caf->data_start, SEEK_SET);
+    avio_seek(s->pb, pos + caf->data_start, SEEK_SET);
     return 0;
 }
 
-AVInputFormat caf_demuxer = {
+AVInputFormat ff_caf_demuxer = {
     "caf",
     NULL_IF_CONFIG_SMALL("Apple Core Audio Format"),
     sizeof(CaffContext),
diff --git a/ffmpeg-mt/libavformat/cavsvideodec.c b/ffmpeg-mt/libavformat/cavsvideodec.c
index 51a7501..f58c56f 100644
--- a/ffmpeg-mt/libavformat/cavsvideodec.c
+++ b/ffmpeg-mt/libavformat/cavsvideodec.c
@@ -2,20 +2,20 @@
  * RAW Chinese AVS video demuxer
  * Copyright (c) 2009  Stefan Gehrer <stefan.gehrer at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -65,7 +65,7 @@ static int cavsvideo_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat cavsvideo_demuxer = {
+AVInputFormat ff_cavsvideo_demuxer = {
     "cavsvideo",
     NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
     0,
diff --git a/ffmpeg-mt/libavformat/cdg.c b/ffmpeg-mt/libavformat/cdg.c
index 2f4fb27..b47a20e 100644
--- a/ffmpeg-mt/libavformat/cdg.c
+++ b/ffmpeg-mt/libavformat/cdg.c
@@ -2,20 +2,20 @@
  * CD Graphics Demuxer
  * Copyright (c) 2009 Michael Tison
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -38,7 +38,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     /// 75 sectors/sec * 4 packets/sector = 300 packets/sec
     av_set_pts_info(vst, 32, 1, 300);
 
-    ret = url_fsize(s->pb);
+    ret = avio_size(s->pb);
     if (ret > 0)
         vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300);
 
@@ -55,7 +55,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat cdg_demuxer = {
+AVInputFormat ff_cdg_demuxer = {
     "cdg",
     NULL_IF_CONFIG_SMALL("CD Graphics Format"),
     0,
diff --git a/ffmpeg-mt/libavformat/concat.c b/ffmpeg-mt/libavformat/concat.c
index 3a19d0a..da9bee2 100644
--- a/ffmpeg-mt/libavformat/concat.c
+++ b/ffmpeg-mt/libavformat/concat.c
@@ -4,26 +4,27 @@
  * Copyright (c) 2007 Wolfram Gloger
  * Copyright (c) 2010 Michele Orrù
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mem.h"
+#include "url.h"
 
 #define AV_CAT_SEPARATOR "|"
 
@@ -46,7 +47,7 @@ static av_cold int concat_close(URLContext *h)
     struct concat_nodes *nodes = data->nodes;
 
     for (i = 0; i != data->length; i++)
-        err |= url_close(nodes[i].uc);
+        err |= ffurl_close(nodes[i].uc);
 
     av_freep(&data->nodes);
     av_freep(&h->priv_data);
@@ -100,12 +101,12 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
         uri += len + strspn(uri+len, AV_CAT_SEPARATOR);
 
         /* creating URLContext */
-        if ((err = url_open(&uc, node_uri, flags)) < 0)
+        if ((err = ffurl_open(&uc, node_uri, flags)) < 0)
             break;
 
         /* creating size */
-        if ((size = url_filesize(uc)) < 0) {
-            url_close(uc);
+        if ((size = ffurl_size(uc)) < 0) {
+            ffurl_close(uc);
             err = AVERROR(ENOSYS);
             break;
         }
@@ -135,12 +136,12 @@ static int concat_read(URLContext *h, unsigned char *buf, int size)
     size_t i = data->current;
 
     while (size > 0) {
-        result = url_read(nodes[i].uc, buf, size);
+        result = ffurl_read(nodes[i].uc, buf, size);
         if (result < 0)
             return total ? total : result;
         if (!result)
             if (i + 1 == data->length ||
-                url_seek(nodes[++i].uc, 0, SEEK_SET) < 0)
+                ffurl_seek(nodes[++i].uc, 0, SEEK_SET) < 0)
                 break;
         total += result;
         buf   += result;
@@ -168,7 +169,7 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
         /* get the absolute position */
         for (i = 0; i != data->current; i++)
             pos += nodes[i].size;
-        pos += url_seek(nodes[i].uc, 0, SEEK_CUR);
+        pos += ffurl_seek(nodes[i].uc, 0, SEEK_CUR);
         whence = SEEK_SET;
         /* fall through with the absolute position */
     case SEEK_SET:
@@ -179,7 +180,7 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
         return AVERROR(EINVAL);
     }
 
-    result = url_seek(nodes[i].uc, pos, whence);
+    result = ffurl_seek(nodes[i].uc, pos, whence);
     if (result >= 0) {
         data->current = i;
         while (i)
@@ -188,11 +189,10 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
     return result;
 }
 
-URLProtocol concat_protocol = {
-    "concat",
-    concat_open,
-    concat_read,
-    NULL,
-    concat_seek,
-    concat_close,
+URLProtocol ff_concat_protocol = {
+    .name      = "concat",
+    .url_open  = concat_open,
+    .url_read  = concat_read,
+    .url_seek  = concat_seek,
+    .url_close = concat_close,
 };
diff --git a/ffmpeg-mt/libavformat/crcenc.c b/ffmpeg-mt/libavformat/crcenc.c
index b343464..55c99d9 100644
--- a/ffmpeg-mt/libavformat/crcenc.c
+++ b/ffmpeg-mt/libavformat/crcenc.c
@@ -2,20 +2,20 @@
  * CRC encoder (for codec/format testing)
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -49,12 +49,12 @@ static int crc_write_trailer(struct AVFormatContext *s)
     char buf[64];
 
     snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
-    put_buffer(s->pb, buf, strlen(buf));
-    put_flush_packet(s->pb);
+    avio_write(s->pb, buf, strlen(buf));
+    avio_flush(s->pb);
     return 0;
 }
 
-AVOutputFormat crc_muxer = {
+AVOutputFormat ff_crc_muxer = {
     "crc",
     NULL_IF_CONFIG_SMALL("CRC testing format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/cutils.c b/ffmpeg-mt/libavformat/cutils.c
index c1b5613..092aa8a 100644
--- a/ffmpeg-mt/libavformat/cutils.c
+++ b/ffmpeg-mt/libavformat/cutils.c
@@ -2,20 +2,20 @@
  * Various simple utilities for ffmpeg system
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
@@ -42,25 +42,6 @@ void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem)
     *nb_ptr = nb;
 }
 
-time_t mktimegm(struct tm *tm)
-{
-    time_t t;
-
-    int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday;
-
-    if (m < 3) {
-        m += 12;
-        y--;
-    }
-
-    t = 86400 *
-        (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469);
-
-    t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec;
-
-    return t;
-}
-
 #define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0))
 #define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400)
 
@@ -95,94 +76,3 @@ struct tm *brktimegm(time_t secs, struct tm *tm)
 
     return tm;
 }
-
-/* get a positive number between n_min and n_max, for a maximum length
-   of len_max. Return -1 if error. */
-static int date_get_num(const char **pp,
-                        int n_min, int n_max, int len_max)
-{
-    int i, val, c;
-    const char *p;
-
-    p = *pp;
-    val = 0;
-    for(i = 0; i < len_max; i++) {
-        c = *p;
-        if (!isdigit(c))
-            break;
-        val = (val * 10) + c - '0';
-        p++;
-    }
-    /* no number read ? */
-    if (p == *pp)
-        return -1;
-    if (val < n_min || val > n_max)
-        return -1;
-    *pp = p;
-    return val;
-}
-
-/* small strptime for ffmpeg */
-const char *small_strptime(const char *p, const char *fmt,
-                           struct tm *dt)
-{
-    int c, val;
-
-    for(;;) {
-        c = *fmt++;
-        if (c == '\0') {
-            return p;
-        } else if (c == '%') {
-            c = *fmt++;
-            switch(c) {
-            case 'H':
-                val = date_get_num(&p, 0, 23, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_hour = val;
-                break;
-            case 'M':
-                val = date_get_num(&p, 0, 59, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_min = val;
-                break;
-            case 'S':
-                val = date_get_num(&p, 0, 59, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_sec = val;
-                break;
-            case 'Y':
-                val = date_get_num(&p, 0, 9999, 4);
-                if (val == -1)
-                    return NULL;
-                dt->tm_year = val - 1900;
-                break;
-            case 'm':
-                val = date_get_num(&p, 1, 12, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_mon = val - 1;
-                break;
-            case 'd':
-                val = date_get_num(&p, 1, 31, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_mday = val;
-                break;
-            case '%':
-                goto match;
-            default:
-                return NULL;
-            }
-        } else {
-        match:
-            if (c != *p)
-                return NULL;
-            p++;
-        }
-    }
-    return p;
-}
-
diff --git a/ffmpeg-mt/libavformat/daud.c b/ffmpeg-mt/libavformat/daud.c
index 9b0e008..1b3cfcf 100644
--- a/ffmpeg-mt/libavformat/daud.c
+++ b/ffmpeg-mt/libavformat/daud.c
@@ -2,20 +2,20 @@
  * D-Cinema audio demuxer
  * Copyright (c) 2005 Reimar Döffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
@@ -36,12 +36,12 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
 }
 
 static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret, size;
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return AVERROR(EIO);
-    size = get_be16(pb);
-    get_be16(pb); // unknown
+    size = avio_rb16(pb);
+    avio_rb16(pb); // unknown
     ret = av_get_packet(pb, pkt, size);
     pkt->stream_index = 0;
     return ret;
@@ -57,15 +57,20 @@ static int daud_write_header(struct AVFormatContext *s)
 
 static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
-    put_be16(s->pb, pkt->size);
-    put_be16(s->pb, 0x8010); // unknown
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
+    if (pkt->size > 65535) {
+        av_log(s, AV_LOG_ERROR,
+               "Packet size too large for s302m. (%d > 65535)\n", pkt->size);
+        return -1;
+    }
+    avio_wb16(s->pb, pkt->size);
+    avio_wb16(s->pb, 0x8010); // unknown
+    avio_write(s->pb, pkt->data, pkt->size);
+    avio_flush(s->pb);
     return 0;
 }
 
 #if CONFIG_DAUD_DEMUXER
-AVInputFormat daud_demuxer = {
+AVInputFormat ff_daud_demuxer = {
     "daud",
     NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
     0,
@@ -79,7 +84,7 @@ AVInputFormat daud_demuxer = {
 #endif
 
 #if CONFIG_DAUD_MUXER
-AVOutputFormat daud_muxer =
+AVOutputFormat ff_daud_muxer =
 {
     "daud",
     NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
diff --git a/ffmpeg-mt/libavformat/dfa.c b/ffmpeg-mt/libavformat/dfa.c
new file mode 100644
index 0000000..8108535
--- /dev/null
+++ b/ffmpeg-mt/libavformat/dfa.c
@@ -0,0 +1,119 @@
+/*
+ * Chronomaster DFA Format Demuxer
+ * Copyright (c) 2011 Konstantin Shishkov
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+
+static int dfa_probe(AVProbeData *p)
+{
+    if (p->buf_size < 4 || AV_RL32(p->buf) != MKTAG('D', 'F', 'I', 'A'))
+        return 0;
+
+    return AVPROBE_SCORE_MAX;
+}
+
+static int dfa_read_header(AVFormatContext *s,
+                           AVFormatParameters *ap)
+{
+    AVIOContext *pb = s->pb;
+    AVStream *st;
+    int frames;
+    uint32_t mspf;
+
+    if (avio_rl32(pb) != MKTAG('D', 'F', 'I', 'A')) {
+        av_log(s, AV_LOG_ERROR, "Invalid magic for DFA\n");
+        return AVERROR_INVALIDDATA;
+    }
+    avio_skip(pb, 2); // unused
+    frames = avio_rl16(pb);
+
+    st = av_new_stream(s, 0);
+    if (!st)
+        return AVERROR(ENOMEM);
+
+    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+    st->codec->codec_id   = CODEC_ID_DFA;
+    st->codec->width      = avio_rl16(pb);
+    st->codec->height     = avio_rl16(pb);
+    mspf = avio_rl32(pb);
+    if (!mspf) {
+        av_log(s, AV_LOG_WARNING, "Zero FPS reported, defaulting to 10\n");
+        mspf = 100;
+    }
+    av_set_pts_info(st, 24, mspf, 1000);
+    avio_skip(pb, 128 - 16); // padding
+    st->duration = frames;
+
+    return 0;
+}
+
+static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+    AVIOContext *pb = s->pb;
+    uint32_t frame_size;
+    int ret, first = 1;
+
+    if (pb->eof_reached)
+        return AVERROR_EOF;
+
+    if (av_get_packet(pb, pkt, 12) != 12)
+        return AVERROR(EIO);
+    while (!pb->eof_reached) {
+        if (!first) {
+            ret = av_append_packet(pb, pkt, 12);
+            if (ret < 0) {
+                av_free_packet(pkt);
+                return ret;
+            }
+        } else
+            first = 0;
+        frame_size = AV_RL32(pkt->data + pkt->size - 8);
+        if (frame_size > INT_MAX - 4) {
+            av_log(s, AV_LOG_ERROR, "Too large chunk size: %d\n", frame_size);
+            return AVERROR(EIO);
+        }
+        if (AV_RL32(pkt->data + pkt->size - 12) == MKTAG('E', 'O', 'F', 'R')) {
+            if (frame_size) {
+                av_log(s, AV_LOG_WARNING, "skipping %d bytes of end-of-frame marker chunk\n",
+                       frame_size);
+                avio_skip(pb, frame_size);
+            }
+            return 0;
+        }
+        ret = av_append_packet(pb, pkt, frame_size);
+        if (ret < 0) {
+            av_free_packet(pkt);
+            return ret;
+        }
+    }
+
+    return 0;
+}
+
+AVInputFormat ff_dfa_demuxer = {
+    "dfa",
+    NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
+    0,
+    dfa_probe,
+    dfa_read_header,
+    dfa_read_packet,
+    .flags = AVFMT_GENERIC_INDEX,
+};
diff --git a/ffmpeg-mt/libavformat/diracdec.c b/ffmpeg-mt/libavformat/diracdec.c
index aa887e7..b0cb3bf 100644
--- a/ffmpeg-mt/libavformat/diracdec.c
+++ b/ffmpeg-mt/libavformat/diracdec.c
@@ -2,20 +2,20 @@
  * RAW Dirac demuxer
  * Copyright (c) 2007 Marco Gerards <marco at gnu.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,7 +31,7 @@ static int dirac_probe(AVProbeData *p)
         return 0;
 }
 
-AVInputFormat dirac_demuxer = {
+AVInputFormat ff_dirac_demuxer = {
     "dirac",
     NULL_IF_CONFIG_SMALL("raw Dirac"),
     0,
diff --git a/ffmpeg-mt/libavformat/dnxhddec.c b/ffmpeg-mt/libavformat/dnxhddec.c
index edd44fe..df5d2e3 100644
--- a/ffmpeg-mt/libavformat/dnxhddec.c
+++ b/ffmpeg-mt/libavformat/dnxhddec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier at gmail.com>
  * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -42,7 +42,7 @@ static int dnxhd_probe(AVProbeData *p)
     return AVPROBE_SCORE_MAX;
 }
 
-AVInputFormat dnxhd_demuxer = {
+AVInputFormat ff_dnxhd_demuxer = {
     "dnxhd",
     NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
     0,
diff --git a/ffmpeg-mt/libavformat/dsicin.c b/ffmpeg-mt/libavformat/dsicin.c
index af5e2d9..d02de46 100644
--- a/ffmpeg-mt/libavformat/dsicin.c
+++ b/ffmpeg-mt/libavformat/dsicin.c
@@ -2,20 +2,20 @@
  * Delphine Software International CIN File Demuxer
  * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -70,19 +70,19 @@ static int cin_probe(AVProbeData *p)
     return AVPROBE_SCORE_MAX;
 }
 
-static int cin_read_file_header(CinDemuxContext *cin, ByteIOContext *pb) {
+static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) {
     CinFileHeader *hdr = &cin->file_header;
 
-    if (get_le32(pb) != 0x55AA0000)
+    if (avio_rl32(pb) != 0x55AA0000)
         return AVERROR_INVALIDDATA;
 
-    hdr->video_frame_size   = get_le32(pb);
-    hdr->video_frame_width  = get_le16(pb);
-    hdr->video_frame_height = get_le16(pb);
-    hdr->audio_frequency    = get_le32(pb);
-    hdr->audio_bits         = get_byte(pb);
-    hdr->audio_stereo       = get_byte(pb);
-    hdr->audio_frame_size   = get_le16(pb);
+    hdr->video_frame_size   = avio_rl32(pb);
+    hdr->video_frame_width  = avio_rl16(pb);
+    hdr->video_frame_height = avio_rl16(pb);
+    hdr->audio_frequency    = avio_rl32(pb);
+    hdr->audio_bits         = avio_r8(pb);
+    hdr->audio_stereo       = avio_r8(pb);
+    hdr->audio_frame_size   = avio_rl16(pb);
 
     if (hdr->audio_frequency != 22050 || hdr->audio_bits != 16 || hdr->audio_stereo != 0)
         return AVERROR_INVALIDDATA;
@@ -95,7 +95,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
     int rc;
     CinDemuxContext *cin = s->priv_data;
     CinFileHeader *hdr = &cin->file_header;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
 
     rc = cin_read_file_header(cin, pb);
@@ -138,19 +138,19 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
     return 0;
 }
 
-static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
+static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {
     CinFrameHeader *hdr = &cin->frame_header;
 
-    hdr->video_frame_type = get_byte(pb);
-    hdr->audio_frame_type = get_byte(pb);
-    hdr->pal_colors_count = get_le16(pb);
-    hdr->video_frame_size = get_le32(pb);
-    hdr->audio_frame_size = get_le32(pb);
+    hdr->video_frame_type = avio_r8(pb);
+    hdr->audio_frame_type = avio_r8(pb);
+    hdr->pal_colors_count = avio_rl16(pb);
+    hdr->video_frame_size = avio_rl32(pb);
+    hdr->audio_frame_size = avio_rl32(pb);
 
-    if (url_feof(pb) || url_ferror(pb))
+    if (pb->eof_reached || pb->error)
         return AVERROR(EIO);
 
-    if (get_le32(pb) != 0xAA55AA55)
+    if (avio_rl32(pb) != 0xAA55AA55)
         return AVERROR_INVALIDDATA;
 
     return 0;
@@ -159,7 +159,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
 static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     CinDemuxContext *cin = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     CinFrameHeader *hdr = &cin->frame_header;
     int rc, palette_type, pkt_size;
     int ret;
@@ -191,7 +191,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
         pkt->data[2] = hdr->pal_colors_count >> 8;
         pkt->data[3] = hdr->video_frame_type;
 
-        ret = get_buffer(pb, &pkt->data[4], pkt_size);
+        ret = avio_read(pb, &pkt->data[4], pkt_size);
         if (ret < 0) {
             av_free_packet(pkt);
             return ret;
@@ -216,7 +216,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat dsicin_demuxer = {
+AVInputFormat ff_dsicin_demuxer = {
     "dsicin",
     NULL_IF_CONFIG_SMALL("Delphine Software International CIN format"),
     sizeof(CinDemuxContext),
diff --git a/ffmpeg-mt/libavformat/dtsdec.c b/ffmpeg-mt/libavformat/dtsdec.c
index c132c08..943f6a5 100644
--- a/ffmpeg-mt/libavformat/dtsdec.c
+++ b/ffmpeg-mt/libavformat/dtsdec.c
@@ -2,20 +2,20 @@
  * RAW DTS demuxer
  * Copyright (c) 2008 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -65,7 +65,7 @@ static int dts_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat dts_demuxer = {
+AVInputFormat ff_dts_demuxer = {
     "dts",
     NULL_IF_CONFIG_SMALL("raw DTS"),
     0,
diff --git a/ffmpeg-mt/libavformat/dv.c b/ffmpeg-mt/libavformat/dv.c
index d7f54d6..4b41e0a 100644
--- a/ffmpeg-mt/libavformat/dv.c
+++ b/ffmpeg-mt/libavformat/dv.c
@@ -12,20 +12,20 @@
  * Copyright (c) 2006 Daniel Maas <dmaas at maasdigital.com>
  * Funded by BBC Research & Development
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <time.h>
@@ -370,7 +370,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
     // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
     const DVprofile* sys = ff_dv_codec_profile(c->vst->codec);
     int64_t offset;
-    int64_t size = url_fsize(s->pb) - s->data_offset;
+    int64_t size = avio_size(s->pb) - s->data_offset;
     int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
 
     offset = sys->frame_size * timestamp;
@@ -410,25 +410,25 @@ static int dv_read_header(AVFormatContext *s,
     if (!c->dv_demux)
         return -1;
 
-    state = get_be32(s->pb);
+    state = avio_rb32(s->pb);
     while ((state & 0xffffff7f) != 0x1f07003f) {
-        if (url_feof(s->pb)) {
+        if (s->pb->eof_reached) {
             av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
             return -1;
         }
         if (state == 0x003f0700 || state == 0xff3f0700)
-            marker_pos = url_ftell(s->pb);
-        if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
-            url_fseek(s->pb, -163, SEEK_CUR);
-            state = get_be32(s->pb);
+            marker_pos = avio_tell(s->pb);
+        if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) {
+            avio_seek(s->pb, -163, SEEK_CUR);
+            state = avio_rb32(s->pb);
             break;
         }
-        state = (state << 8) | get_byte(s->pb);
+        state = (state << 8) | avio_r8(s->pb);
     }
     AV_WB32(c->buf, state);
 
-    if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
-        url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
+    if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
+        avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
         return AVERROR(EIO);
 
     c->dv_demux->sys = ff_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES);
@@ -455,7 +455,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (!c->dv_demux->sys)
             return AVERROR(EIO);
         size = c->dv_demux->sys->frame_size;
-        if (get_buffer(s->pb, c->buf, size) <= 0)
+        if (avio_read(s->pb, c->buf, size) <= 0)
             return AVERROR(EIO);
 
         size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
@@ -473,7 +473,7 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
 
     dv_offset_reset(c, offset / c->sys->frame_size);
 
-    offset = url_fseek(s->pb, offset, SEEK_SET);
+    offset = avio_seek(s->pb, offset, SEEK_SET);
     return (offset < 0) ? offset : 0;
 }
 
@@ -518,7 +518,7 @@ static int dv_probe(AVProbeData *p)
 }
 
 #if CONFIG_DV_DEMUXER
-AVInputFormat dv_demuxer = {
+AVInputFormat ff_dv_demuxer = {
     "dv",
     NULL_IF_CONFIG_SMALL("DV video format"),
     sizeof(RawDVContext),
diff --git a/ffmpeg-mt/libavformat/dv.h b/ffmpeg-mt/libavformat/dv.h
index ae16bef..650699d 100644
--- a/ffmpeg-mt/libavformat/dv.h
+++ b/ffmpeg-mt/libavformat/dv.h
@@ -8,20 +8,20 @@
  * Raw DV format
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -37,8 +37,5 @@ int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int);
 void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset);
 
 typedef struct DVMuxContext DVMuxContext;
-DVMuxContext* dv_init_mux(AVFormatContext* s);
-int dv_assemble_frame(DVMuxContext *c, AVStream*, uint8_t*, int, uint8_t**);
-void dv_delete_mux(DVMuxContext*);
 
 #endif /* AVFORMAT_DV_H */
diff --git a/ffmpeg-mt/libavformat/dvenc.c b/ffmpeg-mt/libavformat/dvenc.c
index 0176ac9..537581a 100644
--- a/ffmpeg-mt/libavformat/dvenc.c
+++ b/ffmpeg-mt/libavformat/dvenc.c
@@ -11,20 +11,20 @@
  * 50 Mbps (DVCPRO50) support
  * Copyright (c) 2006 Daniel Maas <dmaas at maasdigital.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <time.h>
@@ -232,8 +232,8 @@ static void dv_inject_metadata(DVMuxContext *c, uint8_t* frame)
  * The following 3 functions constitute our interface to the world
  */
 
-int dv_assemble_frame(DVMuxContext *c, AVStream* st,
-                      uint8_t* data, int data_size, uint8_t** frame)
+static int dv_assemble_frame(DVMuxContext *c, AVStream* st,
+                             uint8_t* data, int data_size, uint8_t** frame)
 {
     int i, reqasize;
 
@@ -285,7 +285,7 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st,
     return 0;
 }
 
-DVMuxContext* dv_init_mux(AVFormatContext* s)
+static DVMuxContext* dv_init_mux(AVFormatContext* s)
 {
     DVMuxContext *c = s->priv_data;
     AVStream *vst = NULL;
@@ -354,14 +354,13 @@ bail_out:
     return NULL;
 }
 
-void dv_delete_mux(DVMuxContext *c)
+static void dv_delete_mux(DVMuxContext *c)
 {
     int i;
     for (i=0; i < c->n_ast; i++)
         av_fifo_free(c->audio_data[i]);
 }
 
-#if CONFIG_DV_MUXER
 static int dv_write_header(AVFormatContext *s)
 {
     if (!dv_init_mux(s)) {
@@ -382,8 +381,8 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index],
                               pkt->data, pkt->size, &frame);
     if (fsize > 0) {
-        put_buffer(s->pb, frame, fsize);
-        put_flush_packet(s->pb);
+        avio_write(s->pb, frame, fsize);
+        avio_flush(s->pb);
     }
     return 0;
 }
@@ -400,7 +399,7 @@ static int dv_write_trailer(struct AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat dv_muxer = {
+AVOutputFormat ff_dv_muxer = {
     "dv",
     NULL_IF_CONFIG_SMALL("DV video format"),
     NULL,
@@ -412,4 +411,3 @@ AVOutputFormat dv_muxer = {
     dv_write_packet,
     dv_write_trailer,
 };
-#endif /* CONFIG_DV_MUXER */
diff --git a/ffmpeg-mt/libavformat/dxa.c b/ffmpeg-mt/libavformat/dxa.c
index c00c917..7fec26f 100644
--- a/ffmpeg-mt/libavformat/dxa.c
+++ b/ffmpeg-mt/libavformat/dxa.c
@@ -2,20 +2,20 @@
  * DXA demuxer
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -52,7 +52,7 @@ static int dxa_probe(AVProbeData *p)
 
 static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     DXAContext *c = s->priv_data;
     AVStream *st, *ast;
     uint32_t tag;
@@ -61,17 +61,17 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
     int num, den;
     int flags;
 
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
     if (tag != MKTAG('D', 'E', 'X', 'A'))
         return -1;
-    flags = get_byte(pb);
-    c->frames = get_be16(pb);
+    flags = avio_r8(pb);
+    c->frames = avio_rb16(pb);
     if(!c->frames){
         av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
         return -1;
     }
 
-    fps = get_be32(pb);
+    fps = avio_rb32(pb);
     if(fps > 0){
         den = 1000;
         num = fps;
@@ -82,8 +82,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
         den = 10;
         num = 1;
     }
-    w = get_be16(pb);
-    h = get_be16(pb);
+    w = avio_rb16(pb);
+    h = avio_rb16(pb);
     c->has_sound = 0;
 
     st = av_new_stream(s, 0);
@@ -91,31 +91,31 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return -1;
 
     // Parse WAV data header
-    if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){
+    if(avio_rl32(pb) == MKTAG('W', 'A', 'V', 'E')){
         uint32_t size, fsize;
         c->has_sound = 1;
-        size = get_be32(pb);
-        c->vidpos = url_ftell(pb) + size;
-        url_fskip(pb, 16);
-        fsize = get_le32(pb);
+        size = avio_rb32(pb);
+        c->vidpos = avio_tell(pb) + size;
+        avio_skip(pb, 16);
+        fsize = avio_rl32(pb);
 
         ast = av_new_stream(s, 0);
         if (!ast)
             return -1;
         ff_get_wav_header(pb, ast->codec, fsize);
         // find 'data' chunk
-        while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
-            tag = get_le32(pb);
-            fsize = get_le32(pb);
+        while(avio_tell(pb) < c->vidpos && !pb->eof_reached){
+            tag = avio_rl32(pb);
+            fsize = avio_rl32(pb);
             if(tag == MKTAG('d', 'a', 't', 'a')) break;
-            url_fskip(pb, fsize);
+            avio_skip(pb, fsize);
         }
         c->bpc = (fsize + c->frames - 1) / c->frames;
         if(ast->codec->block_align)
             c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align;
         c->bytes_left = fsize;
-        c->wavpos = url_ftell(pb);
-        url_fseek(pb, c->vidpos, SEEK_SET);
+        c->wavpos = avio_tell(pb);
+        avio_seek(pb, c->vidpos, SEEK_SET);
     }
 
     /* now we are ready: build format streams */
@@ -133,7 +133,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
         st->codec->height >>= 1;
     }
     c->readvid = !c->has_sound;
-    c->vidpos  = url_ftell(pb);
+    c->vidpos  = avio_tell(pb);
     s->start_time = 0;
     s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
     av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames);
@@ -151,19 +151,19 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     if(!c->readvid && c->has_sound && c->bytes_left){
         c->readvid = 1;
-        url_fseek(s->pb, c->wavpos, SEEK_SET);
+        avio_seek(s->pb, c->wavpos, SEEK_SET);
         size = FFMIN(c->bytes_left, c->bpc);
         ret = av_get_packet(s->pb, pkt, size);
         pkt->stream_index = 1;
         if(ret != size)
             return AVERROR(EIO);
         c->bytes_left -= size;
-        c->wavpos = url_ftell(s->pb);
+        c->wavpos = avio_tell(s->pb);
         return 0;
     }
-    url_fseek(s->pb, c->vidpos, SEEK_SET);
-    while(!url_feof(s->pb) && c->frames){
-        get_buffer(s->pb, buf, 4);
+    avio_seek(s->pb, c->vidpos, SEEK_SET);
+    while(!s->pb->eof_reached && c->frames){
+        avio_read(s->pb, buf, 4);
         switch(AV_RL32(buf)){
         case MKTAG('N', 'U', 'L', 'L'):
             if(av_new_packet(pkt, 4 + pal_size) < 0)
@@ -172,16 +172,16 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
             if(pal_size) memcpy(pkt->data, pal, pal_size);
             memcpy(pkt->data + pal_size, buf, 4);
             c->frames--;
-            c->vidpos = url_ftell(s->pb);
+            c->vidpos = avio_tell(s->pb);
             c->readvid = 0;
             return 0;
         case MKTAG('C', 'M', 'A', 'P'):
             pal_size = 768+4;
             memcpy(pal, buf, 4);
-            get_buffer(s->pb, pal + 4, 768);
+            avio_read(s->pb, pal + 4, 768);
             break;
         case MKTAG('F', 'R', 'A', 'M'):
-            get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
+            avio_read(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
             size = AV_RB32(buf + 5);
             if(size > 0xFFFFFF){
                 av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
@@ -190,7 +190,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
             if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
                 return AVERROR(ENOMEM);
             memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
-            ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
+            ret = avio_read(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
             if(ret != size){
                 av_free_packet(pkt);
                 return AVERROR(EIO);
@@ -198,7 +198,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
             if(pal_size) memcpy(pkt->data, pal, pal_size);
             pkt->stream_index = 0;
             c->frames--;
-            c->vidpos = url_ftell(s->pb);
+            c->vidpos = avio_tell(s->pb);
             c->readvid = 0;
             return 0;
         default:
@@ -209,7 +209,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
     return AVERROR(EIO);
 }
 
-AVInputFormat dxa_demuxer = {
+AVInputFormat ff_dxa_demuxer = {
     "dxa",
     NULL_IF_CONFIG_SMALL("DXA"),
     sizeof(DXAContext),
diff --git a/ffmpeg-mt/libavformat/eacdata.c b/ffmpeg-mt/libavformat/eacdata.c
index 32c3343..5c89559 100644
--- a/ffmpeg-mt/libavformat/eacdata.c
+++ b/ffmpeg-mt/libavformat/eacdata.c
@@ -2,20 +2,20 @@
  * Electronic Arts .cdata file Demuxer
  * Copyright (c) 2007 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -47,11 +47,11 @@ static int cdata_probe(AVProbeData *p)
 static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     CdataDemuxContext *cdata = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int sample_rate, header;
     AVStream *st;
 
-    header = get_be16(pb);
+    header = avio_rb16(pb);
     switch (header) {
         case 0x0400: cdata->channels = 1; break;
         case 0x0404: cdata->channels = 2; break;
@@ -61,8 +61,8 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
             return -1;
     };
 
-    sample_rate = get_be16(pb);
-    url_fskip(pb, 12);
+    sample_rate = avio_rb16(pb);
+    avio_skip(pb, 12);
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -90,7 +90,7 @@ static int cdata_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat ea_cdata_demuxer = {
+AVInputFormat ff_ea_cdata_demuxer = {
     "ea_cdata",
     NULL_IF_CONFIG_SMALL("Electronic Arts cdata"),
     sizeof(CdataDemuxContext),
diff --git a/ffmpeg-mt/libavformat/electronicarts.c b/ffmpeg-mt/libavformat/electronicarts.c
index b796ede..06689dd 100644
--- a/ffmpeg-mt/libavformat/electronicarts.c
+++ b/ffmpeg-mt/libavformat/electronicarts.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2004  The ffmpeg Project
  * Copyright (c) 2006-2008 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -77,16 +77,16 @@ typedef struct EaDemuxContext {
     int num_samples;
 } EaDemuxContext;
 
-static uint32_t read_arbitary(ByteIOContext *pb) {
+static uint32_t read_arbitary(AVIOContext *pb) {
     uint8_t size, byte;
     int i;
     uint32_t word;
 
-    size = get_byte(pb);
+    size = avio_r8(pb);
 
     word = 0;
     for (i = 0; i < size; i++) {
-        byte = get_byte(pb);
+        byte = avio_r8(pb);
         word <<= 8;
         word |= byte;
     }
@@ -102,25 +102,25 @@ static int process_audio_header_elements(AVFormatContext *s)
 {
     int inHeader = 1;
     EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int compression_type = -1, revision = -1, revision2 = -1;
 
     ea->bytes = 2;
     ea->sample_rate = -1;
     ea->num_channels = 1;
 
-    while (!url_feof(pb) && inHeader) {
+    while (!pb->eof_reached && inHeader) {
         int inSubheader;
         uint8_t byte;
-        byte = get_byte(pb);
+        byte = avio_r8(pb);
 
         switch (byte) {
         case 0xFD:
             av_log (s, AV_LOG_DEBUG, "entered audio subheader\n");
             inSubheader = 1;
-            while (!url_feof(pb) && inSubheader) {
+            while (!pb->eof_reached && inSubheader) {
                 uint8_t subbyte;
-                subbyte = get_byte(pb);
+                subbyte = avio_r8(pb);
 
                 switch (subbyte) {
                 case 0x80:
@@ -215,14 +215,14 @@ static int process_audio_header_elements(AVFormatContext *s)
 static int process_audio_header_eacs(AVFormatContext *s)
 {
     EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int compression_type;
 
-    ea->sample_rate  = ea->big_endian ? get_be32(pb) : get_le32(pb);
-    ea->bytes        = get_byte(pb);   /* 1=8-bit, 2=16-bit */
-    ea->num_channels = get_byte(pb);
-    compression_type = get_byte(pb);
-    url_fskip(pb, 13);
+    ea->sample_rate  = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
+    ea->bytes        = avio_r8(pb);   /* 1=8-bit, 2=16-bit */
+    ea->num_channels = avio_r8(pb);
+    compression_type = avio_r8(pb);
+    avio_skip(pb, 13);
 
     switch (compression_type) {
     case 0:
@@ -247,11 +247,11 @@ static int process_audio_header_eacs(AVFormatContext *s)
 static int process_audio_header_sead(AVFormatContext *s)
 {
     EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
-    ea->sample_rate  = get_le32(pb);
-    ea->bytes        = get_le32(pb);  /* 1=8-bit, 2=16-bit */
-    ea->num_channels = get_le32(pb);
+    ea->sample_rate  = avio_rl32(pb);
+    ea->bytes        = avio_rl32(pb);  /* 1=8-bit, 2=16-bit */
+    ea->num_channels = avio_rl32(pb);
     ea->audio_codec  = CODEC_ID_ADPCM_IMA_EA_SEAD;
 
     return 1;
@@ -260,10 +260,10 @@ static int process_audio_header_sead(AVFormatContext *s)
 static int process_video_header_mdec(AVFormatContext *s)
 {
     EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    url_fskip(pb, 4);
-    ea->width  = get_le16(pb);
-    ea->height = get_le16(pb);
+    AVIOContext *pb = s->pb;
+    avio_skip(pb, 4);
+    ea->width  = avio_rl16(pb);
+    ea->height = avio_rl16(pb);
     ea->time_base = (AVRational){1,15};
     ea->video_codec = CODEC_ID_MDEC;
     return 1;
@@ -272,11 +272,11 @@ static int process_video_header_mdec(AVFormatContext *s)
 static int process_video_header_vp6(AVFormatContext *s)
 {
     EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
-    url_fskip(pb, 16);
-    ea->time_base.den = get_le32(pb);
-    ea->time_base.num = get_le32(pb);
+    avio_skip(pb, 16);
+    ea->time_base.den = avio_rl32(pb);
+    ea->time_base.num = avio_rl32(pb);
     ea->video_codec = CODEC_ID_VP6;
 
     return 1;
@@ -289,15 +289,15 @@ static int process_video_header_vp6(AVFormatContext *s)
 static int process_ea_header(AVFormatContext *s) {
     uint32_t blockid, size = 0;
     EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i;
 
     for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
-        unsigned int startpos = url_ftell(pb);
+        unsigned int startpos = avio_tell(pb);
         int err = 0;
 
-        blockid = get_le32(pb);
-        size = get_le32(pb);
+        blockid = avio_rl32(pb);
+        size = avio_rl32(pb);
         if (i == 0)
             ea->big_endian = size > 0x000FFFFF;
         if (ea->big_endian)
@@ -305,7 +305,7 @@ static int process_ea_header(AVFormatContext *s) {
 
         switch (blockid) {
             case ISNh_TAG:
-                if (get_le32(pb) != EACS_TAG) {
+                if (avio_rl32(pb) != EACS_TAG) {
                     av_log (s, AV_LOG_ERROR, "unknown 1SNh headerid\n");
                     return 0;
                 }
@@ -314,9 +314,9 @@ static int process_ea_header(AVFormatContext *s) {
 
             case SCHl_TAG :
             case SHEN_TAG :
-                blockid = get_le32(pb);
+                blockid = avio_rl32(pb);
                 if (blockid == GSTR_TAG) {
-                    url_fskip(pb, 4);
+                    avio_skip(pb, 4);
                 } else if ((blockid & 0xFFFF)!=PT00_TAG) {
                     av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n");
                     return 0;
@@ -369,10 +369,10 @@ static int process_ea_header(AVFormatContext *s) {
             return err;
         }
 
-        url_fseek(pb, startpos + size, SEEK_SET);
+        avio_seek(pb, startpos + size, SEEK_SET);
     }
 
-    url_fseek(pb, 0, SEEK_SET);
+    avio_seek(pb, 0, SEEK_SET);
 
     return 1;
 }
@@ -459,7 +459,7 @@ static int ea_read_packet(AVFormatContext *s,
                           AVPacket *pkt)
 {
     EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret = 0;
     int packet_read = 0;
     unsigned int chunk_type, chunk_size;
@@ -467,26 +467,26 @@ static int ea_read_packet(AVFormatContext *s,
     int av_uninit(num_samples);
 
     while (!packet_read) {
-        chunk_type = get_le32(pb);
-        chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8;
+        chunk_type = avio_rl32(pb);
+        chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8;
 
         switch (chunk_type) {
         /* audio data */
         case ISNh_TAG:
             /* header chunk also contains data; skip over the header portion*/
-            url_fskip(pb, 32);
+            avio_skip(pb, 32);
             chunk_size -= 32;
         case ISNd_TAG:
         case SCDl_TAG:
         case SNDC_TAG:
         case SDEN_TAG:
             if (!ea->audio_codec) {
-                url_fskip(pb, chunk_size);
+                avio_skip(pb, chunk_size);
                 break;
             } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
                        ea->audio_codec == CODEC_ID_MP3) {
-                num_samples = get_le32(pb);
-                url_fskip(pb, 8);
+                num_samples = avio_rl32(pb);
+                avio_skip(pb, 8);
                 chunk_size -= 12;
             }
             ret = av_get_packet(pb, pkt, chunk_size);
@@ -536,12 +536,12 @@ static int ea_read_packet(AVFormatContext *s,
         case fVGT_TAG:
         case MADm_TAG:
         case MADe_TAG:
-            url_fseek(pb, -8, SEEK_CUR);     // include chunk preamble
+            avio_seek(pb, -8, SEEK_CUR);     // include chunk preamble
             chunk_size += 8;
             goto get_video_packet;
 
         case mTCD_TAG:
-            url_fseek(pb, 8, SEEK_CUR);  // skip ea dct header
+            avio_skip(pb, 8);  // skip ea dct header
             chunk_size -= 8;
             goto get_video_packet;
 
@@ -560,7 +560,7 @@ get_video_packet:
             break;
 
         default:
-            url_fseek(pb, chunk_size, SEEK_CUR);
+            avio_skip(pb, chunk_size);
             break;
         }
     }
@@ -568,7 +568,7 @@ get_video_packet:
     return ret;
 }
 
-AVInputFormat ea_demuxer = {
+AVInputFormat ff_ea_demuxer = {
     "ea",
     NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia Format"),
     sizeof(EaDemuxContext),
diff --git a/ffmpeg-mt/libavformat/ffm.h b/ffmpeg-mt/libavformat/ffm.h
index 05d6eb1..89a14a5 100644
--- a/ffmpeg-mt/libavformat/ffm.h
+++ b/ffmpeg-mt/libavformat/ffm.h
@@ -2,20 +2,20 @@
  * FFM (ffserver live feed) common header
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,6 +28,7 @@
 
 /* The FFM file is made of blocks of fixed size */
 #define FFM_HEADER_SIZE 14
+#define FFM_PACKET_SIZE 4096
 #define PACKET_ID       0x666d
 
 /* each packet contains frames (which can span several packets */
@@ -55,4 +56,8 @@ typedef struct FFMContext {
     uint8_t packet[FFM_PACKET_SIZE];
 } FFMContext;
 
+int64_t ffm_read_write_index(int fd);
+int ffm_write_write_index(int fd, int64_t pos);
+void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
+
 #endif /* AVFORMAT_FFM_H */
diff --git a/ffmpeg-mt/libavformat/ffmdec.c b/ffmpeg-mt/libavformat/ffmdec.c
index 050702e..6cd2b51 100644
--- a/ffmpeg-mt/libavformat/ffmdec.c
+++ b/ffmpeg-mt/libavformat/ffmdec.c
@@ -2,20 +2,20 @@
  * FFM (ffserver live feed) demuxer
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -65,7 +65,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
     len = ffm->packet_end - ffm->packet_ptr;
     if (size <= len)
         return 1;
-    pos = url_ftell(s->pb);
+    pos = avio_tell(s->pb);
     if (!ffm->write_index) {
         if (pos == ffm->file_size)
             return AVERROR_EOF;
@@ -91,11 +91,11 @@ static int ffm_resync(AVFormatContext *s, int state)
 {
     av_log(s, AV_LOG_ERROR, "resyncing\n");
     while (state != PACKET_ID) {
-        if (url_feof(s->pb)) {
+        if (s->pb->eof_reached) {
             av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
             return -1;
         }
-        state = (state << 8) | get_byte(s->pb);
+        state = (state << 8) | avio_r8(s->pb);
     }
     return 0;
 }
@@ -105,7 +105,7 @@ static int ffm_read_data(AVFormatContext *s,
                          uint8_t *buf, int size, int header)
 {
     FFMContext *ffm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int len, fill_size, size1, frame_offset, id;
 
     size1 = size;
@@ -117,17 +117,17 @@ static int ffm_read_data(AVFormatContext *s,
         if (len > size)
             len = size;
         if (len == 0) {
-            if (url_ftell(pb) == ffm->file_size)
-                url_fseek(pb, ffm->packet_size, SEEK_SET);
+            if (avio_tell(pb) == ffm->file_size)
+                avio_seek(pb, ffm->packet_size, SEEK_SET);
     retry_read:
-            id = get_be16(pb); /* PACKET_ID */
+            id = avio_rb16(pb); /* PACKET_ID */
             if (id != PACKET_ID)
                 if (ffm_resync(s, id) < 0)
                     return -1;
-            fill_size = get_be16(pb);
-            ffm->dts = get_be64(pb);
-            frame_offset = get_be16(pb);
-            get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
+            fill_size = avio_rb16(pb);
+            ffm->dts = avio_rb64(pb);
+            frame_offset = avio_rb16(pb);
+            avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
             ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
             if (ffm->packet_end < ffm->packet || frame_offset < 0)
                 return -1;
@@ -136,8 +136,8 @@ static int ffm_read_data(AVFormatContext *s,
             if (ffm->first_packet || (frame_offset & 0x8000)) {
                 if (!frame_offset) {
                     /* This packet has no frame headers in it */
-                    if (url_ftell(pb) >= ffm->packet_size * 3) {
-                        url_fseek(pb, -ffm->packet_size * 2, SEEK_CUR);
+                    if (avio_tell(pb) >= ffm->packet_size * 3) {
+                        avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR);
                         goto retry_read;
                     }
                     /* This is bad, we cannot find a valid frame header */
@@ -170,7 +170,7 @@ static int ffm_read_data(AVFormatContext *s,
 static void ffm_seek1(AVFormatContext *s, int64_t pos1)
 {
     FFMContext *ffm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos;
 
     pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
@@ -178,17 +178,17 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1)
 #ifdef DEBUG_SEEK
     av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
 #endif
-    url_fseek(pb, pos, SEEK_SET);
+    avio_seek(pb, pos, SEEK_SET);
 }
 
 static int64_t get_dts(AVFormatContext *s, int64_t pos)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t dts;
 
     ffm_seek1(s, pos);
-    url_fskip(pb, 4);
-    dts = get_be64(pb);
+    avio_skip(pb, 4);
+    dts = avio_rb64(pb);
 #ifdef DEBUG_SEEK
     av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
 #endif
@@ -198,12 +198,12 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
 static void adjust_write_index(AVFormatContext *s)
 {
     FFMContext *ffm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pts;
     //int64_t orig_write_index = ffm->write_index;
     int64_t pos_min, pos_max;
     int64_t pts_start;
-    int64_t ptr = url_ftell(pb);
+    int64_t ptr = avio_tell(pb);
 
 
     pos_min = 0;
@@ -248,7 +248,7 @@ static void adjust_write_index(AVFormatContext *s)
     //printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
 
  end:
-    url_fseek(pb, ptr, SEEK_SET);
+    avio_seek(pb, ptr, SEEK_SET);
 }
 
 
@@ -267,30 +267,30 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     FFMContext *ffm = s->priv_data;
     AVStream *st;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *codec;
     int i, nb_streams;
     uint32_t tag;
 
     /* header */
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
     if (tag != MKTAG('F', 'F', 'M', '1'))
         goto fail;
-    ffm->packet_size = get_be32(pb);
+    ffm->packet_size = avio_rb32(pb);
     if (ffm->packet_size != FFM_PACKET_SIZE)
         goto fail;
-    ffm->write_index = get_be64(pb);
+    ffm->write_index = avio_rb64(pb);
     /* get also filesize */
-    if (!url_is_streamed(pb)) {
-        ffm->file_size = url_fsize(pb);
+    if (pb->seekable) {
+        ffm->file_size = avio_size(pb);
         if (ffm->write_index)
             adjust_write_index(s);
     } else {
         ffm->file_size = (UINT64_C(1) << 63) - 1;
     }
 
-    nb_streams = get_be32(pb);
-    get_be32(pb); /* total bitrate */
+    nb_streams = avio_rb32(pb);
+    avio_rb32(pb); /* total bitrate */
     /* read each stream */
     for(i=0;i<nb_streams;i++) {
         char rc_eq_buf[128];
@@ -303,85 +303,86 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
         codec = st->codec;
         /* generic info */
-        codec->codec_id = get_be32(pb);
-        codec->codec_type = get_byte(pb); /* codec_type */
-        codec->bit_rate = get_be32(pb);
-        st->quality = get_be32(pb);
-        codec->flags = get_be32(pb);
-        codec->flags2 = get_be32(pb);
-        codec->debug = get_be32(pb);
+        codec->codec_id = avio_rb32(pb);
+        codec->codec_type = avio_r8(pb); /* codec_type */
+        codec->bit_rate = avio_rb32(pb);
+        st->quality = avio_rb32(pb);
+        codec->flags = avio_rb32(pb);
+        codec->flags2 = avio_rb32(pb);
+        codec->debug = avio_rb32(pb);
         /* specific info */
         switch(codec->codec_type) {
         case AVMEDIA_TYPE_VIDEO:
-            codec->time_base.num = get_be32(pb);
-            codec->time_base.den = get_be32(pb);
-            codec->width = get_be16(pb);
-            codec->height = get_be16(pb);
-            codec->gop_size = get_be16(pb);
-            codec->pix_fmt = get_be32(pb);
-            codec->qmin = get_byte(pb);
-            codec->qmax = get_byte(pb);
-            codec->max_qdiff = get_byte(pb);
-            codec->qcompress = get_be16(pb) / 10000.0;
-            codec->qblur = get_be16(pb) / 10000.0;
-            codec->bit_rate_tolerance = get_be32(pb);
-            codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf)));
-            codec->rc_max_rate = get_be32(pb);
-            codec->rc_min_rate = get_be32(pb);
-            codec->rc_buffer_size = get_be32(pb);
-            codec->i_quant_factor = av_int2dbl(get_be64(pb));
-            codec->b_quant_factor = av_int2dbl(get_be64(pb));
-            codec->i_quant_offset = av_int2dbl(get_be64(pb));
-            codec->b_quant_offset = av_int2dbl(get_be64(pb));
-            codec->dct_algo = get_be32(pb);
-            codec->strict_std_compliance = get_be32(pb);
-            codec->max_b_frames = get_be32(pb);
-            codec->luma_elim_threshold = get_be32(pb);
-            codec->chroma_elim_threshold = get_be32(pb);
-            codec->mpeg_quant = get_be32(pb);
-            codec->intra_dc_precision = get_be32(pb);
-            codec->me_method = get_be32(pb);
-            codec->mb_decision = get_be32(pb);
-            codec->nsse_weight = get_be32(pb);
-            codec->frame_skip_cmp = get_be32(pb);
-            codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb));
-            codec->codec_tag = get_be32(pb);
-            codec->thread_count = get_byte(pb);
-            codec->coder_type = get_be32(pb);
-            codec->me_cmp = get_be32(pb);
-            codec->partitions = get_be32(pb);
-            codec->me_subpel_quality = get_be32(pb);
-            codec->me_range = get_be32(pb);
-            codec->keyint_min = get_be32(pb);
-            codec->scenechange_threshold = get_be32(pb);
-            codec->b_frame_strategy = get_be32(pb);
-            codec->qcompress = av_int2dbl(get_be64(pb));
-            codec->qblur = av_int2dbl(get_be64(pb));
-            codec->max_qdiff = get_be32(pb);
-            codec->refs = get_be32(pb);
-            codec->directpred = get_be32(pb);
+            codec->time_base.num = avio_rb32(pb);
+            codec->time_base.den = avio_rb32(pb);
+            codec->width = avio_rb16(pb);
+            codec->height = avio_rb16(pb);
+            codec->gop_size = avio_rb16(pb);
+            codec->pix_fmt = avio_rb32(pb);
+            codec->qmin = avio_r8(pb);
+            codec->qmax = avio_r8(pb);
+            codec->max_qdiff = avio_r8(pb);
+            codec->qcompress = avio_rb16(pb) / 10000.0;
+            codec->qblur = avio_rb16(pb) / 10000.0;
+            codec->bit_rate_tolerance = avio_rb32(pb);
+            avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf));
+            codec->rc_eq = av_strdup(rc_eq_buf);
+            codec->rc_max_rate = avio_rb32(pb);
+            codec->rc_min_rate = avio_rb32(pb);
+            codec->rc_buffer_size = avio_rb32(pb);
+            codec->i_quant_factor = av_int2dbl(avio_rb64(pb));
+            codec->b_quant_factor = av_int2dbl(avio_rb64(pb));
+            codec->i_quant_offset = av_int2dbl(avio_rb64(pb));
+            codec->b_quant_offset = av_int2dbl(avio_rb64(pb));
+            codec->dct_algo = avio_rb32(pb);
+            codec->strict_std_compliance = avio_rb32(pb);
+            codec->max_b_frames = avio_rb32(pb);
+            codec->luma_elim_threshold = avio_rb32(pb);
+            codec->chroma_elim_threshold = avio_rb32(pb);
+            codec->mpeg_quant = avio_rb32(pb);
+            codec->intra_dc_precision = avio_rb32(pb);
+            codec->me_method = avio_rb32(pb);
+            codec->mb_decision = avio_rb32(pb);
+            codec->nsse_weight = avio_rb32(pb);
+            codec->frame_skip_cmp = avio_rb32(pb);
+            codec->rc_buffer_aggressivity = av_int2dbl(avio_rb64(pb));
+            codec->codec_tag = avio_rb32(pb);
+            codec->thread_count = avio_r8(pb);
+            codec->coder_type = avio_rb32(pb);
+            codec->me_cmp = avio_rb32(pb);
+            codec->partitions = avio_rb32(pb);
+            codec->me_subpel_quality = avio_rb32(pb);
+            codec->me_range = avio_rb32(pb);
+            codec->keyint_min = avio_rb32(pb);
+            codec->scenechange_threshold = avio_rb32(pb);
+            codec->b_frame_strategy = avio_rb32(pb);
+            codec->qcompress = av_int2dbl(avio_rb64(pb));
+            codec->qblur = av_int2dbl(avio_rb64(pb));
+            codec->max_qdiff = avio_rb32(pb);
+            codec->refs = avio_rb32(pb);
+            codec->directpred = avio_rb32(pb);
             break;
         case AVMEDIA_TYPE_AUDIO:
-            codec->sample_rate = get_be32(pb);
-            codec->channels = get_le16(pb);
-            codec->frame_size = get_le16(pb);
-            codec->sample_fmt = (int16_t) get_le16(pb);
+            codec->sample_rate = avio_rb32(pb);
+            codec->channels = avio_rl16(pb);
+            codec->frame_size = avio_rl16(pb);
+            codec->sample_fmt = (int16_t) avio_rl16(pb);
             break;
         default:
             goto fail;
         }
         if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
-            codec->extradata_size = get_be32(pb);
+            codec->extradata_size = avio_rb32(pb);
             codec->extradata = av_malloc(codec->extradata_size);
             if (!codec->extradata)
                 return AVERROR(ENOMEM);
-            get_buffer(pb, codec->extradata, codec->extradata_size);
+            avio_read(pb, codec->extradata, codec->extradata_size);
         }
     }
 
     /* get until end of block reached */
-    while ((url_ftell(pb) % ffm->packet_size) != 0)
-        get_byte(pb);
+    while ((avio_tell(pb) % ffm->packet_size) != 0)
+        avio_r8(pb);
 
     /* init packet demux */
     ffm->packet_ptr = ffm->packet;
@@ -408,8 +409,8 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
         if ((ret = ffm_is_avail_data(s, FRAME_HEADER_SIZE+4)) < 0)
             return ret;
 
-        dprintf(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
-               url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
+        av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
+               avio_tell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
         if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
             FRAME_HEADER_SIZE)
             return -1;
@@ -436,7 +437,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
             ffm->read_state = READ_HEADER;
             return -1;
         }
-        pkt->pos = url_ftell(s->pb);
+        pkt->pos = avio_tell(s->pb);
         if (ffm->header[1] & FLAG_KEY_FRAME)
             pkt->flags |= AV_PKT_FLAG_KEY;
 
@@ -518,7 +519,7 @@ static int ffm_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat ffm_demuxer = {
+AVInputFormat ff_ffm_demuxer = {
     "ffm",
     NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"),
     sizeof(FFMContext),
diff --git a/ffmpeg-mt/libavformat/ffmenc.c b/ffmpeg-mt/libavformat/ffmenc.c
index c5c59db..71d93e5 100644
--- a/ffmpeg-mt/libavformat/ffmenc.c
+++ b/ffmpeg-mt/libavformat/ffmenc.c
@@ -2,20 +2,20 @@
  * FFM (ffserver live feed) muxer
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,24 +27,24 @@ static void flush_packet(AVFormatContext *s)
 {
     FFMContext *ffm = s->priv_data;
     int fill_size, h;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     fill_size = ffm->packet_end - ffm->packet_ptr;
     memset(ffm->packet_ptr, 0, fill_size);
 
-    if (url_ftell(pb) % ffm->packet_size)
+    if (avio_tell(pb) % ffm->packet_size)
         av_abort();
 
     /* put header */
-    put_be16(pb, PACKET_ID);
-    put_be16(pb, fill_size);
-    put_be64(pb, ffm->dts);
+    avio_wb16(pb, PACKET_ID);
+    avio_wb16(pb, fill_size);
+    avio_wb64(pb, ffm->dts);
     h = ffm->frame_offset;
     if (ffm->first_packet)
         h |= 0x8000;
-    put_be16(pb, h);
-    put_buffer(pb, ffm->packet, ffm->packet_end - ffm->packet);
-    put_flush_packet(pb);
+    avio_wb16(pb, h);
+    avio_write(pb, ffm->packet, ffm->packet_end - ffm->packet);
+    avio_flush(pb);
 
     /* prepare next packet */
     ffm->frame_offset = 0; /* no key frame */
@@ -84,24 +84,24 @@ static int ffm_write_header(AVFormatContext *s)
 {
     FFMContext *ffm = s->priv_data;
     AVStream *st;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *codec;
     int bit_rate, i;
 
     ffm->packet_size = FFM_PACKET_SIZE;
 
     /* header */
-    put_le32(pb, MKTAG('F', 'F', 'M', '1'));
-    put_be32(pb, ffm->packet_size);
-    put_be64(pb, 0); /* current write position */
+    avio_wl32(pb, MKTAG('F', 'F', 'M', '1'));
+    avio_wb32(pb, ffm->packet_size);
+    avio_wb64(pb, 0); /* current write position */
 
-    put_be32(pb, s->nb_streams);
+    avio_wb32(pb, s->nb_streams);
     bit_rate = 0;
     for(i=0;i<s->nb_streams;i++) {
         st = s->streams[i];
         bit_rate += st->codec->bit_rate;
     }
-    put_be32(pb, bit_rate);
+    avio_wb32(pb, bit_rate);
 
     /* list of streams */
     for(i=0;i<s->nb_streams;i++) {
@@ -110,84 +110,84 @@ static int ffm_write_header(AVFormatContext *s)
 
         codec = st->codec;
         /* generic info */
-        put_be32(pb, codec->codec_id);
-        put_byte(pb, codec->codec_type);
-        put_be32(pb, codec->bit_rate);
-        put_be32(pb, st->quality);
-        put_be32(pb, codec->flags);
-        put_be32(pb, codec->flags2);
-        put_be32(pb, codec->debug);
+        avio_wb32(pb, codec->codec_id);
+        avio_w8(pb, codec->codec_type);
+        avio_wb32(pb, codec->bit_rate);
+        avio_wb32(pb, st->quality);
+        avio_wb32(pb, codec->flags);
+        avio_wb32(pb, codec->flags2);
+        avio_wb32(pb, codec->debug);
         /* specific info */
         switch(codec->codec_type) {
         case AVMEDIA_TYPE_VIDEO:
-            put_be32(pb, codec->time_base.num);
-            put_be32(pb, codec->time_base.den);
-            put_be16(pb, codec->width);
-            put_be16(pb, codec->height);
-            put_be16(pb, codec->gop_size);
-            put_be32(pb, codec->pix_fmt);
-            put_byte(pb, codec->qmin);
-            put_byte(pb, codec->qmax);
-            put_byte(pb, codec->max_qdiff);
-            put_be16(pb, (int) (codec->qcompress * 10000.0));
-            put_be16(pb, (int) (codec->qblur * 10000.0));
-            put_be32(pb, codec->bit_rate_tolerance);
-            put_strz(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp");
-            put_be32(pb, codec->rc_max_rate);
-            put_be32(pb, codec->rc_min_rate);
-            put_be32(pb, codec->rc_buffer_size);
-            put_be64(pb, av_dbl2int(codec->i_quant_factor));
-            put_be64(pb, av_dbl2int(codec->b_quant_factor));
-            put_be64(pb, av_dbl2int(codec->i_quant_offset));
-            put_be64(pb, av_dbl2int(codec->b_quant_offset));
-            put_be32(pb, codec->dct_algo);
-            put_be32(pb, codec->strict_std_compliance);
-            put_be32(pb, codec->max_b_frames);
-            put_be32(pb, codec->luma_elim_threshold);
-            put_be32(pb, codec->chroma_elim_threshold);
-            put_be32(pb, codec->mpeg_quant);
-            put_be32(pb, codec->intra_dc_precision);
-            put_be32(pb, codec->me_method);
-            put_be32(pb, codec->mb_decision);
-            put_be32(pb, codec->nsse_weight);
-            put_be32(pb, codec->frame_skip_cmp);
-            put_be64(pb, av_dbl2int(codec->rc_buffer_aggressivity));
-            put_be32(pb, codec->codec_tag);
-            put_byte(pb, codec->thread_count);
-            put_be32(pb, codec->coder_type);
-            put_be32(pb, codec->me_cmp);
-            put_be32(pb, codec->partitions);
-            put_be32(pb, codec->me_subpel_quality);
-            put_be32(pb, codec->me_range);
-            put_be32(pb, codec->keyint_min);
-            put_be32(pb, codec->scenechange_threshold);
-            put_be32(pb, codec->b_frame_strategy);
-            put_be64(pb, av_dbl2int(codec->qcompress));
-            put_be64(pb, av_dbl2int(codec->qblur));
-            put_be32(pb, codec->max_qdiff);
-            put_be32(pb, codec->refs);
-            put_be32(pb, codec->directpred);
+            avio_wb32(pb, codec->time_base.num);
+            avio_wb32(pb, codec->time_base.den);
+            avio_wb16(pb, codec->width);
+            avio_wb16(pb, codec->height);
+            avio_wb16(pb, codec->gop_size);
+            avio_wb32(pb, codec->pix_fmt);
+            avio_w8(pb, codec->qmin);
+            avio_w8(pb, codec->qmax);
+            avio_w8(pb, codec->max_qdiff);
+            avio_wb16(pb, (int) (codec->qcompress * 10000.0));
+            avio_wb16(pb, (int) (codec->qblur * 10000.0));
+            avio_wb32(pb, codec->bit_rate_tolerance);
+            avio_put_str(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp");
+            avio_wb32(pb, codec->rc_max_rate);
+            avio_wb32(pb, codec->rc_min_rate);
+            avio_wb32(pb, codec->rc_buffer_size);
+            avio_wb64(pb, av_dbl2int(codec->i_quant_factor));
+            avio_wb64(pb, av_dbl2int(codec->b_quant_factor));
+            avio_wb64(pb, av_dbl2int(codec->i_quant_offset));
+            avio_wb64(pb, av_dbl2int(codec->b_quant_offset));
+            avio_wb32(pb, codec->dct_algo);
+            avio_wb32(pb, codec->strict_std_compliance);
+            avio_wb32(pb, codec->max_b_frames);
+            avio_wb32(pb, codec->luma_elim_threshold);
+            avio_wb32(pb, codec->chroma_elim_threshold);
+            avio_wb32(pb, codec->mpeg_quant);
+            avio_wb32(pb, codec->intra_dc_precision);
+            avio_wb32(pb, codec->me_method);
+            avio_wb32(pb, codec->mb_decision);
+            avio_wb32(pb, codec->nsse_weight);
+            avio_wb32(pb, codec->frame_skip_cmp);
+            avio_wb64(pb, av_dbl2int(codec->rc_buffer_aggressivity));
+            avio_wb32(pb, codec->codec_tag);
+            avio_w8(pb, codec->thread_count);
+            avio_wb32(pb, codec->coder_type);
+            avio_wb32(pb, codec->me_cmp);
+            avio_wb32(pb, codec->partitions);
+            avio_wb32(pb, codec->me_subpel_quality);
+            avio_wb32(pb, codec->me_range);
+            avio_wb32(pb, codec->keyint_min);
+            avio_wb32(pb, codec->scenechange_threshold);
+            avio_wb32(pb, codec->b_frame_strategy);
+            avio_wb64(pb, av_dbl2int(codec->qcompress));
+            avio_wb64(pb, av_dbl2int(codec->qblur));
+            avio_wb32(pb, codec->max_qdiff);
+            avio_wb32(pb, codec->refs);
+            avio_wb32(pb, codec->directpred);
             break;
         case AVMEDIA_TYPE_AUDIO:
-            put_be32(pb, codec->sample_rate);
-            put_le16(pb, codec->channels);
-            put_le16(pb, codec->frame_size);
-            put_le16(pb, codec->sample_fmt);
+            avio_wb32(pb, codec->sample_rate);
+            avio_wl16(pb, codec->channels);
+            avio_wl16(pb, codec->frame_size);
+            avio_wl16(pb, codec->sample_fmt);
             break;
         default:
             return -1;
         }
         if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
-            put_be32(pb, codec->extradata_size);
-            put_buffer(pb, codec->extradata, codec->extradata_size);
+            avio_wb32(pb, codec->extradata_size);
+            avio_write(pb, codec->extradata, codec->extradata_size);
         }
     }
 
     /* flush until end of block reached */
-    while ((url_ftell(pb) % ffm->packet_size) != 0)
-        put_byte(pb, 0);
+    while ((avio_tell(pb) % ffm->packet_size) != 0)
+        avio_w8(pb, 0);
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     /* init packet mux */
     ffm->packet_ptr = ffm->packet;
@@ -228,19 +228,19 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
 
 static int ffm_write_trailer(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     FFMContext *ffm = s->priv_data;
 
     /* flush packets */
     if (ffm->packet_ptr > ffm->packet)
         flush_packet(s);
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
-AVOutputFormat ffm_muxer = {
+AVOutputFormat ff_ffm_muxer = {
     "ffm",
     NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"),
     "",
diff --git a/ffmpeg-mt/libavformat/ffmeta.h b/ffmpeg-mt/libavformat/ffmeta.h
index f96dbb2..bce272a 100644
--- a/ffmpeg-mt/libavformat/ffmeta.h
+++ b/ffmpeg-mt/libavformat/ffmeta.h
@@ -2,20 +2,20 @@
  * Common data for metadata muxer/demuxer
  * Copyright (c) 2010 Anton Khirnov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/ffmetadec.c b/ffmpeg-mt/libavformat/ffmetadec.c
index 66ad953..6915b60 100644
--- a/ffmpeg-mt/libavformat/ffmetadec.c
+++ b/ffmpeg-mt/libavformat/ffmetadec.c
@@ -2,25 +2,26 @@
  * Metadata demuxer
  * Copyright (c) 2010 Anton Khirnov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
 #include "ffmeta.h"
+#include "internal.h"
 
 static int probe(AVProbeData *p)
 {
@@ -29,17 +30,17 @@ static int probe(AVProbeData *p)
     return 0;
 }
 
-static void get_line(ByteIOContext *s, uint8_t *buf, int size)
+static void get_line(AVIOContext *s, uint8_t *buf, int size)
 {
     do {
         uint8_t c;
         int i = 0;
 
-        while ((c = get_byte(s))) {
+        while ((c = avio_r8(s))) {
             if (c == '\\') {
                 if (i < size - 1)
                     buf[i++] = c;
-                c = get_byte(s);
+                c = avio_r8(s);
             } else if (c == '\n')
                 break;
 
@@ -47,7 +48,7 @@ static void get_line(ByteIOContext *s, uint8_t *buf, int size)
                 buf[i++] = c;
         }
         buf[i] = 0;
-    } while (!url_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
+    } while (!s->eof_reached && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
 }
 
 static AVChapter *read_chapter(AVFormatContext *s)
@@ -60,14 +61,14 @@ static AVChapter *read_chapter(AVFormatContext *s)
 
     if (sscanf(line, "TIMEBASE=%d/%d", &tb.num, &tb.den))
         get_line(s->pb, line, sizeof(line));
-    if (!sscanf(line, "START=%lld", &start)) {
+    if (!sscanf(line, "START=%"SCNd64, &start)) {
         av_log(s, AV_LOG_ERROR, "Expected chapter start timestamp, found %s.\n", line);
         start = (s->nb_chapters && s->chapters[s->nb_chapters - 1]->end != AV_NOPTS_VALUE) ?
                  s->chapters[s->nb_chapters - 1]->end : 0;
     } else
         get_line(s->pb, line, sizeof(line));
 
-    if (!sscanf(line, "END=%lld", &end)) {
+    if (!sscanf(line, "END=%"SCNd64, &end)) {
         av_log(s, AV_LOG_ERROR, "Expected chapter end timestamp, found %s.\n", line);
         end = AV_NOPTS_VALUE;
     }
@@ -125,7 +126,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     AVMetadata **m = &s->metadata;
     uint8_t line[1024];
 
-    while(!url_feof(s->pb)) {
+    while(!s->pb->eof_reached) {
         get_line(s->pb, line, sizeof(line));
 
         if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
@@ -163,7 +164,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return AVERROR_EOF;
 }
 
-AVInputFormat ffmetadata_demuxer = {
+AVInputFormat ff_ffmetadata_demuxer = {
     .name        = "ffmetadata",
     .long_name   = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text format"),
     .read_probe  = probe,
diff --git a/ffmpeg-mt/libavformat/ffmetaenc.c b/ffmpeg-mt/libavformat/ffmetaenc.c
index f42a2b3..178da59 100644
--- a/ffmpeg-mt/libavformat/ffmetaenc.c
+++ b/ffmpeg-mt/libavformat/ffmetaenc.c
@@ -2,56 +2,58 @@
  * Metadata muxer
  * Copyright (c) 2010 Anton Khirnov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+
 #include "avformat.h"
 #include "ffmeta.h"
 
 
-static void write_escape_str(ByteIOContext *s, const uint8_t *str)
+static void write_escape_str(AVIOContext *s, const uint8_t *str)
 {
     const uint8_t *p = str;
 
     while (*p) {
         if (*p == '#' || *p == ';' || *p == '=' || *p == '\\' || *p == '\n')
-            put_byte(s, '\\');
-        put_byte(s, *p);
+            avio_w8(s, '\\');
+        avio_w8(s, *p);
         p++;
     }
 }
 
-static void write_tags(ByteIOContext *s, AVMetadata *m)
+static void write_tags(AVIOContext *s, AVMetadata *m)
 {
     AVMetadataTag *t = NULL;
     while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) {
         write_escape_str(s, t->key);
-        put_byte(s, '=');
+        avio_w8(s, '=');
         write_escape_str(s, t->value);
-        put_byte(s, '\n');
+        avio_w8(s, '\n');
     }
 }
 
 static int write_header(AVFormatContext *s)
 {
-    put_tag(s->pb, ID_STRING);
-    put_byte(s->pb, '1');          // version
-    put_byte(s->pb, '\n');
-    put_flush_packet(s->pb);
+    avio_write(s->pb, ID_STRING, sizeof(ID_STRING) - 1);
+    avio_w8(s->pb, '1');          // version
+    avio_w8(s->pb, '\n');
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -62,22 +64,22 @@ static int write_trailer(AVFormatContext *s)
     write_tags(s->pb, s->metadata);
 
     for (i = 0; i < s->nb_streams; i++) {
-        put_tag(s->pb, ID_STREAM);
-        put_byte(s->pb, '\n');
+        avio_write(s->pb, ID_STREAM, sizeof(ID_STREAM) - 1);
+        avio_w8(s->pb, '\n');
         write_tags(s->pb, s->streams[i]->metadata);
     }
 
     for (i = 0; i < s->nb_chapters; i++) {
         AVChapter *ch = s->chapters[i];
-        put_tag(s->pb, ID_CHAPTER);
-        put_byte(s->pb, '\n');
-        url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den);
-        url_fprintf(s->pb, "START=%lld\n", ch->start);
-        url_fprintf(s->pb, "END=%lld\n",   ch->end);
+        avio_write(s->pb, ID_CHAPTER, sizeof(ID_CHAPTER) - 1);
+        avio_w8(s->pb, '\n');
+        avio_printf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den);
+        avio_printf(s->pb, "START=%"PRId64"\n", ch->start);
+        avio_printf(s->pb, "END=%"PRId64"\n",   ch->end);
         write_tags(s->pb, ch->metadata);
     }
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     return 0;
 }
@@ -87,7 +89,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVOutputFormat ffmetadata_muxer = {
+AVOutputFormat ff_ffmetadata_muxer = {
     .name          = "ffmetadata",
     .long_name     = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text format"),
     .extensions    = "ffmeta",
diff --git a/ffmpeg-mt/libavformat/file.c b/ffmpeg-mt/libavformat/file.c
index 3c3f42f..31067ed 100644
--- a/ffmpeg-mt/libavformat/file.c
+++ b/ffmpeg-mt/libavformat/file.c
@@ -2,20 +2,20 @@
  * Buffered file io for ffmpeg system
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <stdlib.h>
 #include "os_support.h"
+#include "url.h"
 
 
 /* standard file protocol */
@@ -59,9 +60,9 @@ static int file_open(URLContext *h, const char *filename, int flags)
 
     av_strstart(filename, "file:", &filename);
 
-    if (flags & URL_RDWR) {
+    if (flags & AVIO_RDWR) {
         access = O_CREAT | O_TRUNC | O_RDWR;
-    } else if (flags & URL_WRONLY) {
+    } else if (flags & AVIO_WRONLY) {
         access = O_CREAT | O_TRUNC | O_WRONLY;
     } else {
         access = O_RDONLY;
@@ -94,13 +95,13 @@ static int file_close(URLContext *h)
     return close(fd);
 }
 
-URLProtocol file_protocol = {
-    "file",
-    file_open,
-    file_read,
-    file_write,
-    file_seek,
-    file_close,
+URLProtocol ff_file_protocol = {
+    .name                = "file",
+    .url_open            = file_open,
+    .url_read            = file_read,
+    .url_write           = file_write,
+    .url_seek            = file_seek,
+    .url_close           = file_close,
     .url_get_file_handle = file_get_handle,
 };
 
@@ -116,7 +117,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
 
     fd = strtol(filename, &final, 10);
     if((filename == final) || *final ) {/* No digits found, or something like 10ab */
-        if (flags & URL_WRONLY) {
+        if (flags & AVIO_WRONLY) {
             fd = 1;
         } else {
             fd = 0;
@@ -130,11 +131,11 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
     return 0;
 }
 
-URLProtocol pipe_protocol = {
-    "pipe",
-    pipe_open,
-    file_read,
-    file_write,
+URLProtocol ff_pipe_protocol = {
+    .name                = "pipe",
+    .url_open            = pipe_open,
+    .url_read            = file_read,
+    .url_write           = file_write,
     .url_get_file_handle = file_get_handle,
 };
 
diff --git a/ffmpeg-mt/libavformat/filmstripdec.c b/ffmpeg-mt/libavformat/filmstripdec.c
index 0442fc3..095bf9e 100644
--- a/ffmpeg-mt/libavformat/filmstripdec.c
+++ b/ffmpeg-mt/libavformat/filmstripdec.c
@@ -2,20 +2,20 @@
  * Adobe Filmstrip demuxer
  * Copyright (c) 2010 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -37,14 +37,14 @@ static int read_header(AVFormatContext *s,
                        AVFormatParameters *ap)
 {
     FilmstripDemuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
 
-    if (url_is_streamed(s->pb))
+    if (!s->pb->seekable)
         return AVERROR(EIO);
 
-    url_fseek(pb, url_fsize(pb) - 36, SEEK_SET);
-    if (get_be32(pb) != RAND_TAG) {
+    avio_seek(pb, avio_size(pb) - 36, SEEK_SET);
+    if (avio_rb32(pb) != RAND_TAG) {
         av_log(s, AV_LOG_ERROR, "magic number not found");
         return AVERROR_INVALIDDATA;
     }
@@ -53,23 +53,23 @@ static int read_header(AVFormatContext *s,
     if (!st)
         return AVERROR(ENOMEM);
 
-    st->nb_frames = get_be32(pb);
-    if (get_be16(pb) != 0) {
+    st->nb_frames = avio_rb32(pb);
+    if (avio_rb16(pb) != 0) {
         av_log_ask_for_sample(s, "unsupported packing method\n");
         return AVERROR_INVALIDDATA;
     }
 
-    url_fskip(pb, 2);
+    avio_skip(pb, 2);
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id   = CODEC_ID_RAWVIDEO;
     st->codec->pix_fmt    = PIX_FMT_RGBA;
     st->codec->codec_tag  = 0; /* no fourcc */
-    st->codec->width      = get_be16(pb);
-    st->codec->height     = get_be16(pb);
-    film->leading         = get_be16(pb);
-    av_set_pts_info(st, 64, 1, get_be16(pb));
+    st->codec->width      = avio_rb16(pb);
+    st->codec->height     = avio_rb16(pb);
+    film->leading         = avio_rb16(pb);
+    av_set_pts_info(st, 64, 1, avio_rb16(pb));
 
-    url_fseek(pb, 0, SEEK_SET);
+    avio_seek(pb, 0, SEEK_SET);
 
     return 0;
 }
@@ -80,11 +80,11 @@ static int read_packet(AVFormatContext *s,
     FilmstripDemuxContext *film = s->priv_data;
     AVStream *st = s->streams[0];
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR(EIO);
-    pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
+    pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
     pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
-    url_fskip(s->pb, st->codec->width * film->leading * 4);
+    avio_skip(s->pb, st->codec->width * film->leading * 4);
     if (pkt->size < 0)
         return pkt->size;
     pkt->flags |= AV_PKT_FLAG_KEY;
@@ -94,11 +94,11 @@ static int read_packet(AVFormatContext *s,
 static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 {
     AVStream *st = s->streams[stream_index];
-    url_fseek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET);
+    avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET);
     return 0;
 }
 
-AVInputFormat filmstrip_demuxer = {
+AVInputFormat ff_filmstrip_demuxer = {
     "filmstrip",
     NULL_IF_CONFIG_SMALL("Adobe Filmstrip"),
     sizeof(FilmstripDemuxContext),
diff --git a/ffmpeg-mt/libavformat/filmstripenc.c b/ffmpeg-mt/libavformat/filmstripenc.c
index 4e10c28..21f4755 100644
--- a/ffmpeg-mt/libavformat/filmstripenc.c
+++ b/ffmpeg-mt/libavformat/filmstripenc.c
@@ -2,20 +2,20 @@
  * Adobe Filmstrip muxer
  * Copyright (c) 2010 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -45,7 +45,7 @@ static int write_header(AVFormatContext *s)
 static int write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     FilmstripMuxContext *film = s->priv_data;
-    put_buffer(s->pb, pkt->data, pkt->size);
+    avio_write(s->pb, pkt->data, pkt->size);
     film->nb_frames++;
     return 0;
 }
@@ -53,25 +53,25 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 static int write_trailer(AVFormatContext *s)
 {
     FilmstripMuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st = s->streams[0];
     int i;
 
-    put_be32(pb, RAND_TAG);
-    put_be32(pb, film->nb_frames);
-    put_be16(pb, 0);  // packing method
-    put_be16(pb, 0);  // reserved
-    put_be16(pb, st->codec->width);
-    put_be16(pb, st->codec->height);
-    put_be16(pb, 0);  // leading
-    put_be16(pb, 1/av_q2d(st->codec->time_base));
+    avio_wb32(pb, RAND_TAG);
+    avio_wb32(pb, film->nb_frames);
+    avio_wb16(pb, 0);  // packing method
+    avio_wb16(pb, 0);  // reserved
+    avio_wb16(pb, st->codec->width);
+    avio_wb16(pb, st->codec->height);
+    avio_wb16(pb, 0);  // leading
+    avio_wb16(pb, 1/av_q2d(st->codec->time_base));
     for (i = 0; i < 16; i++)
-        put_byte(pb, 0x00);  // reserved
-    put_flush_packet(pb);
+        avio_w8(pb, 0x00);  // reserved
+    avio_flush(pb);
     return 0;
 }
 
-AVOutputFormat filmstrip_muxer = {
+AVOutputFormat ff_filmstrip_muxer = {
     "filmstrip",
     NULL_IF_CONFIG_SMALL("Adobe Filmstrip"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/flacdec.c b/ffmpeg-mt/libavformat/flacdec.c
index d73486f..02452b4 100644
--- a/ffmpeg-mt/libavformat/flacdec.c
+++ b/ffmpeg-mt/libavformat/flacdec.c
@@ -2,20 +2,20 @@
  * Raw FLAC demuxer
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -40,14 +40,14 @@ static int flac_read_header(AVFormatContext *s,
     /* the parameters will be extracted from the compressed bitstream */
 
     /* if fLaC marker is not found, assume there is no header */
-    if (get_le32(s->pb) != MKTAG('f','L','a','C')) {
-        url_fseek(s->pb, -4, SEEK_CUR);
+    if (avio_rl32(s->pb) != MKTAG('f','L','a','C')) {
+        avio_seek(s->pb, -4, SEEK_CUR);
         return 0;
     }
 
     /* process metadata blocks */
-    while (!url_feof(s->pb) && !metadata_last) {
-        get_buffer(s->pb, header, 4);
+    while (!s->pb->eof_reached && !metadata_last) {
+        avio_read(s->pb, header, 4);
         ff_flac_parse_block_header(header, &metadata_last, &metadata_type,
                                    &metadata_size);
         switch (metadata_type) {
@@ -58,14 +58,14 @@ static int flac_read_header(AVFormatContext *s,
             if (!buffer) {
                 return AVERROR(ENOMEM);
             }
-            if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) {
+            if (avio_read(s->pb, buffer, metadata_size) != metadata_size) {
                 av_freep(&buffer);
                 return AVERROR(EIO);
             }
             break;
         /* skip metadata block for unsupported types */
         default:
-            ret = url_fseek(s->pb, metadata_size, SEEK_CUR);
+            ret = avio_skip(s->pb, metadata_size);
             if (ret < 0)
                 return ret;
         }
@@ -123,7 +123,7 @@ static int flac_probe(AVProbeData *p)
     else                                            return AVPROBE_SCORE_MAX/2;
 }
 
-AVInputFormat flac_demuxer = {
+AVInputFormat ff_flac_demuxer = {
     "flac",
     NULL_IF_CONFIG_SMALL("raw FLAC"),
     0,
diff --git a/ffmpeg-mt/libavformat/flacenc.c b/ffmpeg-mt/libavformat/flacenc.c
index 281d013..38c3265 100644
--- a/ffmpeg-mt/libavformat/flacenc.c
+++ b/ffmpeg-mt/libavformat/flacenc.c
@@ -2,20 +2,20 @@
  * raw FLAC muxer
  * Copyright (c) 2006-2009 Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,19 +27,19 @@
 #include "libavcodec/bytestream.h"
 
 
-static int flac_write_block_padding(ByteIOContext *pb, unsigned int n_padding_bytes,
+static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes,
                                     int last_block)
 {
-    put_byte(pb, last_block ? 0x81 : 0x01);
-    put_be24(pb, n_padding_bytes);
+    avio_w8(pb, last_block ? 0x81 : 0x01);
+    avio_wb24(pb, n_padding_bytes);
     while (n_padding_bytes > 0) {
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
         n_padding_bytes--;
     }
     return 0;
 }
 
-static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m,
+static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m,
                                     int last_block, int bitexact)
 {
     const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
@@ -58,7 +58,7 @@ static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m,
     bytestream_put_be24(&p, len);
     ff_vorbiscomment_write(&p, m, vendor, count);
 
-    put_buffer(pb, p0, len+4);
+    avio_write(pb, p0, len+4);
     av_freep(&p0);
     p = NULL;
 
@@ -90,7 +90,7 @@ static int flac_write_header(struct AVFormatContext *s)
 
 static int flac_write_trailer(struct AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint8_t *streaminfo;
     enum FLACExtradataFormat format;
     int64_t file_size;
@@ -98,13 +98,13 @@ static int flac_write_trailer(struct AVFormatContext *s)
     if (!ff_flac_is_extradata_valid(s->streams[0]->codec, &format, &streaminfo))
         return -1;
 
-    if (!url_is_streamed(pb)) {
+    if (pb->seekable) {
         /* rewrite the STREAMINFO header block data */
-        file_size = url_ftell(pb);
-        url_fseek(pb, 8, SEEK_SET);
-        put_buffer(pb, streaminfo, FLAC_STREAMINFO_SIZE);
-        url_fseek(pb, file_size, SEEK_SET);
-        put_flush_packet(pb);
+        file_size = avio_tell(pb);
+        avio_seek(pb, 8, SEEK_SET);
+        avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
+        avio_seek(pb, file_size, SEEK_SET);
+        avio_flush(pb);
     } else {
         av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n");
     }
@@ -113,12 +113,12 @@ static int flac_write_trailer(struct AVFormatContext *s)
 
 static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
+    avio_write(s->pb, pkt->data, pkt->size);
+    avio_flush(s->pb);
     return 0;
 }
 
-AVOutputFormat flac_muxer = {
+AVOutputFormat ff_flac_muxer = {
     "flac",
     NULL_IF_CONFIG_SMALL("raw FLAC"),
     "audio/x-flac",
diff --git a/ffmpeg-mt/libavformat/flacenc.h b/ffmpeg-mt/libavformat/flacenc.h
index 8ad1c26..2edda67 100644
--- a/ffmpeg-mt/libavformat/flacenc.h
+++ b/ffmpeg-mt/libavformat/flacenc.h
@@ -2,20 +2,20 @@
  * raw FLAC muxer
  * Copyright (C) 2009 Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,7 +26,7 @@
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
 
-int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
+int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
                          int last_block);
 
 #endif /* AVFORMAT_FLACENC_H */
diff --git a/ffmpeg-mt/libavformat/flacenc_header.c b/ffmpeg-mt/libavformat/flacenc_header.c
index 92a129a..90c5a77 100644
--- a/ffmpeg-mt/libavformat/flacenc_header.c
+++ b/ffmpeg-mt/libavformat/flacenc_header.c
@@ -2,20 +2,20 @@
  * raw FLAC muxer
  * Copyright (C) 2009 Justin Ruggles
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,7 +24,7 @@
 #include "avformat.h"
 #include "flacenc.h"
 
-int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
+int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
                          int last_block)
 {
     uint8_t header[8] = {
@@ -39,11 +39,11 @@ int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
 
     /* write "fLaC" stream marker and first metadata block header if needed */
     if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) {
-        put_buffer(pb, header, 8);
+        avio_write(pb, header, 8);
     }
 
     /* write STREAMINFO or full header */
-    put_buffer(pb, codec->extradata, codec->extradata_size);
+    avio_write(pb, codec->extradata, codec->extradata_size);
 
     return 0;
 }
diff --git a/ffmpeg-mt/libavformat/flic.c b/ffmpeg-mt/libavformat/flic.c
index 51320c9..4b59398 100644
--- a/ffmpeg-mt/libavformat/flic.c
+++ b/ffmpeg-mt/libavformat/flic.c
@@ -2,20 +2,20 @@
  * FLI/FLC Animation File Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,6 +32,7 @@
  */
 
 #include "libavutil/intreadwrite.h"
+#include "libavutil/audioconvert.h"
 #include "avformat.h"
 
 #define FLIC_FILE_MAGIC_1 0xAF11
@@ -85,7 +86,7 @@ static int flic_read_header(AVFormatContext *s,
                             AVFormatParameters *ap)
 {
     FlicDemuxContext *flic = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned char header[FLIC_HEADER_SIZE];
     AVStream *st, *ast;
     int speed;
@@ -95,7 +96,7 @@ static int flic_read_header(AVFormatContext *s,
     flic->frame_number = 0;
 
     /* load the whole header and pull out the width and height */
-    if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
+    if (avio_read(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
         return AVERROR(EIO);
 
     magic_number = AV_RL16(&header[4]);
@@ -129,12 +130,12 @@ static int flic_read_header(AVFormatContext *s,
     memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE);
 
     /* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */
-    if (get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) {
+    if (avio_read(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) {
         av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n");
         return AVERROR(EIO);
     }
 
-    url_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR);
+    avio_seek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR);
 
     /* Time to figure out the framerate:
      * If the first preamble's magic number is 0xAAAA then this file is from
@@ -160,7 +161,7 @@ static int flic_read_header(AVFormatContext *s,
         ast->codec->sample_fmt = AV_SAMPLE_FMT_U8;
         ast->codec->bit_rate = st->codec->sample_rate * 8;
         ast->codec->bits_per_coded_sample = 8;
-        ast->codec->channel_layout = CH_LAYOUT_MONO;
+        ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
         ast->codec->extradata_size = 0;
 
         /* Since the header information is incorrect we have to figure out the
@@ -172,7 +173,7 @@ static int flic_read_header(AVFormatContext *s,
         av_set_pts_info(st, 64, FLIC_MC_SPEED, 70);
 
         /* rewind the stream since the first chunk is at offset 12 */
-        url_fseek(pb, 12, SEEK_SET);
+        avio_seek(pb, 12, SEEK_SET);
 
         /* send over abbreviated FLIC header chunk */
         av_free(st->codec->extradata);
@@ -197,7 +198,7 @@ static int flic_read_packet(AVFormatContext *s,
                             AVPacket *pkt)
 {
     FlicDemuxContext *flic = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int packet_read = 0;
     unsigned int size;
     int magic;
@@ -206,7 +207,7 @@ static int flic_read_packet(AVFormatContext *s,
 
     while (!packet_read) {
 
-        if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
+        if ((ret = avio_read(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
             FLIC_PREAMBLE_SIZE) {
             ret = AVERROR(EIO);
             break;
@@ -222,9 +223,9 @@ static int flic_read_packet(AVFormatContext *s,
             }
             pkt->stream_index = flic->video_stream_index;
             pkt->pts = flic->frame_number++;
-            pkt->pos = url_ftell(pb);
+            pkt->pos = avio_tell(pb);
             memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
-            ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE,
+            ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE,
                 size - FLIC_PREAMBLE_SIZE);
             if (ret != size - FLIC_PREAMBLE_SIZE) {
                 av_free_packet(pkt);
@@ -238,11 +239,11 @@ static int flic_read_packet(AVFormatContext *s,
             }
 
             /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */
-            url_fseek(pb, 10, SEEK_CUR);
+            avio_skip(pb, 10);
 
             pkt->stream_index = flic->audio_stream_index;
-            pkt->pos = url_ftell(pb);
-            ret = get_buffer(pb, pkt->data, size);
+            pkt->pos = avio_tell(pb);
+            ret = avio_read(pb, pkt->data, size);
 
             if (ret != size) {
                 av_free_packet(pkt);
@@ -252,14 +253,14 @@ static int flic_read_packet(AVFormatContext *s,
             packet_read = 1;
         } else {
             /* not interested in this chunk */
-            url_fseek(pb, size - 6, SEEK_CUR);
+            avio_skip(pb, size - 6);
         }
     }
 
     return ret;
 }
 
-AVInputFormat flic_demuxer = {
+AVInputFormat ff_flic_demuxer = {
     "flic",
     NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"),
     sizeof(FlicDemuxContext),
diff --git a/ffmpeg-mt/libavformat/flv.h b/ffmpeg-mt/libavformat/flv.h
index 5d2666d..c86e20a 100644
--- a/ffmpeg-mt/libavformat/flv.h
+++ b/ffmpeg-mt/libavformat/flv.h
@@ -2,22 +2,22 @@
  * @file
  * FLV common header
  *
- * Copyright (c) 2006 The FFmpeg Project
+ * Copyright (c) 2006 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/flvdec.c b/ffmpeg-mt/libavformat/flvdec.c
index b359261..f27b70c 100644
--- a/ffmpeg-mt/libavformat/flvdec.c
+++ b/ffmpeg-mt/libavformat/flvdec.c
@@ -1,26 +1,26 @@
 /*
  * FLV demuxer
- * Copyright (c) 2003 The FFmpeg Project
+ * Copyright (c) 2003 The Libav Project
  *
  * This demuxer will generate a 1 byte extradata for VP6F content.
  * It is composed of:
  *  - upper 4bits: difference between encoded width and visible width
  *  - lower 4bits: difference between encoded height and visible height
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,8 +28,13 @@
 #include "libavcodec/bytestream.h"
 #include "libavcodec/mpeg4audio.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "flv.h"
 
+#define KEYFRAMES_TAG            "keyframes"
+#define KEYFRAMES_TIMESTAMP_TAG  "times"
+#define KEYFRAMES_BYTEOFFSET_TAG "filepositions"
+
 typedef struct {
     int wrong_dts; ///< wrong dts due to negative cts
 } FLVContext;
@@ -97,7 +102,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
                 vcodec->extradata_size = 1;
                 vcodec->extradata = av_malloc(1);
             }
-            vcodec->extradata[0] = get_byte(s->pb);
+            vcodec->extradata[0] = avio_r8(s->pb);
             return 1; // 1 byte body size adjustment for flv_read_packet()
         case FLV_CODECID_H264:
             vcodec->codec_id = CODEC_ID_H264;
@@ -110,23 +115,81 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
     return 0;
 }
 
-static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) {
-    int length = get_be16(ioc);
+static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) {
+    int length = avio_rb16(ioc);
     if(length >= buffsize) {
-        url_fskip(ioc, length);
+        avio_skip(ioc, length);
         return -1;
     }
 
-    get_buffer(ioc, buffer, length);
+    avio_read(ioc, buffer, length);
 
     buffer[length] = '\0';
 
     return length;
 }
 
+static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream *vstream, int64_t max_pos) {
+    unsigned int arraylen = 0, timeslen = 0, fileposlen = 0, i;
+    double num_val;
+    char str_val[256];
+    int64_t *times = NULL;
+    int64_t *filepositions = NULL;
+    int ret = 0;
+
+    while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
+        int64_t* current_array;
+
+        // Expect array object in context
+        if (avio_r8(ioc) != AMF_DATA_TYPE_ARRAY)
+            break;
+
+        arraylen = avio_rb32(ioc);
+        /*
+         * Expect only 'times' or 'filepositions' sub-arrays in other case refuse to use such metadata
+         * for indexing
+         */
+        if (!strcmp(KEYFRAMES_TIMESTAMP_TAG, str_val) && !times) {
+            if (!(times = av_mallocz(sizeof(*times) * arraylen))) {
+                ret = AVERROR(ENOMEM);
+                goto finish;
+            }
+            timeslen = arraylen;
+            current_array = times;
+        } else if (!strcmp(KEYFRAMES_BYTEOFFSET_TAG, str_val) && !filepositions) {
+            if (!(filepositions = av_mallocz(sizeof(*filepositions) * arraylen))) {
+                ret = AVERROR(ENOMEM);
+                goto finish;
+            }
+            fileposlen = arraylen;
+            current_array = filepositions;
+        } else // unexpected metatag inside keyframes, will not use such metadata for indexing
+            break;
+
+        for (i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
+            if (avio_r8(ioc) != AMF_DATA_TYPE_NUMBER)
+                goto finish;
+            num_val = av_int2dbl(avio_rb64(ioc));
+            current_array[i] = num_val;
+        }
+    }
+
+    if (timeslen == fileposlen)
+         for(i = 0; i < arraylen; i++)
+             av_add_index_entry(vstream, filepositions[i], times[i]*1000, 0, 0, AVINDEX_KEYFRAME);
+    else
+        av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");
+
+finish:
+    av_freep(&times);
+    av_freep(&filepositions);
+    avio_seek(ioc, max_pos, SEEK_SET);
+    return ret;
+}
+
 static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) {
     AVCodecContext *acodec, *vcodec;
-    ByteIOContext *ioc;
+    AVIOContext *ioc;
     AMFDataType amf_type;
     char str_val[256];
     double num_val;
@@ -134,13 +197,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
     num_val = 0;
     ioc = s->pb;
 
-    amf_type = get_byte(ioc);
+    amf_type = avio_r8(ioc);
 
     switch(amf_type) {
         case AMF_DATA_TYPE_NUMBER:
-            num_val = av_int2dbl(get_be64(ioc)); break;
+            num_val = av_int2dbl(avio_rb64(ioc)); break;
         case AMF_DATA_TYPE_BOOL:
-            num_val = get_byte(ioc); break;
+            num_val = avio_r8(ioc); break;
         case AMF_DATA_TYPE_STRING:
             if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0)
                 return -1;
@@ -148,12 +211,16 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
         case AMF_DATA_TYPE_OBJECT: {
             unsigned int keylen;
 
-            while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) {
-                url_fskip(ioc, keylen); //skip key string
+            if (key && !strcmp(KEYFRAMES_TAG, key) && depth == 1)
+                if (parse_keyframes_index(s, ioc, vstream, max_pos) < 0)
+                    return -1;
+
+            while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
+                avio_skip(ioc, keylen); //skip key string
                 if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
                     return -1; //if we couldn't skip, bomb out.
             }
-            if(get_byte(ioc) != AMF_END_OF_OBJECT)
+            if(avio_r8(ioc) != AMF_END_OF_OBJECT)
                 return -1;
         }
             break;
@@ -162,27 +229,27 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
         case AMF_DATA_TYPE_UNSUPPORTED:
             break; //these take up no additional space
         case AMF_DATA_TYPE_MIXEDARRAY:
-            url_fskip(ioc, 4); //skip 32-bit max array index
-            while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
+            avio_skip(ioc, 4); //skip 32-bit max array index
+            while(avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
                 //this is the only case in which we would want a nested parse to not skip over the object
                 if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
                     return -1;
             }
-            if(get_byte(ioc) != AMF_END_OF_OBJECT)
+            if(avio_r8(ioc) != AMF_END_OF_OBJECT)
                 return -1;
             break;
         case AMF_DATA_TYPE_ARRAY: {
             unsigned int arraylen, i;
 
-            arraylen = get_be32(ioc);
-            for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
+            arraylen = avio_rb32(ioc);
+            for(i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
                 if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
                     return -1; //if we couldn't skip, bomb out.
             }
         }
             break;
         case AMF_DATA_TYPE_DATE:
-            url_fskip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16)
+            avio_skip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16)
             break;
         default: //unsupported type, we couldn't skip
             return -1;
@@ -213,7 +280,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
 static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
     AMFDataType type;
     AVStream *stream, *astream, *vstream;
-    ByteIOContext *ioc;
+    AVIOContext *ioc;
     int i;
     char buffer[11]; //only needs to hold the string "onMetaData". Anything longer is something we don't want.
 
@@ -222,7 +289,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
     ioc = s->pb;
 
     //first object needs to be "onMetaData" string
-    type = get_byte(ioc);
+    type = avio_r8(ioc);
     if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData"))
         return -1;
 
@@ -254,8 +321,8 @@ static int flv_read_header(AVFormatContext *s,
 {
     int offset, flags;
 
-    url_fskip(s->pb, 4);
-    flags = get_byte(s->pb);
+    avio_skip(s->pb, 4);
+    flags = avio_r8(s->pb);
     /* old flvtool cleared this field */
     /* FIXME: better fix needed */
     if (!flags) {
@@ -276,9 +343,9 @@ static int flv_read_header(AVFormatContext *s,
             return AVERROR(ENOMEM);
     }
 
-    offset = get_be32(s->pb);
-    url_fseek(s->pb, offset, SEEK_SET);
-    url_fskip(s->pb, 4);
+    offset = avio_rb32(s->pb);
+    avio_seek(s->pb, offset, SEEK_SET);
+    avio_skip(s->pb, 4);
 
     s->start_time = 0;
 
@@ -292,7 +359,7 @@ static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
     if (!st->codec->extradata)
         return AVERROR(ENOMEM);
     st->codec->extradata_size = size;
-    get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
+    avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
     return 0;
 }
 
@@ -304,30 +371,30 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
     int64_t dts, pts = AV_NOPTS_VALUE;
     AVStream *st = NULL;
 
- for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */
-    pos = url_ftell(s->pb);
-    type = get_byte(s->pb);
-    size = get_be24(s->pb);
-    dts = get_be24(s->pb);
-    dts |= get_byte(s->pb) << 24;
+ for(;;avio_skip(s->pb, 4)){ /* pkt size is repeated at end. skip it */
+    pos = avio_tell(s->pb);
+    type = avio_r8(s->pb);
+    size = avio_rb24(s->pb);
+    dts = avio_rb24(s->pb);
+    dts |= avio_r8(s->pb) << 24;
 //    av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts);
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR_EOF;
-    url_fskip(s->pb, 3); /* stream id, always 0 */
+    avio_skip(s->pb, 3); /* stream id, always 0 */
     flags = 0;
 
     if(size == 0)
         continue;
 
-    next= size + url_ftell(s->pb);
+    next= size + avio_tell(s->pb);
 
     if (type == FLV_TAG_TYPE_AUDIO) {
         is_audio=1;
-        flags = get_byte(s->pb);
+        flags = avio_r8(s->pb);
         size--;
     } else if (type == FLV_TAG_TYPE_VIDEO) {
         is_audio=0;
-        flags = get_byte(s->pb);
+        flags = avio_r8(s->pb);
         size--;
         if ((flags & 0xf0) == 0x50) /* video info / command frame */
             goto skip;
@@ -337,7 +404,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
         else /* skip packet */
             av_log(s, AV_LOG_DEBUG, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
     skip:
-        url_fseek(s->pb, next, SEEK_SET);
+        avio_seek(s->pb, next, SEEK_SET);
         continue;
     }
 
@@ -361,7 +428,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
        ||(st->discard >= AVDISCARD_BIDIR  &&  ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
        || st->discard >= AVDISCARD_ALL
        ){
-        url_fseek(s->pb, next, SEEK_SET);
+        avio_seek(s->pb, next, SEEK_SET);
         continue;
     }
     if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
@@ -370,19 +437,19 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
  }
 
     // if not streamed and no duration from metadata then seek to end to find the duration from the timestamps
-    if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){
+    if(s->pb->seekable && (!s->duration || s->duration==AV_NOPTS_VALUE)){
         int size;
-        const int64_t pos= url_ftell(s->pb);
-        const int64_t fsize= url_fsize(s->pb);
-        url_fseek(s->pb, fsize-4, SEEK_SET);
-        size= get_be32(s->pb);
-        url_fseek(s->pb, fsize-3-size, SEEK_SET);
-        if(size == get_be24(s->pb) + 11){
-            uint32_t ts = get_be24(s->pb);
-            ts |= get_byte(s->pb) << 24;
+        const int64_t pos= avio_tell(s->pb);
+        const int64_t fsize= avio_size(s->pb);
+        avio_seek(s->pb, fsize-4, SEEK_SET);
+        size= avio_rb32(s->pb);
+        avio_seek(s->pb, fsize-3-size, SEEK_SET);
+        if(size == avio_rb24(s->pb) + 11){
+            uint32_t ts = avio_rb24(s->pb);
+            ts |= avio_r8(s->pb) << 24;
             s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
         }
-        url_fseek(s->pb, pos, SEEK_SET);
+        avio_seek(s->pb, pos, SEEK_SET);
     }
 
     if(is_audio){
@@ -400,10 +467,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     if (st->codec->codec_id == CODEC_ID_AAC ||
         st->codec->codec_id == CODEC_ID_H264) {
-        int type = get_byte(s->pb);
+        int type = avio_r8(s->pb);
         size--;
         if (st->codec->codec_id == CODEC_ID_H264) {
-            int32_t cts = (get_be24(s->pb)+0xff800000)^0xff800000; // sign extension
+            int32_t cts = (avio_rb24(s->pb)+0xff800000)^0xff800000; // sign extension
             pts = dts + cts;
             if (cts < 0) { // dts are wrong
                 flv->wrong_dts = 1;
@@ -424,7 +491,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
                     st->codec->sample_rate = cfg.ext_sample_rate;
                 else
                     st->codec->sample_rate = cfg.sample_rate;
-                dprintf(s, "mp4a config channels %d sample rate %d\n",
+                av_dlog(s, "mp4a config channels %d sample rate %d\n",
                         st->codec->channels, st->codec->sample_rate);
             }
 
@@ -454,14 +521,14 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
         pkt->flags |= AV_PKT_FLAG_KEY;
 
 leave:
-    url_fskip(s->pb, 4);
+    avio_skip(s->pb, 4);
     return ret;
 }
 
 static int flv_read_seek(AVFormatContext *s, int stream_index,
     int64_t ts, int flags)
 {
-    return av_url_read_fseek(s->pb, stream_index, ts, flags);
+    return ffio_read_seek(s->pb, stream_index, ts, flags);
 }
 
 #if 0 /* don't know enough to implement this */
@@ -472,7 +539,7 @@ static int flv_read_seek2(AVFormatContext *s, int stream_index,
 
     if (ts - min_ts > (uint64_t)(max_ts - ts)) flags |= AVSEEK_FLAG_BACKWARD;
 
-    if (url_is_streamed(s->pb)) {
+    if (!s->pb->seekable) {
         if (stream_index < 0) {
             stream_index = av_find_default_stream_index(s);
             if (stream_index < 0)
@@ -482,7 +549,7 @@ static int flv_read_seek2(AVFormatContext *s, int stream_index,
             ts = av_rescale_rnd(ts, 1000, AV_TIME_BASE,
                 flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
         }
-        ret = av_url_read_fseek(s->pb, stream_index, ts, flags);
+        ret = ffio_read_seek(s->pb, stream_index, ts, flags);
     }
 
     if (ret == AVERROR(ENOSYS))
@@ -491,7 +558,7 @@ static int flv_read_seek2(AVFormatContext *s, int stream_index,
 }
 #endif
 
-AVInputFormat flv_demuxer = {
+AVInputFormat ff_flv_demuxer = {
     "flv",
     NULL_IF_CONFIG_SMALL("FLV format"),
     sizeof(FLVContext),
diff --git a/ffmpeg-mt/libavformat/flvenc.c b/ffmpeg-mt/libavformat/flvenc.c
index e138292..b8ae113 100644
--- a/ffmpeg-mt/libavformat/flvenc.c
+++ b/ffmpeg-mt/libavformat/flvenc.c
@@ -1,21 +1,21 @@
 /*
  * FLV muxer
- * Copyright (c) 2003 The FFmpeg Project
+ * Copyright (c) 2003 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
@@ -139,39 +139,39 @@ static int get_audio_flags(AVCodecContext *enc){
     return flags;
 }
 
-static void put_amf_string(ByteIOContext *pb, const char *str)
+static void put_amf_string(AVIOContext *pb, const char *str)
 {
     size_t len = strlen(str);
-    put_be16(pb, len);
-    put_buffer(pb, str, len);
+    avio_wb16(pb, len);
+    avio_write(pb, str, len);
 }
 
-static void put_avc_eos_tag(ByteIOContext *pb, unsigned ts) {
-    put_byte(pb, FLV_TAG_TYPE_VIDEO);
-    put_be24(pb, 5);  /* Tag Data Size */
-    put_be24(pb, ts);  /* lower 24 bits of timestamp in ms*/
-    put_byte(pb, (ts >> 24) & 0x7F);  /* MSB of ts in ms*/
-    put_be24(pb, 0);  /* StreamId = 0 */
-    put_byte(pb, 23);  /* ub[4] FrameType = 1, ub[4] CodecId = 7 */
-    put_byte(pb, 2);  /* AVC end of sequence */
-    put_be24(pb, 0);  /* Always 0 for AVC EOS. */
-    put_be32(pb, 16);  /* Size of FLV tag */
+static void put_avc_eos_tag(AVIOContext *pb, unsigned ts) {
+    avio_w8(pb, FLV_TAG_TYPE_VIDEO);
+    avio_wb24(pb, 5);  /* Tag Data Size */
+    avio_wb24(pb, ts);  /* lower 24 bits of timestamp in ms*/
+    avio_w8(pb, (ts >> 24) & 0x7F);  /* MSB of ts in ms*/
+    avio_wb24(pb, 0);  /* StreamId = 0 */
+    avio_w8(pb, 23);  /* ub[4] FrameType = 1, ub[4] CodecId = 7 */
+    avio_w8(pb, 2);  /* AVC end of sequence */
+    avio_wb24(pb, 0);  /* Always 0 for AVC EOS. */
+    avio_wb32(pb, 16);  /* Size of FLV tag */
 }
 
-static void put_amf_double(ByteIOContext *pb, double d)
+static void put_amf_double(AVIOContext *pb, double d)
 {
-    put_byte(pb, AMF_DATA_TYPE_NUMBER);
-    put_be64(pb, av_dbl2int(d));
+    avio_w8(pb, AMF_DATA_TYPE_NUMBER);
+    avio_wb64(pb, av_dbl2int(d));
 }
 
-static void put_amf_bool(ByteIOContext *pb, int b) {
-    put_byte(pb, AMF_DATA_TYPE_BOOL);
-    put_byte(pb, !!b);
+static void put_amf_bool(AVIOContext *pb, int b) {
+    avio_w8(pb, AMF_DATA_TYPE_BOOL);
+    avio_w8(pb, !!b);
 }
 
 static int flv_write_header(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     FLVContext *flv = s->priv_data;
     AVCodecContext *audio_enc = NULL, *video_enc = NULL;
     int i;
@@ -199,20 +199,20 @@ static int flv_write_header(AVFormatContext *s)
         }
         av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
     }
-    put_tag(pb,"FLV");
-    put_byte(pb,1);
-    put_byte(pb,   FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
+    avio_write(pb, "FLV", 3);
+    avio_w8(pb,1);
+    avio_w8(pb,   FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
                  + FLV_HEADER_FLAG_HASVIDEO * !!video_enc);
-    put_be32(pb,9);
-    put_be32(pb,0);
+    avio_wb32(pb,9);
+    avio_wb32(pb,0);
 
     for(i=0; i<s->nb_streams; i++){
         if(s->streams[i]->codec->codec_tag == 5){
-            put_byte(pb,8); // message type
-            put_be24(pb,0); // include flags
-            put_be24(pb,0); // time stamp
-            put_be32(pb,0); // reserved
-            put_be32(pb,11); // size
+            avio_w8(pb,8); // message type
+            avio_wb24(pb,0); // include flags
+            avio_wb24(pb,0); // time stamp
+            avio_wb32(pb,0); // reserved
+            avio_wb32(pb,11); // size
             flv->reserved=5;
         }
     }
@@ -220,24 +220,24 @@ static int flv_write_header(AVFormatContext *s)
     flv->last_video_ts = -1;
 
     /* write meta_tag */
-    put_byte(pb, 18);         // tag type META
-    metadata_size_pos= url_ftell(pb);
-    put_be24(pb, 0);          // size of data part (sum of all parts below)
-    put_be24(pb, 0);          // time stamp
-    put_be32(pb, 0);          // reserved
+    avio_w8(pb, 18);         // tag type META
+    metadata_size_pos= avio_tell(pb);
+    avio_wb24(pb, 0);          // size of data part (sum of all parts below)
+    avio_wb24(pb, 0);          // time stamp
+    avio_wb32(pb, 0);          // reserved
 
     /* now data of data_size size */
 
     /* first event name as a string */
-    put_byte(pb, AMF_DATA_TYPE_STRING);
+    avio_w8(pb, AMF_DATA_TYPE_STRING);
     put_amf_string(pb, "onMetaData"); // 12 bytes
 
     /* mixed array (hash) with size and string/type/data tuples */
-    put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY);
-    put_be32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
+    avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY);
+    avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
 
     put_amf_string(pb, "duration");
-    flv->duration_offset= url_ftell(pb);
+    flv->duration_offset= avio_tell(pb);
     put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect
 
     if(video_enc){
@@ -276,50 +276,50 @@ static int flv_write_header(AVFormatContext *s)
 
     while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
         put_amf_string(pb, tag->key);
-        put_byte(pb, AMF_DATA_TYPE_STRING);
+        avio_w8(pb, AMF_DATA_TYPE_STRING);
         put_amf_string(pb, tag->value);
     }
 
     put_amf_string(pb, "filesize");
-    flv->filesize_offset= url_ftell(pb);
+    flv->filesize_offset= avio_tell(pb);
     put_amf_double(pb, 0); // delayed write
 
     put_amf_string(pb, "");
-    put_byte(pb, AMF_END_OF_OBJECT);
+    avio_w8(pb, AMF_END_OF_OBJECT);
 
     /* write total size of tag */
-    data_size= url_ftell(pb) - metadata_size_pos - 10;
-    url_fseek(pb, metadata_size_pos, SEEK_SET);
-    put_be24(pb, data_size);
-    url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
-    put_be32(pb, data_size + 11);
+    data_size= avio_tell(pb) - metadata_size_pos - 10;
+    avio_seek(pb, metadata_size_pos, SEEK_SET);
+    avio_wb24(pb, data_size);
+    avio_skip(pb, data_size + 10 - 3);
+    avio_wb32(pb, data_size + 11);
 
     for (i = 0; i < s->nb_streams; i++) {
         AVCodecContext *enc = s->streams[i]->codec;
         if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) {
             int64_t pos;
-            put_byte(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ?
+            avio_w8(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ?
                      FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
-            put_be24(pb, 0); // size patched later
-            put_be24(pb, 0); // ts
-            put_byte(pb, 0); // ts ext
-            put_be24(pb, 0); // streamid
-            pos = url_ftell(pb);
+            avio_wb24(pb, 0); // size patched later
+            avio_wb24(pb, 0); // ts
+            avio_w8(pb, 0); // ts ext
+            avio_wb24(pb, 0); // streamid
+            pos = avio_tell(pb);
             if (enc->codec_id == CODEC_ID_AAC) {
-                put_byte(pb, get_audio_flags(enc));
-                put_byte(pb, 0); // AAC sequence header
-                put_buffer(pb, enc->extradata, enc->extradata_size);
+                avio_w8(pb, get_audio_flags(enc));
+                avio_w8(pb, 0); // AAC sequence header
+                avio_write(pb, enc->extradata, enc->extradata_size);
             } else {
-                put_byte(pb, enc->codec_tag | FLV_FRAME_KEY); // flags
-                put_byte(pb, 0); // AVC sequence header
-                put_be24(pb, 0); // composition time
+                avio_w8(pb, enc->codec_tag | FLV_FRAME_KEY); // flags
+                avio_w8(pb, 0); // AVC sequence header
+                avio_wb24(pb, 0); // composition time
                 ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size);
             }
-            data_size = url_ftell(pb) - pos;
-            url_fseek(pb, -data_size - 10, SEEK_CUR);
-            put_be24(pb, data_size);
-            url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
-            put_be32(pb, data_size + 11); // previous tag size
+            data_size = avio_tell(pb) - pos;
+            avio_seek(pb, -data_size - 10, SEEK_CUR);
+            avio_wb24(pb, data_size);
+            avio_skip(pb, data_size + 10 - 3);
+            avio_wb32(pb, data_size + 11); // previous tag size
         }
     }
 
@@ -330,7 +330,7 @@ static int flv_write_trailer(AVFormatContext *s)
 {
     int64_t file_size;
 
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     FLVContext *flv = s->priv_data;
     int i;
 
@@ -343,21 +343,21 @@ static int flv_write_trailer(AVFormatContext *s)
         }
     }
 
-    file_size = url_ftell(pb);
+    file_size = avio_tell(pb);
 
     /* update informations */
-    url_fseek(pb, flv->duration_offset, SEEK_SET);
+    avio_seek(pb, flv->duration_offset, SEEK_SET);
     put_amf_double(pb, flv->duration / (double)1000);
-    url_fseek(pb, flv->filesize_offset, SEEK_SET);
+    avio_seek(pb, flv->filesize_offset, SEEK_SET);
     put_amf_double(pb, file_size);
 
-    url_fseek(pb, file_size, SEEK_SET);
+    avio_seek(pb, file_size, SEEK_SET);
     return 0;
 }
 
 static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
     FLVContext *flv = s->priv_data;
     unsigned ts;
@@ -376,7 +376,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
         flags_size= 1;
 
     if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-        put_byte(pb, FLV_TAG_TYPE_VIDEO);
+        avio_w8(pb, FLV_TAG_TYPE_VIDEO);
 
         flags = enc->codec_tag;
         if(flags == 0) {
@@ -391,7 +391,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
 
         assert(size);
 
-        put_byte(pb, FLV_TAG_TYPE_AUDIO);
+        avio_w8(pb, FLV_TAG_TYPE_AUDIO);
     }
 
     if (enc->codec_id == CODEC_ID_H264) {
@@ -409,35 +409,35 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
         if (flv->last_video_ts < ts)
             flv->last_video_ts = ts;
     }
-    put_be24(pb,size + flags_size);
-    put_be24(pb,ts);
-    put_byte(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
-    put_be24(pb,flv->reserved);
-    put_byte(pb,flags);
+    avio_wb24(pb,size + flags_size);
+    avio_wb24(pb,ts);
+    avio_w8(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
+    avio_wb24(pb,flv->reserved);
+    avio_w8(pb,flags);
     if (enc->codec_id == CODEC_ID_VP6)
-        put_byte(pb,0);
+        avio_w8(pb,0);
     if (enc->codec_id == CODEC_ID_VP6F)
-        put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
+        avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0);
     else if (enc->codec_id == CODEC_ID_AAC)
-        put_byte(pb,1); // AAC raw
+        avio_w8(pb,1); // AAC raw
     else if (enc->codec_id == CODEC_ID_H264) {
-        put_byte(pb,1); // AVC NALU
-        put_be24(pb,pkt->pts - pkt->dts);
+        avio_w8(pb,1); // AVC NALU
+        avio_wb24(pb,pkt->pts - pkt->dts);
     }
 
-    put_buffer(pb, data ? data : pkt->data, size);
+    avio_write(pb, data ? data : pkt->data, size);
 
-    put_be32(pb,size+flags_size+11); // previous tag size
+    avio_wb32(pb,size+flags_size+11); // previous tag size
     flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     av_free(data);
 
     return 0;
 }
 
-AVOutputFormat flv_muxer = {
+AVOutputFormat ff_flv_muxer = {
     "flv",
     NULL_IF_CONFIG_SMALL("FLV format"),
     "video/x-flv",
diff --git a/ffmpeg-mt/libavformat/framecrcenc.c b/ffmpeg-mt/libavformat/framecrcenc.c
index f59a0c8..2bd3f54 100644
--- a/ffmpeg-mt/libavformat/framecrcenc.c
+++ b/ffmpeg-mt/libavformat/framecrcenc.c
@@ -2,20 +2,20 @@
  * frame CRC encoder (for codec/format testing)
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,12 +28,12 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     char buf[256];
 
     snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
-    put_buffer(s->pb, buf, strlen(buf));
-    put_flush_packet(s->pb);
+    avio_write(s->pb, buf, strlen(buf));
+    avio_flush(s->pb);
     return 0;
 }
 
-AVOutputFormat framecrc_muxer = {
+AVOutputFormat ff_framecrc_muxer = {
     "framecrc",
     NULL_IF_CONFIG_SMALL("framecrc testing format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/gif.c b/ffmpeg-mt/libavformat/gif.c
index 4741915..dfd2ec1 100644
--- a/ffmpeg-mt/libavformat/gif.c
+++ b/ffmpeg-mt/libavformat/gif.c
@@ -2,20 +2,20 @@
  * Animated GIF muxer
  * Copyright (c) 2000 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -107,33 +107,33 @@ static const rgb_triplet gif_clut[216] = {
 };
 
 /* GIF header */
-static int gif_image_write_header(ByteIOContext *pb,
+static int gif_image_write_header(AVIOContext *pb,
                                   int width, int height, int loop_count,
                                   uint32_t *palette)
 {
     int i;
     unsigned int v;
 
-    put_tag(pb, "GIF");
-    put_tag(pb, "89a");
-    put_le16(pb, width);
-    put_le16(pb, height);
+    avio_write(pb, "GIF", 3);
+    avio_write(pb, "89a", 3);
+    avio_wl16(pb, width);
+    avio_wl16(pb, height);
 
-    put_byte(pb, 0xf7); /* flags: global clut, 256 entries */
-    put_byte(pb, 0x1f); /* background color index */
-    put_byte(pb, 0); /* aspect ratio */
+    avio_w8(pb, 0xf7); /* flags: global clut, 256 entries */
+    avio_w8(pb, 0x1f); /* background color index */
+    avio_w8(pb, 0);    /* aspect ratio */
 
     /* the global palette */
     if (!palette) {
-        put_buffer(pb, (const unsigned char *)gif_clut, 216*3);
+        avio_write(pb, (const unsigned char *)gif_clut, 216*3);
         for(i=0;i<((256-216)*3);i++)
-            put_byte(pb, 0);
+            avio_w8(pb, 0);
     } else {
         for(i=0;i<256;i++) {
             v = palette[i];
-            put_byte(pb, (v >> 16) & 0xff);
-            put_byte(pb, (v >> 8) & 0xff);
-            put_byte(pb, (v) & 0xff);
+            avio_w8(pb, (v >> 16) & 0xff);
+            avio_w8(pb, (v >> 8) & 0xff);
+            avio_w8(pb, (v) & 0xff);
         }
     }
 
@@ -159,14 +159,14 @@ static int gif_image_write_header(ByteIOContext *pb,
     /* application extension header */
 #ifdef GIF_ADD_APP_HEADER
     if (loop_count >= 0 && loop_count <= 65535) {
-    put_byte(pb, 0x21);
-    put_byte(pb, 0xff);
-    put_byte(pb, 0x0b);
-        put_tag(pb, "NETSCAPE2.0");  // bytes 4 to 14
-        put_byte(pb, 0x03); // byte 15
-        put_byte(pb, 0x01); // byte 16
-        put_le16(pb, (uint16_t)loop_count);
-        put_byte(pb, 0x00); // byte 19
+    avio_w8(pb, 0x21);
+    avio_w8(pb, 0xff);
+    avio_w8(pb, 0x0b);
+        avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1);  // bytes 4 to 14
+        avio_w8(pb, 0x03); // byte 15
+        avio_w8(pb, 0x01); // byte 16
+        avio_wl16(pb, (uint16_t)loop_count);
+        avio_w8(pb, 0x00); // byte 19
     }
 #endif
     return 0;
@@ -179,7 +179,7 @@ static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b)
 }
 
 
-static int gif_image_write_image(ByteIOContext *pb,
+static int gif_image_write_image(AVIOContext *pb,
                                  int x1, int y1, int width, int height,
                                  const uint8_t *buf, int linesize, int pix_fmt)
 {
@@ -189,15 +189,15 @@ static int gif_image_write_image(ByteIOContext *pb,
     const uint8_t *ptr;
     /* image block */
 
-    put_byte(pb, 0x2c);
-    put_le16(pb, x1);
-    put_le16(pb, y1);
-    put_le16(pb, width);
-    put_le16(pb, height);
-    put_byte(pb, 0x00); /* flags */
+    avio_w8(pb, 0x2c);
+    avio_wl16(pb, x1);
+    avio_wl16(pb, y1);
+    avio_wl16(pb, width);
+    avio_wl16(pb, height);
+    avio_w8(pb, 0x00); /* flags */
     /* no local clut */
 
-    put_byte(pb, 0x08);
+    avio_w8(pb, 0x08);
 
     left= width * height;
 
@@ -233,13 +233,13 @@ static int gif_image_write_image(ByteIOContext *pb,
             flush_put_bits(&p);
         }
         if(put_bits_ptr(&p) - p.buf > 0) {
-            put_byte(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
-            put_buffer(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
+            avio_w8(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
+            avio_write(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
             p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
         }
         left-=GIF_CHUNKS;
     }
-    put_byte(pb, 0x00); /* end of image block */
+    avio_w8(pb, 0x00); /* end of image block */
 
     return 0;
 }
@@ -252,7 +252,7 @@ typedef struct {
 static int gif_write_header(AVFormatContext *s)
 {
     GIFContext *gif = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *enc, *video_enc;
     int i, width, height, loop_count /*, rate*/;
 
@@ -287,23 +287,23 @@ static int gif_write_header(AVFormatContext *s)
 
     gif_image_write_header(pb, width, height, loop_count, NULL);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     return 0;
 }
 
 static int gif_write_video(AVFormatContext *s,
                            AVCodecContext *enc, const uint8_t *buf, int size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     GIFContext *gif = s->priv_data;
     int jiffies;
     int64_t delay;
 
     /* graphic control extension block */
-    put_byte(pb, 0x21);
-    put_byte(pb, 0xf9);
-    put_byte(pb, 0x04); /* block size */
-    put_byte(pb, 0x04); /* flags */
+    avio_w8(pb, 0x21);
+    avio_w8(pb, 0xf9);
+    avio_w8(pb, 0x04); /* block size */
+    avio_w8(pb, 0x04); /* flags */
 
     /* 1 jiffy is 1/70 s */
     /* the delay_time field indicates the number of jiffies - 1 */
@@ -314,15 +314,15 @@ static int gif_write_video(AVFormatContext *s,
     /* XXX: don't even remember if I really use it for now */
     jiffies = (70*enc->time_base.num/enc->time_base.den) - 1;
 
-    put_le16(pb, jiffies);
+    avio_wl16(pb, jiffies);
 
-    put_byte(pb, 0x1f); /* transparent color index */
-    put_byte(pb, 0x00);
+    avio_w8(pb, 0x1f); /* transparent color index */
+    avio_w8(pb, 0x00);
 
     gif_image_write_image(pb, 0, 0, enc->width, enc->height,
                           buf, enc->width * 3, PIX_FMT_RGB24);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -337,14 +337,14 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
 
 static int gif_write_trailer(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
-    put_byte(pb, 0x3b);
-    put_flush_packet(s->pb);
+    avio_w8(pb, 0x3b);
+    avio_flush(s->pb);
     return 0;
 }
 
-AVOutputFormat gif_muxer = {
+AVOutputFormat ff_gif_muxer = {
     "gif",
     NULL_IF_CONFIG_SMALL("GIF Animation"),
     "image/gif",
diff --git a/ffmpeg-mt/libavformat/gopher.c b/ffmpeg-mt/libavformat/gopher.c
index b528f9b..cfc07e7 100644
--- a/ffmpeg-mt/libavformat/gopher.c
+++ b/ffmpeg-mt/libavformat/gopher.c
@@ -5,20 +5,20 @@
  *
  * based on libavformat/http.c, Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,6 +26,7 @@
 #include "avformat.h"
 #include "internal.h"
 #include "network.h"
+#include "url.h"
 
 typedef struct {
     URLContext *hd;
@@ -34,7 +35,7 @@ typedef struct {
 static int gopher_write(URLContext *h, const uint8_t *buf, int size)
 {
     GopherContext *s = h->priv_data;
-    return url_write(s->hd, buf, size);
+    return ffurl_write(s->hd, buf, size);
 }
 
 static int gopher_connect(URLContext *h, const char *path)
@@ -68,7 +69,7 @@ static int gopher_close(URLContext *h)
 {
     GopherContext *s = h->priv_data;
     if (s->hd) {
-        url_close(s->hd);
+        ffurl_close(s->hd);
         s->hd = NULL;
     }
     av_freep(&h->priv_data);
@@ -99,7 +100,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
     ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
 
     s->hd = NULL;
-    err = url_open(&s->hd, buf, URL_RDWR);
+    err = ffurl_open(&s->hd, buf, AVIO_RDWR);
     if (err < 0)
         goto fail;
 
@@ -114,16 +115,15 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
 static int gopher_read(URLContext *h, uint8_t *buf, int size)
 {
     GopherContext *s = h->priv_data;
-    int len = url_read(s->hd, buf, size);
+    int len = ffurl_read(s->hd, buf, size);
     return len;
 }
 
 
-URLProtocol gopher_protocol = {
-    "gopher",
-    gopher_open,
-    gopher_read,
-    gopher_write,
-    NULL, /*seek*/
-    gopher_close,
+URLProtocol ff_gopher_protocol = {
+    .name      = "gopher",
+    .url_open  = gopher_open,
+    .url_read  = gopher_read,
+    .url_write = gopher_write,
+    .url_close = gopher_close,
 };
diff --git a/ffmpeg-mt/libavformat/gxf.c b/ffmpeg-mt/libavformat/gxf.c
index d37a1d8..74d925f 100644
--- a/ffmpeg-mt/libavformat/gxf.c
+++ b/ffmpeg-mt/libavformat/gxf.c
@@ -2,20 +2,20 @@
  * GXF demuxer.
  * Copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,26 +33,26 @@ struct gxf_stream_info {
 
 /**
  * \brief parses a packet header, extracting type and length
- * \param pb ByteIOContext to read header from
+ * \param pb AVIOContext to read header from
  * \param type detected packet type is stored here
  * \param length detected packet length, excluding header is stored here
  * \return 0 if header not found or contains invalid data, 1 otherwise
  */
-static int parse_packet_header(ByteIOContext *pb, GXFPktType *type, int *length) {
-    if (get_be32(pb))
+static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length) {
+    if (avio_rb32(pb))
         return 0;
-    if (get_byte(pb) != 1)
+    if (avio_r8(pb) != 1)
         return 0;
-    *type = get_byte(pb);
-    *length = get_be32(pb);
+    *type = avio_r8(pb);
+    *length = avio_rb32(pb);
     if ((*length >> 24) || *length < 16)
         return 0;
     *length -= 16;
-    if (get_be32(pb))
+    if (avio_rb32(pb))
         return 0;
-    if (get_byte(pb) != 0xe1)
+    if (avio_r8(pb) != 0xe1)
         return 0;
-    if (get_byte(pb) != 0xe2)
+    if (avio_r8(pb) != 0xe2)
         return 0;
     return 1;
 }
@@ -157,24 +157,24 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
  * \param len length of tag section, will be adjusted to contain remaining bytes
  * \param si struct to store collected information into
  */
-static void gxf_material_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) {
+static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) {
     si->first_field = AV_NOPTS_VALUE;
     si->last_field = AV_NOPTS_VALUE;
     while (*len >= 2) {
-        GXFMatTag tag = get_byte(pb);
-        int tlen = get_byte(pb);
+        GXFMatTag tag = avio_r8(pb);
+        int tlen = avio_r8(pb);
         *len -= 2;
         if (tlen > *len)
             return;
         *len -= tlen;
         if (tlen == 4) {
-            uint32_t value = get_be32(pb);
+            uint32_t value = avio_rb32(pb);
             if (tag == MAT_FIRST_FIELD)
                 si->first_field = value;
             else if (tag == MAT_LAST_FIELD)
                 si->last_field = value;
         } else
-            url_fskip(pb, tlen);
+            avio_skip(pb, tlen);
     }
 }
 
@@ -206,24 +206,24 @@ static AVRational fps_umf2avr(uint32_t flags) {
  * \param len length of tag section, will be adjusted to contain remaining bytes
  * \param si struct to store collected information into
  */
-static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) {
+static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) {
     si->frames_per_second = (AVRational){0, 0};
     si->fields_per_frame = 0;
     while (*len >= 2) {
-        GXFTrackTag tag = get_byte(pb);
-        int tlen = get_byte(pb);
+        GXFTrackTag tag = avio_r8(pb);
+        int tlen = avio_r8(pb);
         *len -= 2;
         if (tlen > *len)
             return;
         *len -= tlen;
         if (tlen == 4) {
-            uint32_t value = get_be32(pb);
+            uint32_t value = avio_rb32(pb);
             if (tag == TRACK_FPS)
                 si->frames_per_second = fps_tag2avr(value);
             else if (tag == TRACK_FPF && (value == 1 || value == 2))
                 si->fields_per_frame = value;
         } else
-            url_fskip(pb, tlen);
+            avio_skip(pb, tlen);
     }
 }
 
@@ -231,14 +231,14 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *
  * \brief read index from FLT packet into stream 0 av_index
  */
 static void gxf_read_index(AVFormatContext *s, int pkt_len) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st = s->streams[0];
-    uint32_t fields_per_map = get_le32(pb);
-    uint32_t map_cnt = get_le32(pb);
+    uint32_t fields_per_map = avio_rl32(pb);
+    uint32_t map_cnt = avio_rl32(pb);
     int i;
     pkt_len -= 8;
     if (s->flags & AVFMT_FLAG_IGNIDX) {
-        url_fskip(pb, pkt_len);
+        avio_skip(pb, pkt_len);
         return;
     }
     if (map_cnt > 1000) {
@@ -247,19 +247,19 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
     }
     if (pkt_len < 4 * map_cnt) {
         av_log(s, AV_LOG_ERROR, "invalid index length\n");
-        url_fskip(pb, pkt_len);
+        avio_skip(pb, pkt_len);
         return;
     }
     pkt_len -= 4 * map_cnt;
     av_add_index_entry(st, 0, 0, 0, 0, 0);
     for (i = 0; i < map_cnt; i++)
-        av_add_index_entry(st, (uint64_t)get_le32(pb) * 1024,
+        av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024,
                            i * (uint64_t)fields_per_map + 1, 0, 0, 0);
-    url_fskip(pb, pkt_len);
+    avio_skip(pb, pkt_len);
 }
 
 static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     GXFPktType pkt_type;
     int map_len;
     int len;
@@ -271,21 +271,21 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
         return 0;
     }
     map_len -= 2;
-    if (get_byte(pb) != 0x0e0 || get_byte(pb) != 0xff) {
+    if (avio_r8(pb) != 0x0e0 || avio_r8(pb) != 0xff) {
         av_log(s, AV_LOG_ERROR, "unknown version or invalid map preamble\n");
         return 0;
     }
     map_len -= 2;
-    len = get_be16(pb); // length of material data section
+    len = avio_rb16(pb); // length of material data section
     if (len > map_len) {
         av_log(s, AV_LOG_ERROR, "material data longer than map data\n");
         return 0;
     }
     map_len -= len;
     gxf_material_tags(pb, &len, &si);
-    url_fskip(pb, len);
+    avio_skip(pb, len);
     map_len -= 2;
-    len = get_be16(pb); // length of track description
+    len = avio_rb16(pb); // length of track description
     if (len > map_len) {
         av_log(s, AV_LOG_ERROR, "track description longer than map data\n");
         return 0;
@@ -296,12 +296,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
         AVStream *st;
         int idx;
         len -= 4;
-        track_type = get_byte(pb);
-        track_id = get_byte(pb);
-        track_len = get_be16(pb);
+        track_type = avio_r8(pb);
+        track_id = avio_r8(pb);
+        track_len = avio_rb16(pb);
         len -= track_len;
         gxf_track_tags(pb, &track_len, &si);
-        url_fskip(pb, track_len);
+        avio_skip(pb, track_len);
         if (!(track_type & 0x80)) {
            av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type);
            continue;
@@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
     if (len < 0)
         av_log(s, AV_LOG_ERROR, "invalid track description length specified\n");
     if (map_len)
-        url_fskip(pb, map_len);
+        avio_skip(pb, map_len);
     if (!parse_packet_header(pb, &pkt_type, &len)) {
         av_log(s, AV_LOG_ERROR, "sync lost in header\n");
         return -1;
@@ -342,9 +342,9 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
         if (len >= 0x39) {
             AVRational fps;
             len -= 0x39;
-            url_fskip(pb, 5); // preamble
-            url_fskip(pb, 0x30); // payload description
-            fps = fps_umf2avr(get_le32(pb));
+            avio_skip(pb, 5); // preamble
+            avio_skip(pb, 0x30); // payload description
+            fps = fps_umf2avr(avio_rl32(pb));
             if (!main_timebase.num || !main_timebase.den) {
                 // this may not always be correct, but simply the best we can get
                 main_timebase.num = fps.den;
@@ -354,7 +354,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
             av_log(s, AV_LOG_INFO, "UMF packet too short\n");
     } else
         av_log(s, AV_LOG_INFO, "UMF packet missing\n");
-    url_fskip(pb, len);
+    avio_skip(pb, len);
     // set a fallback value, 60000/1001 is specified for audio-only files
     // so use that regardless of why we do not know the video frame rate.
     if (!main_timebase.num || !main_timebase.den)
@@ -368,9 +368,9 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
 
 #define READ_ONE() \
     { \
-        if (!max_interval-- || url_feof(pb)) \
+        if (!max_interval-- || pb->eof_reached) \
             goto out; \
-        tmp = tmp << 8 | get_byte(pb); \
+        tmp = tmp << 8 | avio_r8(pb); \
     }
 
 /**
@@ -387,48 +387,48 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t
     int cur_track;
     int64_t cur_timestamp = AV_NOPTS_VALUE;
     int len;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     GXFPktType type;
-    tmp = get_be32(pb);
+    tmp = avio_rb32(pb);
 start:
     while (tmp)
         READ_ONE();
     READ_ONE();
     if (tmp != 1)
         goto start;
-    last_pos = url_ftell(pb);
-    if (url_fseek(pb, -5, SEEK_CUR) < 0)
+    last_pos = avio_tell(pb);
+    if (avio_seek(pb, -5, SEEK_CUR) < 0)
         goto out;
     if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) {
-        if (url_fseek(pb, last_pos, SEEK_SET) < 0)
+        if (avio_seek(pb, last_pos, SEEK_SET) < 0)
             goto out;
         goto start;
     }
-    get_byte(pb);
-    cur_track = get_byte(pb);
-    cur_timestamp = get_be32(pb);
-    last_found_pos = url_ftell(pb) - 16 - 6;
+    avio_r8(pb);
+    cur_track = avio_r8(pb);
+    cur_timestamp = avio_rb32(pb);
+    last_found_pos = avio_tell(pb) - 16 - 6;
     if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
-        if (url_fseek(pb, last_pos, SEEK_SET) >= 0)
+        if (avio_seek(pb, last_pos, SEEK_SET) >= 0)
             goto start;
     }
 out:
     if (last_found_pos)
-        url_fseek(pb, last_found_pos, SEEK_SET);
+        avio_seek(pb, last_found_pos, SEEK_SET);
     return cur_timestamp;
 }
 
 static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     GXFPktType pkt_type;
     int pkt_len;
-    while (!url_feof(pb)) {
+    while (!pb->eof_reached) {
         AVStream *st;
         int track_type, track_id, ret;
         int field_nr, field_info, skip = 0;
         int stream_index;
         if (!parse_packet_header(pb, &pkt_type, &pkt_len)) {
-            if (!url_feof(pb))
+            if (!pb->eof_reached)
                 av_log(s, AV_LOG_ERROR, "sync lost\n");
             return -1;
         }
@@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
             continue;
         }
         if (pkt_type != PKT_MEDIA) {
-            url_fskip(pb, pkt_len);
+            avio_skip(pb, pkt_len);
             continue;
         }
         if (pkt_len < 16) {
@@ -445,24 +445,24 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
             continue;
         }
         pkt_len -= 16;
-        track_type = get_byte(pb);
-        track_id = get_byte(pb);
+        track_type = avio_r8(pb);
+        track_id = avio_r8(pb);
         stream_index = get_sindex(s, track_id, track_type);
         if (stream_index < 0)
             return stream_index;
         st = s->streams[stream_index];
-        field_nr = get_be32(pb);
-        field_info = get_be32(pb);
-        get_be32(pb); // "timeline" field number
-        get_byte(pb); // flags
-        get_byte(pb); // reserved
+        field_nr = avio_rb32(pb);
+        field_info = avio_rb32(pb);
+        avio_rb32(pb); // "timeline" field number
+        avio_r8(pb); // flags
+        avio_r8(pb); // reserved
         if (st->codec->codec_id == CODEC_ID_PCM_S24LE ||
             st->codec->codec_id == CODEC_ID_PCM_S16LE) {
             int first = field_info >> 16;
             int last  = field_info & 0xffff; // last is exclusive
             int bps = av_get_bits_per_sample(st->codec->codec_id)>>3;
             if (first <= last && last*bps <= pkt_len) {
-                url_fskip(pb, first*bps);
+                avio_skip(pb, first*bps);
                 skip = pkt_len - last*bps;
                 pkt_len = (last-first)*bps;
             } else
@@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
         }
         ret = av_get_packet(pb, pkt, pkt_len);
         if (skip)
-            url_fskip(pb, skip);
+            avio_skip(pb, skip);
         pkt->stream_index = stream_index;
         pkt->dts = field_nr;
         return ret;
@@ -495,7 +495,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
     if (idx < st->nb_index_entries - 2)
         maxlen = st->index_entries[idx + 2].pos - pos;
     maxlen = FFMAX(maxlen, 200 * 1024);
-    res = url_fseek(s->pb, pos, SEEK_SET);
+    res = avio_seek(s->pb, pos, SEEK_SET);
     if (res < 0)
         return res;
     found = gxf_resync_media(s, maxlen, -1, timestamp);
@@ -506,16 +506,16 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
 
 static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
                                   int64_t *pos, int64_t pos_limit) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t res;
-    if (url_fseek(pb, *pos, SEEK_SET) < 0)
+    if (avio_seek(pb, *pos, SEEK_SET) < 0)
         return AV_NOPTS_VALUE;
     res = gxf_resync_media(s, pos_limit - *pos, -1, -1);
-    *pos = url_ftell(pb);
+    *pos = avio_tell(pb);
     return res;
 }
 
-AVInputFormat gxf_demuxer = {
+AVInputFormat ff_gxf_demuxer = {
     "gxf",
     NULL_IF_CONFIG_SMALL("GXF format"),
     0,
diff --git a/ffmpeg-mt/libavformat/gxf.h b/ffmpeg-mt/libavformat/gxf.h
index dcdcdef..c1ac399 100644
--- a/ffmpeg-mt/libavformat/gxf.h
+++ b/ffmpeg-mt/libavformat/gxf.h
@@ -2,20 +2,20 @@
  * GXF demuxer
  * copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/gxfenc.c b/ffmpeg-mt/libavformat/gxfenc.c
index 565a865..585e0ee 100644
--- a/ffmpeg-mt/libavformat/gxfenc.c
+++ b/ffmpeg-mt/libavformat/gxfenc.c
@@ -2,20 +2,20 @@
  * GXF muxer.
  * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -113,53 +113,53 @@ static int gxf_find_lines_index(AVStream *st)
     return -1;
 }
 
-static void gxf_write_padding(ByteIOContext *pb, int64_t to_pad)
+static void gxf_write_padding(AVIOContext *pb, int64_t to_pad)
 {
     for (; to_pad > 0; to_pad--) {
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
     }
 }
 
-static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos)
+static int64_t updatePacketSize(AVIOContext *pb, int64_t pos)
 {
     int64_t curpos;
     int size;
 
-    size = url_ftell(pb) - pos;
+    size = avio_tell(pb) - pos;
     if (size % 4) {
         gxf_write_padding(pb, 4 - size % 4);
-        size = url_ftell(pb) - pos;
+        size = avio_tell(pb) - pos;
     }
-    curpos = url_ftell(pb);
-    url_fseek(pb, pos + 6, SEEK_SET);
-    put_be32(pb, size);
-    url_fseek(pb, curpos, SEEK_SET);
+    curpos = avio_tell(pb);
+    avio_seek(pb, pos + 6, SEEK_SET);
+    avio_wb32(pb, size);
+    avio_seek(pb, curpos, SEEK_SET);
     return curpos - pos;
 }
 
-static int64_t updateSize(ByteIOContext *pb, int64_t pos)
+static int64_t updateSize(AVIOContext *pb, int64_t pos)
 {
     int64_t curpos;
 
-    curpos = url_ftell(pb);
-    url_fseek(pb, pos, SEEK_SET);
-    put_be16(pb, curpos - pos - 2);
-    url_fseek(pb, curpos, SEEK_SET);
+    curpos = avio_tell(pb);
+    avio_seek(pb, pos, SEEK_SET);
+    avio_wb16(pb, curpos - pos - 2);
+    avio_seek(pb, curpos, SEEK_SET);
     return curpos - pos;
 }
 
-static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type)
+static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type)
 {
-    put_be32(pb, 0); /* packet leader for synchro */
-    put_byte(pb, 1);
-    put_byte(pb, type); /* map packet */
-    put_be32(pb, 0); /* size */
-    put_be32(pb, 0); /* reserved */
-    put_byte(pb, 0xE1); /* trailer 1 */
-    put_byte(pb, 0xE2); /* trailer 2 */
+    avio_wb32(pb, 0);  /* packet leader for synchro */
+    avio_w8(pb, 1);
+    avio_w8(pb, type); /* map packet */
+    avio_wb32(pb, 0);  /* size */
+    avio_wb32(pb, 0);  /* reserved */
+    avio_w8(pb, 0xE1); /* trailer 1 */
+    avio_w8(pb, 0xE2); /* trailer 2 */
 }
 
-static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st)
+static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st)
 {
     GXFStreamContext *sc = st->priv_data;
     char buffer[1024];
@@ -191,75 +191,75 @@ static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st)
                     (float)st->codec->bit_rate, sc->p_per_gop, sc->b_per_i_or_p,
                     st->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, sc->first_gop_closed == 1,
                     starting_line, (st->codec->height + 15) / 16);
-    put_byte(pb, TRACK_MPG_AUX);
-    put_byte(pb, size + 1);
-    put_buffer(pb, (uint8_t *)buffer, size + 1);
+    avio_w8(pb, TRACK_MPG_AUX);
+    avio_w8(pb, size + 1);
+    avio_write(pb, (uint8_t *)buffer, size + 1);
     return size + 3;
 }
 
-static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *sc)
+static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFStreamContext *sc)
 {
-    put_byte(pb, 0); /* fields */
-    put_byte(pb, 0);  /* seconds */
-    put_byte(pb, 0); /* minutes */
-    put_byte(pb, 0); /* flags + hours */
+    avio_w8(pb, 0); /* fields */
+    avio_w8(pb, 0); /* seconds */
+    avio_w8(pb, 0); /* minutes */
+    avio_w8(pb, 0); /* flags + hours */
     /* reserved */
-    put_be32(pb, 0);
+    avio_wb32(pb, 0);
     return 8;
 }
 
 static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos;
     int mpeg = sc->track_type == 4 || sc->track_type == 9;
 
     /* track description section */
-    put_byte(pb, sc->media_type + 0x80);
-    put_byte(pb, index + 0xC0);
+    avio_w8(pb, sc->media_type + 0x80);
+    avio_w8(pb, index + 0xC0);
 
-    pos = url_ftell(pb);
-    put_be16(pb, 0); /* size */
+    pos = avio_tell(pb);
+    avio_wb16(pb, 0); /* size */
 
     /* media file name */
-    put_byte(pb, TRACK_NAME);
-    put_byte(pb, strlen(ES_NAME_PATTERN) + 3);
-    put_tag(pb, ES_NAME_PATTERN);
-    put_be16(pb, sc->media_info);
-    put_byte(pb, 0);
+    avio_w8(pb, TRACK_NAME);
+    avio_w8(pb, strlen(ES_NAME_PATTERN) + 3);
+    avio_write(pb, ES_NAME_PATTERN, sizeof(ES_NAME_PATTERN) - 1);
+    avio_wb16(pb, sc->media_info);
+    avio_w8(pb, 0);
 
     if (!mpeg) {
         /* auxiliary information */
-        put_byte(pb, TRACK_AUX);
-        put_byte(pb, 8);
+        avio_w8(pb, TRACK_AUX);
+        avio_w8(pb, 8);
         if (sc->track_type == 3)
             gxf_write_timecode_auxiliary(pb, sc);
         else
-            put_le64(pb, 0);
+            avio_wl64(pb, 0);
     }
 
     /* file system version */
-    put_byte(pb, TRACK_VER);
-    put_byte(pb, 4);
-    put_be32(pb, 0);
+    avio_w8(pb, TRACK_VER);
+    avio_w8(pb, 4);
+    avio_wb32(pb, 0);
 
     if (mpeg)
         gxf_write_mpeg_auxiliary(pb, s->streams[index]);
 
     /* frame rate */
-    put_byte(pb, TRACK_FPS);
-    put_byte(pb, 4);
-    put_be32(pb, sc->frame_rate_index);
+    avio_w8(pb, TRACK_FPS);
+    avio_w8(pb, 4);
+    avio_wb32(pb, sc->frame_rate_index);
 
     /* lines per frame */
-    put_byte(pb, TRACK_LINES);
-    put_byte(pb, 4);
-    put_be32(pb, sc->lines_index);
+    avio_w8(pb, TRACK_LINES);
+    avio_w8(pb, 4);
+    avio_wb32(pb, sc->lines_index);
 
     /* fields per frame */
-    put_byte(pb, TRACK_FPF);
-    put_byte(pb, 4);
-    put_be32(pb, sc->fields);
+    avio_w8(pb, TRACK_FPF);
+    avio_w8(pb, 4);
+    avio_wb32(pb, sc->fields);
 
     return updateSize(pb, pos);
 }
@@ -267,47 +267,50 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc,
 static int gxf_write_material_data_section(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos;
+    int len;
     const char *filename = strrchr(s->filename, '/');
 
-    pos = url_ftell(pb);
-    put_be16(pb, 0); /* size */
+    pos = avio_tell(pb);
+    avio_wb16(pb, 0); /* size */
 
     /* name */
     if (filename)
         filename++;
     else
         filename = s->filename;
-    put_byte(pb, MAT_NAME);
-    put_byte(pb, strlen(SERVER_PATH) + strlen(filename) + 1);
-    put_tag(pb, SERVER_PATH);
-    put_tag(pb, filename);
-    put_byte(pb, 0);
+    len = strlen(filename);
+
+    avio_w8(pb, MAT_NAME);
+    avio_w8(pb, strlen(SERVER_PATH) + len + 1);
+    avio_write(pb, SERVER_PATH, sizeof(SERVER_PATH) - 1);
+    avio_write(pb, filename, len);
+    avio_w8(pb, 0);
 
     /* first field */
-    put_byte(pb, MAT_FIRST_FIELD);
-    put_byte(pb, 4);
-    put_be32(pb, 0);
+    avio_w8(pb, MAT_FIRST_FIELD);
+    avio_w8(pb, 4);
+    avio_wb32(pb, 0);
 
     /* last field */
-    put_byte(pb, MAT_LAST_FIELD);
-    put_byte(pb, 4);
-    put_be32(pb, gxf->nb_fields);
+    avio_w8(pb, MAT_LAST_FIELD);
+    avio_w8(pb, 4);
+    avio_wb32(pb, gxf->nb_fields);
 
     /* reserved */
-    put_byte(pb, MAT_MARK_IN);
-    put_byte(pb, 4);
-    put_be32(pb, 0);
+    avio_w8(pb, MAT_MARK_IN);
+    avio_w8(pb, 4);
+    avio_wb32(pb, 0);
 
-    put_byte(pb, MAT_MARK_OUT);
-    put_byte(pb, 4);
-    put_be32(pb, gxf->nb_fields);
+    avio_w8(pb, MAT_MARK_OUT);
+    avio_w8(pb, 4);
+    avio_wb32(pb, gxf->nb_fields);
 
     /* estimated size */
-    put_byte(pb, MAT_SIZE);
-    put_byte(pb, 4);
-    put_be32(pb, url_fsize(pb) / 1024);
+    avio_w8(pb, MAT_SIZE);
+    avio_w8(pb, 4);
+    avio_wb32(pb, avio_size(pb) / 1024);
 
     return updateSize(pb, pos);
 }
@@ -315,12 +318,12 @@ static int gxf_write_material_data_section(AVFormatContext *s)
 static int gxf_write_track_description_section(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos;
     int i;
 
-    pos = url_ftell(pb);
-    put_be16(pb, 0); /* size */
+    pos = avio_tell(pb);
+    avio_wb16(pb, 0); /* size */
     for (i = 0; i < s->nb_streams; ++i)
         gxf_write_track_description(s, s->streams[i]->priv_data, i);
 
@@ -332,8 +335,8 @@ static int gxf_write_track_description_section(AVFormatContext *s)
 static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos = url_ftell(pb);
+    AVIOContext *pb = s->pb;
+    int64_t pos = avio_tell(pb);
 
     if (!rewrite) {
         if (!(gxf->map_offsets_nb % 30)) {
@@ -350,8 +353,8 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
     gxf_write_packet_header(pb, PKT_MAP);
 
     /* preamble */
-    put_byte(pb, 0xE0); /* version */
-    put_byte(pb, 0xFF); /* reserved */
+    avio_w8(pb, 0xE0); /* version */
+    avio_w8(pb, 0xFF); /* reserved */
 
     gxf_write_material_data_section(s);
     gxf_write_track_description_section(s);
@@ -362,24 +365,24 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
 static int gxf_write_flt_packet(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos = url_ftell(pb);
+    AVIOContext *pb = s->pb;
+    int64_t pos = avio_tell(pb);
     int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1;
     int flt_entries = gxf->nb_fields / fields_per_flt;
     int i = 0;
 
     gxf_write_packet_header(pb, PKT_FLT);
 
-    put_le32(pb, fields_per_flt); /* number of fields */
-    put_le32(pb, flt_entries); /* number of active flt entries */
+    avio_wl32(pb, fields_per_flt); /* number of fields */
+    avio_wl32(pb, flt_entries); /* number of active flt entries */
 
     if (gxf->flt_entries) {
         for (i = 0; i < flt_entries; i++)
-            put_le32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]);
+            avio_wl32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]);
     }
 
     for (; i < 1000; i++)
-        put_le32(pb, 0);
+        avio_wl32(pb, 0);
 
     return updatePacketSize(pb, pos);
 }
@@ -387,7 +390,7 @@ static int gxf_write_flt_packet(AVFormatContext *s)
 static int gxf_write_umf_material_description(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int timecode_base = gxf->time_base.den == 60000 ? 60 : 50;
 
     // XXX drop frame
@@ -397,128 +400,128 @@ static int gxf_write_umf_material_description(AVFormatContext *s)
         gxf->nb_fields /  timecode_base % 60         <<  8 | // seconds
         gxf->nb_fields %  timecode_base;                     // fields
 
-    put_le32(pb, gxf->flags);
-    put_le32(pb, gxf->nb_fields); /* length of the longest track */
-    put_le32(pb, gxf->nb_fields); /* length of the shortest track */
-    put_le32(pb, 0); /* mark in */
-    put_le32(pb, gxf->nb_fields); /* mark out */
-    put_le32(pb, 0); /* timecode mark in */
-    put_le32(pb, timecode); /* timecode mark out */
-    put_le64(pb, s->timestamp); /* modification time */
-    put_le64(pb, s->timestamp); /* creation time */
-    put_le16(pb, 0); /* reserved */
-    put_le16(pb, 0); /* reserved */
-    put_le16(pb, gxf->audio_tracks);
-    put_le16(pb, 1); /* timecode track count */
-    put_le16(pb, 0); /* reserved */
-    put_le16(pb, gxf->mpeg_tracks);
+    avio_wl32(pb, gxf->flags);
+    avio_wl32(pb, gxf->nb_fields); /* length of the longest track */
+    avio_wl32(pb, gxf->nb_fields); /* length of the shortest track */
+    avio_wl32(pb, 0); /* mark in */
+    avio_wl32(pb, gxf->nb_fields); /* mark out */
+    avio_wl32(pb, 0); /* timecode mark in */
+    avio_wl32(pb, timecode); /* timecode mark out */
+    avio_wl64(pb, s->timestamp); /* modification time */
+    avio_wl64(pb, s->timestamp); /* creation time */
+    avio_wl16(pb, 0); /* reserved */
+    avio_wl16(pb, 0); /* reserved */
+    avio_wl16(pb, gxf->audio_tracks);
+    avio_wl16(pb, 1); /* timecode track count */
+    avio_wl16(pb, 0); /* reserved */
+    avio_wl16(pb, gxf->mpeg_tracks);
     return 48;
 }
 
 static int gxf_write_umf_payload(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    put_le32(pb, gxf->umf_length); /* total length of the umf data */
-    put_le32(pb, 3); /* version */
-    put_le32(pb, s->nb_streams+1);
-    put_le32(pb, gxf->umf_track_offset); /* umf track section offset */
-    put_le32(pb, gxf->umf_track_size);
-    put_le32(pb, s->nb_streams+1);
-    put_le32(pb, gxf->umf_media_offset);
-    put_le32(pb, gxf->umf_media_size);
-    put_le32(pb, gxf->umf_length); /* user data offset */
-    put_le32(pb, 0); /* user data size */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
+    AVIOContext *pb = s->pb;
+
+    avio_wl32(pb, gxf->umf_length); /* total length of the umf data */
+    avio_wl32(pb, 3); /* version */
+    avio_wl32(pb, s->nb_streams+1);
+    avio_wl32(pb, gxf->umf_track_offset); /* umf track section offset */
+    avio_wl32(pb, gxf->umf_track_size);
+    avio_wl32(pb, s->nb_streams+1);
+    avio_wl32(pb, gxf->umf_media_offset);
+    avio_wl32(pb, gxf->umf_media_size);
+    avio_wl32(pb, gxf->umf_length); /* user data offset */
+    avio_wl32(pb, 0); /* user data size */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
     return 48;
 }
 
 static int gxf_write_umf_track_description(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     GXFContext *gxf = s->priv_data;
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     int i;
 
     gxf->umf_track_offset = pos - gxf->umf_start_offset;
     for (i = 0; i < s->nb_streams; ++i) {
         GXFStreamContext *sc = s->streams[i]->priv_data;
-        put_le16(pb, sc->media_info);
-        put_le16(pb, 1);
+        avio_wl16(pb, sc->media_info);
+        avio_wl16(pb, 1);
     }
 
-    put_le16(pb, gxf->timecode_track.media_info);
-    put_le16(pb, 1);
+    avio_wl16(pb, gxf->timecode_track.media_info);
+    avio_wl16(pb, 1);
 
-    return url_ftell(pb) - pos;
+    return avio_tell(pb) - pos;
 }
 
-static int gxf_write_umf_media_mpeg(ByteIOContext *pb, AVStream *st)
+static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
 {
     GXFStreamContext *sc = st->priv_data;
 
     if (st->codec->pix_fmt == PIX_FMT_YUV422P)
-        put_le32(pb, 2);
+        avio_wl32(pb, 2);
     else
-        put_le32(pb, 1); /* default to 420 */
-    put_le32(pb, sc->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */
-    put_le32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */
-    put_le32(pb, 1); /* I picture per GOP */
-    put_le32(pb, sc->p_per_gop);
-    put_le32(pb, sc->b_per_i_or_p);
+        avio_wl32(pb, 1); /* default to 420 */
+    avio_wl32(pb, sc->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */
+    avio_wl32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */
+    avio_wl32(pb, 1); /* I picture per GOP */
+    avio_wl32(pb, sc->p_per_gop);
+    avio_wl32(pb, sc->b_per_i_or_p);
     if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO)
-        put_le32(pb, 2);
+        avio_wl32(pb, 2);
     else if (st->codec->codec_id == CODEC_ID_MPEG1VIDEO)
-        put_le32(pb, 1);
+        avio_wl32(pb, 1);
     else
-        put_le32(pb, 0);
-    put_le32(pb, 0); /* reserved */
+        avio_wl32(pb, 0);
+    avio_wl32(pb, 0); /* reserved */
     return 32;
 }
 
-static int gxf_write_umf_media_timecode(ByteIOContext *pb, GXFStreamContext *sc)
+static int gxf_write_umf_media_timecode(AVIOContext *pb, GXFStreamContext *sc)
 {
-    put_le32(pb, 1); /* non drop frame */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
+    avio_wl32(pb, 1); /* non drop frame */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
     return 32;
 }
 
-static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc)
+static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc)
 {
     int i;
 
     for (i = 0; i < 8; i++) {
-        put_be32(pb, 0);
+        avio_wb32(pb, 0);
     }
     return 32;
 }
 
-static int gxf_write_umf_media_audio(ByteIOContext *pb, GXFStreamContext *sc)
+static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc)
 {
-    put_le64(pb, av_dbl2int(1)); /* sound level to begin to */
-    put_le64(pb, av_dbl2int(1)); /* sound level to begin to */
-    put_le32(pb, 0); /* number of fields over which to ramp up sound level */
-    put_le32(pb, 0); /* number of fields over which to ramp down sound level */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
+    avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */
+    avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */
+    avio_wl32(pb, 0); /* number of fields over which to ramp up sound level */
+    avio_wl32(pb, 0); /* number of fields over which to ramp down sound level */
+    avio_wl32(pb, 0); /* reserved */
+    avio_wl32(pb, 0); /* reserved */
     return 32;
 }
 
 #if 0
-static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc)
+static int gxf_write_umf_media_mjpeg(AVIOContext *pb, GXFStreamContext *sc)
 {
-    put_be64(pb, 0); /* FIXME FLOAT max chroma quant level */
-    put_be64(pb, 0); /* FIXME FLOAT max luma quant level */
-    put_be64(pb, 0); /* FIXME FLOAT min chroma quant level */
-    put_be64(pb, 0); /* FIXME FLOAT min luma quant level */
+    avio_wb64(pb, 0); /* FIXME FLOAT max chroma quant level */
+    avio_wb64(pb, 0); /* FIXME FLOAT max luma quant level */
+    avio_wb64(pb, 0); /* FIXME FLOAT min chroma quant level */
+    avio_wb64(pb, 0); /* FIXME FLOAT min luma quant level */
     return 32;
 }
 #endif
@@ -526,11 +529,11 @@ static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc)
 static int gxf_write_umf_media_description(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos;
     int i, j;
 
-    pos = url_ftell(pb);
+    pos = avio_tell(pb);
     gxf->umf_media_offset = pos - gxf->umf_start_offset;
     for (i = 0; i <= s->nb_streams; ++i) {
         GXFStreamContext *sc;
@@ -541,23 +544,23 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
         else
             sc = s->streams[i]->priv_data;
 
-        startpos = url_ftell(pb);
-        put_le16(pb, 0); /* length */
-        put_le16(pb, sc->media_info);
-        put_le16(pb, 0); /* reserved */
-        put_le16(pb, 0); /* reserved */
-        put_le32(pb, gxf->nb_fields);
-        put_le32(pb, 0); /* attributes rw, ro */
-        put_le32(pb, 0); /* mark in */
-        put_le32(pb, gxf->nb_fields); /* mark out */
-        put_buffer(pb, ES_NAME_PATTERN, strlen(ES_NAME_PATTERN));
-        put_be16(pb, sc->media_info);
+        startpos = avio_tell(pb);
+        avio_wl16(pb, 0); /* length */
+        avio_wl16(pb, sc->media_info);
+        avio_wl16(pb, 0); /* reserved */
+        avio_wl16(pb, 0); /* reserved */
+        avio_wl32(pb, gxf->nb_fields);
+        avio_wl32(pb, 0); /* attributes rw, ro */
+        avio_wl32(pb, 0); /* mark in */
+        avio_wl32(pb, gxf->nb_fields); /* mark out */
+        avio_write(pb, ES_NAME_PATTERN, strlen(ES_NAME_PATTERN));
+        avio_wb16(pb, sc->media_info);
         for (j = strlen(ES_NAME_PATTERN)+2; j < 88; j++)
-            put_byte(pb, 0);
-        put_le32(pb, sc->track_type);
-        put_le32(pb, sc->sample_rate);
-        put_le32(pb, sc->sample_size);
-        put_le32(pb, 0); /* reserved */
+            avio_w8(pb, 0);
+        avio_wl32(pb, sc->track_type);
+        avio_wl32(pb, sc->sample_rate);
+        avio_wl32(pb, sc->sample_size);
+        avio_wl32(pb, 0); /* reserved */
 
         if (sc == &gxf->timecode_track)
             gxf_write_umf_media_timecode(pb, sc); /* 8 0bytes */
@@ -577,32 +580,32 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
             }
         }
 
-        curpos = url_ftell(pb);
-        url_fseek(pb, startpos, SEEK_SET);
-        put_le16(pb, curpos - startpos);
-        url_fseek(pb, curpos, SEEK_SET);
+        curpos = avio_tell(pb);
+        avio_seek(pb, startpos, SEEK_SET);
+        avio_wl16(pb, curpos - startpos);
+        avio_seek(pb, curpos, SEEK_SET);
     }
-    return url_ftell(pb) - pos;
+    return avio_tell(pb) - pos;
 }
 
 static int gxf_write_umf_packet(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos = url_ftell(pb);
+    AVIOContext *pb = s->pb;
+    int64_t pos = avio_tell(pb);
 
     gxf_write_packet_header(pb, PKT_UMF);
 
     /* preamble */
-    put_byte(pb, 3); /* first and last (only) packet */
-    put_be32(pb, gxf->umf_length); /* data length */
+    avio_w8(pb, 3); /* first and last (only) packet */
+    avio_wb32(pb, gxf->umf_length); /* data length */
 
-    gxf->umf_start_offset = url_ftell(pb);
+    gxf->umf_start_offset = avio_tell(pb);
     gxf_write_umf_payload(s);
     gxf_write_umf_material_description(s);
     gxf->umf_track_size = gxf_write_umf_track_description(s);
     gxf->umf_media_size = gxf_write_umf_media_description(s);
-    gxf->umf_length = url_ftell(pb) - gxf->umf_start_offset;
+    gxf->umf_length = avio_tell(pb) - gxf->umf_start_offset;
     return updatePacketSize(pb, pos);
 }
 
@@ -625,13 +628,13 @@ static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc)
 
 static int gxf_write_header(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     GXFContext *gxf = s->priv_data;
     GXFStreamContext *vsc = NULL;
     uint8_t tracks[255] = {0};
     int i, media_info = 0;
 
-    if (url_is_streamed(pb)) {
+    if (!pb->seekable) {
         av_log(s, AV_LOG_ERROR, "gxf muxer does not support streamed output, patch welcome");
         return -1;
     }
@@ -750,13 +753,13 @@ static int gxf_write_header(AVFormatContext *s)
 
     gxf->packet_count = 3;
 
-    put_flush_packet(pb);
+    avio_flush(pb);
     return 0;
 }
 
-static int gxf_write_eos_packet(ByteIOContext *pb)
+static int gxf_write_eos_packet(AVIOContext *pb)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
 
     gxf_write_packet_header(pb, PKT_EOS);
     return updatePacketSize(pb, pos);
@@ -765,28 +768,28 @@ static int gxf_write_eos_packet(ByteIOContext *pb)
 static int gxf_write_trailer(AVFormatContext *s)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t end;
     int i;
 
     ff_audio_interleave_close(s);
 
     gxf_write_eos_packet(pb);
-    end = url_ftell(pb);
-    url_fseek(pb, 0, SEEK_SET);
+    end = avio_tell(pb);
+    avio_seek(pb, 0, SEEK_SET);
     /* overwrite map, flt and umf packets with new values */
     gxf_write_map_packet(s, 1);
     gxf_write_flt_packet(s);
     gxf_write_umf_packet(s);
-    put_flush_packet(pb);
+    avio_flush(pb);
     /* update duration in all map packets */
     for (i = 1; i < gxf->map_offsets_nb; i++) {
-        url_fseek(pb, gxf->map_offsets[i], SEEK_SET);
+        avio_seek(pb, gxf->map_offsets[i], SEEK_SET);
         gxf_write_map_packet(s, 1);
-        put_flush_packet(pb);
+        avio_flush(pb);
     }
 
-    url_fseek(pb, end, SEEK_SET);
+    avio_seek(pb, end, SEEK_SET);
 
     av_freep(&gxf->flt_entries);
     av_freep(&gxf->map_offsets);
@@ -809,7 +812,7 @@ static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int si
 static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st = s->streams[pkt->stream_index];
     GXFStreamContext *sc = st->priv_data;
     unsigned field_nb;
@@ -823,44 +826,44 @@ static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
                                   (int64_t)48000*gxf->time_base.num, AV_ROUND_UP);
     }
 
-    put_byte(pb, sc->media_type);
-    put_byte(pb, st->index);
-    put_be32(pb, field_nb);
+    avio_w8(pb, sc->media_type);
+    avio_w8(pb, st->index);
+    avio_wb32(pb, field_nb);
     if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-        put_be16(pb, 0);
-        put_be16(pb, size / 2);
+        avio_wb16(pb, 0);
+        avio_wb16(pb, size / 2);
     } else if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
         int frame_type = gxf_parse_mpeg_frame(sc, pkt->data, pkt->size);
         if (frame_type == FF_I_TYPE) {
-            put_byte(pb, 0x0d);
+            avio_w8(pb, 0x0d);
             sc->iframes++;
         } else if (frame_type == FF_B_TYPE) {
-            put_byte(pb, 0x0f);
+            avio_w8(pb, 0x0f);
             sc->bframes++;
         } else {
-            put_byte(pb, 0x0e);
+            avio_w8(pb, 0x0e);
             sc->pframes++;
         }
-        put_be24(pb, size);
+        avio_wb24(pb, size);
     } else if (st->codec->codec_id == CODEC_ID_DVVIDEO) {
-        put_byte(pb, size / 4096);
-        put_be24(pb, 0);
+        avio_w8(pb, size / 4096);
+        avio_wb24(pb, 0);
     } else
-        put_be32(pb, size);
-    put_be32(pb, field_nb);
-    put_byte(pb, 1); /* flags */
-    put_byte(pb, 0); /* reserved */
+        avio_wb32(pb, size);
+    avio_wb32(pb, field_nb);
+    avio_w8(pb, 1); /* flags */
+    avio_w8(pb, 0); /* reserved */
     return 16;
 }
 
 static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st = s->streams[pkt->stream_index];
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     int padding = 0;
-    int packet_start_offset = url_ftell(pb) / 1024;
+    int packet_start_offset = avio_tell(pb) / 1024;
 
     gxf_write_packet_header(pb, PKT_MEDIA);
     if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */
@@ -868,7 +871,7 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
     else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
         padding = GXF_AUDIO_PACKET_SIZE - pkt->size;
     gxf_write_media_preamble(s, pkt, pkt->size + padding);
-    put_buffer(pb, pkt->data, pkt->size);
+    avio_write(pb, pkt->data, pkt->size);
     gxf_write_padding(pb, padding);
 
     if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -892,7 +895,7 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
         gxf->packet_count = 0;
     }
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
@@ -927,7 +930,7 @@ static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pk
                                av_interleave_packet_per_dts, gxf_compare_field_nb);
 }
 
-AVOutputFormat gxf_muxer = {
+AVOutputFormat ff_gxf_muxer = {
     "gxf",
     NULL_IF_CONFIG_SMALL("GXF format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/h261dec.c b/ffmpeg-mt/libavformat/h261dec.c
index 13394a1..8d9c5fa 100644
--- a/ffmpeg-mt/libavformat/h261dec.c
+++ b/ffmpeg-mt/libavformat/h261dec.c
@@ -2,20 +2,20 @@
  * RAW H.261 video demuxer
  * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -62,7 +62,7 @@ static int h261_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat h261_demuxer = {
+AVInputFormat ff_h261_demuxer = {
     "h261",
     NULL_IF_CONFIG_SMALL("raw H.261"),
     0,
diff --git a/ffmpeg-mt/libavformat/h263dec.c b/ffmpeg-mt/libavformat/h263dec.c
index e27c395..5eda7af 100644
--- a/ffmpeg-mt/libavformat/h263dec.c
+++ b/ffmpeg-mt/libavformat/h263dec.c
@@ -2,20 +2,20 @@
  * RAW H.263 video demuxer
  * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -64,7 +64,7 @@ static int h263_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat h263_demuxer = {
+AVInputFormat ff_h263_demuxer = {
     "h263",
     NULL_IF_CONFIG_SMALL("raw H.263"),
     0,
diff --git a/ffmpeg-mt/libavformat/h264dec.c b/ffmpeg-mt/libavformat/h264dec.c
index 10c239d..268492c 100644
--- a/ffmpeg-mt/libavformat/h264dec.c
+++ b/ffmpeg-mt/libavformat/h264dec.c
@@ -2,20 +2,20 @@
  * RAW H.264 video demuxer
  * Copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -67,7 +67,7 @@ static int h264_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat h264_demuxer = {
+AVInputFormat ff_h264_demuxer = {
     "h264",
     NULL_IF_CONFIG_SMALL("raw H.264 video format"),
     0,
diff --git a/ffmpeg-mt/libavformat/http.c b/ffmpeg-mt/libavformat/http.c
index e9fab3b..bcfce80 100644
--- a/ffmpeg-mt/libavformat/http.c
+++ b/ffmpeg-mt/libavformat/http.c
@@ -2,20 +2,20 @@
  * HTTP protocol for ffmpeg client
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,6 +28,7 @@
 #include "http.h"
 #include "os_support.h"
 #include "httpauth.h"
+#include "url.h"
 #include "libavutil/opt.h"
 
 /* XXX: POST protocol is not completely implemented because ffmpeg uses
@@ -123,7 +124,7 @@ static int http_open_cnx(URLContext *h)
         port = 80;
 
     ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
-    err = url_open(&hd, buf, URL_RDWR);
+    err = ffurl_open(&hd, buf, AVIO_RDWR);
     if (err < 0)
         goto fail;
 
@@ -133,7 +134,7 @@ static int http_open_cnx(URLContext *h)
         goto fail;
     if (s->http_code == 401) {
         if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) {
-            url_close(hd);
+            ffurl_close(hd);
             goto redo;
         } else
             goto fail;
@@ -141,7 +142,7 @@ static int http_open_cnx(URLContext *h)
     if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307)
         && location_changed == 1) {
         /* url moved, get next */
-        url_close(hd);
+        ffurl_close(hd);
         if (redirects++ >= MAX_REDIRECTS)
             return AVERROR(EIO);
         location_changed = 0;
@@ -150,7 +151,7 @@ static int http_open_cnx(URLContext *h)
     return 0;
  fail:
     if (hd)
-        url_close(hd);
+        ffurl_close(hd);
     s->hd = NULL;
     return AVERROR(EIO);
 }
@@ -170,7 +171,7 @@ static int http_getc(HTTPContext *s)
 {
     int len;
     if (s->buf_ptr >= s->buf_end) {
-        len = url_read(s->hd, s->buffer, BUFFER_SIZE);
+        len = ffurl_read(s->hd, s->buffer, BUFFER_SIZE);
         if (len < 0) {
             return AVERROR(EIO);
         } else if (len == 0) {
@@ -225,7 +226,7 @@ static int process_line(URLContext *h, char *line, int line_count,
             p++;
         s->http_code = strtol(p, &end, 10);
 
-        dprintf(NULL, "http_code=%d\n", s->http_code);
+        av_dlog(NULL, "http_code=%d\n", s->http_code);
 
         /* error codes are 4xx and 5xx, but regard 401 as a success, so we
          * don't abort until all headers have been parsed. */
@@ -246,12 +247,12 @@ static int process_line(URLContext *h, char *line, int line_count,
         p++;
         while (isspace(*p))
             p++;
-        if (!strcmp(tag, "Location")) {
+        if (!strcasecmp(tag, "Location")) {
             strcpy(s->location, p);
             *new_location = 1;
-        } else if (!strcmp (tag, "Content-Length") && s->filesize == -1) {
+        } else if (!strcasecmp (tag, "Content-Length") && s->filesize == -1) {
             s->filesize = atoll(p);
-        } else if (!strcmp (tag, "Content-Range")) {
+        } else if (!strcasecmp (tag, "Content-Range")) {
             /* "bytes $from-$to/$document_size" */
             const char *slash;
             if (!strncmp (p, "bytes ", 6)) {
@@ -261,14 +262,14 @@ static int process_line(URLContext *h, char *line, int line_count,
                     s->filesize = atoll(slash+1);
             }
             h->is_streamed = 0; /* we _can_ in fact seek */
-        } else if (!strcmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
+        } else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
             s->filesize = -1;
             s->chunksize = 0;
-        } else if (!strcmp (tag, "WWW-Authenticate")) {
+        } else if (!strcasecmp (tag, "WWW-Authenticate")) {
             ff_http_auth_handle_header(&s->auth_state, tag, p);
-        } else if (!strcmp (tag, "Authentication-Info")) {
+        } else if (!strcasecmp (tag, "Authentication-Info")) {
             ff_http_auth_handle_header(&s->auth_state, tag, p);
-        } else if (!strcmp (tag, "Connection")) {
+        } else if (!strcasecmp (tag, "Connection")) {
             if (!strcmp(p, "close"))
                 s->willclose = 1;
         }
@@ -295,7 +296,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
 
 
     /* send http header */
-    post = h->flags & URL_WRONLY;
+    post = h->flags & AVIO_WRONLY;
     authstr = ff_http_auth_create_response(&s->auth_state, auth, path,
                                         post ? "POST" : "GET");
 
@@ -332,7 +333,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
              authstr ? authstr : "");
 
     av_freep(&authstr);
-    if (url_write(s->hd, s->buffer, strlen(s->buffer)) < 0)
+    if (ffurl_write(s->hd, s->buffer, strlen(s->buffer)) < 0)
         return AVERROR(EIO);
 
     /* init input buffer */
@@ -356,7 +357,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
         if (http_get_line(s, line, sizeof(line)) < 0)
             return AVERROR(EIO);
 
-        dprintf(NULL, "header='%s'\n", line);
+        av_dlog(NULL, "header='%s'\n", line);
 
         err = process_line(h, line, s->line_count, new_location);
         if (err < 0)
@@ -387,7 +388,7 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
 
                 s->chunksize = strtoll(line, NULL, 16);
 
-                dprintf(NULL, "Chunked encoding data size: %"PRId64"'\n", s->chunksize);
+                av_dlog(NULL, "Chunked encoding data size: %"PRId64"'\n", s->chunksize);
 
                 if (!s->chunksize)
                     return 0;
@@ -406,7 +407,7 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
     } else {
         if (!s->willclose && s->filesize >= 0 && s->off >= s->filesize)
             return AVERROR_EOF;
-        len = url_read(s->hd, buf, size);
+        len = ffurl_read(s->hd, buf, size);
     }
     if (len > 0) {
         s->off += len;
@@ -426,7 +427,7 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
 
     if (s->chunksize == -1) {
         /* non-chunked data is sent without any special encoding */
-        return url_write(s->hd, buf, size);
+        return ffurl_write(s->hd, buf, size);
     }
 
     /* silently ignore zero-size data since chunk encoding that would
@@ -435,9 +436,9 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
         /* upload data using chunked encoding */
         snprintf(temp, sizeof(temp), "%x\r\n", size);
 
-        if ((ret = url_write(s->hd, temp, strlen(temp))) < 0 ||
-            (ret = url_write(s->hd, buf, size)) < 0 ||
-            (ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
+        if ((ret = ffurl_write(s->hd, temp, strlen(temp))) < 0 ||
+            (ret = ffurl_write(s->hd, buf, size)) < 0 ||
+            (ret = ffurl_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
             return ret;
     }
     return size;
@@ -450,13 +451,13 @@ static int http_close(URLContext *h)
     HTTPContext *s = h->priv_data;
 
     /* signal end of chunked encoding if used */
-    if ((h->flags & URL_WRONLY) && s->chunksize != -1) {
-        ret = url_write(s->hd, footer, sizeof(footer) - 1);
+    if ((h->flags & AVIO_WRONLY) && s->chunksize != -1) {
+        ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
         ret = ret > 0 ? 0 : ret;
     }
 
     if (s->hd)
-        url_close(s->hd);
+        ffurl_close(s->hd);
     return ret;
 }
 
@@ -492,7 +493,7 @@ static int64_t http_seek(URLContext *h, int64_t off, int whence)
         s->off = old_off;
         return -1;
     }
-    url_close(old_hd);
+    ffurl_close(old_hd);
     return off;
 }
 
@@ -500,17 +501,17 @@ static int
 http_get_file_handle(URLContext *h)
 {
     HTTPContext *s = h->priv_data;
-    return url_get_file_handle(s->hd);
+    return ffurl_get_file_handle(s->hd);
 }
 
-URLProtocol http_protocol = {
-    "http",
-    http_open,
-    http_read,
-    http_write,
-    http_seek,
-    http_close,
+URLProtocol ff_http_protocol = {
+    .name                = "http",
+    .url_open            = http_open,
+    .url_read            = http_read,
+    .url_write           = http_write,
+    .url_seek            = http_seek,
+    .url_close           = http_close,
     .url_get_file_handle = http_get_file_handle,
-    .priv_data_size = sizeof(HTTPContext),
-    .priv_data_class = &httpcontext_class,
+    .priv_data_size      = sizeof(HTTPContext),
+    .priv_data_class     = &httpcontext_class,
 };
diff --git a/ffmpeg-mt/libavformat/http.h b/ffmpeg-mt/libavformat/http.h
index cd003bb..c5ff5e1 100644
--- a/ffmpeg-mt/libavformat/http.h
+++ b/ffmpeg-mt/libavformat/http.h
@@ -2,27 +2,27 @@
  * HTTP definitions
  * Copyright (c) 2010 Josh Allmann
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef AVFORMAT_HTTP_H
 #define AVFORMAT_HTTP_H
 
-#include "avio.h"
+#include "url.h"
 
 /**
  * Set custom HTTP headers.
diff --git a/ffmpeg-mt/libavformat/httpauth.c b/ffmpeg-mt/libavformat/httpauth.c
index 58e0e82..1dda1ac 100644
--- a/ffmpeg-mt/libavformat/httpauth.c
+++ b/ffmpeg-mt/libavformat/httpauth.c
@@ -2,20 +2,20 @@
  * HTTP authentication
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/httpauth.h b/ffmpeg-mt/libavformat/httpauth.h
index ebab3fc..d2a4a55 100644
--- a/ffmpeg-mt/libavformat/httpauth.h
+++ b/ffmpeg-mt/libavformat/httpauth.h
@@ -2,20 +2,20 @@
  * HTTP authentication
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/id3v1.c b/ffmpeg-mt/libavformat/id3v1.c
index 481db97..d296ebb 100644
--- a/ffmpeg-mt/libavformat/id3v1.c
+++ b/ffmpeg-mt/libavformat/id3v1.c
@@ -2,20 +2,20 @@
  * ID3v1 header parser
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -225,19 +225,20 @@ static int parse_tag(AVFormatContext *s, const uint8_t *buf)
 
 void ff_id3v1_read(AVFormatContext *s)
 {
-    int ret, filesize;
+    int ret;
     uint8_t buf[ID3v1_TAG_SIZE];
+    int64_t filesize, position = avio_tell(s->pb);
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
         /* XXX: change that */
-        filesize = url_fsize(s->pb);
+        filesize = avio_size(s->pb);
         if (filesize > 128) {
-            url_fseek(s->pb, filesize - 128, SEEK_SET);
-            ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
+            avio_seek(s->pb, filesize - 128, SEEK_SET);
+            ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE);
             if (ret == ID3v1_TAG_SIZE) {
                 parse_tag(s, buf);
             }
-            url_fseek(s->pb, 0, SEEK_SET);
+            avio_seek(s->pb, position, SEEK_SET);
         }
     }
 }
diff --git a/ffmpeg-mt/libavformat/id3v1.h b/ffmpeg-mt/libavformat/id3v1.h
index 8eb58be..4842f16 100644
--- a/ffmpeg-mt/libavformat/id3v1.h
+++ b/ffmpeg-mt/libavformat/id3v1.h
@@ -2,20 +2,20 @@
  * ID3v1 header parser
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/id3v2.c b/ffmpeg-mt/libavformat/id3v2.c
index b32ca7d..4fecffe 100644
--- a/ffmpeg-mt/libavformat/id3v2.c
+++ b/ffmpeg-mt/libavformat/id3v2.c
@@ -2,20 +2,20 @@
  * ID3v2 header parser
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,6 +24,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "metadata.h"
+#include "avio_internal.h"
 
 int ff_id3v2_match(const uint8_t *buf, const char * magic)
 {
@@ -50,48 +51,21 @@ int ff_id3v2_tag_len(const uint8_t * buf)
     return len;
 }
 
-void ff_id3v2_read(AVFormatContext *s, const char *magic)
-{
-    int len, ret;
-    uint8_t buf[ID3v2_HEADER_SIZE];
-    int     found_header;
-    int64_t off;
-
-    do {
-        /* save the current offset in case there's nothing to read/skip */
-        off = url_ftell(s->pb);
-        ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
-        if (ret != ID3v2_HEADER_SIZE)
-            return;
-            found_header = ff_id3v2_match(buf, magic);
-            if (found_header) {
-            /* parse ID3v2 header */
-            len = ((buf[6] & 0x7f) << 21) |
-                  ((buf[7] & 0x7f) << 14) |
-                  ((buf[8] & 0x7f) << 7) |
-                   (buf[9] & 0x7f);
-            ff_id3v2_parse(s, len, buf[3], buf[5]);
-        } else {
-            url_fseek(s->pb, off, SEEK_SET);
-        }
-    } while (found_header);
-}
-
-static unsigned int get_size(ByteIOContext *s, int len)
+static unsigned int get_size(AVIOContext *s, int len)
 {
     int v = 0;
     while (len--)
-        v = (v << 7) + (get_byte(s) & 0x7F);
+        v = (v << 7) + (avio_r8(s) & 0x7F);
     return v;
 }
 
-static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const char *key)
+static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const char *key)
 {
     char *q, dst[512];
     const char *val = NULL;
     int len, dstlen = sizeof(dst) - 1;
     unsigned genre;
-    unsigned int (*get)(ByteIOContext*) = get_be16;
+    unsigned int (*get)(AVIOContext*) = avio_rb16;
 
     dst[0] = 0;
     if (taglen < 1)
@@ -99,22 +73,22 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c
 
     taglen--; /* account for encoding type byte */
 
-    switch (get_byte(pb)) { /* encoding type */
+    switch (avio_r8(pb)) { /* encoding type */
 
-    case 0:  /* ISO-8859-1 (0 - 255 maps directly into unicode) */
+    case ID3v2_ENCODING_ISO8859:
         q = dst;
         while (taglen-- && q - dst < dstlen - 7) {
             uint8_t tmp;
-            PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;)
+            PUT_UTF8(avio_r8(pb), tmp, *q++ = tmp;)
         }
         *q = 0;
         break;
 
-    case 1:  /* UTF-16 with BOM */
+    case ID3v2_ENCODING_UTF16BOM:
         taglen -= 2;
-        switch (get_be16(pb)) {
+        switch (avio_rb16(pb)) {
         case 0xfffe:
-            get = get_le16;
+            get = avio_rl16;
         case 0xfeff:
             break;
         default:
@@ -123,7 +97,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c
         }
         // fall-through
 
-    case 2:  /* UTF-16BE without BOM */
+    case ID3v2_ENCODING_UTF16BE:
         q = dst;
         while (taglen > 1 && q - dst < dstlen - 7) {
             uint32_t ch;
@@ -135,13 +109,13 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c
         *q = 0;
         break;
 
-    case 3:  /* UTF-8 */
+    case ID3v2_ENCODING_UTF8:
         len = FFMIN(taglen, dstlen);
-        get_buffer(pb, dst, len);
+        avio_read(pb, dst, len);
         dst[len] = 0;
         break;
     default:
-        av_log(s, AV_LOG_WARNING, "Unknown encoding in tag %s\n.", key);
+        av_log(s, AV_LOG_WARNING, "Unknown encoding in tag %s.\n", key);
     }
 
     if (!(strcmp(key, "TCON") && strcmp(key, "TCO"))
@@ -159,17 +133,63 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c
         val = dst;
 
     if (val)
-        av_metadata_set2(&s->metadata, key, val, 0);
+        av_metadata_set2(&s->metadata, key, val, AV_METADATA_DONT_OVERWRITE);
+}
+
+static int is_number(const char *str)
+{
+    while (*str >= '0' && *str <= '9') str++;
+    return !*str;
+}
+
+static AVMetadataTag* get_date_tag(AVMetadata *m, const char *tag)
+{
+    AVMetadataTag *t;
+    if ((t = av_metadata_get(m, tag, NULL, AV_METADATA_MATCH_CASE)) &&
+        strlen(t->value) == 4 && is_number(t->value))
+        return t;
+    return NULL;
 }
 
-void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
+static void merge_date(AVMetadata **m)
+{
+    AVMetadataTag *t;
+    char date[17] = {0};      // YYYY-MM-DD hh:mm
+
+    if (!(t = get_date_tag(*m, "TYER")) &&
+        !(t = get_date_tag(*m, "TYE")))
+        return;
+    av_strlcpy(date, t->value, 5);
+    av_metadata_set2(m, "TYER", NULL, 0);
+    av_metadata_set2(m, "TYE",  NULL, 0);
+
+    if (!(t = get_date_tag(*m, "TDAT")) &&
+        !(t = get_date_tag(*m, "TDA")))
+        goto finish;
+    snprintf(date + 4, sizeof(date) - 4, "-%.2s-%.2s", t->value + 2, t->value);
+    av_metadata_set2(m, "TDAT", NULL, 0);
+    av_metadata_set2(m, "TDA",  NULL, 0);
+
+    if (!(t = get_date_tag(*m, "TIME")) &&
+        !(t = get_date_tag(*m, "TIM")))
+        goto finish;
+    snprintf(date + 10, sizeof(date) - 10, " %.2s:%.2s", t->value, t->value + 2);
+    av_metadata_set2(m, "TIME", NULL, 0);
+    av_metadata_set2(m, "TIM",  NULL, 0);
+
+finish:
+    if (date[0])
+        av_metadata_set2(m, "date", date, 0);
+}
+
+static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
 {
     int isv34, tlen, unsync;
     char tag[5];
-    int64_t next;
+    int64_t next, end = avio_tell(s->pb) + len;
     int taghdrlen;
-    const char *reason;
-    ByteIOContext pb;
+    const char *reason = NULL;
+    AVIOContext pb;
     unsigned char *buffer = NULL;
     int buffer_size = 0;
 
@@ -197,53 +217,53 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
     unsync = flags & 0x80;
 
     if (isv34 && flags & 0x40) /* Extended header present, just skip over it */
-        url_fskip(s->pb, get_size(s->pb, 4));
+        avio_skip(s->pb, get_size(s->pb, 4));
 
     while (len >= taghdrlen) {
         unsigned int tflags;
         int tunsync = 0;
 
         if (isv34) {
-            get_buffer(s->pb, tag, 4);
+            avio_read(s->pb, tag, 4);
             tag[4] = 0;
             if(version==3){
-                tlen = get_be32(s->pb);
+                tlen = avio_rb32(s->pb);
             }else
                 tlen = get_size(s->pb, 4);
-            tflags = get_be16(s->pb);
+            tflags = avio_rb16(s->pb);
             tunsync = tflags & ID3v2_FLAG_UNSYNCH;
         } else {
-            get_buffer(s->pb, tag, 3);
+            avio_read(s->pb, tag, 3);
             tag[3] = 0;
-            tlen = get_be24(s->pb);
+            tlen = avio_rb24(s->pb);
         }
-        len -= taghdrlen + tlen;
-
-        if (len < 0)
+        if (tlen < 0 || tlen > len - taghdrlen) {
+            av_log(s, AV_LOG_WARNING, "Invalid size in frame %s, skipping the rest of tag.\n", tag);
             break;
-
-        next = url_ftell(s->pb) + tlen;
+        }
+        len -= taghdrlen + tlen;
+        next = avio_tell(s->pb) + tlen;
 
         if (tflags & ID3v2_FLAG_DATALEN) {
-            get_be32(s->pb);
+            avio_rb32(s->pb);
             tlen -= 4;
         }
 
         if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) {
             av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag);
-            url_fskip(s->pb, tlen);
+            avio_skip(s->pb, tlen);
         } else if (tag[0] == 'T') {
             if (unsync || tunsync) {
                 int i, j;
                 av_fast_malloc(&buffer, &buffer_size, tlen);
                 for (i = 0, j = 0; i < tlen; i++, j++) {
-                    buffer[j] = get_byte(s->pb);
+                    buffer[j] = avio_r8(s->pb);
                     if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) {
                         /* Unsynchronised byte, skip it */
                         j--;
                     }
                 }
-                init_put_byte(&pb, buffer, j, 0, NULL, NULL, NULL, NULL);
+                ffio_init_context(&pb, buffer, j, 0, NULL, NULL, NULL, NULL);
                 read_ttag(s, &pb, j, tag);
             } else {
                 read_ttag(s, s->pb, tlen, tag);
@@ -252,67 +272,111 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
         else if (!tag[0]) {
             if (tag[1])
                 av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding");
-            url_fskip(s->pb, tlen);
+            avio_skip(s->pb, tlen);
             break;
         }
         /* Skip to end of tag */
-        url_fseek(s->pb, next, SEEK_SET);
+        avio_seek(s->pb, next, SEEK_SET);
     }
-    ff_metadata_conv(&s->metadata, NULL, ff_id3v2_metadata_conv);
 
-    if (len > 0) {
-        /* Skip padding */
-        url_fskip(s->pb, len);
-    }
     if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
-        url_fskip(s->pb, 10);
+        end += 10;
 
+  error:
+    if (reason)
+        av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
+    avio_seek(s->pb, end, SEEK_SET);
     av_free(buffer);
     return;
+}
 
-  error:
-    av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
-    url_fskip(s->pb, len);
-    av_free(buffer);
+void ff_id3v2_read(AVFormatContext *s, const char *magic)
+{
+    int len, ret;
+    uint8_t buf[ID3v2_HEADER_SIZE];
+    int     found_header;
+    int64_t off;
+
+    do {
+        /* save the current offset in case there's nothing to read/skip */
+        off = avio_tell(s->pb);
+        ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE);
+        if (ret != ID3v2_HEADER_SIZE)
+            break;
+            found_header = ff_id3v2_match(buf, magic);
+            if (found_header) {
+            /* parse ID3v2 header */
+            len = ((buf[6] & 0x7f) << 21) |
+                  ((buf[7] & 0x7f) << 14) |
+                  ((buf[8] & 0x7f) << 7) |
+                   (buf[9] & 0x7f);
+            ff_id3v2_parse(s, len, buf[3], buf[5]);
+        } else {
+            avio_seek(s->pb, off, SEEK_SET);
+        }
+    } while (found_header);
+    ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv);
+    ff_metadata_conv(&s->metadata, NULL, ff_id3v2_2_metadata_conv);
+    ff_metadata_conv(&s->metadata, NULL, ff_id3v2_4_metadata_conv);
+    merge_date(&s->metadata);
 }
 
-const AVMetadataConv ff_id3v2_metadata_conv[] = {
+const AVMetadataConv ff_id3v2_34_metadata_conv[] = {
     { "TALB", "album"},
-    { "TAL",  "album"},
     { "TCOM", "composer"},
     { "TCON", "genre"},
-    { "TCO",  "genre"},
     { "TCOP", "copyright"},
-    { "TDRL", "date"},
-    { "TDRC", "date"},
-    { "TDEN", "creation_time"},
     { "TENC", "encoded_by"},
-    { "TEN",  "encoded_by"},
     { "TIT2", "title"},
-    { "TT2",  "title"},
     { "TLAN", "language"},
     { "TPE1", "artist"},
-    { "TP1",  "artist"},
     { "TPE2", "album_artist"},
-    { "TP2",  "album_artist"},
     { "TPE3", "performer"},
-    { "TP3",  "performer"},
     { "TPOS", "disc"},
     { "TPUB", "publisher"},
     { "TRCK", "track"},
-    { "TRK",  "track"},
+    { "TSSE", "encoder"},
+    { 0 }
+};
+
+const AVMetadataConv ff_id3v2_4_metadata_conv[] = {
+    { "TDRL", "date"},
+    { "TDRC", "date"},
+    { "TDEN", "creation_time"},
     { "TSOA", "album-sort"},
     { "TSOP", "artist-sort"},
     { "TSOT", "title-sort"},
-    { "TSSE", "encoder"},
     { 0 }
 };
 
+const AVMetadataConv ff_id3v2_2_metadata_conv[] = {
+    { "TAL",  "album"},
+    { "TCO",  "genre"},
+    { "TT2",  "title"},
+    { "TEN",  "encoded_by"},
+    { "TP1",  "artist"},
+    { "TP2",  "album_artist"},
+    { "TP3",  "performer"},
+    { "TRK",  "track"},
+    { 0 }
+};
+
+
 const char ff_id3v2_tags[][4] = {
-   "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDEN", "TDLY", "TDOR", "TDRC",
-   "TDRL", "TDTG", "TENC", "TEXT", "TFLT", "TIPL", "TIT1", "TIT2", "TIT3",
-   "TKEY", "TLAN", "TLEN", "TMCL", "TMED", "TMOO", "TOAL", "TOFN", "TOLY",
-   "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPRO", "TPUB",
-   "TRCK", "TRSN", "TRSO", "TSOA", "TSOP", "TSOT", "TSRC", "TSSE", "TSST",
+   "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDLY", "TENC", "TEXT",
+   "TFLT", "TIT1", "TIT2", "TIT3", "TKEY", "TLAN", "TLEN", "TMED",
+   "TOAL", "TOFN", "TOLY", "TOPE", "TOWN", "TPE1", "TPE2", "TPE3",
+   "TPE4", "TPOS", "TPUB", "TRCK", "TRSN", "TRSO", "TSRC", "TSSE",
+   { 0 },
+};
+
+const char ff_id3v2_4_tags[][4] = {
+   "TDEN", "TDOR", "TDRC", "TDRL", "TDTG", "TIPL", "TMCL", "TMOO",
+   "TPRO", "TSOA", "TSOP", "TSOT", "TSST",
+   { 0 },
+};
+
+const char ff_id3v2_3_tags[][4] = {
+   "TDAT", "TIME", "TORY", "TRDA", "TSIZ", "TYER",
    { 0 },
 };
diff --git a/ffmpeg-mt/libavformat/id3v2.h b/ffmpeg-mt/libavformat/id3v2.h
index 4c3041f..3e0e65a 100644
--- a/ffmpeg-mt/libavformat/id3v2.h
+++ b/ffmpeg-mt/libavformat/id3v2.h
@@ -2,20 +2,20 @@
  * ID3v2 header parser
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -38,6 +38,13 @@
 #define ID3v2_FLAG_ENCRYPTION  0x0004
 #define ID3v2_FLAG_COMPRESSION 0x0008
 
+enum ID3v2Encoding {
+    ID3v2_ENCODING_ISO8859  = 0,
+    ID3v2_ENCODING_UTF16BOM = 1,
+    ID3v2_ENCODING_UTF16BE  = 2,
+    ID3v2_ENCODING_UTF8     = 3,
+};
+
 /**
  * Detect ID3v2 Header.
  * @param buf   must be ID3v2_HEADER_SIZE byte long
@@ -54,22 +61,29 @@ int ff_id3v2_match(const uint8_t *buf, const char *magic);
 int ff_id3v2_tag_len(const uint8_t *buf);
 
 /**
- * ID3v2 parser
- * Handles ID3v2.2, 2.3 and 2.4.
- */
-void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags);
-
-/**
  * Read an ID3v2 tag
  */
 void ff_id3v2_read(AVFormatContext *s, const char *magic);
 
-extern const AVMetadataConv ff_id3v2_metadata_conv[];
+extern const AVMetadataConv ff_id3v2_34_metadata_conv[];
+extern const AVMetadataConv ff_id3v2_4_metadata_conv[];
+extern const AVMetadataConv ff_id3v2_2_metadata_conv[];
 
 /**
- * A list of ID3v2.4 text information frames.
+ * A list of text information frames allowed in both ID3 v2.3 and v2.4
  * http://www.id3.org/id3v2.4.0-frames
+ * http://www.id3.org/id3v2.4.0-changes
  */
 extern const char ff_id3v2_tags[][4];
 
+/**
+ * ID3v2.4-only text information frames.
+ */
+extern const char ff_id3v2_4_tags[][4];
+
+/**
+ * ID3v2.3-only text information frames.
+ */
+extern const char ff_id3v2_3_tags[][4];
+
 #endif /* AVFORMAT_ID3V2_H */
diff --git a/ffmpeg-mt/libavformat/idcin.c b/ffmpeg-mt/libavformat/idcin.c
index cd4ebf8..e6883c7 100644
--- a/ffmpeg-mt/libavformat/idcin.c
+++ b/ffmpeg-mt/libavformat/idcin.c
@@ -2,20 +2,20 @@
  * id Quake II CIN File Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -142,18 +142,18 @@ static int idcin_probe(AVProbeData *p)
 static int idcin_read_header(AVFormatContext *s,
                              AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     IdcinDemuxContext *idcin = s->priv_data;
     AVStream *st;
     unsigned int width, height;
     unsigned int sample_rate, bytes_per_sample, channels;
 
     /* get the 5 header parameters */
-    width = get_le32(pb);
-    height = get_le32(pb);
-    sample_rate = get_le32(pb);
-    bytes_per_sample = get_le32(pb);
-    channels = get_le32(pb);
+    width = avio_rl32(pb);
+    height = avio_rl32(pb);
+    sample_rate = avio_rl32(pb);
+    bytes_per_sample = avio_rl32(pb);
+    channels = avio_rl32(pb);
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -169,7 +169,7 @@ static int idcin_read_header(AVFormatContext *s,
     /* load up the Huffman tables into extradata */
     st->codec->extradata_size = HUFFMAN_TABLE_SIZE;
     st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
-    if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
+    if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
         HUFFMAN_TABLE_SIZE)
         return AVERROR(EIO);
     /* save a reference in order to transport the palette */
@@ -221,23 +221,23 @@ static int idcin_read_packet(AVFormatContext *s,
     unsigned int command;
     unsigned int chunk_size;
     IdcinDemuxContext *idcin = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i;
     int palette_scale;
     unsigned char r, g, b;
     unsigned char palette_buffer[768];
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR(EIO);
 
     if (idcin->next_chunk_is_video) {
-        command = get_le32(pb);
+        command = avio_rl32(pb);
         if (command == 2) {
             return AVERROR(EIO);
         } else if (command == 1) {
             /* trigger a palette change */
             idcin->palctrl.palette_changed = 1;
-            if (get_buffer(pb, palette_buffer, 768) != 768)
+            if (avio_read(pb, palette_buffer, 768) != 768)
                 return AVERROR(EIO);
             /* scale the palette as necessary */
             palette_scale = 2;
@@ -255,9 +255,9 @@ static int idcin_read_packet(AVFormatContext *s,
             }
         }
 
-        chunk_size = get_le32(pb);
+        chunk_size = avio_rl32(pb);
         /* skip the number of decoded bytes (always equal to width * height) */
-        url_fseek(pb, 4, SEEK_CUR);
+        avio_skip(pb, 4);
         chunk_size -= 4;
         ret= av_get_packet(pb, pkt, chunk_size);
         if (ret < 0)
@@ -286,7 +286,7 @@ static int idcin_read_packet(AVFormatContext *s,
     return ret;
 }
 
-AVInputFormat idcin_demuxer = {
+AVInputFormat ff_idcin_demuxer = {
     "idcin",
     NULL_IF_CONFIG_SMALL("id Cinematic format"),
     sizeof(IdcinDemuxContext),
diff --git a/ffmpeg-mt/libavformat/idroqdec.c b/ffmpeg-mt/libavformat/idroqdec.c
index 6b036d9..8e991c5 100644
--- a/ffmpeg-mt/libavformat/idroqdec.c
+++ b/ffmpeg-mt/libavformat/idroqdec.c
@@ -2,20 +2,20 @@
  * id RoQ (.roq) File Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -68,13 +68,13 @@ static int roq_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
     RoqDemuxContext *roq = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int framerate;
     AVStream *st;
     unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
 
     /* get the main header */
-    if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+    if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
         RoQ_CHUNK_PREAMBLE_SIZE)
         return AVERROR(EIO);
     framerate = AV_RL16(&preamble[6]);
@@ -100,7 +100,7 @@ static int roq_read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
     RoqDemuxContext *roq = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret = 0;
     unsigned int chunk_size;
     unsigned int chunk_type;
@@ -111,11 +111,11 @@ static int roq_read_packet(AVFormatContext *s,
 
     while (!packet_read) {
 
-        if (url_feof(s->pb))
+        if (s->pb->eof_reached)
             return AVERROR(EIO);
 
         /* get the next chunk preamble */
-        if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
+        if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
             RoQ_CHUNK_PREAMBLE_SIZE)
             return AVERROR(EIO);
 
@@ -129,29 +129,29 @@ static int roq_read_packet(AVFormatContext *s,
         case RoQ_INFO:
             if (!roq->width || !roq->height) {
                 AVStream *st = s->streams[roq->video_stream_index];
-                if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
+                if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
                     return AVERROR(EIO);
                 st->codec->width  = roq->width  = AV_RL16(preamble);
                 st->codec->height = roq->height = AV_RL16(preamble + 2);
                 break;
             }
             /* don't care about this chunk anymore */
-            url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR);
+            avio_skip(pb, RoQ_CHUNK_PREAMBLE_SIZE);
             break;
 
         case RoQ_QUAD_CODEBOOK:
             /* packet needs to contain both this codebook and next VQ chunk */
-            codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
+            codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
             codebook_size = chunk_size;
-            url_fseek(pb, codebook_size, SEEK_CUR);
-            if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+            avio_skip(pb, codebook_size);
+            if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
                 RoQ_CHUNK_PREAMBLE_SIZE)
                 return AVERROR(EIO);
             chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
                 codebook_size;
 
             /* rewind */
-            url_fseek(pb, codebook_offset, SEEK_SET);
+            avio_seek(pb, codebook_offset, SEEK_SET);
 
             /* load up the packet */
             ret= av_get_packet(pb, pkt, chunk_size);
@@ -197,8 +197,8 @@ static int roq_read_packet(AVFormatContext *s,
                 roq->audio_frame_count += (chunk_size / roq->audio_channels);
             }
 
-            pkt->pos= url_ftell(pb);
-            ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
+            pkt->pos= avio_tell(pb);
+            ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
                 chunk_size);
             if (ret != chunk_size)
                 ret = AVERROR(EIO);
@@ -216,7 +216,7 @@ static int roq_read_packet(AVFormatContext *s,
     return ret;
 }
 
-AVInputFormat roq_demuxer = {
+AVInputFormat ff_roq_demuxer = {
     "RoQ",
     NULL_IF_CONFIG_SMALL("id RoQ format"),
     sizeof(RoqDemuxContext),
diff --git a/ffmpeg-mt/libavformat/idroqenc.c b/ffmpeg-mt/libavformat/idroqenc.c
index fda899a..688d58d 100644
--- a/ffmpeg-mt/libavformat/idroqenc.c
+++ b/ffmpeg-mt/libavformat/idroqenc.c
@@ -2,20 +2,20 @@
  * id RoQ (.roq) File muxer
  * Copyright (c) 2007 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,13 +29,13 @@ static int roq_write_header(struct AVFormatContext *s)
         0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
     };
 
-    put_buffer(s->pb, header, 8);
-    put_flush_packet(s->pb);
+    avio_write(s->pb, header, 8);
+    avio_flush(s->pb);
 
     return 0;
 }
 
-AVOutputFormat roq_muxer =
+AVOutputFormat ff_roq_muxer =
 {
     "RoQ",
     NULL_IF_CONFIG_SMALL("raw id RoQ format"),
diff --git a/ffmpeg-mt/libavformat/iff.c b/ffmpeg-mt/libavformat/iff.c
index e1afefb..f9b5a77 100644
--- a/ffmpeg-mt/libavformat/iff.c
+++ b/ffmpeg-mt/libavformat/iff.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2010 Peter Ross <pross at xvid.org>
  * Copyright (c) 2010 Sebastian Vater <cdgs.basty at googlemail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,7 +30,6 @@
  */
 
 #include "libavutil/intreadwrite.h"
-#include "libavcodec/iff.h"
 #include "avformat.h"
 
 #define ID_8SVX       MKTAG('8','S','V','X')
@@ -102,7 +101,7 @@ static int get_metadata(AVFormatContext *s,
     if (!buf)
         return AVERROR(ENOMEM);
 
-    if (get_buffer(s->pb, buf, data_size) < 0) {
+    if (avio_read(s->pb, buf, data_size) < 0) {
         av_free(buf);
         return AVERROR(EIO);
     }
@@ -125,7 +124,7 @@ static int iff_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
     IffDemuxContext *iff = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     uint32_t chunk_id, data_size;
     int compression = -1;
@@ -135,17 +134,17 @@ static int iff_read_header(AVFormatContext *s,
         return AVERROR(ENOMEM);
 
     st->codec->channels = 1;
-    url_fskip(pb, 8);
+    avio_skip(pb, 8);
     // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
-    st->codec->codec_tag = get_le32(pb);
+    st->codec->codec_tag = avio_rl32(pb);
 
-    while(!url_feof(pb)) {
+    while(!pb->eof_reached) {
         uint64_t orig_pos;
         int res;
         const char *metadata_tag = NULL;
-        chunk_id = get_le32(pb);
-        data_size = get_be32(pb);
-        orig_pos = url_ftell(pb);
+        chunk_id = avio_rl32(pb);
+        data_size = avio_rb32(pb);
+        orig_pos = avio_tell(pb);
 
         switch(chunk_id) {
         case ID_VHDR:
@@ -153,23 +152,23 @@ static int iff_read_header(AVFormatContext *s,
 
             if (data_size < 14)
                 return AVERROR_INVALIDDATA;
-            url_fskip(pb, 12);
-            st->codec->sample_rate = get_be16(pb);
+            avio_skip(pb, 12);
+            st->codec->sample_rate = avio_rb16(pb);
             if (data_size >= 16) {
-                url_fskip(pb, 1);
-                compression        = get_byte(pb);
+                avio_skip(pb, 1);
+                compression        = avio_r8(pb);
             }
             break;
 
         case ID_BODY:
-            iff->body_pos = url_ftell(pb);
+            iff->body_pos = avio_tell(pb);
             iff->body_size = data_size;
             break;
 
         case ID_CHAN:
             if (data_size < 4)
                 return AVERROR_INVALIDDATA;
-            st->codec->channels = (get_be32(pb) < 6) ? 1 : 2;
+            st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2;
             break;
 
         case ID_CMAP:
@@ -177,7 +176,7 @@ static int iff_read_header(AVFormatContext *s,
             st->codec->extradata      = av_malloc(data_size);
             if (!st->codec->extradata)
                 return AVERROR(ENOMEM);
-            if (get_buffer(pb, st->codec->extradata, data_size) < 0)
+            if (avio_read(pb, st->codec->extradata, data_size) < 0)
                 return AVERROR(EIO);
             break;
 
@@ -185,18 +184,18 @@ static int iff_read_header(AVFormatContext *s,
             st->codec->codec_type            = AVMEDIA_TYPE_VIDEO;
             if (data_size <= 8)
                 return AVERROR_INVALIDDATA;
-            st->codec->width                 = get_be16(pb);
-            st->codec->height                = get_be16(pb);
-            url_fskip(pb, 4); // x, y offset
-            st->codec->bits_per_coded_sample = get_byte(pb);
+            st->codec->width                 = avio_rb16(pb);
+            st->codec->height                = avio_rb16(pb);
+            avio_skip(pb, 4); // x, y offset
+            st->codec->bits_per_coded_sample = avio_r8(pb);
             if (data_size >= 11) {
-                url_fskip(pb, 1); // masking
-                compression                  = get_byte(pb);
+                avio_skip(pb, 1); // masking
+                compression                  = avio_r8(pb);
             }
             if (data_size >= 16) {
-                url_fskip(pb, 3); // paddding, transparent
-                st->sample_aspect_ratio.num  = get_byte(pb);
-                st->sample_aspect_ratio.den  = get_byte(pb);
+                avio_skip(pb, 3); // paddding, transparent
+                st->sample_aspect_ratio.num  = avio_r8(pb);
+                st->sample_aspect_ratio.den  = avio_r8(pb);
             }
             break;
 
@@ -224,10 +223,10 @@ static int iff_read_header(AVFormatContext *s,
                 return res;
             }
         }
-        url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1));
+        avio_skip(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1));
     }
 
-    url_fseek(pb, iff->body_pos, SEEK_SET);
+    avio_seek(pb, iff->body_pos, SEEK_SET);
 
     switch(st->codec->codec_type) {
     case AVMEDIA_TYPE_AUDIO:
@@ -277,7 +276,7 @@ static int iff_read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
     IffDemuxContext *iff = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st = s->streams[0];
     int ret;
 
@@ -287,7 +286,7 @@ static int iff_read_packet(AVFormatContext *s,
     if(st->codec->channels == 2) {
         uint8_t sample_buffer[PACKET_SIZE];
 
-        ret = get_buffer(pb, sample_buffer, PACKET_SIZE);
+        ret = avio_read(pb, sample_buffer, PACKET_SIZE);
         if(av_new_packet(pkt, PACKET_SIZE) < 0) {
             av_log(s, AV_LOG_ERROR, "cannot allocate packet\n");
             return AVERROR(ENOMEM);
@@ -315,7 +314,7 @@ static int iff_read_packet(AVFormatContext *s,
     return ret;
 }
 
-AVInputFormat iff_demuxer = {
+AVInputFormat ff_iff_demuxer = {
     "IFF",
     NULL_IF_CONFIG_SMALL("IFF format"),
     sizeof(IffDemuxContext),
diff --git a/ffmpeg-mt/libavformat/img2.c b/ffmpeg-mt/libavformat/img2.c
index 71f1dd0..2b5d63b 100644
--- a/ffmpeg-mt/libavformat/img2.c
+++ b/ffmpeg-mt/libavformat/img2.c
@@ -3,26 +3,28 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * Copyright (c) 2004 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avstring.h"
 #include "avformat.h"
+#include "avio_internal.h"
+#include "internal.h"
 #include <strings.h>
 
 typedef struct {
@@ -182,9 +184,16 @@ static int read_probe(AVProbeData *p)
     return 0;
 }
 
+enum CodecID ff_guess_image2_codec(const char *filename)
+{
+    return av_str2id(img_tags, filename);
+}
+
+#if FF_API_GUESS_IMG2_CODEC
 enum CodecID av_guess_image2_codec(const char *filename){
     return av_str2id(img_tags, filename);
 }
+#endif
 
 static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
 {
@@ -255,7 +264,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
     char filename[1024];
     int i;
     int size[3]={0}, ret[3]={0};
-    ByteIOContext *f[3];
+    AVIOContext *f[3];
     AVCodecContext *codec= s1->streams[0]->codec;
 
     if (!s->is_pipe) {
@@ -269,13 +278,13 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
                                   s->path, s->img_number)<0 && s->img_number > 1)
             return AVERROR(EIO);
         for(i=0; i<3; i++){
-            if (url_fopen(&f[i], filename, URL_RDONLY) < 0) {
+            if (avio_open(&f[i], filename, AVIO_RDONLY) < 0) {
                 if(i==1)
                     break;
                 av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
                 return AVERROR(EIO);
             }
-            size[i]= url_fsize(f[i]);
+            size[i]= avio_size(f[i]);
 
             if(codec->codec_id != CODEC_ID_RAWVIDEO)
                 break;
@@ -286,7 +295,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
             infer_size(&codec->width, &codec->height, size[0]);
     } else {
         f[0] = s1->pb;
-        if (url_feof(f[0]))
+        if (f[0]->eof_reached)
             return AVERROR(EIO);
         size[0]= 4096;
     }
@@ -298,9 +307,9 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
     pkt->size= 0;
     for(i=0; i<3; i++){
         if(size[i]){
-            ret[i]= get_buffer(f[i], pkt->data + pkt->size, size[i]);
+            ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]);
             if (!s->is_pipe)
-                url_fclose(f[i]);
+                avio_close(f[i]);
             if(ret[i]>0)
                 pkt->size += ret[i];
         }
@@ -339,7 +348,7 @@ static int write_header(AVFormatContext *s)
 static int write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     VideoData *img = s->priv_data;
-    ByteIOContext *pb[3];
+    AVIOContext *pb[3];
     char filename[1024];
     AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec;
     int i;
@@ -347,11 +356,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
     if (!img->is_pipe) {
         if (av_get_frame_filename(filename, sizeof(filename),
                                   img->path, img->img_number) < 0 && img->img_number>1) {
-            av_log(s, AV_LOG_ERROR, "Could not get frame filename from pattern\n");
+            av_log(s, AV_LOG_ERROR,
+                   "Could not get frame filename number %d from pattern '%s'\n",
+                   img->img_number, img->path);
             return AVERROR(EIO);
         }
         for(i=0; i<3; i++){
-            if (url_fopen(&pb[i], filename, URL_WRONLY) < 0) {
+            if (avio_open(&pb[i], filename, AVIO_WRONLY) < 0) {
                 av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
                 return AVERROR(EIO);
             }
@@ -366,13 +377,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 
     if(codec->codec_id == CODEC_ID_RAWVIDEO){
         int ysize = codec->width * codec->height;
-        put_buffer(pb[0], pkt->data        , ysize);
-        put_buffer(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
-        put_buffer(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
-        put_flush_packet(pb[1]);
-        put_flush_packet(pb[2]);
-        url_fclose(pb[1]);
-        url_fclose(pb[2]);
+        avio_write(pb[0], pkt->data        , ysize);
+        avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
+        avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
+        avio_flush(pb[1]);
+        avio_flush(pb[2]);
+        avio_close(pb[1]);
+        avio_close(pb[2]);
     }else{
         if(av_str2id(img_tags, s->filename) == CODEC_ID_JPEG2000){
             AVStream *st = s->streams[0];
@@ -380,15 +391,15 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
                AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){
                 if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c'))
                     goto error;
-                put_be32(pb[0], 12);
-                put_tag (pb[0], "jP  ");
-                put_be32(pb[0], 0x0D0A870A); // signature
-                put_be32(pb[0], 20);
-                put_tag (pb[0], "ftyp");
-                put_tag (pb[0], "jp2 ");
-                put_be32(pb[0], 0);
-                put_tag (pb[0], "jp2 ");
-                put_buffer(pb[0], st->codec->extradata, st->codec->extradata_size);
+                avio_wb32(pb[0], 12);
+                ffio_wfourcc(pb[0], "jP  ");
+                avio_wb32(pb[0], 0x0D0A870A); // signature
+                avio_wb32(pb[0], 20);
+                ffio_wfourcc(pb[0], "ftyp");
+                ffio_wfourcc(pb[0], "jp2 ");
+                avio_wb32(pb[0], 0);
+                ffio_wfourcc(pb[0], "jp2 ");
+                avio_write(pb[0], st->codec->extradata, st->codec->extradata_size);
             }else if(pkt->size < 8 ||
                      (!st->codec->extradata_size &&
                       AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature
@@ -397,11 +408,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
                 return -1;
             }
         }
-        put_buffer(pb[0], pkt->data, pkt->size);
+        avio_write(pb[0], pkt->data, pkt->size);
     }
-    put_flush_packet(pb[0]);
+    avio_flush(pb[0]);
     if (!img->is_pipe) {
-        url_fclose(pb[0]);
+        avio_close(pb[0]);
     }
 
     img->img_number++;
@@ -412,7 +423,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 
 /* input */
 #if CONFIG_IMAGE2_DEMUXER
-AVInputFormat image2_demuxer = {
+AVInputFormat ff_image2_demuxer = {
     .name           = "image2",
     .long_name      = NULL_IF_CONFIG_SMALL("image2 sequence"),
     .priv_data_size = sizeof(VideoData),
@@ -423,7 +434,7 @@ AVInputFormat image2_demuxer = {
 };
 #endif
 #if CONFIG_IMAGE2PIPE_DEMUXER
-AVInputFormat image2pipe_demuxer = {
+AVInputFormat ff_image2pipe_demuxer = {
     .name           = "image2pipe",
     .long_name      = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
     .priv_data_size = sizeof(VideoData),
@@ -434,7 +445,7 @@ AVInputFormat image2pipe_demuxer = {
 
 /* output */
 #if CONFIG_IMAGE2_MUXER
-AVOutputFormat image2_muxer = {
+AVOutputFormat ff_image2_muxer = {
     .name           = "image2",
     .long_name      = NULL_IF_CONFIG_SMALL("image2 sequence"),
     .extensions     = "bmp,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,"
@@ -447,7 +458,7 @@ AVOutputFormat image2_muxer = {
 };
 #endif
 #if CONFIG_IMAGE2PIPE_MUXER
-AVOutputFormat image2pipe_muxer = {
+AVOutputFormat ff_image2pipe_muxer = {
     .name           = "image2pipe",
     .long_name      = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
     .priv_data_size = sizeof(VideoData),
diff --git a/ffmpeg-mt/libavformat/ingenientdec.c b/ffmpeg-mt/libavformat/ingenientdec.c
index 61d39e1..7407a04 100644
--- a/ffmpeg-mt/libavformat/ingenientdec.c
+++ b/ffmpeg-mt/libavformat/ingenientdec.c
@@ -2,20 +2,20 @@
  * RAW Ingenient MJPEG demuxer
  * Copyright (c) 2005 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,19 +27,19 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret, size, w, h, unk1, unk2;
 
-    if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
+    if (avio_rl32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
         return AVERROR(EIO); // FIXME
 
-    size = get_le32(s->pb);
+    size = avio_rl32(s->pb);
 
-    w = get_le16(s->pb);
-    h = get_le16(s->pb);
+    w = avio_rl16(s->pb);
+    h = avio_rl16(s->pb);
 
-    url_fskip(s->pb, 8); // zero + size (padded?)
-    url_fskip(s->pb, 2);
-    unk1 = get_le16(s->pb);
-    unk2 = get_le16(s->pb);
-    url_fskip(s->pb, 22); // ASCII timestamp
+    avio_skip(s->pb, 8); // zero + size (padded?)
+    avio_skip(s->pb, 2);
+    unk1 = avio_rl16(s->pb);
+    unk2 = avio_rl16(s->pb);
+    avio_skip(s->pb, 22); // ASCII timestamp
 
     av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
         size, w, h, unk1, unk2);
@@ -47,9 +47,9 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
     if (av_new_packet(pkt, size) < 0)
         return AVERROR(ENOMEM);
 
-    pkt->pos = url_ftell(s->pb);
+    pkt->pos = avio_tell(s->pb);
     pkt->stream_index = 0;
-    ret = get_buffer(s->pb, pkt->data, size);
+    ret = avio_read(s->pb, pkt->data, size);
     if (ret < 0) {
         av_free_packet(pkt);
         return ret;
@@ -58,7 +58,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat ingenient_demuxer = {
+AVInputFormat ff_ingenient_demuxer = {
     "ingenient",
     NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"),
     0,
diff --git a/ffmpeg-mt/libavformat/internal.h b/ffmpeg-mt/libavformat/internal.h
index b401d35..9bc2340 100644
--- a/ffmpeg-mt/libavformat/internal.h
+++ b/ffmpeg-mt/libavformat/internal.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -48,10 +48,7 @@ do {\
 } while(0)
 #endif
 
-time_t mktimegm(struct tm *tm);
 struct tm *brktimegm(time_t secs, struct tm *tm);
-const char *small_strptime(const char *p, const char *fmt,
-                           struct tm *dt);
 
 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
 
@@ -82,25 +79,6 @@ void ff_read_frame_flush(AVFormatContext *s);
 /** Get the current time since NTP epoch in microseconds. */
 uint64_t ff_ntp_time(void);
 
-/**
- * Probe a bytestream to determine the input format. Each time a probe returns
- * with a score that is too low, the probe buffer size is increased and another
- * attempt is made. When the maximum probe size is reached, the input format
- * with the highest score is returned.
- *
- * @param pb the bytestream to probe, it may be closed and opened again
- * @param fmt the input format is put here
- * @param filename the filename of the stream
- * @param logctx the log context
- * @param offset the offset within the bytestream to probe from
- * @param max_probe_size the maximum probe buffer size (zero for default)
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code otherwise
- */
-int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
-                          const char *filename, void *logctx,
-                          unsigned int offset, unsigned int max_probe_size);
-
 #if FF_API_URL_SPLIT
 /**
  * @deprecated use av_url_split() instead
@@ -179,20 +157,20 @@ int ff_get_v_length(uint64_t val);
 /**
  * Put val using a variable number of bytes.
  */
-void ff_put_v(ByteIOContext *bc, uint64_t val);
+void ff_put_v(AVIOContext *bc, uint64_t val);
 
 /**
- * Read a whole line of text from ByteIOContext. Stop reading after reaching
+ * Read a whole line of text from AVIOContext. Stop reading after reaching
  * either a \n, a \0 or EOF. The returned string is always \0 terminated,
  * and may be truncated if the buffer is too small.
  *
- * @param s the read-only ByteIOContext
+ * @param s the read-only AVIOContext
  * @param buf buffer to store the read line
  * @param maxlen size of the buffer
  * @return the length of the string written in the buffer, not including the
  *         final \0
  */
-int ff_get_line(ByteIOContext *s, char *buf, int maxlen);
+int ff_get_line(AVIOContext *s, char *buf, int maxlen);
 
 #define SPACE_CHARS " \t\r\n"
 
@@ -226,4 +204,52 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
  */
 int ff_find_stream_index(AVFormatContext *s, int id);
 
+/**
+ * Internal version of av_index_search_timestamp
+ */
+int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries,
+                              int64_t wanted_timestamp, int flags);
+
+/**
+ * Internal version of av_add_index_entry
+ */
+int ff_add_index_entry(AVIndexEntry **index_entries,
+                       int *nb_index_entries,
+                       unsigned int *index_entries_allocated_size,
+                       int64_t pos, int64_t timestamp, int size, int distance, int flags);
+
+/**
+ * Add a new chapter.
+ *
+ * @param s media file handle
+ * @param id unique ID for this chapter
+ * @param start chapter start time in time_base units
+ * @param end chapter end time in time_base units
+ * @param title chapter title
+ *
+ * @return AVChapter or NULL on error
+ */
+AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
+                          int64_t start, int64_t end, const char *title);
+
+/**
+ * Ensure the index uses less memory than the maximum specified in
+ * AVFormatContext.max_index_size by discarding entries if it grows
+ * too large.
+ */
+void ff_reduce_index(AVFormatContext *s, int stream_index);
+
+/*
+ * Convert a relative url into an absolute url, given a base url.
+ *
+ * @param buf the buffer where output absolute url is written
+ * @param size the size of buf
+ * @param base the base url, may be equal to buf.
+ * @param rel the new url, which is interpreted relative to base
+ */
+void ff_make_absolute_url(char *buf, int size, const char *base,
+                          const char *rel);
+
+enum CodecID ff_guess_image2_codec(const char *filename);
+
 #endif /* AVFORMAT_INTERNAL_H */
diff --git a/ffmpeg-mt/libavformat/ipmovie.c b/ffmpeg-mt/libavformat/ipmovie.c
index 18077b5..e1d08df 100644
--- a/ffmpeg-mt/libavformat/ipmovie.c
+++ b/ffmpeg-mt/libavformat/ipmovie.c
@@ -2,20 +2,20 @@
  * Interplay MVE File Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -120,7 +120,7 @@ typedef struct IPMVEContext {
 
 } IPMVEContext;
 
-static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
+static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
     AVPacket *pkt) {
 
     int chunk_type;
@@ -133,7 +133,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
             s->audio_chunk_size -= 6;
         }
 
-        url_fseek(pb, s->audio_chunk_offset, SEEK_SET);
+        avio_seek(pb, s->audio_chunk_offset, SEEK_SET);
         s->audio_chunk_offset = 0;
 
         if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size))
@@ -163,19 +163,19 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
             return CHUNK_NOMEM;
 
         pkt->pos= s->decode_map_chunk_offset;
-        url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET);
+        avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET);
         s->decode_map_chunk_offset = 0;
 
-        if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) !=
+        if (avio_read(pb, pkt->data, s->decode_map_chunk_size) !=
             s->decode_map_chunk_size) {
             av_free_packet(pkt);
             return CHUNK_EOF;
         }
 
-        url_fseek(pb, s->video_chunk_offset, SEEK_SET);
+        avio_seek(pb, s->video_chunk_offset, SEEK_SET);
         s->video_chunk_offset = 0;
 
-        if (get_buffer(pb, pkt->data + s->decode_map_chunk_size,
+        if (avio_read(pb, pkt->data + s->decode_map_chunk_size,
             s->video_chunk_size) != s->video_chunk_size) {
             av_free_packet(pkt);
             return CHUNK_EOF;
@@ -193,7 +193,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
 
     } else {
 
-        url_fseek(pb, s->next_chunk_offset, SEEK_SET);
+        avio_seek(pb, s->next_chunk_offset, SEEK_SET);
         chunk_type = CHUNK_DONE;
 
     }
@@ -203,7 +203,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
 
 /* This function loads and processes a single chunk in an IP movie file.
  * It returns the type of chunk that was processed. */
-static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
+static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
     AVPacket *pkt)
 {
     unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
@@ -225,9 +225,9 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
         return chunk_type;
 
     /* read the next chunk, wherever the file happens to be pointing */
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return CHUNK_EOF;
-    if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
+    if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
         CHUNK_PREAMBLE_SIZE)
         return CHUNK_BAD;
     chunk_size = AV_RL16(&chunk_preamble[0]);
@@ -271,11 +271,11 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
     while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) {
 
         /* read the next chunk, wherever the file happens to be pointing */
-        if (url_feof(pb)) {
+        if (pb->eof_reached) {
             chunk_type = CHUNK_EOF;
             break;
         }
-        if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
+        if (avio_read(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
             CHUNK_PREAMBLE_SIZE) {
             chunk_type = CHUNK_BAD;
             break;
@@ -299,12 +299,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
 
         case OPCODE_END_OF_STREAM:
             debug_ipmovie("end of stream\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_END_OF_CHUNK:
             debug_ipmovie("end of chunk\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_CREATE_TIMER:
@@ -314,7 +314,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
                 chunk_type = CHUNK_BAD;
                 break;
             }
-            if (get_buffer(pb, scratch, opcode_size) !=
+            if (avio_read(pb, scratch, opcode_size) !=
                 opcode_size) {
                 chunk_type = CHUNK_BAD;
                 break;
@@ -331,7 +331,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
                 chunk_type = CHUNK_BAD;
                 break;
             }
-            if (get_buffer(pb, scratch, opcode_size) !=
+            if (avio_read(pb, scratch, opcode_size) !=
                 opcode_size) {
                 chunk_type = CHUNK_BAD;
                 break;
@@ -359,7 +359,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
 
         case OPCODE_START_STOP_AUDIO:
             debug_ipmovie("start/stop audio\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_INIT_VIDEO_BUFFERS:
@@ -369,7 +369,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
                 chunk_type = CHUNK_BAD;
                 break;
             }
-            if (get_buffer(pb, scratch, opcode_size) !=
+            if (avio_read(pb, scratch, opcode_size) !=
                 opcode_size) {
                 chunk_type = CHUNK_BAD;
                 break;
@@ -393,36 +393,36 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
         case OPCODE_UNKNOWN_14:
         case OPCODE_UNKNOWN_15:
             debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type);
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_SEND_BUFFER:
             debug_ipmovie("send buffer\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_AUDIO_FRAME:
             debug_ipmovie("audio frame\n");
 
             /* log position and move on for now */
-            s->audio_chunk_offset = url_ftell(pb);
+            s->audio_chunk_offset = avio_tell(pb);
             s->audio_chunk_size = opcode_size;
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_SILENCE_FRAME:
             debug_ipmovie("silence frame\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_INIT_VIDEO_MODE:
             debug_ipmovie("initialize video mode\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_CREATE_GRADIENT:
             debug_ipmovie("create gradient\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_SET_PALETTE:
@@ -434,7 +434,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
                 chunk_type = CHUNK_BAD;
                 break;
             }
-            if (get_buffer(pb, scratch, opcode_size) != opcode_size) {
+            if (avio_read(pb, scratch, opcode_size) != opcode_size) {
                 chunk_type = CHUNK_BAD;
                 break;
             }
@@ -464,25 +464,25 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
 
         case OPCODE_SET_PALETTE_COMPRESSED:
             debug_ipmovie("set palette compressed\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_SET_DECODING_MAP:
             debug_ipmovie("set decoding map\n");
 
             /* log position and move on for now */
-            s->decode_map_chunk_offset = url_ftell(pb);
+            s->decode_map_chunk_offset = avio_tell(pb);
             s->decode_map_chunk_size = opcode_size;
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         case OPCODE_VIDEO_DATA:
             debug_ipmovie("set video data\n");
 
             /* log position and move on for now */
-            s->video_chunk_offset = url_ftell(pb);
+            s->video_chunk_offset = avio_tell(pb);
             s->video_chunk_size = opcode_size;
-            url_fseek(pb, opcode_size, SEEK_CUR);
+            avio_skip(pb, opcode_size);
             break;
 
         default:
@@ -494,7 +494,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
     }
 
     /* make a note of where the stream is sitting */
-    s->next_chunk_offset = url_ftell(pb);
+    s->next_chunk_offset = avio_tell(pb);
 
     /* dispatch the first of any pending packets */
     if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY))
@@ -521,18 +521,18 @@ static int ipmovie_read_header(AVFormatContext *s,
                                AVFormatParameters *ap)
 {
     IPMVEContext *ipmovie = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVPacket pkt;
     AVStream *st;
     unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
     int chunk_type;
     uint8_t signature_buffer[sizeof(signature)];
 
-    get_buffer(pb, signature_buffer, sizeof(signature_buffer));
+    avio_read(pb, signature_buffer, sizeof(signature_buffer));
     while (memcmp(signature_buffer, signature, sizeof(signature))) {
         memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
-        signature_buffer[sizeof(signature_buffer) - 1] = get_byte(pb);
-        if (url_feof(pb))
+        signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb);
+        if (pb->eof_reached)
             return AVERROR_EOF;
     }
     /* initialize private context members */
@@ -541,7 +541,7 @@ static int ipmovie_read_header(AVFormatContext *s,
     ipmovie->decode_map_chunk_offset = 0;
 
     /* on the first read, this will position the stream at the first chunk */
-    ipmovie->next_chunk_offset = url_ftell(pb) + 4;
+    ipmovie->next_chunk_offset = avio_tell(pb) + 4;
 
     /* process the first chunk which should be CHUNK_INIT_VIDEO */
     if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO)
@@ -549,11 +549,11 @@ static int ipmovie_read_header(AVFormatContext *s,
 
     /* peek ahead to the next chunk-- if it is an init audio chunk, process
      * it; if it is the first video chunk, this is a silent file */
-    if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
+    if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
         CHUNK_PREAMBLE_SIZE)
         return AVERROR(EIO);
     chunk_type = AV_RL16(&chunk_preamble[2]);
-    url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
+    avio_seek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
 
     if (chunk_type == CHUNK_VIDEO)
         ipmovie->audio_type = CODEC_ID_NONE;  /* no audio */
@@ -602,7 +602,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
                                AVPacket *pkt)
 {
     IPMVEContext *ipmovie = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret;
 
     ret = process_ipmovie_chunk(ipmovie, pb, pkt);
@@ -620,7 +620,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
     return ret;
 }
 
-AVInputFormat ipmovie_demuxer = {
+AVInputFormat ff_ipmovie_demuxer = {
     "ipmovie",
     NULL_IF_CONFIG_SMALL("Interplay MVE format"),
     sizeof(IPMVEContext),
diff --git a/ffmpeg-mt/libavformat/isom.c b/ffmpeg-mt/libavformat/isom.c
index bf01401..c65f931 100644
--- a/ffmpeg-mt/libavformat/isom.c
+++ b/ffmpeg-mt/libavformat/isom.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2002 Francois Revol <revol at free.fr>
  * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at free.fr>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -134,6 +134,11 @@ const AVCodecTag codec_movvideo_tags[] = {
     { CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') },
 
     { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
+    { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* AVC Intra  50 / 1080 interlace */
+    { CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC Intra  50 /  720 */
+    { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC Intra 100 / 1080 interlace */
+    { CODEC_ID_H264, MKTAG('a', 'i', '1', 'q') }, /* AVC Intra 100 /  720 */
+    { CODEC_ID_H264, MKTAG('a', 'i', '1', '2') }, /* AVC Intra 100 / 1080 */
 
     { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */
     { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
@@ -152,6 +157,7 @@ const AVCodecTag codec_movvideo_tags[] = {
     { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'n') }, /* MPEG2 IMX NTSC 525/60 30mb/s produced by FCP */
     { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'p') }, /* MPEG2 IMX PAL 625/50 30mb/s produced by FCP */
     { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '4') }, /* XDCAM HD422 720p24 CBR */
+    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '5') }, /* XDCAM HD422 720p25 CBR */
     { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '9') }, /* XDCAM HD422 720p60 CBR */
     { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'a') }, /* XDCAM HD422 720p50 CBR */
     { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'b') }, /* XDCAM HD422 1080i60 CBR */
@@ -193,6 +199,12 @@ const AVCodecTag codec_movvideo_tags[] = {
     { CODEC_ID_SGI,   MKTAG('s', 'g', 'i', ' ') }, /* SGI  */
     { CODEC_ID_DPX,   MKTAG('d', 'p', 'x', ' ') }, /* DPX */
 
+    { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'h') }, /* Apple ProRes 422 High Quality */
+    { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'n') }, /* Apple ProRes 422 Standard Definition */
+    { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 's') }, /* Apple ProRes 422 LT */
+    { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'o') }, /* Apple ProRes 422 Proxy */
+    { CODEC_ID_PRORES, MKTAG('a', 'p', '4', 'h') }, /* Apple ProRes 4444 */
+
     { CODEC_ID_NONE, 0 },
 };
 
@@ -241,6 +253,7 @@ const AVCodecTag codec_movaudio_tags[] = {
     { CODEC_ID_QCELP, MKTAG('Q','c','l','q') },
     { CODEC_ID_QCELP, MKTAG('s','q','c','p') }, /* ISO Media fourcc */
 
+    { CODEC_ID_QDMC, MKTAG('Q', 'D', 'M', 'C') }, /* QDMC */
     { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2') }, /* QDM2 */
 
     { CODEC_ID_DVAUDIO, MKTAG('v', 'd', 'v', 'a') },
@@ -332,12 +345,12 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4])
     return 1;
 }
 
-int ff_mp4_read_descr_len(ByteIOContext *pb)
+int ff_mp4_read_descr_len(AVIOContext *pb)
 {
     int len = 0;
     int count = 4;
     while (count--) {
-        int c = get_byte(pb);
+        int c = avio_r8(pb);
         len = (len << 7) | (c & 0x7f);
         if (!(c & 0x80))
             break;
@@ -345,12 +358,12 @@ int ff_mp4_read_descr_len(ByteIOContext *pb)
     return len;
 }
 
-int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag)
+int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag)
 {
     int len;
-    *tag = get_byte(pb);
+    *tag = avio_r8(pb);
     len = ff_mp4_read_descr_len(pb);
-    dprintf(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len);
+    av_dlog(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len);
     return len;
 }
 
@@ -363,27 +376,27 @@ static const AVCodecTag mp4_audio_types[] = {
     { CODEC_ID_NONE,   AOT_NULL },
 };
 
-int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb)
+int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb)
 {
     int len, tag;
-    int object_type_id = get_byte(pb);
-    get_byte(pb); /* stream type */
-    get_be24(pb); /* buffer size db */
-    get_be32(pb); /* max bitrate */
-    get_be32(pb); /* avg bitrate */
+    int object_type_id = avio_r8(pb);
+    avio_r8(pb); /* stream type */
+    avio_rb24(pb); /* buffer size db */
+    avio_rb32(pb); /* max bitrate */
+    avio_rb32(pb); /* avg bitrate */
 
     st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id);
-    dprintf(fc, "esds object type id 0x%02x\n", object_type_id);
+    av_dlog(fc, "esds object type id 0x%02x\n", object_type_id);
     len = ff_mp4_read_descr(fc, pb, &tag);
     if (tag == MP4DecSpecificDescrTag) {
-        dprintf(fc, "Specific MPEG4 header len=%d\n", len);
+        av_dlog(fc, "Specific MPEG4 header len=%d\n", len);
         if((uint64_t)len > (1<<30))
             return -1;
         av_free(st->codec->extradata);
         st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
         if (!st->codec->extradata)
             return AVERROR(ENOMEM);
-        get_buffer(pb, st->codec->extradata, len);
+        avio_read(pb, st->codec->extradata, len);
         st->codec->extradata_size = len;
         if (st->codec->codec_id == CODEC_ID_AAC) {
             MPEG4AudioConfig cfg;
@@ -396,7 +409,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContex
                 st->codec->sample_rate = cfg.ext_sample_rate;
             else
                 st->codec->sample_rate = cfg.sample_rate;
-            dprintf(fc, "mp4a config channels %d obj %d ext obj %d "
+            av_dlog(fc, "mp4a config channels %d obj %d ext obj %d "
                     "sample rate %d ext sample rate %d\n", st->codec->channels,
                     cfg.object_type, cfg.ext_object_type,
                     cfg.sample_rate, cfg.ext_sample_rate);
diff --git a/ffmpeg-mt/libavformat/isom.h b/ffmpeg-mt/libavformat/isom.h
index 2990c9c..fba4963 100644
--- a/ffmpeg-mt/libavformat/isom.h
+++ b/ffmpeg-mt/libavformat/isom.h
@@ -4,20 +4,20 @@
  * copyright (c) 2002 Francois Revol <revol at free.fr>
  * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at free.fr>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -88,7 +88,7 @@ typedef struct {
 } MOVTrackExt;
 
 typedef struct MOVStreamContext {
-    ByteIOContext *pb;
+    AVIOContext *pb;
     int ffindex;          ///< AVStream index
     int next_chunk;
     unsigned int chunk_count;
@@ -141,18 +141,18 @@ typedef struct MOVContext {
     int chapter_track;
 } MOVContext;
 
-int ff_mp4_read_descr_len(ByteIOContext *pb);
-int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag);
-int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb);
+int ff_mp4_read_descr_len(AVIOContext *pb);
+int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag);
+int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb);
 
 #define MP4IODescrTag                   0x02
 #define MP4ESDescrTag                   0x03
 #define MP4DecConfigDescrTag            0x04
 #define MP4DecSpecificDescrTag          0x05
 
-int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom);
+int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
 enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
 
-int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries);
+int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries);
 
 #endif /* AVFORMAT_ISOM_H */
diff --git a/ffmpeg-mt/libavformat/iss.c b/ffmpeg-mt/libavformat/iss.c
index 156af97..fe5203d 100644
--- a/ffmpeg-mt/libavformat/iss.c
+++ b/ffmpeg-mt/libavformat/iss.c
@@ -2,20 +2,20 @@
  * ISS (.iss) file demuxer
  * Copyright (c) 2008 Jaikrishnan Menon <realityman at gmx.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,12 +39,12 @@ typedef struct {
     int sample_start_pos;
 } IssDemuxContext;
 
-static void get_token(ByteIOContext *s, char *buf, int maxlen)
+static void get_token(AVIOContext *s, char *buf, int maxlen)
 {
     int i = 0;
     char c;
 
-    while ((c = get_byte(s))) {
+    while ((c = avio_r8(s))) {
         if(c == ' ')
             break;
         if (i < maxlen-1)
@@ -52,7 +52,7 @@ static void get_token(ByteIOContext *s, char *buf, int maxlen)
     }
 
     if(!c)
-        get_byte(s);
+        avio_r8(s);
 
     buf[i] = 0; /* Ensure null terminated, but may be truncated */
 }
@@ -68,7 +68,7 @@ static int iss_probe(AVProbeData *p)
 static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     IssDemuxContext *iss = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     char token[MAX_TOKEN_SIZE];
     int stereo, rate_divisor;
@@ -87,7 +87,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
     get_token(pb, token, sizeof(token)); //Version ID
     get_token(pb, token, sizeof(token)); //Size
 
-    iss->sample_start_pos = url_ftell(pb);
+    iss->sample_start_pos = avio_tell(pb);
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -116,13 +116,13 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
         return AVERROR(EIO);
 
     pkt->stream_index = 0;
-    pkt->pts = url_ftell(s->pb) - iss->sample_start_pos;
+    pkt->pts = avio_tell(s->pb) - iss->sample_start_pos;
     if(s->streams[0]->codec->channels > 0)
         pkt->pts /= s->streams[0]->codec->channels*2;
     return 0;
 }
 
-AVInputFormat iss_demuxer = {
+AVInputFormat ff_iss_demuxer = {
     "ISS",
     NULL_IF_CONFIG_SMALL("Funcom ISS format"),
     sizeof(IssDemuxContext),
diff --git a/ffmpeg-mt/libavformat/iv8.c b/ffmpeg-mt/libavformat/iv8.c
index 00ddcd4..22e60cf 100644
--- a/ffmpeg-mt/libavformat/iv8.c
+++ b/ffmpeg-mt/libavformat/iv8.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -57,20 +57,20 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret, size, pts, type;
 retry:
-    type= get_be16(s->pb); // 257 or 258
-    size= get_be16(s->pb);
+    type= avio_rb16(s->pb); // 257 or 258
+    size= avio_rb16(s->pb);
 
-    get_be16(s->pb); //some flags, 0x80 indicates end of frame
-    get_be16(s->pb); //packet number
-    pts=get_be32(s->pb);
-    get_be32(s->pb); //6A 13 E3 88
+    avio_rb16(s->pb); //some flags, 0x80 indicates end of frame
+    avio_rb16(s->pb); //packet number
+    pts=avio_rb32(s->pb);
+    avio_rb32(s->pb); //6A 13 E3 88
 
     size -= 12;
     if(size<1)
         return -1;
 
     if(type==258){
-        url_fskip(s->pb, size);
+        avio_skip(s->pb, size);
         goto retry;
     }
 
@@ -84,7 +84,7 @@ retry:
     return ret;
 }
 
-AVInputFormat iv8_demuxer = {
+AVInputFormat ff_iv8_demuxer = {
     "iv8",
     NULL_IF_CONFIG_SMALL("A format generated by IndigoVision 8000 video server"),
     0,
diff --git a/ffmpeg-mt/libavformat/ivfdec.c b/ffmpeg-mt/libavformat/ivfdec.c
index 9baa3ec..3901731 100644
--- a/ffmpeg-mt/libavformat/ivfdec.c
+++ b/ffmpeg-mt/libavformat/ivfdec.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,9 +36,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     AVStream *st;
     AVRational time_base;
 
-    get_le32(s->pb); // DKIF
-    get_le16(s->pb); // version
-    get_le16(s->pb); // header size
+    avio_rl32(s->pb); // DKIF
+    avio_rl16(s->pb); // version
+    avio_rl16(s->pb); // header size
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -46,13 +46,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 
 
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_tag  = get_le32(s->pb);
+    st->codec->codec_tag  = avio_rl32(s->pb);
     st->codec->codec_id   = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag);
-    st->codec->width      = get_le16(s->pb);
-    st->codec->height     = get_le16(s->pb);
-    time_base.den         = get_le32(s->pb);
-    time_base.num         = get_le32(s->pb);
-    st->duration          = get_le64(s->pb);
+    st->codec->width      = avio_rl16(s->pb);
+    st->codec->height     = avio_rl16(s->pb);
+    time_base.den         = avio_rl32(s->pb);
+    time_base.num         = avio_rl32(s->pb);
+    st->duration          = avio_rl64(s->pb);
 
     st->need_parsing      = AVSTREAM_PARSE_HEADERS;
 
@@ -68,8 +68,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    int ret, size = get_le32(s->pb);
-    int64_t   pts = get_le64(s->pb);
+    int ret, size = avio_rl32(s->pb);
+    int64_t   pts = avio_rl64(s->pb);
 
     ret = av_get_packet(s->pb, pkt, size);
     pkt->stream_index = 0;
@@ -79,7 +79,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat ivf_demuxer = {
+AVInputFormat ff_ivf_demuxer = {
     "ivf",
     NULL_IF_CONFIG_SMALL("On2 IVF"),
     0,
diff --git a/ffmpeg-mt/libavformat/ivfenc.c b/ffmpeg-mt/libavformat/ivfenc.c
new file mode 100644
index 0000000..55ce586
--- /dev/null
+++ b/ffmpeg-mt/libavformat/ivfenc.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010 Reimar Döffinger
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "avformat.h"
+#include "libavutil/intreadwrite.h"
+
+static int ivf_write_header(AVFormatContext *s)
+{
+    AVCodecContext *ctx;
+    AVIOContext *pb = s->pb;
+
+    if (s->nb_streams != 1) {
+        av_log(s, AV_LOG_ERROR, "Format supports only exactly one video stream\n");
+        return AVERROR(EINVAL);
+    }
+    ctx = s->streams[0]->codec;
+    if (ctx->codec_type != AVMEDIA_TYPE_VIDEO || ctx->codec_id != CODEC_ID_VP8) {
+        av_log(s, AV_LOG_ERROR, "Currently only VP8 is supported!\n");
+        return AVERROR(EINVAL);
+    }
+    avio_write(pb, "DKIF", 4);
+    avio_wl16(pb, 0); // version
+    avio_wl16(pb, 32); // header length
+    avio_wl32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80"));
+    avio_wl16(pb, ctx->width);
+    avio_wl16(pb, ctx->height);
+    avio_wl32(pb, s->streams[0]->time_base.den);
+    avio_wl32(pb, s->streams[0]->time_base.num);
+    avio_wl64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!?
+
+    return 0;
+}
+
+static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+    AVIOContext *pb = s->pb;
+    avio_wl32(pb, pkt->size);
+    avio_wl64(pb, pkt->pts);
+    avio_write(pb, pkt->data, pkt->size);
+    avio_flush(pb);
+
+    return 0;
+}
+
+AVOutputFormat ff_ivf_muxer = {
+    .name = "ivf",
+    .long_name = NULL_IF_CONFIG_SMALL("On2 IVF"),
+    .extensions = "ivf",
+    .audio_codec = CODEC_ID_NONE,
+    .video_codec = CODEC_ID_VP8,
+    .write_header = ivf_write_header,
+    .write_packet = ivf_write_packet,
+};
diff --git a/ffmpeg-mt/libavformat/jvdec.c b/ffmpeg-mt/libavformat/jvdec.c
new file mode 100644
index 0000000..d4008f7
--- /dev/null
+++ b/ffmpeg-mt/libavformat/jvdec.c
@@ -0,0 +1,225 @@
+/*
+ * Bitmap Brothers JV demuxer
+ * Copyright (c) 2005, 2011 Peter Ross <pross at xvid.org>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Bitmap Brothers JV demuxer
+ * @author Peter Ross <pross at xvid.org>
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+
+#define JV_PREAMBLE_SIZE 5
+
+typedef struct {
+    int audio_size;    /** audio packet size (bytes) */
+    int video_size;    /** video packet size (bytes) */
+    int palette_size;  /** palette size (bytes) */
+    int video_type;    /** per-frame video compression type */
+} JVFrame;
+
+typedef struct {
+    JVFrame *frames;
+    enum {
+        JV_AUDIO = 0,
+        JV_VIDEO,
+        JV_PADDING
+    } state;
+    int64_t pts;
+} JVDemuxContext;
+
+#define MAGIC " Compression by John M Phillips Copyright (C) 1995 The Bitmap Brothers Ltd."
+
+static int read_probe(AVProbeData *pd)
+{
+    if (pd->buf[0] == 'J' && pd->buf[1] == 'V' &&
+        !memcmp(pd->buf + 4, MAGIC, FFMIN(strlen(MAGIC), pd->buf_size - 4)))
+        return AVPROBE_SCORE_MAX;
+    return 0;
+}
+
+static int read_header(AVFormatContext *s,
+                       AVFormatParameters *ap)
+{
+    JVDemuxContext *jv = s->priv_data;
+    AVIOContext *pb = s->pb;
+    AVStream *vst, *ast;
+    int64_t audio_pts = 0;
+    int64_t offset;
+    int i;
+
+    avio_skip(pb, 80);
+
+    ast = av_new_stream(s, 0);
+    vst = av_new_stream(s, 1);
+    if (!ast || !vst)
+        return AVERROR(ENOMEM);
+
+    vst->codec->codec_type  = AVMEDIA_TYPE_VIDEO;
+    vst->codec->codec_id    = CODEC_ID_JV;
+    vst->codec->codec_tag   = 0; /* no fourcc */
+    vst->codec->width       = avio_rl16(pb);
+    vst->codec->height      = avio_rl16(pb);
+    vst->nb_frames          =
+    ast->nb_index_entries   = avio_rl16(pb);
+    av_set_pts_info(vst, 64, avio_rl16(pb), 1000);
+
+    avio_skip(pb, 4);
+
+    ast->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
+    ast->codec->codec_id    = CODEC_ID_PCM_U8;
+    ast->codec->codec_tag   = 0; /* no fourcc */
+    ast->codec->sample_rate = avio_rl16(pb);
+    ast->codec->channels    = 1;
+    av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
+
+    avio_skip(pb, 10);
+
+    ast->index_entries = av_malloc(ast->nb_index_entries * sizeof(*ast->index_entries));
+    if (!ast->index_entries)
+        return AVERROR(ENOMEM);
+
+    jv->frames = av_malloc(ast->nb_index_entries * sizeof(JVFrame));
+    if (!jv->frames)
+        return AVERROR(ENOMEM);
+
+    offset = 0x68 + ast->nb_index_entries * 16;
+    for(i = 0; i < ast->nb_index_entries; i++) {
+        AVIndexEntry *e   = ast->index_entries + i;
+        JVFrame      *jvf = jv->frames + i;
+
+        /* total frame size including audio, video, palette data and padding */
+        e->size         = avio_rl32(pb);
+        e->timestamp    = i;
+        e->pos          = offset;
+        offset         += e->size;
+
+        jvf->audio_size = avio_rl32(pb);
+        jvf->video_size = avio_rl32(pb);
+        jvf->palette_size = avio_r8(pb) ? 768 : 0;
+        jvf->video_size = FFMIN(FFMAX(jvf->video_size, 0),
+                                INT_MAX - JV_PREAMBLE_SIZE - jvf->palette_size);
+        if (avio_r8(pb))
+             av_log(s, AV_LOG_WARNING, "unsupported audio codec\n");
+        jvf->video_type = avio_r8(pb);
+        avio_skip(pb, 1);
+
+        e->timestamp = jvf->audio_size ? audio_pts : AV_NOPTS_VALUE;
+        audio_pts += jvf->audio_size;
+
+        e->flags = jvf->video_type != 1 ? AVINDEX_KEYFRAME : 0;
+    }
+
+    jv->state = JV_AUDIO;
+    return 0;
+}
+
+static int read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+    JVDemuxContext *jv = s->priv_data;
+    AVIOContext *pb = s->pb;
+    AVStream *ast = s->streams[0];
+
+    while (!s->pb->eof_reached && jv->pts < ast->nb_index_entries) {
+        const AVIndexEntry *e   = ast->index_entries + jv->pts;
+        const JVFrame      *jvf = jv->frames + jv->pts;
+
+        switch(jv->state) {
+        case JV_AUDIO:
+            jv->state++;
+            if (jvf->audio_size ) {
+                if (av_get_packet(s->pb, pkt, jvf->audio_size) < 0)
+                    return AVERROR(ENOMEM);
+                pkt->stream_index = 0;
+                pkt->pts          = e->timestamp;
+                pkt->flags       |= AV_PKT_FLAG_KEY;
+                return 0;
+            }
+        case JV_VIDEO:
+            jv->state++;
+            if (jvf->video_size || jvf->palette_size) {
+                int size = jvf->video_size + jvf->palette_size;
+                if (av_new_packet(pkt, size + JV_PREAMBLE_SIZE))
+                    return AVERROR(ENOMEM);
+
+                AV_WL32(pkt->data, jvf->video_size);
+                pkt->data[4]      = jvf->video_type;
+                if (avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size) < 0)
+                    return AVERROR(EIO);
+
+                pkt->size         = size + JV_PREAMBLE_SIZE;
+                pkt->stream_index = 1;
+                pkt->pts          = jv->pts;
+                if (jvf->video_type != 1)
+                    pkt->flags |= AV_PKT_FLAG_KEY;
+                return 0;
+            }
+        case JV_PADDING:
+            avio_skip(pb, FFMAX(e->size - jvf->audio_size - jvf->video_size
+                                        - jvf->palette_size, 0));
+            jv->state = JV_AUDIO;
+            jv->pts++;
+        }
+    }
+
+    return AVERROR(EIO);
+}
+
+static int read_seek(AVFormatContext *s, int stream_index,
+                     int64_t ts, int flags)
+{
+    JVDemuxContext *jv = s->priv_data;
+    AVStream *ast = s->streams[0];
+    int i;
+
+    if (flags & (AVSEEK_FLAG_BYTE|AVSEEK_FLAG_FRAME))
+        return AVERROR(ENOSYS);
+
+    switch(stream_index) {
+    case 0:
+        i = av_index_search_timestamp(ast, ts, flags);
+        break;
+    case 1:
+        i = ts;
+        break;
+    default:
+        return 0;
+    }
+
+    if (i < 0 || i >= ast->nb_index_entries)
+        return 0;
+
+    jv->state = JV_AUDIO;
+    jv->pts   = i;
+    avio_seek(s->pb, ast->index_entries[i].pos, SEEK_SET);
+    return 0;
+}
+
+AVInputFormat ff_jv_demuxer = {
+    .name           = "jv",
+    .long_name      = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV"),
+    .priv_data_size = sizeof(JVDemuxContext),
+    .read_probe     = read_probe,
+    .read_header    = read_header,
+    .read_packet    = read_packet,
+    .read_seek      = read_seek,
+};
diff --git a/ffmpeg-mt/libavformat/libavformat.v b/ffmpeg-mt/libavformat/libavformat.v
index da2311e..0ec1c3c 100644
--- a/ffmpeg-mt/libavformat/libavformat.v
+++ b/ffmpeg-mt/libavformat/libavformat.v
@@ -1,3 +1,7 @@
 LIBAVFORMAT_$MAJOR {
         global: *;
+        local:
+                ff_*_demuxer;
+                ff_*_muxer;
+                ff_*_protocol;
 };
diff --git a/ffmpeg-mt/libavformat/libnut.c b/ffmpeg-mt/libavformat/libnut.c
index 4543df7..76a621a 100644
--- a/ffmpeg-mt/libavformat/libnut.c
+++ b/ffmpeg-mt/libavformat/libnut.c
@@ -2,20 +2,20 @@
  * NUT (de)muxing via libnut
  * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -46,15 +46,15 @@ static const AVCodecTag nut_tags[] = {
 
 #if CONFIG_LIBNUT_MUXER
 static int av_write(void * h, size_t len, const uint8_t * buf) {
-    ByteIOContext * bc = h;
-    put_buffer(bc, buf, len);
-    //put_flush_packet(bc);
+    AVIOContext * bc = h;
+    avio_write(bc, buf, len);
+    //avio_flush(bc);
     return len;
 }
 
 static int nut_write_header(AVFormatContext * avf) {
     NUTContext * priv = avf->priv_data;
-    ByteIOContext * bc = avf->pb;
+    AVIOContext * bc = avf->pb;
     nut_muxer_opts_tt mopts = {
         .output = {
             .priv = bc,
@@ -137,12 +137,12 @@ static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) {
 }
 
 static int nut_write_trailer(AVFormatContext * avf) {
-    ByteIOContext * bc = avf->pb;
+    AVIOContext * bc = avf->pb;
     NUTContext * priv = avf->priv_data;
     int i;
 
     nut_muxer_uninit_reorder(priv->nut);
-    put_flush_packet(bc);
+    avio_flush(bc);
 
     for(i = 0; priv->s[i].type != -1; i++ ) av_freep(&priv->s[i].fourcc);
     av_freep(&priv->s);
@@ -150,7 +150,7 @@ static int nut_write_trailer(AVFormatContext * avf) {
     return 0;
 }
 
-AVOutputFormat libnut_muxer = {
+AVOutputFormat ff_libnut_muxer = {
     "libnut",
     "nut format",
     "video/x-nut",
@@ -172,22 +172,22 @@ static int nut_probe(AVProbeData *p) {
 }
 
 static size_t av_read(void * h, size_t len, uint8_t * buf) {
-    ByteIOContext * bc = h;
-    return get_buffer(bc, buf, len);
+    AVIOContext * bc = h;
+    return avio_read(bc, buf, len);
 }
 
 static off_t av_seek(void * h, long long pos, int whence) {
-    ByteIOContext * bc = h;
+    AVIOContext * bc = h;
     if (whence == SEEK_END) {
-        pos = url_fsize(bc) + pos;
+        pos = avio_size(bc) + pos;
         whence = SEEK_SET;
     }
-    return url_fseek(bc, pos, whence);
+    return avio_seek(bc, pos, whence);
 }
 
 static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
     NUTContext * priv = avf->priv_data;
-    ByteIOContext * bc = avf->pb;
+    AVIOContext * bc = avf->pb;
     nut_demuxer_opts_tt dopts = {
         .input = {
             .priv = bc,
@@ -272,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
     if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY;
     pkt->pts = pd.pts;
     pkt->stream_index = pd.stream;
-    pkt->pos = url_ftell(avf->pb);
+    pkt->pos = avio_tell(avf->pb);
 
     ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
 
@@ -297,7 +297,7 @@ static int nut_read_close(AVFormatContext *s) {
     return 0;
 }
 
-AVInputFormat libnut_demuxer = {
+AVInputFormat ff_libnut_demuxer = {
     "libnut",
     NULL_IF_CONFIG_SMALL("NUT format"),
     sizeof(NUTContext),
diff --git a/ffmpeg-mt/libavformat/librtmp.c b/ffmpeg-mt/libavformat/librtmp.c
index 344f0f9..db5cc98 100644
--- a/ffmpeg-mt/libavformat/librtmp.c
+++ b/ffmpeg-mt/libavformat/librtmp.c
@@ -2,20 +2,20 @@
  * RTMP network protocol
  * Copyright (c) 2010 Howard Chu
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,7 @@
  */
 
 #include "avformat.h"
+#include "url.h"
 
 #include <librtmp/rtmp.h>
 #include <librtmp/log.h>
@@ -93,7 +94,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
         goto fail;
     }
 
-    if (flags & URL_WRONLY)
+    if (flags & AVIO_WRONLY)
         RTMP_EnableWrite(r);
 
     if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
@@ -157,67 +158,57 @@ static int rtmp_get_file_handle(URLContext *s)
     return RTMP_Socket(r);
 }
 
-URLProtocol rtmp_protocol = {
-    "rtmp",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
+URLProtocol ff_rtmp_protocol = {
+    .name                = "rtmp",
+    .url_open            = rtmp_open,
+    .url_read            = rtmp_read,
+    .url_write           = rtmp_write,
+    .url_close           = rtmp_close,
+    .url_read_pause      = rtmp_read_pause,
+    .url_read_seek       = rtmp_read_seek,
+    .url_get_file_handle = rtmp_get_file_handle
 };
 
-URLProtocol rtmpt_protocol = {
-    "rtmpt",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
+URLProtocol ff_rtmpt_protocol = {
+    .name                = "rtmpt",
+    .url_open            = rtmp_open,
+    .url_read            = rtmp_read,
+    .url_write           = rtmp_write,
+    .url_close           = rtmp_close,
+    .url_read_pause      = rtmp_read_pause,
+    .url_read_seek       = rtmp_read_seek,
+    .url_get_file_handle = rtmp_get_file_handle
 };
 
-URLProtocol rtmpe_protocol = {
-    "rtmpe",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
+URLProtocol ff_rtmpe_protocol = {
+    .name                = "rtmpe",
+    .url_open            = rtmp_open,
+    .url_read            = rtmp_read,
+    .url_write           = rtmp_write,
+    .url_close           = rtmp_close,
+    .url_read_pause      = rtmp_read_pause,
+    .url_read_seek       = rtmp_read_seek,
+    .url_get_file_handle = rtmp_get_file_handle
 };
 
-URLProtocol rtmpte_protocol = {
-    "rtmpte",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
+URLProtocol ff_rtmpte_protocol = {
+    .name                = "rtmpte",
+    .url_open            = rtmp_open,
+    .url_read            = rtmp_read,
+    .url_write           = rtmp_write,
+    .url_close           = rtmp_close,
+    .url_read_pause      = rtmp_read_pause,
+    .url_read_seek       = rtmp_read_seek,
+    .url_get_file_handle = rtmp_get_file_handle
 };
 
-URLProtocol rtmps_protocol = {
-    "rtmps",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
+URLProtocol ff_rtmps_protocol = {
+    .name                = "rtmps",
+    .url_open            = rtmp_open,
+    .url_read            = rtmp_read,
+    .url_write           = rtmp_write,
+    .url_close           = rtmp_close,
+    .url_read_pause      = rtmp_read_pause,
+    .url_read_seek       = rtmp_read_seek,
+    .url_get_file_handle = rtmp_get_file_handle
 };
diff --git a/ffmpeg-mt/libavformat/lmlm4.c b/ffmpeg-mt/libavformat/lmlm4.c
index c1397fb..eafc1b6 100644
--- a/ffmpeg-mt/libavformat/lmlm4.c
+++ b/ffmpeg-mt/libavformat/lmlm4.c
@@ -5,20 +5,20 @@
  * Due to a lack of sample files, only files with one channel are supported.
  * u-law and ADPCM audio are unsupported for the same reason.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -78,13 +78,13 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
 }
 
 static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret;
     unsigned int frame_type, packet_size, padding, frame_size;
 
-    get_be16(pb);                       /* channel number */
-    frame_type  = get_be16(pb);
-    packet_size = get_be32(pb);
+    avio_rb16(pb);                       /* channel number */
+    frame_type  = avio_rb16(pb);
+    packet_size = avio_rb32(pb);
     padding     = -packet_size & 511;
     frame_size  = packet_size - 8;
 
@@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
     if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
         return AVERROR(EIO);
 
-    url_fskip(pb, padding);
+    avio_skip(pb, padding);
 
     switch (frame_type) {
         case LMLM4_I_FRAME:
@@ -117,7 +117,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
     return ret;
 }
 
-AVInputFormat lmlm4_demuxer = {
+AVInputFormat ff_lmlm4_demuxer = {
     "lmlm4",
     NULL_IF_CONFIG_SMALL("lmlm4 raw format"),
     0,
diff --git a/ffmpeg-mt/libavformat/lxfdec.c b/ffmpeg-mt/libavformat/lxfdec.c
index 2575f36..0f7e426 100644
--- a/ffmpeg-mt/libavformat/lxfdec.c
+++ b/ffmpeg-mt/libavformat/lxfdec.c
@@ -2,20 +2,20 @@
  * LXF demuxer
  * Copyright (c) 2010 Tomas Härdin
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -86,15 +86,15 @@ static int sync(AVFormatContext *s, uint8_t *header)
     uint8_t buf[LXF_IDENT_LENGTH];
     int ret;
 
-    if ((ret = get_buffer(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH)
+    if ((ret = avio_read(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH)
         return ret < 0 ? ret : AVERROR_EOF;
 
     while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) {
-        if (url_feof(s->pb))
+        if (s->pb->eof_reached)
             return AVERROR_EOF;
 
         memmove(buf, &buf[1], LXF_IDENT_LENGTH-1);
-        buf[LXF_IDENT_LENGTH-1] = get_byte(s->pb);
+        buf[LXF_IDENT_LENGTH-1] = avio_r8(s->pb);
     }
 
     memcpy(header, LXF_IDENT, LXF_IDENT_LENGTH);
@@ -111,7 +111,7 @@ static int sync(AVFormatContext *s, uint8_t *header)
  */
 static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *format)
 {
-    ByteIOContext   *pb  = s->pb;
+    AVIOContext   *pb  = s->pb;
     int track_size, samples, ret;
     AVStream *st;
 
@@ -120,7 +120,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
         return ret;
 
     //read the rest of the packet header
-    if ((ret = get_buffer(pb, header + LXF_IDENT_LENGTH,
+    if ((ret = avio_read(pb, header + LXF_IDENT_LENGTH,
                           LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH)) !=
                           LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH) {
         return ret < 0 ? ret : AVERROR_EOF;
@@ -137,7 +137,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
     case 0:
         //video
         //skip VBI data and metadata
-        url_fskip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) +
+        avio_skip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) +
                       (int64_t)(uint32_t)AV_RL32(&header[52]));
         break;
     case 1:
@@ -198,7 +198,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
 static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     LXFDemuxContext *lxf = s->priv_data;
-    ByteIOContext   *pb  = s->pb;
+    AVIOContext   *pb  = s->pb;
     uint8_t header[LXF_PACKET_HEADER_SIZE], header_data[LXF_HEADER_DATA_SIZE];
     int ret;
     AVStream *st;
@@ -214,11 +214,11 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return AVERROR_INVALIDDATA;
     }
 
-    if ((ret = get_buffer(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
+    if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
         return ret < 0 ? ret : AVERROR_EOF;
 
     if (!(st = av_new_stream(s, 0)))
-        return AVERROR_NOMEM;
+        return AVERROR(ENOMEM);
 
     st->duration          = AV_RL32(&header_data[32]);
     video_params          = AV_RL32(&header_data[40]);
@@ -244,7 +244,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     if ((lxf->channels = (disk_params >> 2) & 0xF)) {
         if (!(st = av_new_stream(s, 1)))
-            return AVERROR_NOMEM;
+            return AVERROR(ENOMEM);
 
         st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
         st->codec->sample_rate = LXF_SAMPLERATE;
@@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     if (format == 1) {
         //skip extended field data
-        url_fskip(s->pb, (uint32_t)AV_RL32(&header[40]));
+        avio_skip(s->pb, (uint32_t)AV_RL32(&header[40]));
     }
 
     return 0;
@@ -281,7 +281,7 @@ static void deplanarize(LXFDemuxContext *lxf, AVStream *ast, uint8_t *out, int b
 static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     LXFDemuxContext *lxf = s->priv_data;
-    ByteIOContext   *pb  = s->pb;
+    AVIOContext   *pb  = s->pb;
     uint8_t header[LXF_PACKET_HEADER_SIZE], *buf;
     AVStream *ast = NULL;
     uint32_t stream, format;
@@ -315,7 +315,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
     //read non-20-bit audio data into lxf->temp so we can deplanarize it
     buf = ast && ast->codec->codec_id != CODEC_ID_PCM_LXF ? lxf->temp : pkt->data;
 
-    if ((ret2 = get_buffer(pb, buf, ret)) != ret) {
+    if ((ret2 = avio_read(pb, buf, ret)) != ret) {
         av_free_packet(pkt);
         return ret2 < 0 ? ret2 : AVERROR_EOF;
     }
@@ -336,7 +336,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat lxf_demuxer = {
+AVInputFormat ff_lxf_demuxer = {
     .name           = "lxf",
     .long_name      = NULL_IF_CONFIG_SMALL("VR native stream format (LXF)"),
     .priv_data_size = sizeof(LXFDemuxContext),
diff --git a/ffmpeg-mt/libavformat/m4vdec.c b/ffmpeg-mt/libavformat/m4vdec.c
index fdd3a80..3463901 100644
--- a/ffmpeg-mt/libavformat/m4vdec.c
+++ b/ffmpeg-mt/libavformat/m4vdec.c
@@ -2,20 +2,20 @@
  * RAW MPEG-4 video demuxer
  * Copyright (c) 2006  Thijs Vermeir <thijs.vermeir at barco.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -49,7 +49,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
     return 0;
 }
 
-AVInputFormat m4v_demuxer = {
+AVInputFormat ff_m4v_demuxer = {
     "m4v",
     NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
     0,
diff --git a/ffmpeg-mt/libavformat/matroska.c b/ffmpeg-mt/libavformat/matroska.c
index c7e9663..b448af2 100644
--- a/ffmpeg-mt/libavformat/matroska.c
+++ b/ffmpeg-mt/libavformat/matroska.c
@@ -2,20 +2,20 @@
  * Matroska common data
  * Copyright (c) 2003-2004 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/matroska.h b/ffmpeg-mt/libavformat/matroska.h
index 0d0d0bc..45d9747 100644
--- a/ffmpeg-mt/libavformat/matroska.h
+++ b/ffmpeg-mt/libavformat/matroska.h
@@ -2,20 +2,20 @@
  * Matroska constants
  * Copyright (c) 2003-2004 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/matroskadec.c b/ffmpeg-mt/libavformat/matroskadec.c
index 820140f..d1567e7 100644
--- a/ffmpeg-mt/libavformat/matroskadec.c
+++ b/ffmpeg-mt/libavformat/matroskadec.c
@@ -1,21 +1,21 @@
 /*
  * Matroska file demuxer
- * Copyright (c) 2003-2008 The FFmpeg Project
+ * Copyright (c) 2003-2008 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include "avformat.h"
 #include "internal.h"
+#include "avio_internal.h"
 /* For ff_codec_get_id(). */
 #include "riff.h"
 #include "isom.h"
@@ -58,6 +59,7 @@ typedef enum {
     EBML_NEST,
     EBML_PASS,
     EBML_STOP,
+    EBML_TYPE_COUNT
 } EbmlType;
 
 typedef const struct EbmlSyntax {
@@ -514,8 +516,8 @@ static const char *matroska_doctypes[] = { "matroska", "webm" };
  */
 static int ebml_level_end(MatroskaDemuxContext *matroska)
 {
-    ByteIOContext *pb = matroska->ctx->pb;
-    int64_t pos = url_ftell(pb);
+    AVIOContext *pb = matroska->ctx->pb;
+    int64_t pos = avio_tell(pb);
 
     if (matroska->num_levels > 0) {
         MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
@@ -535,19 +537,19 @@ static int ebml_level_end(MatroskaDemuxContext *matroska)
  * number.
  * Returns: number of bytes read, < 0 on error
  */
-static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
+static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
                          int max_size, uint64_t *number)
 {
     int read = 1, n = 1;
     uint64_t total = 0;
 
-    /* The first byte tells us the length in bytes - get_byte() can normally
+    /* The first byte tells us the length in bytes - avio_r8() can normally
      * return 0, but since that's not a valid first ebmlID byte, we can
      * use it safely here to catch EOS. */
-    if (!(total = get_byte(pb))) {
+    if (!(total = avio_r8(pb))) {
         /* we might encounter EOS here */
-        if (!url_feof(pb)) {
-            int64_t pos = url_ftell(pb);
+        if (!pb->eof_reached) {
+            int64_t pos = avio_tell(pb);
             av_log(matroska->ctx, AV_LOG_ERROR,
                    "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
                    pos, pos);
@@ -558,7 +560,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
     /* get the length of the EBML number */
     read = 8 - ff_log2_tab[total];
     if (read > max_size) {
-        int64_t pos = url_ftell(pb) - 1;
+        int64_t pos = avio_tell(pb) - 1;
         av_log(matroska->ctx, AV_LOG_ERROR,
                "Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
                (uint8_t) total, pos, pos);
@@ -568,7 +570,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
     /* read out length */
     total ^= 1 << ff_log2_tab[total];
     while (n++ < read)
-        total = (total << 8) | get_byte(pb);
+        total = (total << 8) | avio_r8(pb);
 
     *number = total;
 
@@ -580,7 +582,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
  * This needs special handling for the "unknown length" case which has multiple
  * encodings.
  */
-static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb,
+static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb,
                             uint64_t *number)
 {
     int res = ebml_read_num(matroska, pb, 8, number);
@@ -593,7 +595,7 @@ static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb,
  * Read the next element as an unsigned int.
  * 0 is success, < 0 is failure.
  */
-static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
+static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num)
 {
     int n = 0;
 
@@ -603,7 +605,7 @@ static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
     /* big-endian ordering; build up number */
     *num = 0;
     while (n++ < size)
-        *num = (*num << 8) | get_byte(pb);
+        *num = (*num << 8) | avio_r8(pb);
 
     return 0;
 }
@@ -612,14 +614,14 @@ static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
  * Read the next element as a float.
  * 0 is success, < 0 is failure.
  */
-static int ebml_read_float(ByteIOContext *pb, int size, double *num)
+static int ebml_read_float(AVIOContext *pb, int size, double *num)
 {
     if (size == 0) {
         *num = 0;
     } else if (size == 4) {
-        *num= av_int2flt(get_be32(pb));
+        *num= av_int2flt(avio_rb32(pb));
     } else if(size==8){
-        *num= av_int2dbl(get_be64(pb));
+        *num= av_int2dbl(avio_rb64(pb));
     } else
         return AVERROR_INVALIDDATA;
 
@@ -630,14 +632,14 @@ static int ebml_read_float(ByteIOContext *pb, int size, double *num)
  * Read the next element as an ASCII string.
  * 0 is success, < 0 is failure.
  */
-static int ebml_read_ascii(ByteIOContext *pb, int size, char **str)
+static int ebml_read_ascii(AVIOContext *pb, int size, char **str)
 {
     av_free(*str);
     /* EBML strings are usually not 0-terminated, so we allocate one
      * byte more, read the string and NULL-terminate it ourselves. */
     if (!(*str = av_malloc(size + 1)))
         return AVERROR(ENOMEM);
-    if (get_buffer(pb, (uint8_t *) *str, size) != size) {
+    if (avio_read(pb, (uint8_t *) *str, size) != size) {
         av_freep(str);
         return AVERROR(EIO);
     }
@@ -650,15 +652,15 @@ static int ebml_read_ascii(ByteIOContext *pb, int size, char **str)
  * Read the next element as binary data.
  * 0 is success, < 0 is failure.
  */
-static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
+static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin)
 {
     av_free(bin->data);
     if (!(bin->data = av_malloc(length)))
         return AVERROR(ENOMEM);
 
     bin->size = length;
-    bin->pos  = url_ftell(pb);
-    if (get_buffer(pb, bin->data, length) != length) {
+    bin->pos  = avio_tell(pb);
+    if (avio_read(pb, bin->data, length) != length) {
         av_freep(&bin->data);
         return AVERROR(EIO);
     }
@@ -673,7 +675,7 @@ static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
  */
 static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
 {
-    ByteIOContext *pb = matroska->ctx->pb;
+    AVIOContext *pb = matroska->ctx->pb;
     MatroskaLevel *level;
 
     if (matroska->num_levels >= EBML_MAX_DEPTH) {
@@ -683,7 +685,7 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
     }
 
     level = &matroska->levels[matroska->num_levels++];
-    level->start = url_ftell(pb);
+    level->start = avio_tell(pb);
     level->length = length;
 
     return 0;
@@ -696,8 +698,8 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
 static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska,
                                  uint8_t *data, uint32_t size, uint64_t *num)
 {
-    ByteIOContext pb;
-    init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL);
+    AVIOContext pb;
+    ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL);
     return ebml_read_num(matroska, &pb, FFMIN(size, 8), num);
 }
 
@@ -780,7 +782,17 @@ static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
 static int ebml_parse_elem(MatroskaDemuxContext *matroska,
                            EbmlSyntax *syntax, void *data)
 {
-    ByteIOContext *pb = matroska->ctx->pb;
+    static const uint64_t max_lengths[EBML_TYPE_COUNT] = {
+        [EBML_UINT]  = 8,
+        [EBML_FLOAT] = 8,
+        // max. 16 MB for strings
+        [EBML_STR]   = 0x1000000,
+        [EBML_UTF8]  = 0x1000000,
+        // max. 256 MB for binary data
+        [EBML_BIN]   = 0x10000000,
+        // no limits for anything else
+    };
+    AVIOContext *pb = matroska->ctx->pb;
     uint32_t id = syntax->id;
     uint64_t length;
     int res;
@@ -798,6 +810,12 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
         matroska->current_id = 0;
         if ((res = ebml_read_length(matroska, pb, &length)) < 0)
             return res;
+        if (max_lengths[syntax->type] && length > max_lengths[syntax->type]) {
+            av_log(matroska->ctx, AV_LOG_ERROR,
+                   "Invalid length 0x%"PRIx64" > 0x%"PRIx64" for syntax element %i\n",
+                   length, max_lengths[syntax->type], syntax->type);
+            return AVERROR_INVALIDDATA;
+        }
     }
 
     switch (syntax->type) {
@@ -809,11 +827,11 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
     case EBML_NEST:  if ((res=ebml_read_master(matroska, length)) < 0)
                          return res;
                      if (id == MATROSKA_ID_SEGMENT)
-                         matroska->segment_start = url_ftell(matroska->ctx->pb);
+                         matroska->segment_start = avio_tell(matroska->ctx->pb);
                      return ebml_parse_nest(matroska, syntax->def.n, data);
     case EBML_PASS:  return ebml_parse_id(matroska, syntax->def.n, id, data);
     case EBML_STOP:  return 1;
-    default:         return url_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0;
+    default:         return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0;
     }
     if (res == AVERROR_INVALIDDATA)
         av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n");
@@ -1093,13 +1111,13 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
     EbmlList *seekhead_list = &matroska->seekhead;
     MatroskaSeekhead *seekhead = seekhead_list->elem;
     uint32_t level_up = matroska->level_up;
-    int64_t before_pos = url_ftell(matroska->ctx->pb);
+    int64_t before_pos = avio_tell(matroska->ctx->pb);
     uint32_t saved_id = matroska->current_id;
     MatroskaLevel level;
     int i;
 
     // we should not do any seeking in the streaming case
-    if (url_is_streamed(matroska->ctx->pb) ||
+    if (!matroska->ctx->pb->seekable ||
         (matroska->ctx->flags & AVFMT_FLAG_IGNIDX))
         return;
 
@@ -1112,7 +1130,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
             continue;
 
         /* seek */
-        if (url_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset)
+        if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) != offset)
             continue;
 
         /* We don't want to lose our seekhead level, so we add
@@ -1141,7 +1159,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
     }
 
     /* seek back */
-    url_fseek(matroska->ctx->pb, before_pos, SEEK_SET);
+    avio_seek(matroska->ctx->pb, before_pos, SEEK_SET);
     matroska->level_up = level_up;
     matroska->current_id = saved_id;
 }
@@ -1225,7 +1243,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
         uint8_t *extradata = NULL;
         int extradata_size = 0;
         int extradata_offset = 0;
-        ByteIOContext b;
+        AVIOContext b;
 
         /* Apply some sanity checks. */
         if (track->type != MATROSKA_TRACK_TYPE_VIDEO &&
@@ -1311,8 +1329,8 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
         } else if (!strcmp(track->codec_id, "A_MS/ACM")
                    && track->codec_priv.size >= 14
                    && track->codec_priv.data != NULL) {
-            init_put_byte(&b, track->codec_priv.data, track->codec_priv.size,
-                          URL_RDONLY, NULL, NULL, NULL, NULL);
+            ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size,
+                          AVIO_RDONLY, NULL, NULL, NULL, NULL);
             ff_get_wav_header(&b, st->codec, track->codec_priv.size);
             codec_id = st->codec->codec_id;
             extradata_offset = FFMIN(track->codec_priv.size, 18);
@@ -1356,14 +1374,14 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
             extradata = av_mallocz(extradata_size);
             if (extradata == NULL)
                 return AVERROR(ENOMEM);
-            init_put_byte(&b, extradata, extradata_size, 1,
+            ffio_init_context(&b, extradata, extradata_size, 1,
                           NULL, NULL, NULL, NULL);
-            put_buffer(&b, "TTA1", 4);
-            put_le16(&b, 1);
-            put_le16(&b, track->audio.channels);
-            put_le16(&b, track->audio.bitdepth);
-            put_le32(&b, track->audio.out_samplerate);
-            put_le32(&b, matroska->ctx->duration * track->audio.out_samplerate);
+            avio_write(&b, "TTA1", 4);
+            avio_wl16(&b, 1);
+            avio_wl16(&b, track->audio.channels);
+            avio_wl16(&b, track->audio.bitdepth);
+            avio_wl32(&b, track->audio.out_samplerate);
+            avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate);
         } else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 ||
                    codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
             extradata_offset = 26;
@@ -1373,15 +1391,15 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
         } else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK ||
                    codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) {
             int flavor;
-            init_put_byte(&b, track->codec_priv.data,track->codec_priv.size,
+            ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
                           0, NULL, NULL, NULL, NULL);
-            url_fskip(&b, 22);
-            flavor                       = get_be16(&b);
-            track->audio.coded_framesize = get_be32(&b);
-            url_fskip(&b, 12);
-            track->audio.sub_packet_h    = get_be16(&b);
-            track->audio.frame_size      = get_be16(&b);
-            track->audio.sub_packet_size = get_be16(&b);
+            avio_skip(&b, 22);
+            flavor                       = avio_rb16(&b);
+            track->audio.coded_framesize = avio_rb32(&b);
+            avio_skip(&b, 12);
+            track->audio.sub_packet_h    = avio_rb16(&b);
+            track->audio.frame_size      = avio_rb16(&b);
+            track->audio.sub_packet_size = avio_rb16(&b);
             track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h);
             if (codec_id == CODEC_ID_RA_288) {
                 st->codec->block_align = track->audio.coded_framesize;
@@ -1824,7 +1842,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
     EbmlList *blocks_list;
     MatroskaBlock *blocks;
     int i, res;
-    int64_t pos = url_ftell(matroska->ctx->pb);
+    int64_t pos = avio_tell(matroska->ctx->pb);
     matroska->prev_pkt = NULL;
     if (matroska->current_id)
         pos -= 4;  /* sizeof the ID which was already read */
@@ -1834,6 +1852,8 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
     for (i=0; i<blocks_list->nb_elem; i++)
         if (blocks[i].bin.size > 0 && blocks[i].bin.data) {
             int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
+            if (!blocks[i].non_simple)
+                blocks[i].duration = AV_NOPTS_VALUE;
             res=matroska_parse_block(matroska,
                                      blocks[i].bin.data, blocks[i].bin.size,
                                      blocks[i].bin.pos,  cluster.timecode,
@@ -1871,7 +1891,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
     timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
 
     if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
-        url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
+        avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
         while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
             matroska_clear_queue(matroska);
             if (matroska_parse_cluster(matroska) < 0)
@@ -1896,7 +1916,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
         }
     }
 
-    url_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
+    avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
     matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
     matroska->skip_to_timecode = st->index_entries[index].timestamp;
     matroska->done = 0;
@@ -1920,7 +1940,7 @@ static int matroska_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat matroska_demuxer = {
+AVInputFormat ff_matroska_demuxer = {
     "matroska,webm",
     NULL_IF_CONFIG_SMALL("Matroska/WebM file format"),
     sizeof(MatroskaDemuxContext),
diff --git a/ffmpeg-mt/libavformat/matroskaenc.c b/ffmpeg-mt/libavformat/matroskaenc.c
index dc08c18..c0427f9 100644
--- a/ffmpeg-mt/libavformat/matroskaenc.c
+++ b/ffmpeg-mt/libavformat/matroskaenc.c
@@ -2,20 +2,20 @@
  * Matroska muxer
  * Copyright (c) 2007 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,7 +26,7 @@
 #include "avc.h"
 #include "flacenc.h"
 #include "avlanguage.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/samplefmt.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/random_seed.h"
 #include "libavutil/lfg.h"
@@ -74,7 +74,7 @@ typedef struct {
 
 typedef struct MatroskaMuxContext {
     int             mode;
-    ByteIOContext   *dyn_bc;
+    AVIOContext   *dyn_bc;
     ebml_master     segment;
     int64_t         segment_offset;
     ebml_master     cluster;
@@ -108,11 +108,11 @@ static int ebml_id_size(unsigned int id)
     return (av_log2(id+1)-1)/7+1;
 }
 
-static void put_ebml_id(ByteIOContext *pb, unsigned int id)
+static void put_ebml_id(AVIOContext *pb, unsigned int id)
 {
     int i = ebml_id_size(id);
     while (i--)
-        put_byte(pb, id >> (i*8));
+        avio_w8(pb, id >> (i*8));
 }
 
 /**
@@ -120,12 +120,12 @@ static void put_ebml_id(ByteIOContext *pb, unsigned int id)
  *
  * @param bytes The number of bytes the size should occupy (maximum: 8).
  */
-static void put_ebml_size_unknown(ByteIOContext *pb, int bytes)
+static void put_ebml_size_unknown(AVIOContext *pb, int bytes)
 {
     assert(bytes <= 8);
-    put_byte(pb, 0x1ff >> bytes);
+    avio_w8(pb, 0x1ff >> bytes);
     while (--bytes)
-        put_byte(pb, 0xff);
+        avio_w8(pb, 0xff);
 }
 
 /**
@@ -144,7 +144,7 @@ static int ebml_num_size(uint64_t num)
  * @param bytes The number of bytes that need to be used to write the number.
  *              If zero, any number of bytes can be used.
  */
-static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes)
+static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes)
 {
     int i, needed_bytes = ebml_num_size(num);
 
@@ -160,10 +160,10 @@ static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes)
 
     num |= 1ULL << bytes*7;
     for (i = bytes - 1; i >= 0; i--)
-        put_byte(pb, num >> i*8);
+        avio_w8(pb, num >> i*8);
 }
 
-static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val)
+static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val)
 {
     int i, bytes = 1;
     uint64_t tmp = val;
@@ -172,25 +172,25 @@ static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t va
     put_ebml_id(pb, elementid);
     put_ebml_num(pb, bytes, 0);
     for (i = bytes - 1; i >= 0; i--)
-        put_byte(pb, val >> i*8);
+        avio_w8(pb, val >> i*8);
 }
 
-static void put_ebml_float(ByteIOContext *pb, unsigned int elementid, double val)
+static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val)
 {
     put_ebml_id(pb, elementid);
     put_ebml_num(pb, 8, 0);
-    put_be64(pb, av_dbl2int(val));
+    avio_wb64(pb, av_dbl2int(val));
 }
 
-static void put_ebml_binary(ByteIOContext *pb, unsigned int elementid,
+static void put_ebml_binary(AVIOContext *pb, unsigned int elementid,
                             const void *buf, int size)
 {
     put_ebml_id(pb, elementid);
     put_ebml_num(pb, size, 0);
-    put_buffer(pb, buf, size);
+    avio_write(pb, buf, size);
 }
 
-static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const char *str)
+static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char *str)
 {
     put_ebml_binary(pb, elementid, str, strlen(str));
 }
@@ -201,9 +201,9 @@ static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const cha
  *
  * @param size The number of bytes to reserve, which must be at least 2.
  */
-static void put_ebml_void(ByteIOContext *pb, uint64_t size)
+static void put_ebml_void(AVIOContext *pb, uint64_t size)
 {
-    int64_t currentpos = url_ftell(pb);
+    int64_t currentpos = avio_tell(pb);
 
     assert(size >= 2);
 
@@ -215,34 +215,34 @@ static void put_ebml_void(ByteIOContext *pb, uint64_t size)
         put_ebml_num(pb, size-1, 0);
     else
         put_ebml_num(pb, size-9, 8);
-    while(url_ftell(pb) < currentpos + size)
-        put_byte(pb, 0);
+    while(avio_tell(pb) < currentpos + size)
+        avio_w8(pb, 0);
 }
 
-static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid, uint64_t expectedsize)
+static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, uint64_t expectedsize)
 {
     int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
     put_ebml_id(pb, elementid);
     put_ebml_size_unknown(pb, bytes);
-    return (ebml_master){ url_ftell(pb), bytes };
+    return (ebml_master){ avio_tell(pb), bytes };
 }
 
-static void end_ebml_master(ByteIOContext *pb, ebml_master master)
+static void end_ebml_master(AVIOContext *pb, ebml_master master)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
 
-    if (url_fseek(pb, master.pos - master.sizebytes, SEEK_SET) < 0)
+    if (avio_seek(pb, master.pos - master.sizebytes, SEEK_SET) < 0)
         return;
     put_ebml_num(pb, pos - master.pos, master.sizebytes);
-    url_fseek(pb, pos, SEEK_SET);
+    avio_seek(pb, pos, SEEK_SET);
 }
 
-static void put_xiph_size(ByteIOContext *pb, int size)
+static void put_xiph_size(AVIOContext *pb, int size)
 {
     int i;
     for (i = 0; i < size / 255; i++)
-        put_byte(pb, 255);
-    put_byte(pb, size % 255);
+        avio_w8(pb, 255);
+    avio_w8(pb, size % 255);
 }
 
 /**
@@ -256,7 +256,7 @@ static void put_xiph_size(ByteIOContext *pb, int size)
  * @param numelements The maximum number of elements that will be indexed
  *                    by this seek head, 0 if unlimited.
  */
-static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offset, int numelements)
+static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset, int numelements)
 {
     mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
     if (new_seekhead == NULL)
@@ -265,7 +265,7 @@ static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offs
     new_seekhead->segment_offset = segment_offset;
 
     if (numelements > 0) {
-        new_seekhead->filepos = url_ftell(pb);
+        new_seekhead->filepos = avio_tell(pb);
         // 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID
         // and size, and 3 bytes to guarantee that an EBML void element
         // will fit afterwards
@@ -304,16 +304,16 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid
  * @return The file offset where the seekhead was written,
  * -1 if an error occurred.
  */
-static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
+static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead)
 {
     ebml_master metaseek, seekentry;
     int64_t currentpos;
     int i;
 
-    currentpos = url_ftell(pb);
+    currentpos = avio_tell(pb);
 
     if (seekhead->reserved_size > 0)
-        if (url_fseek(pb, seekhead->filepos, SEEK_SET) < 0)
+        if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0)
             return -1;
 
     metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size);
@@ -332,9 +332,9 @@ static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
     end_ebml_master(pb, metaseek);
 
     if (seekhead->reserved_size > 0) {
-        uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb);
+        uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
         put_ebml_void(pb, remaining);
-        url_fseek(pb, currentpos, SEEK_SET);
+        avio_seek(pb, currentpos, SEEK_SET);
 
         currentpos = seekhead->filepos;
     }
@@ -373,13 +373,13 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t clus
     return 0;
 }
 
-static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks)
+static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks)
 {
     ebml_master cues_element;
     int64_t currentpos;
     int i, j;
 
-    currentpos = url_ftell(pb);
+    currentpos = avio_tell(pb);
     cues_element = start_ebml_master(pb, MATROSKA_ID_CUES, 0);
 
     for (i = 0; i < cues->num_entries; i++) {
@@ -408,7 +408,7 @@ static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks)
     return currentpos;
 }
 
-static int put_xiph_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec)
+static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec)
 {
     uint8_t *header_start[3];
     int header_len[3];
@@ -426,50 +426,36 @@ static int put_xiph_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecCont
         return -1;
     }
 
-    put_byte(pb, 2);                    // number packets - 1
+    avio_w8(pb, 2);                    // number packets - 1
     for (j = 0; j < 2; j++) {
         put_xiph_size(pb, header_len[j]);
     }
     for (j = 0; j < 3; j++)
-        put_buffer(pb, header_start[j], header_len[j]);
+        avio_write(pb, header_start[j], header_len[j]);
 
     return 0;
 }
 
 static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate)
 {
-    int sri;
+    MPEG4AudioConfig mp4ac;
 
-    if (codec->extradata_size < 2) {
-        av_log(s, AV_LOG_WARNING, "No AAC extradata, unable to determine samplerate.\n");
+    if (ff_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) {
+        av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n");
         return;
     }
 
-    sri = ((codec->extradata[0] << 1) & 0xE) | (codec->extradata[1] >> 7);
-    if (sri > 12) {
-        av_log(s, AV_LOG_WARNING, "AAC samplerate index out of bounds\n");
-        return;
-    }
-    *sample_rate = ff_mpeg4audio_sample_rates[sri];
-
-    // if sbr, get output sample rate as well
-    if (codec->extradata_size == 5) {
-        sri = (codec->extradata[4] >> 3) & 0xF;
-        if (sri > 12) {
-            av_log(s, AV_LOG_WARNING, "AAC output samplerate index out of bounds\n");
-            return;
-        }
-        *output_sample_rate = ff_mpeg4audio_sample_rates[sri];
-    }
+    *sample_rate        = mp4ac.sample_rate;
+    *output_sample_rate = mp4ac.ext_sample_rate;
 }
 
-static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id, int qt_id)
+static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, int native_id, int qt_id)
 {
-    ByteIOContext *dyn_cp;
+    AVIOContext *dyn_cp;
     uint8_t *codecpriv;
     int ret, codecpriv_size;
 
-    ret = url_open_dyn_buf(&dyn_cp);
+    ret = avio_open_dyn_buf(&dyn_cp);
     if(ret < 0)
         return ret;
 
@@ -481,13 +467,13 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
         else if (codec->codec_id == CODEC_ID_H264)
             ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size);
         else if (codec->extradata_size)
-            put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
+            avio_write(dyn_cp, codec->extradata, codec->extradata_size);
     } else if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
         if (qt_id) {
             if (!codec->codec_tag)
                 codec->codec_tag = ff_codec_get_tag(codec_movvideo_tags, codec->codec_id);
             if (codec->extradata_size)
-                put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
+                avio_write(dyn_cp, codec->extradata, codec->extradata_size);
         } else {
             if (!codec->codec_tag)
                 codec->codec_tag = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id);
@@ -512,7 +498,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
         ff_put_wav_header(dyn_cp, codec);
     }
 
-    codecpriv_size = url_close_dyn_buf(dyn_cp, &codecpriv);
+    codecpriv_size = avio_close_dyn_buf(dyn_cp, &codecpriv);
     if (codecpriv_size)
         put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv, codecpriv_size);
     av_free(codecpriv);
@@ -522,11 +508,11 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
 static int mkv_write_tracks(AVFormatContext *s)
 {
     MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     ebml_master tracks;
     int i, j, ret;
 
-    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, url_ftell(pb));
+    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_tell(pb));
     if (ret < 0) return ret;
 
     tracks = start_ebml_master(pb, MATROSKA_ID_TRACKS, 0);
@@ -650,7 +636,7 @@ static int mkv_write_tracks(AVFormatContext *s)
 static int mkv_write_chapters(AVFormatContext *s)
 {
     MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     ebml_master chapters, editionentry;
     AVRational scale = {1, 1E9};
     int i, ret;
@@ -658,7 +644,7 @@ static int mkv_write_chapters(AVFormatContext *s)
     if (!s->nb_chapters)
         return 0;
 
-    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, url_ftell(pb));
+    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb));
     if (ret < 0) return ret;
 
     chapters     = start_ebml_master(pb, MATROSKA_ID_CHAPTERS    , 0);
@@ -691,7 +677,7 @@ static int mkv_write_chapters(AVFormatContext *s)
     return 0;
 }
 
-static void mkv_write_simpletag(ByteIOContext *pb, AVMetadataTag *t)
+static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t)
 {
     uint8_t *key = av_strdup(t->key);
     uint8_t *p   = key;
@@ -730,7 +716,7 @@ static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int element
     int ret;
 
     if (!tags->pos) {
-        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, url_ftell(s->pb));
+        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb));
         if (ret < 0) return ret;
 
         *tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0);
@@ -790,7 +776,7 @@ static int mkv_write_tags(AVFormatContext *s)
 static int mkv_write_header(AVFormatContext *s)
 {
     MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     ebml_master ebml_header, segment_info;
     AVMetadataTag *tag;
     int ret, i;
@@ -813,7 +799,7 @@ static int mkv_write_header(AVFormatContext *s)
     end_ebml_master(pb, ebml_header);
 
     mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0);
-    mkv->segment_offset = url_ftell(pb);
+    mkv->segment_offset = avio_tell(pb);
 
     // we write 2 seek heads - one at the end of the file to point to each
     // cluster, and one at the beginning to point to all other level one
@@ -824,7 +810,7 @@ static int mkv_write_header(AVFormatContext *s)
     if (!mkv->main_seekhead)
         return AVERROR(ENOMEM);
 
-    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));
+    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, avio_tell(pb));
     if (ret < 0) return ret;
 
     segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0);
@@ -847,7 +833,7 @@ static int mkv_write_header(AVFormatContext *s)
 
     // reserve space for the duration
     mkv->duration = 0;
-    mkv->duration_offset = url_ftell(pb);
+    mkv->duration_offset = avio_tell(pb);
     put_ebml_void(pb, 11);                  // assumes double-precision float to be written
     end_ebml_master(pb, segment_info);
 
@@ -862,7 +848,7 @@ static int mkv_write_header(AVFormatContext *s)
         if (ret < 0) return ret;
     }
 
-    if (url_is_streamed(s->pb))
+    if (!s->pb->seekable)
         mkv_write_seekhead(pb, mkv->main_seekhead);
 
     mkv->cues = mkv_start_cues(mkv->segment_offset);
@@ -873,7 +859,7 @@ static int mkv_write_header(AVFormatContext *s)
     mkv->cur_audio_pkt.size = 0;
     mkv->audio_buffer_size  = 0;
 
-    put_flush_packet(pb);
+    avio_flush(pb);
     return 0;
 }
 
@@ -901,7 +887,7 @@ static int ass_get_duration(const uint8_t *p)
     return end - start;
 }
 
-static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt)
+static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
 {
     MatroskaMuxContext *mkv = s->priv_data;
     int i, layer = 0, max_duration = 0, size, line_size, data_size = pkt->size;
@@ -928,14 +914,14 @@ static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket
 
         av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
                "pts %" PRId64 ", duration %d\n",
-               url_ftell(pb), size, pkt->pts, duration);
+               avio_tell(pb), size, pkt->pts, duration);
         blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size));
         put_ebml_id(pb, MATROSKA_ID_BLOCK);
         put_ebml_num(pb, size+4, 0);
-        put_byte(pb, 0x80 | (pkt->stream_index + 1));     // this assumes stream_index is less than 126
-        put_be16(pb, pkt->pts - mkv->cluster_pts);
-        put_byte(pb, 0);
-        put_buffer(pb, buffer, size);
+        avio_w8(pb, 0x80 | (pkt->stream_index + 1));     // this assumes stream_index is less than 126
+        avio_wb16(pb, pkt->pts - mkv->cluster_pts);
+        avio_w8(pb, 0);
+        avio_write(pb, buffer, size);
         put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
         end_ebml_master(pb, blockgroup);
 
@@ -946,7 +932,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket
     return max_duration;
 }
 
-static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb,
+static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
                             unsigned int blockid, AVPacket *pkt, int flags)
 {
     MatroskaMuxContext *mkv = s->priv_data;
@@ -957,7 +943,7 @@ static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb,
 
     av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
            "pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
-           url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
+           avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
     if (codec->codec_id == CODEC_ID_H264 && codec->extradata_size > 0 &&
         (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
         ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
@@ -965,10 +951,10 @@ static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb,
         data = pkt->data;
     put_ebml_id(pb, blockid);
     put_ebml_num(pb, size+4, 0);
-    put_byte(pb, 0x80 | (pkt->stream_index + 1));     // this assumes stream_index is less than 126
-    put_be16(pb, ts - mkv->cluster_pts);
-    put_byte(pb, flags);
-    put_buffer(pb, data, size);
+    avio_w8(pb, 0x80 | (pkt->stream_index + 1));     // this assumes stream_index is less than 126
+    avio_wb16(pb, ts - mkv->cluster_pts);
+    avio_w8(pb, flags);
+    avio_write(pb, data, size);
     if (data != pkt->data)
         av_free(data);
 }
@@ -992,7 +978,7 @@ static int srt_get_duration(uint8_t **buf)
     return duration;
 }
 
-static int mkv_write_srt_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt)
+static int mkv_write_srt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
 {
     ebml_master blockgroup;
     AVPacket pkt2 = *pkt;
@@ -1017,8 +1003,8 @@ static void mkv_flush_dynbuf(AVFormatContext *s)
     if (!mkv->dyn_bc)
         return;
 
-    bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
-    put_buffer(s->pb, dyn_buf, bufsize);
+    bufsize = avio_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
+    avio_write(s->pb, dyn_buf, bufsize);
     av_free(dyn_buf);
     mkv->dyn_bc = NULL;
 }
@@ -1026,7 +1012,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s)
 static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
 {
     MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
     int keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
     int duration = pkt->duration;
@@ -1038,14 +1024,14 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
         return AVERROR(EINVAL);
     }
 
-    if (url_is_streamed(s->pb)) {
+    if (!s->pb->seekable) {
         if (!mkv->dyn_bc)
-            url_open_dyn_buf(&mkv->dyn_bc);
+            avio_open_dyn_buf(&mkv->dyn_bc);
         pb = mkv->dyn_bc;
     }
 
     if (!mkv->cluster_pos) {
-        mkv->cluster_pos = url_ftell(s->pb);
+        mkv->cluster_pos = avio_tell(s->pb);
         mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
         put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
         mkv->cluster_pts = FFMAX(0, ts);
@@ -1090,20 +1076,20 @@ static int mkv_copy_packet(MatroskaMuxContext *mkv, const AVPacket *pkt)
 static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb;
+    AVIOContext *pb = s->pb->seekable ? s->pb : mkv->dyn_bc;
     AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
     int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
     int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
-    int cluster_size = url_ftell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos);
+    int cluster_size = avio_tell(pb) - (s->pb->seekable ? mkv->cluster_pos : 0);
 
     // start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or
     // after 4k and on a keyframe
     if (mkv->cluster_pos &&
-        ((url_is_streamed(s->pb) && (cluster_size > 32*1024 || ts > mkv->cluster_pts + 1000))
+        ((!s->pb->seekable && (cluster_size > 32*1024 || ts > mkv->cluster_pts + 1000))
          ||                      cluster_size > 5*1024*1024 || ts > mkv->cluster_pts + 5000
          || (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe && cluster_size > 4*1024))) {
         av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64
-               " bytes, pts %" PRIu64 "\n", url_ftell(pb), ts);
+               " bytes, pts %" PRIu64 "\n", avio_tell(pb), ts);
         end_ebml_master(pb, mkv->cluster);
         mkv->cluster_pos = 0;
         if (mkv->dyn_bc)
@@ -1132,7 +1118,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
 static int mkv_write_trailer(AVFormatContext *s)
 {
     MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t currentpos, cuespos;
     int ret;
 
@@ -1153,31 +1139,34 @@ static int mkv_write_trailer(AVFormatContext *s)
         end_ebml_master(pb, mkv->cluster);
     }
 
-    if (!url_is_streamed(pb)) {
-        cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
+    if (pb->seekable) {
+        if (mkv->cues->num_entries) {
+            cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
+
+            ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES, cuespos);
+            if (ret < 0) return ret;
+        }
 
-        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES    , cuespos);
-        if (ret < 0) return ret;
         mkv_write_seekhead(pb, mkv->main_seekhead);
 
         // update the duration
         av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration);
-        currentpos = url_ftell(pb);
-        url_fseek(pb, mkv->duration_offset, SEEK_SET);
+        currentpos = avio_tell(pb);
+        avio_seek(pb, mkv->duration_offset, SEEK_SET);
         put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration);
 
-        url_fseek(pb, currentpos, SEEK_SET);
+        avio_seek(pb, currentpos, SEEK_SET);
     }
 
     end_ebml_master(pb, mkv->segment);
     av_free(mkv->tracks);
     av_destruct_packet(&mkv->cur_audio_pkt);
-    put_flush_packet(pb);
+    avio_flush(pb);
     return 0;
 }
 
 #if CONFIG_MATROSKA_MUXER
-AVOutputFormat matroska_muxer = {
+AVOutputFormat ff_matroska_muxer = {
     "matroska",
     NULL_IF_CONFIG_SMALL("Matroska file format"),
     "video/x-matroska",
@@ -1195,7 +1184,7 @@ AVOutputFormat matroska_muxer = {
 #endif
 
 #if CONFIG_WEBM_MUXER
-AVOutputFormat webm_muxer = {
+AVOutputFormat ff_webm_muxer = {
     "webm",
     NULL_IF_CONFIG_SMALL("WebM file format"),
     "video/webm",
@@ -1211,7 +1200,7 @@ AVOutputFormat webm_muxer = {
 #endif
 
 #if CONFIG_MATROSKA_AUDIO_MUXER
-AVOutputFormat matroska_audio_muxer = {
+AVOutputFormat ff_matroska_audio_muxer = {
     "matroska",
     NULL_IF_CONFIG_SMALL("Matroska file format"),
     "audio/x-matroska",
diff --git a/ffmpeg-mt/libavformat/md5enc.c b/ffmpeg-mt/libavformat/md5enc.c
index f9ab3d0..3b7d0ea 100644
--- a/ffmpeg-mt/libavformat/md5enc.c
+++ b/ffmpeg-mt/libavformat/md5enc.c
@@ -2,20 +2,20 @@
  * MD5 encoder (for codec/format testing)
  * Copyright (c) 2009 Reimar Döffinger, based on crcenc (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,8 +36,8 @@ static void md5_finish(struct AVFormatContext *s, char *buf)
     buf[offset] = '\n';
     buf[offset+1] = 0;
 
-    put_buffer(s->pb, buf, strlen(buf));
-    put_flush_packet(s->pb);
+    avio_write(s->pb, buf, strlen(buf));
+    avio_flush(s->pb);
 }
 
 #if CONFIG_MD5_MUXER
@@ -65,7 +65,7 @@ static int write_trailer(struct AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat md5_muxer = {
+AVOutputFormat ff_md5_muxer = {
     "md5",
     NULL_IF_CONFIG_SMALL("MD5 testing format"),
     NULL,
@@ -95,7 +95,7 @@ static int framemd5_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVOutputFormat framemd5_muxer = {
+AVOutputFormat ff_framemd5_muxer = {
     "framemd5",
     NULL_IF_CONFIG_SMALL("Per-frame MD5 testing format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/md5proto.c b/ffmpeg-mt/libavformat/md5proto.c
index 63e9fe4..8b811ec 100644
--- a/ffmpeg-mt/libavformat/md5proto.c
+++ b/ffmpeg-mt/libavformat/md5proto.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,7 @@
 #include "libavutil/error.h"
 #include "avformat.h"
 #include "avio.h"
+#include "url.h"
 
 #define PRIV_SIZE 128
 
@@ -35,7 +36,7 @@ static int md5_open(URLContext *h, const char *filename, int flags)
         return -1;
     }
 
-    if (flags != URL_WRONLY)
+    if (flags != AVIO_WRONLY)
         return AVERROR(EINVAL);
 
     av_md5_init(h->priv_data);
@@ -64,11 +65,11 @@ static int md5_close(URLContext *h)
     av_strstart(filename, "md5:", &filename);
 
     if (*filename) {
-        err = url_open(&out, filename, URL_WRONLY);
+        err = ffurl_open(&out, filename, AVIO_WRONLY);
         if (err)
             return err;
-        err = url_write(out, buf, i*2+1);
-        url_close(out);
+        err = ffurl_write(out, buf, i*2+1);
+        ffurl_close(out);
     } else {
         if (fwrite(buf, 1, i*2+1, stdout) < i*2+1)
             err = AVERROR(errno);
@@ -82,7 +83,7 @@ static int md5_get_handle(URLContext *h)
     return (intptr_t)h->priv_data;
 }
 
-URLProtocol md5_protocol = {
+URLProtocol ff_md5_protocol = {
     .name                = "md5",
     .url_open            = md5_open,
     .url_write           = md5_write,
diff --git a/ffmpeg-mt/libavformat/metadata.c b/ffmpeg-mt/libavformat/metadata.c
index 7d9a864..9ecc0a9 100644
--- a/ffmpeg-mt/libavformat/metadata.c
+++ b/ffmpeg-mt/libavformat/metadata.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2009 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/metadata.h b/ffmpeg-mt/libavformat/metadata.h
index 9e86650..0d2f1ab 100644
--- a/ffmpeg-mt/libavformat/metadata.h
+++ b/ffmpeg-mt/libavformat/metadata.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2009 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/metadata_compat.c b/ffmpeg-mt/libavformat/metadata_compat.c
index 19b8f59..bb73258 100644
--- a/ffmpeg-mt/libavformat/metadata_compat.c
+++ b/ffmpeg-mt/libavformat/metadata_compat.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/mm.c b/ffmpeg-mt/libavformat/mm.c
index cb0917a..bea6161 100644
--- a/ffmpeg-mt/libavformat/mm.c
+++ b/ffmpeg-mt/libavformat/mm.c
@@ -2,20 +2,20 @@
  * American Laser Games MM Format Demuxer
  * Copyright (c) 2006 Peter Ross
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -84,25 +84,25 @@ static int read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
     MmDemuxContext *mm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
 
     unsigned int type, length;
     unsigned int frame_rate, width, height;
 
-    type = get_le16(pb);
-    length = get_le32(pb);
+    type = avio_rl16(pb);
+    length = avio_rl32(pb);
 
     if (type != MM_TYPE_HEADER)
         return AVERROR_INVALIDDATA;
 
     /* read header */
-    get_le16(pb);   /* total number of chunks */
-    frame_rate = get_le16(pb);
-    get_le16(pb);   /* ibm-pc video bios mode */
-    width = get_le16(pb);
-    height = get_le16(pb);
-    url_fseek(pb, length - 10, SEEK_CUR);  /* unknown data */
+    avio_rl16(pb);   /* total number of chunks */
+    frame_rate = avio_rl16(pb);
+    avio_rl16(pb);   /* ibm-pc video bios mode */
+    width = avio_rl16(pb);
+    height = avio_rl16(pb);
+    avio_skip(pb, length - 10);  /* unknown data */
 
     /* video stream */
     st = av_new_stream(s, 0);
@@ -137,13 +137,13 @@ static int read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
     MmDemuxContext *mm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned char preamble[MM_PREAMBLE_SIZE];
     unsigned int type, length;
 
     while(1) {
 
-        if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
+        if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
             return AVERROR(EIO);
         }
 
@@ -162,7 +162,7 @@ static int read_packet(AVFormatContext *s,
             if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE))
                 return AVERROR(ENOMEM);
             memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
-            if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
+            if (avio_read(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
                 return AVERROR(EIO);
             pkt->size = length + MM_PREAMBLE_SIZE;
             pkt->stream_index = 0;
@@ -181,14 +181,14 @@ static int read_packet(AVFormatContext *s,
 
         default :
             av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type);
-            url_fseek(pb, length, SEEK_CUR);
+            avio_skip(pb, length);
         }
     }
 
     return 0;
 }
 
-AVInputFormat mm_demuxer = {
+AVInputFormat ff_mm_demuxer = {
     "mm",
     NULL_IF_CONFIG_SMALL("American Laser Games MM format"),
     sizeof(MmDemuxContext),
diff --git a/ffmpeg-mt/libavformat/mmf.c b/ffmpeg-mt/libavformat/mmf.c
index 85b23a3..ec99c2d 100644
--- a/ffmpeg-mt/libavformat/mmf.c
+++ b/ffmpeg-mt/libavformat/mmf.c
@@ -2,23 +2,24 @@
  * Yamaha SMAF format
  * Copyright (c) 2005 Vidar Madsen
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "avio_internal.h"
 #include "pcm.h"
 #include "riff.h"
 
@@ -47,20 +48,20 @@ static int mmf_rate_code(int rate)
 }
 
 /* Copy of end_tag() from avienc.c, but for big-endian chunk size */
-static void end_tag_be(ByteIOContext *pb, int64_t start)
+static void end_tag_be(AVIOContext *pb, int64_t start)
 {
     int64_t pos;
 
-    pos = url_ftell(pb);
-    url_fseek(pb, start - 4, SEEK_SET);
-    put_be32(pb, (uint32_t)(pos - start));
-    url_fseek(pb, pos, SEEK_SET);
+    pos = avio_tell(pb);
+    avio_seek(pb, start - 4, SEEK_SET);
+    avio_wb32(pb, (uint32_t)(pos - start));
+    avio_seek(pb, pos, SEEK_SET);
 }
 
 static int mmf_write_header(AVFormatContext *s)
 {
     MMFContext *mmf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos;
     int rate;
 
@@ -70,96 +71,96 @@ static int mmf_write_header(AVFormatContext *s)
         return -1;
     }
 
-    put_tag(pb, "MMMD");
-    put_be32(pb, 0);
+    ffio_wfourcc(pb, "MMMD");
+    avio_wb32(pb, 0);
     pos = ff_start_tag(pb, "CNTI");
-    put_byte(pb, 0); /* class */
-    put_byte(pb, 0); /* type */
-    put_byte(pb, 0); /* code type */
-    put_byte(pb, 0); /* status */
-    put_byte(pb, 0); /* counts */
-    put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */
+    avio_w8(pb, 0); /* class */
+    avio_w8(pb, 0); /* type */
+    avio_w8(pb, 0); /* code type */
+    avio_w8(pb, 0); /* status */
+    avio_w8(pb, 0); /* counts */
+    avio_write(pb, "VN:libavcodec,", sizeof("VN:libavcodec,") -1); /* metadata ("ST:songtitle,VN:version,...") */
     end_tag_be(pb, pos);
 
-    put_buffer(pb, "ATR\x00", 4);
-    put_be32(pb, 0);
-    mmf->atrpos = url_ftell(pb);
-    put_byte(pb, 0); /* format type */
-    put_byte(pb, 0); /* sequence type */
-    put_byte(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
-    put_byte(pb, 0); /* wave base bit */
-    put_byte(pb, 2); /* time base d */
-    put_byte(pb, 2); /* time base g */
-
-    put_tag(pb, "Atsq");
-    put_be32(pb, 16);
-    mmf->atsqpos = url_ftell(pb);
+    avio_write(pb, "ATR\x00", 4);
+    avio_wb32(pb, 0);
+    mmf->atrpos = avio_tell(pb);
+    avio_w8(pb, 0); /* format type */
+    avio_w8(pb, 0); /* sequence type */
+    avio_w8(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
+    avio_w8(pb, 0); /* wave base bit */
+    avio_w8(pb, 2); /* time base d */
+    avio_w8(pb, 2); /* time base g */
+
+    ffio_wfourcc(pb, "Atsq");
+    avio_wb32(pb, 16);
+    mmf->atsqpos = avio_tell(pb);
     /* Will be filled on close */
-    put_buffer(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
+    avio_write(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
 
     mmf->awapos = ff_start_tag(pb, "Awa\x01");
 
     av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
 static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
+    AVIOContext *pb = s->pb;
+    avio_write(pb, pkt->data, pkt->size);
     return 0;
 }
 
 /* Write a variable-length symbol */
-static void put_varlength(ByteIOContext *pb, int val)
+static void put_varlength(AVIOContext *pb, int val)
 {
     if(val < 128)
-        put_byte(pb, val);
+        avio_w8(pb, val);
     else {
         val -= 128;
-        put_byte(pb, 0x80 | val >> 7);
-        put_byte(pb, 0x7f & val);
+        avio_w8(pb, 0x80 | val >> 7);
+        avio_w8(pb, 0x7f & val);
     }
 }
 
 static int mmf_write_trailer(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     MMFContext *mmf = s->priv_data;
     int64_t pos, size;
     int gatetime;
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
         /* Fill in length fields */
         end_tag_be(pb, mmf->awapos);
         end_tag_be(pb, mmf->atrpos);
         end_tag_be(pb, 8);
 
-        pos = url_ftell(pb);
+        pos = avio_tell(pb);
         size = pos - mmf->awapos;
 
         /* Fill Atsq chunk */
-        url_fseek(pb, mmf->atsqpos, SEEK_SET);
+        avio_seek(pb, mmf->atsqpos, SEEK_SET);
 
         /* "play wav" */
-        put_byte(pb, 0); /* start time */
-        put_byte(pb, 1); /* (channel << 6) | wavenum */
+        avio_w8(pb, 0); /* start time */
+        avio_w8(pb, 1); /* (channel << 6) | wavenum */
         gatetime = size * 500 / s->streams[0]->codec->sample_rate;
         put_varlength(pb, gatetime); /* duration */
 
         /* "nop" */
         put_varlength(pb, gatetime); /* start time */
-        put_buffer(pb, "\xff\x00", 2); /* nop */
+        avio_write(pb, "\xff\x00", 2); /* nop */
 
         /* "end of sequence" */
-        put_buffer(pb, "\x00\x00\x00\x00", 4);
+        avio_write(pb, "\x00\x00\x00\x00", 4);
 
-        url_fseek(pb, pos, SEEK_SET);
+        avio_seek(pb, pos, SEEK_SET);
 
-        put_flush_packet(pb);
+        avio_flush(pb);
     }
     return 0;
 }
@@ -183,20 +184,20 @@ static int mmf_read_header(AVFormatContext *s,
 {
     MMFContext *mmf = s->priv_data;
     unsigned int tag;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     int64_t file_size, size;
     int rate, params;
 
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
     if (tag != MKTAG('M', 'M', 'M', 'D'))
         return -1;
-    file_size = get_be32(pb);
+    file_size = avio_rb32(pb);
 
     /* Skip some unused chunks that may or may not be present */
-    for(;; url_fseek(pb, size, SEEK_CUR)) {
-        tag = get_le32(pb);
-        size = get_be32(pb);
+    for(;; avio_skip(pb, size)) {
+        tag = avio_rl32(pb);
+        size = avio_rb32(pb);
         if(tag == MKTAG('C','N','T','I')) continue;
         if(tag == MKTAG('O','P','D','A')) continue;
         break;
@@ -212,22 +213,22 @@ static int mmf_read_header(AVFormatContext *s,
         return -1;
     }
 
-    get_byte(pb); /* format type */
-    get_byte(pb); /* sequence type */
-    params = get_byte(pb); /* (channel << 7) | (format << 4) | rate */
+    avio_r8(pb); /* format type */
+    avio_r8(pb); /* sequence type */
+    params = avio_r8(pb); /* (channel << 7) | (format << 4) | rate */
     rate = mmf_rate(params & 0x0f);
     if(rate  < 0) {
         av_log(s, AV_LOG_ERROR, "Invalid sample rate\n");
         return -1;
     }
-    get_byte(pb); /* wave base bit */
-    get_byte(pb); /* time base d */
-    get_byte(pb); /* time base g */
+    avio_r8(pb); /* wave base bit */
+    avio_r8(pb); /* time base d */
+    avio_r8(pb); /* time base g */
 
     /* Skip some unused chunks that may or may not be present */
-    for(;; url_fseek(pb, size, SEEK_CUR)) {
-        tag = get_le32(pb);
-        size = get_be32(pb);
+    for(;; avio_skip(pb, size)) {
+        tag = avio_rl32(pb);
+        size = avio_rb32(pb);
         if(tag == MKTAG('A','t','s','q')) continue;
         if(tag == MKTAG('A','s','p','I')) continue;
         break;
@@ -265,7 +266,7 @@ static int mmf_read_packet(AVFormatContext *s,
     AVStream *st;
     int ret, size;
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR(EIO);
     st = s->streams[0];
 
@@ -280,7 +281,7 @@ static int mmf_read_packet(AVFormatContext *s,
         return AVERROR(EIO);
     pkt->stream_index = 0;
 
-    ret = get_buffer(s->pb, pkt->data, pkt->size);
+    ret = avio_read(s->pb, pkt->data, pkt->size);
     if (ret < 0)
         av_free_packet(pkt);
 
@@ -291,7 +292,7 @@ static int mmf_read_packet(AVFormatContext *s,
 }
 
 #if CONFIG_MMF_DEMUXER
-AVInputFormat mmf_demuxer = {
+AVInputFormat ff_mmf_demuxer = {
     "mmf",
     NULL_IF_CONFIG_SMALL("Yamaha SMAF"),
     sizeof(MMFContext),
@@ -303,7 +304,7 @@ AVInputFormat mmf_demuxer = {
 };
 #endif
 #if CONFIG_MMF_MUXER
-AVOutputFormat mmf_muxer = {
+AVOutputFormat ff_mmf_muxer = {
     "mmf",
     NULL_IF_CONFIG_SMALL("Yamaha SMAF"),
     "application/vnd.smaf",
diff --git a/ffmpeg-mt/libavformat/mms.c b/ffmpeg-mt/libavformat/mms.c
index d995a43..5796663 100644
--- a/ffmpeg-mt/libavformat/mms.c
+++ b/ffmpeg-mt/libavformat/mms.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2007 Björn Axelsson
  * Copyright (c) 2010 Zhentan Feng <spyfeng at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "mms.h"
@@ -115,6 +115,34 @@ int ff_mms_asf_header_parser(MMSContext *mms)
                        "Corrupt stream (too many A/V streams)\n");
                 return AVERROR_INVALIDDATA;
             }
+        } else if (!memcmp(p, ff_asf_ext_stream_header, sizeof(ff_asf_guid))) {
+            if (end - p >= 88) {
+                int stream_count = AV_RL16(p + 84), ext_len_count = AV_RL16(p + 86);
+                uint64_t skip_bytes = 88;
+                while (stream_count--) {
+                    if (end - p < skip_bytes + 4) {
+                        av_log(NULL, AV_LOG_ERROR,
+                               "Corrupt stream (next stream name length is not in the buffer)\n");
+                        return AVERROR_INVALIDDATA;
+                    }
+                    skip_bytes += 4 + AV_RL16(p + skip_bytes + 2);
+                }
+                while (ext_len_count--) {
+                    if (end - p < skip_bytes + 22) {
+                        av_log(NULL, AV_LOG_ERROR,
+                               "Corrupt stream (next extension system info length is not in the buffer)\n");
+                        return AVERROR_INVALIDDATA;
+                    }
+                    skip_bytes += 22 + AV_RL32(p + skip_bytes + 18);
+                }
+                if (end - p < skip_bytes) {
+                    av_log(NULL, AV_LOG_ERROR,
+                           "Corrupt stream (the last extension system info length is invalid)\n");
+                    return AVERROR_INVALIDDATA;
+                }
+                if (chunksize - skip_bytes > 24)
+                    chunksize = skip_bytes;
+            }
         } else if (!memcmp(p, ff_asf_head1_guid, sizeof(ff_asf_guid))) {
             chunksize = 46; // see references [2] section 3.4. This should be set 46.
         }
diff --git a/ffmpeg-mt/libavformat/mms.h b/ffmpeg-mt/libavformat/mms.h
index 31d71b4..12e9ef0 100644
--- a/ffmpeg-mt/libavformat/mms.h
+++ b/ffmpeg-mt/libavformat/mms.h
@@ -2,26 +2,26 @@
  * MMS protocol common definitions.
  * Copyright (c) 2010 Zhentan Feng <spyfeng at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVFORMAT_MMS_H
 #define AVFORMAT_MMS_H
 
-#include "avformat.h"
+#include "url.h"
 
 typedef struct {
     int id;
diff --git a/ffmpeg-mt/libavformat/mmsh.c b/ffmpeg-mt/libavformat/mmsh.c
index 3581431..1b9b494 100644
--- a/ffmpeg-mt/libavformat/mmsh.c
+++ b/ffmpeg-mt/libavformat/mmsh.c
@@ -2,20 +2,20 @@
  * MMS protocol over HTTP
  * Copyright (c) 2010 Zhentan Feng <spyfeng at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,6 +32,7 @@
 #include "mms.h"
 #include "asf.h"
 #include "http.h"
+#include "url.h"
 
 #define CHUNK_HEADER_LENGTH 4   // 2bytes chunk type and 2bytes chunk length.
 #define EXT_HEADER_LENGTH   8   // 4bytes sequence, 2bytes useless and 2bytes chunk length.
@@ -63,7 +64,7 @@ static int mmsh_close(URLContext *h)
     MMSHContext *mmsh = (MMSHContext *)h->priv_data;
     MMSContext *mms   = &mmsh->mms;
     if (mms->mms_hd)
-        url_close(mms->mms_hd);
+        ffurl_close(mms->mms_hd);
     av_free(mms->streams);
     av_free(mms->asf_header);
     av_freep(&h->priv_data);
@@ -78,7 +79,7 @@ static ChunkType get_chunk_header(MMSHContext *mmsh, int *len)
     ChunkType chunk_type;
     int chunk_len, res, ext_header_len;
 
-    res = url_read_complete(mms->mms_hd, chunk_header, CHUNK_HEADER_LENGTH);
+    res = ffurl_read_complete(mms->mms_hd, chunk_header, CHUNK_HEADER_LENGTH);
     if (res != CHUNK_HEADER_LENGTH) {
         av_log(NULL, AV_LOG_ERROR, "Read data packet header failed!\n");
         return AVERROR(EIO);
@@ -100,7 +101,7 @@ static ChunkType get_chunk_header(MMSHContext *mmsh, int *len)
         return AVERROR_INVALIDDATA;
     }
 
-    res = url_read_complete(mms->mms_hd, ext_header, ext_header_len);
+    res = ffurl_read_complete(mms->mms_hd, ext_header, ext_header_len);
     if (res != ext_header_len) {
         av_log(NULL, AV_LOG_ERROR, "Read ext header failed!\n");
         return AVERROR(EIO);
@@ -121,8 +122,8 @@ static int read_data_packet(MMSHContext *mmsh, const int len)
                len, sizeof(mms->in_buffer));
         return AVERROR(EIO);
     }
-    res = url_read_complete(mms->mms_hd, mms->in_buffer, len);
-    dprintf(NULL, "Data packet len = %d\n", len);
+    res = ffurl_read_complete(mms->mms_hd, mms->in_buffer, len);
+    av_dlog(NULL, "Data packet len = %d\n", len);
     if (res != len) {
         av_log(NULL, AV_LOG_ERROR, "Read data packet failed!\n");
         return AVERROR(EIO);
@@ -156,7 +157,7 @@ static int get_http_header_data(MMSHContext *mmsh)
                 if (mms->asf_header) {
                     if (len != mms->asf_header_size) {
                         mms->asf_header_size = len;
-                        dprintf(NULL, "Header len changed from %d to %d\n",
+                        av_dlog(NULL, "Header len changed from %d to %d\n",
                                 mms->asf_header_size, len);
                         av_freep(&mms->asf_header);
                     }
@@ -173,7 +174,7 @@ static int get_http_header_data(MMSHContext *mmsh)
                        len, mms->asf_header_size);
                 return AVERROR(EIO);
             }
-            res = url_read_complete(mms->mms_hd, mms->asf_header, len);
+            res = ffurl_read_complete(mms->mms_hd, mms->asf_header, len);
             if (res != len) {
                 av_log(NULL, AV_LOG_ERROR,
                        "Recv asf header data len %d != expected len %d\n", res, len);
@@ -196,12 +197,12 @@ static int get_http_header_data(MMSHContext *mmsh)
                            len, sizeof(mms->in_buffer));
                     return AVERROR(EIO);
                 }
-                res = url_read_complete(mms->mms_hd, mms->in_buffer, len);
+                res = ffurl_read_complete(mms->mms_hd, mms->in_buffer, len);
                 if (res != len) {
                     av_log(NULL, AV_LOG_ERROR, "Read other chunk type data failed!\n");
                     return AVERROR(EIO);
                 } else {
-                    dprintf(NULL, "Skip chunk type %d \n", chunk_type);
+                    av_dlog(NULL, "Skip chunk type %d \n", chunk_type);
                     continue;
                 }
             }
@@ -232,7 +233,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
         port = 80; // default mmsh protocol port
     ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path);
 
-    if (url_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) {
+    if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) {
         return AVERROR(EIO);
     }
 
@@ -247,7 +248,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
              host, port, mmsh->request_seq++);
     ff_http_set_headers(mms->mms_hd, headers);
 
-    err = url_connect(mms->mms_hd);
+    err = ffurl_connect(mms->mms_hd);
     if (err) {
         goto fail;
     }
@@ -258,9 +259,9 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
     }
 
     // close the socket and then reopen it for sending the second play request.
-    url_close(mms->mms_hd);
+    ffurl_close(mms->mms_hd);
     memset(headers, 0, sizeof(headers));
-    if (url_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) {
+    if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) {
         return AVERROR(EIO);
     }
     stream_selection = av_mallocz(mms->stream_num * 19 + 1);
@@ -290,10 +291,10 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
         av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n");
         goto fail;
     }
-    dprintf(NULL, "out_buffer is %s", headers);
+    av_dlog(NULL, "out_buffer is %s", headers);
     ff_http_set_headers(mms->mms_hd, headers);
 
-    err = url_connect(mms->mms_hd);
+    err = ffurl_connect(mms->mms_hd);
     if (err) {
           goto fail;
     }
@@ -304,12 +305,12 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
         goto fail;
     }
 
-    dprintf(NULL, "Connection successfully open\n");
+    av_dlog(NULL, "Connection successfully open\n");
     return 0;
 fail:
     av_freep(&stream_selection);
     mmsh_close(h);
-    dprintf(NULL, "Connection failed with error %d\n", err);
+    av_dlog(NULL, "Connection failed with error %d\n", err);
     return err;
 }
 
@@ -359,7 +360,7 @@ static int mmsh_read(URLContext *h, uint8_t *buf, int size)
     return res;
 }
 
-URLProtocol mmsh_protocol = {
+URLProtocol ff_mmsh_protocol = {
     .name      = "mmsh",
     .url_open  = mmsh_open,
     .url_read  = mmsh_read,
diff --git a/ffmpeg-mt/libavformat/mmst.c b/ffmpeg-mt/libavformat/mmst.c
index 57cca5d..a3f2609 100644
--- a/ffmpeg-mt/libavformat/mmst.c
+++ b/ffmpeg-mt/libavformat/mmst.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2007 Björn Axelsson
  * Copyright (c) 2010 Zhentan Feng <spyfeng at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,10 +31,11 @@
 #include "avformat.h"
 #include "mms.h"
 #include "internal.h"
+#include "avio_internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/bytestream.h"
 #include "network.h"
-#include "asf.h"
+#include "url.h"
 
 #define LOCAL_ADDRESS 0xc0a80081    // FIXME get and use correct local ip address.
 #define LOCAL_PORT    1037          // as above.
@@ -138,14 +139,14 @@ static int send_command_packet(MMSTContext *mmst)
     memset(mms->write_out_ptr, 0, exact_length - len);
 
     // write it out.
-    write_result= url_write(mms->mms_hd, mms->out_buffer, exact_length);
+    write_result= ffurl_write(mms->mms_hd, mms->out_buffer, exact_length);
     if(write_result != exact_length) {
         av_log(NULL, AV_LOG_ERROR,
                "Failed to write data of length %d: %d (%s)\n",
                exact_length, write_result,
                write_result < 0 ? strerror(write_result) :
                    "The server closed the connection");
-        return AVERROR_IO;
+        return AVERROR(EIO);
     }
 
     return 0;
@@ -153,13 +154,13 @@ static int send_command_packet(MMSTContext *mmst)
 
 static void mms_put_utf16(MMSContext *mms, uint8_t *src)
 {
-    ByteIOContext bic;
+    AVIOContext bic;
     int size = mms->write_out_ptr - mms->out_buffer;
     int len;
-    init_put_byte(&bic, mms->write_out_ptr,
+    ffio_init_context(&bic, mms->write_out_ptr,
             sizeof(mms->out_buffer) - size, 1, NULL, NULL, NULL, NULL);
 
-    len = ff_put_str16_nolen(&bic, src);
+    len = avio_put_str16le(&bic, src);
     mms->write_out_ptr += len;
 }
 
@@ -207,11 +208,11 @@ static int send_media_file_request(MMSTContext *mmst)
 static void handle_packet_stream_changing_type(MMSTContext *mmst)
 {
     MMSContext *mms = &mmst->mms;
-    dprintf(NULL, "Stream changing!\n");
+    av_dlog(NULL, "Stream changing!\n");
 
     // 40 is the packet header size, 7 is the prefix size.
     mmst->header_packet_id= AV_RL32(mms->in_buffer + 40 + 7);
-    dprintf(NULL, "Changed header prefix to 0x%x", mmst->header_packet_id);
+    av_dlog(NULL, "Changed header prefix to 0x%x", mmst->header_packet_id);
 }
 
 static int send_keepalive_packet(MMSTContext *mmst)
@@ -240,7 +241,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
     MMSSCPacketType packet_type= -1;
     MMSContext *mms = &mmst->mms;
     for(;;) {
-        read_result = url_read_complete(mms->mms_hd, mms->in_buffer, 8);
+        read_result = ffurl_read_complete(mms->mms_hd, mms->in_buffer, 8);
         if (read_result != 8) {
             if(read_result < 0) {
                 av_log(NULL, AV_LOG_ERROR,
@@ -260,18 +261,18 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
             int length_remaining, hr;
 
             mmst->incoming_flags= mms->in_buffer[3];
-            read_result= url_read_complete(mms->mms_hd, mms->in_buffer+8, 4);
+            read_result= ffurl_read_complete(mms->mms_hd, mms->in_buffer+8, 4);
             if(read_result != 4) {
                 av_log(NULL, AV_LOG_ERROR,
                        "Reading command packet length failed: %d (%s)\n",
                        read_result,
                        read_result < 0 ? strerror(read_result) :
                            "The server closed the connection");
-                return read_result < 0 ? read_result : AVERROR_IO;
+                return read_result < 0 ? read_result : AVERROR(EIO);
             }
 
             length_remaining= AV_RL32(mms->in_buffer+8) + 4;
-            dprintf(NULL, "Length remaining is %d\n", length_remaining);
+            av_dlog(NULL, "Length remaining is %d\n", length_remaining);
             // read the rest of the packet.
             if (length_remaining < 0
                 || length_remaining > sizeof(mms->in_buffer) - 12) {
@@ -280,7 +281,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
                        length_remaining, sizeof(mms->in_buffer) - 12);
                 return AVERROR_INVALIDDATA;
             }
-            read_result = url_read_complete(mms->mms_hd, mms->in_buffer + 12,
+            read_result = ffurl_read_complete(mms->mms_hd, mms->in_buffer + 12,
                                             length_remaining) ;
             if (read_result != length_remaining) {
                 av_log(NULL, AV_LOG_ERROR,
@@ -288,14 +289,13 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
                        length_remaining, read_result,
                        read_result < 0 ? strerror(read_result) :
                            "The server closed the connection");
-                return read_result < 0 ? read_result : AVERROR_IO;
+                return read_result < 0 ? read_result : AVERROR(EIO);
             }
             packet_type= AV_RL16(mms->in_buffer+36);
-            hr = AV_RL32(mms->in_buffer + 40);
-            if (hr) {
+            if (read_result >= 44 && (hr = AV_RL32(mms->in_buffer + 40))) {
                 av_log(NULL, AV_LOG_ERROR,
-                       "Server sent an error status code: 0x%08x\n", hr);
-                return AVERROR_UNKNOWN;
+                       "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr);
+                return AVERROR(EINVAL);
             }
         } else {
             int length_remaining;
@@ -319,14 +319,14 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
             }
             mms->remaining_in_len    = length_remaining;
             mms->read_in_ptr         = mms->in_buffer;
-            read_result= url_read_complete(mms->mms_hd, mms->in_buffer, length_remaining);
+            read_result= ffurl_read_complete(mms->mms_hd, mms->in_buffer, length_remaining);
             if(read_result != length_remaining) {
                 av_log(NULL, AV_LOG_ERROR,
                        "Failed to read packet data of size %d: %d (%s)\n",
                        length_remaining, read_result,
                        read_result < 0 ? strerror(read_result) :
                            "The server closed the connection");
-                return read_result < 0 ? read_result : AVERROR_IO;
+                return read_result < 0 ? read_result : AVERROR(EIO);
             }
 
             // if we successfully read everything.
@@ -351,7 +351,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
             } else if(packet_id_type == mmst->packet_id) {
                 packet_type = SC_PKT_ASF_MEDIA;
             } else {
-                dprintf(NULL, "packet id type %d is old.", packet_id_type);
+                av_dlog(NULL, "packet id type %d is old.", packet_id_type);
                 continue;
             }
         }
@@ -377,7 +377,7 @@ static int mms_safe_send_recv(MMSTContext *mmst,
     if(send_fun) {
         int ret = send_fun(mmst);
         if (ret < 0) {
-            dprintf(NULL, "Send Packet error before expecting recv packet %d\n", expect_type);
+            av_dlog(NULL, "Send Packet error before expecting recv packet %d\n", expect_type);
             return ret;
         }
     }
@@ -464,7 +464,7 @@ static int mms_close(URLContext *h)
     MMSContext *mms   = &mmst->mms;
     if(mms->mms_hd) {
         send_close_packet(mmst);
-        url_close(mms->mms_hd);
+        ffurl_close(mms->mms_hd);
     }
 
     /* free all separately allocated pointers in mms */
@@ -523,7 +523,7 @@ static int mms_open(URLContext *h, const char *uri, int flags)
 
     // establish tcp connection.
     ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mmst->host, port, NULL);
-    err = url_open(&mms->mms_hd, tcpname, URL_RDWR);
+    err = ffurl_open(&mms->mms_hd, tcpname, AVIO_RDWR);
     if (err)
         goto fail;
 
@@ -550,12 +550,12 @@ static int mms_open(URLContext *h, const char *uri, int flags)
     if((mmst->incoming_flags != 0X08) && (mmst->incoming_flags != 0X0C)) {
         av_log(NULL, AV_LOG_ERROR,
                "The server does not support MMST (try MMSH or RTSP)\n");
-        err = AVERROR_NOFMT;
+        err = AVERROR(EINVAL);
         goto fail;
     }
     err = ff_mms_asf_header_parser(mms);
     if (err) {
-        dprintf(NULL, "asf header parsed failed!\n");
+        av_dlog(NULL, "asf header parsed failed!\n");
         goto fail;
     }
     mms->header_parsed = 1;
@@ -572,11 +572,11 @@ static int mms_open(URLContext *h, const char *uri, int flags)
     if (err) {
         goto fail;
     }
-    dprintf(NULL, "Leaving open (success)\n");
+    av_dlog(NULL, "Leaving open (success)\n");
     return 0;
 fail:
     mms_close(h);
-    dprintf(NULL, "Leaving open (failure: %d)\n", err);
+    av_dlog(NULL, "Leaving open (failure: %d)\n", err);
     return err;
 }
 
@@ -604,17 +604,17 @@ static int mms_read(URLContext *h, uint8_t *buf, int size)
                     av_log(NULL, AV_LOG_ERROR,
                            "Incoming pktlen %d is larger than ASF pktsize %d\n",
                            mms->remaining_in_len, mms->asf_packet_len);
-                    result= AVERROR_IO;
+                    result= AVERROR(EIO);
                 } else {
                     // copy the data to the packet buffer.
                     result = ff_mms_read_data(mms, buf, size);
                     if (result == 0) {
-                        dprintf(NULL, "read asf media paket size is zero!\n");
+                        av_dlog(NULL, "read asf media paket size is zero!\n");
                         break;
                     }
                 }
             } else {
-                dprintf(NULL, "read packet error!\n");
+                av_dlog(NULL, "read packet error!\n");
                 break;
             }
         }
@@ -622,11 +622,9 @@ static int mms_read(URLContext *h, uint8_t *buf, int size)
     return result;
 }
 
-URLProtocol mmst_protocol = {
-    "mmst",
-    mms_open,
-    mms_read,
-    NULL, // write
-    NULL, // seek
-    mms_close,
+URLProtocol ff_mmst_protocol = {
+    .name      = "mmst",
+    .url_open  = mms_open,
+    .url_read  = mms_read,
+    .url_close = mms_close,
 };
diff --git a/ffmpeg-mt/libavformat/mov.c b/ffmpeg-mt/libavformat/mov.c
index 4370b48..61ceaac 100644
--- a/ffmpeg-mt/libavformat/mov.c
+++ b/ffmpeg-mt/libavformat/mov.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2001 Fabrice Bellard
  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,6 +29,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avstring.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "riff.h"
 #include "isom.h"
 #include "libavcodec/get_bits.h"
@@ -73,20 +74,20 @@
 /* links atom IDs to parse functions */
 typedef struct MOVParseTableEntry {
     uint32_t type;
-    int (*parse)(MOVContext *ctx, ByteIOContext *pb, MOVAtom atom);
+    int (*parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom);
 } MOVParseTableEntry;
 
 static const MOVParseTableEntry mov_default_parse_table[];
 
-static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len)
+static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len)
 {
     char buf[16];
 
-    get_be16(pb); // unknown
-    snprintf(buf, sizeof(buf), "%d", get_be16(pb));
+    avio_rb16(pb); // unknown
+    snprintf(buf, sizeof(buf), "%d", avio_rb16(pb));
     av_metadata_set2(&c->fc->metadata, "track", buf, 0);
 
-    get_be16(pb); // total tracks
+    avio_rb16(pb); // total tracks
 
     return 0;
 }
@@ -110,7 +111,7 @@ static const uint32_t mac_to_unicode[128] = {
     0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
 };
 
-static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len,
+static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len,
                                char *dst, int dstlen)
 {
     char *p = dst;
@@ -118,7 +119,7 @@ static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len,
     int i;
 
     for (i = 0; i < len; i++) {
-        uint8_t t, c = get_byte(pb);
+        uint8_t t, c = avio_r8(pb);
         if (c < 0x80 && p < end)
             *p++ = c;
         else
@@ -128,7 +129,7 @@ static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len,
     return p - dst;
 }
 
-static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 #ifdef MOV_EXPORT_ALL_METADATA
     char tmp_key[5];
@@ -137,7 +138,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     const char *key = NULL;
     uint16_t str_size, langcode = 0;
     uint32_t data_type = 0;
-    int (*parse)(MOVContext*, ByteIOContext*, unsigned) = NULL;
+    int (*parse)(MOVContext*, AVIOContext*, unsigned) = NULL;
 
     switch (atom.type) {
     case MKTAG(0xa9,'n','a','m'): key = "title";     break;
@@ -164,17 +165,17 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     }
 
     if (c->itunes_metadata && atom.size > 8) {
-        int data_size = get_be32(pb);
-        int tag = get_le32(pb);
+        int data_size = avio_rb32(pb);
+        int tag = avio_rl32(pb);
         if (tag == MKTAG('d','a','t','a')) {
-            data_type = get_be32(pb); // type
-            get_be32(pb); // unknown
+            data_type = avio_rb32(pb); // type
+            avio_rb32(pb); // unknown
             str_size = data_size - 16;
             atom.size -= 16;
         } else return 0;
     } else if (atom.size > 4 && key && !c->itunes_metadata) {
-        str_size = get_be16(pb); // string length
-        langcode = get_be16(pb);
+        str_size = avio_rb16(pb); // string length
+        langcode = avio_rb16(pb);
         ff_mov_lang_to_iso639(langcode, language);
         atom.size -= 4;
     } else
@@ -200,7 +201,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded
             mov_read_mac_string(c, pb, str_size, str, sizeof(str));
         } else {
-            get_buffer(pb, str, str_size);
+            avio_read(pb, str, str_size);
             str[str_size] = 0;
         }
         av_metadata_set2(&c->fc->metadata, key, str, 0);
@@ -218,7 +219,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return 0;
 }
 
-static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     int64_t start;
     int i, nb_chapters, str_len, version;
@@ -227,30 +228,30 @@ static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     if ((atom.size -= 5) < 0)
         return 0;
 
-    version = get_byte(pb);
-    get_be24(pb);
+    version = avio_r8(pb);
+    avio_rb24(pb);
     if (version)
-        get_be32(pb); // ???
-    nb_chapters = get_byte(pb);
+        avio_rb32(pb); // ???
+    nb_chapters = avio_r8(pb);
 
     for (i = 0; i < nb_chapters; i++) {
         if (atom.size < 9)
             return 0;
 
-        start = get_be64(pb);
-        str_len = get_byte(pb);
+        start = avio_rb64(pb);
+        str_len = avio_r8(pb);
 
         if ((atom.size -= 9+str_len) < 0)
             return 0;
 
-        get_buffer(pb, str, str_len);
+        avio_read(pb, str, str_len);
         str[str_len] = 0;
         ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str);
     }
     return 0;
 }
 
-static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     int64_t total_size = 0;
     MOVAtom a;
@@ -258,19 +259,19 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 
     if (atom.size < 0)
         atom.size = INT64_MAX;
-    while (total_size + 8 < atom.size && !url_feof(pb)) {
-        int (*parse)(MOVContext*, ByteIOContext*, MOVAtom) = NULL;
+    while (total_size + 8 < atom.size && !pb->eof_reached) {
+        int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
         a.size = atom.size;
         a.type=0;
         if(atom.size >= 8) {
-            a.size = get_be32(pb);
-            a.type = get_le32(pb);
+            a.size = avio_rb32(pb);
+            a.type = avio_rl32(pb);
         }
-        dprintf(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
+        av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
                 a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
         total_size += 8;
         if (a.size == 1) { /* 64 bit extended size */
-            a.size = get_be64(pb) - 8;
+            a.size = avio_rb64(pb) - 8;
             total_size += 8;
         }
         if (a.size == 0) {
@@ -295,31 +296,31 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
             parse = mov_read_udta_string;
 
         if (!parse) { /* skip leaf atoms data */
-            url_fskip(pb, a.size);
+            avio_skip(pb, a.size);
         } else {
-            int64_t start_pos = url_ftell(pb);
+            int64_t start_pos = avio_tell(pb);
             int64_t left;
             int err = parse(c, pb, a);
             if (err < 0)
                 return err;
             if (c->found_moov && c->found_mdat &&
-                (url_is_streamed(pb) || start_pos + a.size == url_fsize(pb)))
+                (!pb->seekable || start_pos + a.size == avio_size(pb)))
                 return 0;
-            left = a.size - url_ftell(pb) + start_pos;
+            left = a.size - avio_tell(pb) + start_pos;
             if (left > 0) /* skip garbage at atom end */
-                url_fskip(pb, left);
+                avio_skip(pb, left);
         }
 
         total_size += a.size;
     }
 
     if (total_size < atom.size && atom.size < 0x7ffff)
-        url_fskip(pb, atom.size - total_size);
+        avio_skip(pb, atom.size - total_size);
 
     return 0;
 }
 
-static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -330,8 +331,8 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_be32(pb); // version + flags
-    entries = get_be32(pb);
+    avio_rb32(pb); // version + flags
+    entries = avio_rb32(pb);
     if (entries >= UINT_MAX / sizeof(*sc->drefs))
         return -1;
     sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
@@ -341,50 +342,50 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 
     for (i = 0; i < sc->drefs_count; i++) {
         MOVDref *dref = &sc->drefs[i];
-        uint32_t size = get_be32(pb);
-        int64_t next = url_ftell(pb) + size - 4;
+        uint32_t size = avio_rb32(pb);
+        int64_t next = avio_tell(pb) + size - 4;
 
         if (size < 12)
             return -1;
 
-        dref->type = get_le32(pb);
-        get_be32(pb); // version + flags
-        dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
+        dref->type = avio_rl32(pb);
+        avio_rb32(pb); // version + flags
+        av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
 
         if (dref->type == MKTAG('a','l','i','s') && size > 150) {
             /* macintosh alias record */
             uint16_t volume_len, len;
             int16_t type;
 
-            url_fskip(pb, 10);
+            avio_skip(pb, 10);
 
-            volume_len = get_byte(pb);
+            volume_len = avio_r8(pb);
             volume_len = FFMIN(volume_len, 27);
-            get_buffer(pb, dref->volume, 27);
+            avio_read(pb, dref->volume, 27);
             dref->volume[volume_len] = 0;
             av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len);
 
-            url_fskip(pb, 12);
+            avio_skip(pb, 12);
 
-            len = get_byte(pb);
+            len = avio_r8(pb);
             len = FFMIN(len, 63);
-            get_buffer(pb, dref->filename, 63);
+            avio_read(pb, dref->filename, 63);
             dref->filename[len] = 0;
             av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len);
 
-            url_fskip(pb, 16);
+            avio_skip(pb, 16);
 
             /* read next level up_from_alias/down_to_target */
-            dref->nlvl_from = get_be16(pb);
-            dref->nlvl_to   = get_be16(pb);
+            dref->nlvl_from = avio_rb16(pb);
+            dref->nlvl_to   = avio_rb16(pb);
             av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n",
                    dref->nlvl_from, dref->nlvl_to);
 
-            url_fskip(pb, 16);
+            avio_skip(pb, 16);
 
-            for (type = 0; type != -1 && url_ftell(pb) < next; ) {
-                type = get_be16(pb);
-                len = get_be16(pb);
+            for (type = 0; type != -1 && avio_tell(pb) < next; ) {
+                type = avio_rb16(pb);
+                len = avio_rb16(pb);
                 av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
                 if (len&1)
                     len += 1;
@@ -393,7 +394,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
                     dref->path = av_mallocz(len+1);
                     if (!dref->path)
                         return AVERROR(ENOMEM);
-                    get_buffer(pb, dref->path, len);
+                    avio_read(pb, dref->path, len);
                     if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) {
                         len -= volume_len;
                         memmove(dref->path, dref->path+volume_len, len);
@@ -408,22 +409,22 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
                     dref->dir = av_malloc(len+1);
                     if (!dref->dir)
                         return AVERROR(ENOMEM);
-                    get_buffer(pb, dref->dir, len);
+                    avio_read(pb, dref->dir, len);
                     dref->dir[len] = 0;
                     for (j = 0; j < len; j++)
                         if (dref->dir[j] == ':')
                             dref->dir[j] = '/';
                     av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir);
                 } else
-                    url_fskip(pb, len);
+                    avio_skip(pb, len);
             }
         }
-        url_fseek(pb, next, SEEK_SET);
+        avio_seek(pb, next, SEEK_SET);
     }
     return 0;
 }
 
-static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     uint32_t type;
@@ -434,15 +435,15 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 
     st = c->fc->streams[c->fc->nb_streams-1];
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
 
     /* component type */
-    ctype = get_le32(pb);
-    type = get_le32(pb); /* component subtype */
+    ctype = avio_rl32(pb);
+    type = avio_rl32(pb); /* component subtype */
 
-    dprintf(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
-    dprintf(c->fc, "stype= %.4s\n", (char*)&type);
+    av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
+    av_dlog(c->fc, "stype= %.4s\n", (char*)&type);
 
     if     (type == MKTAG('v','i','d','e'))
         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -453,14 +454,14 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     else if(type == MKTAG('s','u','b','p'))
         st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
 
-    get_be32(pb); /* component  manufacture */
-    get_be32(pb); /* component flags */
-    get_be32(pb); /* component flags mask */
+    avio_rb32(pb); /* component  manufacture */
+    avio_rb32(pb); /* component flags */
+    avio_rb32(pb); /* component flags mask */
 
     return 0;
 }
 
-int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
+int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     int tag, len;
@@ -469,13 +470,13 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
         return 0;
     st = fc->streams[fc->nb_streams-1];
 
-    get_be32(pb); /* version + flags */
+    avio_rb32(pb); /* version + flags */
     len = ff_mp4_read_descr(fc, pb, &tag);
     if (tag == MP4ESDescrTag) {
-        get_be16(pb); /* ID */
-        get_byte(pb); /* priority */
+        avio_rb16(pb); /* ID */
+        avio_r8(pb); /* priority */
     } else
-        get_be16(pb); /* ID */
+        avio_rb16(pb); /* ID */
 
     len = ff_mp4_read_descr(fc, pb, &tag);
     if (tag == MP4DecConfigDescrTag)
@@ -483,32 +484,36 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
     return 0;
 }
 
-static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     return ff_mov_read_esds(c->fc, pb, atom);
 }
 
-static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
-    int ac3info, acmod, lfeon;
+    int ac3info, acmod, lfeon, bsmod;
 
     if (c->fc->nb_streams < 1)
         return 0;
     st = c->fc->streams[c->fc->nb_streams-1];
 
-    ac3info = get_be24(pb);
+    ac3info = avio_rb24(pb);
+    bsmod = (ac3info >> 14) & 0x7;
     acmod = (ac3info >> 11) & 0x7;
     lfeon = (ac3info >> 10) & 0x1;
     st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
+    st->codec->audio_service_type = bsmod;
+    if (st->codec->channels > 1 && bsmod == 0x7)
+        st->codec->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
 
     return 0;
 }
 
-static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
-    const int num = get_be32(pb);
-    const int den = get_be32(pb);
+    const int num = avio_rb32(pb);
+    const int den = avio_rb32(pb);
     AVStream *st;
 
     if (c->fc->nb_streams < 1)
@@ -529,7 +534,7 @@ static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 }
 
 /* this atom contains actual media data */
-static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_mdat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     if(atom.size == 0) /* wrong one (MP4) */
         return 0;
@@ -538,7 +543,7 @@ static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 }
 
 /* read major brand, minor version and compatible brands and store them as metadata */
-static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     uint32_t minor_ver;
     int comp_brand_size;
@@ -546,12 +551,12 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     char* comp_brands_str;
     uint8_t type[5] = {0};
 
-    get_buffer(pb, type, 4);
+    avio_read(pb, type, 4);
     if (strcmp(type, "qt  "))
         c->isom = 1;
     av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type);
     av_metadata_set2(&c->fc->metadata, "major_brand", type, 0);
-    minor_ver = get_be32(pb); /* minor version */
+    minor_ver = avio_rb32(pb); /* minor version */
     snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver);
     av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0);
 
@@ -561,7 +566,7 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null terminator */
     if (!comp_brands_str)
         return AVERROR(ENOMEM);
-    get_buffer(pb, comp_brands_str, comp_brand_size);
+    avio_read(pb, comp_brands_str, comp_brand_size);
     comp_brands_str[comp_brand_size] = 0;
     av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0);
     av_freep(&comp_brands_str);
@@ -570,7 +575,7 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 }
 
 /* this atom should contain all header atoms */
-static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     if (mov_read_default(c, pb, atom) < 0)
         return -1;
@@ -580,10 +585,10 @@ static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return 0; /* now go for mdat */
 }
 
-static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
-    c->fragment.moof_offset = url_ftell(pb) - 8;
-    dprintf(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
+    c->fragment.moof_offset = avio_tell(pb) - 8;
+    av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
     return mov_read_default(c, pb, atom);
 }
 
@@ -600,7 +605,7 @@ static void mov_metadata_creation_time(AVMetadata **metadata, time_t time)
     }
 }
 
-static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -614,70 +619,70 @@ static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    version = get_byte(pb);
+    version = avio_r8(pb);
     if (version > 1)
         return -1; /* unsupported */
 
-    get_be24(pb); /* flags */
+    avio_rb24(pb); /* flags */
     if (version == 1) {
-        creation_time = get_be64(pb);
-        get_be64(pb);
+        creation_time = avio_rb64(pb);
+        avio_rb64(pb);
     } else {
-        creation_time = get_be32(pb);
-        get_be32(pb); /* modification time */
+        creation_time = avio_rb32(pb);
+        avio_rb32(pb); /* modification time */
     }
     mov_metadata_creation_time(&st->metadata, creation_time);
 
-    sc->time_scale = get_be32(pb);
-    st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
+    sc->time_scale = avio_rb32(pb);
+    st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */
 
-    lang = get_be16(pb); /* language */
+    lang = avio_rb16(pb); /* language */
     if (ff_mov_lang_to_iso639(lang, language))
         av_metadata_set2(&st->metadata, "language", language, 0);
-    get_be16(pb); /* quality */
+    avio_rb16(pb); /* quality */
 
     return 0;
 }
 
-static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     time_t creation_time;
-    int version = get_byte(pb); /* version */
-    get_be24(pb); /* flags */
+    int version = avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
 
     if (version == 1) {
-        creation_time = get_be64(pb);
-        get_be64(pb);
+        creation_time = avio_rb64(pb);
+        avio_rb64(pb);
     } else {
-        creation_time = get_be32(pb);
-        get_be32(pb); /* modification time */
+        creation_time = avio_rb32(pb);
+        avio_rb32(pb); /* modification time */
     }
     mov_metadata_creation_time(&c->fc->metadata, creation_time);
-    c->time_scale = get_be32(pb); /* time scale */
+    c->time_scale = avio_rb32(pb); /* time scale */
 
-    dprintf(c->fc, "time scale = %i\n", c->time_scale);
+    av_dlog(c->fc, "time scale = %i\n", c->time_scale);
 
-    c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
-    get_be32(pb); /* preferred scale */
+    c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */
+    avio_rb32(pb); /* preferred scale */
 
-    get_be16(pb); /* preferred volume */
+    avio_rb16(pb); /* preferred volume */
 
-    url_fskip(pb, 10); /* reserved */
+    avio_skip(pb, 10); /* reserved */
 
-    url_fskip(pb, 36); /* display matrix */
+    avio_skip(pb, 36); /* display matrix */
 
-    get_be32(pb); /* preview time */
-    get_be32(pb); /* preview duration */
-    get_be32(pb); /* poster time */
-    get_be32(pb); /* selection time */
-    get_be32(pb); /* selection duration */
-    get_be32(pb); /* current time */
-    get_be32(pb); /* next track ID */
+    avio_rb32(pb); /* preview time */
+    avio_rb32(pb); /* preview duration */
+    avio_rb32(pb); /* poster time */
+    avio_rb32(pb); /* selection time */
+    avio_rb32(pb); /* selection duration */
+    avio_rb32(pb); /* current time */
+    avio_rb32(pb); /* next track ID */
 
     return 0;
 }
 
-static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
 
@@ -696,12 +701,12 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         return AVERROR(ENOMEM);
     st->codec->extradata_size = 0x5a + atom.size;
     memcpy(st->codec->extradata, "SVQ3", 4); // fake
-    get_buffer(pb, st->codec->extradata + 0x5a, atom.size);
-    dprintf(c->fc, "Reading SMI %"PRId64"  %s\n", atom.size, st->codec->extradata + 0x5a);
+    avio_read(pb, st->codec->extradata + 0x5a, atom.size);
+    av_dlog(c->fc, "Reading SMI %"PRId64"  %s\n", atom.size, st->codec->extradata + 0x5a);
     return 0;
 }
 
-static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     int little_endian;
@@ -710,8 +715,8 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         return 0;
     st = c->fc->streams[c->fc->nb_streams-1];
 
-    little_endian = get_be16(pb);
-    dprintf(c->fc, "enda %d\n", little_endian);
+    little_endian = avio_rb16(pb);
+    av_dlog(c->fc, "enda %d\n", little_endian);
     if (little_endian == 1) {
         switch (st->codec->codec_id) {
         case CODEC_ID_PCM_S24BE:
@@ -734,7 +739,7 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 }
 
 /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */
-static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     uint64_t size;
@@ -754,11 +759,11 @@ static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;
     AV_WB32(       buf    , atom.size + 8);
     AV_WL32(       buf + 4, atom.type);
-    get_buffer(pb, buf + 8, atom.size);
+    avio_read(pb, buf + 8, atom.size);
     return 0;
 }
 
-static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
 
@@ -769,19 +774,19 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     if((uint64_t)atom.size > (1<<30))
         return -1;
 
-    if (st->codec->codec_id == CODEC_ID_QDM2) {
-        // pass all frma atom to codec, needed at least for QDM2
+    if (st->codec->codec_id == CODEC_ID_QDM2 || st->codec->codec_id == CODEC_ID_QDMC) {
+        // pass all frma atom to codec, needed at least for QDMC and QDM2
         av_free(st->codec->extradata);
         st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);
         if (!st->codec->extradata)
             return AVERROR(ENOMEM);
         st->codec->extradata_size = atom.size;
-        get_buffer(pb, st->codec->extradata, atom.size);
+        avio_read(pb, st->codec->extradata, atom.size);
     } else if (atom.size > 8) { /* to read frma, esds atoms */
         if (mov_read_default(c, pb, atom) < 0)
             return -1;
     } else
-        url_fskip(pb, atom.size);
+        avio_skip(pb, atom.size);
     return 0;
 }
 
@@ -789,7 +794,7 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
  * This function reads atom content and puts data in extradata without tag
  * nor size unlike mov_read_extradata.
  */
-static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
 
@@ -805,7 +810,7 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     if (!st->codec->extradata)
         return AVERROR(ENOMEM);
     st->codec->extradata_size = atom.size;
-    get_buffer(pb, st->codec->extradata, atom.size);
+    avio_read(pb, st->codec->extradata, atom.size);
     return 0;
 }
 
@@ -814,7 +819,7 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
  * but can have extradata appended at the end after the 40 bytes belonging
  * to the struct.
  */
-static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
 
@@ -832,12 +837,12 @@ static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     if (!st->codec->extradata)
         return AVERROR(ENOMEM);
     st->codec->extradata_size = atom.size - 40;
-    url_fskip(pb, 40);
-    get_buffer(pb, st->codec->extradata, atom.size - 40);
+    avio_skip(pb, 40);
+    avio_read(pb, st->codec->extradata, atom.size - 40);
     return 0;
 }
 
-static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -848,10 +853,10 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
 
-    entries = get_be32(pb);
+    entries = avio_rb32(pb);
 
     if(entries >= UINT_MAX/sizeof(int64_t))
         return -1;
@@ -863,10 +868,10 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 
     if      (atom.type == MKTAG('s','t','c','o'))
         for(i=0; i<entries; i++)
-            sc->chunk_offsets[i] = get_be32(pb);
+            sc->chunk_offsets[i] = avio_rb32(pb);
     else if (atom.type == MKTAG('c','o','6','4'))
         for(i=0; i<entries; i++)
-            sc->chunk_offsets[i] = get_be64(pb);
+            sc->chunk_offsets[i] = avio_rb64(pb);
     else
         return -1;
 
@@ -908,7 +913,7 @@ enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
     return CODEC_ID_NONE;
 }
 
-int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
+int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -924,14 +929,14 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
         enum CodecID id;
         int dref_id = 1;
         MOVAtom a = { AV_RL32("stsd") };
-        int64_t start_pos = url_ftell(pb);
-        int size = get_be32(pb); /* size */
-        uint32_t format = get_le32(pb); /* data format */
+        int64_t start_pos = avio_tell(pb);
+        int size = avio_rb32(pb); /* size */
+        uint32_t format = avio_rl32(pb); /* data format */
 
         if (size >= 16) {
-            get_be32(pb); /* reserved */
-            get_be16(pb); /* reserved */
-            dref_id = get_be16(pb);
+            avio_rb32(pb); /* reserved */
+            avio_rb16(pb); /* reserved */
+            dref_id = avio_rb16(pb);
         }
 
         if (st->codec->codec_tag &&
@@ -944,7 +949,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
              * in the MOV demuxer, patch welcome. */
         multiple_stsd:
             av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");
-            url_fskip(pb, size - (url_ftell(pb) - start_pos));
+            avio_skip(pb, size - (avio_tell(pb) - start_pos));
             continue;
         }
         /* we cannot demux concatenated h264 streams because of different extradata */
@@ -974,7 +979,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
             }
         }
 
-        dprintf(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
+        av_dlog(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
                 (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
                 (format >> 24) & 0xff, st->codec->codec_type);
 
@@ -983,33 +988,33 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
             int color_greyscale;
 
             st->codec->codec_id = id;
-            get_be16(pb); /* version */
-            get_be16(pb); /* revision level */
-            get_be32(pb); /* vendor */
-            get_be32(pb); /* temporal quality */
-            get_be32(pb); /* spatial quality */
+            avio_rb16(pb); /* version */
+            avio_rb16(pb); /* revision level */
+            avio_rb32(pb); /* vendor */
+            avio_rb32(pb); /* temporal quality */
+            avio_rb32(pb); /* spatial quality */
 
-            st->codec->width = get_be16(pb); /* width */
-            st->codec->height = get_be16(pb); /* height */
+            st->codec->width = avio_rb16(pb); /* width */
+            st->codec->height = avio_rb16(pb); /* height */
 
-            get_be32(pb); /* horiz resolution */
-            get_be32(pb); /* vert resolution */
-            get_be32(pb); /* data size, always 0 */
-            get_be16(pb); /* frames per samples */
+            avio_rb32(pb); /* horiz resolution */
+            avio_rb32(pb); /* vert resolution */
+            avio_rb32(pb); /* data size, always 0 */
+            avio_rb16(pb); /* frames per samples */
 
-            len = get_byte(pb); /* codec name, pascal string */
+            len = avio_r8(pb); /* codec name, pascal string */
             if (len > 31)
                 len = 31;
             mov_read_mac_string(c, pb, len, st->codec->codec_name, 32);
             if (len < 31)
-                url_fskip(pb, 31 - len);
+                avio_skip(pb, 31 - len);
             /* codec_tag YV12 triggers an UV swap in rawdec.c */
             if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
                 st->codec->codec_tag=MKTAG('I', '4', '2', '0');
 
-            st->codec->bits_per_coded_sample = get_be16(pb); /* depth */
-            st->codec->color_table_id = get_be16(pb); /* colortable id */
-            dprintf(c->fc, "depth %d, ctab id %d\n",
+            st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */
+            st->codec->color_table_id = avio_rb16(pb); /* colortable id */
+            av_dlog(c->fc, "depth %d, ctab id %d\n",
                    st->codec->bits_per_coded_sample, st->codec->color_table_id);
             /* figure out the palette situation */
             color_depth = st->codec->bits_per_coded_sample & 0x1F;
@@ -1058,23 +1063,23 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
                     }
                 } else {
                     /* load the palette from the file */
-                    color_start = get_be32(pb);
-                    color_count = get_be16(pb);
-                    color_end = get_be16(pb);
+                    color_start = avio_rb32(pb);
+                    color_count = avio_rb16(pb);
+                    color_end = avio_rb16(pb);
                     if ((color_start <= 255) &&
                         (color_end <= 255)) {
                         for (j = color_start; j <= color_end; j++) {
                             /* each R, G, or B component is 16 bits;
                              * only use the top 8 bits; skip alpha bytes
                              * up front */
-                            get_byte(pb);
-                            get_byte(pb);
-                            r = get_byte(pb);
-                            get_byte(pb);
-                            g = get_byte(pb);
-                            get_byte(pb);
-                            b = get_byte(pb);
-                            get_byte(pb);
+                            avio_r8(pb);
+                            avio_r8(pb);
+                            r = avio_r8(pb);
+                            avio_r8(pb);
+                            g = avio_r8(pb);
+                            avio_r8(pb);
+                            b = avio_r8(pb);
+                            avio_r8(pb);
                             st->codec->palctrl->palette[j] =
                                 (r << 16) | (g << 8) | (b);
                         }
@@ -1084,38 +1089,38 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
             }
         } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
             int bits_per_sample, flags;
-            uint16_t version = get_be16(pb);
+            uint16_t version = avio_rb16(pb);
 
             st->codec->codec_id = id;
-            get_be16(pb); /* revision level */
-            get_be32(pb); /* vendor */
+            avio_rb16(pb); /* revision level */
+            avio_rb32(pb); /* vendor */
 
-            st->codec->channels = get_be16(pb);             /* channel count */
-            dprintf(c->fc, "audio channels %d\n", st->codec->channels);
-            st->codec->bits_per_coded_sample = get_be16(pb);      /* sample size */
+            st->codec->channels = avio_rb16(pb);             /* channel count */
+            av_dlog(c->fc, "audio channels %d\n", st->codec->channels);
+            st->codec->bits_per_coded_sample = avio_rb16(pb);      /* sample size */
 
-            sc->audio_cid = get_be16(pb);
-            get_be16(pb); /* packet size = 0 */
+            sc->audio_cid = avio_rb16(pb);
+            avio_rb16(pb); /* packet size = 0 */
 
-            st->codec->sample_rate = ((get_be32(pb) >> 16));
+            st->codec->sample_rate = ((avio_rb32(pb) >> 16));
 
             //Read QT version 1 fields. In version 0 these do not exist.
-            dprintf(c->fc, "version =%d, isom =%d\n",version,c->isom);
+            av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom);
             if(!c->isom) {
                 if(version==1) {
-                    sc->samples_per_frame = get_be32(pb);
-                    get_be32(pb); /* bytes per packet */
-                    sc->bytes_per_frame = get_be32(pb);
-                    get_be32(pb); /* bytes per sample */
+                    sc->samples_per_frame = avio_rb32(pb);
+                    avio_rb32(pb); /* bytes per packet */
+                    sc->bytes_per_frame = avio_rb32(pb);
+                    avio_rb32(pb); /* bytes per sample */
                 } else if(version==2) {
-                    get_be32(pb); /* sizeof struct only */
-                    st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */
-                    st->codec->channels = get_be32(pb);
-                    get_be32(pb); /* always 0x7F000000 */
-                    st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */
-                    flags = get_be32(pb); /* lpcm format specific flag */
-                    sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */
-                    sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */
+                    avio_rb32(pb); /* sizeof struct only */
+                    st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); /* float 64 */
+                    st->codec->channels = avio_rb32(pb);
+                    avio_rb32(pb); /* always 0x7F000000 */
+                    st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */
+                    flags = avio_rb32(pb); /* lpcm format specific flag */
+                    sc->bytes_per_frame = avio_rb32(pb); /* bytes per audio packet if constant */
+                    sc->samples_per_frame = avio_rb32(pb); /* lpcm frames per audio packet if constant */
                     if (format == MKTAG('l','p','c','m'))
                         st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
                 }
@@ -1165,7 +1170,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
         } else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
             // ttxt stsd contains display flags, justification, background
             // color, fonts, and default styles, so fake an atom to read it
-            MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
+            MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) };
             if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom
                 mov_read_glbl(c, pb, fake_atom);
             st->codec->codec_id= id;
@@ -1173,15 +1178,15 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
             st->codec->height = sc->height;
         } else {
             /* other codec type, just skip (rtp, mp4s, tmcd ...) */
-            url_fskip(pb, size - (url_ftell(pb) - start_pos));
+            avio_skip(pb, size - (avio_tell(pb) - start_pos));
         }
         /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */
-        a.size = size - (url_ftell(pb) - start_pos);
+        a.size = size - (avio_tell(pb) - start_pos);
         if (a.size > 8) {
             if (mov_read_default(c, pb, a) < 0)
                 return -1;
         } else if (a.size > 0)
-            url_fskip(pb, a.size);
+            avio_skip(pb, a.size);
     }
 
     if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
@@ -1227,6 +1232,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
     case CODEC_ID_GSM:
     case CODEC_ID_ADPCM_MS:
     case CODEC_ID_ADPCM_IMA_WAV:
+        st->codec->frame_size = sc->samples_per_frame;
         st->codec->block_align = sc->bytes_per_frame;
         break;
     case CODEC_ID_ALAC:
@@ -1243,18 +1249,18 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
     return 0;
 }
 
-static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     int entries;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    entries = get_be32(pb);
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
+    entries = avio_rb32(pb);
 
     return ff_mov_read_stsd_entries(c, pb, entries);
 }
 
-static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1265,12 +1271,12 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
 
-    entries = get_be32(pb);
+    entries = avio_rb32(pb);
 
-    dprintf(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
+    av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
 
     if(entries >= UINT_MAX / sizeof(*sc->stsc_data))
         return -1;
@@ -1280,14 +1286,14 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     sc->stsc_count = entries;
 
     for(i=0; i<entries; i++) {
-        sc->stsc_data[i].first = get_be32(pb);
-        sc->stsc_data[i].count = get_be32(pb);
-        sc->stsc_data[i].id = get_be32(pb);
+        sc->stsc_data[i].first = avio_rb32(pb);
+        sc->stsc_data[i].count = avio_rb32(pb);
+        sc->stsc_data[i].id = avio_rb32(pb);
     }
     return 0;
 }
 
-static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1298,9 +1304,9 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_be32(pb); // version + flags
+    avio_rb32(pb); // version + flags
 
-    entries = get_be32(pb);
+    entries = avio_rb32(pb);
     if (entries >= UINT_MAX / sizeof(*sc->stps_data))
         return -1;
     sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data));
@@ -1309,14 +1315,14 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     sc->stps_count = entries;
 
     for (i = 0; i < entries; i++) {
-        sc->stps_data[i] = get_be32(pb);
-        //dprintf(c->fc, "stps %d\n", sc->stps_data[i]);
+        sc->stps_data[i] = avio_rb32(pb);
+        //av_dlog(c->fc, "stps %d\n", sc->stps_data[i]);
     }
 
     return 0;
 }
 
-static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1327,12 +1333,12 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
 
-    entries = get_be32(pb);
+    entries = avio_rb32(pb);
 
-    dprintf(c->fc, "keyframe_count = %d\n", entries);
+    av_dlog(c->fc, "keyframe_count = %d\n", entries);
 
     if(entries >= UINT_MAX / sizeof(int))
         return -1;
@@ -1342,13 +1348,13 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     sc->keyframe_count = entries;
 
     for(i=0; i<entries; i++) {
-        sc->keyframes[i] = get_be32(pb);
-        //dprintf(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
+        sc->keyframes[i] = avio_rb32(pb);
+        //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
     }
     return 0;
 }
 
-static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1361,22 +1367,22 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
 
     if (atom.type == MKTAG('s','t','s','z')) {
-        sample_size = get_be32(pb);
+        sample_size = avio_rb32(pb);
         if (!sc->sample_size) /* do not overwrite value computed in stsd */
             sc->sample_size = sample_size;
         field_size = 32;
     } else {
         sample_size = 0;
-        get_be24(pb); /* reserved */
-        field_size = get_byte(pb);
+        avio_rb24(pb); /* reserved */
+        field_size = avio_r8(pb);
     }
-    entries = get_be32(pb);
+    entries = avio_rb32(pb);
 
-    dprintf(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries);
+    av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries);
 
     sc->sample_count = entries;
     if (sample_size)
@@ -1401,7 +1407,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         return AVERROR(ENOMEM);
     }
 
-    if (get_buffer(pb, buf, num_bytes) < num_bytes) {
+    if (avio_read(pb, buf, num_bytes) < num_bytes) {
         av_freep(&sc->sample_sizes);
         av_free(buf);
         return -1;
@@ -1416,7 +1422,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return 0;
 }
 
-static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1429,11 +1435,11 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    entries = get_be32(pb);
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
+    entries = avio_rb32(pb);
 
-    dprintf(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
+    av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
 
     if(entries >= UINT_MAX / sizeof(*sc->stts_data))
         return -1;
@@ -1446,12 +1452,12 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         int sample_duration;
         int sample_count;
 
-        sample_count=get_be32(pb);
-        sample_duration = get_be32(pb);
+        sample_count=avio_rb32(pb);
+        sample_duration = avio_rb32(pb);
         sc->stts_data[i].count= sample_count;
         sc->stts_data[i].duration= sample_duration;
 
-        dprintf(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration);
+        av_dlog(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration);
 
         duration+=(int64_t)sample_duration*sample_count;
         total_sample_count+=sample_count;
@@ -1463,7 +1469,7 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return 0;
 }
 
-static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1474,11 +1480,11 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    entries = get_be32(pb);
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
+    entries = avio_rb32(pb);
 
-    dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
+    av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
 
     if(entries >= UINT_MAX / sizeof(*sc->ctts_data))
         return -1;
@@ -1488,8 +1494,8 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     sc->ctts_count = entries;
 
     for(i=0; i<entries; i++) {
-        int count    =get_be32(pb);
-        int duration =get_be32(pb);
+        int count    =avio_rb32(pb);
+        int duration =avio_rb32(pb);
 
         sc->ctts_data[i].count   = count;
         sc->ctts_data[i].duration= duration;
@@ -1497,7 +1503,7 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
             sc->dts_shift = FFMAX(sc->dts_shift, -duration);
     }
 
-    dprintf(c->fc, "dts shift %d\n", sc->dts_shift);
+    av_dlog(c->fc, "dts shift %d\n", sc->dts_shift);
 
     return 0;
 }
@@ -1547,7 +1553,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
 
         for (i = 0; i < sc->chunk_count; i++) {
             current_offset = sc->chunk_offsets[i];
-            if (stsc_index + 1 < sc->stsc_count &&
+            while (stsc_index + 1 < sc->stsc_count &&
                 i + 1 == sc->stsc_data[stsc_index + 1].first)
                 stsc_index++;
             for (j = 0; j < sc->stsc_data[stsc_index].count; j++) {
@@ -1577,7 +1583,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
                     e->size = sample_size;
                     e->min_distance = distance;
                     e->flags = keyframe ? AVINDEX_KEYFRAME : 0;
-                    dprintf(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
+                    av_dlog(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
                             "size %d, distance %d, keyframe %d\n", st->index, current_sample,
                             current_offset, current_dts, sample_size, distance, keyframe);
                 }
@@ -1625,7 +1631,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
             total += chunk_count * count;
         }
 
-        dprintf(mov->fc, "chunk count %d\n", total);
+        av_dlog(mov->fc, "chunk count %d\n", total);
         if (total >= UINT_MAX / sizeof(*st->index_entries))
             return;
         st->index_entries = av_malloc(total*sizeof(*st->index_entries));
@@ -1669,7 +1675,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
                 e->size = size;
                 e->min_distance = 0;
                 e->flags = AVINDEX_KEYFRAME;
-                dprintf(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", "
+                av_dlog(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", "
                         "size %d, duration %d\n", st->index, i, current_offset, current_dts,
                         size, samples);
 
@@ -1681,7 +1687,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
     }
 }
 
-static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref)
+static int mov_open_dref(AVIOContext **pb, char *src, MOVDref *ref)
 {
     /* try relative path, we do not try the absolute because it can leak information about our
        system to an attacker */
@@ -1716,15 +1722,15 @@ static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref)
 
             av_strlcat(filename, ref->path + l + 1, 1024);
 
-            if (!url_fopen(pb, filename, URL_RDONLY))
+            if (!avio_open(pb, filename, AVIO_RDONLY))
                 return 0;
         }
     }
 
     return AVERROR(ENOENT);
-};
+}
 
-static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
@@ -1763,7 +1769,7 @@ static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         !st->codec->frame_size && sc->stts_count == 1) {
         st->codec->frame_size = av_rescale(sc->stts_data[0].duration,
                                            st->codec->sample_rate, sc->time_scale);
-        dprintf(c->fc, "frame size %d\n", st->codec->frame_size);
+        av_dlog(c->fc, "frame size %d\n", st->codec->frame_size);
     }
 
     mov_build_index(c, st);
@@ -1823,7 +1829,7 @@ static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return 0;
 }
 
-static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     int ret;
     c->itunes_metadata = 1;
@@ -1832,13 +1838,13 @@ static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return ret;
 }
 
-static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     while (atom.size > 8) {
-        uint32_t tag = get_le32(pb);
+        uint32_t tag = avio_rl32(pb);
         atom.size -= 4;
         if (tag == MKTAG('h','d','l','r')) {
-            url_fseek(pb, -8, SEEK_CUR);
+            avio_seek(pb, -8, SEEK_CUR);
             atom.size += 8;
             return mov_read_default(c, pb, atom);
         }
@@ -1846,7 +1852,7 @@ static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return 0;
 }
 
-static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     int i;
     int width;
@@ -1862,8 +1868,8 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;
 
-    version = get_byte(pb);
-    get_be24(pb); /* flags */
+    version = avio_r8(pb);
+    avio_rb24(pb); /* flags */
     /*
     MOV_TRACK_ENABLED 0x0001
     MOV_TRACK_IN_MOVIE 0x0002
@@ -1872,36 +1878,36 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     */
 
     if (version == 1) {
-        get_be64(pb);
-        get_be64(pb);
+        avio_rb64(pb);
+        avio_rb64(pb);
     } else {
-        get_be32(pb); /* creation time */
-        get_be32(pb); /* modification time */
+        avio_rb32(pb); /* creation time */
+        avio_rb32(pb); /* modification time */
     }
-    st->id = (int)get_be32(pb); /* track id (NOT 0 !)*/
-    get_be32(pb); /* reserved */
+    st->id = (int)avio_rb32(pb); /* track id (NOT 0 !)*/
+    avio_rb32(pb); /* reserved */
 
     /* highlevel (considering edits) duration in movie timebase */
-    (version == 1) ? get_be64(pb) : get_be32(pb);
-    get_be32(pb); /* reserved */
-    get_be32(pb); /* reserved */
+    (version == 1) ? avio_rb64(pb) : avio_rb32(pb);
+    avio_rb32(pb); /* reserved */
+    avio_rb32(pb); /* reserved */
 
-    get_be16(pb); /* layer */
-    get_be16(pb); /* alternate group */
-    get_be16(pb); /* volume */
-    get_be16(pb); /* reserved */
+    avio_rb16(pb); /* layer */
+    avio_rb16(pb); /* alternate group */
+    avio_rb16(pb); /* volume */
+    avio_rb16(pb); /* reserved */
 
     //read in the display matrix (outlined in ISO 14496-12, Section 6.2.2)
     // they're kept in fixed point format through all calculations
     // ignore u,v,z b/c we don't need the scale factor to calc aspect ratio
     for (i = 0; i < 3; i++) {
-        display_matrix[i][0] = get_be32(pb);   // 16.16 fixed point
-        display_matrix[i][1] = get_be32(pb);   // 16.16 fixed point
-        get_be32(pb);           // 2.30 fixed point (not used)
+        display_matrix[i][0] = avio_rb32(pb);   // 16.16 fixed point
+        display_matrix[i][1] = avio_rb32(pb);   // 16.16 fixed point
+        avio_rb32(pb);           // 2.30 fixed point (not used)
     }
 
-    width = get_be32(pb);       // 16.16 fixed point track width
-    height = get_be32(pb);      // 16.16 fixed point track height
+    width = avio_rb32(pb);       // 16.16 fixed point track width
+    height = avio_rb32(pb);      // 16.16 fixed point track height
     sc->width = width >> 16;
     sc->height = height >> 16;
 
@@ -1929,16 +1935,16 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     return 0;
 }
 
-static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     MOVFragment *frag = &c->fragment;
     MOVTrackExt *trex = NULL;
     int flags, track_id, i;
 
-    get_byte(pb); /* version */
-    flags = get_be24(pb);
+    avio_r8(pb); /* version */
+    flags = avio_rb24(pb);
 
-    track_id = get_be32(pb);
+    track_id = avio_rb32(pb);
     if (!track_id)
         return -1;
     frag->track_id = track_id;
@@ -1952,25 +1958,25 @@ static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         return -1;
     }
 
-    if (flags & 0x01) frag->base_data_offset = get_be64(pb);
+    if (flags & 0x01) frag->base_data_offset = avio_rb64(pb);
     else              frag->base_data_offset = frag->moof_offset;
-    if (flags & 0x02) frag->stsd_id          = get_be32(pb);
+    if (flags & 0x02) frag->stsd_id          = avio_rb32(pb);
     else              frag->stsd_id          = trex->stsd_id;
 
-    frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration;
-    frag->size     = flags & 0x10 ? get_be32(pb) : trex->size;
-    frag->flags    = flags & 0x20 ? get_be32(pb) : trex->flags;
-    dprintf(c->fc, "frag flags 0x%x\n", frag->flags);
+    frag->duration = flags & 0x08 ? avio_rb32(pb) : trex->duration;
+    frag->size     = flags & 0x10 ? avio_rb32(pb) : trex->size;
+    frag->flags    = flags & 0x20 ? avio_rb32(pb) : trex->flags;
+    av_dlog(c->fc, "frag flags 0x%x\n", frag->flags);
     return 0;
 }
 
-static int mov_read_chap(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
-    c->chapter_track = get_be32(pb);
+    c->chapter_track = avio_rb32(pb);
     return 0;
 }
 
-static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     MOVTrackExt *trex;
 
@@ -1981,17 +1987,17 @@ static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         return AVERROR(ENOMEM);
     c->trex_data = trex;
     trex = &c->trex_data[c->trex_count++];
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    trex->track_id = get_be32(pb);
-    trex->stsd_id  = get_be32(pb);
-    trex->duration = get_be32(pb);
-    trex->size     = get_be32(pb);
-    trex->flags    = get_be32(pb);
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
+    trex->track_id = avio_rb32(pb);
+    trex->stsd_id  = avio_rb32(pb);
+    trex->duration = avio_rb32(pb);
+    trex->size     = avio_rb32(pb);
+    trex->flags    = avio_rb32(pb);
     return 0;
 }
 
-static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     MOVFragment *frag = &c->fragment;
     AVStream *st = NULL;
@@ -2015,12 +2021,12 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     sc = st->priv_data;
     if (sc->pseudo_stream_id+1 != frag->stsd_id)
         return 0;
-    get_byte(pb); /* version */
-    flags = get_be24(pb);
-    entries = get_be32(pb);
-    dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries);
-    if (flags & 0x001) data_offset        = get_be32(pb);
-    if (flags & 0x004) first_sample_flags = get_be32(pb);
+    avio_r8(pb); /* version */
+    flags = avio_rb24(pb);
+    entries = avio_rb32(pb);
+    av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries);
+    if (flags & 0x001) data_offset        = avio_rb32(pb);
+    if (flags & 0x004) first_sample_flags = avio_rb32(pb);
     if (flags & 0x800) {
         MOVStts *ctts_data;
         if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
@@ -2034,19 +2040,19 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
     dts = st->duration;
     offset = frag->base_data_offset + data_offset;
     distance = 0;
-    dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags);
+    av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);
     for (i = 0; i < entries; i++) {
         unsigned sample_size = frag->size;
         int sample_flags = i ? frag->flags : first_sample_flags;
         unsigned sample_duration = frag->duration;
         int keyframe;
 
-        if (flags & 0x100) sample_duration = get_be32(pb);
-        if (flags & 0x200) sample_size     = get_be32(pb);
-        if (flags & 0x400) sample_flags    = get_be32(pb);
+        if (flags & 0x100) sample_duration = avio_rb32(pb);
+        if (flags & 0x200) sample_size     = avio_rb32(pb);
+        if (flags & 0x400) sample_flags    = avio_rb32(pb);
         if (flags & 0x800) {
             sc->ctts_data[sc->ctts_count].count = 1;
-            sc->ctts_data[sc->ctts_count].duration = get_be32(pb);
+            sc->ctts_data[sc->ctts_count].duration = avio_rb32(pb);
             sc->ctts_count++;
         }
         if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
@@ -2054,7 +2060,7 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
             distance = 0;
         av_add_index_entry(st, offset, dts, sample_size, distance,
                            keyframe ? AVINDEX_KEYFRAME : 0);
-        dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
+        av_dlog(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
                 "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i,
                 offset, dts, sample_size, distance, keyframe);
         distance++;
@@ -2069,46 +2075,46 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 /* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */
 /* like the files created with Adobe Premiere 5.0, for samples see */
 /* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */
-static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     int err;
 
     if (atom.size < 8)
         return 0; /* continue */
-    if (get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
-        url_fskip(pb, atom.size - 4);
+    if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
+        avio_skip(pb, atom.size - 4);
         return 0;
     }
-    atom.type = get_le32(pb);
+    atom.type = avio_rl32(pb);
     atom.size -= 8;
     if (atom.type != MKTAG('m','d','a','t')) {
-        url_fskip(pb, atom.size);
+        avio_skip(pb, atom.size);
         return 0;
     }
     err = mov_read_mdat(c, pb, atom);
     return err;
 }
 
-static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 #if CONFIG_ZLIB
-    ByteIOContext ctx;
+    AVIOContext ctx;
     uint8_t *cmov_data;
     uint8_t *moov_data; /* uncompressed data */
     long cmov_len, moov_len;
     int ret = -1;
 
-    get_be32(pb); /* dcom atom */
-    if (get_le32(pb) != MKTAG('d','c','o','m'))
+    avio_rb32(pb); /* dcom atom */
+    if (avio_rl32(pb) != MKTAG('d','c','o','m'))
         return -1;
-    if (get_le32(pb) != MKTAG('z','l','i','b')) {
+    if (avio_rl32(pb) != MKTAG('z','l','i','b')) {
         av_log(c->fc, AV_LOG_ERROR, "unknown compression for cmov atom !");
         return -1;
     }
-    get_be32(pb); /* cmvd atom */
-    if (get_le32(pb) != MKTAG('c','m','v','d'))
+    avio_rb32(pb); /* cmvd atom */
+    if (avio_rl32(pb) != MKTAG('c','m','v','d'))
         return -1;
-    moov_len = get_be32(pb); /* uncompressed size */
+    moov_len = avio_rb32(pb); /* uncompressed size */
     cmov_len = atom.size - 6 * 4;
 
     cmov_data = av_malloc(cmov_len);
@@ -2119,10 +2125,10 @@ static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         av_free(cmov_data);
         return AVERROR(ENOMEM);
     }
-    get_buffer(pb, cmov_data, cmov_len);
+    avio_read(pb, cmov_data, cmov_len);
     if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK)
         goto free_and_return;
-    if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
+    if(ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
         goto free_and_return;
     atom.type = MKTAG('m','o','o','v');
     atom.size = moov_len;
@@ -2141,7 +2147,7 @@ free_and_return:
 }
 
 /* edit list atom */
-static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     MOVStreamContext *sc;
     int i, edit_count;
@@ -2150,18 +2156,18 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         return 0;
     sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
 
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    edit_count = get_be32(pb); /* entries */
+    avio_r8(pb); /* version */
+    avio_rb24(pb); /* flags */
+    edit_count = avio_rb32(pb); /* entries */
 
     if((uint64_t)edit_count*12+8 > atom.size)
         return -1;
 
     for(i=0; i<edit_count; i++){
         int time;
-        int duration = get_be32(pb); /* Track duration */
-        time = get_be32(pb); /* Media time */
-        get_be32(pb); /* Media rate */
+        int duration = avio_rb32(pb); /* Track duration */
+        time = avio_rb32(pb); /* Media time */
+        avio_rb32(pb); /* Media rate */
         if (i == 0 && time >= -1) {
             sc->time_offset = time != -1 ? time : -duration;
         }
@@ -2171,7 +2177,7 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
         av_log(c->fc, AV_LOG_WARNING, "multiple edit list entries, "
                "a/v desync might occur, patch welcome\n");
 
-    dprintf(c->fc, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count);
+    av_dlog(c->fc, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count);
     return 0;
 }
 
@@ -2283,8 +2289,7 @@ static void mov_read_chapters(AVFormatContext *s)
     AVStream *st = NULL;
     MOVStreamContext *sc;
     int64_t cur_pos;
-    uint8_t *title = NULL;
-    int i, len, i8, i16;
+    int i;
 
     for (i = 0; i < s->nb_streams; i++)
         if (s->streams[i]->id == mov->chapter_track) {
@@ -2298,62 +2303,59 @@ static void mov_read_chapters(AVFormatContext *s)
 
     st->discard = AVDISCARD_ALL;
     sc = st->priv_data;
-    cur_pos = url_ftell(sc->pb);
+    cur_pos = avio_tell(sc->pb);
 
     for (i = 0; i < st->nb_index_entries; i++) {
         AVIndexEntry *sample = &st->index_entries[i];
         int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration;
+        uint8_t *title;
+        uint16_t ch;
+        int len, title_len;
 
-        if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+        if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
             av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i);
             goto finish;
         }
 
-        title = av_malloc(sample->size+2);
-        get_buffer(sc->pb, title, sample->size);
-
         // the first two bytes are the length of the title
-        len = AV_RB16(title);
+        len = avio_rb16(sc->pb);
         if (len > sample->size-2)
             continue;
+        title_len = 2*len + 1;
+        if (!(title = av_mallocz(title_len)))
+            goto finish;
 
         // The samples could theoretically be in any encoding if there's an encd
         // atom following, but in practice are only utf-8 or utf-16, distinguished
         // instead by the presence of a BOM
-        if (AV_RB16(title+2) == 0xfeff) {
-            uint8_t *utf8 = av_malloc(2*len+3);
-
-            i8 = i16 = 0;
-            while (i16 < len) {
-                uint32_t ch;
-                uint8_t tmp;
-                GET_UTF16(ch, i16 < len ? AV_RB16(title + (i16+=2)) : 0, break;)
-                PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;)
-            }
-            utf8[2+i8] = 0;
-            av_freep(&title);
-            title = utf8;
+        ch = avio_rb16(sc->pb);
+        if (ch == 0xfeff)
+            avio_get_str16be(sc->pb, len, title, title_len);
+        else if (ch == 0xfffe)
+            avio_get_str16le(sc->pb, len, title, title_len);
+        else {
+            AV_WB16(title, ch);
+            avio_get_str(sc->pb, len - 2, title + 2, title_len - 2);
         }
 
-        ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2);
+        ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title);
         av_freep(&title);
     }
 finish:
-    av_free(title);
-    url_fseek(sc->pb, cur_pos, SEEK_SET);
+    avio_seek(sc->pb, cur_pos, SEEK_SET);
 }
 
 static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     MOVContext *mov = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int err;
     MOVAtom atom = { AV_RL32("root") };
 
     mov->fc = s;
     /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
-    if(!url_is_streamed(pb))
-        atom.size = url_fsize(pb);
+    if(pb->seekable)
+        atom.size = avio_size(pb);
     else
         atom.size = INT64_MAX;
 
@@ -2366,9 +2368,9 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
         av_log(s, AV_LOG_ERROR, "moov atom not found\n");
         return -1;
     }
-    dprintf(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb));
+    av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", avio_tell(pb));
 
-    if (!url_is_streamed(pb) && mov->chapter_track > 0)
+    if (pb->seekable && mov->chapter_track > 0)
         mov_read_chapters(s);
 
     return 0;
@@ -2385,9 +2387,9 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
         if (msc->pb && msc->current_sample < avst->nb_index_entries) {
             AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample];
             int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale);
-            dprintf(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts);
-            if (!sample || (url_is_streamed(s->pb) && current_sample->pos < sample->pos) ||
-                (!url_is_streamed(s->pb) &&
+            av_dlog(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts);
+            if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) ||
+                (s->pb->seekable &&
                  ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb &&
                  ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) ||
                   (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) {
@@ -2411,11 +2413,11 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
     sample = mov_find_next_sample(s, &st);
     if (!sample) {
         mov->found_mdat = 0;
-        if (!url_is_streamed(s->pb) ||
+        if (s->pb->seekable||
             mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
-            url_feof(s->pb))
+            s->pb->eof_reached)
             return AVERROR_EOF;
-        dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
+        av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb));
         goto retry;
     }
     sc = st->priv_data;
@@ -2423,7 +2425,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
     sc->current_sample++;
 
     if (st->discard != AVDISCARD_ALL) {
-        if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+        if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
             av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n",
                    sc->ffindex, sample->pos);
             return -1;
@@ -2466,7 +2468,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
         goto retry;
     pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0;
     pkt->pos = sample->pos;
-    dprintf(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
+    av_dlog(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
             pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration);
     return 0;
 }
@@ -2478,13 +2480,13 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp,
     int i;
 
     sample = av_index_search_timestamp(st, timestamp, flags);
-    dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
+    av_dlog(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
     if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
         sample = 0;
     if (sample < 0) /* not sure what to do */
         return -1;
     sc->current_sample = sample;
-    dprintf(s, "stream %d, found sample %d\n", st->index, sc->current_sample);
+    av_dlog(s, "stream %d, found sample %d\n", st->index, sc->current_sample);
     /* adjust ctts index */
     if (sc->ctts_data) {
         time_sample = 0;
@@ -2548,7 +2550,7 @@ static int mov_read_close(AVFormatContext *s)
         }
         av_freep(&sc->drefs);
         if (sc->pb && sc->pb != s->pb)
-            url_fclose(sc->pb);
+            avio_close(sc->pb);
 
         av_freep(&st->codec->palctrl);
     }
@@ -2567,7 +2569,7 @@ static int mov_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat mov_demuxer = {
+AVInputFormat ff_mov_demuxer = {
     "mov,mp4,m4a,3gp,3g2,mj2",
     NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"),
     sizeof(MOVContext),
diff --git a/ffmpeg-mt/libavformat/movenc.c b/ffmpeg-mt/libavformat/movenc.c
index 5230938..0458844 100644
--- a/ffmpeg-mt/libavformat/movenc.c
+++ b/ffmpeg-mt/libavformat/movenc.c
@@ -4,25 +4,26 @@
  * Copyright (c) 2004 Gildas Bazin <gbazin at videolan dot org>
  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "movenc.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "riff.h"
 #include "avio.h"
 #include "isom.h"
@@ -36,49 +37,49 @@
 #include <assert.h>
 
 //FIXME support 64 bit variant with wide placeholders
-static int64_t updateSize(ByteIOContext *pb, int64_t pos)
+static int64_t updateSize(AVIOContext *pb, int64_t pos)
 {
-    int64_t curpos = url_ftell(pb);
-    url_fseek(pb, pos, SEEK_SET);
-    put_be32(pb, curpos - pos); /* rewrite size */
-    url_fseek(pb, curpos, SEEK_SET);
+    int64_t curpos = avio_tell(pb);
+    avio_seek(pb, pos, SEEK_SET);
+    avio_wb32(pb, curpos - pos); /* rewrite size */
+    avio_seek(pb, curpos, SEEK_SET);
 
     return curpos - pos;
 }
 
 /* Chunk offset atom */
-static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
 {
     int i;
     int mode64 = 0; //   use 32 bit size variant if possible
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
     if (pos > UINT32_MAX) {
         mode64 = 1;
-        put_tag(pb, "co64");
+        ffio_wfourcc(pb, "co64");
     } else
-        put_tag(pb, "stco");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, track->entry); /* entry count */
+        ffio_wfourcc(pb, "stco");
+    avio_wb32(pb, 0); /* version & flags */
+    avio_wb32(pb, track->entry); /* entry count */
     for (i=0; i<track->entry; i++) {
         if(mode64 == 1)
-            put_be64(pb, track->cluster[i].pos);
+            avio_wb64(pb, track->cluster[i].pos);
         else
-            put_be32(pb, track->cluster[i].pos);
+            avio_wb32(pb, track->cluster[i].pos);
     }
     return updateSize(pb, pos);
 }
 
 /* Sample size atom */
-static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track)
 {
     int equalChunks = 1;
     int i, j, entries = 0, tst = -1, oldtst = -1;
 
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stsz");
-    put_be32(pb, 0); /* version & flags */
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "stsz");
+    avio_wb32(pb, 0); /* version & flags */
 
     for (i=0; i<track->entry; i++) {
         tst = track->cluster[i].size/track->cluster[i].entries;
@@ -90,15 +91,15 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
     }
     if (equalChunks) {
         int sSize = track->cluster[0].size/track->cluster[0].entries;
-        put_be32(pb, sSize); // sample size
-        put_be32(pb, entries); // sample count
+        avio_wb32(pb, sSize); // sample size
+        avio_wb32(pb, entries); // sample count
     }
     else {
-        put_be32(pb, 0); // sample size
-        put_be32(pb, entries); // sample count
+        avio_wb32(pb, 0); // sample size
+        avio_wb32(pb, entries); // sample count
         for (i=0; i<track->entry; i++) {
             for (j=0; j<track->cluster[i].entries; j++) {
-                put_be32(pb, track->cluster[i].size /
+                avio_wb32(pb, track->cluster[i].size /
                          track->cluster[i].entries);
             }
         }
@@ -107,74 +108,74 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
 }
 
 /* Sample to chunk atom */
-static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
 {
     int index = 0, oldval = -1, i;
     int64_t entryPos, curpos;
 
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stsc");
-    put_be32(pb, 0); // version & flags
-    entryPos = url_ftell(pb);
-    put_be32(pb, track->entry); // entry count
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "stsc");
+    avio_wb32(pb, 0); // version & flags
+    entryPos = avio_tell(pb);
+    avio_wb32(pb, track->entry); // entry count
     for (i=0; i<track->entry; i++) {
         if(oldval != track->cluster[i].samplesInChunk)
         {
-            put_be32(pb, i+1); // first chunk
-            put_be32(pb, track->cluster[i].samplesInChunk); // samples per chunk
-            put_be32(pb, 0x1); // sample description index
+            avio_wb32(pb, i+1); // first chunk
+            avio_wb32(pb, track->cluster[i].samplesInChunk); // samples per chunk
+            avio_wb32(pb, 0x1); // sample description index
             oldval = track->cluster[i].samplesInChunk;
             index++;
         }
     }
-    curpos = url_ftell(pb);
-    url_fseek(pb, entryPos, SEEK_SET);
-    put_be32(pb, index); // rewrite size
-    url_fseek(pb, curpos, SEEK_SET);
+    curpos = avio_tell(pb);
+    avio_seek(pb, entryPos, SEEK_SET);
+    avio_wb32(pb, index); // rewrite size
+    avio_seek(pb, curpos, SEEK_SET);
 
     return updateSize(pb, pos);
 }
 
 /* Sync sample atom */
-static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag)
+static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
 {
     int64_t curpos, entryPos;
     int i, index = 0;
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); // size
-    put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
-    put_be32(pb, 0); // version & flags
-    entryPos = url_ftell(pb);
-    put_be32(pb, track->entry); // entry count
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); // size
+    ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
+    avio_wb32(pb, 0); // version & flags
+    entryPos = avio_tell(pb);
+    avio_wb32(pb, track->entry); // entry count
     for (i=0; i<track->entry; i++) {
         if (track->cluster[i].flags & flag) {
-            put_be32(pb, i+1);
+            avio_wb32(pb, i+1);
             index++;
         }
     }
-    curpos = url_ftell(pb);
-    url_fseek(pb, entryPos, SEEK_SET);
-    put_be32(pb, index); // rewrite size
-    url_fseek(pb, curpos, SEEK_SET);
+    curpos = avio_tell(pb);
+    avio_seek(pb, entryPos, SEEK_SET);
+    avio_wb32(pb, index); // rewrite size
+    avio_seek(pb, curpos, SEEK_SET);
     return updateSize(pb, pos);
 }
 
-static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track)
 {
-    put_be32(pb, 0x11); /* size */
-    if (track->mode == MODE_MOV) put_tag(pb, "samr");
-    else                         put_tag(pb, "damr");
-    put_tag(pb, "FFMP");
-    put_byte(pb, 0); /* decoder version */
+    avio_wb32(pb, 0x11); /* size */
+    if (track->mode == MODE_MOV) ffio_wfourcc(pb, "samr");
+    else                         ffio_wfourcc(pb, "damr");
+    ffio_wfourcc(pb, "FFMP");
+    avio_w8(pb, 0); /* decoder version */
 
-    put_be16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */
-    put_byte(pb, 0x00); /* Mode change period (no restriction) */
-    put_byte(pb, 0x01); /* Frames per sample */
+    avio_wb16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */
+    avio_w8(pb, 0x00); /* Mode change period (no restriction) */
+    avio_w8(pb, 0x01); /* Frames per sample */
     return 0x11;
 }
 
-static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track)
 {
     GetBitContext gbc;
     PutBitContext pbc;
@@ -184,8 +185,8 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track)
     if (track->vosLen < 7)
         return -1;
 
-    put_be32(pb, 11);
-    put_tag(pb, "dac3");
+    avio_wb32(pb, 11);
+    ffio_wfourcc(pb, "dac3");
 
     init_get_bits(&gbc, track->vosData+4, track->vosLen-4);
     fscod      = get_bits(&gbc, 2);
@@ -213,7 +214,7 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track)
     put_bits(&pbc, 5, 0); // reserved
 
     flush_put_bits(&pbc);
-    put_buffer(pb, buf, sizeof(buf));
+    avio_write(pb, buf, sizeof(buf));
 
     return 11;
 }
@@ -222,17 +223,17 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track)
  * This function writes extradata "as is".
  * Extradata must be formated like a valid atom (with size and tag)
  */
-static int mov_write_extradata_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track)
 {
-    put_buffer(pb, track->enc->extradata, track->enc->extradata_size);
+    avio_write(pb, track->enc->extradata, track->enc->extradata_size);
     return track->enc->extradata_size;
 }
 
-static int mov_write_enda_tag(ByteIOContext *pb)
+static int mov_write_enda_tag(AVIOContext *pb)
 {
-    put_be32(pb, 10);
-    put_tag(pb, "enda");
-    put_be16(pb, 1); /* little endian */
+    avio_wb32(pb, 10);
+    ffio_wfourcc(pb, "enda");
+    avio_wb16(pb, 1); /* little endian */
     return 10;
 }
 
@@ -243,29 +244,29 @@ static unsigned int descrLength(unsigned int len)
     return len + 1 + i;
 }
 
-static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
+static void putDescr(AVIOContext *pb, int tag, unsigned int size)
 {
     int i= descrLength(size) - size - 2;
-    put_byte(pb, tag);
+    avio_w8(pb, tag);
     for(; i>0; i--)
-        put_byte(pb, (size>>(7*i)) | 0x80);
-    put_byte(pb, size & 0x7F);
+        avio_w8(pb, (size>>(7*i)) | 0x80);
+    avio_w8(pb, size & 0x7F);
 }
 
-static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic
+static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
 
-    put_be32(pb, 0); // size
-    put_tag(pb, "esds");
-    put_be32(pb, 0); // Version
+    avio_wb32(pb, 0); // size
+    ffio_wfourcc(pb, "esds");
+    avio_wb32(pb, 0); // Version
 
     // ES descriptor
     putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) +
              descrLength(1));
-    put_be16(pb, track->trackID);
-    put_byte(pb, 0x00); // flags (= no flags)
+    avio_wb16(pb, track->trackID);
+    avio_w8(pb, 0x00); // flags (= no flags)
 
     // DecoderConfig descriptor
     putDescr(pb, 0x04, 13 + decoderSpecificInfoLen);
@@ -274,35 +275,35 @@ static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic
     if ((track->enc->codec_id == CODEC_ID_MP2 ||
          track->enc->codec_id == CODEC_ID_MP3) &&
         track->enc->sample_rate > 24000)
-        put_byte(pb, 0x6B); // 11172-3
+        avio_w8(pb, 0x6B); // 11172-3
     else
-        put_byte(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id));
+        avio_w8(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id));
 
     // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio)
     // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved)
     if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
-        put_byte(pb, 0x15); // flags (= Audiostream)
+        avio_w8(pb, 0x15); // flags (= Audiostream)
     else
-        put_byte(pb, 0x11); // flags (= Visualstream)
+        avio_w8(pb, 0x11); // flags (= Visualstream)
 
-    put_byte(pb,  track->enc->rc_buffer_size>>(3+16));    // Buffersize DB (24 bits)
-    put_be16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB
+    avio_w8(pb,  track->enc->rc_buffer_size>>(3+16));      // Buffersize DB (24 bits)
+    avio_wb16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB
 
-    put_be32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window)
+    avio_wb32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window)
     if(track->enc->rc_max_rate != track->enc->rc_min_rate || track->enc->rc_min_rate==0)
-        put_be32(pb, 0); // vbr
+        avio_wb32(pb, 0); // vbr
     else
-        put_be32(pb, track->enc->rc_max_rate); // avg bitrate
+        avio_wb32(pb, track->enc->rc_max_rate); // avg bitrate
 
     if (track->vosLen) {
         // DecoderSpecific info descriptor
         putDescr(pb, 0x05, track->vosLen);
-        put_buffer(pb, track->vosData, track->vosLen);
+        avio_write(pb, track->vosData, track->vosLen);
     }
 
     // SL descriptor
     putDescr(pb, 0x06, 1);
-    put_byte(pb, 0x02);
+    avio_w8(pb, 0x02);
     return updateSize(pb, pos);
 }
 
@@ -314,22 +315,32 @@ static int mov_pcm_le_gt16(enum CodecID codec_id)
            codec_id == CODEC_ID_PCM_F64LE;
 }
 
-static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0);
+    avio_wl32(pb, track->tag); // store it byteswapped
+    track->enc->codec_tag = av_bswap16(track->tag >> 16);
+    ff_put_wav_header(pb, track->enc);
+    return updateSize(pb, pos);
+}
+
+static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
+{
+    int64_t pos = avio_tell(pb);
 
-    put_be32(pb, 0);     /* size */
-    put_tag(pb, "wave");
+    avio_wb32(pb, 0);     /* size */
+    ffio_wfourcc(pb, "wave");
 
-    put_be32(pb, 12);    /* size */
-    put_tag(pb, "frma");
-    put_le32(pb, track->tag);
+    avio_wb32(pb, 12);    /* size */
+    ffio_wfourcc(pb, "frma");
+    avio_wl32(pb, track->tag);
 
     if (track->enc->codec_id == CODEC_ID_AAC) {
         /* useless atom needed by mplayer, ipod, not needed by quicktime */
-        put_be32(pb, 12); /* size */
-        put_tag(pb, "mp4a");
-        put_be32(pb, 0);
+        avio_wb32(pb, 12); /* size */
+        ffio_wfourcc(pb, "mp4a");
+        avio_wb32(pb, 0);
         mov_write_esds_tag(pb, track);
     } else if (mov_pcm_le_gt16(track->enc->codec_id)) {
         mov_write_enda_tag(pb);
@@ -339,19 +350,22 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track)
         mov_write_ac3_tag(pb, track);
     } else if (track->enc->codec_id == CODEC_ID_ALAC) {
         mov_write_extradata_tag(pb, track);
+    } else if (track->enc->codec_id == CODEC_ID_ADPCM_MS ||
+               track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
+        mov_write_ms_tag(pb, track);
     }
 
-    put_be32(pb, 8);     /* size */
-    put_be32(pb, 0);     /* null tag */
+    avio_wb32(pb, 8);     /* size */
+    avio_wb32(pb, 0);     /* null tag */
 
     return updateSize(pb, pos);
 }
 
-static int mov_write_glbl_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track)
 {
-    put_be32(pb, track->vosLen+8);
-    put_tag(pb, "glbl");
-    put_buffer(pb, track->vosData, track->vosLen);
+    avio_wb32(pb, track->vosLen+8);
+    ffio_wfourcc(pb, "glbl");
+    avio_write(pb, track->vosData, track->vosLen);
     return 8+track->vosLen;
 }
 
@@ -384,9 +398,9 @@ static int mov_get_lpcm_flags(enum CodecID codec_id)
     }
 }
 
-static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     int version = 0;
     uint32_t tag = track->tag;
 
@@ -395,61 +409,63 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track)
             if (mov_get_lpcm_flags(track->enc->codec_id))
                 tag = AV_RL32("lpcm");
             version = 2;
-        } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id)) {
+        } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id) ||
+                   track->enc->codec_id == CODEC_ID_ADPCM_MS ||
+                   track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
             version = 1;
         }
     }
 
-    put_be32(pb, 0); /* size */
-    put_le32(pb, tag); // store it byteswapped
-    put_be32(pb, 0); /* Reserved */
-    put_be16(pb, 0); /* Reserved */
-    put_be16(pb, 1); /* Data-reference index, XXX  == 1 */
+    avio_wb32(pb, 0); /* size */
+    avio_wl32(pb, tag); // store it byteswapped
+    avio_wb32(pb, 0); /* Reserved */
+    avio_wb16(pb, 0); /* Reserved */
+    avio_wb16(pb, 1); /* Data-reference index, XXX  == 1 */
 
     /* SoundDescription */
-    put_be16(pb, version); /* Version */
-    put_be16(pb, 0); /* Revision level */
-    put_be32(pb, 0); /* Reserved */
+    avio_wb16(pb, version); /* Version */
+    avio_wb16(pb, 0); /* Revision level */
+    avio_wb32(pb, 0); /* Reserved */
 
     if (version == 2) {
-        put_be16(pb, 3);
-        put_be16(pb, 16);
-        put_be16(pb, 0xfffe);
-        put_be16(pb, 0);
-        put_be32(pb, 0x00010000);
-        put_be32(pb, 72);
-        put_be64(pb, av_dbl2int(track->timescale));
-        put_be32(pb, track->enc->channels);
-        put_be32(pb, 0x7F000000);
-        put_be32(pb, av_get_bits_per_sample(track->enc->codec_id));
-        put_be32(pb, mov_get_lpcm_flags(track->enc->codec_id));
-        put_be32(pb, track->sampleSize);
-        put_be32(pb, track->enc->frame_size);
+        avio_wb16(pb, 3);
+        avio_wb16(pb, 16);
+        avio_wb16(pb, 0xfffe);
+        avio_wb16(pb, 0);
+        avio_wb32(pb, 0x00010000);
+        avio_wb32(pb, 72);
+        avio_wb64(pb, av_dbl2int(track->timescale));
+        avio_wb32(pb, track->enc->channels);
+        avio_wb32(pb, 0x7F000000);
+        avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
+        avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id));
+        avio_wb32(pb, track->sampleSize);
+        avio_wb32(pb, track->enc->frame_size);
     } else {
         if (track->mode == MODE_MOV) {
-            put_be16(pb, track->enc->channels);
+            avio_wb16(pb, track->enc->channels);
             if (track->enc->codec_id == CODEC_ID_PCM_U8 ||
                 track->enc->codec_id == CODEC_ID_PCM_S8)
-                put_be16(pb, 8); /* bits per sample */
+                avio_wb16(pb, 8); /* bits per sample */
             else
-                put_be16(pb, 16);
-            put_be16(pb, track->audio_vbr ? -2 : 0); /* compression ID */
+                avio_wb16(pb, 16);
+            avio_wb16(pb, track->audio_vbr ? -2 : 0); /* compression ID */
         } else { /* reserved for mp4/3gp */
-            put_be16(pb, 2);
-            put_be16(pb, 16);
-            put_be16(pb, 0);
+            avio_wb16(pb, 2);
+            avio_wb16(pb, 16);
+            avio_wb16(pb, 0);
         }
 
-        put_be16(pb, 0); /* packet size (= 0) */
-        put_be16(pb, track->timescale); /* Time scale */
-        put_be16(pb, 0); /* Reserved */
+        avio_wb16(pb, 0); /* packet size (= 0) */
+        avio_wb16(pb, track->timescale); /* Time scale */
+        avio_wb16(pb, 0); /* Reserved */
     }
 
     if(version == 1) { /* SoundDescription V1 extended info */
-        put_be32(pb, track->enc->frame_size); /* Samples per packet */
-        put_be32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */
-        put_be32(pb, track->sampleSize); /* Bytes per frame */
-        put_be32(pb, 2); /* Bytes per sample */
+        avio_wb32(pb, track->enc->frame_size); /* Samples per packet */
+        avio_wb32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */
+        avio_wb32(pb, track->sampleSize); /* Bytes per frame */
+        avio_wb32(pb, 2); /* Bytes per sample */
     }
 
     if(track->mode == MODE_MOV &&
@@ -457,6 +473,8 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track)
         track->enc->codec_id == CODEC_ID_AC3 ||
         track->enc->codec_id == CODEC_ID_AMR_NB ||
         track->enc->codec_id == CODEC_ID_ALAC ||
+        track->enc->codec_id == CODEC_ID_ADPCM_MS ||
+        track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV ||
         mov_pcm_le_gt16(track->enc->codec_id)))
         mov_write_wave_tag(pb, track);
     else if(track->tag == MKTAG('m','p','4','a'))
@@ -473,86 +491,86 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track)
     return updateSize(pb, pos);
 }
 
-static int mov_write_d263_tag(ByteIOContext *pb)
+static int mov_write_d263_tag(AVIOContext *pb)
 {
-    put_be32(pb, 0xf); /* size */
-    put_tag(pb, "d263");
-    put_tag(pb, "FFMP");
-    put_byte(pb, 0); /* decoder version */
+    avio_wb32(pb, 0xf); /* size */
+    ffio_wfourcc(pb, "d263");
+    ffio_wfourcc(pb, "FFMP");
+    avio_w8(pb, 0); /* decoder version */
     /* FIXME use AVCodecContext level/profile, when encoder will set values */
-    put_byte(pb, 0xa); /* level */
-    put_byte(pb, 0); /* profile */
+    avio_w8(pb, 0xa); /* level */
+    avio_w8(pb, 0); /* profile */
     return 0xf;
 }
 
 /* TODO: No idea about these values */
-static int mov_write_svq3_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 0x15);
-    put_tag(pb, "SMI ");
-    put_tag(pb, "SEQH");
-    put_be32(pb, 0x5);
-    put_be32(pb, 0xe2c0211d);
-    put_be32(pb, 0xc0000000);
-    put_byte(pb, 0);
+static int mov_write_svq3_tag(AVIOContext *pb)
+{
+    avio_wb32(pb, 0x15);
+    ffio_wfourcc(pb, "SMI ");
+    ffio_wfourcc(pb, "SEQH");
+    avio_wb32(pb, 0x5);
+    avio_wb32(pb, 0xe2c0211d);
+    avio_wb32(pb, 0xc0000000);
+    avio_w8(pb, 0);
     return 0x15;
 }
 
-static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
 
-    put_be32(pb, 0);
-    put_tag(pb, "avcC");
+    avio_wb32(pb, 0);
+    ffio_wfourcc(pb, "avcC");
     ff_isom_write_avcc(pb, track->vosData, track->vosLen);
     return updateSize(pb, pos);
 }
 
 /* also used by all avid codecs (dv, imx, meridien) and their variants */
-static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
 {
     int i;
-    put_be32(pb, 24); /* size */
-    put_tag(pb, "ACLR");
-    put_tag(pb, "ACLR");
-    put_tag(pb, "0001");
-    put_be32(pb, 1); /* yuv 1 / rgb 2 ? */
-    put_be32(pb, 0); /* unknown */
-
-    put_be32(pb, 24); /* size */
-    put_tag(pb, "APRG");
-    put_tag(pb, "APRG");
-    put_tag(pb, "0001");
-    put_be32(pb, 1); /* unknown */
-    put_be32(pb, 0); /* unknown */
-
-    put_be32(pb, 120); /* size */
-    put_tag(pb, "ARES");
-    put_tag(pb, "ARES");
-    put_tag(pb, "0001");
-    put_be32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */
-    put_be32(pb, track->enc->width);
+    avio_wb32(pb, 24); /* size */
+    ffio_wfourcc(pb, "ACLR");
+    ffio_wfourcc(pb, "ACLR");
+    ffio_wfourcc(pb, "0001");
+    avio_wb32(pb, 1); /* yuv 1 / rgb 2 ? */
+    avio_wb32(pb, 0); /* unknown */
+
+    avio_wb32(pb, 24); /* size */
+    ffio_wfourcc(pb, "APRG");
+    ffio_wfourcc(pb, "APRG");
+    ffio_wfourcc(pb, "0001");
+    avio_wb32(pb, 1); /* unknown */
+    avio_wb32(pb, 0); /* unknown */
+
+    avio_wb32(pb, 120); /* size */
+    ffio_wfourcc(pb, "ARES");
+    ffio_wfourcc(pb, "ARES");
+    ffio_wfourcc(pb, "0001");
+    avio_wb32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */
+    avio_wb32(pb, track->enc->width);
     /* values below are based on samples created with quicktime and avid codecs */
     if (track->vosData[5] & 2) { // interlaced
-        put_be32(pb, track->enc->height/2);
-        put_be32(pb, 2); /* unknown */
-        put_be32(pb, 0); /* unknown */
-        put_be32(pb, 4); /* unknown */
+        avio_wb32(pb, track->enc->height/2);
+        avio_wb32(pb, 2); /* unknown */
+        avio_wb32(pb, 0); /* unknown */
+        avio_wb32(pb, 4); /* unknown */
     } else {
-        put_be32(pb, track->enc->height);
-        put_be32(pb, 1); /* unknown */
-        put_be32(pb, 0); /* unknown */
+        avio_wb32(pb, track->enc->height);
+        avio_wb32(pb, 1); /* unknown */
+        avio_wb32(pb, 0); /* unknown */
         if (track->enc->height == 1080)
-            put_be32(pb, 5); /* unknown */
+            avio_wb32(pb, 5); /* unknown */
         else
-            put_be32(pb, 6); /* unknown */
+            avio_wb32(pb, 6); /* unknown */
     }
     /* padding */
     for (i = 0; i < 10; i++)
-        put_be64(pb, 0);
+        avio_wb64(pb, 0);
 
     /* extra padding for stsd needed */
-    put_be32(pb, 0);
+    avio_wb32(pb, 0);
     return 0;
 }
 
@@ -605,12 +623,23 @@ static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
 {
     int tag;
 
-    if (track->enc->height == 480) /* NTSC */
-        if  (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n');
-        else                                         tag = MKTAG('d','v','c',' ');
-    else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p');
-    else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p');
-    else                                             tag = MKTAG('d','v','p','p');
+    if (track->enc->width == 720) /* SD */
+        if (track->enc->height == 480) /* NTSC */
+            if  (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n');
+            else                                         tag = MKTAG('d','v','c',' ');
+        else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p');
+        else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p');
+        else                                             tag = MKTAG('d','v','p','p');
+    else if (track->enc->height == 720) /* HD 720 line */
+        if  (track->enc->time_base.den == 50)            tag = MKTAG('d','v','h','q');
+        else                                             tag = MKTAG('d','v','h','p');
+    else if (track->enc->height == 1080) /* HD 1080 line */
+        if  (track->enc->time_base.den == 25)            tag = MKTAG('d','v','h','5');
+        else                                             tag = MKTAG('d','v','h','6');
+    else {
+        av_log(s, AV_LOG_ERROR, "unsupported height for dv codec\n");
+        return 0;
+    }
 
     return tag;
 }
@@ -721,92 +750,92 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
  * Needed to make file play in iPods running newest firmware
  * goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1
  */
-static int mov_write_uuid_tag_ipod(ByteIOContext *pb)
-{
-    put_be32(pb, 28);
-    put_tag(pb, "uuid");
-    put_be32(pb, 0x6b6840f2);
-    put_be32(pb, 0x5f244fc5);
-    put_be32(pb, 0xba39a51b);
-    put_be32(pb, 0xcf0323f3);
-    put_be32(pb, 0x0);
+static int mov_write_uuid_tag_ipod(AVIOContext *pb)
+{
+    avio_wb32(pb, 28);
+    ffio_wfourcc(pb, "uuid");
+    avio_wb32(pb, 0x6b6840f2);
+    avio_wb32(pb, 0x5f244fc5);
+    avio_wb32(pb, 0xba39a51b);
+    avio_wb32(pb, 0xcf0323f3);
+    avio_wb32(pb, 0x0);
     return 28;
 }
 
-static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0);    /* size */
-    put_le32(pb, track->tag); // store it byteswapped
-    put_be32(pb, 0);    /* Reserved */
-    put_be16(pb, 0);    /* Reserved */
-    put_be16(pb, 1);    /* Data-reference index */
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0);    /* size */
+    avio_wl32(pb, track->tag); // store it byteswapped
+    avio_wb32(pb, 0);    /* Reserved */
+    avio_wb16(pb, 0);    /* Reserved */
+    avio_wb16(pb, 1);    /* Data-reference index */
 
     if (track->enc->extradata_size)
-        put_buffer(pb, track->enc->extradata, track->enc->extradata_size);
+        avio_write(pb, track->enc->extradata, track->enc->extradata_size);
 
     return updateSize(pb, pos);
 }
 
-static int mov_write_pasp_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
 {
     AVRational sar;
     av_reduce(&sar.num, &sar.den, track->enc->sample_aspect_ratio.num,
               track->enc->sample_aspect_ratio.den, INT_MAX);
 
-    put_be32(pb, 16);
-    put_tag(pb, "pasp");
-    put_be32(pb, sar.num);
-    put_be32(pb, sar.den);
+    avio_wb32(pb, 16);
+    ffio_wfourcc(pb, "pasp");
+    avio_wb32(pb, sar.num);
+    avio_wb32(pb, sar.den);
     return 16;
 }
 
-static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     char compressor_name[32];
 
-    put_be32(pb, 0); /* size */
-    put_le32(pb, track->tag); // store it byteswapped
-    put_be32(pb, 0); /* Reserved */
-    put_be16(pb, 0); /* Reserved */
-    put_be16(pb, 1); /* Data-reference index */
+    avio_wb32(pb, 0); /* size */
+    avio_wl32(pb, track->tag); // store it byteswapped
+    avio_wb32(pb, 0); /* Reserved */
+    avio_wb16(pb, 0); /* Reserved */
+    avio_wb16(pb, 1); /* Data-reference index */
 
-    put_be16(pb, 0); /* Codec stream version */
-    put_be16(pb, 0); /* Codec stream revision (=0) */
+    avio_wb16(pb, 0); /* Codec stream version */
+    avio_wb16(pb, 0); /* Codec stream revision (=0) */
     if (track->mode == MODE_MOV) {
-        put_tag(pb, "FFMP"); /* Vendor */
+        ffio_wfourcc(pb, "FFMP"); /* Vendor */
         if(track->enc->codec_id == CODEC_ID_RAWVIDEO) {
-            put_be32(pb, 0); /* Temporal Quality */
-            put_be32(pb, 0x400); /* Spatial Quality = lossless*/
+            avio_wb32(pb, 0); /* Temporal Quality */
+            avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/
         } else {
-            put_be32(pb, 0x200); /* Temporal Quality = normal */
-            put_be32(pb, 0x200); /* Spatial Quality = normal */
+            avio_wb32(pb, 0x200); /* Temporal Quality = normal */
+            avio_wb32(pb, 0x200); /* Spatial Quality = normal */
         }
     } else {
-        put_be32(pb, 0); /* Reserved */
-        put_be32(pb, 0); /* Reserved */
-        put_be32(pb, 0); /* Reserved */
+        avio_wb32(pb, 0); /* Reserved */
+        avio_wb32(pb, 0); /* Reserved */
+        avio_wb32(pb, 0); /* Reserved */
     }
-    put_be16(pb, track->enc->width); /* Video width */
-    put_be16(pb, track->height); /* Video height */
-    put_be32(pb, 0x00480000); /* Horizontal resolution 72dpi */
-    put_be32(pb, 0x00480000); /* Vertical resolution 72dpi */
-    put_be32(pb, 0); /* Data size (= 0) */
-    put_be16(pb, 1); /* Frame count (= 1) */
+    avio_wb16(pb, track->enc->width); /* Video width */
+    avio_wb16(pb, track->height); /* Video height */
+    avio_wb32(pb, 0x00480000); /* Horizontal resolution 72dpi */
+    avio_wb32(pb, 0x00480000); /* Vertical resolution 72dpi */
+    avio_wb32(pb, 0); /* Data size (= 0) */
+    avio_wb16(pb, 1); /* Frame count (= 1) */
 
     memset(compressor_name,0,32);
     /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
     if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
         strncpy(compressor_name,track->enc->codec->name,31);
-    put_byte(pb, strlen(compressor_name));
-    put_buffer(pb, compressor_name, 31);
+    avio_w8(pb, strlen(compressor_name));
+    avio_write(pb, compressor_name, 31);
 
     if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample)
-        put_be16(pb, track->enc->bits_per_coded_sample);
+        avio_wb16(pb, track->enc->bits_per_coded_sample);
     else
-        put_be16(pb, 0x18); /* Reserved */
-    put_be16(pb, 0xffff); /* Reserved */
+        avio_wb16(pb, 0x18); /* Reserved */
+    avio_wb16(pb, 0xffff); /* Reserved */
     if(track->tag == MKTAG('m','p','4','v'))
         mov_write_esds_tag(pb, track);
     else if(track->enc->codec_id == CODEC_ID_H263)
@@ -822,8 +851,7 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
     } else if(track->vosLen > 0)
         mov_write_glbl_tag(pb, track);
 
-    if (track->mode == MODE_MOV &&
-        track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num &&
+    if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num &&
         track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) {
         mov_write_pasp_tag(pb, track);
     }
@@ -831,33 +859,33 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
     return updateSize(pb, pos);
 }
 
-static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "rtp ");
-    put_be32(pb, 0); /* Reserved */
-    put_be16(pb, 0); /* Reserved */
-    put_be16(pb, 1); /* Data-reference index */
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "rtp ");
+    avio_wb32(pb, 0); /* Reserved */
+    avio_wb16(pb, 0); /* Reserved */
+    avio_wb16(pb, 1); /* Data-reference index */
 
-    put_be16(pb, 1); /* Hint track version */
-    put_be16(pb, 1); /* Highest compatible version */
-    put_be32(pb, track->max_packet_size); /* Max packet size */
+    avio_wb16(pb, 1); /* Hint track version */
+    avio_wb16(pb, 1); /* Highest compatible version */
+    avio_wb32(pb, track->max_packet_size); /* Max packet size */
 
-    put_be32(pb, 12); /* size */
-    put_tag(pb, "tims");
-    put_be32(pb, track->timescale);
+    avio_wb32(pb, 12); /* size */
+    ffio_wfourcc(pb, "tims");
+    avio_wb32(pb, track->timescale);
 
     return updateSize(pb, pos);
 }
 
-static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stsd");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, 1); /* entry count */
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "stsd");
+    avio_wb32(pb, 0); /* version & flags */
+    avio_wb32(pb, 1); /* entry count */
     if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
         mov_write_video_tag(pb, track);
     else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
@@ -869,7 +897,7 @@ static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track)
     return updateSize(pb, pos);
 }
 
-static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track)
 {
     MOVStts *ctts_entries;
     uint32_t entries = 0;
@@ -890,20 +918,20 @@ static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track)
     }
     entries++; /* last one */
     atom_size = 16 + (entries * 8);
-    put_be32(pb, atom_size); /* size */
-    put_tag(pb, "ctts");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, entries); /* entry count */
+    avio_wb32(pb, atom_size); /* size */
+    ffio_wfourcc(pb, "ctts");
+    avio_wb32(pb, 0); /* version & flags */
+    avio_wb32(pb, entries); /* entry count */
     for (i=0; i<entries; i++) {
-        put_be32(pb, ctts_entries[i].count);
-        put_be32(pb, ctts_entries[i].duration);
+        avio_wb32(pb, ctts_entries[i].count);
+        avio_wb32(pb, ctts_entries[i].duration);
     }
     av_free(ctts_entries);
     return atom_size;
 }
 
 /* Time to sample atom */
-static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
 {
     MOVStts *stts_entries;
     uint32_t entries = -1;
@@ -932,37 +960,37 @@ static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track)
         entries++; /* last one */
     }
     atom_size = 16 + (entries * 8);
-    put_be32(pb, atom_size); /* size */
-    put_tag(pb, "stts");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, entries); /* entry count */
+    avio_wb32(pb, atom_size); /* size */
+    ffio_wfourcc(pb, "stts");
+    avio_wb32(pb, 0); /* version & flags */
+    avio_wb32(pb, entries); /* entry count */
     for (i=0; i<entries; i++) {
-        put_be32(pb, stts_entries[i].count);
-        put_be32(pb, stts_entries[i].duration);
+        avio_wb32(pb, stts_entries[i].count);
+        avio_wb32(pb, stts_entries[i].duration);
     }
     av_free(stts_entries);
     return atom_size;
 }
 
-static int mov_write_dref_tag(ByteIOContext *pb)
+static int mov_write_dref_tag(AVIOContext *pb)
 {
-    put_be32(pb, 28); /* size */
-    put_tag(pb, "dref");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, 1); /* entry count */
+    avio_wb32(pb, 28); /* size */
+    ffio_wfourcc(pb, "dref");
+    avio_wb32(pb, 0); /* version & flags */
+    avio_wb32(pb, 1); /* entry count */
 
-    put_be32(pb, 0xc); /* size */
-    put_tag(pb, "url ");
-    put_be32(pb, 1); /* version & flags */
+    avio_wb32(pb, 0xc); /* size */
+    ffio_wfourcc(pb, "url ");
+    avio_wb32(pb, 1); /* version & flags */
 
     return 28;
 }
 
-static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stbl");
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "stbl");
     mov_write_stsd_tag(pb, track);
     mov_write_stts_tag(pb, track);
     if ((track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
@@ -980,62 +1008,62 @@ static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track)
     return updateSize(pb, pos);
 }
 
-static int mov_write_dinf_tag(ByteIOContext *pb)
+static int mov_write_dinf_tag(AVIOContext *pb)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "dinf");
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "dinf");
     mov_write_dref_tag(pb);
     return updateSize(pb, pos);
 }
 
-static int mov_write_nmhd_tag(ByteIOContext *pb)
+static int mov_write_nmhd_tag(AVIOContext *pb)
 {
-    put_be32(pb, 12);
-    put_tag(pb, "nmhd");
-    put_be32(pb, 0);
+    avio_wb32(pb, 12);
+    ffio_wfourcc(pb, "nmhd");
+    avio_wb32(pb, 0);
     return 12;
 }
 
-static int mov_write_gmhd_tag(ByteIOContext *pb)
+static int mov_write_gmhd_tag(AVIOContext *pb)
 {
-    put_be32(pb, 0x20);   /* size */
-    put_tag(pb, "gmhd");
-    put_be32(pb, 0x18);   /* gmin size */
-    put_tag(pb, "gmin");  /* generic media info */
-    put_be32(pb, 0);      /* version & flags */
-    put_be16(pb, 0x40);   /* graphics mode = */
-    put_be16(pb, 0x8000); /* opColor (r?) */
-    put_be16(pb, 0x8000); /* opColor (g?) */
-    put_be16(pb, 0x8000); /* opColor (b?) */
-    put_be16(pb, 0);      /* balance */
-    put_be16(pb, 0);      /* reserved */
+    avio_wb32(pb, 0x20);   /* size */
+    ffio_wfourcc(pb, "gmhd");
+    avio_wb32(pb, 0x18);   /* gmin size */
+    ffio_wfourcc(pb, "gmin");/* generic media info */
+    avio_wb32(pb, 0);      /* version & flags */
+    avio_wb16(pb, 0x40);   /* graphics mode = */
+    avio_wb16(pb, 0x8000); /* opColor (r?) */
+    avio_wb16(pb, 0x8000); /* opColor (g?) */
+    avio_wb16(pb, 0x8000); /* opColor (b?) */
+    avio_wb16(pb, 0);      /* balance */
+    avio_wb16(pb, 0);      /* reserved */
     return 0x20;
 }
 
-static int mov_write_smhd_tag(ByteIOContext *pb)
+static int mov_write_smhd_tag(AVIOContext *pb)
 {
-    put_be32(pb, 16); /* size */
-    put_tag(pb, "smhd");
-    put_be32(pb, 0); /* version & flags */
-    put_be16(pb, 0); /* reserved (balance, normally = 0) */
-    put_be16(pb, 0); /* reserved */
+    avio_wb32(pb, 16); /* size */
+    ffio_wfourcc(pb, "smhd");
+    avio_wb32(pb, 0); /* version & flags */
+    avio_wb16(pb, 0); /* reserved (balance, normally = 0) */
+    avio_wb16(pb, 0); /* reserved */
     return 16;
 }
 
-static int mov_write_vmhd_tag(ByteIOContext *pb)
+static int mov_write_vmhd_tag(AVIOContext *pb)
 {
-    put_be32(pb, 0x14); /* size (always 0x14) */
-    put_tag(pb, "vmhd");
-    put_be32(pb, 0x01); /* version & flags */
-    put_be64(pb, 0); /* reserved (graphics mode = copy) */
+    avio_wb32(pb, 0x14); /* size (always 0x14) */
+    ffio_wfourcc(pb, "vmhd");
+    avio_wb32(pb, 0x01); /* version & flags */
+    avio_wb64(pb, 0); /* reserved (graphics mode = copy) */
     return 0x14;
 }
 
-static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
 {
     const char *hdlr, *descr = NULL, *hdlr_type = NULL;
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
 
     if (!track) { /* no media --> data handler */
         hdlr = "dhlr";
@@ -1059,42 +1087,42 @@ static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track)
         }
     }
 
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "hdlr");
-    put_be32(pb, 0); /* Version & flags */
-    put_buffer(pb, hdlr, 4); /* handler */
-    put_tag(pb, hdlr_type); /* handler type */
-    put_be32(pb ,0); /* reserved */
-    put_be32(pb ,0); /* reserved */
-    put_be32(pb ,0); /* reserved */
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "hdlr");
+    avio_wb32(pb, 0); /* Version & flags */
+    avio_write(pb, hdlr, 4); /* handler */
+    ffio_wfourcc(pb, hdlr_type); /* handler type */
+    avio_wb32(pb ,0); /* reserved */
+    avio_wb32(pb ,0); /* reserved */
+    avio_wb32(pb ,0); /* reserved */
     if (!track || track->mode == MODE_MOV)
-        put_byte(pb, strlen(descr)); /* pascal string */
-    put_buffer(pb, descr, strlen(descr)); /* handler description */
+        avio_w8(pb, strlen(descr)); /* pascal string */
+    avio_write(pb, descr, strlen(descr)); /* handler description */
     if (track && track->mode != MODE_MOV)
-        put_byte(pb, 0); /* c string */
+        avio_w8(pb, 0); /* c string */
     return updateSize(pb, pos);
 }
 
-static int mov_write_hmhd_tag(ByteIOContext *pb)
+static int mov_write_hmhd_tag(AVIOContext *pb)
 {
     /* This atom must be present, but leaving the values at zero
      * seems harmless. */
-    put_be32(pb, 28); /* size */
-    put_tag(pb, "hmhd");
-    put_be32(pb, 0); /* version, flags */
-    put_be16(pb, 0); /* maxPDUsize */
-    put_be16(pb, 0); /* avgPDUsize */
-    put_be32(pb, 0); /* maxbitrate */
-    put_be32(pb, 0); /* avgbitrate */
-    put_be32(pb, 0); /* reserved */
+    avio_wb32(pb, 28); /* size */
+    ffio_wfourcc(pb, "hmhd");
+    avio_wb32(pb, 0); /* version, flags */
+    avio_wb16(pb, 0); /* maxPDUsize */
+    avio_wb16(pb, 0); /* avgPDUsize */
+    avio_wb32(pb, 0); /* maxbitrate */
+    avio_wb32(pb, 0); /* avgbitrate */
+    avio_wb32(pb, 0); /* reserved */
     return 28;
 }
 
-static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "minf");
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "minf");
     if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
         mov_write_vmhd_tag(pb);
     else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
@@ -1112,25 +1140,25 @@ static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track)
     return updateSize(pb, pos);
 }
 
-static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
 {
     int version = track->trackDuration < INT32_MAX ? 0 : 1;
 
-    (version == 1) ? put_be32(pb, 44) : put_be32(pb, 32); /* size */
-    put_tag(pb, "mdhd");
-    put_byte(pb, version);
-    put_be24(pb, 0); /* flags */
+    (version == 1) ? avio_wb32(pb, 44) : avio_wb32(pb, 32); /* size */
+    ffio_wfourcc(pb, "mdhd");
+    avio_w8(pb, version);
+    avio_wb24(pb, 0); /* flags */
     if (version == 1) {
-        put_be64(pb, track->time);
-        put_be64(pb, track->time);
+        avio_wb64(pb, track->time);
+        avio_wb64(pb, track->time);
     } else {
-        put_be32(pb, track->time); /* creation time */
-        put_be32(pb, track->time); /* modification time */
+        avio_wb32(pb, track->time); /* creation time */
+        avio_wb32(pb, track->time); /* modification time */
     }
-    put_be32(pb, track->timescale); /* time scale (sample rate for audio) */
-    (version == 1) ? put_be64(pb, track->trackDuration) : put_be32(pb, track->trackDuration); /* duration */
-    put_be16(pb, track->language); /* language */
-    put_be16(pb, 0); /* reserved (quality) */
+    avio_wb32(pb, track->timescale); /* time scale (sample rate for audio) */
+    (version == 1) ? avio_wb64(pb, track->trackDuration) : avio_wb32(pb, track->trackDuration); /* duration */
+    avio_wb16(pb, track->language); /* language */
+    avio_wb16(pb, 0); /* reserved (quality) */
 
     if(version!=0 && track->mode == MODE_MOV){
         av_log(NULL, AV_LOG_ERROR,
@@ -1142,124 +1170,154 @@ static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track)
     return 32;
 }
 
-static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "mdia");
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "mdia");
     mov_write_mdhd_tag(pb, track);
     mov_write_hdlr_tag(pb, track);
     mov_write_minf_tag(pb, track);
     return updateSize(pb, pos);
 }
 
-static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
+static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
 {
     int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
                                       track->timescale, AV_ROUND_UP);
     int version = duration < INT32_MAX ? 0 : 1;
 
-    (version == 1) ? put_be32(pb, 104) : put_be32(pb, 92); /* size */
-    put_tag(pb, "tkhd");
-    put_byte(pb, version);
-    put_be24(pb, 0xf); /* flags (track enabled) */
+    (version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */
+    ffio_wfourcc(pb, "tkhd");
+    avio_w8(pb, version);
+    avio_wb24(pb, 0xf); /* flags (track enabled) */
     if (version == 1) {
-        put_be64(pb, track->time);
-        put_be64(pb, track->time);
+        avio_wb64(pb, track->time);
+        avio_wb64(pb, track->time);
     } else {
-        put_be32(pb, track->time); /* creation time */
-        put_be32(pb, track->time); /* modification time */
+        avio_wb32(pb, track->time); /* creation time */
+        avio_wb32(pb, track->time); /* modification time */
     }
-    put_be32(pb, track->trackID); /* track-id */
-    put_be32(pb, 0); /* reserved */
-    (version == 1) ? put_be64(pb, duration) : put_be32(pb, duration);
+    avio_wb32(pb, track->trackID); /* track-id */
+    avio_wb32(pb, 0); /* reserved */
+    (version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration);
 
-    put_be32(pb, 0); /* reserved */
-    put_be32(pb, 0); /* reserved */
-    put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */
+    avio_wb32(pb, 0); /* reserved */
+    avio_wb32(pb, 0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved (Layer & Alternate group) */
     /* Volume, only for audio */
     if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
-        put_be16(pb, 0x0100);
+        avio_wb16(pb, 0x0100);
     else
-        put_be16(pb, 0);
-    put_be16(pb, 0); /* reserved */
+        avio_wb16(pb, 0);
+    avio_wb16(pb, 0); /* reserved */
 
     /* Matrix structure */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x40000000); /* reserved */
+    avio_wb32(pb, 0x00010000); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x00010000); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x40000000); /* reserved */
 
     /* Track width and height, for visual only */
     if(st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
               track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) {
-        double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
-        if(!sample_aspect_ratio || track->height != track->enc->height)
-            sample_aspect_ratio = 1;
-        put_be32(pb, sample_aspect_ratio * track->enc->width*0x10000);
-        put_be32(pb, track->height*0x10000);
+        if(track->mode == MODE_MOV) {
+            avio_wb32(pb, track->enc->width << 16);
+            avio_wb32(pb, track->height << 16);
+        } else {
+            double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
+            if(!sample_aspect_ratio || track->height != track->enc->height)
+                sample_aspect_ratio = 1;
+            avio_wb32(pb, sample_aspect_ratio * track->enc->width*0x10000);
+            avio_wb32(pb, track->height*0x10000);
+        }
     }
     else {
-        put_be32(pb, 0);
-        put_be32(pb, 0);
+        avio_wb32(pb, 0);
+        avio_wb32(pb, 0);
     }
     return 0x5c;
 }
 
+static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track)
+{
+    int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width,
+                               track->enc->sample_aspect_ratio.den);
+
+    int64_t pos = avio_tell(pb);
+
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "tapt");
+
+    avio_wb32(pb, 20);
+    ffio_wfourcc(pb, "clef");
+    avio_wb32(pb, 0);
+    avio_wb32(pb, width << 16);
+    avio_wb32(pb, track->enc->height << 16);
+
+    avio_wb32(pb, 20);
+    ffio_wfourcc(pb, "enof");
+    avio_wb32(pb, 0);
+    avio_wb32(pb, track->enc->width << 16);
+    avio_wb32(pb, track->enc->height << 16);
+
+    return updateSize(pb, pos);
+};
+
 // This box seems important for the psp playback ... without it the movie seems to hang
-static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
 {
-    put_be32(pb, 0x24); /* size  */
-    put_tag(pb, "edts");
-    put_be32(pb, 0x1c); /* size  */
-    put_tag(pb, "elst");
-    put_be32(pb, 0x0);
-    put_be32(pb, 0x1);
+    avio_wb32(pb, 0x24); /* size  */
+    ffio_wfourcc(pb, "edts");
+    avio_wb32(pb, 0x1c); /* size  */
+    ffio_wfourcc(pb, "elst");
+    avio_wb32(pb, 0x0);
+    avio_wb32(pb, 0x1);
 
     /* duration   ... doesn't seem to effect psp */
-    put_be32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
+    avio_wb32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
                                 track->timescale, AV_ROUND_UP));
 
-    put_be32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */
-    put_be32(pb, 0x00010000);
+    avio_wb32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */
+    avio_wb32(pb, 0x00010000);
     return 0x24;
 }
 
-static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track)
+static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track)
 {
-    put_be32(pb, 20);   // size
-    put_tag(pb, "tref");
-    put_be32(pb, 12);   // size (subatom)
-    put_le32(pb, track->tref_tag);
-    put_be32(pb, track->tref_id);
+    avio_wb32(pb, 20);   // size
+    ffio_wfourcc(pb, "tref");
+    avio_wb32(pb, 12);   // size (subatom)
+    avio_wl32(pb, track->tref_tag);
+    avio_wb32(pb, track->tref_id);
     return 20;
 }
 
 // goes at the end of each track!  ... Critical for PSP playback ("Incompatible data" without it)
-static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov)
-{
-    put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */
-    put_tag(pb, "uuid");
-    put_tag(pb, "USMT");
-    put_be32(pb, 0x21d24fce);
-    put_be32(pb, 0xbb88695c);
-    put_be32(pb, 0xfac9c740);
-    put_be32(pb, 0x1c);     // another size here!
-    put_tag(pb, "MTDT");
-    put_be32(pb, 0x00010012);
-    put_be32(pb, 0x0a);
-    put_be32(pb, 0x55c40000);
-    put_be32(pb, 0x1);
-    put_be32(pb, 0x0);
+static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov)
+{
+    avio_wb32(pb, 0x34); /* size ... reports as 28 in mp4box! */
+    ffio_wfourcc(pb, "uuid");
+    ffio_wfourcc(pb, "USMT");
+    avio_wb32(pb, 0x21d24fce);
+    avio_wb32(pb, 0xbb88695c);
+    avio_wb32(pb, 0xfac9c740);
+    avio_wb32(pb, 0x1c);     // another size here!
+    ffio_wfourcc(pb, "MTDT");
+    avio_wb32(pb, 0x00010012);
+    avio_wb32(pb, 0x0a);
+    avio_wb32(pb, 0x55c40000);
+    avio_wb32(pb, 0x1);
+    avio_wb32(pb, 0x0);
     return 0x34;
 }
 
-static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index)
+static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index)
 {
     char buf[1000] = "";
     int len;
@@ -1268,21 +1326,21 @@ static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index)
     av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
     len = strlen(buf);
 
-    put_be32(pb, len + 24);
-    put_tag (pb, "udta");
-    put_be32(pb, len + 16);
-    put_tag (pb, "hnti");
-    put_be32(pb, len + 8);
-    put_tag (pb, "sdp ");
-    put_buffer(pb, buf, len);
+    avio_wb32(pb, len + 24);
+    ffio_wfourcc(pb, "udta");
+    avio_wb32(pb, len + 16);
+    ffio_wfourcc(pb, "hnti");
+    avio_wb32(pb, len + 8);
+    ffio_wfourcc(pb, "sdp ");
+    avio_write(pb, buf, len);
     return len + 24;
 }
 
-static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
+static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "trak");
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "trak");
     mov_write_tkhd_tag(pb, track, st);
     if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS)
         mov_write_edts_tag(pb, track);  // PSP Movies require edts box
@@ -1293,26 +1351,31 @@ static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
         mov_write_uuid_tag_psp(pb,track);  // PSP Movies require this uuid box
     if (track->tag == MKTAG('r','t','p',' '))
         mov_write_udta_sdp(pb, track->rtp_ctx->streams[0]->codec, track->trackID);
+    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO && track->mode == MODE_MOV) {
+        double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
+        if (0.0 != sample_aspect_ratio && 1.0 != sample_aspect_ratio)
+            mov_write_tapt_tag(pb, track);
+    };
     return updateSize(pb, pos);
 }
 
 #if 0
 /* TODO: Not sorted out, but not necessary either */
-static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov)
-{
-    put_be32(pb, 0x15); /* size */
-    put_tag(pb, "iods");
-    put_be32(pb, 0);    /* version & flags */
-    put_be16(pb, 0x1007);
-    put_byte(pb, 0);
-    put_be16(pb, 0x4fff);
-    put_be16(pb, 0xfffe);
-    put_be16(pb, 0x01ff);
+static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
+{
+    avio_wb32(pb, 0x15); /* size */
+    ffio_wfourcc(pb, "iods");
+    avio_wb32(pb, 0);    /* version & flags */
+    avio_wb16(pb, 0x1007);
+    avio_w8(pb, 0);
+    avio_wb16(pb, 0x4fff);
+    avio_wb16(pb, 0xfffe);
+    avio_wb16(pb, 0x01ff);
     return 0x15;
 }
 #endif
 
-static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov)
+static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
 {
     int maxTrackID = 1, i;
     int64_t maxTrackLenTemp, maxTrackLen = 0;
@@ -1332,96 +1395,96 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov)
     }
 
     version = maxTrackLen < UINT32_MAX ? 0 : 1;
-    (version == 1) ? put_be32(pb, 120) : put_be32(pb, 108); /* size */
-    put_tag(pb, "mvhd");
-    put_byte(pb, version);
-    put_be24(pb, 0); /* flags */
+    (version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */
+    ffio_wfourcc(pb, "mvhd");
+    avio_w8(pb, version);
+    avio_wb24(pb, 0); /* flags */
     if (version == 1) {
-        put_be64(pb, mov->time);
-        put_be64(pb, mov->time);
+        avio_wb64(pb, mov->time);
+        avio_wb64(pb, mov->time);
     } else {
-        put_be32(pb, mov->time); /* creation time */
-        put_be32(pb, mov->time); /* modification time */
+        avio_wb32(pb, mov->time); /* creation time */
+        avio_wb32(pb, mov->time); /* modification time */
     }
-    put_be32(pb, MOV_TIMESCALE);
-    (version == 1) ? put_be64(pb, maxTrackLen) : put_be32(pb, maxTrackLen); /* duration of longest track */
+    avio_wb32(pb, MOV_TIMESCALE);
+    (version == 1) ? avio_wb64(pb, maxTrackLen) : avio_wb32(pb, maxTrackLen); /* duration of longest track */
 
-    put_be32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */
-    put_be16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */
-    put_be16(pb, 0); /* reserved */
-    put_be32(pb, 0); /* reserved */
-    put_be32(pb, 0); /* reserved */
+    avio_wb32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */
+    avio_wb16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */
+    avio_wb16(pb, 0); /* reserved */
+    avio_wb32(pb, 0); /* reserved */
+    avio_wb32(pb, 0); /* reserved */
 
     /* Matrix structure */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x40000000); /* reserved */
-
-    put_be32(pb, 0); /* reserved (preview time) */
-    put_be32(pb, 0); /* reserved (preview duration) */
-    put_be32(pb, 0); /* reserved (poster time) */
-    put_be32(pb, 0); /* reserved (selection time) */
-    put_be32(pb, 0); /* reserved (selection duration) */
-    put_be32(pb, 0); /* reserved (current time) */
-    put_be32(pb, maxTrackID+1); /* Next track id */
+    avio_wb32(pb, 0x00010000); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x00010000); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x0); /* reserved */
+    avio_wb32(pb, 0x40000000); /* reserved */
+
+    avio_wb32(pb, 0); /* reserved (preview time) */
+    avio_wb32(pb, 0); /* reserved (preview duration) */
+    avio_wb32(pb, 0); /* reserved (poster time) */
+    avio_wb32(pb, 0); /* reserved (selection time) */
+    avio_wb32(pb, 0); /* reserved (selection duration) */
+    avio_wb32(pb, 0); /* reserved (current time) */
+    avio_wb32(pb, maxTrackID+1); /* Next track id */
     return 0x6c;
 }
 
-static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov,
+static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov,
                                      AVFormatContext *s)
 {
-    put_be32(pb, 33); /* size */
-    put_tag(pb, "hdlr");
-    put_be32(pb, 0);
-    put_be32(pb, 0);
-    put_tag(pb, "mdir");
-    put_tag(pb, "appl");
-    put_be32(pb, 0);
-    put_be32(pb, 0);
-    put_byte(pb, 0);
+    avio_wb32(pb, 33); /* size */
+    ffio_wfourcc(pb, "hdlr");
+    avio_wb32(pb, 0);
+    avio_wb32(pb, 0);
+    ffio_wfourcc(pb, "mdir");
+    ffio_wfourcc(pb, "appl");
+    avio_wb32(pb, 0);
+    avio_wb32(pb, 0);
+    avio_w8(pb, 0);
     return 33;
 }
 
 /* helper function to write a data tag with the specified string as data */
-static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lang, int long_style)
+static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang, int long_style)
 {
     if(long_style){
         int size = 16 + strlen(data);
-        put_be32(pb, size); /* size */
-        put_tag(pb, "data");
-        put_be32(pb, 1);
-        put_be32(pb, 0);
-        put_buffer(pb, data, strlen(data));
+        avio_wb32(pb, size); /* size */
+        ffio_wfourcc(pb, "data");
+        avio_wb32(pb, 1);
+        avio_wb32(pb, 0);
+        avio_write(pb, data, strlen(data));
         return size;
     }else{
         if (!lang)
             lang = ff_mov_iso639_to_lang("und", 1);
-        put_be16(pb, strlen(data)); /* string length */
-        put_be16(pb, lang);
-        put_buffer(pb, data, strlen(data));
+        avio_wb16(pb, strlen(data)); /* string length */
+        avio_wb16(pb, lang);
+        avio_write(pb, data, strlen(data));
         return strlen(data) + 4;
     }
 }
 
-static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int lang, int long_style){
+static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){
     int size = 0;
     if (value && value[0]) {
-        int64_t pos = url_ftell(pb);
-        put_be32(pb, 0); /* size */
-        put_tag(pb, name);
+        int64_t pos = avio_tell(pb);
+        avio_wb32(pb, 0); /* size */
+        ffio_wfourcc(pb, name);
         mov_write_string_data_tag(pb, value, lang, long_style);
         size= updateSize(pb, pos);
     }
     return size;
 }
 
-static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb,
+static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
                                      const char *name, const char *tag,
                                      int long_style)
 {
@@ -1446,34 +1509,34 @@ static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb,
 }
 
 /* iTunes track number */
-static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov,
+static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov,
                               AVFormatContext *s)
 {
     AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0);
     int size = 0, track = t ? atoi(t->value) : 0;
     if (track) {
-        put_be32(pb, 32); /* size */
-        put_tag(pb, "trkn");
-            put_be32(pb, 24); /* size */
-            put_tag(pb, "data");
-            put_be32(pb, 0);        // 8 bytes empty
-            put_be32(pb, 0);
-            put_be16(pb, 0);        // empty
-            put_be16(pb, track);    // track number
-            put_be16(pb, 0);        // total track number
-            put_be16(pb, 0);        // empty
+        avio_wb32(pb, 32); /* size */
+        ffio_wfourcc(pb, "trkn");
+            avio_wb32(pb, 24); /* size */
+            ffio_wfourcc(pb, "data");
+            avio_wb32(pb, 0);        // 8 bytes empty
+            avio_wb32(pb, 0);
+            avio_wb16(pb, 0);        // empty
+            avio_wb16(pb, track);    // track number
+            avio_wb16(pb, 0);        // total track number
+            avio_wb16(pb, 0);        // empty
         size = 32;
     }
     return size;
 }
 
 /* iTunes meta data list */
-static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov,
+static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
                               AVFormatContext *s)
 {
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "ilst");
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "ilst");
     mov_write_string_metadata(s, pb, "\251nam", "title"    , 1);
     mov_write_string_metadata(s, pb, "\251ART", "artist"   , 1);
     mov_write_string_metadata(s, pb, "aART", "album_artist", 1);
@@ -1496,14 +1559,14 @@ static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov,
 }
 
 /* iTunes meta data tag */
-static int mov_write_meta_tag(ByteIOContext *pb, MOVMuxContext *mov,
+static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov,
                               AVFormatContext *s)
 {
     int size = 0;
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "meta");
-    put_be32(pb, 0);
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "meta");
+    avio_wb32(pb, 0);
     mov_write_itunes_hdlr_tag(pb, mov, s);
     mov_write_ilst_tag(pb, mov, s);
     size = updateSize(pb, pos);
@@ -1521,14 +1584,14 @@ static int utf8len(const uint8_t *b)
     return len;
 }
 
-static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b)
+static int ascii_to_wc(AVIOContext *pb, const uint8_t *b)
 {
     int val;
     while(*b){
         GET_UTF8(val, *b++, return -1;)
-        put_be16(pb, val);
+        avio_wb16(pb, val);
     }
-    put_be16(pb, 0x00);
+    avio_wb16(pb, 0x00);
     return 0;
 }
 
@@ -1537,58 +1600,58 @@ static uint16_t language_code(const char *str)
     return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F);
 }
 
-static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s,
+static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
                                   const char *tag, const char *str)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0);
     if (!t || !utf8len(t->value))
         return 0;
-    put_be32(pb, 0);   /* size */
-    put_tag (pb, tag); /* type */
-    put_be32(pb, 0);   /* version + flags */
+    avio_wb32(pb, 0);   /* size */
+    ffio_wfourcc(pb, tag); /* type */
+    avio_wb32(pb, 0);   /* version + flags */
     if (!strcmp(tag, "yrrc"))
-        put_be16(pb, atoi(t->value));
+        avio_wb16(pb, atoi(t->value));
     else {
-        put_be16(pb, language_code("eng")); /* language */
-        put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */
+        avio_wb16(pb, language_code("eng")); /* language */
+        avio_write(pb, t->value, strlen(t->value)+1); /* UTF8 string value */
         if (!strcmp(tag, "albm") &&
             (t = av_metadata_get(s->metadata, "track", NULL, 0)))
-            put_byte(pb, atoi(t->value));
+            avio_w8(pb, atoi(t->value));
     }
     return updateSize(pb, pos);
 }
 
-static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s)
+static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
 {
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     int i, nb_chapters = FFMIN(s->nb_chapters, 255);
 
-    put_be32(pb, 0);            // size
-    put_tag (pb, "chpl");
-    put_be32(pb, 0x01000000);   // version + flags
-    put_be32(pb, 0);            // unknown
-    put_byte(pb, nb_chapters);
+    avio_wb32(pb, 0);            // size
+    ffio_wfourcc(pb, "chpl");
+    avio_wb32(pb, 0x01000000);   // version + flags
+    avio_wb32(pb, 0);            // unknown
+    avio_w8(pb, nb_chapters);
 
     for (i = 0; i < nb_chapters; i++) {
         AVChapter *c = s->chapters[i];
         AVMetadataTag *t;
-        put_be64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000}));
+        avio_wb64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000}));
 
         if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) {
             int len = FFMIN(strlen(t->value), 255);
-            put_byte(pb, len);
-            put_buffer(pb, t->value, len);
+            avio_w8(pb, len);
+            avio_write(pb, t->value, len);
         } else
-            put_byte(pb, 0);
+            avio_w8(pb, 0);
     }
     return updateSize(pb, pos);
 }
 
-static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov,
+static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
                               AVFormatContext *s)
 {
-    ByteIOContext *pb_buf;
+    AVIOContext *pb_buf;
     int i, ret, size;
     uint8_t *buf;
 
@@ -1597,7 +1660,7 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov,
             return 0;
         }
 
-    ret = url_open_dyn_buf(&pb_buf);
+    ret = avio_open_dyn_buf(&pb_buf);
     if(ret < 0)
         return ret;
 
@@ -1628,54 +1691,54 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov,
         if (s->nb_chapters)
             mov_write_chpl_tag(pb_buf, s);
 
-    if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) {
-        put_be32(pb, size+8);
-        put_tag(pb, "udta");
-        put_buffer(pb, buf, size);
+    if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) {
+        avio_wb32(pb, size+8);
+        ffio_wfourcc(pb, "udta");
+        avio_write(pb, buf, size);
     }
     av_free(buf);
 
     return 0;
 }
 
-static void mov_write_psp_udta_tag(ByteIOContext *pb,
+static void mov_write_psp_udta_tag(AVIOContext *pb,
                                   const char *str, const char *lang, int type)
 {
     int len = utf8len(str)+1;
     if(len<=0)
         return;
-    put_be16(pb, len*2+10);            /* size */
-    put_be32(pb, type);                /* type */
-    put_be16(pb, language_code(lang)); /* language */
-    put_be16(pb, 0x01);                /* ? */
+    avio_wb16(pb, len*2+10);            /* size */
+    avio_wb32(pb, type);                /* type */
+    avio_wb16(pb, language_code(lang)); /* language */
+    avio_wb16(pb, 0x01);                /* ? */
     ascii_to_wc(pb, str);
 }
 
-static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s)
+static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
 {
     AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0);
     int64_t pos, pos2;
 
     if (title) {
-        pos = url_ftell(pb);
-        put_be32(pb, 0); /* size placeholder*/
-        put_tag(pb, "uuid");
-        put_tag(pb, "USMT");
-        put_be32(pb, 0x21d24fce); /* 96 bit UUID */
-        put_be32(pb, 0xbb88695c);
-        put_be32(pb, 0xfac9c740);
-
-        pos2 = url_ftell(pb);
-        put_be32(pb, 0); /* size placeholder*/
-        put_tag(pb, "MTDT");
-        put_be16(pb, 4);
+        pos = avio_tell(pb);
+        avio_wb32(pb, 0); /* size placeholder*/
+        ffio_wfourcc(pb, "uuid");
+        ffio_wfourcc(pb, "USMT");
+        avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */
+        avio_wb32(pb, 0xbb88695c);
+        avio_wb32(pb, 0xfac9c740);
+
+        pos2 = avio_tell(pb);
+        avio_wb32(pb, 0); /* size placeholder*/
+        ffio_wfourcc(pb, "MTDT");
+        avio_wb16(pb, 4);
 
         // ?
-        put_be16(pb, 0x0C);                 /* size */
-        put_be32(pb, 0x0B);                 /* type */
-        put_be16(pb, language_code("und")); /* language */
-        put_be16(pb, 0x0);                  /* ? */
-        put_be16(pb, 0x021C);               /* data */
+        avio_wb16(pb, 0x0C);                 /* size */
+        avio_wb32(pb, 0x0B);                 /* type */
+        avio_wb16(pb, language_code("und")); /* language */
+        avio_wb16(pb, 0x0);                  /* ? */
+        avio_wb16(pb, 0x021C);               /* data */
 
         mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT,      "eng", 0x04);
         mov_write_psp_udta_tag(pb, title->value,          "eng", 0x01);
@@ -1689,13 +1752,13 @@ static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s)
     return 0;
 }
 
-static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov,
+static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
                               AVFormatContext *s)
 {
     int i;
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size placeholder*/
-    put_tag(pb, "moov");
+    int64_t pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size placeholder*/
+    ffio_wfourcc(pb, "moov");
 
     for (i=0; i<mov->nb_streams; i++) {
         if(mov->tracks[i].entry <= 0) continue;
@@ -1733,22 +1796,22 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov,
     return updateSize(pb, pos);
 }
 
-static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov)
+static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
 {
-    put_be32(pb, 8);    // placeholder for extended size field (64 bit)
-    put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free");
+    avio_wb32(pb, 8);    // placeholder for extended size field (64 bit)
+    ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free");
 
-    mov->mdat_pos = url_ftell(pb);
-    put_be32(pb, 0); /* size placeholder*/
-    put_tag(pb, "mdat");
+    mov->mdat_pos = avio_tell(pb);
+    avio_wb32(pb, 0); /* size placeholder*/
+    ffio_wfourcc(pb, "mdat");
     return 0;
 }
 
 /* TODO: This needs to be more general */
-static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
+static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
 {
     MOVMuxContext *mov = s->priv_data;
-    int64_t pos = url_ftell(pb);
+    int64_t pos = avio_tell(pb);
     int has_h264 = 0, has_video = 0;
     int minor = 0x200;
     int i;
@@ -1761,47 +1824,47 @@ static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
             has_h264 = 1;
     }
 
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "ftyp");
+    avio_wb32(pb, 0); /* size */
+    ffio_wfourcc(pb, "ftyp");
 
     if (mov->mode == MODE_3GP) {
-        put_tag(pb, has_h264 ? "3gp6"  : "3gp4");
+        ffio_wfourcc(pb, has_h264 ? "3gp6"  : "3gp4");
         minor =     has_h264 ?   0x100 :   0x200;
     } else if (mov->mode & MODE_3G2) {
-        put_tag(pb, has_h264 ? "3g2b"  : "3g2a");
+        ffio_wfourcc(pb, has_h264 ? "3g2b"  : "3g2a");
         minor =     has_h264 ? 0x20000 : 0x10000;
     }else if (mov->mode == MODE_PSP)
-        put_tag(pb, "MSNV");
+        ffio_wfourcc(pb, "MSNV");
     else if (mov->mode == MODE_MP4)
-        put_tag(pb, "isom");
+        ffio_wfourcc(pb, "isom");
     else if (mov->mode == MODE_IPOD)
-        put_tag(pb, has_video ? "M4V ":"M4A ");
+        ffio_wfourcc(pb, has_video ? "M4V ":"M4A ");
     else
-        put_tag(pb, "qt  ");
+        ffio_wfourcc(pb, "qt  ");
 
-    put_be32(pb, minor);
+    avio_wb32(pb, minor);
 
     if(mov->mode == MODE_MOV)
-        put_tag(pb, "qt  ");
+        ffio_wfourcc(pb, "qt  ");
     else{
-        put_tag(pb, "isom");
-        put_tag(pb, "iso2");
+        ffio_wfourcc(pb, "isom");
+        ffio_wfourcc(pb, "iso2");
         if(has_h264)
-            put_tag(pb, "avc1");
+            ffio_wfourcc(pb, "avc1");
     }
 
     if (mov->mode == MODE_3GP)
-        put_tag(pb, has_h264 ? "3gp6":"3gp4");
+        ffio_wfourcc(pb, has_h264 ? "3gp6":"3gp4");
     else if (mov->mode & MODE_3G2)
-        put_tag(pb, has_h264 ? "3g2b":"3g2a");
+        ffio_wfourcc(pb, has_h264 ? "3g2b":"3g2a");
     else if (mov->mode == MODE_PSP)
-        put_tag(pb, "MSNV");
+        ffio_wfourcc(pb, "MSNV");
     else if (mov->mode == MODE_MP4)
-        put_tag(pb, "mp41");
+        ffio_wfourcc(pb, "mp41");
     return updateSize(pb, pos);
 }
 
-static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
+static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
 {
     AVCodecContext *VideoCodec = s->streams[0]->codec;
     AVCodecContext *AudioCodec = s->streams[1]->codec;
@@ -1810,56 +1873,56 @@ static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
     int audio_kbitrate= AudioCodec->bit_rate / 1000;
     int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate);
 
-    put_be32(pb, 0x94); /* size */
-    put_tag(pb, "uuid");
-    put_tag(pb, "PROF");
-
-    put_be32(pb, 0x21d24fce); /* 96 bit UUID */
-    put_be32(pb, 0xbb88695c);
-    put_be32(pb, 0xfac9c740);
-
-    put_be32(pb, 0x0);  /* ? */
-    put_be32(pb, 0x3);  /* 3 sections ? */
-
-    put_be32(pb, 0x14); /* size */
-    put_tag(pb, "FPRF");
-    put_be32(pb, 0x0);  /* ? */
-    put_be32(pb, 0x0);  /* ? */
-    put_be32(pb, 0x0);  /* ? */
-
-    put_be32(pb, 0x2c);  /* size */
-    put_tag(pb, "APRF");   /* audio */
-    put_be32(pb, 0x0);
-    put_be32(pb, 0x2);   /* TrackID */
-    put_tag(pb, "mp4a");
-    put_be32(pb, 0x20f);
-    put_be32(pb, 0x0);
-    put_be32(pb, audio_kbitrate);
-    put_be32(pb, audio_kbitrate);
-    put_be32(pb, AudioRate);
-    put_be32(pb, AudioCodec->channels);
-
-    put_be32(pb, 0x34);  /* size */
-    put_tag(pb, "VPRF");   /* video */
-    put_be32(pb, 0x0);
-    put_be32(pb, 0x1);    /* TrackID */
+    avio_wb32(pb, 0x94); /* size */
+    ffio_wfourcc(pb, "uuid");
+    ffio_wfourcc(pb, "PROF");
+
+    avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */
+    avio_wb32(pb, 0xbb88695c);
+    avio_wb32(pb, 0xfac9c740);
+
+    avio_wb32(pb, 0x0);  /* ? */
+    avio_wb32(pb, 0x3);  /* 3 sections ? */
+
+    avio_wb32(pb, 0x14); /* size */
+    ffio_wfourcc(pb, "FPRF");
+    avio_wb32(pb, 0x0);  /* ? */
+    avio_wb32(pb, 0x0);  /* ? */
+    avio_wb32(pb, 0x0);  /* ? */
+
+    avio_wb32(pb, 0x2c);  /* size */
+    ffio_wfourcc(pb, "APRF");/* audio */
+    avio_wb32(pb, 0x0);
+    avio_wb32(pb, 0x2);   /* TrackID */
+    ffio_wfourcc(pb, "mp4a");
+    avio_wb32(pb, 0x20f);
+    avio_wb32(pb, 0x0);
+    avio_wb32(pb, audio_kbitrate);
+    avio_wb32(pb, audio_kbitrate);
+    avio_wb32(pb, AudioRate);
+    avio_wb32(pb, AudioCodec->channels);
+
+    avio_wb32(pb, 0x34);  /* size */
+    ffio_wfourcc(pb, "VPRF");   /* video */
+    avio_wb32(pb, 0x0);
+    avio_wb32(pb, 0x1);    /* TrackID */
     if (VideoCodec->codec_id == CODEC_ID_H264) {
-        put_tag(pb, "avc1");
-        put_be16(pb, 0x014D);
-        put_be16(pb, 0x0015);
+        ffio_wfourcc(pb, "avc1");
+        avio_wb16(pb, 0x014D);
+        avio_wb16(pb, 0x0015);
     } else {
-        put_tag(pb, "mp4v");
-        put_be16(pb, 0x0000);
-        put_be16(pb, 0x0103);
+        ffio_wfourcc(pb, "mp4v");
+        avio_wb16(pb, 0x0000);
+        avio_wb16(pb, 0x0103);
     }
-    put_be32(pb, 0x0);
-    put_be32(pb, video_kbitrate);
-    put_be32(pb, video_kbitrate);
-    put_be32(pb, FrameRate);
-    put_be32(pb, FrameRate);
-    put_be16(pb, VideoCodec->width);
-    put_be16(pb, VideoCodec->height);
-    put_be32(pb, 0x010001); /* ? */
+    avio_wb32(pb, 0x0);
+    avio_wb32(pb, video_kbitrate);
+    avio_wb32(pb, video_kbitrate);
+    avio_wb32(pb, FrameRate);
+    avio_wb32(pb, FrameRate);
+    avio_wb16(pb, VideoCodec->width);
+    avio_wb16(pb, VideoCodec->height);
+    avio_wb32(pb, 0x010001); /* ? */
 }
 
 static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags)
@@ -1886,13 +1949,13 @@ static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags)
 int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     MOVMuxContext *mov = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     MOVTrack *trk = &mov->tracks[pkt->stream_index];
     AVCodecContext *enc = trk->enc;
     unsigned int samplesInChunk = 0;
     int size= pkt->size;
 
-    if (url_is_streamed(s->pb)) return 0; /* Can't handle that */
+    if (!s->pb->seekable) return 0; /* Can't handle that */
     if (!size) return 0; /* Discard 0 sized packets */
 
     if (enc->codec_id == CODEC_ID_AMR_NB) {
@@ -1909,6 +1972,9 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
             av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n");
             return -1;
         }
+    } else if (enc->codec_id == CODEC_ID_ADPCM_MS ||
+               enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
+        samplesInChunk = enc->frame_size;
     } else if (trk->sampleSize)
         samplesInChunk = size/trk->sampleSize;
     else
@@ -1926,7 +1992,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
         /* nal reformating needed */
         size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size);
     } else {
-        put_buffer(pb, pkt->data, size);
+        avio_write(pb, pkt->data, size);
     }
 
     if ((enc->codec_id == CODEC_ID_DNXHD ||
@@ -1945,7 +2011,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
             return -1;
     }
 
-    trk->cluster[trk->entry].pos = url_ftell(pb) - size;
+    trk->cluster[trk->entry].pos = avio_tell(pb) - size;
     trk->cluster[trk->entry].samplesInChunk = samplesInChunk;
     trk->cluster[trk->entry].size = size;
     trk->cluster[trk->entry].entries = samplesInChunk;
@@ -1961,7 +2027,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
     trk->cluster[trk->entry].cts = pkt->pts - pkt->dts;
     trk->cluster[trk->entry].flags = 0;
     if (pkt->flags & AV_PKT_FLAG_KEY) {
-        if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO) {
+        if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO &&
+            trk->entry > 0) { // force sync sample for the first key frame
             mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags);
             if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE)
                 trk->flags |= MOV_TRACK_STPS;
@@ -1975,7 +2042,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
     trk->sampleCount += samplesInChunk;
     mov->mdat_size += size;
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams)
         ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry);
@@ -2019,11 +2086,11 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
 
 static int mov_write_header(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     MOVMuxContext *mov = s->priv_data;
     int i, hint_track = 0;
 
-    if (url_is_streamed(s->pb)) {
+    if (!s->pb->seekable) {
         av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n");
         return -1;
     }
@@ -2108,6 +2175,13 @@ static int mov_write_header(AVFormatContext *s)
             if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) {
                 av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i);
                 goto error;
+            }else if(st->codec->codec_id == CODEC_ID_ADPCM_MS ||
+                     st->codec->codec_id == CODEC_ID_ADPCM_IMA_WAV){
+                if (!st->codec->block_align) {
+                    av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", i);
+                    goto error;
+                }
+                track->sampleSize = st->codec->block_align;
             }else if(st->codec->frame_size > 1){ /* assume compressed audio */
                 track->audio_vbr = 1;
             }else{
@@ -2153,7 +2227,7 @@ static int mov_write_header(AVFormatContext *s)
         }
     }
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
  error:
@@ -2164,24 +2238,24 @@ static int mov_write_header(AVFormatContext *s)
 static int mov_write_trailer(AVFormatContext *s)
 {
     MOVMuxContext *mov = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int res = 0;
     int i;
 
-    int64_t moov_pos = url_ftell(pb);
+    int64_t moov_pos = avio_tell(pb);
 
     /* Write size of mdat tag */
     if (mov->mdat_size+8 <= UINT32_MAX) {
-        url_fseek(pb, mov->mdat_pos, SEEK_SET);
-        put_be32(pb, mov->mdat_size+8);
+        avio_seek(pb, mov->mdat_pos, SEEK_SET);
+        avio_wb32(pb, mov->mdat_size+8);
     } else {
         /* overwrite 'wide' placeholder atom */
-        url_fseek(pb, mov->mdat_pos - 8, SEEK_SET);
-        put_be32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */
-        put_tag(pb, "mdat");
-        put_be64(pb, mov->mdat_size+16);
+        avio_seek(pb, mov->mdat_pos - 8, SEEK_SET);
+        avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */
+        ffio_wfourcc(pb, "mdat");
+        avio_wb64(pb, mov->mdat_size+16);
     }
-    url_fseek(pb, moov_pos, SEEK_SET);
+    avio_seek(pb, moov_pos, SEEK_SET);
 
     mov_write_moov_tag(pb, mov, s);
 
@@ -2197,7 +2271,7 @@ static int mov_write_trailer(AVFormatContext *s)
 
     }
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     av_freep(&mov->tracks);
 
@@ -2205,7 +2279,7 @@ static int mov_write_trailer(AVFormatContext *s)
 }
 
 #if CONFIG_MOV_MUXER
-AVOutputFormat mov_muxer = {
+AVOutputFormat ff_mov_muxer = {
     "mov",
     NULL_IF_CONFIG_SMALL("MOV format"),
     NULL,
@@ -2221,7 +2295,7 @@ AVOutputFormat mov_muxer = {
 };
 #endif
 #if CONFIG_TGP_MUXER
-AVOutputFormat tgp_muxer = {
+AVOutputFormat ff_tgp_muxer = {
     "3gp",
     NULL_IF_CONFIG_SMALL("3GP format"),
     NULL,
@@ -2237,7 +2311,7 @@ AVOutputFormat tgp_muxer = {
 };
 #endif
 #if CONFIG_MP4_MUXER
-AVOutputFormat mp4_muxer = {
+AVOutputFormat ff_mp4_muxer = {
     "mp4",
     NULL_IF_CONFIG_SMALL("MP4 format"),
     "application/mp4",
@@ -2253,7 +2327,7 @@ AVOutputFormat mp4_muxer = {
 };
 #endif
 #if CONFIG_PSP_MUXER
-AVOutputFormat psp_muxer = {
+AVOutputFormat ff_psp_muxer = {
     "psp",
     NULL_IF_CONFIG_SMALL("PSP MP4 format"),
     NULL,
@@ -2269,7 +2343,7 @@ AVOutputFormat psp_muxer = {
 };
 #endif
 #if CONFIG_TG2_MUXER
-AVOutputFormat tg2_muxer = {
+AVOutputFormat ff_tg2_muxer = {
     "3g2",
     NULL_IF_CONFIG_SMALL("3GP2 format"),
     NULL,
@@ -2285,7 +2359,7 @@ AVOutputFormat tg2_muxer = {
 };
 #endif
 #if CONFIG_IPOD_MUXER
-AVOutputFormat ipod_muxer = {
+AVOutputFormat ff_ipod_muxer = {
     "ipod",
     NULL_IF_CONFIG_SMALL("iPod H.264 MP4 format"),
     "application/mp4",
diff --git a/ffmpeg-mt/libavformat/movenc.h b/ffmpeg-mt/libavformat/movenc.h
index 182c5ed..0cc1eb8 100644
--- a/ffmpeg-mt/libavformat/movenc.h
+++ b/ffmpeg-mt/libavformat/movenc.h
@@ -4,20 +4,20 @@
  * Copyright (c) 2004 Gildas Bazin <gbazin at videolan dot org>
  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/movenchint.c b/ffmpeg-mt/libavformat/movenchint.c
index 2ebe8b8..6157146 100644
--- a/ffmpeg-mt/libavformat/movenchint.c
+++ b/ffmpeg-mt/libavformat/movenchint.c
@@ -2,26 +2,28 @@
  * MOV, 3GP, MP4 muxer RTP hinting
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "movenc.h"
 #include "libavutil/intreadwrite.h"
 #include "internal.h"
+#include "rtpenc_chain.h"
+#include "avio_internal.h"
 
 int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
 {
@@ -30,44 +32,20 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
     MOVTrack *src_track = &mov->tracks[src_index];
     AVStream *src_st    = s->streams[src_index];
     int ret = AVERROR(ENOMEM);
-    AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
 
     track->tag = MKTAG('r','t','p',' ');
     track->src_track = src_index;
 
-    if (!rtp_format) {
-        ret = AVERROR(ENOENT);
-        goto fail;
-    }
-
     track->enc = avcodec_alloc_context();
     if (!track->enc)
         goto fail;
     track->enc->codec_type = AVMEDIA_TYPE_DATA;
     track->enc->codec_tag  = track->tag;
 
-    track->rtp_ctx = avformat_alloc_context();
+    track->rtp_ctx = ff_rtp_chain_mux_open(s, src_st, NULL,
+                                           RTP_MAX_PACKET_SIZE);
     if (!track->rtp_ctx)
         goto fail;
-    track->rtp_ctx->oformat = rtp_format;
-    if (!av_new_stream(track->rtp_ctx, 0))
-        goto fail;
-
-    /* Copy stream parameters */
-    track->rtp_ctx->streams[0]->sample_aspect_ratio =
-                        src_st->sample_aspect_ratio;
-
-    /* Remove the allocated codec context, link to the original one
-     * instead, to give the rtp muxer access to codec parameters. */
-    av_free(track->rtp_ctx->streams[0]->codec);
-    track->rtp_ctx->streams[0]->codec = src_st->codec;
-
-    if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb,
-                                       RTP_MAX_PACKET_SIZE)) < 0)
-        goto fail;
-    ret = av_write_header(track->rtp_ctx);
-    if (ret)
-        goto fail;
 
     /* Copy the RTP AVStream timebase back to the hint AVStream */
     track->timescale = track->rtp_ctx->streams[0]->time_base.den;
@@ -79,22 +57,8 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
 fail:
     av_log(s, AV_LOG_WARNING,
            "Unable to initialize hinting of stream %d\n", src_index);
-    if (track->rtp_ctx && track->rtp_ctx->pb) {
-        uint8_t *buf;
-        url_close_dyn_buf(track->rtp_ctx->pb, &buf);
-        av_free(buf);
-    }
-    if (track->rtp_ctx && track->rtp_ctx->streams[0]) {
-        av_metadata_free(&track->rtp_ctx->streams[0]->metadata);
-        av_free(track->rtp_ctx->streams[0]);
-    }
-    if (track->rtp_ctx) {
-        av_metadata_free(&track->rtp_ctx->metadata);
-        av_free(track->rtp_ctx->priv_data);
-        av_freep(&track->rtp_ctx);
-    }
     av_freep(&track->enc);
-    /* Set a default timescale, to avoid crashes in dump_format */
+    /* Set a default timescale, to avoid crashes in av_dump_format */
     track->timescale = 90000;
     return ret;
 }
@@ -282,40 +246,40 @@ static int find_sample_match(const uint8_t *data, int len,
 }
 
 static void output_immediate(const uint8_t *data, int size,
-                             ByteIOContext *out, int *entries)
+                             AVIOContext *out, int *entries)
 {
     while (size > 0) {
         int len = size;
         if (len > 14)
             len = 14;
-        put_byte(out, 1); /* immediate constructor */
-        put_byte(out, len); /* amount of valid data */
-        put_buffer(out, data, len);
+        avio_w8(out, 1); /* immediate constructor */
+        avio_w8(out, len); /* amount of valid data */
+        avio_write(out, data, len);
         data += len;
         size -= len;
 
         for (; len < 14; len++)
-            put_byte(out, 0);
+            avio_w8(out, 0);
 
         (*entries)++;
     }
 }
 
-static void output_match(ByteIOContext *out, int match_sample,
+static void output_match(AVIOContext *out, int match_sample,
                          int match_offset, int match_len, int *entries)
 {
-    put_byte(out, 2); /* sample constructor */
-    put_byte(out, 0); /* track reference */
-    put_be16(out, match_len);
-    put_be32(out, match_sample);
-    put_be32(out, match_offset);
-    put_be16(out, 1); /* bytes per block */
-    put_be16(out, 1); /* samples per block */
+    avio_w8(out, 2); /* sample constructor */
+    avio_w8(out, 0); /* track reference */
+    avio_wb16(out, match_len);
+    avio_wb32(out, match_sample);
+    avio_wb32(out, match_offset);
+    avio_wb16(out, 1); /* bytes per block */
+    avio_wb16(out, 1); /* samples per block */
     (*entries)++;
 }
 
 static void describe_payload(const uint8_t *data, int size,
-                             ByteIOContext *out, int *entries,
+                             AVIOContext *out, int *entries,
                              HintSampleQueue *queue)
 {
     /* Describe the payload using different constructors */
@@ -346,17 +310,17 @@ static void describe_payload(const uint8_t *data, int size,
  * @param pts pointer where the timestamp for the written RTP hint is stored
  * @return the number of RTP packets in the written hint
  */
-static int write_hint_packets(ByteIOContext *out, const uint8_t *data,
+static int write_hint_packets(AVIOContext *out, const uint8_t *data,
                               int size, MOVTrack *trk, int64_t *pts)
 {
     int64_t curpos;
     int64_t count_pos, entries_pos;
     int count = 0, entries;
 
-    count_pos = url_ftell(out);
+    count_pos = avio_tell(out);
     /* RTPsample header */
-    put_be16(out, 0); /* packet count */
-    put_be16(out, 0); /* reserved */
+    avio_wb16(out, 0); /* packet count */
+    avio_wb16(out, 0); /* reserved */
 
     while (size > 4) {
         uint32_t packet_len = AV_RB32(data);
@@ -391,12 +355,12 @@ static int write_hint_packets(ByteIOContext *out, const uint8_t *data,
 
         count++;
         /* RTPpacket header */
-        put_be32(out, 0); /* relative_time */
-        put_buffer(out, data, 2); /* RTP header */
-        put_be16(out, seq); /* RTPsequenceseed */
-        put_be16(out, 0); /* reserved + flags */
-        entries_pos = url_ftell(out);
-        put_be16(out, 0); /* entry count */
+        avio_wb32(out, 0); /* relative_time */
+        avio_write(out, data, 2); /* RTP header */
+        avio_wb16(out, seq); /* RTPsequenceseed */
+        avio_wb16(out, 0); /* reserved + flags */
+        entries_pos = avio_tell(out);
+        avio_wb16(out, 0); /* entry count */
 
         data += 12;
         size -= 12;
@@ -408,16 +372,16 @@ static int write_hint_packets(ByteIOContext *out, const uint8_t *data,
         data += packet_len;
         size -= packet_len;
 
-        curpos = url_ftell(out);
-        url_fseek(out, entries_pos, SEEK_SET);
-        put_be16(out, entries);
-        url_fseek(out, curpos, SEEK_SET);
+        curpos = avio_tell(out);
+        avio_seek(out, entries_pos, SEEK_SET);
+        avio_wb16(out, entries);
+        avio_seek(out, curpos, SEEK_SET);
     }
 
-    curpos = url_ftell(out);
-    url_fseek(out, count_pos, SEEK_SET);
-    put_be16(out, count);
-    url_fseek(out, curpos, SEEK_SET);
+    curpos = avio_tell(out);
+    avio_seek(out, count_pos, SEEK_SET);
+    avio_wb16(out, count);
+    avio_seek(out, curpos, SEEK_SET);
     return count;
 }
 
@@ -429,7 +393,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
     AVFormatContext *rtp_ctx = trk->rtp_ctx;
     uint8_t *buf = NULL;
     int size;
-    ByteIOContext *hintbuf = NULL;
+    AVIOContext *hintbuf = NULL;
     AVPacket hint_pkt;
     int ret = 0, count;
 
@@ -445,8 +409,8 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
 
     /* Fetch the output from the RTP muxer, open a new output buffer
      * for next time. */
-    size = url_close_dyn_buf(rtp_ctx->pb, &buf);
-    if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb,
+    size = avio_close_dyn_buf(rtp_ctx->pb, &buf);
+    if ((ret = ffio_open_dyn_packet_buf(&rtp_ctx->pb,
                                        RTP_MAX_PACKET_SIZE)) < 0)
         goto done;
 
@@ -454,14 +418,14 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
         goto done;
 
     /* Open a buffer for writing the hint */
-    if ((ret = url_open_dyn_buf(&hintbuf)) < 0)
+    if ((ret = avio_open_dyn_buf(&hintbuf)) < 0)
         goto done;
     av_init_packet(&hint_pkt);
     count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts);
     av_freep(&buf);
 
     /* Write the hint data into the hint track */
-    hint_pkt.size = size = url_close_dyn_buf(hintbuf, &buf);
+    hint_pkt.size = size = avio_close_dyn_buf(hintbuf, &buf);
     hint_pkt.data = buf;
     hint_pkt.pts  = hint_pkt.dts;
     hint_pkt.stream_index = track_index;
@@ -485,12 +449,9 @@ void ff_mov_close_hinting(MOVTrack *track) {
         return;
     if (rtp_ctx->pb) {
         av_write_trailer(rtp_ctx);
-        url_close_dyn_buf(rtp_ctx->pb, &ptr);
+        avio_close_dyn_buf(rtp_ctx->pb, &ptr);
         av_free(ptr);
     }
-    av_metadata_free(&rtp_ctx->streams[0]->metadata);
-    av_metadata_free(&rtp_ctx->metadata);
-    av_free(rtp_ctx->streams[0]);
-    av_freep(&rtp_ctx);
+    avformat_free_context(rtp_ctx);
 }
 
diff --git a/ffmpeg-mt/libavformat/mp3.c b/ffmpeg-mt/libavformat/mp3.c
deleted file mode 100644
index e70a120..0000000
--- a/ffmpeg-mt/libavformat/mp3.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * MP3 muxer and demuxer
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <strings.h>
-#include "libavutil/avstring.h"
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "id3v2.h"
-#include "id3v1.h"
-
-#if CONFIG_MP3_DEMUXER
-
-#include "libavcodec/mpegaudio.h"
-#include "libavcodec/mpegaudiodecheader.h"
-
-/* mp3 read */
-
-static int mp3_read_probe(AVProbeData *p)
-{
-    int max_frames, first_frames = 0;
-    int fsize, frames, sample_rate;
-    uint32_t header;
-    uint8_t *buf, *buf0, *buf2, *end;
-    AVCodecContext avctx;
-
-    buf0 = p->buf;
-    end = p->buf + p->buf_size - sizeof(uint32_t);
-    while(buf0 < end && !*buf0)
-        buf0++;
-
-    max_frames = 0;
-    buf = buf0;
-
-    for(; buf < end; buf= buf2+1) {
-        buf2 = buf;
-
-        for(frames = 0; buf2 < end; frames++) {
-            header = AV_RB32(buf2);
-            fsize = ff_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate);
-            if(fsize < 0)
-                break;
-            buf2 += fsize;
-        }
-        max_frames = FFMAX(max_frames, frames);
-        if(buf == buf0)
-            first_frames= frames;
-    }
-    // keep this in sync with ac3 probe, both need to avoid
-    // issues with MPEG-files!
-    if   (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
-    else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
-    else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
-    else if(max_frames>=1) return 1;
-    else                   return 0;
-//mpegps_mp3_unrecognized_format.mpg has max_frames=3
-}
-
-/**
- * Try to find Xing/Info/VBRI tags and compute duration from info therein
- */
-static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
-{
-    uint32_t v, spf;
-    unsigned frames = 0; /* Total number of frames in file */
-    unsigned size = 0; /* Total number of bytes in the stream */
-    const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
-    MPADecodeHeader c;
-    int vbrtag_size = 0;
-
-    v = get_be32(s->pb);
-    if(ff_mpa_check_header(v) < 0)
-      return -1;
-
-    if (ff_mpegaudio_decode_header(&c, v) == 0)
-        vbrtag_size = c.frame_size;
-    if(c.layer != 3)
-        return -1;
-
-    /* Check for Xing / Info tag */
-    url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
-    v = get_be32(s->pb);
-    if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
-        v = get_be32(s->pb);
-        if(v & 0x1)
-            frames = get_be32(s->pb);
-        if(v & 0x2)
-            size = get_be32(s->pb);
-    }
-
-    /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
-    url_fseek(s->pb, base + 4 + 32, SEEK_SET);
-    v = get_be32(s->pb);
-    if(v == MKBETAG('V', 'B', 'R', 'I')) {
-        /* Check tag version */
-        if(get_be16(s->pb) == 1) {
-            /* skip delay and quality */
-            url_fseek(s->pb, 4, SEEK_CUR);
-            frames = get_be32(s->pb);
-            size = get_be32(s->pb);
-        }
-    }
-
-    if(!frames && !size)
-        return -1;
-
-    /* Skip the vbr tag frame */
-    url_fseek(s->pb, base + vbrtag_size, SEEK_SET);
-
-    spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
-    if(frames)
-        st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
-                                    st->time_base);
-    if(size && frames)
-        st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf);
-
-    return 0;
-}
-
-static int mp3_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    AVStream *st;
-    int64_t off;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_MP3;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-    st->start_time = 0;
-
-    // lcm of all mp3 sample rates
-    av_set_pts_info(st, 64, 1, 14112000);
-
-    off = url_ftell(s->pb);
-
-    if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
-        ff_id3v1_read(s);
-
-    if (mp3_parse_vbr_tags(s, st, off) < 0)
-        url_fseek(s->pb, off, SEEK_SET);
-
-    /* the parameters will be extracted from the compressed bitstream */
-    return 0;
-}
-
-#define MP3_PACKET_SIZE 1024
-
-static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, size;
-    //    AVStream *st = s->streams[0];
-
-    size= MP3_PACKET_SIZE;
-
-    ret= av_get_packet(s->pb, pkt, size);
-
-    pkt->stream_index = 0;
-    if (ret <= 0) {
-        return AVERROR(EIO);
-    }
-    /* note: we need to modify the packet size here to handle the last
-       packet */
-    pkt->size = ret;
-    return ret;
-}
-
-AVInputFormat mp3_demuxer = {
-    "mp3",
-    NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"),
-    0,
-    mp3_read_probe,
-    mp3_read_header,
-    mp3_read_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "mp2,mp3,m2a", /* XXX: use probe */
-};
-#endif
-
-#if CONFIG_MP2_MUXER || CONFIG_MP3_MUXER
-static int id3v1_set_string(AVFormatContext *s, const char *key,
-                            uint8_t *buf, int buf_size)
-{
-    AVMetadataTag *tag;
-    if ((tag = av_metadata_get(s->metadata, key, NULL, 0)))
-        strncpy(buf, tag->value, buf_size);
-    return !!tag;
-}
-
-static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
-{
-    AVMetadataTag *tag;
-    int i, count = 0;
-
-    memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */
-    buf[0] = 'T';
-    buf[1] = 'A';
-    buf[2] = 'G';
-    count += id3v1_set_string(s, "TIT2",    buf +  3, 30);       //title
-    count += id3v1_set_string(s, "TPE1",    buf + 33, 30);       //author|artist
-    count += id3v1_set_string(s, "TALB",    buf + 63, 30);       //album
-    count += id3v1_set_string(s, "TDRL",    buf + 93,  4);       //date
-    count += id3v1_set_string(s, "comment", buf + 97, 30);
-    if ((tag = av_metadata_get(s->metadata, "TRCK", NULL, 0))) { //track
-        buf[125] = 0;
-        buf[126] = atoi(tag->value);
-        count++;
-    }
-    buf[127] = 0xFF; /* default to unknown genre */
-    if ((tag = av_metadata_get(s->metadata, "TCON", NULL, 0))) { //genre
-        for(i = 0; i <= ID3v1_GENRE_MAX; i++) {
-            if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) {
-                buf[127] = i;
-                count++;
-                break;
-            }
-        }
-    }
-    return count;
-}
-
-/* simple formats */
-
-static void id3v2_put_size(AVFormatContext *s, int size)
-{
-    put_byte(s->pb, size >> 21 & 0x7f);
-    put_byte(s->pb, size >> 14 & 0x7f);
-    put_byte(s->pb, size >> 7  & 0x7f);
-    put_byte(s->pb, size       & 0x7f);
-}
-
-static void id3v2_put_ttag(AVFormatContext *s, const char *buf, int len,
-                           uint32_t tag)
-{
-    put_be32(s->pb, tag);
-    id3v2_put_size(s, len + 1);
-    put_be16(s->pb, 0);
-    put_byte(s->pb, 3); /* UTF-8 */
-    put_buffer(s->pb, buf, len);
-}
-
-
-static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int mp3_write_trailer(struct AVFormatContext *s)
-{
-    uint8_t buf[ID3v1_TAG_SIZE];
-
-    /* write the id3v1 tag */
-    if (id3v1_create_tag(s, buf) > 0) {
-        put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
-        put_flush_packet(s->pb);
-    }
-    return 0;
-}
-#endif /* CONFIG_MP2_MUXER || CONFIG_MP3_MUXER */
-
-#if CONFIG_MP2_MUXER
-AVOutputFormat mp2_muxer = {
-    "mp2",
-    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
-    "audio/x-mpeg",
-    "mp2,m2a",
-    0,
-    CODEC_ID_MP2,
-    CODEC_ID_NONE,
-    NULL,
-    mp3_write_packet,
-    mp3_write_trailer,
-};
-#endif
-
-#if CONFIG_MP3_MUXER
-/**
- * Write an ID3v2.4 header at beginning of stream
- */
-
-static int mp3_write_header(struct AVFormatContext *s)
-{
-    AVMetadataTag *t = NULL;
-    int totlen = 0;
-    int64_t size_pos, cur_pos;
-
-    put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
-    put_byte(s->pb, 0);
-    put_byte(s->pb, 0); /* flags */
-
-    /* reserve space for size */
-    size_pos = url_ftell(s->pb);
-    put_be32(s->pb, 0);
-
-    ff_metadata_conv(&s->metadata, ff_id3v2_metadata_conv, NULL);
-    while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
-        uint32_t tag = 0;
-
-        if (t->key[0] == 'T' && strlen(t->key) == 4) {
-            int i;
-            for (i = 0; *ff_id3v2_tags[i]; i++)
-                if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) {
-                    int len = strlen(t->value);
-                    tag = AV_RB32(t->key);
-                    totlen += len + ID3v2_HEADER_SIZE + 2;
-                    id3v2_put_ttag(s, t->value, len + 1, tag);
-                    break;
-                }
-        }
-
-        if (!tag) { /* unknown tag, write as TXXX frame */
-            int   len = strlen(t->key), len1 = strlen(t->value);
-            char *buf = av_malloc(len + len1 + 2);
-            if (!buf)
-                return AVERROR(ENOMEM);
-            tag = MKBETAG('T', 'X', 'X', 'X');
-            strcpy(buf,           t->key);
-            strcpy(buf + len + 1, t->value);
-            id3v2_put_ttag(s, buf, len + len1 + 2, tag);
-            totlen += len + len1 + ID3v2_HEADER_SIZE + 3;
-            av_free(buf);
-        }
-    }
-
-    cur_pos = url_ftell(s->pb);
-    url_fseek(s->pb, size_pos, SEEK_SET);
-    id3v2_put_size(s, totlen);
-    url_fseek(s->pb, cur_pos, SEEK_SET);
-
-    return 0;
-}
-
-AVOutputFormat mp3_muxer = {
-    "mp3",
-    NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),
-    "audio/x-mpeg",
-    "mp3",
-    0,
-    CODEC_ID_MP3,
-    CODEC_ID_NONE,
-    mp3_write_header,
-    mp3_write_packet,
-    mp3_write_trailer,
-    AVFMT_NOTIMESTAMPS,
-};
-#endif
diff --git a/ffmpeg-mt/libavformat/mp3dec.c b/ffmpeg-mt/libavformat/mp3dec.c
new file mode 100644
index 0000000..dbecf3d
--- /dev/null
+++ b/ffmpeg-mt/libavformat/mp3dec.c
@@ -0,0 +1,197 @@
+/*
+ * MP3 demuxer
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "id3v2.h"
+#include "id3v1.h"
+#include "libavcodec/mpegaudiodecheader.h"
+
+/* mp3 read */
+
+static int mp3_read_probe(AVProbeData *p)
+{
+    int max_frames, first_frames = 0;
+    int fsize, frames, sample_rate;
+    uint32_t header;
+    uint8_t *buf, *buf0, *buf2, *end;
+    AVCodecContext avctx;
+
+    buf0 = p->buf;
+    end = p->buf + p->buf_size - sizeof(uint32_t);
+    while(buf0 < end && !*buf0)
+        buf0++;
+
+    max_frames = 0;
+    buf = buf0;
+
+    for(; buf < end; buf= buf2+1) {
+        buf2 = buf;
+
+        for(frames = 0; buf2 < end; frames++) {
+            header = AV_RB32(buf2);
+            fsize = ff_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate);
+            if(fsize < 0)
+                break;
+            buf2 += fsize;
+        }
+        max_frames = FFMAX(max_frames, frames);
+        if(buf == buf0)
+            first_frames= frames;
+    }
+    // keep this in sync with ac3 probe, both need to avoid
+    // issues with MPEG-files!
+    if   (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
+    else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
+    else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
+    else if(max_frames>=1) return 1;
+    else                   return 0;
+//mpegps_mp3_unrecognized_format.mpg has max_frames=3
+}
+
+/**
+ * Try to find Xing/Info/VBRI tags and compute duration from info therein
+ */
+static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
+{
+    uint32_t v, spf;
+    unsigned frames = 0; /* Total number of frames in file */
+    unsigned size = 0; /* Total number of bytes in the stream */
+    const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
+    MPADecodeHeader c;
+    int vbrtag_size = 0;
+
+    v = avio_rb32(s->pb);
+    if(ff_mpa_check_header(v) < 0)
+      return -1;
+
+    if (ff_mpegaudio_decode_header(&c, v) == 0)
+        vbrtag_size = c.frame_size;
+    if(c.layer != 3)
+        return -1;
+
+    /* Check for Xing / Info tag */
+    avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]);
+    v = avio_rb32(s->pb);
+    if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
+        v = avio_rb32(s->pb);
+        if(v & 0x1)
+            frames = avio_rb32(s->pb);
+        if(v & 0x2)
+            size = avio_rb32(s->pb);
+    }
+
+    /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
+    avio_seek(s->pb, base + 4 + 32, SEEK_SET);
+    v = avio_rb32(s->pb);
+    if(v == MKBETAG('V', 'B', 'R', 'I')) {
+        /* Check tag version */
+        if(avio_rb16(s->pb) == 1) {
+            /* skip delay and quality */
+            avio_skip(s->pb, 4);
+            frames = avio_rb32(s->pb);
+            size = avio_rb32(s->pb);
+        }
+    }
+
+    if(!frames && !size)
+        return -1;
+
+    /* Skip the vbr tag frame */
+    avio_seek(s->pb, base + vbrtag_size, SEEK_SET);
+
+    spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
+    if(frames)
+        st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
+                                    st->time_base);
+    if(size && frames)
+        st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf);
+
+    return 0;
+}
+
+static int mp3_read_header(AVFormatContext *s,
+                           AVFormatParameters *ap)
+{
+    AVStream *st;
+    int64_t off;
+
+    st = av_new_stream(s, 0);
+    if (!st)
+        return AVERROR(ENOMEM);
+
+    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+    st->codec->codec_id = CODEC_ID_MP3;
+    st->need_parsing = AVSTREAM_PARSE_FULL;
+    st->start_time = 0;
+
+    // lcm of all mp3 sample rates
+    av_set_pts_info(st, 64, 1, 14112000);
+
+    off = avio_tell(s->pb);
+
+    if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
+        ff_id3v1_read(s);
+
+    if (mp3_parse_vbr_tags(s, st, off) < 0)
+        avio_seek(s->pb, off, SEEK_SET);
+
+    /* the parameters will be extracted from the compressed bitstream */
+    return 0;
+}
+
+#define MP3_PACKET_SIZE 1024
+
+static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+    int ret, size;
+    //    AVStream *st = s->streams[0];
+
+    size= MP3_PACKET_SIZE;
+
+    ret= av_get_packet(s->pb, pkt, size);
+
+    pkt->stream_index = 0;
+    if (ret <= 0) {
+        return AVERROR(EIO);
+    }
+
+    if (ret > ID3v1_TAG_SIZE &&
+        memcmp(&pkt->data[ret - ID3v1_TAG_SIZE], "TAG", 3) == 0)
+        ret -= ID3v1_TAG_SIZE;
+
+    /* note: we need to modify the packet size here to handle the last
+       packet */
+    pkt->size = ret;
+    return ret;
+}
+
+AVInputFormat ff_mp3_demuxer = {
+    "mp3",
+    NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"),
+    0,
+    mp3_read_probe,
+    mp3_read_header,
+    mp3_read_packet,
+    .flags= AVFMT_GENERIC_INDEX,
+    .extensions = "mp2,mp3,m2a", /* XXX: use probe */
+};
diff --git a/ffmpeg-mt/libavformat/mp3enc.c b/ffmpeg-mt/libavformat/mp3enc.c
new file mode 100644
index 0000000..d46e67b
--- /dev/null
+++ b/ffmpeg-mt/libavformat/mp3enc.c
@@ -0,0 +1,255 @@
+/*
+ * MP3 muxer
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <strings.h>
+#include "avformat.h"
+#include "id3v1.h"
+#include "id3v2.h"
+#include "rawenc.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+
+static int id3v1_set_string(AVFormatContext *s, const char *key,
+                            uint8_t *buf, int buf_size)
+{
+    AVMetadataTag *tag;
+    if ((tag = av_metadata_get(s->metadata, key, NULL, 0)))
+        strncpy(buf, tag->value, buf_size);
+    return !!tag;
+}
+
+static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
+{
+    AVMetadataTag *tag;
+    int i, count = 0;
+
+    memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */
+    buf[0] = 'T';
+    buf[1] = 'A';
+    buf[2] = 'G';
+    count += id3v1_set_string(s, "TIT2",    buf +  3, 30);       //title
+    count += id3v1_set_string(s, "TPE1",    buf + 33, 30);       //author|artist
+    count += id3v1_set_string(s, "TALB",    buf + 63, 30);       //album
+    count += id3v1_set_string(s, "TDRL",    buf + 93,  4);       //date
+    count += id3v1_set_string(s, "comment", buf + 97, 30);
+    if ((tag = av_metadata_get(s->metadata, "TRCK", NULL, 0))) { //track
+        buf[125] = 0;
+        buf[126] = atoi(tag->value);
+        count++;
+    }
+    buf[127] = 0xFF; /* default to unknown genre */
+    if ((tag = av_metadata_get(s->metadata, "TCON", NULL, 0))) { //genre
+        for(i = 0; i <= ID3v1_GENRE_MAX; i++) {
+            if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) {
+                buf[127] = i;
+                count++;
+                break;
+            }
+        }
+    }
+    return count;
+}
+
+/* simple formats */
+
+static void id3v2_put_size(AVFormatContext *s, int size)
+{
+    avio_w8(s->pb, size >> 21 & 0x7f);
+    avio_w8(s->pb, size >> 14 & 0x7f);
+    avio_w8(s->pb, size >> 7  & 0x7f);
+    avio_w8(s->pb, size       & 0x7f);
+}
+
+static int string_is_ascii(const uint8_t *str)
+{
+    while (*str && *str < 128) str++;
+    return !*str;
+}
+
+/**
+ * Write a text frame with one (normal frames) or two (TXXX frames) strings
+ * according to encoding (only UTF-8 or UTF-16+BOM supported).
+ * @return number of bytes written or a negative error code.
+ */
+static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2,
+                          uint32_t tag, enum ID3v2Encoding enc)
+{
+    int len;
+    uint8_t *pb;
+    int (*put)(AVIOContext*, const char*);
+    AVIOContext *dyn_buf;
+    if (avio_open_dyn_buf(&dyn_buf) < 0)
+        return AVERROR(ENOMEM);
+
+    /* check if the strings are ASCII-only and use UTF16 only if
+     * they're not */
+    if (enc == ID3v2_ENCODING_UTF16BOM && string_is_ascii(str1) &&
+        (!str2 || string_is_ascii(str2)))
+        enc = ID3v2_ENCODING_ISO8859;
+
+    avio_w8(dyn_buf, enc);
+    if (enc == ID3v2_ENCODING_UTF16BOM) {
+        avio_wl16(dyn_buf, 0xFEFF);      /* BOM */
+        put = avio_put_str16le;
+    } else
+        put = avio_put_str;
+
+    put(dyn_buf, str1);
+    if (str2)
+        put(dyn_buf, str2);
+    len = avio_close_dyn_buf(dyn_buf, &pb);
+
+    avio_wb32(s->pb, tag);
+    id3v2_put_size(s, len);
+    avio_wb16(s->pb, 0);
+    avio_write(s->pb, pb, len);
+
+    av_freep(&pb);
+    return len + ID3v2_HEADER_SIZE;
+}
+
+static int mp3_write_trailer(struct AVFormatContext *s)
+{
+    uint8_t buf[ID3v1_TAG_SIZE];
+
+    /* write the id3v1 tag */
+    if (id3v1_create_tag(s, buf) > 0) {
+        avio_write(s->pb, buf, ID3v1_TAG_SIZE);
+        avio_flush(s->pb);
+    }
+    return 0;
+}
+
+#if CONFIG_MP2_MUXER
+AVOutputFormat ff_mp2_muxer = {
+    "mp2",
+    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
+    "audio/x-mpeg",
+    "mp2,m2a",
+    0,
+    CODEC_ID_MP2,
+    CODEC_ID_NONE,
+    NULL,
+    ff_raw_write_packet,
+    mp3_write_trailer,
+};
+#endif
+
+#if CONFIG_MP3_MUXER
+typedef struct MP3Context {
+    const AVClass *class;
+    int id3v2_version;
+} MP3Context;
+
+static const AVOption options[] = {
+    { "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.",
+      offsetof(MP3Context, id3v2_version), FF_OPT_TYPE_INT, 4, 3, 4, AV_OPT_FLAG_ENCODING_PARAM},
+    { NULL },
+};
+
+static const AVClass mp3_muxer_class = {
+    "MP3 muxer",
+    av_default_item_name,
+    options,
+    LIBAVUTIL_VERSION_INT,
+};
+
+static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const char table[][4],
+                                 enum ID3v2Encoding enc)
+{
+    uint32_t tag;
+    int i;
+
+    if (t->key[0] != 'T' || strlen(t->key) != 4)
+        return -1;
+    tag = AV_RB32(t->key);
+    for (i = 0; *table[i]; i++)
+        if (tag == AV_RB32(table[i]))
+            return id3v2_put_ttag(s, t->value, NULL, tag, enc);
+    return -1;
+}
+
+/**
+ * Write an ID3v2 header at beginning of stream
+ */
+
+static int mp3_write_header(struct AVFormatContext *s)
+{
+    MP3Context  *mp3 = s->priv_data;
+    AVMetadataTag *t = NULL;
+    int totlen = 0, enc = mp3->id3v2_version == 3 ? ID3v2_ENCODING_UTF16BOM :
+                                                    ID3v2_ENCODING_UTF8;
+    int64_t size_pos, cur_pos;
+
+    avio_wb32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version));
+    avio_w8(s->pb, 0);
+    avio_w8(s->pb, 0); /* flags */
+
+    /* reserve space for size */
+    size_pos = avio_tell(s->pb);
+    avio_wb32(s->pb, 0);
+
+    ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL);
+    if (mp3->id3v2_version == 4)
+        ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL);
+
+    while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
+        int ret;
+
+        if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_tags, enc)) > 0) {
+            totlen += ret;
+            continue;
+        }
+        if ((ret = id3v2_check_write_tag(s, t, mp3->id3v2_version == 3 ?
+                                               ff_id3v2_3_tags : ff_id3v2_4_tags, enc)) > 0) {
+            totlen += ret;
+            continue;
+        }
+
+        /* unknown tag, write as TXXX frame */
+        if ((ret = id3v2_put_ttag(s, t->key, t->value, MKBETAG('T', 'X', 'X', 'X'), enc)) < 0)
+            return ret;
+        totlen += ret;
+    }
+
+    cur_pos = avio_tell(s->pb);
+    avio_seek(s->pb, size_pos, SEEK_SET);
+    id3v2_put_size(s, totlen);
+    avio_seek(s->pb, cur_pos, SEEK_SET);
+
+    return 0;
+}
+
+AVOutputFormat ff_mp3_muxer = {
+    "mp3",
+    NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),
+    "audio/x-mpeg",
+    "mp3",
+    sizeof(MP3Context),
+    CODEC_ID_MP3,
+    CODEC_ID_NONE,
+    mp3_write_header,
+    ff_raw_write_packet,
+    mp3_write_trailer,
+    AVFMT_NOTIMESTAMPS,
+    .priv_class = &mp3_muxer_class,
+};
+#endif
diff --git a/ffmpeg-mt/libavformat/mpc.c b/ffmpeg-mt/libavformat/mpc.c
index ecc9809..07c2299 100644
--- a/ffmpeg-mt/libavformat/mpc.c
+++ b/ffmpeg-mt/libavformat/mpc.c
@@ -2,20 +2,20 @@
  * Musepack demuxer
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,16 +55,16 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
     MPCContext *c = s->priv_data;
     AVStream *st;
 
-    if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
+    if(avio_rl24(s->pb) != MKTAG('M', 'P', '+', 0)){
         av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
         return -1;
     }
-    c->ver = get_byte(s->pb);
+    c->ver = avio_r8(s->pb);
     if(c->ver != 0x07 && c->ver != 0x17){
         av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver);
         return -1;
     }
-    c->fcount = get_le32(s->pb);
+    c->fcount = avio_rl32(s->pb);
     if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){
         av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n");
         return -1;
@@ -85,7 +85,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     st->codec->extradata_size = 16;
     st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
-    get_buffer(s->pb, st->codec->extradata, 16);
+    avio_read(s->pb, st->codec->extradata, 16);
     st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
     av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
     /* scan for seekpoints */
@@ -93,12 +93,12 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
     st->duration = c->fcount;
 
     /* try to read APE tags */
-    if (!url_is_streamed(s->pb)) {
-        int64_t pos = url_ftell(s->pb);
+    if (s->pb->seekable) {
+        int64_t pos = avio_tell(s->pb);
         ff_ape_parse_tag(s);
         if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
             ff_id3v1_read(s);
-        url_fseek(s->pb, pos, SEEK_SET);
+        avio_seek(s->pb, pos, SEEK_SET);
     }
 
     return 0;
@@ -114,22 +114,22 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
         return -1;
 
     if(c->curframe != c->lastframe + 1){
-        url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
+        avio_seek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
         c->curbits = c->frames[c->curframe].skip;
     }
     c->lastframe = c->curframe;
     c->curframe++;
     curbits = c->curbits;
-    pos = url_ftell(s->pb);
-    tmp = get_le32(s->pb);
+    pos = avio_tell(s->pb);
+    tmp = avio_rl32(s->pb);
     if(curbits <= 12){
         size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
     }else{
-        tmp = (tmp << 32) | get_le32(s->pb);
+        tmp = (tmp << 32) | avio_rl32(s->pb);
         size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
     }
     curbits += 20;
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
 
     size = ((size2 + curbits + 31) & ~31) >> 3;
     if(cur == c->frames_noted){
@@ -151,9 +151,9 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     pkt->stream_index = 0;
     pkt->pts = cur;
-    ret = get_buffer(s->pb, pkt->data + 4, size);
+    ret = avio_read(s->pb, pkt->data + 4, size);
     if(c->curbits)
-        url_fseek(s->pb, -4, SEEK_CUR);
+        avio_seek(s->pb, -4, SEEK_CUR);
     if(ret < size){
         av_free_packet(pkt);
         return AVERROR(EIO);
@@ -212,7 +212,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
 }
 
 
-AVInputFormat mpc_demuxer = {
+AVInputFormat ff_mpc_demuxer = {
     "mpc",
     NULL_IF_CONFIG_SMALL("Musepack"),
     sizeof(MPCContext),
diff --git a/ffmpeg-mt/libavformat/mpc8.c b/ffmpeg-mt/libavformat/mpc8.c
index 92e996c..c4810f6 100644
--- a/ffmpeg-mt/libavformat/mpc8.c
+++ b/ffmpeg-mt/libavformat/mpc8.c
@@ -2,26 +2,27 @@
  * Musepack SV8 demuxer
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavcodec/get_bits.h"
 #include "libavcodec/unary.h"
 #include "avformat.h"
+#include "avio_internal.h"
 
 /// Two-byte MPC tag
 #define MKMPCTAG(a, b) (a | (b << 8))
@@ -117,13 +118,13 @@ static inline int64_t gb_get_v(GetBitContext *gb)
     return v;
 }
 
-static void mpc8_get_chunk_header(ByteIOContext *pb, int *tag, int64_t *size)
+static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size)
 {
     int64_t pos;
-    pos = url_ftell(pb);
-    *tag = get_le16(pb);
-    *size = ff_get_v(pb);
-    *size -= url_ftell(pb) - pos;
+    pos = avio_tell(pb);
+    *tag = avio_rl16(pb);
+    *size = ffio_read_varlen(pb);
+    *size -= avio_tell(pb) - pos;
 }
 
 static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
@@ -135,7 +136,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
     int i, t, seekd;
     GetBitContext gb;
 
-    url_fseek(s->pb, off, SEEK_SET);
+    avio_seek(s->pb, off, SEEK_SET);
     mpc8_get_chunk_header(s->pb, &tag, &size);
     if(tag != TAG_SEEKTABLE){
         av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
@@ -143,7 +144,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
     }
     if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
         return;
-    get_buffer(s->pb, buf, size);
+    avio_read(s->pb, buf, size);
     init_get_bits(&gb, buf, size * 8);
     size = gb_get_v(&gb);
     if(size > UINT_MAX/4 || size > c->samples/1152){
@@ -171,37 +172,37 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
 
 static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos, off;
 
     switch(tag){
     case TAG_SEEKTBLOFF:
-        pos = url_ftell(pb) + size;
-        off = ff_get_v(pb);
+        pos = avio_tell(pb) + size;
+        off = ffio_read_varlen(pb);
         mpc8_parse_seektable(s, chunk_pos + off);
-        url_fseek(pb, pos, SEEK_SET);
+        avio_seek(pb, pos, SEEK_SET);
         break;
     default:
-        url_fskip(pb, size);
+        avio_skip(pb, size);
     }
 }
 
 static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     MPCContext *c = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     int tag = 0;
     int64_t size, pos;
 
-    c->header_pos = url_ftell(pb);
-    if(get_le32(pb) != TAG_MPCK){
+    c->header_pos = avio_tell(pb);
+    if(avio_rl32(pb) != TAG_MPCK){
         av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
         return -1;
     }
 
-    while(!url_feof(pb)){
-        pos = url_ftell(pb);
+    while(!pb->eof_reached){
+        pos = avio_tell(pb);
         mpc8_get_chunk_header(pb, &tag, &size);
         if(tag == TAG_STREAMHDR)
             break;
@@ -211,15 +212,15 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
         av_log(s, AV_LOG_ERROR, "Stream header not found\n");
         return -1;
     }
-    pos = url_ftell(pb);
-    url_fskip(pb, 4); //CRC
-    c->ver = get_byte(pb);
+    pos = avio_tell(pb);
+    avio_skip(pb, 4); //CRC
+    c->ver = avio_r8(pb);
     if(c->ver != 8){
         av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
         return -1;
     }
-    c->samples = ff_get_v(pb);
-    ff_get_v(pb); //silence samples at the beginning
+    c->samples = ffio_read_varlen(pb);
+    ffio_read_varlen(pb); //silence samples at the beginning
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -230,13 +231,13 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     st->codec->extradata_size = 2;
     st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
+    avio_read(pb, st->codec->extradata, st->codec->extradata_size);
 
     st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
     st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
     av_set_pts_info(st, 32, 1152  << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
     st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
-    size -= url_ftell(pb) - pos;
+    size -= avio_tell(pb) - pos;
 
     return 0;
 }
@@ -247,8 +248,8 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
     int tag;
     int64_t pos, size;
 
-    while(!url_feof(s->pb)){
-        pos = url_ftell(s->pb);
+    while(!s->pb->eof_reached){
+        pos = avio_tell(s->pb);
         mpc8_get_chunk_header(s->pb, &tag, &size);
         if (size < 0)
             return -1;
@@ -273,13 +274,13 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
     int index = av_index_search_timestamp(st, timestamp, flags);
 
     if(index < 0) return -1;
-    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+    avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
     c->frame = st->index_entries[index].timestamp;
     return 0;
 }
 
 
-AVInputFormat mpc8_demuxer = {
+AVInputFormat ff_mpc8_demuxer = {
     "mpc8",
     NULL_IF_CONFIG_SMALL("Musepack SV8"),
     sizeof(MPCContext),
diff --git a/ffmpeg-mt/libavformat/mpeg.c b/ffmpeg-mt/libavformat/mpeg.c
index 6fd0125..68b685c 100644
--- a/ffmpeg-mt/libavformat/mpeg.c
+++ b/ffmpeg-mt/libavformat/mpeg.c
@@ -2,24 +2,25 @@
  * MPEG1/2 demuxer
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
+#include "internal.h"
 #include "mpeg.h"
 
 //#define DEBUG_SEEK
@@ -112,7 +113,7 @@ static int mpegps_read_header(AVFormatContext *s,
 
     m->sofdec = -1;
     do {
-        v = get_byte(s->pb);
+        v = avio_r8(s->pb);
         m->header_state = m->header_state << 8 | v;
         m->sofdec++;
     } while (v == sofdec[i] && i++ < 6);
@@ -123,17 +124,17 @@ static int mpegps_read_header(AVFormatContext *s,
     return 0;
 }
 
-static int64_t get_pts(ByteIOContext *pb, int c)
+static int64_t get_pts(AVIOContext *pb, int c)
 {
     uint8_t buf[5];
 
-    buf[0] = c<0 ? get_byte(pb) : c;
-    get_buffer(pb, buf+1, 4);
+    buf[0] = c<0 ? avio_r8(pb) : c;
+    avio_read(pb, buf+1, 4);
 
     return ff_parse_pes_pts(buf);
 }
 
-static int find_next_start_code(ByteIOContext *pb, int *size_ptr,
+static int find_next_start_code(AVIOContext *pb, int *size_ptr,
                                 int32_t *header_state)
 {
     unsigned int state, v;
@@ -142,9 +143,9 @@ static int find_next_start_code(ByteIOContext *pb, int *size_ptr,
     state = *header_state;
     n = *size_ptr;
     while (n > 0) {
-        if (url_feof(pb))
+        if (pb->eof_reached)
             break;
-        v = get_byte(pb);
+        v = avio_r8(pb);
         n--;
         if (state == 0x000001) {
             state = ((state << 8) | v) & 0xffffff;
@@ -162,20 +163,20 @@ static int find_next_start_code(ByteIOContext *pb, int *size_ptr,
 
 #if 0 /* unused, remove? */
 /* XXX: optimize */
-static int find_prev_start_code(ByteIOContext *pb, int *size_ptr)
+static int find_prev_start_code(AVIOContext *pb, int *size_ptr)
 {
     int64_t pos, pos_start;
     int max_size, start_code;
 
     max_size = *size_ptr;
-    pos_start = url_ftell(pb);
+    pos_start = avio_tell(pb);
 
     /* in order to go faster, we fill the buffer */
     pos = pos_start - 16386;
     if (pos < 0)
         pos = 0;
-    url_fseek(pb, pos, SEEK_SET);
-    get_byte(pb);
+    avio_seek(pb, pos, SEEK_SET);
+    avio_r8(pb);
 
     pos = pos_start;
     for(;;) {
@@ -184,8 +185,8 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr)
             start_code = -1;
             goto the_end;
         }
-        url_fseek(pb, pos, SEEK_SET);
-        start_code = get_be32(pb);
+        avio_seek(pb, pos, SEEK_SET);
+        start_code = avio_rb32(pb);
         if ((start_code & 0xffffff00) == 0x100)
             break;
     }
@@ -201,31 +202,31 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr)
  *
  * @return number of bytes occupied by PSM in the bitstream
  */
-static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb)
+static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb)
 {
     int psm_length, ps_info_length, es_map_length;
 
-    psm_length = get_be16(pb);
-    get_byte(pb);
-    get_byte(pb);
-    ps_info_length = get_be16(pb);
+    psm_length = avio_rb16(pb);
+    avio_r8(pb);
+    avio_r8(pb);
+    ps_info_length = avio_rb16(pb);
 
     /* skip program_stream_info */
-    url_fskip(pb, ps_info_length);
-    es_map_length = get_be16(pb);
+    avio_skip(pb, ps_info_length);
+    es_map_length = avio_rb16(pb);
 
     /* at least one es available? */
     while (es_map_length >= 4){
-        unsigned char type      = get_byte(pb);
-        unsigned char es_id     = get_byte(pb);
-        uint16_t es_info_length = get_be16(pb);
+        unsigned char type      = avio_r8(pb);
+        unsigned char es_id     = avio_r8(pb);
+        uint16_t es_info_length = avio_rb16(pb);
         /* remember mapping from stream id to stream type */
         m->psm_es_type[es_id] = type;
         /* skip program_stream_info */
-        url_fskip(pb, es_info_length);
+        avio_skip(pb, es_info_length);
         es_map_length -= 4 + es_info_length;
     }
-    get_be32(pb); /* crc32 */
+    avio_rb32(pb); /* crc32 */
     return 2 + psm_length;
 }
 
@@ -240,19 +241,19 @@ static int mpegps_read_pes_header(AVFormatContext *s,
     int len, size, startcode, c, flags, header_len;
     int pes_ext, ext2_len, id_ext, skip;
     int64_t pts, dts;
-    int64_t last_sync= url_ftell(s->pb);
+    int64_t last_sync= avio_tell(s->pb);
 
  error_redo:
-        url_fseek(s->pb, last_sync, SEEK_SET);
+        avio_seek(s->pb, last_sync, SEEK_SET);
  redo:
         /* next start code (should be immediately after) */
         m->header_state = 0xff;
         size = MAX_SYNC_SIZE;
         startcode = find_next_start_code(s->pb, &size, &m->header_state);
-        last_sync = url_ftell(s->pb);
-    //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
+        last_sync = avio_tell(s->pb);
+    //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb));
     if (startcode < 0){
-        if(url_feof(s->pb))
+        if(s->pb->eof_reached)
             return AVERROR_EOF;
         //FIXME we should remember header_state
         return AVERROR(EAGAIN);
@@ -263,16 +264,16 @@ static int mpegps_read_pes_header(AVFormatContext *s,
     if (startcode == SYSTEM_HEADER_START_CODE)
         goto redo;
     if (startcode == PADDING_STREAM) {
-        url_fskip(s->pb, get_be16(s->pb));
+        avio_skip(s->pb, avio_rb16(s->pb));
         goto redo;
     }
     if (startcode == PRIVATE_STREAM_2) {
-        len = get_be16(s->pb);
+        len = avio_rb16(s->pb);
         if (!m->sofdec) {
             while (len-- >= 6) {
-                if (get_byte(s->pb) == 'S') {
+                if (avio_r8(s->pb) == 'S') {
                     uint8_t buf[5];
-                    get_buffer(s->pb, buf, sizeof(buf));
+                    avio_read(s->pb, buf, sizeof(buf));
                     m->sofdec = !memcmp(buf, "ofdec", 5);
                     len -= sizeof(buf);
                     break;
@@ -280,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
             }
             m->sofdec -= !m->sofdec;
         }
-        url_fskip(s->pb, len);
+        avio_skip(s->pb, len);
         goto redo;
     }
     if (startcode == PROGRAM_STREAM_MAP) {
@@ -294,16 +295,16 @@ static int mpegps_read_pes_header(AVFormatContext *s,
           (startcode == 0x1bd) || (startcode == 0x1fd)))
         goto redo;
     if (ppos) {
-        *ppos = url_ftell(s->pb) - 4;
+        *ppos = avio_tell(s->pb) - 4;
     }
-    len = get_be16(s->pb);
+    len = avio_rb16(s->pb);
     pts =
     dts = AV_NOPTS_VALUE;
     /* stuffing */
     for(;;) {
         if (len < 1)
             goto error_redo;
-        c = get_byte(s->pb);
+        c = avio_r8(s->pb);
         len--;
         /* XXX: for mpeg1, should test only bit 7 */
         if (c != 0xff)
@@ -311,8 +312,8 @@ static int mpegps_read_pes_header(AVFormatContext *s,
     }
     if ((c & 0xc0) == 0x40) {
         /* buffer scale & size */
-        get_byte(s->pb);
-        c = get_byte(s->pb);
+        avio_r8(s->pb);
+        c = avio_r8(s->pb);
         len -= 2;
     }
     if ((c & 0xe0) == 0x20) {
@@ -330,8 +331,8 @@ static int mpegps_read_pes_header(AVFormatContext *s,
             goto redo;
         }
 #endif
-        flags = get_byte(s->pb);
-        header_len = get_byte(s->pb);
+        flags = avio_r8(s->pb);
+        header_len = avio_r8(s->pb);
         len -= 2;
         if (header_len > len)
             goto error_redo;
@@ -349,7 +350,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
             av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n");
         }
         if (flags & 0x01) { /* PES extension */
-            pes_ext = get_byte(s->pb);
+            pes_ext = avio_r8(s->pb);
             header_len--;
             /* Skip PES private data, program packet sequence counter and P-STD buffer */
             skip = (pes_ext >> 4) & 0xb;
@@ -358,14 +359,14 @@ static int mpegps_read_pes_header(AVFormatContext *s,
                 av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext);
                 pes_ext=skip=0;
             }
-            url_fskip(s->pb, skip);
+            avio_skip(s->pb, skip);
             header_len -= skip;
 
             if (pes_ext & 0x01) { /* PES extension 2 */
-                ext2_len = get_byte(s->pb);
+                ext2_len = avio_r8(s->pb);
                 header_len--;
                 if ((ext2_len & 0x7f) > 0) {
-                    id_ext = get_byte(s->pb);
+                    id_ext = avio_r8(s->pb);
                     if ((id_ext & 0x80) == 0)
                         startcode = ((startcode & 0xff) << 8) | id_ext;
                     header_len--;
@@ -374,23 +375,23 @@ static int mpegps_read_pes_header(AVFormatContext *s,
         }
         if(header_len < 0)
             goto error_redo;
-        url_fskip(s->pb, header_len);
+        avio_skip(s->pb, header_len);
     }
     else if( c!= 0xf )
         goto redo;
 
     if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
-        startcode = get_byte(s->pb);
+        startcode = avio_r8(s->pb);
         len--;
         if (startcode >= 0x80 && startcode <= 0xcf) {
             /* audio: skip header */
-            get_byte(s->pb);
-            get_byte(s->pb);
-            get_byte(s->pb);
+            avio_r8(s->pb);
+            avio_r8(s->pb);
+            avio_r8(s->pb);
             len -= 3;
             if (startcode >= 0xb0 && startcode <= 0xbf) {
                 /* MLP/TrueHD audio has a 4-byte header */
-                get_byte(s->pb);
+                avio_r8(s->pb);
                 len--;
             }
         }
@@ -401,7 +402,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
         int i;
         for(i=0; i<s->nb_streams; i++){
             if(startcode == s->streams[i]->id &&
-               !url_is_streamed(s->pb) /* index useless on streams anyway */) {
+               s->pb->seekable /* index useless on streams anyway */) {
                 ff_reduce_index(s, i);
                 av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */);
             }
@@ -431,8 +432,8 @@ static int mpegps_read_packet(AVFormatContext *s,
         return len;
 
     if(startcode == 0x1bd) {
-        dvdaudio_substream_type = get_byte(s->pb);
-        url_fskip(s->pb, 3);
+        dvdaudio_substream_type = avio_r8(s->pb);
+        avio_skip(s->pb, 3);
         len -= 4;
     }
 
@@ -473,8 +474,8 @@ static int mpegps_read_packet(AVFormatContext *s,
     } else if (startcode >= 0x1e0 && startcode <= 0x1ef) {
         static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
         unsigned char buf[8];
-        get_buffer(s->pb, buf, 8);
-        url_fseek(s->pb, -8, SEEK_CUR);
+        avio_read(s->pb, buf, 8);
+        avio_seek(s->pb, -8, SEEK_CUR);
         if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
             codec_id = CODEC_ID_CAVS;
         else
@@ -524,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s,
     } else {
     skip:
         /* skip packet */
-        url_fskip(s->pb, len);
+        avio_skip(s->pb, len);
         goto redo;
     }
     /* no stream found: add a new stream */
@@ -546,9 +547,9 @@ static int mpegps_read_packet(AVFormatContext *s,
            audio data */
         if (len <= 3)
             goto skip;
-        get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
-        b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
-        get_byte(s->pb); /* dynamic range control (0x80 = off) */
+        avio_r8(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
+        b1 = avio_r8(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
+        avio_r8(s->pb); /* dynamic range control (0x80 = off) */
         len -= 3;
         freq = (b1 >> 4) & 3;
         st->codec->sample_rate = lpcm_freq_tab[freq];
@@ -563,7 +564,7 @@ static int mpegps_read_packet(AVFormatContext *s,
             return AVERROR(EINVAL);
     }
     av_new_packet(pkt, len);
-    get_buffer(s->pb, pkt->data, pkt->size);
+    avio_read(s->pb, pkt->data, pkt->size);
     pkt->pts = pts;
     pkt->dts = dts;
     pkt->pos = dummy_pos;
@@ -586,7 +587,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
 #ifdef DEBUG_SEEK
     printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next);
 #endif
-    if (url_fseek(s->pb, pos, SEEK_SET) < 0)
+    if (avio_seek(s->pb, pos, SEEK_SET) < 0)
         return AV_NOPTS_VALUE;
 
     for(;;) {
@@ -601,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
             dts != AV_NOPTS_VALUE) {
             break;
         }
-        url_fskip(s->pb, len);
+        avio_skip(s->pb, len);
     }
 #ifdef DEBUG_SEEK
     printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0);
@@ -610,7 +611,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
     return dts;
 }
 
-AVInputFormat mpegps_demuxer = {
+AVInputFormat ff_mpegps_demuxer = {
     "mpeg",
     NULL_IF_CONFIG_SMALL("MPEG-PS format"),
     sizeof(MpegDemuxContext),
diff --git a/ffmpeg-mt/libavformat/mpeg.h b/ffmpeg-mt/libavformat/mpeg.h
index d09b2e8..75dddf3 100644
--- a/ffmpeg-mt/libavformat/mpeg.h
+++ b/ffmpeg-mt/libavformat/mpeg.h
@@ -2,20 +2,20 @@
  * MPEG1/2 muxer and demuxer common defines
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -63,7 +63,7 @@ static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
 /**
  * Parse MPEG-PES five-byte timestamp
  */
-static inline int64_t ff_parse_pes_pts(uint8_t *buf) {
+static inline int64_t ff_parse_pes_pts(const uint8_t *buf) {
     return (int64_t)(*buf & 0x0e) << 29 |
             (AV_RB16(buf+1) >> 1) << 15 |
              AV_RB16(buf+3) >> 1;
diff --git a/ffmpeg-mt/libavformat/mpegenc.c b/ffmpeg-mt/libavformat/mpegenc.c
index 5c090f6..0e01645 100644
--- a/ffmpeg-mt/libavformat/mpegenc.c
+++ b/ffmpeg-mt/libavformat/mpegenc.c
@@ -2,20 +2,20 @@
  * MPEG1/2 muxer
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -76,10 +76,10 @@ typedef struct {
 
 } MpegMuxContext;
 
-extern AVOutputFormat mpeg1vcd_muxer;
-extern AVOutputFormat mpeg2dvd_muxer;
-extern AVOutputFormat mpeg2svcd_muxer;
-extern AVOutputFormat mpeg2vob_muxer;
+extern AVOutputFormat ff_mpeg1vcd_muxer;
+extern AVOutputFormat ff_mpeg2dvd_muxer;
+extern AVOutputFormat ff_mpeg2svcd_muxer;
+extern AVOutputFormat ff_mpeg2vob_muxer;
 
 static int put_pack_header(AVFormatContext *ctx,
                            uint8_t *buf, int64_t timestamp)
@@ -297,12 +297,12 @@ static int mpeg_mux_init(AVFormatContext *ctx)
     int video_bitrate;
 
     s->packet_number = 0;
-    s->is_vcd =    (CONFIG_MPEG1VCD_MUXER  && ctx->oformat == &mpeg1vcd_muxer);
-    s->is_svcd =   (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer);
-    s->is_mpeg2 = ((CONFIG_MPEG2VOB_MUXER  && ctx->oformat == &mpeg2vob_muxer) ||
-                   (CONFIG_MPEG2DVD_MUXER  && ctx->oformat == &mpeg2dvd_muxer) ||
-                   (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer));
-    s->is_dvd =    (CONFIG_MPEG2DVD_MUXER  && ctx->oformat == &mpeg2dvd_muxer);
+    s->is_vcd =    (CONFIG_MPEG1VCD_MUXER  && ctx->oformat == &ff_mpeg1vcd_muxer);
+    s->is_svcd =   (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &ff_mpeg2svcd_muxer);
+    s->is_mpeg2 = ((CONFIG_MPEG2VOB_MUXER  && ctx->oformat == &ff_mpeg2vob_muxer) ||
+                   (CONFIG_MPEG2DVD_MUXER  && ctx->oformat == &ff_mpeg2dvd_muxer) ||
+                   (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &ff_mpeg2svcd_muxer));
+    s->is_dvd =    (CONFIG_MPEG2DVD_MUXER  && ctx->oformat == &ff_mpeg2dvd_muxer);
 
     if(ctx->packet_size) {
         if (ctx->packet_size < 20 || ctx->packet_size > (1 << 23) + 10) {
@@ -491,14 +491,14 @@ static int mpeg_mux_init(AVFormatContext *ctx)
     return AVERROR(ENOMEM);
 }
 
-static inline void put_timestamp(ByteIOContext *pb, int id, int64_t timestamp)
+static inline void put_timestamp(AVIOContext *pb, int id, int64_t timestamp)
 {
-    put_byte(pb,
+    avio_w8(pb,
              (id << 4) |
              (((timestamp >> 30) & 0x07) << 1) |
              1);
-    put_be16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1));
-    put_be16(pb, (uint16_t)((((timestamp      ) & 0x7fff) << 1) | 1));
+    avio_wb16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1));
+    avio_wb16(pb, (uint16_t)((((timestamp      ) & 0x7fff) << 1) | 1));
 }
 
 
@@ -613,21 +613,21 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index,
 #endif
 
 /* Write an MPEG padding packet header. */
-static void put_padding_packet(AVFormatContext *ctx, ByteIOContext *pb,int packet_bytes)
+static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes)
 {
     MpegMuxContext *s = ctx->priv_data;
     int i;
 
-    put_be32(pb, PADDING_STREAM);
-    put_be16(pb, packet_bytes - 6);
+    avio_wb32(pb, PADDING_STREAM);
+    avio_wb16(pb, packet_bytes - 6);
     if (!s->is_mpeg2) {
-        put_byte(pb, 0x0f);
+        avio_w8(pb, 0x0f);
         packet_bytes -= 7;
     } else
         packet_bytes -= 6;
 
     for(i=0;i<packet_bytes;i++)
-        put_byte(pb, 0xff);
+        avio_w8(pb, 0xff);
 }
 
 static int get_nb_frames(AVFormatContext *ctx, StreamInfo *stream, int len){
@@ -699,19 +699,19 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
                     size = put_system_header(ctx, buf_ptr, 0);
                     buf_ptr += size;
                     size = buf_ptr - buffer;
-                    put_buffer(ctx->pb, buffer, size);
+                    avio_write(ctx->pb, buffer, size);
 
-                    put_be32(ctx->pb, PRIVATE_STREAM_2);
-                    put_be16(ctx->pb, 0x03d4);         // length
-                    put_byte(ctx->pb, 0x00);           // substream ID, 00=PCI
+                    avio_wb32(ctx->pb, PRIVATE_STREAM_2);
+                    avio_wb16(ctx->pb, 0x03d4);         // length
+                    avio_w8(ctx->pb, 0x00);           // substream ID, 00=PCI
                     for (i = 0; i < 979; i++)
-                        put_byte(ctx->pb, 0x00);
+                        avio_w8(ctx->pb, 0x00);
 
-                    put_be32(ctx->pb, PRIVATE_STREAM_2);
-                    put_be16(ctx->pb, 0x03fa);         // length
-                    put_byte(ctx->pb, 0x01);           // substream ID, 01=DSI
+                    avio_wb32(ctx->pb, PRIVATE_STREAM_2);
+                    avio_wb16(ctx->pb, 0x03fa);         // length
+                    avio_w8(ctx->pb, 0x01);           // substream ID, 01=DSI
                     for (i = 0; i < 1017; i++)
-                        put_byte(ctx->pb, 0x00);
+                        avio_w8(ctx->pb, 0x00);
 
                     memset(buffer, 0, 128);
                     buf_ptr = buffer;
@@ -734,7 +734,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
         }
     }
     size = buf_ptr - buffer;
-    put_buffer(ctx->pb, buffer, size);
+    avio_write(ctx->pb, buffer, size);
 
     packet_size = s->packet_size - size;
 
@@ -839,16 +839,16 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
 
         nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size);
 
-        put_be32(ctx->pb, startcode);
+        avio_wb32(ctx->pb, startcode);
 
-        put_be16(ctx->pb, packet_size);
+        avio_wb16(ctx->pb, packet_size);
 
         if (!s->is_mpeg2)
             for(i=0;i<stuffing_size;i++)
-                put_byte(ctx->pb, 0xff);
+                avio_w8(ctx->pb, 0xff);
 
         if (s->is_mpeg2) {
-            put_byte(ctx->pb, 0x80); /* mpeg2 id */
+            avio_w8(ctx->pb, 0x80); /* mpeg2 id */
 
             pes_flags=0;
 
@@ -865,8 +865,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
             if (stream->packet_number == 0)
                 pes_flags |= 0x01;
 
-            put_byte(ctx->pb, pes_flags); /* flags */
-            put_byte(ctx->pb, header_len - 3 + stuffing_size);
+            avio_w8(ctx->pb, pes_flags); /* flags */
+            avio_w8(ctx->pb, header_len - 3 + stuffing_size);
 
             if (pes_flags & 0x80)  /*write pts*/
                 put_timestamp(ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
@@ -874,13 +874,13 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
                 put_timestamp(ctx->pb, 0x01, dts);
 
             if (pes_flags & 0x01) {  /*write pes extension*/
-                put_byte(ctx->pb, 0x10); /* flags */
+                avio_w8(ctx->pb, 0x10); /* flags */
 
                 /* P-STD buffer info */
                 if ((id & 0xe0) == AUDIO_ID)
-                    put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128);
+                    avio_wb16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128);
                 else
-                    put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
+                    avio_wb16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
             }
 
         } else {
@@ -892,38 +892,38 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
                     put_timestamp(ctx->pb, 0x02, pts);
                 }
             } else {
-                put_byte(ctx->pb, 0x0f);
+                avio_w8(ctx->pb, 0x0f);
             }
         }
 
         if (s->is_mpeg2) {
             /* special stuffing byte that is always written
                to prevent accidental generation of start codes. */
-            put_byte(ctx->pb, 0xff);
+            avio_w8(ctx->pb, 0xff);
 
             for(i=0;i<stuffing_size;i++)
-                put_byte(ctx->pb, 0xff);
+                avio_w8(ctx->pb, 0xff);
         }
 
         if (startcode == PRIVATE_STREAM_1) {
-            put_byte(ctx->pb, id);
+            avio_w8(ctx->pb, id);
             if (id >= 0xa0) {
                 /* LPCM (XXX: check nb_frames) */
-                put_byte(ctx->pb, 7);
-                put_be16(ctx->pb, 4); /* skip 3 header bytes */
-                put_byte(ctx->pb, stream->lpcm_header[0]);
-                put_byte(ctx->pb, stream->lpcm_header[1]);
-                put_byte(ctx->pb, stream->lpcm_header[2]);
+                avio_w8(ctx->pb, 7);
+                avio_wb16(ctx->pb, 4); /* skip 3 header bytes */
+                avio_w8(ctx->pb, stream->lpcm_header[0]);
+                avio_w8(ctx->pb, stream->lpcm_header[1]);
+                avio_w8(ctx->pb, stream->lpcm_header[2]);
             } else if (id >= 0x40) {
                 /* AC-3 */
-                put_byte(ctx->pb, nb_frames);
-                put_be16(ctx->pb, trailer_size+1);
+                avio_w8(ctx->pb, nb_frames);
+                avio_wb16(ctx->pb, trailer_size+1);
             }
         }
 
         /* output data */
         assert(payload_size - stuffing_size <= av_fifo_size(stream->fifo));
-        av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &put_buffer);
+        av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &avio_write);
         stream->bytes_to_iframe -= payload_size - stuffing_size;
     }else{
         payload_size=
@@ -934,9 +934,9 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
         put_padding_packet(ctx,ctx->pb, pad_packet_bytes);
 
     for(i=0;i<zero_trail_bytes;i++)
-        put_byte(ctx->pb, 0x00);
+        avio_w8(ctx->pb, 0x00);
 
-    put_flush_packet(ctx->pb);
+    avio_flush(ctx->pb);
 
     s->packet_number++;
 
@@ -961,11 +961,11 @@ static void put_vcd_padding_sector(AVFormatContext *ctx)
     int i;
 
     for(i=0;i<s->packet_size;i++)
-        put_byte(ctx->pb, 0);
+        avio_w8(ctx->pb, 0);
 
     s->vcd_padding_bytes_written += s->packet_size;
 
-    put_flush_packet(ctx->pb);
+    avio_flush(ctx->pb);
 
     /* increasing the packet number is correct. The SCR of the following packs
        is calculated from the packet_number and it has to include the padding
@@ -1220,8 +1220,8 @@ static int mpeg_mux_end(AVFormatContext *ctx)
     /* End header according to MPEG1 systems standard. We do not write
        it as it is usually not needed by decoders and because it
        complicates MPEG stream concatenation. */
-    //put_be32(ctx->pb, ISO_11172_END_CODE);
-    //put_flush_packet(ctx->pb);
+    //avio_wb32(ctx->pb, ISO_11172_END_CODE);
+    //avio_flush(ctx->pb);
 
     for(i=0;i<ctx->nb_streams;i++) {
         stream = ctx->streams[i]->priv_data;
@@ -1233,7 +1233,7 @@ static int mpeg_mux_end(AVFormatContext *ctx)
 }
 
 #if CONFIG_MPEG1SYSTEM_MUXER
-AVOutputFormat mpeg1system_muxer = {
+AVOutputFormat ff_mpeg1system_muxer = {
     "mpeg",
     NULL_IF_CONFIG_SMALL("MPEG-1 System format"),
     "video/mpeg",
@@ -1247,7 +1247,7 @@ AVOutputFormat mpeg1system_muxer = {
 };
 #endif
 #if CONFIG_MPEG1VCD_MUXER
-AVOutputFormat mpeg1vcd_muxer = {
+AVOutputFormat ff_mpeg1vcd_muxer = {
     "vcd",
     NULL_IF_CONFIG_SMALL("MPEG-1 System format (VCD)"),
     "video/mpeg",
@@ -1261,7 +1261,7 @@ AVOutputFormat mpeg1vcd_muxer = {
 };
 #endif
 #if CONFIG_MPEG2VOB_MUXER
-AVOutputFormat mpeg2vob_muxer = {
+AVOutputFormat ff_mpeg2vob_muxer = {
     "vob",
     NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"),
     "video/mpeg",
@@ -1277,7 +1277,7 @@ AVOutputFormat mpeg2vob_muxer = {
 
 /* Same as mpeg2vob_mux except that the pack size is 2324 */
 #if CONFIG_MPEG2SVCD_MUXER
-AVOutputFormat mpeg2svcd_muxer = {
+AVOutputFormat ff_mpeg2svcd_muxer = {
     "svcd",
     NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"),
     "video/mpeg",
@@ -1293,7 +1293,7 @@ AVOutputFormat mpeg2svcd_muxer = {
 
 /*  Same as mpeg2vob_mux except the 'is_dvd' flag is set to produce NAV pkts */
 #if CONFIG_MPEG2DVD_MUXER
-AVOutputFormat mpeg2dvd_muxer = {
+AVOutputFormat ff_mpeg2dvd_muxer = {
     "dvd",
     NULL_IF_CONFIG_SMALL("MPEG-2 PS format (DVD VOB)"),
     "video/mpeg",
diff --git a/ffmpeg-mt/libavformat/mpegts.c b/ffmpeg-mt/libavformat/mpegts.c
index 01b69a7..62e9dcb 100644
--- a/ffmpeg-mt/libavformat/mpegts.c
+++ b/ffmpeg-mt/libavformat/mpegts.c
@@ -2,20 +2,20 @@
  * MPEG2 transport stream (aka DVB) demuxer
  * Copyright (c) 2002-2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,12 +29,11 @@
 #include "avformat.h"
 #include "mpegts.h"
 #include "internal.h"
+#include "avio_internal.h"
 #include "seek.h"
+#include "mpeg.h"
 #include "isom.h"
 
-/* 1.0 second at 24Mbit/s */
-#define MAX_SCAN_PACKETS 32000
-
 /* maximum size in which we look for synchronisation if
    synchronisation is lost */
 #define MAX_RESYNC_SIZE 65536
@@ -158,7 +157,7 @@ typedef struct PESContext {
     uint8_t *buffer;
 } PESContext;
 
-extern AVInputFormat mpegts_demuxer;
+extern AVInputFormat ff_mpegts_demuxer;
 
 static void clear_program(MpegTSContext *ts, unsigned int programid)
 {
@@ -289,7 +288,7 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int
     MpegTSFilter *filter;
     MpegTSSectionFilter *sec;
 
-    dprintf(ts->stream, "Filter: pid=0x%x\n", pid);
+    av_dlog(ts->stream, "Filter: pid=0x%x\n", pid);
 
     if (pid >= NB_PID_MAX || ts->pids[pid])
         return NULL;
@@ -601,14 +600,6 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
     return 0;
 }
 
-static int64_t get_pts(const uint8_t *p)
-{
-    int64_t pts = (int64_t)((p[0] >> 1) & 0x07) << 30;
-    pts |= (AV_RB16(p + 1) >> 1) << 15;
-    pts |=  AV_RB16(p + 3) >> 1;
-    return pts;
-}
-
 static void new_pes_packet(PESContext *pes, AVPacket *pkt)
 {
     av_init_packet(pkt);
@@ -678,7 +669,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
                     pes->header[2] == 0x01) {
                     /* it must be an mpeg2 PES stream */
                     code = pes->header[3] | 0x100;
-                    dprintf(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
+                    av_dlog(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
 
                     if ((pes->st && pes->st->discard == AVDISCARD_ALL) ||
                         code == 0x1be) /* padding_stream */
@@ -714,7 +705,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
                         code != 0x1f8) {                  /* ITU-T Rec. H.222.1 type E stream */
                         pes->state = MPEGTS_PESHEADER;
                         if (pes->st->codec->codec_id == CODEC_ID_NONE) {
-                            dprintf(pes->stream, "pid=%x stream_type=%x probing\n",
+                            av_dlog(pes->stream, "pid=%x stream_type=%x probing\n",
                                     pes->pid, pes->stream_type);
                             pes->st->codec->codec_id = CODEC_ID_PROBE;
                         }
@@ -767,12 +758,12 @@ static int mpegts_push_data(MpegTSFilter *filter,
                 pes->pts = AV_NOPTS_VALUE;
                 pes->dts = AV_NOPTS_VALUE;
                 if ((flags & 0xc0) == 0x80) {
-                    pes->dts = pes->pts = get_pts(r);
+                    pes->dts = pes->pts = ff_parse_pes_pts(r);
                     r += 5;
                 } else if ((flags & 0xc0) == 0xc0) {
-                    pes->pts = get_pts(r);
+                    pes->pts = ff_parse_pes_pts(r);
                     r += 5;
-                    pes->dts = get_pts(r);
+                    pes->dts = ff_parse_pes_pts(r);
                     r += 5;
                 }
                 pes->extended_stream_id = -1;
@@ -861,32 +852,32 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,
                          int *es_id, uint8_t **dec_config_descr,
                          int *dec_config_descr_size)
 {
-    ByteIOContext pb;
+    AVIOContext pb;
     int tag;
     unsigned len;
 
-    init_put_byte(&pb, buf, size, 0, NULL, NULL, NULL, NULL);
+    ffio_init_context(&pb, buf, size, 0, NULL, NULL, NULL, NULL);
 
     len = ff_mp4_read_descr(s, &pb, &tag);
     if (tag == MP4IODescrTag) {
-        get_be16(&pb); // ID
-        get_byte(&pb);
-        get_byte(&pb);
-        get_byte(&pb);
-        get_byte(&pb);
-        get_byte(&pb);
+        avio_rb16(&pb); // ID
+        avio_r8(&pb);
+        avio_r8(&pb);
+        avio_r8(&pb);
+        avio_r8(&pb);
+        avio_r8(&pb);
         len = ff_mp4_read_descr(s, &pb, &tag);
         if (tag == MP4ESDescrTag) {
-            *es_id = get_be16(&pb); /* ES_ID */
-            dprintf(s, "ES_ID %#x\n", *es_id);
-            get_byte(&pb); /* priority */
+            *es_id = avio_rb16(&pb); /* ES_ID */
+            av_dlog(s, "ES_ID %#x\n", *es_id);
+            avio_r8(&pb); /* priority */
             len = ff_mp4_read_descr(s, &pb, &tag);
             if (tag == MP4DecConfigDescrTag) {
                 *dec_config_descr = av_malloc(len);
                 if (!*dec_config_descr)
                     return AVERROR(ENOMEM);
                 *dec_config_descr_size = len;
-                get_buffer(&pb, *dec_config_descr, len);
+                avio_read(&pb, *dec_config_descr, len);
             }
         }
     }
@@ -900,7 +891,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
 {
     const uint8_t *desc_end;
     int desc_len, desc_tag;
-    char language[4];
+    char language[252];
+    int i;
 
     desc_tag = get8(pp, desc_list_end);
     if (desc_tag < 0)
@@ -912,7 +904,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
     if (desc_end > desc_list_end)
         return -1;
 
-    dprintf(fc, "tag: 0x%02x len=%d\n", desc_tag, desc_len);
+    av_dlog(fc, "tag: 0x%02x len=%d\n", desc_tag, desc_len);
 
     if (st->codec->codec_id == CODEC_ID_NONE &&
         stream_type == STREAM_TYPE_PRIVATE_DATA)
@@ -923,8 +915,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
         get16(pp, desc_end);
         if (st->codec->codec_id == CODEC_ID_AAC_LATM &&
             mp4_dec_config_descr_len && mp4_es_id == pid) {
-            ByteIOContext pb;
-            init_put_byte(&pb, mp4_dec_config_descr,
+            AVIOContext pb;
+            ffio_init_context(&pb, mp4_dec_config_descr,
                           mp4_dec_config_descr_len, 0, NULL, NULL, NULL, NULL);
             ff_mp4_read_dec_config_descr(fc, st, &pb);
             if (st->codec->codec_id == CODEC_ID_AAC &&
@@ -944,7 +936,17 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
         language[1] = get8(pp, desc_end);
         language[2] = get8(pp, desc_end);
         language[3] = 0;
-        get8(pp, desc_end);
+        /* hearing impaired subtitles detection */
+        switch(get8(pp, desc_end)) {
+        case 0x20: /* DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality */
+        case 0x21: /* DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor */
+        case 0x22: /* DVB subtitles (for the hard of hearing) for display on 16:9 aspect ratio monitor */
+        case 0x23: /* DVB subtitles (for the hard of hearing) for display on 2.21:1 aspect ratio monitor */
+        case 0x24: /* DVB subtitles (for the hard of hearing) for display on a high definition monitor */
+        case 0x25: /* DVB subtitles (for the hard of hearing) with plano-stereoscopic disparity for display on a high definition monitor */
+            st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
+            break;
+        }
         if (st->codec->extradata) {
             if (st->codec->extradata_size == 4 && memcmp(st->codec->extradata, *pp, 4))
                 av_log_ask_for_sample(fc, "DVB sub with multiple IDs\n");
@@ -959,15 +961,25 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
         av_metadata_set2(&st->metadata, "language", language, 0);
         break;
     case 0x0a: /* ISO 639 language descriptor */
-        language[0] = get8(pp, desc_end);
-        language[1] = get8(pp, desc_end);
-        language[2] = get8(pp, desc_end);
-        language[3] = 0;
-        av_metadata_set2(&st->metadata, "language", language, 0);
+        for (i = 0; i + 4 <= desc_len; i += 4) {
+            language[i + 0] = get8(pp, desc_end);
+            language[i + 1] = get8(pp, desc_end);
+            language[i + 2] = get8(pp, desc_end);
+            language[i + 3] = ',';
+        switch (get8(pp, desc_end)) {
+            case 0x01: st->disposition |= AV_DISPOSITION_CLEAN_EFFECTS; break;
+            case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; break;
+            case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; break;
+        }
+        }
+        if (i) {
+            language[i - 1] = 0;
+            av_metadata_set2(&st->metadata, "language", language, 0);
+        }
         break;
     case 0x05: /* registration descriptor */
         st->codec->codec_tag = bytestream_get_le32(pp);
-        dprintf(fc, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag);
+        av_dlog(fc, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag);
         if (st->codec->codec_id == CODEC_ID_NONE &&
             stream_type == STREAM_TYPE_PRIVATE_DATA)
             mpegts_find_stream_type(st, st->codec->codec_tag, REGD_types);
@@ -994,7 +1006,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
     int mp4_es_id = 0;
 
 #ifdef DEBUG
-    dprintf(ts->stream, "PMT: len %i\n", section_len);
+    av_dlog(ts->stream, "PMT: len %i\n", section_len);
     av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
 #endif
 
@@ -1003,7 +1015,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
     if (parse_section_header(h, &p, p_end) < 0)
         return;
 
-    dprintf(ts->stream, "sid=0x%x sec_num=%d/%d\n",
+    av_dlog(ts->stream, "sid=0x%x sec_num=%d/%d\n",
            h->id, h->sec_num, h->last_sec_num);
 
     if (h->tid != PMT_TID)
@@ -1015,7 +1027,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
         return;
     add_pid_to_pmt(ts, h->id, pcr_pid);
 
-    dprintf(ts->stream, "pcr_pid=0x%x\n", pcr_pid);
+    av_dlog(ts->stream, "pcr_pid=0x%x\n", pcr_pid);
 
     program_info_length = get16(&p, p_end) & 0xfff;
     if (program_info_length < 0)
@@ -1025,7 +1037,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
         tag = get8(&p, p_end);
         len = get8(&p, p_end);
 
-        dprintf(ts->stream, "program tag: 0x%02x len=%d\n", tag, len);
+        av_dlog(ts->stream, "program tag: 0x%02x len=%d\n", tag, len);
 
         if(len > program_info_length - 2)
             //something else is broken, exit the program_descriptors_loop
@@ -1114,7 +1126,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
     int sid, pmt_pid;
 
 #ifdef DEBUG
-    dprintf(ts->stream, "PAT:\n");
+    av_dlog(ts->stream, "PAT:\n");
     av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
 #endif
     p_end = section + section_len - 4;
@@ -1133,7 +1145,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
         if (pmt_pid < 0)
             break;
 
-        dprintf(ts->stream, "sid=0x%x pid=0x%x\n", sid, pmt_pid);
+        av_dlog(ts->stream, "sid=0x%x pid=0x%x\n", sid, pmt_pid);
 
         if (sid == 0x0000) {
             /* NIT info */
@@ -1158,7 +1170,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
     char *name, *provider_name;
 
 #ifdef DEBUG
-    dprintf(ts->stream, "SDT:\n");
+    av_dlog(ts->stream, "SDT:\n");
     av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
 #endif
 
@@ -1196,7 +1208,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
             if (desc_end > desc_list_end)
                 break;
 
-            dprintf(ts->stream, "tag: 0x%02x len=%d\n",
+            av_dlog(ts->stream, "tag: 0x%02x len=%d\n",
                    desc_tag, desc_len);
 
             switch(desc_tag) {
@@ -1211,8 +1223,8 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
                 if (name) {
                     AVProgram *program = av_new_program(ts->stream, sid);
                     if(program) {
-                        av_metadata_set2(&program->metadata, "name", name, 0);
-                        av_metadata_set2(&program->metadata, "provider_name", provider_name, 0);
+                        av_metadata_set2(&program->metadata, "service_name", name, 0);
+                        av_metadata_set2(&program->metadata, "service_provider", provider_name, 0);
                     }
                 }
                 av_free(name);
@@ -1269,7 +1281,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
     if (p >= p_end)
         return 0;
 
-    pos = url_ftell(ts->stream->pb);
+    pos = avio_tell(ts->stream->pb);
     ts->pos47= pos % ts->raw_packet_size;
 
     if (tss->type == MPEGTS_SECTION) {
@@ -1312,15 +1324,15 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
    get_packet_size() ?) */
 static int mpegts_resync(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int c, i;
 
     for(i = 0;i < MAX_RESYNC_SIZE; i++) {
-        c = url_fgetc(pb);
-        if (c < 0)
+        c = avio_r8(pb);
+        if (pb->eof_reached)
             return -1;
         if (c == 0x47) {
-            url_fseek(pb, -1, SEEK_CUR);
+            avio_seek(pb, -1, SEEK_CUR);
             return 0;
         }
     }
@@ -1332,17 +1344,17 @@ static int mpegts_resync(AVFormatContext *s)
 /* return -1 if error or EOF. Return 0 if OK. */
 static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int skip, len;
 
     for(;;) {
-        len = get_buffer(pb, buf, TS_PACKET_SIZE);
+        len = avio_read(pb, buf, TS_PACKET_SIZE);
         if (len != TS_PACKET_SIZE)
-            return AVERROR(EIO);
+            return len < 0 ? len : AVERROR_EOF;
         /* check paquet sync byte */
         if (buf[0] != 0x47) {
             /* find a new packet start */
-            url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR);
+            avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR);
             if (mpegts_resync(s) < 0)
                 return AVERROR(EAGAIN);
             else
@@ -1350,7 +1362,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
         } else {
             skip = raw_packet_size - TS_PACKET_SIZE;
             if (skip > 0)
-                url_fskip(pb, skip);
+                avio_skip(pb, skip);
             break;
         }
     }
@@ -1444,7 +1456,7 @@ static int mpegts_read_header(AVFormatContext *s,
                               AVFormatParameters *ap)
 {
     MpegTSContext *ts = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint8_t buf[5*1024];
     int len;
     int64_t pos;
@@ -1458,8 +1470,8 @@ static int mpegts_read_header(AVFormatContext *s,
     }
 
     /* read the first 1024 bytes to get packet size */
-    pos = url_ftell(pb);
-    len = get_buffer(pb, buf, sizeof(buf));
+    pos = avio_tell(pb);
+    len = avio_read(pb, buf, sizeof(buf));
     if (len != sizeof(buf))
         goto fail;
     ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
@@ -1468,11 +1480,11 @@ static int mpegts_read_header(AVFormatContext *s,
     ts->stream = s;
     ts->auto_guess = 0;
 
-    if (s->iformat == &mpegts_demuxer) {
+    if (s->iformat == &ff_mpegts_demuxer) {
         /* normal demux */
 
         /* first do a scaning to get all the services */
-        if (url_fseek(pb, pos, SEEK_SET) < 0)
+        if (avio_seek(pb, pos, SEEK_SET) < 0)
             av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n");
 
         mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1);
@@ -1484,7 +1496,7 @@ static int mpegts_read_header(AVFormatContext *s,
 
         ts->auto_guess = 1;
 
-        dprintf(ts->stream, "tuning done\n");
+        av_dlog(ts->stream, "tuning done\n");
 
         s->ctx_flags |= AVFMTCTX_NOHEADER;
     } else {
@@ -1537,7 +1549,7 @@ static int mpegts_read_header(AVFormatContext *s,
 #endif
     }
 
-    url_fseek(pb, pos, SEEK_SET);
+    avio_seek(pb, pos, SEEK_SET);
     return 0;
  fail:
     return -1;
@@ -1556,7 +1568,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
 
     if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
         return AVERROR(ENOMEM);
-    pkt->pos= url_ftell(s->pb);
+    pkt->pos= avio_tell(s->pb);
     ret = read_packet(s, pkt->data, ts->raw_packet_size);
     if (ret < 0) {
         av_free_packet(pkt);
@@ -1566,10 +1578,10 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
         /* compute exact PCR for each packet */
         if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
             /* we read the next PCR (XXX: optimize it by using a bigger buffer */
-            pos = url_ftell(s->pb);
+            pos = avio_tell(s->pb);
             for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
-                url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
-                get_buffer(s->pb, pcr_buf, 12);
+                avio_seek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
+                avio_read(s->pb, pcr_buf, 12);
                 if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
                     /* XXX: not precise enough */
                     ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) /
@@ -1577,7 +1589,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
                     break;
                 }
             }
-            url_fseek(s->pb, pos, SEEK_SET);
+            avio_seek(s->pb, pos, SEEK_SET);
             /* no next PCR found: we use previous increment */
             ts->cur_pcr = pcr_h * 300 + pcr_l;
         }
@@ -1595,7 +1607,7 @@ static int mpegts_read_packet(AVFormatContext *s,
     MpegTSContext *ts = s->priv_data;
     int ret, i;
 
-    if (url_ftell(s->pb) != ts->last_pos) {
+    if (avio_tell(s->pb) != ts->last_pos) {
         /* seek detected, flush pes buffer */
         for (i = 0; i < NB_PID_MAX; i++) {
             if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
@@ -1624,7 +1636,7 @@ static int mpegts_read_packet(AVFormatContext *s,
         }
     }
 
-    ts->last_pos = url_ftell(s->pb);
+    ts->last_pos = avio_tell(s->pb);
 
     return ret;
 }
@@ -1653,8 +1665,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
     pos = ((*ppos  + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47;
     if (find_next) {
         for(;;) {
-            url_fseek(s->pb, pos, SEEK_SET);
-            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+            avio_seek(s->pb, pos, SEEK_SET);
+            if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
                 return AV_NOPTS_VALUE;
             if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
                 parse_pcr(&timestamp, &pcr_l, buf) == 0) {
@@ -1667,8 +1679,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
             pos -= ts->raw_packet_size;
             if (pos < 0)
                 return AV_NOPTS_VALUE;
-            url_fseek(s->pb, pos, SEEK_SET);
-            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+            avio_seek(s->pb, pos, SEEK_SET);
+            if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
                 return AV_NOPTS_VALUE;
             if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
                 parse_pcr(&timestamp, &pcr_l, buf) == 0) {
@@ -1775,17 +1787,17 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
     if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
         return -1;
 
-    pos= url_ftell(s->pb);
+    pos= avio_tell(s->pb);
 
     for(;;) {
-        url_fseek(s->pb, pos, SEEK_SET);
-        if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+        avio_seek(s->pb, pos, SEEK_SET);
+        if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
             return -1;
 //        pid = AV_RB16(buf + 1) & 0x1fff;
         if(buf[1] & 0x40) break;
         pos += ts->raw_packet_size;
     }
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
 
     return 0;
 }
@@ -1845,7 +1857,7 @@ void ff_mpegts_parse_close(MpegTSContext *ts)
     av_free(ts);
 }
 
-AVInputFormat mpegts_demuxer = {
+AVInputFormat ff_mpegts_demuxer = {
     "mpegts",
     NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"),
     sizeof(MpegTSContext),
@@ -1861,7 +1873,7 @@ AVInputFormat mpegts_demuxer = {
 #endif
 };
 
-AVInputFormat mpegtsraw_demuxer = {
+AVInputFormat ff_mpegtsraw_demuxer = {
     "mpegtsraw",
     NULL_IF_CONFIG_SMALL("MPEG-2 raw transport stream format"),
     sizeof(MpegTSContext),
diff --git a/ffmpeg-mt/libavformat/mpegts.h b/ffmpeg-mt/libavformat/mpegts.h
index 25f2107..73ef2ed 100644
--- a/ffmpeg-mt/libavformat/mpegts.h
+++ b/ffmpeg-mt/libavformat/mpegts.h
@@ -2,20 +2,20 @@
  * MPEG2 transport stream defines
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -48,6 +48,7 @@
 #define STREAM_TYPE_PRIVATE_SECTION 0x05
 #define STREAM_TYPE_PRIVATE_DATA    0x06
 #define STREAM_TYPE_AUDIO_AAC       0x0f
+#define STREAM_TYPE_AUDIO_AAC_LATM  0x11
 #define STREAM_TYPE_VIDEO_MPEG4     0x10
 #define STREAM_TYPE_VIDEO_H264      0x1b
 #define STREAM_TYPE_VIDEO_VC1       0xea
diff --git a/ffmpeg-mt/libavformat/mpegtsenc.c b/ffmpeg-mt/libavformat/mpegtsenc.c
index bfd21db..40b906e 100644
--- a/ffmpeg-mt/libavformat/mpegtsenc.c
+++ b/ffmpeg-mt/libavformat/mpegtsenc.c
@@ -2,25 +2,26 @@
  * MPEG2 transport stream (aka DVB) muxer
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/bswap.h"
 #include "libavutil/crc.h"
+#include "libavutil/opt.h"
 #include "libavcodec/mpegvideo.h"
 #include "avformat.h"
 #include "internal.h"
@@ -64,12 +65,39 @@ typedef struct MpegTSWrite {
     int tsid;
     int64_t first_pcr;
     int mux_rate; ///< set to 1 when VBR
+
+    int transport_stream_id;
+    int original_network_id;
+    int service_id;
+
+    int pmt_start_pid;
+    int start_pid;
 } MpegTSWrite;
 
+static const AVOption options[] = {
+    { "mpegts_transport_stream_id", "Set transport_stream_id field.",
+      offsetof(MpegTSWrite, transport_stream_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
+    { "mpegts_original_network_id", "Set original_network_id field.",
+      offsetof(MpegTSWrite, original_network_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
+    { "mpegts_service_id", "Set service_id field.",
+      offsetof(MpegTSWrite, service_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
+    { "mpegts_pmt_start_pid", "Set the first pid of the PMT.",
+      offsetof(MpegTSWrite, pmt_start_pid), FF_OPT_TYPE_INT, 0x1000, 0x1000, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM},
+    { "mpegts_start_pid", "Set the first pid.",
+      offsetof(MpegTSWrite, start_pid), FF_OPT_TYPE_INT, 0x0100, 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM},
+    { NULL },
+};
+
+static const AVClass mpegts_muxer_class = {
+    "MPEGTS muxer",
+    av_default_item_name,
+    options,
+    LIBAVUTIL_VERSION_INT,
+};
+
 /* NOTE: 4 bytes must be left at the end for the crc32 */
 static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
 {
-    MpegTSWrite *ts = ((AVFormatContext*)s->opaque)->priv_data;
     unsigned int crc;
     unsigned char packet[TS_PACKET_SIZE];
     const unsigned char *buf_ptr;
@@ -129,6 +157,8 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
 {
     uint8_t section[1024], *q;
     unsigned int tot_len;
+    /* reserved_future_use field must be set to 1 for SDT */
+    unsigned int flags = tid == SDT_TID ? 0xf000 : 0xb000;
 
     tot_len = 3 + 5 + len + 4;
     /* check if not too big */
@@ -137,7 +167,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
 
     q = section;
     *q++ = tid;
-    put16(&q, 0xb000 | (len + 5 + 4)); /* 5 byte header + 4 byte CRC */
+    put16(&q, flags | (len + 5 + 4)); /* 5 byte header + 4 byte CRC */
     put16(&q, id);
     *q++ = 0xc1 | (version << 1); /* current_next_indicator = 1 */
     *q++ = sec_num;
@@ -151,16 +181,9 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
 /*********************************************/
 /* mpegts writer */
 
-#define DEFAULT_PMT_START_PID   0x1000
-#define DEFAULT_START_PID       0x0100
 #define DEFAULT_PROVIDER_NAME   "FFmpeg"
 #define DEFAULT_SERVICE_NAME    "Service01"
 
-/* default network id, transport stream and service identifiers */
-#define DEFAULT_ONID            0x0001
-#define DEFAULT_TSID            0x0001
-#define DEFAULT_SID             0x0001
-
 /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */
 #define DEFAULT_PES_HEADER_FREQ 16
 #define DEFAULT_PES_PAYLOAD_SIZE ((DEFAULT_PES_HEADER_FREQ - 1) * 184 + 170)
@@ -242,6 +265,9 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
         case CODEC_ID_AAC:
             stream_type = STREAM_TYPE_AUDIO_AAC;
             break;
+        case CODEC_ID_AAC_LATM:
+            stream_type = STREAM_TYPE_AUDIO_AAC_LATM;
+            break;
         case CODEC_ID_AC3:
             stream_type = STREAM_TYPE_AUDIO_AC3;
             break;
@@ -257,13 +283,38 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
         /* write optional descriptors here */
         switch(st->codec->codec_type) {
         case AVMEDIA_TYPE_AUDIO:
-            if (lang && strlen(lang->value) == 3) {
+            if (lang) {
+                char *p;
+                char *next = lang->value;
+                uint8_t *len_ptr;
+
                 *q++ = 0x0a; /* ISO 639 language descriptor */
-                *q++ = 4;
-                *q++ = lang->value[0];
-                *q++ = lang->value[1];
-                *q++ = lang->value[2];
-                *q++ = 0; /* undefined type */
+                len_ptr = q++;
+                *len_ptr = 0;
+
+                for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) {
+                    next = strchr(p, ',');
+                    if (strlen(p) != 3 && (!next || next != p + 3))
+                        continue; /* not a 3-letter code */
+
+                    *q++ = *p++;
+                    *q++ = *p++;
+                    *q++ = *p++;
+
+                if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)
+                    *q++ = 0x01;
+                else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)
+                    *q++ = 0x02;
+                else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
+                    *q++ = 0x03;
+                else
+                    *q++ = 0; /* undefined type */
+
+                    *len_ptr += 4;
+                }
+
+                if (*len_ptr == 0)
+                    q -= 2; /* no language codes were written */
             }
             break;
         case AVMEDIA_TYPE_SUBTITLE:
@@ -370,7 +421,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts,
     service = av_mallocz(sizeof(MpegTSService));
     if (!service)
         return NULL;
-    service->pmt.pid = DEFAULT_PMT_START_PID + ts->nb_services - 1;
+    service->pmt.pid = ts->pmt_start_pid + ts->nb_services - 1;
     service->sid = sid;
     service->provider_name = av_strdup(provider_name);
     service->name = av_strdup(name);
@@ -382,7 +433,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts,
 static void section_write_packet(MpegTSSection *s, const uint8_t *packet)
 {
     AVFormatContext *ctx = s->opaque;
-    put_buffer(ctx->pb, packet, TS_PACKET_SIZE);
+    avio_write(ctx->pb, packet, TS_PACKET_SIZE);
 }
 
 static int mpegts_write_header(AVFormatContext *s)
@@ -391,18 +442,22 @@ static int mpegts_write_header(AVFormatContext *s)
     MpegTSWriteStream *ts_st;
     MpegTSService *service;
     AVStream *st, *pcr_st = NULL;
-    AVMetadataTag *title;
+    AVMetadataTag *title, *provider;
     int i, j;
     const char *service_name;
+    const char *provider_name;
     int *pids;
 
-    ts->tsid = DEFAULT_TSID;
-    ts->onid = DEFAULT_ONID;
+    ts->tsid = ts->transport_stream_id;
+    ts->onid = ts->original_network_id;
     /* allocate a single DVB service */
-    title = av_metadata_get(s->metadata, "title", NULL, 0);
+    title = av_metadata_get(s->metadata, "service_name", NULL, 0);
+    if (!title)
+        title = av_metadata_get(s->metadata, "title", NULL, 0);
     service_name = title ? title->value : DEFAULT_SERVICE_NAME;
-    service = mpegts_add_service(ts, DEFAULT_SID,
-                                 DEFAULT_PROVIDER_NAME, service_name);
+    provider = av_metadata_get(s->metadata, "service_provider", NULL, 0);
+    provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME;
+    service = mpegts_add_service(ts, ts->service_id, provider_name, service_name);
     service->pmt.write_packet = section_write_packet;
     service->pmt.opaque = s;
     service->pmt.cc = 15;
@@ -432,7 +487,7 @@ static int mpegts_write_header(AVFormatContext *s)
         /* MPEG pid values < 16 are reserved. Applications which set st->id in
          * this range are assigned a calculated pid. */
         if (st->id < 16) {
-            ts_st->pid = DEFAULT_START_PID + i;
+            ts_st->pid = ts->start_pid + i;
         } else if (st->id < 0x1FFF) {
             ts_st->pid = st->id;
         } else {
@@ -524,7 +579,7 @@ static int mpegts_write_header(AVFormatContext *s)
            service->pcr_packet_period,
            ts->sdt_packet_period, ts->pat_packet_period);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     return 0;
 
@@ -556,9 +611,9 @@ static void retransmit_si_info(AVFormatContext *s)
     }
 }
 
-static int64_t get_pcr(const MpegTSWrite *ts, ByteIOContext *pb)
+static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb)
 {
-    return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
+    return av_rescale(avio_tell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
            ts->first_pcr;
 }
 
@@ -570,7 +625,7 @@ static uint8_t* write_pcr_bits(uint8_t *buf, int64_t pcr)
     *buf++ = pcr_high >> 17;
     *buf++ = pcr_high >> 9;
     *buf++ = pcr_high >> 1;
-    *buf++ = ((pcr_high & 1) << 7) | (pcr_low >> 8);
+    *buf++ = pcr_high << 7 | pcr_low >> 8 | 0x7e;
     *buf++ = pcr_low;
 
     return buf;
@@ -579,7 +634,6 @@ static uint8_t* write_pcr_bits(uint8_t *buf, int64_t pcr)
 /* Write a single null transport stream packet */
 static void mpegts_insert_null_packet(AVFormatContext *s)
 {
-    MpegTSWrite *ts = s->priv_data;
     uint8_t *q;
     uint8_t buf[TS_PACKET_SIZE];
 
@@ -589,7 +643,7 @@ static void mpegts_insert_null_packet(AVFormatContext *s)
     *q++ = 0xff;
     *q++ = 0x10;
     memset(q, 0x0FF, TS_PACKET_SIZE - (q - buf));
-    put_buffer(s->pb, buf, TS_PACKET_SIZE);
+    avio_write(s->pb, buf, TS_PACKET_SIZE);
 }
 
 /* Write a single transport stream packet with a PCR and no payload */
@@ -614,7 +668,7 @@ static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st)
 
     /* stuffing bytes */
     memset(q, 0xFF, TS_PACKET_SIZE - (q - buf));
-    put_buffer(s->pb, buf, TS_PACKET_SIZE);
+    avio_write(s->pb, buf, TS_PACKET_SIZE);
 }
 
 static void write_pts(uint8_t *q, int fourbits, int64_t pts)
@@ -710,7 +764,8 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
                     *q++ = 0xe0;
             } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
                        (st->codec->codec_id == CODEC_ID_MP2 ||
-                        st->codec->codec_id == CODEC_ID_MP3)) {
+                        st->codec->codec_id == CODEC_ID_MP3 ||
+                        st->codec->codec_id == CODEC_ID_AAC)) {
                 *q++ = 0xc0;
             } else {
                 *q++ = 0xbd;
@@ -808,9 +863,9 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
         memcpy(buf + TS_PACKET_SIZE - len, payload, len);
         payload += len;
         payload_size -= len;
-        put_buffer(s->pb, buf, TS_PACKET_SIZE);
+        avio_write(s->pb, buf, TS_PACKET_SIZE);
     }
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 }
 
 static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
@@ -933,7 +988,7 @@ static int mpegts_write_end(AVFormatContext *s)
         }
         av_freep(&ts_st->adts);
     }
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     for(i = 0; i < ts->nb_services; i++) {
         service = ts->services[i];
@@ -946,7 +1001,7 @@ static int mpegts_write_end(AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat mpegts_muxer = {
+AVOutputFormat ff_mpegts_muxer = {
     "mpegts",
     NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"),
     "video/x-mpegts",
@@ -957,4 +1012,5 @@ AVOutputFormat mpegts_muxer = {
     mpegts_write_header,
     mpegts_write_packet,
     mpegts_write_end,
+    .priv_class = &mpegts_muxer_class,
 };
diff --git a/ffmpeg-mt/libavformat/mpegvideodec.c b/ffmpeg-mt/libavformat/mpegvideodec.c
index d0b9a2c..0669820 100644
--- a/ffmpeg-mt/libavformat/mpegvideodec.c
+++ b/ffmpeg-mt/libavformat/mpegvideodec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002-2003 Fabrice Bellard
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,7 +55,7 @@ static int mpegvideo_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat mpegvideo_demuxer = {
+AVInputFormat ff_mpegvideo_demuxer = {
     "mpegvideo",
     NULL_IF_CONFIG_SMALL("raw MPEG video"),
     0,
diff --git a/ffmpeg-mt/libavformat/mpjpeg.c b/ffmpeg-mt/libavformat/mpjpeg.c
index 8973877..ebb57bf 100644
--- a/ffmpeg-mt/libavformat/mpjpeg.c
+++ b/ffmpeg-mt/libavformat/mpjpeg.c
@@ -2,20 +2,20 @@
  * Multipart JPEG format
  * Copyright (c) 2000, 2001, 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
@@ -29,8 +29,8 @@ static int mpjpeg_write_header(AVFormatContext *s)
     uint8_t buf1[256];
 
     snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG);
-    put_buffer(s->pb, buf1, strlen(buf1));
-    put_flush_packet(s->pb);
+    avio_write(s->pb, buf1, strlen(buf1));
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -39,12 +39,12 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
     uint8_t buf1[256];
 
     snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
-    put_buffer(s->pb, buf1, strlen(buf1));
-    put_buffer(s->pb, pkt->data, pkt->size);
+    avio_write(s->pb, buf1, strlen(buf1));
+    avio_write(s->pb, pkt->data, pkt->size);
 
     snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG);
-    put_buffer(s->pb, buf1, strlen(buf1));
-    put_flush_packet(s->pb);
+    avio_write(s->pb, buf1, strlen(buf1));
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -53,7 +53,7 @@ static int mpjpeg_write_trailer(AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat mpjpeg_muxer = {
+AVOutputFormat ff_mpjpeg_muxer = {
     "mpjpeg",
     NULL_IF_CONFIG_SMALL("MIME multipart JPEG format"),
     "multipart/x-mixed-replace;boundary=" BOUNDARY_TAG,
diff --git a/ffmpeg-mt/libavformat/msnwc_tcp.c b/ffmpeg-mt/libavformat/msnwc_tcp.c
index e548871..d9d8000 100644
--- a/ffmpeg-mt/libavformat/msnwc_tcp.c
+++ b/ffmpeg-mt/libavformat/msnwc_tcp.c
@@ -1,20 +1,20 @@
 /*
- * Copyright (C) 2008  Ramiro Polla <ramiro at lisha.ufsc.br>
+ * Copyright (C) 2008  Ramiro Polla
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -71,7 +71,7 @@ static int msnwc_tcp_probe(AVProbeData *p)
 
 static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = ctx->pb;
+    AVIOContext *pb = ctx->pb;
     AVCodecContext *codec;
     AVStream *st;
 
@@ -88,9 +88,9 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
 
     /* Some files start with "connected\r\n\r\n".
      * So skip until we find the first byte of struct size */
-    while(get_byte(pb) != HEADER_SIZE && !url_feof(pb));
+    while(avio_r8(pb) != HEADER_SIZE && !pb->eof_reached);
 
-    if(url_feof(pb)) {
+    if(pb->eof_reached) {
         av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
         return -1;
     }
@@ -100,23 +100,23 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
 
 static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
 {
-    ByteIOContext *pb = ctx->pb;
+    AVIOContext *pb = ctx->pb;
     uint16_t keyframe;
     uint32_t size, timestamp;
 
-    url_fskip(pb, 1); /* one byte has been read ahead */
-    url_fskip(pb, 2);
-    url_fskip(pb, 2);
-    keyframe = get_le16(pb);
-    size = get_le32(pb);
-    url_fskip(pb, 4);
-    url_fskip(pb, 4);
-    timestamp = get_le32(pb);
+    avio_skip(pb, 1); /* one byte has been read ahead */
+    avio_skip(pb, 2);
+    avio_skip(pb, 2);
+    keyframe = avio_rl16(pb);
+    size = avio_rl32(pb);
+    avio_skip(pb, 4);
+    avio_skip(pb, 4);
+    timestamp = avio_rl32(pb);
 
     if(!size || av_get_packet(pb, pkt, size) != size)
         return -1;
 
-    url_fskip(pb, 1); /* Read ahead one byte of struct size like read_header */
+    avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */
 
     pkt->pts = timestamp;
     pkt->dts = timestamp;
@@ -130,7 +130,7 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
     return HEADER_SIZE + size;
 }
 
-AVInputFormat msnwc_tcp_demuxer = {
+AVInputFormat ff_msnwc_tcp_demuxer = {
     "msnwctcp",
     NULL_IF_CONFIG_SMALL("MSN TCP Webcam stream"),
     0,
diff --git a/ffmpeg-mt/libavformat/mtv.c b/ffmpeg-mt/libavformat/mtv.c
index 9280455..92d38e1 100644
--- a/ffmpeg-mt/libavformat/mtv.c
+++ b/ffmpeg-mt/libavformat/mtv.c
@@ -2,20 +2,20 @@
  * mtv demuxer
  * Copyright (c) 2006 Reynaldo H. Verdejo Pinochet
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,21 +79,21 @@ static int mtv_probe(AVProbeData *p)
 static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     MTVDemuxContext *mtv = s->priv_data;
-    ByteIOContext   *pb  = s->pb;
+    AVIOContext   *pb  = s->pb;
     AVStream        *st;
     unsigned int    audio_subsegments;
 
-    url_fskip(pb, 3);
-    mtv->file_size         = get_le32(pb);
-    mtv->segments          = get_le32(pb);
-    url_fskip(pb, 32);
-    mtv->audio_identifier  = get_le24(pb);
-    mtv->audio_br          = get_le16(pb);
-    mtv->img_colorfmt      = get_le24(pb);
-    mtv->img_bpp           = get_byte(pb);
-    mtv->img_width         = get_le16(pb);
-    mtv->img_height        = get_le16(pb);
-    mtv->img_segment_size  = get_le16(pb);
+    avio_skip(pb, 3);
+    mtv->file_size         = avio_rl32(pb);
+    mtv->segments          = avio_rl32(pb);
+    avio_skip(pb, 32);
+    mtv->audio_identifier  = avio_rl24(pb);
+    mtv->audio_br          = avio_rl16(pb);
+    mtv->img_colorfmt      = avio_rl24(pb);
+    mtv->img_bpp           = avio_r8(pb);
+    mtv->img_width         = avio_rl16(pb);
+    mtv->img_height        = avio_rl16(pb);
+    mtv->img_segment_size  = avio_rl16(pb);
 
     /* Calculate width and height if missing from header */
 
@@ -105,8 +105,8 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
         mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3)
                         / mtv->img_width;
 
-    url_fskip(pb, 4);
-    audio_subsegments = get_le16(pb);
+    avio_skip(pb, 4);
+    audio_subsegments = avio_rl16(pb);
     mtv->full_segment_size =
         audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
         mtv->img_segment_size;
@@ -146,7 +146,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     // Jump over header
 
-    if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
+    if(avio_seek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
         return AVERROR(EIO);
 
     return 0;
@@ -156,15 +156,15 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
 static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     MTVDemuxContext *mtv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret;
 #if !HAVE_BIGENDIAN
     int i;
 #endif
 
-    if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
+    if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
     {
-        url_fskip(pb, MTV_AUDIO_PADDING_SIZE);
+        avio_skip(pb, MTV_AUDIO_PADDING_SIZE);
 
         ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE);
         if(ret < 0)
@@ -196,7 +196,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat mtv_demuxer = {
+AVInputFormat ff_mtv_demuxer = {
     "MTV",
     NULL_IF_CONFIG_SMALL("MTV format"),
     sizeof(MTVDemuxContext),
diff --git a/ffmpeg-mt/libavformat/mvi.c b/ffmpeg-mt/libavformat/mvi.c
index 506976d..809cdf5 100644
--- a/ffmpeg-mt/libavformat/mvi.c
+++ b/ffmpeg-mt/libavformat/mvi.c
@@ -2,20 +2,20 @@
  * Motion Pixels MVI Demuxer
  * Copyright (c) 2008 Gregory Montoir (cyx at users.sourceforge.net)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 #define MVI_VIDEO_STREAM_INDEX 1
 
 typedef struct MviDemuxContext {
-    unsigned int (*get_int)(ByteIOContext *);
+    unsigned int (*get_int)(AVIOContext *);
     uint32_t audio_data_size;
     uint64_t audio_size_counter;
     uint64_t audio_frame_size;
@@ -38,7 +38,7 @@ typedef struct MviDemuxContext {
 static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     MviDemuxContext *mvi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *ast, *vst;
     unsigned int version, frames_count, msecs_per_frame, player_version;
 
@@ -53,20 +53,20 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     vst->codec->extradata_size = 2;
     vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE);
 
-    version                  = get_byte(pb);
-    vst->codec->extradata[0] = get_byte(pb);
-    vst->codec->extradata[1] = get_byte(pb);
-    frames_count             = get_le32(pb);
-    msecs_per_frame          = get_le32(pb);
-    vst->codec->width        = get_le16(pb);
-    vst->codec->height       = get_le16(pb);
-    get_byte(pb);
-    ast->codec->sample_rate  = get_le16(pb);
-    mvi->audio_data_size     = get_le32(pb);
-    get_byte(pb);
-    player_version           = get_le32(pb);
-    get_le16(pb);
-    get_byte(pb);
+    version                  = avio_r8(pb);
+    vst->codec->extradata[0] = avio_r8(pb);
+    vst->codec->extradata[1] = avio_r8(pb);
+    frames_count             = avio_rl32(pb);
+    msecs_per_frame          = avio_rl32(pb);
+    vst->codec->width        = avio_rl16(pb);
+    vst->codec->height       = avio_rl16(pb);
+    avio_r8(pb);
+    ast->codec->sample_rate  = avio_rl16(pb);
+    mvi->audio_data_size     = avio_rl32(pb);
+    avio_r8(pb);
+    player_version           = avio_rl32(pb);
+    avio_rl16(pb);
+    avio_r8(pb);
 
     if (frames_count == 0 || mvi->audio_data_size == 0)
         return AVERROR_INVALIDDATA;
@@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
     vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     vst->codec->codec_id   = CODEC_ID_MOTIONPIXELS;
 
-    mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? get_le16 : get_le24;
+    mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24;
 
     mvi->audio_frame_size   = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
     mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size;
@@ -100,7 +100,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret, count;
     MviDemuxContext *mvi = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     if (mvi->video_frame_size == 0) {
         mvi->video_frame_size = (mvi->get_int)(pb);
@@ -123,7 +123,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat mvi_demuxer = {
+AVInputFormat ff_mvi_demuxer = {
     "mvi",
     NULL_IF_CONFIG_SMALL("Motion Pixels MVI format"),
     sizeof(MviDemuxContext),
diff --git a/ffmpeg-mt/libavformat/mxf.c b/ffmpeg-mt/libavformat/mxf.c
index c7423b0..6192368 100644
--- a/ffmpeg-mt/libavformat/mxf.c
+++ b/ffmpeg-mt/libavformat/mxf.c
@@ -2,20 +2,20 @@
  * MXF
  * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -52,7 +52,10 @@ const MXFCodecUL ff_mxf_codec_uls[] = {
     { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,       CODEC_ID_NONE },
 };
 
-const MXFPixelLayout ff_mxf_pixel_layouts[] = {
+static const struct {
+    enum PixelFormat pix_fmt;
+    const char data[16];
+} ff_mxf_pixel_layouts[] = {
     /**
      * See SMPTE 377M E.2.46
      *
diff --git a/ffmpeg-mt/libavformat/mxf.h b/ffmpeg-mt/libavformat/mxf.h
index 26832c2..beb6628 100644
--- a/ffmpeg-mt/libavformat/mxf.h
+++ b/ffmpeg-mt/libavformat/mxf.h
@@ -2,20 +2,20 @@
  * MXF
  * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVFORMAT_MXF_H
@@ -61,20 +61,9 @@ typedef struct {
 extern const MXFCodecUL ff_mxf_data_definition_uls[];
 extern const MXFCodecUL ff_mxf_codec_uls[];
 
-typedef struct {
-    enum PixelFormat pix_fmt;
-    const char data[16];
-} MXFPixelLayout;
-
-extern const MXFPixelLayout ff_mxf_pixel_layouts[];
-
 int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt);
 
-#ifdef DEBUG
-#define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \
+#define PRINT_KEY(pc, s, x) av_dlog(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \
                              (x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15])
-#else
-#define PRINT_KEY(pc, s, x)
-#endif
 
 #endif /* AVFORMAT_MXF_H */
diff --git a/ffmpeg-mt/libavformat/mxfdec.c b/ffmpeg-mt/libavformat/mxfdec.c
index ac5ea4b..39c7fea 100644
--- a/ffmpeg-mt/libavformat/mxfdec.c
+++ b/ffmpeg-mt/libavformat/mxfdec.c
@@ -2,20 +2,20 @@
  * MXF demuxer.
  * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -140,7 +140,7 @@ enum MXFWrappingScheme {
     Clip,
 };
 
-typedef int MXFMetadataReadFunc(void *arg, ByteIOContext *pb, int tag, int size, UID uid);
+typedef int MXFMetadataReadFunc(void *arg, AVIOContext *pb, int tag, int size, UID uid);
 
 typedef struct {
     const UID key;
@@ -161,9 +161,9 @@ static const uint8_t mxf_sony_mpeg4_extradata[]            = { 0x06,0x0e,0x2b,0x
 
 #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
 
-static int64_t klv_decode_ber_length(ByteIOContext *pb)
+static int64_t klv_decode_ber_length(AVIOContext *pb)
 {
-    uint64_t size = get_byte(pb);
+    uint64_t size = avio_r8(pb);
     if (size & 0x80) { /* long form */
         int bytes_num = size & 0x7f;
         /* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */
@@ -171,16 +171,16 @@ static int64_t klv_decode_ber_length(ByteIOContext *pb)
             return -1;
         size = 0;
         while (bytes_num--)
-            size = size << 8 | get_byte(pb);
+            size = size << 8 | avio_r8(pb);
     }
     return size;
 }
 
-static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size)
+static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size)
 {
     int i, b;
-    for (i = 0; i < size && !url_feof(pb); i++) {
-        b = get_byte(pb);
+    for (i = 0; i < size && !pb->eof_reached; i++) {
+        b = avio_r8(pb);
         if (b == key[0])
             i = 0;
         else if (b != key[i])
@@ -189,13 +189,13 @@ static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size)
     return i == size;
 }
 
-static int klv_read_packet(KLVPacket *klv, ByteIOContext *pb)
+static int klv_read_packet(KLVPacket *klv, AVIOContext *pb)
 {
     if (!mxf_read_sync(pb, mxf_klv_key, 4))
         return -1;
-    klv->offset = url_ftell(pb) - 4;
+    klv->offset = avio_tell(pb) - 4;
     memcpy(klv->key, mxf_klv_key, 4);
-    get_buffer(pb, klv->key + 4, 12);
+    avio_read(pb, klv->key + 4, 12);
     klv->length = klv_decode_ber_length(pb);
     return klv->length == -1 ? -1 : 0;
 }
@@ -215,7 +215,7 @@ static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv)
 }
 
 /* XXX: use AVBitStreamFilter */
-static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length)
+static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length)
 {
     const uint8_t *buf_ptr, *end_ptr;
     uint8_t *data_ptr;
@@ -224,7 +224,7 @@ static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pk
     if (length > 61444) /* worst case PAL 1920 samples 8 channels */
         return -1;
     av_new_packet(pkt, length);
-    get_buffer(pb, pkt->data, length);
+    avio_read(pb, pkt->data, length);
     data_ptr = pkt->data;
     end_ptr = pkt->data + length;
     buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */
@@ -246,8 +246,8 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
 {
     static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t end = url_ftell(pb) + klv->length;
+    AVIOContext *pb = s->pb;
+    int64_t end = avio_tell(pb) + klv->length;
     uint64_t size;
     uint64_t orig_size;
     uint64_t plaintext_size;
@@ -262,13 +262,13 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
         av_aes_init(mxf->aesc, s->key, 128, 1);
     }
     // crypto context
-    url_fskip(pb, klv_decode_ber_length(pb));
+    avio_skip(pb, klv_decode_ber_length(pb));
     // plaintext offset
     klv_decode_ber_length(pb);
-    plaintext_size = get_be64(pb);
+    plaintext_size = avio_rb64(pb);
     // source klv key
     klv_decode_ber_length(pb);
-    get_buffer(pb, klv->key, 16);
+    avio_read(pb, klv->key, 16);
     if (!IS_KLV_KEY(klv, mxf_essence_element_key))
         return -1;
     index = mxf_get_stream_index(s, klv);
@@ -276,15 +276,15 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
         return -1;
     // source size
     klv_decode_ber_length(pb);
-    orig_size = get_be64(pb);
+    orig_size = avio_rb64(pb);
     if (orig_size < plaintext_size)
         return -1;
     // enc. code
     size = klv_decode_ber_length(pb);
     if (size < 32 || size - 32 < orig_size)
         return -1;
-    get_buffer(pb, ivec, 16);
-    get_buffer(pb, tmpbuf, 16);
+    avio_read(pb, ivec, 16);
+    avio_read(pb, tmpbuf, 16);
     if (mxf->aesc)
         av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1);
     if (memcmp(tmpbuf, checkv, 16))
@@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
                      &pkt->data[plaintext_size], size >> 4, ivec, 1);
     pkt->size = orig_size;
     pkt->stream_index = index;
-    url_fskip(pb, end - url_ftell(pb));
+    avio_skip(pb, end - avio_tell(pb));
     return 0;
 }
 
@@ -305,11 +305,11 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     KLVPacket klv;
 
-    while (!url_feof(s->pb)) {
+    while (!s->pb->eof_reached) {
         if (klv_read_packet(&klv, s->pb) < 0)
             return -1;
         PRINT_KEY(s, "read packet", klv.key);
-        dprintf(s, "size %lld offset %#llx\n", klv.length, klv.offset);
+        av_dlog(s, "size %lld offset %#llx\n", klv.length, klv.offset);
         if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) {
             int res = mxf_decrypt_triplet(s, pkt, &klv);
             if (res < 0) {
@@ -339,16 +339,16 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
             return 0;
         } else
         skip:
-            url_fskip(s->pb, klv.length);
+            avio_skip(s->pb, klv.length);
     }
     return AVERROR_EOF;
 }
 
-static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFContext *mxf = arg;
-    int item_num = get_be32(pb);
-    int item_len = get_be32(pb);
+    int item_num = avio_rb32(pb);
+    int item_len = avio_rb32(pb);
 
     if (item_len != 18) {
         av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n");
@@ -360,7 +360,7 @@ static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size,
     mxf->local_tags = av_malloc(item_num*item_len);
     if (!mxf->local_tags)
         return -1;
-    get_buffer(pb, mxf->local_tags, item_num*item_len);
+    avio_read(pb, mxf->local_tags, item_num*item_len);
     return 0;
 }
 
@@ -376,167 +376,167 @@ static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
     return 0;
 }
 
-static int mxf_read_cryptographic_context(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFCryptoContext *cryptocontext = arg;
     if (size != 16)
         return -1;
     if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul))
-        get_buffer(pb, cryptocontext->source_container_ul, 16);
+        avio_read(pb, cryptocontext->source_container_ul, 16);
     return 0;
 }
 
-static int mxf_read_content_storage(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFContext *mxf = arg;
     switch (tag) {
     case 0x1901:
-        mxf->packages_count = get_be32(pb);
+        mxf->packages_count = avio_rb32(pb);
         if (mxf->packages_count >= UINT_MAX / sizeof(UID))
             return -1;
         mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID));
         if (!mxf->packages_refs)
             return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
+        avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
+        avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
         break;
     }
     return 0;
 }
 
-static int mxf_read_source_clip(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFStructuralComponent *source_clip = arg;
     switch(tag) {
     case 0x0202:
-        source_clip->duration = get_be64(pb);
+        source_clip->duration = avio_rb64(pb);
         break;
     case 0x1201:
-        source_clip->start_position = get_be64(pb);
+        source_clip->start_position = avio_rb64(pb);
         break;
     case 0x1101:
         /* UMID, only get last 16 bytes */
-        url_fskip(pb, 16);
-        get_buffer(pb, source_clip->source_package_uid, 16);
+        avio_skip(pb, 16);
+        avio_read(pb, source_clip->source_package_uid, 16);
         break;
     case 0x1102:
-        source_clip->source_track_id = get_be32(pb);
+        source_clip->source_track_id = avio_rb32(pb);
         break;
     }
     return 0;
 }
 
-static int mxf_read_material_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFPackage *package = arg;
     switch(tag) {
     case 0x4403:
-        package->tracks_count = get_be32(pb);
+        package->tracks_count = avio_rb32(pb);
         if (package->tracks_count >= UINT_MAX / sizeof(UID))
             return -1;
         package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
         if (!package->tracks_refs)
             return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
+        avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
+        avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
         break;
     }
     return 0;
 }
 
-static int mxf_read_track(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFTrack *track = arg;
     switch(tag) {
     case 0x4801:
-        track->track_id = get_be32(pb);
+        track->track_id = avio_rb32(pb);
         break;
     case 0x4804:
-        get_buffer(pb, track->track_number, 4);
+        avio_read(pb, track->track_number, 4);
         break;
     case 0x4B01:
-        track->edit_rate.den = get_be32(pb);
-        track->edit_rate.num = get_be32(pb);
+        track->edit_rate.den = avio_rb32(pb);
+        track->edit_rate.num = avio_rb32(pb);
         break;
     case 0x4803:
-        get_buffer(pb, track->sequence_ref, 16);
+        avio_read(pb, track->sequence_ref, 16);
         break;
     }
     return 0;
 }
 
-static int mxf_read_sequence(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFSequence *sequence = arg;
     switch(tag) {
     case 0x0202:
-        sequence->duration = get_be64(pb);
+        sequence->duration = avio_rb64(pb);
         break;
     case 0x0201:
-        get_buffer(pb, sequence->data_definition_ul, 16);
+        avio_read(pb, sequence->data_definition_ul, 16);
         break;
     case 0x1001:
-        sequence->structural_components_count = get_be32(pb);
+        sequence->structural_components_count = avio_rb32(pb);
         if (sequence->structural_components_count >= UINT_MAX / sizeof(UID))
             return -1;
         sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID));
         if (!sequence->structural_components_refs)
             return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
+        avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
+        avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
         break;
     }
     return 0;
 }
 
-static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFPackage *package = arg;
     switch(tag) {
     case 0x4403:
-        package->tracks_count = get_be32(pb);
+        package->tracks_count = avio_rb32(pb);
         if (package->tracks_count >= UINT_MAX / sizeof(UID))
             return -1;
         package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
         if (!package->tracks_refs)
             return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
+        avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
+        avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
         break;
     case 0x4401:
         /* UMID, only get last 16 bytes */
-        url_fskip(pb, 16);
-        get_buffer(pb, package->package_uid, 16);
+        avio_skip(pb, 16);
+        avio_read(pb, package->package_uid, 16);
         break;
     case 0x4701:
-        get_buffer(pb, package->descriptor_ref, 16);
+        avio_read(pb, package->descriptor_ref, 16);
         break;
     }
     return 0;
 }
 
-static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     switch(tag) {
-    case 0x3F05: dprintf(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break;
-    case 0x3F06: dprintf(NULL, "IndexSID %d\n", get_be32(pb)); break;
-    case 0x3F07: dprintf(NULL, "BodySID %d\n", get_be32(pb)); break;
-    case 0x3F0B: dprintf(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break;
-    case 0x3F0C: dprintf(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break;
-    case 0x3F0D: dprintf(NULL, "IndexDuration %lld\n", get_be64(pb)); break;
+    case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", avio_rb32(pb)); break;
+    case 0x3F06: av_dlog(NULL, "IndexSID %d\n", avio_rb32(pb)); break;
+    case 0x3F07: av_dlog(NULL, "BodySID %d\n", avio_rb32(pb)); break;
+    case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", avio_rb32(pb), avio_rb32(pb)); break;
+    case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", avio_rb64(pb)); break;
+    case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", avio_rb64(pb)); break;
     }
     return 0;
 }
 
-static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor)
+static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor)
 {
     int code, value, ofs = 0;
     char layout[16] = {0};
 
     do {
-        code = get_byte(pb);
-        value = get_byte(pb);
-        dprintf(NULL, "pixel layout: code %#x\n", code);
+        code = avio_r8(pb);
+        value = avio_r8(pb);
+        av_dlog(NULL, "pixel layout: code %#x\n", code);
 
         if (ofs < 16) {
             layout[ofs++] = code;
@@ -547,51 +547,51 @@ static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor)
     ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt);
 }
 
-static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid)
 {
     MXFDescriptor *descriptor = arg;
     switch(tag) {
     case 0x3F01:
-        descriptor->sub_descriptors_count = get_be32(pb);
+        descriptor->sub_descriptors_count = avio_rb32(pb);
         if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID))
             return -1;
         descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID));
         if (!descriptor->sub_descriptors_refs)
             return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
+        avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
+        avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
         break;
     case 0x3004:
-        get_buffer(pb, descriptor->essence_container_ul, 16);
+        avio_read(pb, descriptor->essence_container_ul, 16);
         break;
     case 0x3006:
-        descriptor->linked_track_id = get_be32(pb);
+        descriptor->linked_track_id = avio_rb32(pb);
         break;
     case 0x3201: /* PictureEssenceCoding */
-        get_buffer(pb, descriptor->essence_codec_ul, 16);
+        avio_read(pb, descriptor->essence_codec_ul, 16);
         break;
     case 0x3203:
-        descriptor->width = get_be32(pb);
+        descriptor->width = avio_rb32(pb);
         break;
     case 0x3202:
-        descriptor->height = get_be32(pb);
+        descriptor->height = avio_rb32(pb);
         break;
     case 0x320E:
-        descriptor->aspect_ratio.num = get_be32(pb);
-        descriptor->aspect_ratio.den = get_be32(pb);
+        descriptor->aspect_ratio.num = avio_rb32(pb);
+        descriptor->aspect_ratio.den = avio_rb32(pb);
         break;
     case 0x3D03:
-        descriptor->sample_rate.num = get_be32(pb);
-        descriptor->sample_rate.den = get_be32(pb);
+        descriptor->sample_rate.num = avio_rb32(pb);
+        descriptor->sample_rate.den = avio_rb32(pb);
         break;
     case 0x3D06: /* SoundEssenceCompression */
-        get_buffer(pb, descriptor->essence_codec_ul, 16);
+        avio_read(pb, descriptor->essence_codec_ul, 16);
         break;
     case 0x3D07:
-        descriptor->channels = get_be32(pb);
+        descriptor->channels = avio_rb32(pb);
         break;
     case 0x3D01:
-        descriptor->bits_per_sample = get_be32(pb);
+        descriptor->bits_per_sample = avio_rb32(pb);
         break;
     case 0x3401:
         mxf_read_pixel_layout(pb, descriptor);
@@ -603,7 +603,7 @@ static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, in
             if (!descriptor->extradata)
                 return -1;
             descriptor->extradata_size = size;
-            get_buffer(pb, descriptor->extradata, size);
+            avio_read(pb, descriptor->extradata, size);
         }
         break;
     }
@@ -666,7 +666,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
     MXFPackage *temp_package = NULL;
     int i, j, k;
 
-    dprintf(mxf->fc, "metadata sets count %d\n", mxf->metadata_sets_count);
+    av_dlog(mxf->fc, "metadata sets count %d\n", mxf->metadata_sets_count);
     /* TODO: handle multiple material packages (OP3x) */
     for (i = 0; i < mxf->packages_count; i++) {
         material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage);
@@ -864,19 +864,19 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
 
 static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type)
 {
-    ByteIOContext *pb = mxf->fc->pb;
+    AVIOContext *pb = mxf->fc->pb;
     MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
-    uint64_t klv_end = url_ftell(pb) + klv->length;
+    uint64_t klv_end = avio_tell(pb) + klv->length;
 
     if (!ctx)
         return -1;
-    while (url_ftell(pb) + 4 < klv_end) {
-        int tag = get_be16(pb);
-        int size = get_be16(pb); /* KLV specified by 0x53 */
-        uint64_t next = url_ftell(pb) + size;
+    while (avio_tell(pb) + 4 < klv_end) {
+        int tag = avio_rb16(pb);
+        int size = avio_rb16(pb); /* KLV specified by 0x53 */
+        uint64_t next = avio_tell(pb) + size;
         UID uid = {0};
 
-        dprintf(mxf->fc, "local tag %#04x size %d\n", tag, size);
+        av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size);
         if (!size) { /* ignore empty tag, needed for some files with empty UMID tag */
             av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x with 0 size\n", tag);
             continue;
@@ -887,17 +887,17 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
                 int local_tag = AV_RB16(mxf->local_tags+i*18);
                 if (local_tag == tag) {
                     memcpy(uid, mxf->local_tags+i*18+2, 16);
-                    dprintf(mxf->fc, "local tag %#04x\n", local_tag);
+                    av_dlog(mxf->fc, "local tag %#04x\n", local_tag);
                     PRINT_KEY(mxf->fc, "uid", uid);
                 }
             }
         }
         if (ctx_size && tag == 0x3C0A)
-            get_buffer(pb, ctx->uid, 16);
+            avio_read(pb, ctx->uid, 16);
         else if (read_child(ctx, pb, tag, size, uid) < 0)
             return -1;
 
-        url_fseek(pb, next, SEEK_SET);
+        avio_seek(pb, next, SEEK_SET);
     }
     if (ctx_size) ctx->type = type;
     return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0;
@@ -912,19 +912,19 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
         av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n");
         return -1;
     }
-    url_fseek(s->pb, -14, SEEK_CUR);
+    avio_seek(s->pb, -14, SEEK_CUR);
     mxf->fc = s;
-    while (!url_feof(s->pb)) {
+    while (!s->pb->eof_reached) {
         const MXFMetadataReadTableEntry *metadata;
 
         if (klv_read_packet(&klv, s->pb) < 0)
             return -1;
         PRINT_KEY(s, "read header", klv.key);
-        dprintf(s, "size %lld offset %#llx\n", klv.length, klv.offset);
+        av_dlog(s, "size %lld offset %#llx\n", klv.length, klv.offset);
         if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) ||
             IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
             /* FIXME avoid seek */
-            url_fseek(s->pb, klv.offset, SEEK_SET);
+            avio_seek(s->pb, klv.offset, SEEK_SET);
             break;
         }
 
@@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
             }
         }
         if (!metadata->read)
-            url_fskip(s->pb, klv.length);
+            avio_skip(s->pb, klv.length);
     }
     return mxf_parse_structural_metadata(mxf);
 }
@@ -1009,12 +1009,12 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
     if (sample_time < 0)
         sample_time = 0;
     seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
-    url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
+    avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
     av_update_cur_dts(s, st, sample_time);
     return 0;
 }
 
-AVInputFormat mxf_demuxer = {
+AVInputFormat ff_mxf_demuxer = {
     "mxf",
     NULL_IF_CONFIG_SMALL("Material eXchange Format"),
     sizeof(MXFContext),
diff --git a/ffmpeg-mt/libavformat/mxfenc.c b/ffmpeg-mt/libavformat/mxfenc.c
index c53849a..44052a0 100644
--- a/ffmpeg-mt/libavformat/mxfenc.c
+++ b/ffmpeg-mt/libavformat/mxfenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2008 GUCAS, Zhentan Feng <spyfeng at gmail dot com>
  * Copyright (c) 2008 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -44,7 +44,7 @@
 static const int NTSC_samples_per_frame[] = { 1602, 1601, 1602, 1601, 1602, 0 };
 static const int PAL_samples_per_frame[]  = { 1920, 0 };
 
-extern AVOutputFormat mxf_d10_muxer;
+extern AVOutputFormat ff_mxf_d10_muxer;
 
 #define EDIT_UNITS_PER_BODY 250
 #define KAG_SIZE 512
@@ -305,26 +305,26 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
     { 0x3D0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}}, /* Block Align */
 };
 
-static void mxf_write_uuid(ByteIOContext *pb, enum MXFMetadataSetType type, int value)
+static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value)
 {
-    put_buffer(pb, uuid_base, 12);
-    put_be16(pb, type);
-    put_be16(pb, value);
+    avio_write(pb, uuid_base, 12);
+    avio_wb16(pb, type);
+    avio_wb16(pb, value);
 }
 
 static void mxf_write_umid(AVFormatContext *s, int type)
 {
     MXFContext *mxf = s->priv_data;
-    put_buffer(s->pb, umid_ul, 13);
-    put_be24(s->pb, mxf->instance_number);
-    put_buffer(s->pb, mxf->umid, 15);
-    put_byte(s->pb, type);
+    avio_write(s->pb, umid_ul, 13);
+    avio_wb24(s->pb, mxf->instance_number);
+    avio_write(s->pb, mxf->umid, 15);
+    avio_w8(s->pb, type);
 }
 
-static void mxf_write_refs_count(ByteIOContext *pb, int ref_count)
+static void mxf_write_refs_count(AVIOContext *pb, int ref_count)
 {
-    put_be32(pb, ref_count);
-    put_be32(pb, 16);
+    avio_wb32(pb, ref_count);
+    avio_wb32(pb, 16);
 }
 
 static int klv_ber_length(uint64_t len)
@@ -335,31 +335,31 @@ static int klv_ber_length(uint64_t len)
         return (av_log2(len) >> 3) + 2;
 }
 
-static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len)
+static int klv_encode_ber_length(AVIOContext *pb, uint64_t len)
 {
     // Determine the best BER size
     int size;
     if (len < 128) {
         //short form
-        put_byte(pb, len);
+        avio_w8(pb, len);
         return 1;
     }
 
     size = (av_log2(len) >> 3) + 1;
 
     // long form
-    put_byte(pb, 0x80 + size);
+    avio_w8(pb, 0x80 + size);
     while(size) {
         size--;
-        put_byte(pb, len >> 8 * size & 0xff);
+        avio_w8(pb, len >> 8 * size & 0xff);
     }
     return 0;
 }
 
-static void klv_encode_ber4_length(ByteIOContext *pb, int len)
+static void klv_encode_ber4_length(AVIOContext *pb, int len)
 {
-    put_byte(pb, 0x80 + 3);
-    put_be24(pb, len);
+    avio_w8(pb, 0x80 + 3);
+    avio_wb24(pb, len);
 }
 
 /*
@@ -376,33 +376,33 @@ static int mxf_get_essence_container_ul_index(enum CodecID id)
 
 static void mxf_write_primer_pack(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int local_tag_number, i = 0;
 
     local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch);
 
-    put_buffer(pb, primer_pack_key, 16);
+    avio_write(pb, primer_pack_key, 16);
     klv_encode_ber_length(pb, local_tag_number * 18 + 8);
 
-    put_be32(pb, local_tag_number); // local_tag num
-    put_be32(pb, 18); // item size, always 18 according to the specs
+    avio_wb32(pb, local_tag_number); // local_tag num
+    avio_wb32(pb, 18); // item size, always 18 according to the specs
 
     for (i = 0; i < local_tag_number; i++) {
-        put_be16(pb, mxf_local_tag_batch[i].local_tag);
-        put_buffer(pb, mxf_local_tag_batch[i].uid, 16);
+        avio_wb16(pb, mxf_local_tag_batch[i].local_tag);
+        avio_write(pb, mxf_local_tag_batch[i].uid, 16);
     }
 }
 
-static void mxf_write_local_tag(ByteIOContext *pb, int size, int tag)
+static void mxf_write_local_tag(AVIOContext *pb, int size, int tag)
 {
-    put_be16(pb, tag);
-    put_be16(pb, size);
+    avio_wb16(pb, tag);
+    avio_wb16(pb, size);
 }
 
-static void mxf_write_metadata_key(ByteIOContext *pb, unsigned int value)
+static void mxf_write_metadata_key(AVIOContext *pb, unsigned int value)
 {
-    put_buffer(pb, header_metadata_key, 13);
-    put_be24(pb, value);
+    avio_write(pb, header_metadata_key, 13);
+    avio_wb24(pb, value);
 }
 
 static void mxf_free(AVFormatContext *s)
@@ -429,21 +429,21 @@ static const MXFCodecUL *mxf_get_data_definition_ul(int type)
 static void mxf_write_essence_container_refs(AVFormatContext *s)
 {
     MXFContext *c = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i;
 
     mxf_write_refs_count(pb, c->essence_container_count);
     av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", c->essence_container_count);
     for (i = 0; i < c->essence_container_count; i++) {
         MXFStreamContext *sc = s->streams[i]->priv_data;
-        put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
+        avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
     }
 }
 
 static void mxf_write_preface(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     mxf_write_metadata_key(pb, 0x012f00);
     PRINT_KEY(s, "preface key", pb->buf_ptr - 16);
@@ -456,11 +456,11 @@ static void mxf_write_preface(AVFormatContext *s)
 
     // last modified date
     mxf_write_local_tag(pb, 8, 0x3B02);
-    put_be64(pb, mxf->timestamp);
+    avio_wb64(pb, mxf->timestamp);
 
     // write version
     mxf_write_local_tag(pb, 2, 0x3B05);
-    put_be16(pb, 258); // v1.2
+    avio_wb16(pb, 258); // v1.2
 
     // write identification_refs
     mxf_write_local_tag(pb, 16 + 8, 0x3B06);
@@ -473,7 +473,7 @@ static void mxf_write_preface(AVFormatContext *s)
 
     // operational pattern
     mxf_write_local_tag(pb, 16, 0x3B09);
-    put_buffer(pb, op1a_ul, 16);
+    avio_write(pb, op1a_ul, 16);
 
     // write essence_container_refs
     mxf_write_local_tag(pb, 8 + 16 * mxf->essence_container_count, 0x3B0A);
@@ -481,24 +481,24 @@ static void mxf_write_preface(AVFormatContext *s)
 
     // write dm_scheme_refs
     mxf_write_local_tag(pb, 8, 0x3B0B);
-    put_be64(pb, 0);
+    avio_wb64(pb, 0);
 }
 
 /*
  * Write a local tag containing an ascii string as utf-16
  */
-static void mxf_write_local_tag_utf16(ByteIOContext *pb, int tag, const char *value)
+static void mxf_write_local_tag_utf16(AVIOContext *pb, int tag, const char *value)
 {
     int i, size = strlen(value);
     mxf_write_local_tag(pb, size*2, tag);
     for (i = 0; i < size; i++)
-        put_be16(pb, value[i]);
+        avio_wb16(pb, value[i]);
 }
 
 static void mxf_write_identification(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     const char *company = "FFmpeg";
     const char *product = "OP1a Muxer";
     const char *version;
@@ -531,12 +531,12 @@ static void mxf_write_identification(AVFormatContext *s)
 
     // modification date
     mxf_write_local_tag(pb, 8, 0x3C06);
-    put_be64(pb, mxf->timestamp);
+    avio_wb64(pb, mxf->timestamp);
 }
 
 static void mxf_write_content_storage(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     mxf_write_metadata_key(pb, 0x011800);
     PRINT_KEY(s, "content storage key", pb->buf_ptr - 16);
@@ -562,7 +562,7 @@ static void mxf_write_content_storage(AVFormatContext *s)
 static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     MXFStreamContext *sc = st->priv_data;
 
     mxf_write_metadata_key(pb, 0x013b00);
@@ -576,22 +576,22 @@ static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSe
 
     // write track id
     mxf_write_local_tag(pb, 4, 0x4801);
-    put_be32(pb, st->index+2);
+    avio_wb32(pb, st->index+2);
 
     // write track number
     mxf_write_local_tag(pb, 4, 0x4804);
     if (type == MaterialPackage)
-        put_be32(pb, 0); // track number of material package is 0
+        avio_wb32(pb, 0); // track number of material package is 0
     else
-        put_buffer(pb, sc->track_essence_element_key + 12, 4);
+        avio_write(pb, sc->track_essence_element_key + 12, 4);
 
     mxf_write_local_tag(pb, 8, 0x4B01);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
+    avio_wb32(pb, mxf->time_base.den);
+    avio_wb32(pb, mxf->time_base.num);
 
     // write origin
     mxf_write_local_tag(pb, 8, 0x4B02);
-    put_be64(pb, 0);
+    avio_wb64(pb, 0);
 
     // write sequence refs
     mxf_write_local_tag(pb, 16, 0x4803);
@@ -603,26 +603,26 @@ static const uint8_t smpte_12m_timecode_track_data_ul[] = { 0x06,0x0E,0x2B,0x34,
 static void mxf_write_common_fields(AVFormatContext *s, AVStream *st)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     // find data define uls
     mxf_write_local_tag(pb, 16, 0x0201);
     if (st == mxf->timecode_track)
-        put_buffer(pb, smpte_12m_timecode_track_data_ul, 16);
+        avio_write(pb, smpte_12m_timecode_track_data_ul, 16);
     else {
         const MXFCodecUL *data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type);
-        put_buffer(pb, data_def_ul->uid, 16);
+        avio_write(pb, data_def_ul->uid, 16);
     }
 
     // write duration
     mxf_write_local_tag(pb, 8, 0x0202);
-    put_be64(pb, mxf->duration);
+    avio_wb64(pb, mxf->duration);
 }
 
 static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     enum MXFMetadataSetType component;
 
     mxf_write_metadata_key(pb, 0x010f00);
@@ -650,7 +650,7 @@ static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadat
 static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     mxf_write_metadata_key(pb, 0x011400);
     klv_encode_ber_length(pb, 75);
@@ -664,20 +664,20 @@ static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum
 
     // Start Time Code
     mxf_write_local_tag(pb, 8, 0x1501);
-    put_be64(pb, mxf->timecode_start);
+    avio_wb64(pb, mxf->timecode_start);
 
     // Rounded Time Code Base
     mxf_write_local_tag(pb, 2, 0x1502);
-    put_be16(pb, mxf->timecode_base);
+    avio_wb16(pb, mxf->timecode_base);
 
     // Drop Frame
     mxf_write_local_tag(pb, 1, 0x1503);
-    put_byte(pb, mxf->timecode_drop_frame);
+    avio_w8(pb, mxf->timecode_drop_frame);
 }
 
 static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i;
 
     mxf_write_metadata_key(pb, 0x011100);
@@ -693,28 +693,28 @@ static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enu
 
     // write start_position
     mxf_write_local_tag(pb, 8, 0x1201);
-    put_be64(pb, 0);
+    avio_wb64(pb, 0);
 
     // write source package uid, end of the reference
     mxf_write_local_tag(pb, 32, 0x1101);
     if (type == SourcePackage) {
         for (i = 0; i < 4; i++)
-            put_be64(pb, 0);
+            avio_wb64(pb, 0);
     } else
         mxf_write_umid(s, 1);
 
     // write source track id
     mxf_write_local_tag(pb, 4, 0x1102);
     if (type == SourcePackage)
-        put_be32(pb, 0);
+        avio_wb32(pb, 0);
     else
-        put_be32(pb, st->index+2);
+        avio_wb32(pb, st->index+2);
 }
 
 static void mxf_write_multi_descriptor(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     const uint8_t *ul;
     int i;
 
@@ -728,8 +728,8 @@ static void mxf_write_multi_descriptor(AVFormatContext *s)
 
     // write sample rate
     mxf_write_local_tag(pb, 8, 0x3001);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
+    avio_wb32(pb, mxf->time_base.den);
+    avio_wb32(pb, mxf->time_base.num);
 
     // write essence container ul
     mxf_write_local_tag(pb, 16, 0x3004);
@@ -739,7 +739,7 @@ static void mxf_write_multi_descriptor(AVFormatContext *s)
         MXFStreamContext *sc = s->streams[0]->priv_data;
         ul = mxf_essence_container_uls[sc->index].container_ul;
     }
-    put_buffer(pb, ul, 16);
+    avio_write(pb, ul, 16);
 
     // write sub descriptor refs
     mxf_write_local_tag(pb, s->nb_streams * 16 + 8, 0x3F01);
@@ -752,23 +752,23 @@ static void mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID k
 {
     MXFContext *mxf = s->priv_data;
     MXFStreamContext *sc = st->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
-    put_buffer(pb, key, 16);
+    avio_write(pb, key, 16);
     klv_encode_ber4_length(pb, size+20+8+12+20);
 
     mxf_write_local_tag(pb, 16, 0x3C0A);
     mxf_write_uuid(pb, SubDescriptor, st->index);
 
     mxf_write_local_tag(pb, 4, 0x3006);
-    put_be32(pb, st->index+2);
+    avio_wb32(pb, st->index+2);
 
     mxf_write_local_tag(pb, 8, 0x3001);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
+    avio_wb32(pb, mxf->time_base.den);
+    avio_wb32(pb, mxf->time_base.num);
 
     mxf_write_local_tag(pb, 16, 0x3004);
-    put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
+    avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
 }
 
 static const UID mxf_mpegvideo_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 };
@@ -780,7 +780,7 @@ static const UID mxf_generic_sound_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0
 static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
 {
     MXFStreamContext *sc = st->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int stored_height = (st->codec->height+15)/16*16;
     int display_height;
     int f1, f2;
@@ -788,13 +788,13 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
     mxf_write_generic_desc(s, st, key, size+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20);
 
     mxf_write_local_tag(pb, 4, 0x3203);
-    put_be32(pb, st->codec->width);
+    avio_wb32(pb, st->codec->width);
 
     mxf_write_local_tag(pb, 4, 0x3202);
-    put_be32(pb, stored_height>>sc->interlaced);
+    avio_wb32(pb, stored_height>>sc->interlaced);
 
     mxf_write_local_tag(pb, 4, 0x3209);
-    put_be32(pb, st->codec->width);
+    avio_wb32(pb, st->codec->width);
 
     if (st->codec->height == 608) // PAL + VBI
         display_height = 576;
@@ -804,19 +804,19 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
         display_height = st->codec->height;
 
     mxf_write_local_tag(pb, 4, 0x3208);
-    put_be32(pb, display_height>>sc->interlaced);
+    avio_wb32(pb, display_height>>sc->interlaced);
 
     // component depth
     mxf_write_local_tag(pb, 4, 0x3301);
-    put_be32(pb, 8);
+    avio_wb32(pb, 8);
 
     // horizontal subsampling
     mxf_write_local_tag(pb, 4, 0x3302);
-    put_be32(pb, 2);
+    avio_wb32(pb, 2);
 
     // frame layout
     mxf_write_local_tag(pb, 1, 0x320C);
-    put_byte(pb, sc->interlaced);
+    avio_w8(pb, sc->interlaced);
 
     // video line map
     switch (st->codec->height) {
@@ -835,18 +835,18 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
     }
 
     mxf_write_local_tag(pb, 12+sc->interlaced*4, 0x320D);
-    put_be32(pb, sc->interlaced ? 2 : 1);
-    put_be32(pb, 4);
-    put_be32(pb, f1);
+    avio_wb32(pb, sc->interlaced ? 2 : 1);
+    avio_wb32(pb, 4);
+    avio_wb32(pb, f1);
     if (sc->interlaced)
-        put_be32(pb, f2);
+        avio_wb32(pb, f2);
 
     mxf_write_local_tag(pb, 8, 0x320E);
-    put_be32(pb, sc->aspect_ratio.num);
-    put_be32(pb, sc->aspect_ratio.den);
+    avio_wb32(pb, sc->aspect_ratio.num);
+    avio_wb32(pb, sc->aspect_ratio.den);
 
     mxf_write_local_tag(pb, 16, 0x3201);
-    put_buffer(pb, *sc->codec_ul, 16);
+    avio_write(pb, *sc->codec_ul, 16);
 }
 
 static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
@@ -856,56 +856,56 @@ static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
 
 static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int profile_and_level = (st->codec->profile<<4) | st->codec->level;
 
     mxf_write_cdci_common(s, st, mxf_mpegvideo_descriptor_key, 8+5);
 
     // bit rate
     mxf_write_local_tag(pb, 4, 0x8000);
-    put_be32(pb, st->codec->bit_rate);
+    avio_wb32(pb, st->codec->bit_rate);
 
     // profile and level
     mxf_write_local_tag(pb, 1, 0x8007);
     if (!st->codec->profile)
         profile_and_level |= 0x80; // escape bit
-    put_byte(pb, profile_and_level);
+    avio_w8(pb, profile_and_level);
 }
 
 static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     mxf_write_generic_desc(s, st, key, size+5+12+8+8);
 
     // audio locked
     mxf_write_local_tag(pb, 1, 0x3D02);
-    put_byte(pb, 1);
+    avio_w8(pb, 1);
 
     // write audio sampling rate
     mxf_write_local_tag(pb, 8, 0x3D03);
-    put_be32(pb, st->codec->sample_rate);
-    put_be32(pb, 1);
+    avio_wb32(pb, st->codec->sample_rate);
+    avio_wb32(pb, 1);
 
     mxf_write_local_tag(pb, 4, 0x3D07);
-    put_be32(pb, st->codec->channels);
+    avio_wb32(pb, st->codec->channels);
 
     mxf_write_local_tag(pb, 4, 0x3D01);
-    put_be32(pb, av_get_bits_per_sample(st->codec->codec_id));
+    avio_wb32(pb, av_get_bits_per_sample(st->codec->codec_id));
 }
 
 static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     mxf_write_generic_sound_common(s, st, key, size+6+8);
 
     mxf_write_local_tag(pb, 2, 0x3D0A);
-    put_be16(pb, st->codec->block_align);
+    avio_wb16(pb, st->codec->block_align);
 
     // avg bytes per sec
     mxf_write_local_tag(pb, 4, 0x3D09);
-    put_be32(pb, st->codec->block_align*st->codec->sample_rate);
+    avio_wb32(pb, st->codec->block_align*st->codec->sample_rate);
 }
 
 static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st)
@@ -926,7 +926,7 @@ static void mxf_write_generic_sound_desc(AVFormatContext *s, AVStream *st)
 static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i, track_count = s->nb_streams+1;
 
     if (type == MaterialPackage) {
@@ -952,11 +952,11 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type)
 
     // package creation date
     mxf_write_local_tag(pb, 8, 0x4405);
-    put_be64(pb, mxf->timestamp);
+    avio_wb64(pb, mxf->timestamp);
 
     // package modified date
     mxf_write_local_tag(pb, 8, 0x4404);
-    put_be64(pb, mxf->timestamp);
+    avio_wb64(pb, mxf->timestamp);
 
     // write track refs
     mxf_write_local_tag(pb, track_count*16 + 8, 0x4403);
@@ -996,7 +996,7 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type)
 
 static int mxf_write_essence_container_data(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     mxf_write_metadata_key(pb, 0x012300);
     klv_encode_ber_length(pb, 72);
@@ -1008,10 +1008,10 @@ static int mxf_write_essence_container_data(AVFormatContext *s)
     mxf_write_umid(s, 1);
 
     mxf_write_local_tag(pb, 4, 0x3F07); // BodySID
-    put_be32(pb, 1);
+    avio_wb32(pb, 1);
 
     mxf_write_local_tag(pb, 4, 0x3F06); // IndexSID
-    put_be32(pb, 2);
+    avio_wb32(pb, 2);
 
     return 0;
 }
@@ -1039,7 +1039,7 @@ static unsigned klv_fill_size(uint64_t size)
 static void mxf_write_index_table_segment(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i, j, temporal_reordering = 0;
     int key_index = mxf->last_key_index;
 
@@ -1048,7 +1048,7 @@ static void mxf_write_index_table_segment(AVFormatContext *s)
     if (!mxf->edit_units_count && !mxf->edit_unit_byte_count)
         return;
 
-    put_buffer(pb, index_table_segment_key, 16);
+    avio_write(pb, index_table_segment_key, 16);
 
     if (mxf->edit_unit_byte_count) {
         klv_encode_ber_length(pb, 80);
@@ -1063,65 +1063,65 @@ static void mxf_write_index_table_segment(AVFormatContext *s)
 
     // index edit rate
     mxf_write_local_tag(pb, 8, 0x3F0B);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
+    avio_wb32(pb, mxf->time_base.den);
+    avio_wb32(pb, mxf->time_base.num);
 
     // index start position
     mxf_write_local_tag(pb, 8, 0x3F0C);
-    put_be64(pb, mxf->last_indexed_edit_unit);
+    avio_wb64(pb, mxf->last_indexed_edit_unit);
 
     // index duration
     mxf_write_local_tag(pb, 8, 0x3F0D);
     if (mxf->edit_unit_byte_count)
-        put_be64(pb, 0); // index table covers whole container
+        avio_wb64(pb, 0); // index table covers whole container
     else
-        put_be64(pb, mxf->edit_units_count);
+        avio_wb64(pb, mxf->edit_units_count);
 
     // edit unit byte count
     mxf_write_local_tag(pb, 4, 0x3F05);
-    put_be32(pb, mxf->edit_unit_byte_count);
+    avio_wb32(pb, mxf->edit_unit_byte_count);
 
     // index sid
     mxf_write_local_tag(pb, 4, 0x3F06);
-    put_be32(pb, 2);
+    avio_wb32(pb, 2);
 
     // body sid
     mxf_write_local_tag(pb, 4, 0x3F07);
-    put_be32(pb, 1);
+    avio_wb32(pb, 1);
 
     if (!mxf->edit_unit_byte_count) {
         // real slice count - 1
         mxf_write_local_tag(pb, 1, 0x3F08);
-        put_byte(pb, mxf->slice_count);
+        avio_w8(pb, mxf->slice_count);
 
         // delta entry array
         mxf_write_local_tag(pb, 8 + (s->nb_streams+1)*6, 0x3F09);
-        put_be32(pb, s->nb_streams+1); // num of entries
-        put_be32(pb, 6);               // size of one entry
+        avio_wb32(pb, s->nb_streams+1); // num of entries
+        avio_wb32(pb, 6);               // size of one entry
         // write system item delta entry
-        put_byte(pb, 0);
-        put_byte(pb, 0); // slice entry
-        put_be32(pb, 0); // element delta
+        avio_w8(pb, 0);
+        avio_w8(pb, 0); // slice entry
+        avio_wb32(pb, 0); // element delta
         for (i = 0; i < s->nb_streams; i++) {
             AVStream *st = s->streams[i];
             MXFStreamContext *sc = st->priv_data;
-            put_byte(pb, sc->temporal_reordering);
+            avio_w8(pb, sc->temporal_reordering);
             if (sc->temporal_reordering)
                 temporal_reordering = 1;
             if (i == 0) { // video track
-                put_byte(pb, 0); // slice number
-                put_be32(pb, KAG_SIZE); // system item size including klv fill
+                avio_w8(pb, 0); // slice number
+                avio_wb32(pb, KAG_SIZE); // system item size including klv fill
             } else { // audio track
                 unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size;
                 audio_frame_size += klv_fill_size(audio_frame_size);
-                put_byte(pb, 1);
-                put_be32(pb, (i-1)*audio_frame_size); // element delta
+                avio_w8(pb, 1);
+                avio_wb32(pb, (i-1)*audio_frame_size); // element delta
             }
         }
 
         mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A);
-        put_be32(pb, mxf->edit_units_count);  // num of entries
-        put_be32(pb, 11+mxf->slice_count*4);  // size of one entry
+        avio_wb32(pb, mxf->edit_units_count);  // num of entries
+        avio_wb32(pb, 11+mxf->slice_count*4);  // size of one entry
 
         for (i = 0; i < mxf->edit_units_count; i++) {
             int temporal_offset = 0;
@@ -1143,12 +1143,12 @@ static void mxf_write_index_table_segment(AVFormatContext *s)
                     temporal_offset = j - key_index - pic_num_in_gop;
                 }
             }
-            put_byte(pb, temporal_offset);
+            avio_w8(pb, temporal_offset);
 
             if ((mxf->index_entries[i].flags & 0x30) == 0x30) { // back and forward prediction
-                put_byte(pb, mxf->last_key_index - i);
+                avio_w8(pb, mxf->last_key_index - i);
             } else {
-                put_byte(pb, key_index - i); // key frame offset
+                avio_w8(pb, key_index - i); // key frame offset
                 if ((mxf->index_entries[i].flags & 0x20) == 0x20) // only forward
                     mxf->last_key_index = key_index;
             }
@@ -1156,11 +1156,11 @@ static void mxf_write_index_table_segment(AVFormatContext *s)
             if (!(mxf->index_entries[i].flags & 0x33) && // I frame
                 mxf->index_entries[i].flags & 0x40 && !temporal_offset)
                 mxf->index_entries[i].flags |= 0x80; // random access
-            put_byte(pb, mxf->index_entries[i].flags);
+            avio_w8(pb, mxf->index_entries[i].flags);
             // stream offset
-            put_be64(pb, mxf->index_entries[i].offset);
+            avio_wb64(pb, mxf->index_entries[i].offset);
             if (s->nb_streams > 1)
-                put_be32(pb, mxf->index_entries[i].slice_offset);
+                avio_wb32(pb, mxf->index_entries[i].slice_offset);
         }
 
         mxf->last_key_index = key_index - mxf->edit_units_count;
@@ -1171,14 +1171,14 @@ static void mxf_write_index_table_segment(AVFormatContext *s)
 
 static void mxf_write_klv_fill(AVFormatContext *s)
 {
-    unsigned pad = klv_fill_size(url_ftell(s->pb));
+    unsigned pad = klv_fill_size(avio_tell(s->pb));
     if (pad) {
-        put_buffer(s->pb, klv_fill_key, 16);
+        avio_write(s->pb, klv_fill_key, 16);
         pad -= 16 + 4;
         klv_encode_ber4_length(s->pb, pad);
         for (; pad; pad--)
-            put_byte(s->pb, 0);
-        assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
+            avio_w8(s->pb, 0);
+        assert(!(avio_tell(s->pb) & (KAG_SIZE-1)));
     }
 }
 
@@ -1187,10 +1187,10 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
                                 const uint8_t *key, int write_metadata)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t header_byte_count_offset;
     unsigned index_byte_count = 0;
-    uint64_t partition_offset = url_ftell(pb);
+    uint64_t partition_offset = avio_tell(pb);
 
     if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
         index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
@@ -1213,43 +1213,43 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
     }
 
     // write klv
-    put_buffer(pb, key, 16);
+    avio_write(pb, key, 16);
     klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count);
 
     // write partition value
-    put_be16(pb, 1); // majorVersion
-    put_be16(pb, 2); // minorVersion
-    put_be32(pb, KAG_SIZE); // KAGSize
+    avio_wb16(pb, 1); // majorVersion
+    avio_wb16(pb, 2); // minorVersion
+    avio_wb32(pb, KAG_SIZE); // KAGSize
 
-    put_be64(pb, partition_offset); // ThisPartition
+    avio_wb64(pb, partition_offset); // ThisPartition
 
     if (!memcmp(key, body_partition_key, 16) && mxf->body_partitions_count > 1)
-        put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition
+        avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition
     else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count)
-        put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition
+        avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition
     else
-        put_be64(pb, 0);
+        avio_wb64(pb, 0);
 
-    put_be64(pb, mxf->footer_partition_offset); // footerPartition
+    avio_wb64(pb, mxf->footer_partition_offset); // footerPartition
 
     // set offset
-    header_byte_count_offset = url_ftell(pb);
-    put_be64(pb, 0); // headerByteCount, update later
+    header_byte_count_offset = avio_tell(pb);
+    avio_wb64(pb, 0); // headerByteCount, update later
 
     // indexTable
-    put_be64(pb, index_byte_count); // indexByteCount
-    put_be32(pb, index_byte_count ? indexsid : 0); // indexSID
+    avio_wb64(pb, index_byte_count); // indexByteCount
+    avio_wb32(pb, index_byte_count ? indexsid : 0); // indexSID
 
     // BodyOffset
     if (bodysid && mxf->edit_units_count && mxf->body_partitions_count) {
-        put_be64(pb, mxf->body_offset);
+        avio_wb64(pb, mxf->body_offset);
     } else
-        put_be64(pb, 0);
+        avio_wb64(pb, 0);
 
-    put_be32(pb, bodysid); // bodySID
+    avio_wb32(pb, bodysid); // bodySID
 
     // operational pattern
-    put_buffer(pb, op1a_ul, 16);
+    avio_write(pb, op1a_ul, 16);
 
     // essence container
     mxf_write_essence_container_refs(s);
@@ -1260,19 +1260,19 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
         unsigned header_byte_count;
 
         mxf_write_klv_fill(s);
-        start = url_ftell(s->pb);
+        start = avio_tell(s->pb);
         mxf_write_primer_pack(s);
         mxf_write_header_metadata_sets(s);
-        pos = url_ftell(s->pb);
+        pos = avio_tell(s->pb);
         header_byte_count = pos - start + klv_fill_size(pos);
 
         // update header_byte_count
-        url_fseek(pb, header_byte_count_offset, SEEK_SET);
-        put_be64(pb, header_byte_count);
-        url_fseek(pb, pos, SEEK_SET);
+        avio_seek(pb, header_byte_count_offset, SEEK_SET);
+        avio_wb64(pb, header_byte_count);
+        avio_seek(pb, pos, SEEK_SET);
     }
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 }
 
 static const UID mxf_mpeg2_codec_uls[] = {
@@ -1371,7 +1371,7 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st,
             }
         }
     }
-    if (s->oformat != &mxf_d10_muxer)
+    if (s->oformat != &ff_mxf_d10_muxer)
         sc->codec_ul = mxf_get_mpeg2_codec_ul(st->codec);
     return !!sc->codec_ul;
 }
@@ -1436,7 +1436,7 @@ static int mxf_write_header(AVFormatContext *s)
                 return -1;
             }
             av_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den);
-            if (s->oformat == &mxf_d10_muxer) {
+            if (s->oformat == &ff_mxf_d10_muxer) {
                 if (st->codec->bit_rate == 50000000)
                     if (mxf->time_base.den == 25) sc->index = 3;
                     else                          sc->index = 5;
@@ -1464,7 +1464,7 @@ static int mxf_write_header(AVFormatContext *s)
                 return -1;
             }
             av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-            if (s->oformat == &mxf_d10_muxer) {
+            if (s->oformat == &ff_mxf_d10_muxer) {
                 if (st->index != 1) {
                     av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n");
                     return -1;
@@ -1498,7 +1498,7 @@ static int mxf_write_header(AVFormatContext *s)
         present[sc->index]++;
     }
 
-    if (s->oformat == &mxf_d10_muxer) {
+    if (s->oformat == &ff_mxf_d10_muxer) {
         mxf->essence_container_count = 1;
     }
 
@@ -1557,48 +1557,48 @@ static uint32_t ff_framenum_to_12m_time_code(unsigned frame, int drop, int fps)
 static void mxf_write_system_item(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned frame;
     uint32_t time_code;
 
     frame = mxf->timecode_start + mxf->last_indexed_edit_unit + mxf->edit_units_count;
 
     // write system metadata pack
-    put_buffer(pb, system_metadata_pack_key, 16);
+    avio_write(pb, system_metadata_pack_key, 16);
     klv_encode_ber4_length(pb, 57);
-    put_byte(pb, 0x5c); // UL, user date/time stamp, picture and sound item present
-    put_byte(pb, 0x04); // content package rate
-    put_byte(pb, 0x00); // content package type
-    put_be16(pb, 0x00); // channel handle
-    put_be16(pb, frame); // continuity count
+    avio_w8(pb, 0x5c); // UL, user date/time stamp, picture and sound item present
+    avio_w8(pb, 0x04); // content package rate
+    avio_w8(pb, 0x00); // content package type
+    avio_wb16(pb, 0x00); // channel handle
+    avio_wb16(pb, frame); // continuity count
     if (mxf->essence_container_count > 1)
-        put_buffer(pb, multiple_desc_ul, 16);
+        avio_write(pb, multiple_desc_ul, 16);
     else {
         MXFStreamContext *sc = s->streams[0]->priv_data;
-        put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
+        avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
     }
-    put_byte(pb, 0);
-    put_be64(pb, 0);
-    put_be64(pb, 0); // creation date/time stamp
+    avio_w8(pb, 0);
+    avio_wb64(pb, 0);
+    avio_wb64(pb, 0); // creation date/time stamp
 
-    put_byte(pb, 0x81); // SMPTE 12M time code
+    avio_w8(pb, 0x81); // SMPTE 12M time code
     time_code = ff_framenum_to_12m_time_code(frame, mxf->timecode_drop_frame, mxf->timecode_base);
-    put_be32(pb, time_code);
-    put_be32(pb, 0); // binary group data
-    put_be64(pb, 0);
+    avio_wb32(pb, time_code);
+    avio_wb32(pb, 0); // binary group data
+    avio_wb64(pb, 0);
 
     // write system metadata package set
-    put_buffer(pb, system_metadata_package_set_key, 16);
+    avio_write(pb, system_metadata_package_set_key, 16);
     klv_encode_ber4_length(pb, 35);
-    put_byte(pb, 0x83); // UMID
-    put_be16(pb, 0x20);
+    avio_w8(pb, 0x83); // UMID
+    avio_wb16(pb, 0x20);
     mxf_write_umid(s, 1);
 }
 
 static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int packet_size = (uint64_t)st->codec->bit_rate*mxf->time_base.num /
         (8*mxf->time_base.den); // frame size
     int pad;
@@ -1607,28 +1607,28 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke
     packet_size += klv_fill_size(packet_size);
 
     klv_encode_ber4_length(pb, pkt->size);
-    put_buffer(pb, pkt->data, pkt->size);
+    avio_write(pb, pkt->data, pkt->size);
 
     // ensure CBR muxing by padding to correct video frame size
     pad = packet_size - pkt->size - 16 - 4;
     if (pad > 20) {
-        put_buffer(s->pb, klv_fill_key, 16);
+        avio_write(s->pb, klv_fill_key, 16);
         pad -= 16 + 4;
         klv_encode_ber4_length(s->pb, pad);
         for (; pad; pad--)
-            put_byte(s->pb, 0);
-        assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
+            avio_w8(s->pb, 0);
+        assert(!(avio_tell(s->pb) & (KAG_SIZE-1)));
     } else {
         av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n");
         for (; pad > 0; pad--)
-            put_byte(s->pb, 0);
+            avio_w8(s->pb, 0);
     }
 }
 
 static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int frame_size = pkt->size / st->codec->block_align;
     uint8_t *samples = pkt->data;
     uint8_t *end = pkt->data + pkt->size;
@@ -1636,9 +1636,9 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke
 
     klv_encode_ber4_length(pb, 4 + frame_size*4*8);
 
-    put_byte(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1));
-    put_le16(pb, frame_size);
-    put_byte(pb, (1<<st->codec->channels)-1);
+    avio_w8(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1));
+    avio_wl16(pb, frame_size);
+    avio_w8(pb, (1<<st->codec->channels)-1);
 
     while (samples < end) {
         for (i = 0; i < st->codec->channels; i++) {
@@ -1650,17 +1650,17 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke
                 sample = AV_RL16(samples)<<12;
                 samples += 2;
             }
-            put_le32(pb, sample | i);
+            avio_wl32(pb, sample | i);
         }
         for (; i < 8; i++)
-            put_le32(pb, i);
+            avio_wl32(pb, i);
     }
 }
 
 static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st = s->streams[pkt->stream_index];
     MXFStreamContext *sc = st->priv_data;
     MXFIndexEntry ie = {0};
@@ -1719,19 +1719,19 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     mxf_write_klv_fill(s);
-    put_buffer(pb, sc->track_essence_element_key, 16); // write key
-    if (s->oformat == &mxf_d10_muxer) {
+    avio_write(pb, sc->track_essence_element_key, 16); // write key
+    if (s->oformat == &ff_mxf_d10_muxer) {
         if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
             mxf_write_d10_video_packet(s, st, pkt);
         else
             mxf_write_d10_audio_packet(s, st, pkt);
     } else {
         klv_encode_ber4_length(pb, pkt->size); // write length
-        put_buffer(pb, pkt->data, pkt->size);
+        avio_write(pb, pkt->data, pkt->size);
         mxf->body_offset += 16+4+pkt->size + klv_fill_size(16+4+pkt->size);
     }
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
@@ -1739,39 +1739,39 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
 static void mxf_write_random_index_pack(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint64_t pos = url_ftell(pb);
+    AVIOContext *pb = s->pb;
+    uint64_t pos = avio_tell(pb);
     int i;
 
-    put_buffer(pb, random_index_pack_key, 16);
+    avio_write(pb, random_index_pack_key, 16);
     klv_encode_ber_length(pb, 28 + 12*mxf->body_partitions_count);
 
     if (mxf->edit_unit_byte_count)
-        put_be32(pb, 1); // BodySID of header partition
+        avio_wb32(pb, 1); // BodySID of header partition
     else
-        put_be32(pb, 0);
-    put_be64(pb, 0); // offset of header partition
+        avio_wb32(pb, 0);
+    avio_wb64(pb, 0); // offset of header partition
 
     for (i = 0; i < mxf->body_partitions_count; i++) {
-        put_be32(pb, 1); // BodySID
-        put_be64(pb, mxf->body_partition_offset[i]);
+        avio_wb32(pb, 1); // BodySID
+        avio_wb64(pb, mxf->body_partition_offset[i]);
     }
 
-    put_be32(pb, 0); // BodySID of footer partition
-    put_be64(pb, mxf->footer_partition_offset);
+    avio_wb32(pb, 0); // BodySID of footer partition
+    avio_wb64(pb, mxf->footer_partition_offset);
 
-    put_be32(pb, url_ftell(pb) - pos + 4);
+    avio_wb32(pb, avio_tell(pb) - pos + 4);
 }
 
 static int mxf_write_footer(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;
 
     mxf_write_klv_fill(s);
-    mxf->footer_partition_offset = url_ftell(pb);
+    mxf->footer_partition_offset = avio_tell(pb);
     if (mxf->edit_unit_byte_count) { // no need to repeat index
         mxf_write_partition(s, 0, 0, footer_partition_key, 0);
     } else {
@@ -1784,8 +1784,8 @@ static int mxf_write_footer(AVFormatContext *s)
     mxf_write_klv_fill(s);
     mxf_write_random_index_pack(s);
 
-    if (!url_is_streamed(s->pb)) {
-        url_fseek(pb, 0, SEEK_SET);
+    if (s->pb->seekable) {
+        avio_seek(pb, 0, SEEK_SET);
         if (mxf->edit_unit_byte_count) {
             mxf_write_partition(s, 1, 2, header_closed_partition_key, 1);
             mxf_write_klv_fill(s);
@@ -1795,7 +1795,7 @@ static int mxf_write_footer(AVFormatContext *s)
         }
     }
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     ff_audio_interleave_close(s);
 
@@ -1879,7 +1879,7 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int
                                mxf_interleave_get_packet, mxf_compare_timestamps);
 }
 
-AVOutputFormat mxf_muxer = {
+AVOutputFormat ff_mxf_muxer = {
     "mxf",
     NULL_IF_CONFIG_SMALL("Material eXchange Format"),
     "application/mxf",
@@ -1895,7 +1895,7 @@ AVOutputFormat mxf_muxer = {
     mxf_interleave,
 };
 
-AVOutputFormat mxf_d10_muxer = {
+AVOutputFormat ff_mxf_d10_muxer = {
     "mxf_d10",
     NULL_IF_CONFIG_SMALL("Material eXchange Format, D-10 Mapping"),
     "application/mxf",
diff --git a/ffmpeg-mt/libavformat/mxg.c b/ffmpeg-mt/libavformat/mxg.c
index e7791e8..5caa68a 100644
--- a/ffmpeg-mt/libavformat/mxg.c
+++ b/ffmpeg-mt/libavformat/mxg.c
@@ -2,20 +2,20 @@
  * MxPEG clip file demuxer
  * Copyright (c) 2010 Anatoly Nenashev
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -115,7 +115,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size)
     if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos;
 
     /* get data */
-    ret = get_buffer(s->pb, mxg->buffer_ptr + mxg->cache_size,
+    ret = avio_read(s->pb, mxg->buffer_ptr + mxg->cache_size,
                      cache_size - mxg->cache_size);
     if (ret < 0)
         return ret;
@@ -132,7 +132,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
     uint8_t *startmarker_ptr, *end, *search_end, marker;
     MXGContext *mxg = s->priv_data;
 
-    while (!url_feof(s->pb) && !url_ferror(s->pb)){
+    while (!s->pb->eof_reached && !s->pb->error){
         if (mxg->cache_size <= OVERREAD_SIZE) {
             /* update internal buffer */
             ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE);
@@ -240,7 +240,7 @@ static int mxg_close(struct AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat mxg_demuxer = {
+AVInputFormat ff_mxg_demuxer = {
     .name = "mxg",
     .long_name = NULL_IF_CONFIG_SMALL("MxPEG clip file format"),
     .priv_data_size = sizeof(MXGContext),
diff --git a/ffmpeg-mt/libavformat/ncdec.c b/ffmpeg-mt/libavformat/ncdec.c
index 6d99a04..7e43adc 100644
--- a/ffmpeg-mt/libavformat/ncdec.c
+++ b/ffmpeg-mt/libavformat/ncdec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2009  Nicolas Martin (martinic at iro dot umontreal dot ca)
  *                     Edouard Auvinet
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -66,14 +66,14 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     uint32_t state=-1;
     while (state != NC_VIDEO_FLAG) {
-        if (url_feof(s->pb))
+        if (s->pb->eof_reached)
             return AVERROR(EIO);
-        state = (state<<8) + get_byte(s->pb);
+        state = (state<<8) + avio_r8(s->pb);
     }
 
-    get_byte(s->pb);
-    size = get_le16(s->pb);
-    url_fskip(s->pb, 9);
+    avio_r8(s->pb);
+    size = avio_rl16(s->pb);
+    avio_skip(s->pb, 9);
 
     if (size == 0) {
         av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n");
@@ -90,7 +90,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
     return size;
 }
 
-AVInputFormat nc_demuxer = {
+AVInputFormat ff_nc_demuxer = {
     "nc",
     NULL_IF_CONFIG_SMALL("NC camera feed format"),
     0,
diff --git a/ffmpeg-mt/libavformat/network.h b/ffmpeg-mt/libavformat/network.h
index d6aee93..84a8f53 100644
--- a/ffmpeg-mt/libavformat/network.h
+++ b/ffmpeg-mt/libavformat/network.h
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2007 The FFmpeg Project
+ * Copyright (c) 2007 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -22,14 +22,27 @@
 #define AVFORMAT_NETWORK_H
 
 #include "config.h"
+#include "os_support.h"
 
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
 #include <ws2tcpip.h>
 
-#define ff_neterrno() (-WSAGetLastError())
-#define FF_NETERROR(err) (-WSA##err)
-#define WSAEAGAIN WSAEWOULDBLOCK
+#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
+#define ETIMEDOUT       WSAETIMEDOUT
+#define ECONNREFUSED    WSAECONNREFUSED
+#define EINPROGRESS     WSAEINPROGRESS
+
+static inline int ff_neterrno() {
+    int err = WSAGetLastError();
+    switch (err) {
+    case WSAEWOULDBLOCK:
+        return AVERROR(EAGAIN);
+    case WSAEINTR:
+        return AVERROR(EINTR);
+    }
+    return -err;
+}
 #else
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -37,13 +50,16 @@
 #include <netdb.h>
 
 #define ff_neterrno() AVERROR(errno)
-#define FF_NETERROR(err) AVERROR(err)
 #endif
 
 #if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
 
+#if HAVE_POLL_H
+#include <poll.h>
+#endif
+
 int ff_socket_nonblock(int socket, int enable);
 
 static inline int ff_network_init(void)
@@ -56,6 +72,15 @@ static inline int ff_network_init(void)
     return 1;
 }
 
+static inline int ff_network_wait_fd(int fd, int write)
+{
+    int ev = write ? POLLOUT : POLLIN;
+    struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };
+    int ret;
+    ret = poll(&p, 1, 100);
+    return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN);
+}
+
 static inline void ff_network_close(void)
 {
 #if HAVE_WINSOCK2_H
diff --git a/ffmpeg-mt/libavformat/nsvdec.c b/ffmpeg-mt/libavformat/nsvdec.c
index 44e5097..b70d3b9 100644
--- a/ffmpeg-mt/libavformat/nsvdec.c
+++ b/ffmpeg-mt/libavformat/nsvdec.c
@@ -1,21 +1,21 @@
 /*
  * NSV demuxer
- * Copyright (c) 2004 The FFmpeg Project
+ * Copyright (c) 2004 The Libav Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
@@ -81,12 +81,6 @@
  * - seek
  */
 
-#ifdef DEBUG
-#define PRINT(_v) printf _v
-#else
-#define PRINT(_v)
-#endif
-
 #if 0
 struct NSVf_header {
     uint32_t chunk_tag; /* 'NSVf' */
@@ -216,102 +210,96 @@ static const AVCodecTag nsv_codec_audio_tags[] = {
 //static int nsv_load_index(AVFormatContext *s);
 static int nsv_read_chunk(AVFormatContext *s, int fill_header);
 
-#ifdef DEBUG
-static void print_tag(const char *str, unsigned int tag, int size)
-{
-    printf("%s: tag=%c%c%c%c\n",
-           str, tag & 0xff,
-           (tag >> 8) & 0xff,
-           (tag >> 16) & 0xff,
-           (tag >> 24) & 0xff);
-}
-#endif
+#define print_tag(str, tag, size)       \
+    av_dlog(NULL, "%s: tag=%c%c%c%c\n", \
+            str, tag & 0xff,            \
+            (tag >> 8) & 0xff,          \
+            (tag >> 16) & 0xff,         \
+            (tag >> 24) & 0xff);
 
 /* try to find something we recognize, and set the state accordingly */
 static int nsv_resync(AVFormatContext *s)
 {
     NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint32_t v = 0;
     int i;
 
-    PRINT(("%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state));
+    av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, avio_tell(pb), nsv->state);
 
     //nsv->state = NSV_UNSYNC;
 
     for (i = 0; i < NSV_MAX_RESYNC; i++) {
-        if (url_feof(pb)) {
-            PRINT(("NSV EOF\n"));
+        if (pb->eof_reached) {
+            av_dlog(s, "NSV EOF\n");
             nsv->state = NSV_UNSYNC;
             return -1;
         }
         v <<= 8;
-        v |= get_byte(pb);
-/*
+        v |= avio_r8(pb);
         if (i < 8) {
-            PRINT(("NSV resync: [%d] = %02x\n", i, v & 0x0FF));
+            av_dlog(s, "NSV resync: [%d] = %02x\n", i, v & 0x0FF);
         }
-*/
 
         if ((v & 0x0000ffff) == 0xefbe) { /* BEEF */
-            PRINT(("NSV resynced on BEEF after %d bytes\n", i+1));
+            av_dlog(s, "NSV resynced on BEEF after %d bytes\n", i+1);
             nsv->state = NSV_FOUND_BEEF;
             return 0;
         }
         /* we read as big endian, thus the MK*BE* */
         if (v == TB_NSVF) { /* NSVf */
-            PRINT(("NSV resynced on NSVf after %d bytes\n", i+1));
+            av_dlog(s, "NSV resynced on NSVf after %d bytes\n", i+1);
             nsv->state = NSV_FOUND_NSVF;
             return 0;
         }
         if (v == MKBETAG('N', 'S', 'V', 's')) { /* NSVs */
-            PRINT(("NSV resynced on NSVs after %d bytes\n", i+1));
+            av_dlog(s, "NSV resynced on NSVs after %d bytes\n", i+1);
             nsv->state = NSV_FOUND_NSVS;
             return 0;
         }
 
     }
-    PRINT(("NSV sync lost\n"));
+    av_dlog(s, "NSV sync lost\n");
     return -1;
 }
 
 static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int file_size, size;
     int64_t duration;
     int strings_size;
     int table_entries;
     int table_entries_used;
 
-    PRINT(("%s()\n", __FUNCTION__));
+    av_dlog(s, "%s()\n", __FUNCTION__);
 
     nsv->state = NSV_UNSYNC; /* in case we fail */
 
-    size = get_le32(pb);
+    size = avio_rl32(pb);
     if (size < 28)
         return -1;
     nsv->NSVf_end = size;
 
-    //s->file_size = (uint32_t)get_le32(pb);
-    file_size = (uint32_t)get_le32(pb);
-    PRINT(("NSV NSVf chunk_size %u\n", size));
-    PRINT(("NSV NSVf file_size %u\n", file_size));
+    //s->file_size = (uint32_t)avio_rl32(pb);
+    file_size = (uint32_t)avio_rl32(pb);
+    av_dlog(s, "NSV NSVf chunk_size %u\n", size);
+    av_dlog(s, "NSV NSVf file_size %u\n", file_size);
 
-    nsv->duration = duration = get_le32(pb); /* in ms */
-    PRINT(("NSV NSVf duration %"PRId64" ms\n", duration));
+    nsv->duration = duration = avio_rl32(pb); /* in ms */
+    av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration);
     // XXX: store it in AVStreams
 
-    strings_size = get_le32(pb);
-    table_entries = get_le32(pb);
-    table_entries_used = get_le32(pb);
-    PRINT(("NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
-            strings_size, table_entries, table_entries_used));
-    if (url_feof(pb))
+    strings_size = avio_rl32(pb);
+    table_entries = avio_rl32(pb);
+    table_entries_used = avio_rl32(pb);
+    av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
+            strings_size, table_entries, table_entries_used);
+    if (pb->eof_reached)
         return -1;
 
-    PRINT(("NSV got header; filepos %"PRId64"\n", url_ftell(pb)));
+    av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb));
 
     if (strings_size > 0) {
         char *strings; /* last byte will be '\0' to play safe with str*() */
@@ -321,7 +309,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
 
         p = strings = av_mallocz(strings_size + 1);
         endp = strings + strings_size;
-        get_buffer(pb, strings, strings_size);
+        avio_read(pb, strings, strings_size);
         while (p < endp) {
             while (*p == ' ')
                 p++; /* strip out spaces */
@@ -338,15 +326,15 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
             if (!p || p >= endp)
                 break;
             *p++ = '\0';
-            PRINT(("NSV NSVf INFO: %s='%s'\n", token, value));
+            av_dlog(s, "NSV NSVf INFO: %s='%s'\n", token, value);
             av_metadata_set2(&s->metadata, token, value, 0);
         }
         av_free(strings);
     }
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return -1;
 
-    PRINT(("NSV got infos; filepos %"PRId64"\n", url_ftell(pb)));
+    av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb));
 
     if (table_entries_used > 0) {
         int i;
@@ -356,41 +344,41 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
         nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t));
 
         for(i=0;i<table_entries_used;i++)
-            nsv->nsvs_file_offset[i] = get_le32(pb) + size;
+            nsv->nsvs_file_offset[i] = avio_rl32(pb) + size;
 
         if(table_entries > table_entries_used &&
-           get_le32(pb) == MKTAG('T','O','C','2')) {
+           avio_rl32(pb) == MKTAG('T','O','C','2')) {
             nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t));
             for(i=0;i<table_entries_used;i++) {
-                nsv->nsvs_timestamps[i] = get_le32(pb);
+                nsv->nsvs_timestamps[i] = avio_rl32(pb);
             }
         }
     }
 
-    PRINT(("NSV got index; filepos %"PRId64"\n", url_ftell(pb)));
+    av_dlog(s, "NSV got index; filepos %"PRId64"\n", avio_tell(pb));
 
 #ifdef DEBUG_DUMP_INDEX
 #define V(v) ((v<0x20 || v > 127)?'.':v)
     /* dump index */
-    PRINT(("NSV %d INDEX ENTRIES:\n", table_entries));
-    PRINT(("NSV [dataoffset][fileoffset]\n", table_entries));
+    av_dlog(s, "NSV %d INDEX ENTRIES:\n", table_entries);
+    av_dlog(s, "NSV [dataoffset][fileoffset]\n", table_entries);
     for (i = 0; i < table_entries; i++) {
         unsigned char b[8];
-        url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
-        get_buffer(pb, b, 8);
-        PRINT(("NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
+        avio_seek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
+        avio_read(pb, b, 8);
+        av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
            "%c%c%c%c%c%c%c%c\n",
            nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i],
            b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
-           V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ));
+           V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) );
     }
-    //url_fseek(pb, size, SEEK_SET); /* go back to end of header */
+    //avio_seek(pb, size, SEEK_SET); /* go back to end of header */
 #undef V
 #endif
 
-    url_fseek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */
+    avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */
 
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return -1;
     nsv->state = NSV_HAS_READ_NSVF;
     return 0;
@@ -399,22 +387,22 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
 static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint32_t vtag, atag;
     uint16_t vwidth, vheight;
     AVRational framerate;
     int i;
     AVStream *st;
     NSVStream *nst;
-    PRINT(("%s()\n", __FUNCTION__));
+    av_dlog(s, "%s()\n", __FUNCTION__);
 
-    vtag = get_le32(pb);
-    atag = get_le32(pb);
-    vwidth = get_le16(pb);
-    vheight = get_le16(pb);
-    i = get_byte(pb);
+    vtag = avio_rl32(pb);
+    atag = avio_rl32(pb);
+    vwidth = avio_rl16(pb);
+    vheight = avio_rl16(pb);
+    i = avio_r8(pb);
 
-    PRINT(("NSV NSVs framerate code %2x\n", i));
+    av_dlog(s, "NSV NSVs framerate code %2x\n", i);
     if(i&0x80) { /* odd way of giving native framerates from docs */
         int t=(i & 0x7F)>>2;
         if(t<16) framerate = (AVRational){1, t+1};
@@ -432,13 +420,12 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
     else
         framerate= (AVRational){i, 1};
 
-    nsv->avsync = get_le16(pb);
+    nsv->avsync = avio_rl16(pb);
     nsv->framerate = framerate;
-#ifdef DEBUG
+
     print_tag("NSV NSVs vtag", vtag, 0);
     print_tag("NSV NSVs atag", atag, 0);
-    PRINT(("NSV NSVs vsize %dx%d\n", vwidth, vheight));
-#endif
+    av_dlog(s, "NSV NSVs vsize %dx%d\n", vwidth, vheight);
 
     /* XXX change to ap != NULL ? */
     if (s->nb_streams == 0) { /* streams not yet published, let's do that */
@@ -502,7 +489,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
 #ifdef CHECK_SUBSEQUENT_NSVS
     } else {
         if (nsv->vtag != vtag || nsv->atag != atag || nsv->vwidth != vwidth || nsv->vheight != vwidth) {
-            PRINT(("NSV NSVs header values differ from the first one!!!\n"));
+            av_dlog(s, "NSV NSVs header values differ from the first one!!!\n");
             //return -1;
         }
 #endif /* CHECK_SUBSEQUENT_NSVS */
@@ -521,8 +508,8 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
     NSVContext *nsv = s->priv_data;
     int i, err;
 
-    PRINT(("%s()\n", __FUNCTION__));
-    PRINT(("filename '%s'\n", s->filename));
+    av_dlog(s, "%s()\n", __FUNCTION__);
+    av_dlog(s, "filename '%s'\n", s->filename);
 
     nsv->state = NSV_UNSYNC;
     nsv->ahead[0].data = nsv->ahead[1].data = NULL;
@@ -543,14 +530,14 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
     /* now read the first chunk, so we can attempt to decode more info */
     err = nsv_read_chunk(s, 1);
 
-    PRINT(("parsed header\n"));
+    av_dlog(s, "parsed header\n");
     return 0;
 }
 
 static int nsv_read_chunk(AVFormatContext *s, int fill_header)
 {
     NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st[2] = {NULL, NULL};
     NSVStream *nst;
     AVPacket *pkt;
@@ -561,13 +548,13 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header)
     uint16_t auxsize;
     uint32_t auxtag;
 
-    PRINT(("%s(%d)\n", __FUNCTION__, fill_header));
+    av_dlog(s, "%s(%d)\n", __FUNCTION__, fill_header);
 
     if (nsv->ahead[0].data || nsv->ahead[1].data)
         return 0; //-1; /* hey! eat what you've in your plate first! */
 
 null_chunk_retry:
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return -1;
 
     for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)
@@ -581,27 +568,27 @@ null_chunk_retry:
     if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)
         return -1;
 
-    auxcount = get_byte(pb);
-    vsize = get_le16(pb);
-    asize = get_le16(pb);
+    auxcount = avio_r8(pb);
+    vsize = avio_rl16(pb);
+    asize = avio_rl16(pb);
     vsize = (vsize << 4) | (auxcount >> 4);
     auxcount &= 0x0f;
-    PRINT(("NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize));
+    av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize);
     /* skip aux stuff */
     for (i = 0; i < auxcount; i++) {
-        auxsize = get_le16(pb);
-        auxtag = get_le32(pb);
-        PRINT(("NSV aux data: '%c%c%c%c', %d bytes\n",
+        auxsize = avio_rl16(pb);
+        auxtag = avio_rl32(pb);
+        av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n",
               (auxtag & 0x0ff),
               ((auxtag >> 8) & 0x0ff),
               ((auxtag >> 16) & 0x0ff),
               ((auxtag >> 24) & 0x0ff),
-              auxsize));
-        url_fskip(pb, auxsize);
+              auxsize);
+        avio_skip(pb, auxsize);
         vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */
     }
 
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return -1;
     if (!vsize && !asize) {
         nsv->state = NSV_UNSYNC;
@@ -621,10 +608,8 @@ null_chunk_retry:
         pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO;
         pkt->dts = nst->frame_offset;
         pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */
-/*
-        for (i = 0; i < MIN(8, vsize); i++)
-            PRINT(("NSV video: [%d] = %02x\n", i, pkt->data[i]));
-*/
+        for (i = 0; i < FFMIN(8, vsize); i++)
+            av_dlog(s, "NSV video: [%d] = %02x\n", i, pkt->data[i]);
     }
     if(st[NSV_ST_VIDEO])
         ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++;
@@ -638,15 +623,15 @@ null_chunk_retry:
             uint8_t bps;
             uint8_t channels;
             uint16_t samplerate;
-            bps = get_byte(pb);
-            channels = get_byte(pb);
-            samplerate = get_le16(pb);
+            bps = avio_r8(pb);
+            channels = avio_r8(pb);
+            samplerate = avio_rl16(pb);
             asize-=4;
-            PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate));
+            av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate);
             if (fill_header) {
                 st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */
                 if (bps != 16) {
-                    PRINT(("NSV AUDIO bit/sample != 16 (%d)!!!\n", bps));
+                    av_dlog(s, "NSV AUDIO bit/sample != 16 (%d)!!!\n", bps);
                 }
                 bps /= channels; // ???
                 if (bps == 8)
@@ -655,7 +640,7 @@ null_chunk_retry:
                 channels = 1;
                 st[NSV_ST_AUDIO]->codec->channels = channels;
                 st[NSV_ST_AUDIO]->codec->sample_rate = samplerate;
-                PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate));
+                av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate);
             }
         }
         av_get_packet(pb, pkt, asize);
@@ -666,7 +651,7 @@ null_chunk_retry:
             pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1);
             pkt->dts *= (int64_t)1000        * nsv->framerate.den;
             pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num;
-            PRINT(("NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts));
+            av_dlog(s, "NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts);
         }
         nst->frame_offset++;
     }
@@ -681,7 +666,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
     NSVContext *nsv = s->priv_data;
     int i, err = 0;
 
-    PRINT(("%s()\n", __FUNCTION__));
+    av_dlog(s, "%s()\n", __FUNCTION__);
 
     /* in case we don't already have something to eat ... */
     if (nsv->ahead[0].data == NULL && nsv->ahead[1].data == NULL)
@@ -692,7 +677,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
     /* now pick one of the plates */
     for (i = 0; i < 2; i++) {
         if (nsv->ahead[i].data) {
-                PRINT(("%s: using cached packet[%d]\n", __FUNCTION__, i));
+            av_dlog(s, "%s: using cached packet[%d]\n", __FUNCTION__, i);
             /* avoid the cost of new_packet + memcpy(->data) */
             memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket));
             nsv->ahead[i].data = NULL; /* we ate that one */
@@ -715,7 +700,7 @@ static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     if(index < 0)
         return -1;
 
-    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+    avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
     nst->frame_offset = st->index_entries[index].timestamp;
     nsv->state = NSV_UNSYNC;
     return 0;
@@ -752,7 +737,7 @@ static int nsv_read_close(AVFormatContext *s)
 static int nsv_probe(AVProbeData *p)
 {
     int i;
-//    PRINT(("nsv_probe(), buf_size %d\n", p->buf_size));
+    av_dlog(NULL, "nsv_probe(), buf_size %d\n", p->buf_size);
     /* check file header */
     /* streamed files might not have any header */
     if (p->buf[0] == 'N' && p->buf[1] == 'S' &&
@@ -774,7 +759,7 @@ static int nsv_probe(AVProbeData *p)
     return 0;
 }
 
-AVInputFormat nsv_demuxer = {
+AVInputFormat ff_nsv_demuxer = {
     "nsv",
     NULL_IF_CONFIG_SMALL("Nullsoft Streaming Video"),
     sizeof(NSVContext),
diff --git a/ffmpeg-mt/libavformat/nullenc.c b/ffmpeg-mt/libavformat/nullenc.c
index 0785b77..8e38b27 100644
--- a/ffmpeg-mt/libavformat/nullenc.c
+++ b/ffmpeg-mt/libavformat/nullenc.c
@@ -2,20 +2,20 @@
  * RAW null muxer
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,7 +26,7 @@ static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVOutputFormat null_muxer = {
+AVOutputFormat ff_null_muxer = {
     "null",
     NULL_IF_CONFIG_SMALL("raw null video format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/nut.c b/ffmpeg-mt/libavformat/nut.c
index 1c5a139..3a6e28f 100644
--- a/ffmpeg-mt/libavformat/nut.c
+++ b/ffmpeg-mt/libavformat/nut.c
@@ -2,20 +2,20 @@
  * nut
  * Copyright (c) 2004-2007 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/nut.h b/ffmpeg-mt/libavformat/nut.h
index 7013fb1..419b123 100644
--- a/ffmpeg-mt/libavformat/nut.h
+++ b/ffmpeg-mt/libavformat/nut.h
@@ -2,20 +2,20 @@
  * "NUT" Container Format (de)muxer
  * Copyright (c) 2006 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -82,6 +82,10 @@ typedef struct {
 } StreamContext;
 
 typedef struct {
+    AVRational *time_base;
+} ChapterContext;
+
+typedef struct {
     AVFormatContext *avf;
 //    int written_packet_size;
 //    int64_t packet_start;
@@ -90,6 +94,7 @@ typedef struct {
     const uint8_t *header[128];
     uint64_t next_startcode;     ///< stores the next startcode if it has already been parsed but the stream is not seekable
     StreamContext *stream;
+    ChapterContext *chapter;
     unsigned int max_distance;
     unsigned int time_base_count;
     int64_t last_syncpoint_pos;
diff --git a/ffmpeg-mt/libavformat/nutdec.c b/ffmpeg-mt/libavformat/nutdec.c
index bf72555..d3804f2 100644
--- a/ffmpeg-mt/libavformat/nutdec.c
+++ b/ffmpeg-mt/libavformat/nutdec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2004-2006 Michael Niedermayer
  * Copyright (c) 2003 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,6 +24,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/bswap.h"
 #include "libavutil/tree.h"
+#include "avio_internal.h"
 #include "nut.h"
 
 #undef NDEBUG
@@ -35,13 +36,13 @@
 #define NUT_MAX_STREAMS 256    /* arbitrary sanity check value */
 #endif
 
-static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){
-    unsigned int len= ff_get_v(bc);
+static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){
+    unsigned int len= ffio_read_varlen(bc);
 
     if(len && maxlen)
-        get_buffer(bc, string, FFMIN(len, maxlen));
+        avio_read(bc, string, FFMIN(len, maxlen));
     while(len > maxlen){
-        get_byte(bc);
+        avio_r8(bc);
         len--;
     }
 
@@ -54,75 +55,75 @@ static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){
         return 0;
 }
 
-static int64_t get_s(ByteIOContext *bc){
-    int64_t v = ff_get_v(bc) + 1;
+static int64_t get_s(AVIOContext *bc){
+    int64_t v = ffio_read_varlen(bc) + 1;
 
     if (v&1) return -(v>>1);
     else     return  (v>>1);
 }
 
-static uint64_t get_fourcc(ByteIOContext *bc){
-    unsigned int len= ff_get_v(bc);
+static uint64_t get_fourcc(AVIOContext *bc){
+    unsigned int len= ffio_read_varlen(bc);
 
-    if     (len==2) return get_le16(bc);
-    else if(len==4) return get_le32(bc);
+    if     (len==2) return avio_rl16(bc);
+    else if(len==4) return avio_rl32(bc);
     else            return -1;
 }
 
 #ifdef TRACE
-static inline uint64_t get_v_trace(ByteIOContext *bc, char *file, char *func, int line){
-    uint64_t v= ff_get_v(bc);
+static inline uint64_t get_v_trace(AVIOContext *bc, char *file, char *func, int line){
+    uint64_t v= ffio_read_varlen(bc);
 
     av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
     return v;
 }
 
-static inline int64_t get_s_trace(ByteIOContext *bc, char *file, char *func, int line){
+static inline int64_t get_s_trace(AVIOContext *bc, char *file, char *func, int line){
     int64_t v= get_s(bc);
 
     av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
     return v;
 }
 
-static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, int line){
+static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int line){
     uint64_t v= get_vb(bc);
 
     av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
     return v;
 }
-#define ff_get_v(bc)  get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#define ffio_read_varlen(bc)  get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
 #define get_s(bc)  get_s_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
 #define get_vb(bc)  get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
 #endif
 
-static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum, uint64_t startcode)
+static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode)
 {
     int64_t size;
-//    start= url_ftell(bc) - 8;
+//    start= avio_tell(bc) - 8;
 
     startcode= av_be2ne64(startcode);
     startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8);
 
-    init_checksum(bc, ff_crc04C11DB7_update, startcode);
-    size= ff_get_v(bc);
+    ffio_init_checksum(bc, ff_crc04C11DB7_update, startcode);
+    size= ffio_read_varlen(bc);
     if(size > 4096)
-        get_be32(bc);
-    if(get_checksum(bc) && size > 4096)
+        avio_rb32(bc);
+    if(ffio_get_checksum(bc) && size > 4096)
         return -1;
 
-    init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
+    ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
 
     return size;
 }
 
-static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){
+static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){
     uint64_t state=0;
 
     if(pos >= 0)
-        url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
+        avio_seek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
 
-    while(!url_feof(bc)){
-        state= (state<<8) | get_byte(bc);
+    while(!bc->eof_reached){
+        state= (state<<8) | avio_r8(bc);
         if((state>>56) != 'N')
             continue;
         switch(state){
@@ -144,11 +145,11 @@ static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){
  * @param pos the start position of the search, or -1 if the current position
  * @return the position of the startcode or -1 if not found
  */
-static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){
+static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){
     for(;;){
         uint64_t startcode= find_any_startcode(bc, pos);
         if(startcode == code)
-            return url_ftell(bc) - 8;
+            return avio_tell(bc) - 8;
         else if(startcode == 0)
             return -1;
         pos=-1;
@@ -168,40 +169,40 @@ static int nut_probe(AVProbeData *p){
 }
 
 #define GET_V(dst, check) \
-    tmp= ff_get_v(bc);\
+    tmp= ffio_read_varlen(bc);\
     if(!(check)){\
         av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp);\
         return -1;\
     }\
     dst= tmp;
 
-static int skip_reserved(ByteIOContext *bc, int64_t pos){
-    pos -= url_ftell(bc);
+static int skip_reserved(AVIOContext *bc, int64_t pos){
+    pos -= avio_tell(bc);
     if(pos<0){
-        url_fseek(bc, pos, SEEK_CUR);
+        avio_seek(bc, pos, SEEK_CUR);
         return -1;
     }else{
         while(pos--)
-            get_byte(bc);
+            avio_r8(bc);
         return 0;
     }
 }
 
 static int decode_main_header(NUTContext *nut){
     AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     uint64_t tmp, end;
     unsigned int stream_count;
     int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx;
     int64_t tmp_match;
 
     end= get_packetheader(nut, bc, 1, MAIN_STARTCODE);
-    end += url_ftell(bc);
+    end += avio_tell(bc);
 
     GET_V(tmp              , tmp >=2 && tmp <= 3)
     GET_V(stream_count     , tmp > 0 && tmp <= NUT_MAX_STREAMS)
 
-    nut->max_distance = ff_get_v(bc);
+    nut->max_distance = ffio_read_varlen(bc);
     if(nut->max_distance > 65536){
         av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance);
         nut->max_distance= 65536;
@@ -224,22 +225,22 @@ static int decode_main_header(NUTContext *nut){
     tmp_match= 1-(1LL<<62);
     tmp_head_idx= 0;
     for(i=0; i<256;){
-        int tmp_flags = ff_get_v(bc);
-        int tmp_fields= ff_get_v(bc);
+        int tmp_flags = ffio_read_varlen(bc);
+        int tmp_fields= ffio_read_varlen(bc);
         if(tmp_fields>0) tmp_pts   = get_s(bc);
-        if(tmp_fields>1) tmp_mul   = ff_get_v(bc);
-        if(tmp_fields>2) tmp_stream= ff_get_v(bc);
-        if(tmp_fields>3) tmp_size  = ff_get_v(bc);
+        if(tmp_fields>1) tmp_mul   = ffio_read_varlen(bc);
+        if(tmp_fields>2) tmp_stream= ffio_read_varlen(bc);
+        if(tmp_fields>3) tmp_size  = ffio_read_varlen(bc);
         else             tmp_size  = 0;
-        if(tmp_fields>4) tmp_res   = ff_get_v(bc);
+        if(tmp_fields>4) tmp_res   = ffio_read_varlen(bc);
         else             tmp_res   = 0;
-        if(tmp_fields>5) count     = ff_get_v(bc);
+        if(tmp_fields>5) count     = ffio_read_varlen(bc);
         else             count     = tmp_mul - tmp_size;
         if(tmp_fields>6) tmp_match = get_s(bc);
-        if(tmp_fields>7) tmp_head_idx= ff_get_v(bc);
+        if(tmp_fields>7) tmp_head_idx= ffio_read_varlen(bc);
 
         while(tmp_fields-- > 8)
-           ff_get_v(bc);
+           ffio_read_varlen(bc);
 
         if(count == 0 || i+count > 256){
             av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i);
@@ -267,7 +268,7 @@ static int decode_main_header(NUTContext *nut){
     }
     assert(nut->frame_code['N'].flags == FLAG_INVALID);
 
-    if(end > url_ftell(bc) + 4){
+    if(end > avio_tell(bc) + 4){
         int rem= 1024;
         GET_V(nut->header_count, tmp<128U)
         nut->header_count++;
@@ -279,12 +280,12 @@ static int decode_main_header(NUTContext *nut){
                 return AVERROR_INVALIDDATA;
             }
             nut->header[i]= av_malloc(nut->header_len[i]);
-            get_buffer(bc, nut->header[i], nut->header_len[i]);
+            avio_read(bc, nut->header[i], nut->header_len[i]);
         }
         assert(nut->header_len[0]==0);
     }
 
-    if(skip_reserved(bc, end) || get_checksum(bc)){
+    if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
         av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n");
         return AVERROR_INVALIDDATA;
     }
@@ -299,14 +300,14 @@ static int decode_main_header(NUTContext *nut){
 
 static int decode_stream_header(NUTContext *nut){
     AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     StreamContext *stc;
     int class, stream_id;
     uint64_t tmp, end;
     AVStream *st;
 
     end= get_packetheader(nut, bc, 1, STREAM_STARTCODE);
-    end += url_ftell(bc);
+    end += avio_tell(bc);
 
     GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base);
     stc= &nut->stream[stream_id];
@@ -315,7 +316,7 @@ static int decode_stream_header(NUTContext *nut){
     if (!st)
         return AVERROR(ENOMEM);
 
-    class = ff_get_v(bc);
+    class = ffio_read_varlen(bc);
     tmp = get_fourcc(bc);
     st->codec->codec_tag= tmp;
     switch(class)
@@ -347,33 +348,33 @@ static int decode_stream_header(NUTContext *nut){
 
     GET_V(stc->time_base_id    , tmp < nut->time_base_count);
     GET_V(stc->msb_pts_shift   , tmp < 16);
-    stc->max_pts_distance= ff_get_v(bc);
+    stc->max_pts_distance= ffio_read_varlen(bc);
     GET_V(stc->decode_delay    , tmp < 1000); //sanity limit, raise this if Moore's law is true
     st->codec->has_b_frames= stc->decode_delay;
-    ff_get_v(bc); //stream flags
+    ffio_read_varlen(bc); //stream flags
 
     GET_V(st->codec->extradata_size, tmp < (1<<30));
     if(st->codec->extradata_size){
         st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-        get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
+        avio_read(bc, st->codec->extradata, st->codec->extradata_size);
     }
 
     if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
         GET_V(st->codec->width , tmp > 0)
         GET_V(st->codec->height, tmp > 0)
-        st->sample_aspect_ratio.num= ff_get_v(bc);
-        st->sample_aspect_ratio.den= ff_get_v(bc);
+        st->sample_aspect_ratio.num= ffio_read_varlen(bc);
+        st->sample_aspect_ratio.den= ffio_read_varlen(bc);
         if((!st->sample_aspect_ratio.num) != (!st->sample_aspect_ratio.den)){
             av_log(s, AV_LOG_ERROR, "invalid aspect ratio %d/%d\n", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
             return -1;
         }
-        ff_get_v(bc); /* csp type */
+        ffio_read_varlen(bc); /* csp type */
     }else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO){
         GET_V(st->codec->sample_rate , tmp > 0)
-        ff_get_v(bc); // samplerate_den
+        ffio_read_varlen(bc); // samplerate_den
         GET_V(st->codec->channels, tmp > 0)
     }
-    if(skip_reserved(bc, end) || get_checksum(bc)){
+    if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
         av_log(s, AV_LOG_ERROR, "stream header %d checksum mismatch\n", stream_id);
         return -1;
     }
@@ -397,7 +398,7 @@ static void set_disposition_bits(AVFormatContext* avf, char* value, int stream_i
 
 static int decode_info_header(NUTContext *nut){
     AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     uint64_t tmp, chapter_start, chapter_len;
     unsigned int stream_id_plus1, count;
     int chapter_id, i;
@@ -409,13 +410,13 @@ static int decode_info_header(NUTContext *nut){
     AVMetadata **metadata = NULL;
 
     end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
-    end += url_ftell(bc);
+    end += avio_tell(bc);
 
     GET_V(stream_id_plus1, tmp <= s->nb_streams)
     chapter_id   = get_s(bc);
-    chapter_start= ff_get_v(bc);
-    chapter_len  = ff_get_v(bc);
-    count        = ff_get_v(bc);
+    chapter_start= ffio_read_varlen(bc);
+    chapter_len  = ffio_read_varlen(bc);
+    count        = ffio_read_varlen(bc);
 
     if(chapter_id && !stream_id_plus1){
         int64_t start= chapter_start / nut->time_base_count;
@@ -444,7 +445,7 @@ static int decode_info_header(NUTContext *nut){
             value= get_s(bc);
         }else if(value == -4){
             type= "t";
-            value= ff_get_v(bc);
+            value= ffio_read_varlen(bc);
         }else if(value < -4){
             type= "r";
             get_s(bc);
@@ -468,7 +469,7 @@ static int decode_info_header(NUTContext *nut){
         }
     }
 
-    if(skip_reserved(bc, end) || get_checksum(bc)){
+    if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
         av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
         return -1;
     }
@@ -477,22 +478,22 @@ static int decode_info_header(NUTContext *nut){
 
 static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
     AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     int64_t end, tmp;
 
-    nut->last_syncpoint_pos= url_ftell(bc)-8;
+    nut->last_syncpoint_pos= avio_tell(bc)-8;
 
     end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
-    end += url_ftell(bc);
+    end += avio_tell(bc);
 
-    tmp= ff_get_v(bc);
-    *back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc);
+    tmp= ffio_read_varlen(bc);
+    *back_ptr= nut->last_syncpoint_pos - 16*ffio_read_varlen(bc);
     if(*back_ptr < 0)
         return -1;
 
     ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count);
 
-    if(skip_reserved(bc, end) || get_checksum(bc)){
+    if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
         av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
         return -1;
     }
@@ -505,30 +506,30 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
 
 static int find_and_decode_index(NUTContext *nut){
     AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     uint64_t tmp, end;
     int i, j, syncpoint_count;
-    int64_t filesize= url_fsize(bc);
+    int64_t filesize= avio_size(bc);
     int64_t *syncpoints;
     int8_t *has_keyframe;
     int ret= -1;
 
-    url_fseek(bc, filesize-12, SEEK_SET);
-    url_fseek(bc, filesize-get_be64(bc), SEEK_SET);
-    if(get_be64(bc) != INDEX_STARTCODE){
+    avio_seek(bc, filesize-12, SEEK_SET);
+    avio_seek(bc, filesize-avio_rb64(bc), SEEK_SET);
+    if(avio_rb64(bc) != INDEX_STARTCODE){
         av_log(s, AV_LOG_ERROR, "no index at the end\n");
         return -1;
     }
 
     end= get_packetheader(nut, bc, 1, INDEX_STARTCODE);
-    end += url_ftell(bc);
+    end += avio_tell(bc);
 
-    ff_get_v(bc); //max_pts
+    ffio_read_varlen(bc); //max_pts
     GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0)
     syncpoints= av_malloc(sizeof(int64_t)*syncpoint_count);
     has_keyframe= av_malloc(sizeof(int8_t)*(syncpoint_count+1));
     for(i=0; i<syncpoint_count; i++){
-        syncpoints[i] = ff_get_v(bc);
+        syncpoints[i] = ffio_read_varlen(bc);
         if(syncpoints[i] <= 0)
             goto fail;
         if(i)
@@ -538,7 +539,7 @@ static int find_and_decode_index(NUTContext *nut){
     for(i=0; i<s->nb_streams; i++){
         int64_t last_pts= -1;
         for(j=0; j<syncpoint_count;){
-            uint64_t x= ff_get_v(bc);
+            uint64_t x= ffio_read_varlen(bc);
             int type= x&1;
             int n= j;
             x>>=1;
@@ -569,10 +570,10 @@ static int find_and_decode_index(NUTContext *nut){
             assert(n<=syncpoint_count+1);
             for(; j<n && j<syncpoint_count; j++){
                 if(has_keyframe[j]){
-                    uint64_t B, A= ff_get_v(bc);
+                    uint64_t B, A= ffio_read_varlen(bc);
                     if(!A){
-                        A= ff_get_v(bc);
-                        B= ff_get_v(bc);
+                        A= ffio_read_varlen(bc);
+                        B= ffio_read_varlen(bc);
                         //eor_pts[j][i] = last_pts + A + B
                     }else
                         B= 0;
@@ -589,7 +590,7 @@ static int find_and_decode_index(NUTContext *nut){
         }
     }
 
-    if(skip_reserved(bc, end) || get_checksum(bc)){
+    if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
         av_log(s, AV_LOG_ERROR, "index checksum mismatch\n");
         goto fail;
     }
@@ -603,7 +604,7 @@ fail:
 static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     int64_t pos;
     int initialized_stream_count;
 
@@ -635,7 +636,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
     pos=0;
     for(;;){
         uint64_t startcode= find_any_startcode(bc, pos);
-        pos= url_ftell(bc);
+        pos= avio_tell(bc);
 
         if(startcode==0){
             av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
@@ -652,10 +653,10 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     s->data_offset= pos-8;
 
-    if(!url_is_streamed(bc)){
-        int64_t orig_pos= url_ftell(bc);
+    if(bc->seekable){
+        int64_t orig_pos= avio_tell(bc);
         find_and_decode_index(nut);
-        url_fseek(bc, orig_pos, SEEK_SET);
+        avio_seek(bc, orig_pos, SEEK_SET);
     }
     assert(nut->next_startcode == SYNCPOINT_STARTCODE);
 
@@ -666,13 +667,13 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
 static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){
     AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     StreamContext *stc;
     int size, flags, size_mul, pts_delta, i, reserved_count;
     uint64_t tmp;
 
-    if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
-        av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut->last_syncpoint_pos, nut->max_distance);
+    if(avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance){
+        av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance);
         return AVERROR_INVALIDDATA;
     }
 
@@ -687,13 +688,13 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
     if(flags & FLAG_INVALID)
         return AVERROR_INVALIDDATA;
     if(flags & FLAG_CODED)
-        flags ^= ff_get_v(bc);
+        flags ^= ffio_read_varlen(bc);
     if(flags & FLAG_STREAM_ID){
         GET_V(*stream_id, tmp < s->nb_streams)
     }
     stc= &nut->stream[*stream_id];
     if(flags&FLAG_CODED_PTS){
-        int coded_pts= ff_get_v(bc);
+        int coded_pts= ffio_read_varlen(bc);
 //FIXME check last_pts validity?
         if(coded_pts < (1<<stc->msb_pts_shift)){
             *pts=ff_lsb2full(stc, coded_pts);
@@ -702,16 +703,16 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
     }else
         *pts= stc->last_pts + pts_delta;
     if(flags&FLAG_SIZE_MSB){
-        size += size_mul*ff_get_v(bc);
+        size += size_mul*ffio_read_varlen(bc);
     }
     if(flags&FLAG_MATCH_TIME)
         get_s(bc);
     if(flags&FLAG_HEADER_IDX)
-        *header_idx= ff_get_v(bc);
+        *header_idx= ffio_read_varlen(bc);
     if(flags&FLAG_RESERVED)
-        reserved_count= ff_get_v(bc);
+        reserved_count= ffio_read_varlen(bc);
     for(i=0; i<reserved_count; i++)
-        ff_get_v(bc);
+        ffio_read_varlen(bc);
 
     if(*header_idx >= (unsigned)nut->header_count){
         av_log(s, AV_LOG_ERROR, "header_idx invalid\n");
@@ -722,7 +723,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
     size -= nut->header_len[*header_idx];
 
     if(flags&FLAG_CHECKSUM){
-        get_be32(bc); //FIXME check this
+        avio_rb32(bc); //FIXME check this
     }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
         av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n");
         return AVERROR_INVALIDDATA;
@@ -736,7 +737,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
 
 static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
     AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     int size, stream_id, discard;
     int64_t pts, last_IP_pts;
     StreamContext *stc;
@@ -757,14 +758,14 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
        ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
        || discard >= AVDISCARD_ALL
        || stc->skip_until_key_frame){
-        url_fskip(bc, size);
+        avio_skip(bc, size);
         return 1;
     }
 
     av_new_packet(pkt, size + nut->header_len[header_idx]);
     memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
-    pkt->pos= url_ftell(bc); //FIXME
-    get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
+    pkt->pos= avio_tell(bc); //FIXME
+    avio_read(bc, pkt->data + nut->header_len[header_idx], size);
 
     pkt->stream_index = stream_id;
     if (stc->last_flags & FLAG_KEY)
@@ -777,25 +778,25 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
 static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     int i, frame_code=0, ret, skip;
     int64_t ts, back_ptr;
 
     for(;;){
-        int64_t pos= url_ftell(bc);
+        int64_t pos= avio_tell(bc);
         uint64_t tmp= nut->next_startcode;
         nut->next_startcode=0;
 
         if(tmp){
             pos-=8;
         }else{
-            frame_code = get_byte(bc);
-            if(url_feof(bc))
+            frame_code = avio_r8(bc);
+            if(bc->eof_reached)
                 return -1;
             if(frame_code == 'N'){
                 tmp= frame_code;
                 for(i=1; i<8; i++)
-                    tmp = (tmp<<8) + get_byte(bc);
+                    tmp = (tmp<<8) + avio_r8(bc);
             }
         }
         switch(tmp){
@@ -803,7 +804,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
         case STREAM_STARTCODE:
         case INDEX_STARTCODE:
             skip= get_packetheader(nut, bc, 0, tmp);
-            url_fseek(bc, skip, SEEK_CUR);
+            avio_skip(bc, skip);
             break;
         case INFO_STARTCODE:
             if(decode_info_header(nut)<0)
@@ -812,7 +813,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
         case SYNCPOINT_STARTCODE:
             if(decode_syncpoint(nut, &ts, &back_ptr)<0)
                 goto resync;
-            frame_code = get_byte(bc);
+            frame_code = avio_r8(bc);
         case 0:
             ret= decode_frame(nut, pkt, frame_code);
             if(ret==0)
@@ -833,7 +834,7 @@ av_log(s, AV_LOG_DEBUG, "sync\n");
 
 static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){
     NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     int64_t pos, pts, back_ptr;
 av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit);
 
@@ -900,7 +901,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag
     }
     av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
     pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
     av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
     if(pos2 > pos || pos2 + 15 < pos){
         av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
@@ -926,7 +927,7 @@ static int nut_read_close(AVFormatContext *s)
 }
 
 #if CONFIG_NUT_DEMUXER
-AVInputFormat nut_demuxer = {
+AVInputFormat ff_nut_demuxer = {
     "nut",
     NULL_IF_CONFIG_SMALL("NUT format"),
     sizeof(NUTContext),
diff --git a/ffmpeg-mt/libavformat/nutenc.c b/ffmpeg-mt/libavformat/nutenc.c
index a030fee..c17a15d 100644
--- a/ffmpeg-mt/libavformat/nutenc.c
+++ b/ffmpeg-mt/libavformat/nutenc.c
@@ -2,20 +2,20 @@
  * nut muxer
  * Copyright (c) 2004-2007 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,6 +24,7 @@
 #include "libavcodec/mpegaudiodata.h"
 #include "nut.h"
 #include "internal.h"
+#include "avio_internal.h"
 
 static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){
     int sample_rate= c->sample_rate;
@@ -241,34 +242,34 @@ static void build_frame_code(AVFormatContext *s){
     nut->frame_code['N'].flags= FLAG_INVALID;
 }
 
-static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){
+static void put_tt(NUTContext *nut, AVRational *time_base, AVIOContext *bc, uint64_t val){
     val *= nut->time_base_count;
-    val += nus->time_base - nut->time_base;
+    val += time_base - nut->time_base;
     ff_put_v(bc, val);
 }
 
 /**
  * Store a string as vb.
  */
-static void put_str(ByteIOContext *bc, const char *string){
+static void put_str(AVIOContext *bc, const char *string){
     int len= strlen(string);
 
     ff_put_v(bc, len);
-    put_buffer(bc, string, len);
+    avio_write(bc, string, len);
 }
 
-static void put_s(ByteIOContext *bc, int64_t val){
+static void put_s(AVIOContext *bc, int64_t val){
     ff_put_v(bc, 2*FFABS(val) - (val>0));
 }
 
 #ifdef TRACE
-static inline void ff_put_v_trace(ByteIOContext *bc, uint64_t v, char *file, char *func, int line){
+static inline void ff_put_v_trace(AVIOContext *bc, uint64_t v, char *file, char *func, int line){
     av_log(NULL, AV_LOG_DEBUG, "ff_put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
 
     ff_put_v(bc, v);
 }
 
-static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *func, int line){
+static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *func, int line){
     av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
 
     put_s(bc, v);
@@ -278,28 +279,28 @@ static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *f
 #endif
 
 //FIXME remove calculate_checksum
-static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){
+static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){
     uint8_t *dyn_buf=NULL;
-    int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
+    int dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf);
     int forw_ptr= dyn_size + 4*calculate_checksum;
 
     if(forw_ptr > 4096)
-        init_checksum(bc, ff_crc04C11DB7_update, 0);
-    put_be64(bc, startcode);
+        ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
+    avio_wb64(bc, startcode);
     ff_put_v(bc, forw_ptr);
     if(forw_ptr > 4096)
-        put_le32(bc, get_checksum(bc));
+        avio_wl32(bc, ffio_get_checksum(bc));
 
     if(calculate_checksum)
-        init_checksum(bc, ff_crc04C11DB7_update, 0);
-    put_buffer(bc, dyn_buf, dyn_size);
+        ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
+    avio_write(bc, dyn_buf, dyn_size);
     if(calculate_checksum)
-        put_le32(bc, get_checksum(bc));
+        avio_wl32(bc, ffio_get_checksum(bc));
 
     av_free(dyn_buf);
 }
 
-static void write_mainheader(NUTContext *nut, ByteIOContext *bc){
+static void write_mainheader(NUTContext *nut, AVIOContext *bc){
     int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx;
     int64_t tmp_match;
 
@@ -366,11 +367,11 @@ static void write_mainheader(NUTContext *nut, ByteIOContext *bc){
     ff_put_v(bc, nut->header_count-1);
     for(i=1; i<nut->header_count; i++){
         ff_put_v(bc, nut->header_len[i]);
-        put_buffer(bc, nut->header[i], nut->header_len[i]);
+        avio_write(bc, nut->header[i], nut->header_len[i]);
     }
 }
 
-static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStream *st, int i){
+static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream *st, int i){
     NUTContext *nut = avctx->priv_data;
     AVCodecContext *codec = st->codec;
     ff_put_v(bc, i);
@@ -382,7 +383,7 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea
     }
     ff_put_v(bc, 4);
     if (codec->codec_tag){
-        put_le32(bc, codec->codec_tag);
+        avio_wl32(bc, codec->codec_tag);
     } else {
         av_log(avctx, AV_LOG_ERROR, "No codec tag defined for stream %d\n", i);
         return AVERROR(EINVAL);
@@ -392,10 +393,10 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea
     ff_put_v(bc, nut->stream[i].msb_pts_shift);
     ff_put_v(bc, nut->stream[i].max_pts_distance);
     ff_put_v(bc, codec->has_b_frames);
-    put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */
+    avio_w8(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */
 
     ff_put_v(bc, codec->extradata_size);
-    put_buffer(bc, codec->extradata, codec->extradata_size);
+    avio_write(bc, codec->extradata, codec->extradata_size);
 
     switch(codec->codec_type){
     case AVMEDIA_TYPE_AUDIO:
@@ -422,20 +423,20 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea
     return 0;
 }
 
-static int add_info(ByteIOContext *bc, const char *type, const char *value){
+static int add_info(AVIOContext *bc, const char *type, const char *value){
     put_str(bc, type);
     put_s(bc, -1);
     put_str(bc, value);
     return 1;
 }
 
-static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){
+static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
     AVFormatContext *s= nut->avf;
     AVMetadataTag *t = NULL;
-    ByteIOContext *dyn_bc;
+    AVIOContext *dyn_bc;
     uint8_t *dyn_buf=NULL;
     int count=0, dyn_size;
-    int ret = url_open_dyn_buf(&dyn_bc);
+    int ret = avio_open_dyn_buf(&dyn_bc);
     if(ret < 0)
         return ret;
 
@@ -449,19 +450,19 @@ static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){
 
     ff_put_v(bc, count);
 
-    dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
-    put_buffer(bc, dyn_buf, dyn_size);
+    dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf);
+    avio_write(bc, dyn_buf, dyn_size);
     av_free(dyn_buf);
     return 0;
 }
 
-static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){
+static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){
     AVFormatContext *s= nut->avf;
     AVStream* st = s->streams[stream_id];
-    ByteIOContext *dyn_bc;
+    AVIOContext *dyn_bc;
     uint8_t *dyn_buf=NULL;
     int count=0, dyn_size, i;
-    int ret = url_open_dyn_buf(&dyn_bc);
+    int ret = avio_open_dyn_buf(&dyn_bc);
     if(ret < 0)
         return ret;
 
@@ -469,7 +470,7 @@ static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){
         if (st->disposition & ff_nut_dispositions[i].flag)
             count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str);
     }
-    dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf);
+    dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf);
 
     if (count) {
         ff_put_v(bc, stream_id + 1); //stream_id_plus1
@@ -479,28 +480,56 @@ static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){
 
         ff_put_v(bc, count);
 
-        put_buffer(bc, dyn_buf, dyn_size);
+        avio_write(bc, dyn_buf, dyn_size);
     }
 
     av_free(dyn_buf);
     return count;
 }
 
-static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){
+static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
+{
+    AVIOContext *dyn_bc;
+    uint8_t *dyn_buf = NULL;
+    AVMetadataTag *t = NULL;
+    AVChapter *ch    = nut->avf->chapters[id];
+    int ret, dyn_size, count = 0;
+
+    ret = avio_open_dyn_buf(&dyn_bc);
+    if (ret < 0)
+        return ret;
+
+    ff_put_v(bc, 0);                                        // stream_id_plus1
+    put_s(bc, id + 1);                                      // chapter_id
+    put_tt(nut, nut->chapter[id].time_base, bc, ch->start); // chapter_start
+    ff_put_v(bc, ch->end - ch->start);                      // chapter_len
+
+    while ((t = av_metadata_get(ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX)))
+        count += add_info(dyn_bc, t->key, t->value);
+
+    ff_put_v(bc, count);
+
+    dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf);
+    avio_write(bc, dyn_buf, dyn_size);
+    av_freep(&dyn_buf);
+    return 0;
+}
+
+static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
     NUTContext *nut = avctx->priv_data;
-    ByteIOContext *dyn_bc;
+    AVIOContext *dyn_bc;
     int i, ret;
 
     ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL);
 
-    ret = url_open_dyn_buf(&dyn_bc);
+    ret = avio_open_dyn_buf(&dyn_bc);
     if(ret < 0)
         return ret;
     write_mainheader(nut, dyn_bc);
     put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
 
     for (i=0; i < nut->avf->nb_streams; i++){
-        ret = url_open_dyn_buf(&dyn_bc);
+        ret = avio_open_dyn_buf(&dyn_bc);
         if(ret < 0)
             return ret;
         if ((ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i)) < 0)
@@ -508,14 +537,14 @@ static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){
         put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
     }
 
-    ret = url_open_dyn_buf(&dyn_bc);
+    ret = avio_open_dyn_buf(&dyn_bc);
     if(ret < 0)
         return ret;
     write_globalinfo(nut, dyn_bc);
     put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
 
     for (i = 0; i < nut->avf->nb_streams; i++) {
-        ret = url_open_dyn_buf(&dyn_bc);
+        ret = avio_open_dyn_buf(&dyn_bc);
         if(ret < 0)
             return ret;
         ret = write_streaminfo(nut, dyn_bc, i);
@@ -525,11 +554,25 @@ static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){
             put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
         else {
             uint8_t* buf;
-            url_close_dyn_buf(dyn_bc, &buf);
+            avio_close_dyn_buf(dyn_bc, &buf);
             av_free(buf);
         }
     }
 
+    for (i = 0; i < nut->avf->nb_chapters; i++) {
+        ret = avio_open_dyn_buf(&dyn_bc);
+        if (ret < 0)
+            return ret;
+        ret = write_chapter(nut, dyn_bc, i);
+        if (ret < 0) {
+            uint8_t *buf;
+            avio_close_dyn_buf(dyn_bc, &buf);
+            av_freep(&buf);
+            return ret;
+        }
+        put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
+    }
+
     nut->last_syncpoint_pos= INT_MIN;
     nut->header_count++;
     return 0;
@@ -537,13 +580,15 @@ static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){
 
 static int write_header(AVFormatContext *s){
     NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     int i, j, ret;
 
     nut->avf= s;
 
     nut->stream   = av_mallocz(sizeof(StreamContext)*s->nb_streams);
-    nut->time_base= av_mallocz(sizeof(AVRational   )*s->nb_streams);
+    nut->chapter  = av_mallocz(sizeof(ChapterContext)*s->nb_chapters);
+    nut->time_base= av_mallocz(sizeof(AVRational   )*(s->nb_streams +
+                                                      s->nb_chapters));
 
     for(i=0; i<s->nb_streams; i++){
         AVStream *st= s->streams[i];
@@ -570,18 +615,32 @@ static int write_header(AVFormatContext *s){
         nut->stream[i].max_pts_distance= FFMAX(time_base.den, time_base.num) / time_base.num;
     }
 
+    for (i = 0; i < s->nb_chapters; i++) {
+        AVChapter *ch = s->chapters[i];
+
+        for (j = 0; j < nut->time_base_count; j++) {
+            if (!memcmp(&ch->time_base, &nut->time_base[j], sizeof(AVRational)))
+                break;
+        }
+
+        nut->time_base[j] = ch->time_base;
+        nut->chapter[i].time_base = &nut->time_base[j];
+        if(j == nut->time_base_count)
+            nut->time_base_count++;
+    }
+
     nut->max_distance = MAX_DISTANCE;
     build_elision_headers(s);
     build_frame_code(s);
     assert(nut->frame_code['N'].flags == FLAG_INVALID);
 
-    put_buffer(bc, ID_STRING, strlen(ID_STRING));
-    put_byte(bc, 0);
+    avio_write(bc, ID_STRING, strlen(ID_STRING));
+    avio_w8(bc, 0);
 
     if ((ret = write_headers(s, bc)) < 0)
         return ret;
 
-    put_flush_packet(bc);
+    avio_flush(bc);
 
     //FIXME index
 
@@ -628,7 +687,7 @@ static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){
 static int write_packet(AVFormatContext *s, AVPacket *pkt){
     NUTContext *nut = s->priv_data;
     StreamContext *nus= &nut->stream[pkt->stream_index];
-    ByteIOContext *bc = s->pb, *dyn_bc;
+    AVIOContext *bc = s->pb, *dyn_bc;
     FrameCode *fc;
     int64_t coded_pts;
     int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx;
@@ -639,13 +698,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
     if(pkt->pts < 0)
         return -1;
 
-    if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
+    if(1LL<<(20+3*nut->header_count) <= avio_tell(bc))
         write_headers(s, bc);
 
     if(key_frame && !(nus->last_flags & FLAG_KEY))
         store_sp= 1;
 
-    if(pkt->size + 30/*FIXME check*/ + url_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
+    if(pkt->size + 30/*FIXME check*/ + avio_tell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
         store_sp= 1;
 
 //FIXME: Ensure store_sp is 1 in the first place.
@@ -668,11 +727,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
         sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
                          NULL);
 
-        nut->last_syncpoint_pos= url_ftell(bc);
-        ret = url_open_dyn_buf(&dyn_bc);
+        nut->last_syncpoint_pos= avio_tell(bc);
+        ret = avio_open_dyn_buf(&dyn_bc);
         if(ret < 0)
             return ret;
-        put_tt(nut, nus, dyn_bc, pkt->dts);
+        put_tt(nut, nus->time_base, dyn_bc, pkt->dts);
         ff_put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0);
         put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE);
 
@@ -748,8 +807,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
     needed_flags= get_needed_flags(nut, nus, fc, pkt);
     header_idx= fc->header_idx;
 
-    init_checksum(bc, ff_crc04C11DB7_update, 0);
-    put_byte(bc, frame_code);
+    ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
+    avio_w8(bc, frame_code);
     if(flags & FLAG_CODED){
         ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));
         flags = needed_flags;
@@ -759,10 +818,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
     if(flags & FLAG_SIZE_MSB)   ff_put_v(bc, pkt->size / fc->size_mul);
     if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx);
 
-    if(flags & FLAG_CHECKSUM)   put_le32(bc, get_checksum(bc));
-    else                        get_checksum(bc);
+    if(flags & FLAG_CHECKSUM)   avio_wl32(bc, ffio_get_checksum(bc));
+    else                        ffio_get_checksum(bc);
 
-    put_buffer(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
+    avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
     nus->last_flags= flags;
     nus->last_pts= pkt->pts;
 
@@ -781,19 +840,20 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
 
 static int write_trailer(AVFormatContext *s){
     NUTContext *nut= s->priv_data;
-    ByteIOContext *bc= s->pb;
+    AVIOContext *bc= s->pb;
 
     while(nut->header_count<3)
         write_headers(s, bc);
-    put_flush_packet(bc);
+    avio_flush(bc);
     ff_nut_free_sp(nut);
     av_freep(&nut->stream);
+    av_freep(&nut->chapter);
     av_freep(&nut->time_base);
 
     return 0;
 }
 
-AVOutputFormat nut_muxer = {
+AVOutputFormat ff_nut_muxer = {
     "nut",
     NULL_IF_CONFIG_SMALL("NUT format"),
     "video/x-nut",
diff --git a/ffmpeg-mt/libavformat/nuv.c b/ffmpeg-mt/libavformat/nuv.c
index f0eacd5..bf59610 100644
--- a/ffmpeg-mt/libavformat/nuv.c
+++ b/ffmpeg-mt/libavformat/nuv.c
@@ -2,20 +2,20 @@
  * NuppelVideo demuxer.
  * Copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,100 +55,100 @@ static int nuv_probe(AVProbeData *p) {
  * \param myth set if this is a MythTVVideo format file
  * \return 1 if all required codec data was found
  */
-static int get_codec_data(ByteIOContext *pb, AVStream *vst,
+static int get_codec_data(AVIOContext *pb, AVStream *vst,
                           AVStream *ast, int myth) {
     nuv_frametype frametype;
     if (!vst && !myth)
         return 1; // no codec data needed
-    while (!url_feof(pb)) {
+    while (!pb->eof_reached) {
         int size, subtype;
-        frametype = get_byte(pb);
+        frametype = avio_r8(pb);
         switch (frametype) {
             case NUV_EXTRADATA:
-                subtype = get_byte(pb);
-                url_fskip(pb, 6);
-                size = PKTSIZE(get_le32(pb));
+                subtype = avio_r8(pb);
+                avio_skip(pb, 6);
+                size = PKTSIZE(avio_rl32(pb));
                 if (vst && subtype == 'R') {
                     vst->codec->extradata_size = size;
                     vst->codec->extradata = av_malloc(size);
-                    get_buffer(pb, vst->codec->extradata, size);
+                    avio_read(pb, vst->codec->extradata, size);
                     size = 0;
                     if (!myth)
                         return 1;
                 }
                 break;
             case NUV_MYTHEXT:
-                url_fskip(pb, 7);
-                size = PKTSIZE(get_le32(pb));
+                avio_skip(pb, 7);
+                size = PKTSIZE(avio_rl32(pb));
                 if (size != 128 * 4)
                     break;
-                get_le32(pb); // version
+                avio_rl32(pb); // version
                 if (vst) {
-                    vst->codec->codec_tag = get_le32(pb);
+                    vst->codec->codec_tag = avio_rl32(pb);
                     vst->codec->codec_id =
                         ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag);
                     if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
                         vst->codec->codec_id = CODEC_ID_NUV;
                 } else
-                    url_fskip(pb, 4);
+                    avio_skip(pb, 4);
 
                 if (ast) {
-                    ast->codec->codec_tag = get_le32(pb);
-                    ast->codec->sample_rate = get_le32(pb);
-                    ast->codec->bits_per_coded_sample = get_le32(pb);
-                    ast->codec->channels = get_le32(pb);
+                    ast->codec->codec_tag = avio_rl32(pb);
+                    ast->codec->sample_rate = avio_rl32(pb);
+                    ast->codec->bits_per_coded_sample = avio_rl32(pb);
+                    ast->codec->channels = avio_rl32(pb);
                     ast->codec->codec_id =
                         ff_wav_codec_get_id(ast->codec->codec_tag,
                                          ast->codec->bits_per_coded_sample);
                     ast->need_parsing = AVSTREAM_PARSE_FULL;
                 } else
-                    url_fskip(pb, 4 * 4);
+                    avio_skip(pb, 4 * 4);
 
                 size -= 6 * 4;
-                url_fskip(pb, size);
+                avio_skip(pb, size);
                 return 1;
             case NUV_SEEKP:
                 size = 11;
                 break;
             default:
-                url_fskip(pb, 7);
-                size = PKTSIZE(get_le32(pb));
+                avio_skip(pb, 7);
+                size = PKTSIZE(avio_rl32(pb));
                 break;
         }
-        url_fskip(pb, size);
+        avio_skip(pb, size);
     }
     return 0;
 }
 
 static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
     NUVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     char id_string[12];
     double aspect, fps;
     int is_mythtv, width, height, v_packs, a_packs;
     int stream_nr = 0;
     AVStream *vst = NULL, *ast = NULL;
-    get_buffer(pb, id_string, 12);
+    avio_read(pb, id_string, 12);
     is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
-    url_fskip(pb, 5); // version string
-    url_fskip(pb, 3); // padding
-    width = get_le32(pb);
-    height = get_le32(pb);
-    get_le32(pb); // unused, "desiredwidth"
-    get_le32(pb); // unused, "desiredheight"
-    get_byte(pb); // 'P' == progressive, 'I' == interlaced
-    url_fskip(pb, 3); // padding
-    aspect = av_int2dbl(get_le64(pb));
+    avio_skip(pb, 5); // version string
+    avio_skip(pb, 3); // padding
+    width = avio_rl32(pb);
+    height = avio_rl32(pb);
+    avio_rl32(pb); // unused, "desiredwidth"
+    avio_rl32(pb); // unused, "desiredheight"
+    avio_r8(pb); // 'P' == progressive, 'I' == interlaced
+    avio_skip(pb, 3); // padding
+    aspect = av_int2dbl(avio_rl64(pb));
     if (aspect > 0.9999 && aspect < 1.0001)
         aspect = 4.0 / 3.0;
-    fps = av_int2dbl(get_le64(pb));
+    fps = av_int2dbl(avio_rl64(pb));
 
     // number of packets per stream type, -1 means unknown, e.g. streaming
-    v_packs = get_le32(pb);
-    a_packs = get_le32(pb);
-    get_le32(pb); // text
+    v_packs = avio_rl32(pb);
+    a_packs = avio_rl32(pb);
+    avio_rl32(pb); // text
 
-    get_le32(pb); // keyframe distance (?)
+    avio_rl32(pb); // keyframe distance (?)
 
     if (v_packs) {
         ctx->v_id = stream_nr++;
@@ -191,14 +191,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
 
 static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
     NUVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     uint8_t hdr[HDRSIZE];
     nuv_frametype frametype;
     int ret, size;
-    while (!url_feof(pb)) {
+    while (!pb->eof_reached) {
         int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
-        uint64_t pos = url_ftell(pb);
-        ret = get_buffer(pb, hdr, HDRSIZE);
+        uint64_t pos = avio_tell(pb);
+        ret = avio_read(pb, hdr, HDRSIZE);
         if (ret < HDRSIZE)
             return ret < 0 ? ret : AVERROR(EIO);
         frametype = hdr[0];
@@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
         switch (frametype) {
             case NUV_EXTRADATA:
                 if (!ctx->rtjpg_video) {
-                    url_fskip(pb, size);
+                    avio_skip(pb, size);
                     break;
                 }
             case NUV_VIDEO:
                 if (ctx->v_id < 0) {
                     av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n");
-                    url_fskip(pb, size);
+                    avio_skip(pb, size);
                     break;
                 }
                 ret = av_new_packet(pkt, copyhdrsize + size);
@@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
                 pkt->pts = AV_RL32(&hdr[4]);
                 pkt->stream_index = ctx->v_id;
                 memcpy(pkt->data, hdr, copyhdrsize);
-                ret = get_buffer(pb, pkt->data + copyhdrsize, size);
+                ret = avio_read(pb, pkt->data + copyhdrsize, size);
                 if (ret < 0) {
                     av_free_packet(pkt);
                     return ret;
@@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
             case NUV_AUDIO:
                 if (ctx->a_id < 0) {
                     av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n");
-                    url_fskip(pb, size);
+                    avio_skip(pb, size);
                     break;
                 }
                 ret = av_get_packet(pb, pkt, size);
@@ -250,14 +250,14 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
                 // contains no data, size value is invalid
                 break;
             default:
-                url_fskip(pb, size);
+                avio_skip(pb, size);
                 break;
         }
     }
     return AVERROR(EIO);
 }
 
-AVInputFormat nuv_demuxer = {
+AVInputFormat ff_nuv_demuxer = {
     "nuv",
     NULL_IF_CONFIG_SMALL("NuppelVideo format"),
     sizeof(NUVContext),
diff --git a/ffmpeg-mt/libavformat/oggdec.c b/ffmpeg-mt/libavformat/oggdec.c
index 4fcf8ad..cd866d4 100644
--- a/ffmpeg-mt/libavformat/oggdec.c
+++ b/ffmpeg-mt/libavformat/oggdec.c
@@ -62,7 +62,7 @@ ogg_save (AVFormatContext * s)
     struct ogg_state *ost =
         av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
     int i;
-    ost->pos = url_ftell (s->pb);
+    ost->pos = avio_tell (s->pb);
     ost->curidx = ogg->curidx;
     ost->next = ogg->state;
     ost->nstreams = ogg->nstreams;
@@ -84,7 +84,7 @@ static int
 ogg_restore (AVFormatContext * s, int discard)
 {
     struct ogg *ogg = s->priv_data;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     struct ogg_state *ost = ogg->state;
     int i;
 
@@ -97,7 +97,7 @@ ogg_restore (AVFormatContext * s, int discard)
         for (i = 0; i < ogg->nstreams; i++)
             av_free (ogg->streams[i].buf);
 
-        url_fseek (bc, ost->pos, SEEK_SET);
+        avio_seek (bc, ost->pos, SEEK_SET);
         ogg->curidx = ost->curidx;
         ogg->nstreams = ost->nstreams;
         memcpy(ogg->streams, ost->streams,
@@ -194,7 +194,7 @@ ogg_new_buf(struct ogg *ogg, int idx)
 static int
 ogg_read_page (AVFormatContext * s, int *str)
 {
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     struct ogg *ogg = s->priv_data;
     struct ogg_stream *os;
     int i = 0;
@@ -207,7 +207,7 @@ ogg_read_page (AVFormatContext * s, int *str)
     uint8_t sync[4];
     int sp = 0;
 
-    if (get_buffer (bc, sync, 4) < 4)
+    if (avio_read (bc, sync, 4) < 4)
         return -1;
 
     do{
@@ -218,8 +218,8 @@ ogg_read_page (AVFormatContext * s, int *str)
             sync[(sp + 2) & 3] == 'g' && sync[(sp + 3) & 3] == 'S')
             break;
 
-        c = url_fgetc (bc);
-        if (c < 0)
+        c = avio_r8(bc);
+        if (bc->eof_reached)
             return -1;
         sync[sp++ & 3] = c;
     }while (i++ < MAX_PAGE_SIZE);
@@ -229,15 +229,15 @@ ogg_read_page (AVFormatContext * s, int *str)
         return -1;
     }
 
-    if (url_fgetc (bc) != 0)      /* version */
+    if (avio_r8(bc) != 0)      /* version */
         return -1;
 
-    flags = url_fgetc (bc);
-    gp = get_le64 (bc);
-    serial = get_le32 (bc);
-    seq = get_le32 (bc);
-    crc = get_le32 (bc);
-    nsegs = url_fgetc (bc);
+    flags = avio_r8(bc);
+    gp = avio_rl64 (bc);
+    serial = avio_rl32 (bc);
+    seq = avio_rl32 (bc);
+    crc = avio_rl32 (bc);
+    nsegs = avio_r8(bc);
 
     idx = ogg_find_stream (ogg, serial);
     if (idx < 0){
@@ -247,12 +247,12 @@ ogg_read_page (AVFormatContext * s, int *str)
     }
 
     os = ogg->streams + idx;
-    os->page_pos = url_ftell(bc) - 27;
+    os->page_pos = avio_tell(bc) - 27;
 
     if(os->psize > 0)
         ogg_new_buf(ogg, idx);
 
-    if (get_buffer (bc, os->segments, nsegs) < nsegs)
+    if (avio_read (bc, os->segments, nsegs) < nsegs)
         return -1;
 
     os->nsegs = nsegs;
@@ -284,7 +284,7 @@ ogg_read_page (AVFormatContext * s, int *str)
         os->buf = nb;
     }
 
-    if (get_buffer (bc, os->buf + os->bufpos, size) < size)
+    if (avio_read (bc, os->buf + os->bufpos, size) < size)
         return -1;
 
     os->bufpos += size;
@@ -374,20 +374,20 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo
             os->segp = segp;
             os->psize = psize;
 
-            // We have reached the first non-header packet. All header
-            // packets must be complete before the first non-header
-            // one, so everything that follows must be non-header.
+            // We have reached the first non-header packet in this stream.
+            // Unfortunately more header packets may still follow for others,
+            // so we reset this later unless we are done with the headers
+            // for all streams.
             ogg->headers = 1;
 
             // Update the header state for all streams and
             // compute the data_offset.
-            s->data_offset = os->sync_pos;
+            if (!s->data_offset)
+                s->data_offset = os->sync_pos;
             for (i = 0; i < ogg->nstreams; i++) {
                 struct ogg_stream *cur_os = ogg->streams + i;
-                // Set stream header state to 0 if its last packet
-                // was a header.
                 if (cur_os->header > 0)
-                    cur_os->header = 0;
+                    ogg->headers = 0;
 
                 // if we have a partial non-header packet, its start is
                 // obviously at or after the data start
@@ -455,20 +455,20 @@ ogg_get_length (AVFormatContext * s)
     int i;
     int64_t size, end;
 
-    if(url_is_streamed(s->pb))
+    if(!s->pb->seekable)
         return 0;
 
 // already set
     if (s->duration != AV_NOPTS_VALUE)
         return 0;
 
-    size = url_fsize(s->pb);
+    size = avio_size(s->pb);
     if(size < 0)
         return 0;
     end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0;
 
     ogg_save (s);
-    url_fseek (s->pb, end, SEEK_SET);
+    avio_seek (s->pb, end, SEEK_SET);
 
     while (!ogg_read_page (s, &i)){
         if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
@@ -601,13 +601,13 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
 {
     struct ogg *ogg = s->priv_data;
     struct ogg_stream *os = ogg->streams + stream_index;
-    ByteIOContext *bc = s->pb;
+    AVIOContext *bc = s->pb;
     int64_t pts = AV_NOPTS_VALUE;
     int i;
-    url_fseek(bc, *pos_arg, SEEK_SET);
+    avio_seek(bc, *pos_arg, SEEK_SET);
     ogg_reset(ogg);
 
-    while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
+    while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
         if (i == stream_index) {
             pts = ogg_calc_pts(s, i, NULL);
             if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
@@ -648,7 +648,7 @@ static int ogg_probe(AVProbeData *p)
         return 0;
 }
 
-AVInputFormat ogg_demuxer = {
+AVInputFormat ff_ogg_demuxer = {
     "ogg",
     NULL_IF_CONFIG_SMALL("Ogg"),
     sizeof (struct ogg),
diff --git a/ffmpeg-mt/libavformat/oggenc.c b/ffmpeg-mt/libavformat/oggenc.c
index b72efc8..92c751c 100644
--- a/ffmpeg-mt/libavformat/oggenc.c
+++ b/ffmpeg-mt/libavformat/oggenc.c
@@ -2,20 +2,20 @@
  * Ogg muxer
  * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at free dot fr>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,7 @@
 #include "libavcodec/bytestream.h"
 #include "libavcodec/flac.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "internal.h"
 #include "vorbiscomment.h"
 
@@ -64,48 +65,48 @@ typedef struct {
     OGGPageList *page_list;
 } OGGContext;
 
-static void ogg_update_checksum(AVFormatContext *s, ByteIOContext *pb, int64_t crc_offset)
+static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
 {
-    int64_t pos = url_ftell(pb);
-    uint32_t checksum = get_checksum(pb);
-    url_fseek(pb, crc_offset, SEEK_SET);
-    put_be32(pb, checksum);
-    url_fseek(pb, pos, SEEK_SET);
+    int64_t pos = avio_tell(pb);
+    uint32_t checksum = ffio_get_checksum(pb);
+    avio_seek(pb, crc_offset, SEEK_SET);
+    avio_wb32(pb, checksum);
+    avio_seek(pb, pos, SEEK_SET);
 }
 
 static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
 {
     OGGStreamContext *oggstream = s->streams[page->stream_index]->priv_data;
-    ByteIOContext *pb;
+    AVIOContext *pb;
     int64_t crc_offset;
     int ret, size;
     uint8_t *buf;
 
-    ret = url_open_dyn_buf(&pb);
+    ret = avio_open_dyn_buf(&pb);
     if (ret < 0)
         return ret;
-    init_checksum(pb, ff_crc04C11DB7_update, 0);
-    put_tag(pb, "OggS");
-    put_byte(pb, 0);
-    put_byte(pb, page->flags | extra_flags);
-    put_le64(pb, page->granule);
-    put_le32(pb, oggstream->serial_num);
-    put_le32(pb, oggstream->page_counter++);
-    crc_offset = url_ftell(pb);
-    put_le32(pb, 0); // crc
-    put_byte(pb, page->segments_count);
-    put_buffer(pb, page->segments, page->segments_count);
-    put_buffer(pb, page->data, page->size);
+    ffio_init_checksum(pb, ff_crc04C11DB7_update, 0);
+    ffio_wfourcc(pb, "OggS");
+    avio_w8(pb, 0);
+    avio_w8(pb, page->flags | extra_flags);
+    avio_wl64(pb, page->granule);
+    avio_wl32(pb, oggstream->serial_num);
+    avio_wl32(pb, oggstream->page_counter++);
+    crc_offset = avio_tell(pb);
+    avio_wl32(pb, 0); // crc
+    avio_w8(pb, page->segments_count);
+    avio_write(pb, page->segments, page->segments_count);
+    avio_write(pb, page->data, page->size);
 
     ogg_update_checksum(s, pb, crc_offset);
-    put_flush_packet(pb);
+    avio_flush(pb);
 
-    size = url_close_dyn_buf(pb, &buf);
+    size = avio_close_dyn_buf(pb, &buf);
     if (size < 0)
         return size;
 
-    put_buffer(s->pb, buf, size);
-    put_flush_packet(s->pb);
+    avio_write(s->pb, buf, size);
+    avio_flush(s->pb);
     av_free(buf);
     oggstream->page_count--;
     return 0;
@@ -502,7 +503,7 @@ static int ogg_write_trailer(AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat ogg_muxer = {
+AVOutputFormat ff_ogg_muxer = {
     "ogg",
     NULL_IF_CONFIG_SMALL("Ogg"),
     "application/ogg",
diff --git a/ffmpeg-mt/libavformat/oggparsedirac.c b/ffmpeg-mt/libavformat/oggparsedirac.c
index a7f0401..f6afafd 100644
--- a/ffmpeg-mt/libavformat/oggparsedirac.c
+++ b/ffmpeg-mt/libavformat/oggparsedirac.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2008  David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -42,7 +42,7 @@ static int dirac_header(AVFormatContext *s, int idx)
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_DIRAC;
     // dirac in ogg always stores timestamps as though the video were interlaced
-    st->time_base = (AVRational){st->codec->time_base.num, 2*st->codec->time_base.den};
+    av_set_pts_info(st, 64, st->codec->time_base.num, 2*st->codec->time_base.den);
     return 1;
 }
 
@@ -79,8 +79,7 @@ static int old_dirac_header(AVFormatContext *s, int idx)
 
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_DIRAC;
-    st->time_base.den = AV_RB32(buf+8);
-    st->time_base.num = AV_RB32(buf+12);
+    av_set_pts_info(st, 64, AV_RB32(buf+12), AV_RB32(buf+8));
     return 1;
 }
 
diff --git a/ffmpeg-mt/libavformat/oggparseflac.c b/ffmpeg-mt/libavformat/oggparseflac.c
index e5034af..53cd0fa 100644
--- a/ffmpeg-mt/libavformat/oggparseflac.c
+++ b/ffmpeg-mt/libavformat/oggparseflac.c
@@ -1,20 +1,20 @@
 /*
  *    Copyright (C) 2005  Matthieu CASTET
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -65,8 +65,7 @@ flac_header (AVFormatContext * s, int idx)
         memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE);
         st->codec->extradata_size = FLAC_STREAMINFO_SIZE;
 
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
+        av_set_pts_info(st, 64, 1, st->codec->sample_rate);
     } else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
         ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 4, os->psize - 4);
     }
diff --git a/ffmpeg-mt/libavformat/oggparseogm.c b/ffmpeg-mt/libavformat/oggparseogm.c
index e1d046f..dda5be6 100644
--- a/ffmpeg-mt/libavformat/oggparseogm.c
+++ b/ffmpeg-mt/libavformat/oggparseogm.c
@@ -83,14 +83,13 @@ ogm_header(AVFormatContext *s, int idx)
             st->codec->height = bytestream_get_le32(&p);
             st->codec->time_base.den = spu * 10000000;
             st->codec->time_base.num = time_unit;
-            st->time_base = st->codec->time_base;
+            av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
         } else {
             st->codec->channels = bytestream_get_le16(&p);
             p += 2;                 /* block_align */
             st->codec->bit_rate = bytestream_get_le32(&p) * 8;
             st->codec->sample_rate = spu * 10000000 / time_unit;
-            st->time_base.num = 1;
-            st->time_base.den = st->codec->sample_rate;
+            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
         }
     } else if (*p == 3) {
         if (os->psize > 8)
diff --git a/ffmpeg-mt/libavformat/oggparseskeleton.c b/ffmpeg-mt/libavformat/oggparseskeleton.c
index ad0dded..ceb7c69 100644
--- a/ffmpeg-mt/libavformat/oggparseskeleton.c
+++ b/ffmpeg-mt/libavformat/oggparseskeleton.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2010 David Conrad
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -60,8 +60,9 @@ static int skeleton_header(AVFormatContext *s, int idx)
         start_den = AV_RL64(buf+20);
 
         if (start_den) {
-            av_reduce(&start_time, &st->time_base.den, start_num, start_den, INT_MAX);
-            st->time_base.num = 1;
+            int base_den;
+            av_reduce(&start_time, &base_den, start_num, start_den, INT_MAX);
+            av_set_pts_info(st, 64, 1, base_den);
             os->lastpts =
             st->start_time = start_time;
         }
diff --git a/ffmpeg-mt/libavformat/oggparsespeex.c b/ffmpeg-mt/libavformat/oggparsespeex.c
index 936b37e..80b2001 100644
--- a/ffmpeg-mt/libavformat/oggparsespeex.c
+++ b/ffmpeg-mt/libavformat/oggparsespeex.c
@@ -72,8 +72,7 @@ static int speex_header(AVFormatContext *s, int idx) {
                                          + FF_INPUT_BUFFER_PADDING_SIZE);
         memcpy(st->codec->extradata, p, st->codec->extradata_size);
 
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
+        av_set_pts_info(st, 64, 1, st->codec->sample_rate);
     } else
         ff_vorbis_comment(s, &st->metadata, p, os->psize);
 
diff --git a/ffmpeg-mt/libavformat/oggparsetheora.c b/ffmpeg-mt/libavformat/oggparsetheora.c
index 2299f55..d02781f 100644
--- a/ffmpeg-mt/libavformat/oggparsetheora.c
+++ b/ffmpeg-mt/libavformat/oggparsetheora.c
@@ -91,7 +91,7 @@ theora_header (AVFormatContext * s, int idx)
             st->codec->time_base.num = 1;
             st->codec->time_base.den = 25;
         }
-        st->time_base = st->codec->time_base;
+        av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
 
         st->sample_aspect_ratio.num = get_bits_long(&gb, 24);
         st->sample_aspect_ratio.den = get_bits_long(&gb, 24);
diff --git a/ffmpeg-mt/libavformat/oggparsevorbis.c b/ffmpeg-mt/libavformat/oggparsevorbis.c
index cdb0266..830f0bc 100644
--- a/ffmpeg-mt/libavformat/oggparsevorbis.c
+++ b/ffmpeg-mt/libavformat/oggparsevorbis.c
@@ -28,6 +28,7 @@
 #include "libavcodec/get_bits.h"
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
+#include "internal.h"
 #include "oggdec.h"
 #include "vorbiscomment.h"
 
@@ -221,6 +222,7 @@ vorbis_header (AVFormatContext * s, int idx)
     if (os->buf[os->pstart] == 1) {
         const uint8_t *p = os->buf + os->pstart + 7; /* skip "\001vorbis" tag */
         unsigned blocksize, bs0, bs1;
+        int srate;
 
         if (os->psize != 30)
             return -1;
@@ -229,7 +231,7 @@ vorbis_header (AVFormatContext * s, int idx)
             return -1;
 
         st->codec->channels = bytestream_get_byte(&p);
-        st->codec->sample_rate = bytestream_get_le32(&p);
+        srate = bytestream_get_le32(&p);
         p += 4; // skip maximum bitrate
         st->codec->bit_rate = bytestream_get_le32(&p); // nominal bitrate
         p += 4; // skip minimum bitrate
@@ -249,11 +251,21 @@ vorbis_header (AVFormatContext * s, int idx)
         st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
         st->codec->codec_id = CODEC_ID_VORBIS;
 
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
+        if (srate > 0) {
+            st->codec->sample_rate = srate;
+            av_set_pts_info(st, 64, 1, srate);
+        }
     } else if (os->buf[os->pstart] == 3) {
-        if (os->psize > 8)
-            ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
+        if (os->psize > 8 &&
+            ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8) >= 0) {
+            // drop all metadata we parsed and which is not required by libvorbis
+            unsigned new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1;
+            if (new_len >= 16 && new_len < os->psize) {
+                AV_WL32(priv->packet[1] + new_len - 5, 0);
+                priv->packet[1][new_len - 1] = 1;
+                priv->len[1] = new_len;
+            }
+        }
     } else {
         st->codec->extradata_size =
             fixup_vorbis_headers(s, priv, &st->codec->extradata);
diff --git a/ffmpeg-mt/libavformat/oma.c b/ffmpeg-mt/libavformat/oma.c
index 0f471dd..ba8901d 100644
--- a/ffmpeg-mt/libavformat/oma.c
+++ b/ffmpeg-mt/libavformat/oma.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2008 Maxim Poliakovski
  *               2008 Benjamin Larsson
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -79,7 +79,7 @@ static int oma_read_header(AVFormatContext *s,
     AVStream *st;
 
     ff_id3v2_read(s, ID3v2_EA3_MAGIC);
-    ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
+    ret = avio_read(s->pb, buf, EA3_HEADER_SIZE);
 
     if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
         av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
@@ -189,7 +189,7 @@ static int oma_read_probe(AVProbeData *p)
 }
 
 
-AVInputFormat oma_demuxer = {
+AVInputFormat ff_oma_demuxer = {
     "oma",
     NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
     0,
diff --git a/ffmpeg-mt/libavformat/options.c b/ffmpeg-mt/libavformat/options.c
index 27eb8da..beaafd8 100644
--- a/ffmpeg-mt/libavformat/options.c
+++ b/ffmpeg-mt/libavformat/options.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
diff --git a/ffmpeg-mt/libavformat/os_support.c b/ffmpeg-mt/libavformat/os_support.c
index 83f0820..5a3a1bb 100644
--- a/ffmpeg-mt/libavformat/os_support.c
+++ b/ffmpeg-mt/libavformat/os_support.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * copyright (c) 2002 Francois Revol
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -234,9 +234,7 @@ int ff_socket_nonblock(int socket, int enable)
       return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
 #endif
 }
-#endif /* CONFIG_NETWORK */
 
-#if CONFIG_FFSERVER
 #if !HAVE_POLL_H
 int poll(struct pollfd *fds, nfds_t numfds, int timeout)
 {
@@ -294,7 +292,7 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
     if (rc < 0)
         return rc;
 
-    for(i = 0; i < (nfds_t) n; i++) {
+    for(i = 0; i < numfds; i++) {
         fds[i].revents = 0;
 
         if (FD_ISSET(fds[i].fd, &read_set))      fds[i].revents |= POLLIN;
@@ -305,5 +303,4 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
     return rc;
 }
 #endif /* HAVE_POLL_H */
-#endif /* CONFIG_FFSERVER */
-
+#endif /* CONFIG_NETWORK */
diff --git a/ffmpeg-mt/libavformat/os_support.h b/ffmpeg-mt/libavformat/os_support.h
index 5c9e81b..dc01e64 100644
--- a/ffmpeg-mt/libavformat/os_support.h
+++ b/ffmpeg-mt/libavformat/os_support.h
@@ -2,20 +2,20 @@
  * various utilities for ffmpeg system
  * copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,7 +55,6 @@ typedef int socklen_t;
 #define closesocket close
 #endif
 
-#if CONFIG_FFSERVER
 #if !HAVE_POLL_H
 typedef unsigned long nfds_t;
 
@@ -82,7 +81,6 @@ struct pollfd {
 
 int poll(struct pollfd *fds, nfds_t numfds, int timeout);
 #endif /* HAVE_POLL_H */
-#endif /* CONFIG_FFSERVER */
 #endif /* CONFIG_NETWORK */
 
 #endif /* AVFORMAT_OS_SUPPORT_H */
diff --git a/ffmpeg-mt/libavformat/output-example.c b/ffmpeg-mt/libavformat/output-example.c
index 06207ed..27db78c 100644
--- a/ffmpeg-mt/libavformat/output-example.c
+++ b/ffmpeg-mt/libavformat/output-example.c
@@ -481,7 +481,7 @@ int main(int argc, char **argv)
         exit(1);
     }
 
-    dump_format(oc, 0, filename, 1);
+    av_dump_format(oc, 0, filename, 1);
 
     /* now that all the parameters are set, we can open the audio and
        video codecs and allocate the necessary encode buffers */
@@ -492,7 +492,7 @@ int main(int argc, char **argv)
 
     /* open the output file, if needed */
     if (!(fmt->flags & AVFMT_NOFILE)) {
-        if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
+        if (avio_open(&oc->pb, filename, AVIO_WRONLY) < 0) {
             fprintf(stderr, "Could not open '%s'\n", filename);
             exit(1);
         }
@@ -545,7 +545,7 @@ int main(int argc, char **argv)
 
     if (!(fmt->flags & AVFMT_NOFILE)) {
         /* close the output file */
-        url_fclose(oc->pb);
+        avio_close(oc->pb);
     }
 
     /* free the stream */
diff --git a/ffmpeg-mt/libavformat/pcm.c b/ffmpeg-mt/libavformat/pcm.c
index 5de23af..26ab142 100644
--- a/ffmpeg-mt/libavformat/pcm.c
+++ b/ffmpeg-mt/libavformat/pcm.c
@@ -2,20 +2,20 @@
  * PCM common functions
  * Copyright (c) 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -49,7 +49,7 @@ int pcm_read_seek(AVFormatContext *s,
 
     /* recompute exact position */
     st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
-    if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
+    if ((ret = avio_seek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
         return ret;
     return 0;
 }
diff --git a/ffmpeg-mt/libavformat/pcm.h b/ffmpeg-mt/libavformat/pcm.h
index 7c0b7d7..228df13 100644
--- a/ffmpeg-mt/libavformat/pcm.h
+++ b/ffmpeg-mt/libavformat/pcm.h
@@ -2,20 +2,20 @@
  * PCM common functions
  * Copyright (C) 2007  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/pcmdec.c b/ffmpeg-mt/libavformat/pcmdec.c
index 26be4f4..a5b8278 100644
--- a/ffmpeg-mt/libavformat/pcmdec.c
+++ b/ffmpeg-mt/libavformat/pcmdec.c
@@ -2,20 +2,20 @@
  * RAW PCM demuxers
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -47,7 +47,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
 }
 
 #define PCMDEF(name, long_name, ext, codec) \
-AVInputFormat pcm_ ## name ## _demuxer = {\
+AVInputFormat ff_pcm_ ## name ## _demuxer = {\
     #name,\
     NULL_IF_CONFIG_SMALL(long_name),\
     0,\
diff --git a/ffmpeg-mt/libavformat/pcmenc.c b/ffmpeg-mt/libavformat/pcmenc.c
index bda94c3..928124e 100644
--- a/ffmpeg-mt/libavformat/pcmenc.c
+++ b/ffmpeg-mt/libavformat/pcmenc.c
@@ -2,20 +2,20 @@
  * RAW PCM muxers
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 #include "rawenc.h"
 
 #define PCMDEF(name, long_name, ext, codec) \
-AVOutputFormat pcm_ ## name ## _muxer = {\
+AVOutputFormat ff_pcm_ ## name ## _muxer = {\
     #name,\
     NULL_IF_CONFIG_SMALL(long_name),\
     NULL,\
diff --git a/ffmpeg-mt/libavformat/psxstr.c b/ffmpeg-mt/libavformat/psxstr.c
index 347c26e..b7a9d3b 100644
--- a/ffmpeg-mt/libavformat/psxstr.c
+++ b/ffmpeg-mt/libavformat/psxstr.c
@@ -2,20 +2,20 @@
  * Sony Playstation (PSX) STR File Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -98,21 +98,21 @@ static int str_probe(AVProbeData *p)
 static int str_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     StrDemuxContext *str = s->priv_data;
     unsigned char sector[RAW_CD_SECTOR_SIZE];
     int start;
     int i;
 
     /* skip over any RIFF header */
-    if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
+    if (avio_read(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
         return AVERROR(EIO);
     if (AV_RL32(&sector[0]) == RIFF_TAG)
         start = RIFF_HEADER_SIZE;
     else
         start = 0;
 
-    url_fseek(pb, start, SEEK_SET);
+    avio_seek(pb, start, SEEK_SET);
 
     for(i=0; i<32; i++){
         str->channels[i].video_stream_index=
@@ -127,7 +127,7 @@ static int str_read_header(AVFormatContext *s,
 static int str_read_packet(AVFormatContext *s,
                            AVPacket *ret_pkt)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     StrDemuxContext *str = s->priv_data;
     unsigned char sector[RAW_CD_SECTOR_SIZE];
     int channel;
@@ -136,7 +136,7 @@ static int str_read_packet(AVFormatContext *s,
 
     while (1) {
 
-        if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
+        if (avio_read(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
             return AVERROR(EIO);
 
         channel = sector[0x11];
@@ -186,7 +186,7 @@ static int str_read_packet(AVFormatContext *s,
                     if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
                         return AVERROR(EIO);
 
-                    pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE;
+                    pkt->pos= avio_tell(pb) - RAW_CD_SECTOR_SIZE;
                     pkt->stream_index =
                         str->channels[channel].video_stream_index;
                 }
@@ -241,7 +241,7 @@ static int str_read_packet(AVFormatContext *s,
             break;
         }
 
-        if (url_feof(pb))
+        if (pb->eof_reached)
             return AVERROR(EIO);
     }
 }
@@ -258,7 +258,7 @@ static int str_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat str_demuxer = {
+AVInputFormat ff_str_demuxer = {
     "psxstr",
     NULL_IF_CONFIG_SMALL("Sony Playstation STR format"),
     sizeof(StrDemuxContext),
diff --git a/ffmpeg-mt/libavformat/pva.c b/ffmpeg-mt/libavformat/pva.c
index abbc6f1..79b959c 100644
--- a/ffmpeg-mt/libavformat/pva.c
+++ b/ffmpeg-mt/libavformat/pva.c
@@ -2,20 +2,20 @@
  * TechnoTrend PVA (.pva) demuxer
  * Copyright (c) 2007, 2008 Ivo van Poorten
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -67,20 +67,20 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
 
 static int read_part_of_packet(AVFormatContext *s, int64_t *pts,
                                int *len, int *strid, int read_packet) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     PVAContext *pvactx = s->priv_data;
     int syncword, streamid, reserved, flags, length, pts_flag;
     int64_t pva_pts = AV_NOPTS_VALUE, startpos;
 
 recover:
-    startpos = url_ftell(pb);
+    startpos = avio_tell(pb);
 
-    syncword = get_be16(pb);
-    streamid = get_byte(pb);
-    get_byte(pb);               /* counter not used */
-    reserved = get_byte(pb);
-    flags    = get_byte(pb);
-    length   = get_be16(pb);
+    syncword = avio_rb16(pb);
+    streamid = avio_r8(pb);
+    avio_r8(pb);               /* counter not used */
+    reserved = avio_r8(pb);
+    flags    = avio_r8(pb);
+    length   = avio_rb16(pb);
 
     pts_flag = flags & 0x10;
 
@@ -101,7 +101,7 @@ recover:
     }
 
     if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) {
-        pva_pts = get_be32(pb);
+        pva_pts = avio_rb32(pb);
         length -= 4;
     } else if (streamid == PVA_AUDIO_PAYLOAD) {
         /* PVA Audio Packets either start with a signaled PES packet or
@@ -113,22 +113,22 @@ recover:
                 pes_flags;
             unsigned char pes_header_data[256];
 
-            pes_signal             = get_be24(pb);
-            get_byte(pb);
-            pes_packet_length      = get_be16(pb);
-            pes_flags              = get_be16(pb);
-            pes_header_data_length = get_byte(pb);
+            pes_signal             = avio_rb24(pb);
+            avio_r8(pb);
+            pes_packet_length      = avio_rb16(pb);
+            pes_flags              = avio_rb16(pb);
+            pes_header_data_length = avio_r8(pb);
 
             if (pes_signal != 1) {
                 pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, "
                                           "trying to recover\n");
-                url_fskip(pb, length - 9);
+                avio_skip(pb, length - 9);
                 if (!read_packet)
                     return AVERROR(EIO);
                 goto recover;
             }
 
-            get_buffer(pb, pes_header_data, pes_header_data_length);
+            avio_read(pb, pes_header_data, pes_header_data_length);
             length -= 9 + pes_header_data_length;
 
             pes_packet_length -= 3 + pes_header_data_length;
@@ -157,7 +157,7 @@ recover:
 }
 
 static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pva_pts;
     int ret, length, streamid;
 
@@ -173,7 +173,7 @@ static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) {
 
 static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
                                           int64_t *pos, int64_t pos_limit) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     PVAContext *pvactx = s->priv_data;
     int length, streamid;
     int64_t res = AV_NOPTS_VALUE;
@@ -182,7 +182,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
 
     while (*pos < pos_limit) {
         res = AV_NOPTS_VALUE;
-        url_fseek(pb, *pos, SEEK_SET);
+        avio_seek(pb, *pos, SEEK_SET);
 
         pvactx->continue_pes = 0;
         if (read_part_of_packet(s, &res, &length, &streamid, 0)) {
@@ -190,7 +190,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
             continue;
         }
         if (streamid - 1 != stream_index || res == AV_NOPTS_VALUE) {
-            *pos = url_ftell(pb) + length;
+            *pos = avio_tell(pb) + length;
             continue;
         }
         break;
@@ -200,7 +200,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
     return res;
 }
 
-AVInputFormat pva_demuxer = {
+AVInputFormat ff_pva_demuxer = {
     "pva",
     NULL_IF_CONFIG_SMALL("TechnoTrend PVA file and stream format"),
     sizeof(PVAContext),
diff --git a/ffmpeg-mt/libavformat/qcp.c b/ffmpeg-mt/libavformat/qcp.c
index 676e9c7..635d531 100644
--- a/ffmpeg-mt/libavformat/qcp.c
+++ b/ffmpeg-mt/libavformat/qcp.c
@@ -2,20 +2,20 @@
  * QCP format (.qcp) demuxer
  * Copyright (c) 2009 Kenan Gillet
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -82,7 +82,7 @@ static int qcp_probe(AVProbeData *pd)
 
 static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     QCPContext    *c  = s->priv_data;
     AVStream      *st = av_new_stream(s, 0);
     uint8_t       buf[16];
@@ -91,13 +91,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
     if (!st)
         return AVERROR(ENOMEM);
 
-    get_be32(pb);                    // "RIFF"
-    s->file_size = get_le32(pb) + 8;
-    url_fskip(pb, 8 + 4 + 1 + 1);    // "QLCMfmt " + chunk-size + major-version + minor-version
+    avio_rb32(pb);                    // "RIFF"
+    s->file_size = avio_rl32(pb) + 8;
+    avio_skip(pb, 8 + 4 + 1 + 1);    // "QLCMfmt " + chunk-size + major-version + minor-version
 
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->channels   = 1;
-    get_buffer(pb, buf, 16);
+    avio_read(pb, buf, 16);
     if (is_qcelp_13k_guid(buf)) {
         st->codec->codec_id = CODEC_ID_QCELP;
     } else if (!memcmp(buf, guid_evrc, 16)) {
@@ -110,39 +110,39 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
         av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n");
         return AVERROR_INVALIDDATA;
     }
-    url_fskip(pb, 2 + 80); // codec-version + codec-name
-    st->codec->bit_rate = get_le16(pb);
+    avio_skip(pb, 2 + 80); // codec-version + codec-name
+    st->codec->bit_rate = avio_rl16(pb);
 
-    s->packet_size = get_le16(pb);
-    url_fskip(pb, 2); // block-size
-    st->codec->sample_rate = get_le16(pb);
-    url_fskip(pb, 2); // sample-size
+    s->packet_size = avio_rl16(pb);
+    avio_skip(pb, 2); // block-size
+    st->codec->sample_rate = avio_rl16(pb);
+    avio_skip(pb, 2); // sample-size
 
     memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode));
-    nb_rates = get_le32(pb);
+    nb_rates = avio_rl32(pb);
     nb_rates = FFMIN(nb_rates, 8);
     for (i=0; i<nb_rates; i++) {
-        int size = get_byte(pb);
-        int mode = get_byte(pb);
+        int size = avio_r8(pb);
+        int mode = avio_r8(pb);
         if (mode > QCP_MAX_MODE) {
             av_log(s, AV_LOG_WARNING, "Unknown entry %d=>%d in rate-map-table.\n ", mode, size);
         } else
             c->rates_per_mode[mode] = size;
     }
-    url_fskip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved
+    avio_skip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved
 
     return 0;
 }
 
 static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     QCPContext    *c  = s->priv_data;
     unsigned int  chunk_size, tag;
 
-    while(!url_feof(pb)) {
+    while(!pb->eof_reached) {
         if (c->data_size) {
-            int pkt_size, ret, mode = get_byte(pb);
+            int pkt_size, ret, mode = avio_r8(pb);
 
             if (s->packet_size) {
                 pkt_size = s->packet_size - 1;
@@ -165,29 +165,29 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
             return ret;
         }
 
-        if (url_ftell(pb) & 1 && get_byte(pb))
+        if (avio_tell(pb) & 1 && avio_r8(pb))
             av_log(s, AV_LOG_WARNING, "Padding should be 0.\n");
 
-        tag        = get_le32(pb);
-        chunk_size = get_le32(pb);
+        tag        = avio_rl32(pb);
+        chunk_size = avio_rl32(pb);
         switch (tag) {
         case MKTAG('v', 'r', 'a', 't'):
-            if (get_le32(pb)) // var-rate-flag
+            if (avio_rl32(pb)) // var-rate-flag
                 s->packet_size = 0;
-            url_fskip(pb, 4); // size-in-packets
+            avio_skip(pb, 4); // size-in-packets
             break;
         case MKTAG('d', 'a', 't', 'a'):
             c->data_size = chunk_size;
             break;
 
         default:
-            url_fskip(pb, chunk_size);
+            avio_skip(pb, chunk_size);
         }
     }
     return AVERROR_EOF;
 }
 
-AVInputFormat qcp_demuxer = {
+AVInputFormat ff_qcp_demuxer = {
     .name           = "qcp",
     .long_name      = NULL_IF_CONFIG_SMALL("QCP format"),
     .priv_data_size = sizeof(QCPContext),
diff --git a/ffmpeg-mt/libavformat/qtpalette.h b/ffmpeg-mt/libavformat/qtpalette.h
index 7d6802f..ecc85d3 100644
--- a/ffmpeg-mt/libavformat/qtpalette.h
+++ b/ffmpeg-mt/libavformat/qtpalette.h
@@ -3,20 +3,20 @@
  *  Automatically generated from a utility derived from XAnim:
  *  http://xanim.va.pubnix.com/home.html
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/r3d.c b/ffmpeg-mt/libavformat/r3d.c
index 556a32b..e815fda 100644
--- a/ffmpeg-mt/libavformat/r3d.c
+++ b/ffmpeg-mt/libavformat/r3d.c
@@ -2,20 +2,20 @@
  * R3D REDCODE demuxer
  * Copyright (c) 2008 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -38,12 +38,12 @@ typedef struct {
 
 static int read_atom(AVFormatContext *s, Atom *atom)
 {
-    atom->offset = url_ftell(s->pb);
-    atom->size = get_be32(s->pb);
+    atom->offset = avio_tell(s->pb);
+    atom->size = avio_rb32(s->pb);
     if (atom->size < 8)
         return -1;
-    atom->tag = get_le32(s->pb);
-    dprintf(s, "atom %d %.4s offset %#llx\n",
+    atom->tag = avio_rl32(s->pb);
+    av_dlog(s, "atom %d %.4s offset %#llx\n",
             atom->size, (char*)&atom->tag, atom->offset);
     return atom->size;
 }
@@ -59,32 +59,32 @@ static int r3d_read_red1(AVFormatContext *s)
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_JPEG2000;
 
-    tmp  = get_byte(s->pb); // major version
-    tmp2 = get_byte(s->pb); // minor version
-    dprintf(s, "version %d.%d\n", tmp, tmp2);
+    tmp  = avio_r8(s->pb); // major version
+    tmp2 = avio_r8(s->pb); // minor version
+    av_dlog(s, "version %d.%d\n", tmp, tmp2);
 
-    tmp = get_be16(s->pb); // unknown
-    dprintf(s, "unknown1 %d\n", tmp);
+    tmp = avio_rb16(s->pb); // unknown
+    av_dlog(s, "unknown1 %d\n", tmp);
 
-    tmp = get_be32(s->pb);
+    tmp = avio_rb32(s->pb);
     av_set_pts_info(st, 32, 1, tmp);
 
-    tmp = get_be32(s->pb); // filenum
-    dprintf(s, "filenum %d\n", tmp);
+    tmp = avio_rb32(s->pb); // filenum
+    av_dlog(s, "filenum %d\n", tmp);
 
-    url_fskip(s->pb, 32); // unknown
+    avio_skip(s->pb, 32); // unknown
 
-    st->codec->width  = get_be32(s->pb);
-    st->codec->height = get_be32(s->pb);
+    st->codec->width  = avio_rb32(s->pb);
+    st->codec->height = avio_rb32(s->pb);
 
-    tmp = get_be16(s->pb); // unknown
-    dprintf(s, "unknown2 %d\n", tmp);
+    tmp = avio_rb16(s->pb); // unknown
+    av_dlog(s, "unknown2 %d\n", tmp);
 
-    st->codec->time_base.den = get_be16(s->pb);
-    st->codec->time_base.num = get_be16(s->pb);
+    st->codec->time_base.den = avio_rb16(s->pb);
+    st->codec->time_base.num = avio_rb16(s->pb);
 
-    tmp = get_byte(s->pb); // audio channels
-    dprintf(s, "audio channels %d\n", tmp);
+    tmp = avio_r8(s->pb); // audio channels
+    av_dlog(s, "audio channels %d\n", tmp);
     if (tmp > 0) {
         AVStream *ast = av_new_stream(s, 1);
         if (!ast)
@@ -95,14 +95,14 @@ static int r3d_read_red1(AVFormatContext *s)
         av_set_pts_info(ast, 32, 1, st->time_base.den);
     }
 
-    get_buffer(s->pb, filename, 257);
+    avio_read(s->pb, filename, 257);
     filename[sizeof(filename)-1] = 0;
     av_metadata_set2(&st->metadata, "filename", filename, 0);
 
-    dprintf(s, "filename %s\n", filename);
-    dprintf(s, "resolution %dx%d\n", st->codec->width, st->codec->height);
-    dprintf(s, "timescale %d\n", st->time_base.den);
-    dprintf(s, "frame rate %d/%d\n",
+    av_dlog(s, "filename %s\n", filename);
+    av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height);
+    av_dlog(s, "timescale %d\n", st->time_base.den);
+    av_dlog(s, "frame rate %d/%d\n",
             st->codec->time_base.num, st->codec->time_base.den);
 
     return 0;
@@ -120,18 +120,18 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
         return AVERROR(ENOMEM);
 
     for (i = 0; i < r3d->video_offsets_count; i++) {
-        r3d->video_offsets[i] = get_be32(s->pb);
+        r3d->video_offsets[i] = avio_rb32(s->pb);
         if (!r3d->video_offsets[i]) {
             r3d->video_offsets_count = i;
             break;
         }
-        dprintf(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);
+        av_dlog(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);
     }
 
     if (st->codec->time_base.den)
         st->duration = (uint64_t)r3d->video_offsets_count*
             st->time_base.den*st->codec->time_base.num/st->codec->time_base.den;
-    dprintf(s, "duration %lld\n", st->duration);
+    av_dlog(s, "duration %lld\n", st->duration);
 
     return 0;
 }
@@ -141,18 +141,18 @@ static void r3d_read_reos(AVFormatContext *s)
     R3DContext *r3d = s->priv_data;
     int tmp;
 
-    r3d->rdvo_offset = get_be32(s->pb);
-    get_be32(s->pb); // rdvs offset
-    get_be32(s->pb); // rdao offset
-    get_be32(s->pb); // rdas offset
+    r3d->rdvo_offset = avio_rb32(s->pb);
+    avio_rb32(s->pb); // rdvs offset
+    avio_rb32(s->pb); // rdao offset
+    avio_rb32(s->pb); // rdas offset
 
-    tmp = get_be32(s->pb);
-    dprintf(s, "num video chunks %d\n", tmp);
+    tmp = avio_rb32(s->pb);
+    av_dlog(s, "num video chunks %d\n", tmp);
 
-    tmp = get_be32(s->pb);
-    dprintf(s, "num audio chunks %d\n", tmp);
+    tmp = avio_rb32(s->pb);
+    av_dlog(s, "num audio chunks %d\n", tmp);
 
-    url_fskip(s->pb, 6*4);
+    avio_skip(s->pb, 6*4);
 }
 
 static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
@@ -175,12 +175,12 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return -1;
     }
 
-    s->data_offset = url_ftell(s->pb);
-    dprintf(s, "data offset %#llx\n", s->data_offset);
-    if (url_is_streamed(s->pb))
+    s->data_offset = avio_tell(s->pb);
+    av_dlog(s, "data offset %#llx\n", s->data_offset);
+    if (!s->pb->seekable)
         return 0;
     // find REOB/REOF/REOS to load index
-    url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET);
+    avio_seek(s->pb, avio_size(s->pb)-48-8, SEEK_SET);
     if (read_atom(s, &atom) < 0)
         av_log(s, AV_LOG_ERROR, "error reading end atom\n");
 
@@ -192,7 +192,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
     r3d_read_reos(s);
 
     if (r3d->rdvo_offset) {
-        url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET);
+        avio_seek(s->pb, r3d->rdvo_offset, SEEK_SET);
         if (read_atom(s, &atom) < 0)
             av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n");
         if (atom.tag == MKTAG('R','D','V','O')) {
@@ -202,7 +202,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
     }
 
  out:
-    url_fseek(s->pb, s->data_offset, SEEK_SET);
+    avio_seek(s->pb, s->data_offset, SEEK_SET);
     return 0;
 }
 
@@ -210,38 +210,38 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
 {
     AVStream *st = s->streams[0];
     int tmp, tmp2;
-    uint64_t pos = url_ftell(s->pb);
+    uint64_t pos = avio_tell(s->pb);
     unsigned dts;
     int ret;
 
-    dts = get_be32(s->pb);
+    dts = avio_rb32(s->pb);
 
-    tmp = get_be32(s->pb);
-    dprintf(s, "frame num %d\n", tmp);
+    tmp = avio_rb32(s->pb);
+    av_dlog(s, "frame num %d\n", tmp);
 
-    tmp  = get_byte(s->pb); // major version
-    tmp2 = get_byte(s->pb); // minor version
-    dprintf(s, "version %d.%d\n", tmp, tmp2);
+    tmp  = avio_r8(s->pb); // major version
+    tmp2 = avio_r8(s->pb); // minor version
+    av_dlog(s, "version %d.%d\n", tmp, tmp2);
 
-    tmp = get_be16(s->pb); // unknown
-    dprintf(s, "unknown %d\n", tmp);
+    tmp = avio_rb16(s->pb); // unknown
+    av_dlog(s, "unknown %d\n", tmp);
 
     if (tmp > 4) {
-        tmp = get_be16(s->pb); // unknown
-        dprintf(s, "unknown %d\n", tmp);
+        tmp = avio_rb16(s->pb); // unknown
+        av_dlog(s, "unknown %d\n", tmp);
 
-        tmp = get_be16(s->pb); // unknown
-        dprintf(s, "unknown %d\n", tmp);
+        tmp = avio_rb16(s->pb); // unknown
+        av_dlog(s, "unknown %d\n", tmp);
 
-        tmp = get_be32(s->pb);
-        dprintf(s, "width %d\n", tmp);
-        tmp = get_be32(s->pb);
-        dprintf(s, "height %d\n", tmp);
+        tmp = avio_rb32(s->pb);
+        av_dlog(s, "width %d\n", tmp);
+        tmp = avio_rb32(s->pb);
+        av_dlog(s, "height %d\n", tmp);
 
-        tmp = get_be32(s->pb);
-        dprintf(s, "metadata len %d\n", tmp);
+        tmp = avio_rb32(s->pb);
+        av_dlog(s, "metadata len %d\n", tmp);
     }
-    tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
+    tmp = atom->size - 8 - (avio_tell(s->pb) - pos);
     if (tmp < 0)
         return -1;
     ret = av_get_packet(s->pb, pkt, tmp);
@@ -255,7 +255,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
     if (st->codec->time_base.den)
         pkt->duration = (uint64_t)st->time_base.den*
             st->codec->time_base.num/st->codec->time_base.den;
-    dprintf(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration);
+    av_dlog(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration);
 
     return 0;
 }
@@ -264,30 +264,30 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
 {
     AVStream *st = s->streams[1];
     int tmp, tmp2, samples, size;
-    uint64_t pos = url_ftell(s->pb);
+    uint64_t pos = avio_tell(s->pb);
     unsigned dts;
     int ret;
 
-    dts = get_be32(s->pb);
+    dts = avio_rb32(s->pb);
 
-    st->codec->sample_rate = get_be32(s->pb);
+    st->codec->sample_rate = avio_rb32(s->pb);
 
-    samples = get_be32(s->pb);
+    samples = avio_rb32(s->pb);
 
-    tmp = get_be32(s->pb);
-    dprintf(s, "packet num %d\n", tmp);
+    tmp = avio_rb32(s->pb);
+    av_dlog(s, "packet num %d\n", tmp);
 
-    tmp = get_be16(s->pb); // unkown
-    dprintf(s, "unknown %d\n", tmp);
+    tmp = avio_rb16(s->pb); // unkown
+    av_dlog(s, "unknown %d\n", tmp);
 
-    tmp  = get_byte(s->pb); // major version
-    tmp2 = get_byte(s->pb); // minor version
-    dprintf(s, "version %d.%d\n", tmp, tmp2);
+    tmp  = avio_r8(s->pb); // major version
+    tmp2 = avio_r8(s->pb); // minor version
+    av_dlog(s, "version %d.%d\n", tmp, tmp2);
 
-    tmp = get_be32(s->pb); // unknown
-    dprintf(s, "unknown %d\n", tmp);
+    tmp = avio_rb32(s->pb); // unknown
+    av_dlog(s, "unknown %d\n", tmp);
 
-    size = atom->size - 8 - (url_ftell(s->pb) - pos);
+    size = atom->size - 8 - (avio_tell(s->pb) - pos);
     if (size < 0)
         return -1;
     ret = av_get_packet(s->pb, pkt, size);
@@ -299,7 +299,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
     pkt->stream_index = 1;
     pkt->dts = dts;
     pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);
-    dprintf(s, "pkt dts %lld duration %d samples %d sample rate %d\n",
+    av_dlog(s, "pkt dts %lld duration %d samples %d sample rate %d\n",
             pkt->dts, pkt->duration, samples, st->codec->sample_rate);
 
     return 0;
@@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
             break;
         default:
         skip:
-            url_fskip(s->pb, atom.size-8);
+            avio_skip(s->pb, atom.size-8);
         }
     }
     return err;
@@ -356,10 +356,10 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
 
     frame_num = sample_time*st->codec->time_base.den/
         ((int64_t)st->codec->time_base.num*st->time_base.den);
-    dprintf(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time);
+    av_dlog(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time);
 
     if (frame_num < r3d->video_offsets_count) {
-        url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET);
+        avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET);
     } else {
         av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);
         return -1;
@@ -377,7 +377,7 @@ static int r3d_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat r3d_demuxer = {
+AVInputFormat ff_r3d_demuxer = {
     "r3d",
     NULL_IF_CONFIG_SMALL("REDCODE R3D format"),
     sizeof(R3DContext),
diff --git a/ffmpeg-mt/libavformat/rawdec.c b/ffmpeg-mt/libavformat/rawdec.c
index fe25014..7df63a1 100644
--- a/ffmpeg-mt/libavformat/rawdec.c
+++ b/ffmpeg-mt/libavformat/rawdec.c
@@ -3,24 +3,25 @@
  * Copyright (c) 2001 Fabrice Bellard
  * Copyright (c) 2005 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
+#include "avio_internal.h"
 #include "rawdec.h"
 
 /* raw input */
@@ -79,9 +80,9 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
     if (av_new_packet(pkt, size) < 0)
         return AVERROR(ENOMEM);
 
-    pkt->pos= url_ftell(s->pb);
+    pkt->pos= avio_tell(s->pb);
     pkt->stream_index = 0;
-    ret = get_partial_buffer(s->pb, pkt->data, size);
+    ret = ffio_read_partial(s->pb, pkt->data, size);
     if (ret < 0) {
         av_free_packet(pkt);
         return ret;
@@ -138,7 +139,7 @@ int ff_raw_video_read_header(AVFormatContext *s,
 /* Note: Do not forget to add new entries to the Makefile as well. */
 
 #if CONFIG_G722_DEMUXER
-AVInputFormat g722_demuxer = {
+AVInputFormat ff_g722_demuxer = {
     "g722",
     NULL_IF_CONFIG_SMALL("raw G.722"),
     0,
@@ -152,7 +153,7 @@ AVInputFormat g722_demuxer = {
 #endif
 
 #if CONFIG_GSM_DEMUXER
-AVInputFormat gsm_demuxer = {
+AVInputFormat ff_gsm_demuxer = {
     "gsm",
     NULL_IF_CONFIG_SMALL("raw GSM"),
     0,
@@ -166,7 +167,7 @@ AVInputFormat gsm_demuxer = {
 #endif
 
 #if CONFIG_MJPEG_DEMUXER
-AVInputFormat mjpeg_demuxer = {
+AVInputFormat ff_mjpeg_demuxer = {
     "mjpeg",
     NULL_IF_CONFIG_SMALL("raw MJPEG video"),
     0,
@@ -180,7 +181,7 @@ AVInputFormat mjpeg_demuxer = {
 #endif
 
 #if CONFIG_MLP_DEMUXER
-AVInputFormat mlp_demuxer = {
+AVInputFormat ff_mlp_demuxer = {
     "mlp",
     NULL_IF_CONFIG_SMALL("raw MLP"),
     0,
@@ -194,7 +195,7 @@ AVInputFormat mlp_demuxer = {
 #endif
 
 #if CONFIG_TRUEHD_DEMUXER
-AVInputFormat truehd_demuxer = {
+AVInputFormat ff_truehd_demuxer = {
     "truehd",
     NULL_IF_CONFIG_SMALL("raw TrueHD"),
     0,
@@ -208,7 +209,7 @@ AVInputFormat truehd_demuxer = {
 #endif
 
 #if CONFIG_SHORTEN_DEMUXER
-AVInputFormat shorten_demuxer = {
+AVInputFormat ff_shorten_demuxer = {
     "shn",
     NULL_IF_CONFIG_SMALL("raw Shorten"),
     0,
@@ -222,7 +223,7 @@ AVInputFormat shorten_demuxer = {
 #endif
 
 #if CONFIG_VC1_DEMUXER
-AVInputFormat vc1_demuxer = {
+AVInputFormat ff_vc1_demuxer = {
     "vc1",
     NULL_IF_CONFIG_SMALL("raw VC-1"),
     0,
diff --git a/ffmpeg-mt/libavformat/rawdec.h b/ffmpeg-mt/libavformat/rawdec.h
index 0b0cf1b..82672b7 100644
--- a/ffmpeg-mt/libavformat/rawdec.h
+++ b/ffmpeg-mt/libavformat/rawdec.h
@@ -2,20 +2,20 @@
  * RAW demuxers
  * Copyright (C) 2007  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rawenc.c b/ffmpeg-mt/libavformat/rawenc.c
index 5a116b1..00e43df 100644
--- a/ffmpeg-mt/libavformat/rawenc.c
+++ b/ffmpeg-mt/libavformat/rawenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2001 Fabrice Bellard
  * Copyright (c) 2005 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,15 +25,15 @@
 
 int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
+    avio_write(s->pb, pkt->data, pkt->size);
+    avio_flush(s->pb);
     return 0;
 }
 
 /* Note: Do not forget to add new entries to the Makefile as well. */
 
 #if CONFIG_AC3_MUXER
-AVOutputFormat ac3_muxer = {
+AVOutputFormat ff_ac3_muxer = {
     "ac3",
     NULL_IF_CONFIG_SMALL("raw AC-3"),
     "audio/x-ac3",
@@ -48,7 +48,7 @@ AVOutputFormat ac3_muxer = {
 #endif
 
 #if CONFIG_DIRAC_MUXER
-AVOutputFormat dirac_muxer = {
+AVOutputFormat ff_dirac_muxer = {
     "dirac",
     NULL_IF_CONFIG_SMALL("raw Dirac"),
     NULL,
@@ -63,7 +63,7 @@ AVOutputFormat dirac_muxer = {
 #endif
 
 #if CONFIG_DNXHD_MUXER
-AVOutputFormat dnxhd_muxer = {
+AVOutputFormat ff_dnxhd_muxer = {
     "dnxhd",
     NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
     NULL,
@@ -78,7 +78,7 @@ AVOutputFormat dnxhd_muxer = {
 #endif
 
 #if CONFIG_DTS_MUXER
-AVOutputFormat dts_muxer = {
+AVOutputFormat ff_dts_muxer = {
     "dts",
     NULL_IF_CONFIG_SMALL("raw DTS"),
     "audio/x-dca",
@@ -93,7 +93,7 @@ AVOutputFormat dts_muxer = {
 #endif
 
 #if CONFIG_EAC3_MUXER
-AVOutputFormat eac3_muxer = {
+AVOutputFormat ff_eac3_muxer = {
     "eac3",
     NULL_IF_CONFIG_SMALL("raw E-AC-3"),
     "audio/x-eac3",
@@ -108,7 +108,7 @@ AVOutputFormat eac3_muxer = {
 #endif
 
 #if CONFIG_G722_MUXER
-AVOutputFormat g722_muxer = {
+AVOutputFormat ff_g722_muxer = {
     "g722",
     NULL_IF_CONFIG_SMALL("raw G.722"),
     "audio/G722",
@@ -123,7 +123,7 @@ AVOutputFormat g722_muxer = {
 #endif
 
 #if CONFIG_H261_MUXER
-AVOutputFormat h261_muxer = {
+AVOutputFormat ff_h261_muxer = {
     "h261",
     NULL_IF_CONFIG_SMALL("raw H.261"),
     "video/x-h261",
@@ -138,7 +138,7 @@ AVOutputFormat h261_muxer = {
 #endif
 
 #if CONFIG_H263_MUXER
-AVOutputFormat h263_muxer = {
+AVOutputFormat ff_h263_muxer = {
     "h263",
     NULL_IF_CONFIG_SMALL("raw H.263"),
     "video/x-h263",
@@ -153,7 +153,7 @@ AVOutputFormat h263_muxer = {
 #endif
 
 #if CONFIG_H264_MUXER
-AVOutputFormat h264_muxer = {
+AVOutputFormat ff_h264_muxer = {
     "h264",
     NULL_IF_CONFIG_SMALL("raw H.264 video format"),
     NULL,
@@ -168,7 +168,7 @@ AVOutputFormat h264_muxer = {
 #endif
 
 #if CONFIG_CAVSVIDEO_MUXER
-AVOutputFormat cavsvideo_muxer = {
+AVOutputFormat ff_cavsvideo_muxer = {
     "cavsvideo",
     NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
     NULL,
@@ -183,7 +183,7 @@ AVOutputFormat cavsvideo_muxer = {
 #endif
 
 #if CONFIG_M4V_MUXER
-AVOutputFormat m4v_muxer = {
+AVOutputFormat ff_m4v_muxer = {
     "m4v",
     NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
     NULL,
@@ -198,7 +198,7 @@ AVOutputFormat m4v_muxer = {
 #endif
 
 #if CONFIG_MJPEG_MUXER
-AVOutputFormat mjpeg_muxer = {
+AVOutputFormat ff_mjpeg_muxer = {
     "mjpeg",
     NULL_IF_CONFIG_SMALL("raw MJPEG video"),
     "video/x-mjpeg",
@@ -213,7 +213,7 @@ AVOutputFormat mjpeg_muxer = {
 #endif
 
 #if CONFIG_MLP_MUXER
-AVOutputFormat mlp_muxer = {
+AVOutputFormat ff_mlp_muxer = {
     "mlp",
     NULL_IF_CONFIG_SMALL("raw MLP"),
     NULL,
@@ -228,7 +228,7 @@ AVOutputFormat mlp_muxer = {
 #endif
 
 #if CONFIG_SRT_MUXER
-AVOutputFormat srt_muxer = {
+AVOutputFormat ff_srt_muxer = {
     .name           = "srt",
     .long_name      = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
     .mime_type      = "application/x-subrip",
@@ -240,7 +240,7 @@ AVOutputFormat srt_muxer = {
 #endif
 
 #if CONFIG_TRUEHD_MUXER
-AVOutputFormat truehd_muxer = {
+AVOutputFormat ff_truehd_muxer = {
     "truehd",
     NULL_IF_CONFIG_SMALL("raw TrueHD"),
     NULL,
@@ -255,7 +255,7 @@ AVOutputFormat truehd_muxer = {
 #endif
 
 #if CONFIG_MPEG1VIDEO_MUXER
-AVOutputFormat mpeg1video_muxer = {
+AVOutputFormat ff_mpeg1video_muxer = {
     "mpeg1video",
     NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
     "video/x-mpeg",
@@ -270,7 +270,7 @@ AVOutputFormat mpeg1video_muxer = {
 #endif
 
 #if CONFIG_MPEG2VIDEO_MUXER
-AVOutputFormat mpeg2video_muxer = {
+AVOutputFormat ff_mpeg2video_muxer = {
     "mpeg2video",
     NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
     NULL,
@@ -285,7 +285,7 @@ AVOutputFormat mpeg2video_muxer = {
 #endif
 
 #if CONFIG_RAWVIDEO_MUXER
-AVOutputFormat rawvideo_muxer = {
+AVOutputFormat ff_rawvideo_muxer = {
     "rawvideo",
     NULL_IF_CONFIG_SMALL("raw video format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/rawenc.h b/ffmpeg-mt/libavformat/rawenc.h
index b552309..daa5489 100644
--- a/ffmpeg-mt/libavformat/rawenc.h
+++ b/ffmpeg-mt/libavformat/rawenc.h
@@ -2,20 +2,20 @@
  * RAW muxers
  * Copyright (C) 2007  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rawvideodec.c b/ffmpeg-mt/libavformat/rawvideodec.c
index da61300..a29f7da 100644
--- a/ffmpeg-mt/libavformat/rawvideodec.c
+++ b/ffmpeg-mt/libavformat/rawvideodec.c
@@ -2,20 +2,20 @@
  * RAW video demuxer
  * Copyright (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -44,7 +44,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat rawvideo_demuxer = {
+AVInputFormat ff_rawvideo_demuxer = {
     "rawvideo",
     NULL_IF_CONFIG_SMALL("raw video format"),
     0,
diff --git a/ffmpeg-mt/libavformat/rdt.c b/ffmpeg-mt/libavformat/rdt.c
index 303a2a8..dfb31d1 100644
--- a/ffmpeg-mt/libavformat/rdt.c
+++ b/ffmpeg-mt/libavformat/rdt.c
@@ -2,20 +2,20 @@
  * Realmedia RTSP protocol (RDT) support.
  * Copyright (c) 2007 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,6 +33,7 @@
 #include "libavutil/md5.h"
 #include "rm.h"
 #include "internal.h"
+#include "avio_internal.h"
 #include "libavcodec/get_bits.h"
 
 struct RDTDemuxContext {
@@ -63,7 +64,7 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx,
     do {
         s->n_streams++;
     } while (first_stream_of_set_idx + s->n_streams < ic->nb_streams &&
-             s->streams[s->n_streams]->priv_data == s->streams[0]->priv_data);
+             s->streams[s->n_streams]->id == s->streams[0]->id);
     s->prev_set_id    = -1;
     s->prev_stream_id = -1;
     s->prev_timestamp = -1;
@@ -76,11 +77,6 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx,
 void
 ff_rdt_parse_close(RDTDemuxContext *s)
 {
-    int i;
-
-    for (i = 1; i < s->n_streams; i++)
-        s->streams[i]->priv_data = NULL;
-
     av_free(s);
 }
 
@@ -135,7 +131,7 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
 static int
 rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
 {
-    ByteIOContext pb;
+    AVIOContext pb;
     int size;
     uint32_t tag;
 
@@ -155,30 +151,30 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
      */
     if (!rdt->mlti_data)
         return -1;
-    init_put_byte(&pb, rdt->mlti_data, rdt->mlti_data_size, 0,
+    ffio_init_context(&pb, rdt->mlti_data, rdt->mlti_data_size, 0,
                   NULL, NULL, NULL, NULL);
-    tag = get_le32(&pb);
+    tag = avio_rl32(&pb);
     if (tag == MKTAG('M', 'L', 'T', 'I')) {
         int num, chunk_nr;
 
         /* read index of MDPR chunk numbers */
-        num = get_be16(&pb);
+        num = avio_rb16(&pb);
         if (rule_nr < 0 || rule_nr >= num)
             return -1;
-        url_fskip(&pb, rule_nr * 2);
-        chunk_nr = get_be16(&pb);
-        url_fskip(&pb, (num - 1 - rule_nr) * 2);
+        avio_skip(&pb, rule_nr * 2);
+        chunk_nr = avio_rb16(&pb);
+        avio_skip(&pb, (num - 1 - rule_nr) * 2);
 
         /* read MDPR chunks */
-        num = get_be16(&pb);
+        num = avio_rb16(&pb);
         if (chunk_nr >= num)
             return -1;
         while (chunk_nr--)
-            url_fskip(&pb, get_be32(&pb));
-        size = get_be32(&pb);
+            avio_skip(&pb, avio_rb32(&pb));
+        size = avio_rb32(&pb);
     } else {
         size = rdt->mlti_data_size;
-        url_fseek(&pb, 0, SEEK_SET);
+        avio_seek(&pb, 0, SEEK_SET);
     }
     if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[st->index], size) < 0)
         return -1;
@@ -300,22 +296,22 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
                   const uint8_t *buf, int len, int flags)
 {
     int seq = 1, res;
-    ByteIOContext pb;
+    AVIOContext pb;
 
     if (rdt->audio_pkt_cnt == 0) {
         int pos;
 
-        init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
+        ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
         flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
         res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
                                   &seq, flags, *timestamp);
-        pos = url_ftell(&pb);
+        pos = avio_tell(&pb);
         if (res < 0)
             return res;
         if (res > 0) {
             if (st->codec->codec_id == CODEC_ID_AAC) {
                 memcpy (rdt->buffer, buf + pos, len - pos);
-                rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0,
+                rdt->rmctx->pb = avio_alloc_context (rdt->buffer, len - pos, 0,
                                                     NULL, NULL, NULL, NULL);
             }
             goto get_cache;
@@ -422,7 +418,7 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index,
         int n, first = -1;
 
         for (n = 0; n < s->nb_streams; n++)
-            if (s->streams[n]->priv_data == stream->priv_data) {
+            if (s->streams[n]->id == stream->id) {
                 int count = s->streams[n]->index + 1;
                 if (first == -1) first = n;
                 if (rdt->nb_rmst < count) {
@@ -463,10 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st)
 {
     AVStream *st;
 
-    if (!(st = av_new_stream(s, 0)))
+    if (!(st = av_new_stream(s, orig_st->id)))
         return NULL;
     st->codec->codec_type = orig_st->codec->codec_type;
-    st->priv_data         = orig_st->priv_data;
     st->first_dts         = orig_st->first_dts;
 
     return st;
@@ -528,7 +523,7 @@ rdt_new_context (void)
 {
     PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
 
-    av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL);
+    av_open_input_stream(&rdt->rmctx, NULL, "", &ff_rdt_demuxer, NULL);
 
     return rdt;
 }
@@ -559,7 +554,7 @@ static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \
     .open             = rdt_new_context, \
     .close            = rdt_free_context, \
     .parse_packet     = rdt_parse_packet \
-};
+}
 
 RDT_HANDLER(live_video, "x-pn-multirate-realvideo-live", AVMEDIA_TYPE_VIDEO);
 RDT_HANDLER(live_audio, "x-pn-multirate-realaudio-live", AVMEDIA_TYPE_AUDIO);
diff --git a/ffmpeg-mt/libavformat/rdt.h b/ffmpeg-mt/libavformat/rdt.h
index 19a4a7b..08b17bc 100644
--- a/ffmpeg-mt/libavformat/rdt.h
+++ b/ffmpeg-mt/libavformat/rdt.h
@@ -2,20 +2,20 @@
  * Realmedia RTSP (RDT) definitions
  * Copyright (c) 2007 Ronald S. Bultje <rbultje at ronald.bitfreak.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/riff.c b/ffmpeg-mt/libavformat/riff.c
index 4edccce..f490b47 100644
--- a/ffmpeg-mt/libavformat/riff.c
+++ b/ffmpeg-mt/libavformat/riff.c
@@ -2,25 +2,26 @@
  * RIFF codec tags
  * Copyright (c) 2000 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavcodec/avcodec.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "riff.h"
 #include "libavcodec/bytestream.h"
 
@@ -298,6 +299,7 @@ const AVCodecTag ff_codec_wav_tags[] = {
     { CODEC_ID_IMC,             0x0401 },
     { CODEC_ID_GSM_MS,          0x1500 },
     { CODEC_ID_TRUESPEECH,      0x1501 },
+    { CODEC_ID_AAC,             0x1600 }, /* ADTS AAC */
     { CODEC_ID_AAC_LATM,        0x1602 },
     { CODEC_ID_AC3,             0x2000 },
     { CODEC_ID_DTS,             0x2001 },
@@ -319,26 +321,26 @@ const AVCodecTag ff_codec_wav_tags[] = {
 };
 
 #if CONFIG_MUXERS
-int64_t ff_start_tag(ByteIOContext *pb, const char *tag)
+int64_t ff_start_tag(AVIOContext *pb, const char *tag)
 {
-    put_tag(pb, tag);
-    put_le32(pb, 0);
-    return url_ftell(pb);
+    ffio_wfourcc(pb, tag);
+    avio_wl32(pb, 0);
+    return avio_tell(pb);
 }
 
-void ff_end_tag(ByteIOContext *pb, int64_t start)
+void ff_end_tag(AVIOContext *pb, int64_t start)
 {
     int64_t pos;
 
-    pos = url_ftell(pb);
-    url_fseek(pb, start - 4, SEEK_SET);
-    put_le32(pb, (uint32_t)(pos - start));
-    url_fseek(pb, pos, SEEK_SET);
+    pos = avio_tell(pb);
+    avio_seek(pb, start - 4, SEEK_SET);
+    avio_wl32(pb, (uint32_t)(pos - start));
+    avio_seek(pb, pos, SEEK_SET);
 }
 
 /* WAVEFORMATEX header */
 /* returns the size or -1 on error */
-int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
+int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
 {
     int bps, blkalign, bytespersec;
     int hdrsize = 18;
@@ -354,12 +356,12 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
                           || av_get_bits_per_sample(enc->codec_id) > 16;
 
     if (waveformatextensible) {
-        put_le16(pb, 0xfffe);
+        avio_wl16(pb, 0xfffe);
     } else {
-        put_le16(pb, enc->codec_tag);
+        avio_wl16(pb, enc->codec_tag);
     }
-    put_le16(pb, enc->channels);
-    put_le32(pb, enc->sample_rate);
+    avio_wl16(pb, enc->channels);
+    avio_wl32(pb, enc->sample_rate);
     if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) {
         bps = 0;
     } else if (enc->codec_id == CODEC_ID_ADPCM_G726) {
@@ -393,9 +395,9 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
     } else {
         bytespersec = enc->bit_rate / 8;
     }
-    put_le32(pb, bytespersec); /* bytes per second */
-    put_le16(pb, blkalign); /* block align */
-    put_le16(pb, bps); /* bits per sample */
+    avio_wl32(pb, bytespersec); /* bytes per second */
+    avio_wl16(pb, blkalign); /* block align */
+    avio_wl16(pb, bps); /* bits per sample */
     if (enc->codec_id == CODEC_ID_MP3) {
         hdrsize += 12;
         bytestream_put_le16(&riff_extradata, 1);    /* wID */
@@ -425,47 +427,47 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
     }
     if(waveformatextensible) {                                    /* write WAVEFORMATEXTENSIBLE extensions */
         hdrsize += 22;
-        put_le16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */
-        put_le16(pb, enc->bits_per_coded_sample);                 /* ValidBitsPerSample || SamplesPerBlock || Reserved */
-        put_le32(pb, enc->channel_layout);                        /* dwChannelMask */
-        put_le32(pb, enc->codec_tag);                             /* GUID + next 3 */
-        put_le32(pb, 0x00100000);
-        put_le32(pb, 0xAA000080);
-        put_le32(pb, 0x719B3800);
+        avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */
+        avio_wl16(pb, enc->bits_per_coded_sample);                 /* ValidBitsPerSample || SamplesPerBlock || Reserved */
+        avio_wl32(pb, enc->channel_layout);                        /* dwChannelMask */
+        avio_wl32(pb, enc->codec_tag);                             /* GUID + next 3 */
+        avio_wl32(pb, 0x00100000);
+        avio_wl32(pb, 0xAA000080);
+        avio_wl32(pb, 0x719B3800);
     } else if(riff_extradata - riff_extradata_start) {
-        put_le16(pb, riff_extradata - riff_extradata_start);
+        avio_wl16(pb, riff_extradata - riff_extradata_start);
     }
-    put_buffer(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
+    avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
     if(hdrsize&1){
         hdrsize++;
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
     }
 
     return hdrsize;
 }
 
 /* BITMAPINFOHEADER header */
-void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf)
+void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf)
 {
-    put_le32(pb, 40 + enc->extradata_size); /* size */
-    put_le32(pb, enc->width);
+    avio_wl32(pb, 40 + enc->extradata_size); /* size */
+    avio_wl32(pb, enc->width);
     //We always store RGB TopDown
-    put_le32(pb, enc->codec_tag ? enc->height : -enc->height);
-    put_le16(pb, 1); /* planes */
+    avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height);
+    avio_wl16(pb, 1); /* planes */
 
-    put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */
+    avio_wl16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */
     /* compression type */
-    put_le32(pb, enc->codec_tag);
-    put_le32(pb, enc->width * enc->height * 3);
-    put_le32(pb, 0);
-    put_le32(pb, 0);
-    put_le32(pb, 0);
-    put_le32(pb, 0);
+    avio_wl32(pb, enc->codec_tag);
+    avio_wl32(pb, enc->width * enc->height * 3);
+    avio_wl32(pb, 0);
+    avio_wl32(pb, 0);
+    avio_wl32(pb, 0);
+    avio_wl32(pb, 0);
 
-    put_buffer(pb, enc->extradata, enc->extradata_size);
+    avio_write(pb, enc->extradata, enc->extradata_size);
 
     if (!for_asf && enc->extradata_size & 1)
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
 }
 #endif //CONFIG_MUXERS
 
@@ -477,43 +479,43 @@ void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag
  * WAVEFORMATEX adds 'WORD  cbSize' and basically makes itself
  * an openended structure.
  */
-void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
+void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
 {
     int id;
 
-    id = get_le16(pb);
+    id = avio_rl16(pb);
     codec->codec_type = AVMEDIA_TYPE_AUDIO;
     codec->codec_tag = id;
-    codec->channels = get_le16(pb);
-    codec->sample_rate = get_le32(pb);
-    codec->bit_rate = get_le32(pb) * 8;
-    codec->block_align = get_le16(pb);
+    codec->channels = avio_rl16(pb);
+    codec->sample_rate = avio_rl32(pb);
+    codec->bit_rate = avio_rl32(pb) * 8;
+    codec->block_align = avio_rl16(pb);
     if (size == 14) {  /* We're dealing with plain vanilla WAVEFORMAT */
         codec->bits_per_coded_sample = 8;
     }else
-        codec->bits_per_coded_sample = get_le16(pb);
+        codec->bits_per_coded_sample = avio_rl16(pb);
     if (size >= 18) {  /* We're obviously dealing with WAVEFORMATEX */
-        int cbSize = get_le16(pb); /* cbSize */
+        int cbSize = avio_rl16(pb); /* cbSize */
         size -= 18;
         cbSize = FFMIN(size, cbSize);
         if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
-            codec->bits_per_coded_sample = get_le16(pb);
-            codec->channel_layout = get_le32(pb); /* dwChannelMask */
-            id = get_le32(pb); /* 4 first bytes of GUID */
-            url_fskip(pb, 12); /* skip end of GUID */
+            codec->bits_per_coded_sample = avio_rl16(pb);
+            codec->channel_layout = avio_rl32(pb); /* dwChannelMask */
+            id = avio_rl32(pb); /* 4 first bytes of GUID */
+            avio_skip(pb, 12); /* skip end of GUID */
             cbSize -= 22;
             size -= 22;
         }
         codec->extradata_size = cbSize;
         if (cbSize > 0) {
             codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-            get_buffer(pb, codec->extradata, codec->extradata_size);
+            avio_read(pb, codec->extradata, codec->extradata_size);
             size -= cbSize;
         }
 
         /* It is possible for the chunk to contain garbage at the end */
         if (size > 0)
-            url_fskip(pb, size);
+            avio_skip(pb, size);
     }
     codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample);
     if (codec->codec_id == CODEC_ID_AAC_LATM) {
@@ -544,20 +546,20 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps)
     return id;
 }
 
-int ff_get_bmp_header(ByteIOContext *pb, AVStream *st)
+int ff_get_bmp_header(AVIOContext *pb, AVStream *st)
 {
     int tag1;
-    get_le32(pb); /* size */
-    st->codec->width = get_le32(pb);
-    st->codec->height = (int32_t)get_le32(pb);
-    get_le16(pb); /* planes */
-    st->codec->bits_per_coded_sample= get_le16(pb); /* depth */
-    tag1 = get_le32(pb);
-    get_le32(pb); /* ImageSize */
-    get_le32(pb); /* XPelsPerMeter */
-    get_le32(pb); /* YPelsPerMeter */
-    get_le32(pb); /* ClrUsed */
-    get_le32(pb); /* ClrImportant */
+    avio_rl32(pb); /* size */
+    st->codec->width = avio_rl32(pb);
+    st->codec->height = (int32_t)avio_rl32(pb);
+    avio_rl16(pb); /* planes */
+    st->codec->bits_per_coded_sample= avio_rl16(pb); /* depth */
+    tag1 = avio_rl32(pb);
+    avio_rl32(pb); /* ImageSize */
+    avio_rl32(pb); /* XPelsPerMeter */
+    avio_rl32(pb); /* YPelsPerMeter */
+    avio_rl32(pb); /* ClrUsed */
+    avio_rl32(pb); /* ClrImportant */
     return tag1;
 }
 #endif // CONFIG_DEMUXERS
diff --git a/ffmpeg-mt/libavformat/riff.h b/ffmpeg-mt/libavformat/riff.h
index 5045abc..1743012 100644
--- a/ffmpeg-mt/libavformat/riff.h
+++ b/ffmpeg-mt/libavformat/riff.h
@@ -2,20 +2,20 @@
  * RIFF codec tags
  * copyright (c) 2000 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,20 +32,20 @@
 #include "avio.h"
 #include "internal.h"
 
-int64_t ff_start_tag(ByteIOContext *pb, const char *tag);
-void ff_end_tag(ByteIOContext *pb, int64_t start);
+int64_t ff_start_tag(AVIOContext *pb, const char *tag);
+void ff_end_tag(AVIOContext *pb, int64_t start);
 
 /**
  * Read BITMAPINFOHEADER structure and set AVStream codec width, height and
  * bits_per_encoded_sample fields. Does not read extradata.
  * @return codec tag
  */
-int ff_get_bmp_header(ByteIOContext *pb, AVStream *st);
+int ff_get_bmp_header(AVIOContext *pb, AVStream *st);
 
-void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf);
-int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc);
+void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf);
+int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc);
 enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps);
-void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size);
+void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size);
 
 extern const AVCodecTag ff_codec_bmp_tags[];
 extern const AVCodecTag ff_codec_wav_tags[];
diff --git a/ffmpeg-mt/libavformat/rl2.c b/ffmpeg-mt/libavformat/rl2.c
index bfffef3..f2d6838 100644
--- a/ffmpeg-mt/libavformat/rl2.c
+++ b/ffmpeg-mt/libavformat/rl2.c
@@ -2,20 +2,20 @@
  * RL2 Format Demuxer
  * Copyright (c) 2008 Sascha Sommer (saschasommer at freenet.de)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -74,7 +74,7 @@ static int rl2_probe(AVProbeData *p)
 static av_cold int rl2_read_header(AVFormatContext *s,
                             AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     unsigned int frame_count;
     unsigned int audio_frame_counter = 0;
@@ -95,21 +95,21 @@ static av_cold int rl2_read_header(AVFormatContext *s,
     int i;
     int ret = 0;
 
-    url_fskip(pb,4);          /* skip FORM tag */
-    back_size = get_le32(pb); /**< get size of the background frame */
-    signature = get_be32(pb);
-    data_size = get_be32(pb);
-    frame_count = get_le32(pb);
+    avio_skip(pb,4);          /* skip FORM tag */
+    back_size = avio_rl32(pb); /**< get size of the background frame */
+    signature = avio_rb32(pb);
+    data_size = avio_rb32(pb);
+    frame_count = avio_rl32(pb);
 
     /* disallow back_sizes and frame_counts that may lead to overflows later */
     if(back_size > INT_MAX/2  || frame_count > INT_MAX / sizeof(uint32_t))
         return AVERROR_INVALIDDATA;
 
-    encoding_method = get_le16(pb);
-    sound_rate = get_le16(pb);
-    rate = get_le16(pb);
-    channels = get_le16(pb);
-    def_sound_size = get_le16(pb);
+    encoding_method = avio_rl16(pb);
+    sound_rate = avio_rl16(pb);
+    rate = avio_rl16(pb);
+    channels = avio_rl16(pb);
+    def_sound_size = avio_rl16(pb);
 
     /** setup video stream */
     st = av_new_stream(s, 0);
@@ -133,7 +133,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
     if(!st->codec->extradata)
         return AVERROR(ENOMEM);
 
-    if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) !=
+    if(avio_read(pb,st->codec->extradata,st->codec->extradata_size) !=
                       st->codec->extradata_size)
         return AVERROR(EIO);
 
@@ -173,11 +173,11 @@ static av_cold int rl2_read_header(AVFormatContext *s,
 
     /** read offset and size tables */
     for(i=0; i < frame_count;i++)
-        chunk_size[i] = get_le32(pb);
+        chunk_size[i] = avio_rl32(pb);
     for(i=0; i < frame_count;i++)
-        chunk_offset[i] = get_le32(pb);
+        chunk_offset[i] = avio_rl32(pb);
     for(i=0; i < frame_count;i++)
-        audio_size[i] = get_le32(pb) & 0xFFFF;
+        audio_size[i] = avio_rl32(pb) & 0xFFFF;
 
     /** build the sample index */
     for(i=0;i<frame_count;i++){
@@ -214,7 +214,7 @@ static int rl2_read_packet(AVFormatContext *s,
                             AVPacket *pkt)
 {
     Rl2DemuxContext *rl2 = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVIndexEntry *sample = NULL;
     int i;
     int ret = 0;
@@ -237,7 +237,7 @@ static int rl2_read_packet(AVFormatContext *s,
     ++rl2->index_pos[stream_id];
 
     /** position the stream (will probably be there anyway) */
-    url_fseek(pb, sample->pos, SEEK_SET);
+    avio_seek(pb, sample->pos, SEEK_SET);
 
     /** fill the packet */
     ret = av_get_packet(pb, pkt, sample->size);
@@ -287,7 +287,7 @@ static int rl2_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-AVInputFormat rl2_demuxer = {
+AVInputFormat ff_rl2_demuxer = {
     "rl2",
     NULL_IF_CONFIG_SMALL("RL2 format"),
     sizeof(Rl2DemuxContext),
diff --git a/ffmpeg-mt/libavformat/rm.c b/ffmpeg-mt/libavformat/rm.c
index f294296..9c0ad4a 100644
--- a/ffmpeg-mt/libavformat/rm.c
+++ b/ffmpeg-mt/libavformat/rm.c
@@ -2,20 +2,20 @@
  * "Real" compatible muxer and demuxer common code.
  * Copyright (c) 2009  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rm.h b/ffmpeg-mt/libavformat/rm.h
index 182fddf..9d104ad 100644
--- a/ffmpeg-mt/libavformat/rm.h
+++ b/ffmpeg-mt/libavformat/rm.h
@@ -2,20 +2,20 @@
  * "Real" compatible muxer and demuxer.
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -35,13 +35,13 @@ RMStream *ff_rm_alloc_rmstream (void);
 void      ff_rm_free_rmstream  (RMStream *rms);
 
 /*< input format for Realmedia-style RTSP streams */
-extern AVInputFormat rdt_demuxer;
+extern AVInputFormat ff_rdt_demuxer;
 
 /**
  * Read the MDPR chunk, which contains stream-specific codec initialization
  * parameters.
  *
- * @param s context containing RMContext and ByteIOContext for stream reading
+ * @param s context containing RMContext and AVIOContext for stream reading
  * @param pb context to read the data from
  * @param st the stream that the MDPR chunk belongs to and where to store the
  *           parameters read from the chunk into
@@ -49,14 +49,14 @@ extern AVInputFormat rdt_demuxer;
  * @param codec_data_size size of the MDPR chunk
  * @return 0 on success, errno codes on error
  */
-int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
+int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
                                AVStream *st, RMStream *rst,
                                int codec_data_size);
 
 /**
  * Parse one rm-stream packet from the input bytestream.
  *
- * @param s context containing RMContext and ByteIOContext for stream reading
+ * @param s context containing RMContext and AVIOContext for stream reading
  * @param pb context to read the data from
  * @param st stream to which the packet to be read belongs
  * @param rst Real-specific stream information
@@ -70,7 +70,7 @@ int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
  *         value >0 means that no data was placed in pkt, but that cached
  *         data is available by calling ff_rm_retrieve_cache().
  */
-int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
+int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
                         AVStream *st, RMStream *rst, int len,
                         AVPacket *pkt, int *seq, int flags, int64_t ts);
 
@@ -82,7 +82,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
  * a positive number, the amount of cached packets. Using this function, each
  * of those packets can be retrieved sequentially.
  *
- * @param s context containing RMContext and ByteIOContext for stream reading
+ * @param s context containing RMContext and AVIOContext for stream reading
  * @param pb context to read the data from
  * @param st stream that this packet belongs to
  * @param rst Real-specific stream information
@@ -90,7 +90,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
  * @return the number of samples left for subsequent calls to this same
  *          function, or 0 if all samples have been retrieved.
  */
-int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
+int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
                           AVStream *st, RMStream *rst, AVPacket *pkt);
 
 /**
diff --git a/ffmpeg-mt/libavformat/rmdec.c b/ffmpeg-mt/libavformat/rmdec.c
index 436a7e0..bcf55fd 100644
--- a/ffmpeg-mt/libavformat/rmdec.c
+++ b/ffmpeg-mt/libavformat/rmdec.c
@@ -2,20 +2,20 @@
  * "Real" compatible demuxer.
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -64,33 +64,33 @@ static const unsigned char sipr_swaps[38][2] = {
 
 const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 };
 
-static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len)
+static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len)
 {
     int i;
     char *q, r;
 
     q = buf;
     for(i=0;i<len;i++) {
-        r = get_byte(pb);
+        r = avio_r8(pb);
         if (i < buf_size - 1)
             *q++ = r;
     }
     if (buf_size > 0) *q = '\0';
 }
 
-static void get_str8(ByteIOContext *pb, char *buf, int buf_size)
+static void get_str8(AVIOContext *pb, char *buf, int buf_size)
 {
-    get_strl(pb, buf, buf_size, get_byte(pb));
+    get_strl(pb, buf, buf_size, avio_r8(pb));
 }
 
-static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned size)
+static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size)
 {
     if (size >= 1<<24)
         return -1;
     avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
     if (!avctx->extradata)
         return AVERROR(ENOMEM);
-    avctx->extradata_size = get_buffer(pb, avctx->extradata, size);
+    avctx->extradata_size = avio_read(pb, avctx->extradata, size);
     memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
     if (avctx->extradata_size != size)
         return AVERROR(EIO);
@@ -102,7 +102,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide)
     char buf[1024];
     int i;
     for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
-        int len = wide ? get_be16(s->pb) : get_byte(s->pb);
+        int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb);
         get_strl(s->pb, buf, sizeof(buf), len);
         av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0);
     }
@@ -120,7 +120,7 @@ void ff_rm_free_rmstream (RMStream *rms)
     av_free_packet(&rms->pkt);
 }
 
-static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
+static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
                                      AVStream *st, RMStream *ast, int read_all)
 {
     char buf[256];
@@ -128,20 +128,20 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
     int ret;
 
     /* ra type header */
-    version = get_be16(pb); /* version */
+    version = avio_rb16(pb); /* version */
     if (version == 3) {
-        int header_size = get_be16(pb);
-        int64_t startpos = url_ftell(pb);
-        url_fskip(pb, 14);
+        int header_size = avio_rb16(pb);
+        int64_t startpos = avio_tell(pb);
+        avio_skip(pb, 14);
         rm_read_metadata(s, 0);
-        if ((startpos + header_size) >= url_ftell(pb) + 2) {
+        if ((startpos + header_size) >= avio_tell(pb) + 2) {
             // fourcc (should always be "lpcJ")
-            get_byte(pb);
+            avio_r8(pb);
             get_str8(pb, buf, sizeof(buf));
         }
         // Skip extra header crap (this should never happen)
-        if ((startpos + header_size) > url_ftell(pb))
-            url_fskip(pb, header_size + startpos - url_ftell(pb));
+        if ((startpos + header_size) > avio_tell(pb))
+            avio_skip(pb, header_size + startpos - avio_tell(pb));
         st->codec->sample_rate = 8000;
         st->codec->channels = 1;
         st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -150,29 +150,29 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
         int flavor, sub_packet_h, coded_framesize, sub_packet_size;
         int codecdata_length;
         /* old version (4) */
-        url_fskip(pb, 2); /* unused */
-        get_be32(pb); /* .ra4 */
-        get_be32(pb); /* data size */
-        get_be16(pb); /* version2 */
-        get_be32(pb); /* header size */
-        flavor= get_be16(pb); /* add codec info / flavor */
-        ast->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */
-        get_be32(pb); /* ??? */
-        get_be32(pb); /* ??? */
-        get_be32(pb); /* ??? */
-        ast->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */
-        st->codec->block_align= get_be16(pb); /* frame size */
-        ast->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */
-        get_be16(pb); /* ??? */
+        avio_skip(pb, 2); /* unused */
+        avio_rb32(pb); /* .ra4 */
+        avio_rb32(pb); /* data size */
+        avio_rb16(pb); /* version2 */
+        avio_rb32(pb); /* header size */
+        flavor= avio_rb16(pb); /* add codec info / flavor */
+        ast->coded_framesize = coded_framesize = avio_rb32(pb); /* coded frame size */
+        avio_rb32(pb); /* ??? */
+        avio_rb32(pb); /* ??? */
+        avio_rb32(pb); /* ??? */
+        ast->sub_packet_h = sub_packet_h = avio_rb16(pb); /* 1 */
+        st->codec->block_align= avio_rb16(pb); /* frame size */
+        ast->sub_packet_size = sub_packet_size = avio_rb16(pb); /* sub packet size */
+        avio_rb16(pb); /* ??? */
         if (version == 5) {
-            get_be16(pb); get_be16(pb); get_be16(pb);
+            avio_rb16(pb); avio_rb16(pb); avio_rb16(pb);
         }
-        st->codec->sample_rate = get_be16(pb);
-        get_be32(pb);
-        st->codec->channels = get_be16(pb);
+        st->codec->sample_rate = avio_rb16(pb);
+        avio_rb32(pb);
+        st->codec->channels = avio_rb16(pb);
         if (version == 5) {
-            get_be32(pb);
-            get_buffer(pb, buf, 4);
+            avio_rb32(pb);
+            avio_read(pb, buf, 4);
             buf[4] = 0;
         } else {
             get_str8(pb, buf, sizeof(buf)); /* desc */
@@ -201,10 +201,10 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
         case CODEC_ID_COOK:
         case CODEC_ID_ATRAC3:
         case CODEC_ID_SIPR:
-            get_be16(pb); get_byte(pb);
+            avio_rb16(pb); avio_r8(pb);
             if (version == 5)
-                get_byte(pb);
-            codecdata_length = get_be32(pb);
+                avio_r8(pb);
+            codecdata_length = avio_rb32(pb);
             if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
                 av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
                 return -1;
@@ -236,16 +236,16 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
             av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h);
             break;
         case CODEC_ID_AAC:
-            get_be16(pb); get_byte(pb);
+            avio_rb16(pb); avio_r8(pb);
             if (version == 5)
-                get_byte(pb);
-            codecdata_length = get_be32(pb);
+                avio_r8(pb);
+            codecdata_length = avio_rb32(pb);
             if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
                 av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
                 return -1;
             }
             if (codecdata_length >= 1) {
-                get_byte(pb);
+                avio_r8(pb);
                 if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0)
                     return ret;
             }
@@ -254,9 +254,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
             av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name));
         }
         if (read_all) {
-            get_byte(pb);
-            get_byte(pb);
-            get_byte(pb);
+            avio_r8(pb);
+            avio_r8(pb);
+            avio_r8(pb);
             rm_read_metadata(s, 0);
         }
     }
@@ -264,7 +264,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
 }
 
 int
-ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
+ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
                            AVStream *st, RMStream *rst, int codec_data_size)
 {
     unsigned int v;
@@ -273,35 +273,35 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
     int ret;
 
     av_set_pts_info(st, 64, 1, 1000);
-    codec_pos = url_ftell(pb);
-    v = get_be32(pb);
+    codec_pos = avio_tell(pb);
+    v = avio_rb32(pb);
     if (v == MKTAG(0xfd, 'a', 'r', '.')) {
         /* ra type header */
         if (rm_read_audio_stream_info(s, pb, st, rst, 0))
             return -1;
     } else {
         int fps, fps2;
-        if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
+        if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) {
         fail1:
             av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
             goto skip;
         }
-        st->codec->codec_tag = get_le32(pb);
+        st->codec->codec_tag = avio_rl32(pb);
         st->codec->codec_id  = ff_codec_get_id(ff_rm_codec_tags,
                                                st->codec->codec_tag);
 //        av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
         if (st->codec->codec_id == CODEC_ID_NONE)
             goto fail1;
-        st->codec->width = get_be16(pb);
-        st->codec->height = get_be16(pb);
+        st->codec->width = avio_rb16(pb);
+        st->codec->height = avio_rb16(pb);
         st->codec->time_base.num= 1;
-        fps= get_be16(pb);
+        fps= avio_rb16(pb);
         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        get_be32(pb);
-        fps2= get_be16(pb);
-        get_be16(pb);
+        avio_rb32(pb);
+        fps2= avio_rb16(pb);
+        avio_rb16(pb);
 
-        if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0)
+        if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
             return ret;
 
 //        av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
@@ -320,8 +320,8 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
 
 skip:
     /* skip codec info */
-    size = url_ftell(pb) - codec_pos;
-    url_fskip(pb, codec_data_size - size);
+    size = avio_tell(pb) - codec_pos;
+    avio_skip(pb, codec_data_size - size);
 
     return 0;
 }
@@ -330,20 +330,20 @@ skip:
  * of the INDX chunk, and will bail out if not. */
 static int rm_read_index(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int size, n_pkts, str_id, next_off, n, pos, pts;
     AVStream *st;
 
     do {
-        if (get_le32(pb) != MKTAG('I','N','D','X'))
+        if (avio_rl32(pb) != MKTAG('I','N','D','X'))
             return -1;
-        size     = get_be32(pb);
+        size     = avio_rb32(pb);
         if (size < 20)
             return -1;
-        url_fskip(pb, 2);
-        n_pkts   = get_be32(pb);
-        str_id   = get_be16(pb);
-        next_off = get_be32(pb);
+        avio_skip(pb, 2);
+        n_pkts   = avio_rb32(pb);
+        str_id   = avio_rb16(pb);
+        next_off = avio_rb32(pb);
         for (n = 0; n < s->nb_streams; n++)
             if (s->streams[n]->id == str_id) {
                 st = s->streams[n];
@@ -353,17 +353,17 @@ static int rm_read_index(AVFormatContext *s)
             goto skip;
 
         for (n = 0; n < n_pkts; n++) {
-            url_fskip(pb, 2);
-            pts = get_be32(pb);
-            pos = get_be32(pb);
-            url_fskip(pb, 4); /* packet no. */
+            avio_skip(pb, 2);
+            pts = avio_rb32(pb);
+            pos = avio_rb32(pb);
+            avio_skip(pb, 4); /* packet no. */
 
             av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME);
         }
 
 skip:
-        if (next_off && url_ftell(pb) != next_off &&
-            url_fseek(pb, next_off, SEEK_SET) < 0)
+        if (next_off && avio_tell(pb) != next_off &&
+            avio_seek(pb, next_off, SEEK_SET) < 0)
             return -1;
     } while (next_off);
 
@@ -387,7 +387,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     RMDemuxContext *rm = s->priv_data;
     AVStream *st;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int tag;
     int tag_size;
     unsigned int start_time, duration;
@@ -395,7 +395,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
     char buf[128];
     int flags = 0;
 
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
     if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
         /* very old .ra format */
         return rm_read_header_old(s, ap);
@@ -403,17 +403,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return AVERROR(EIO);
     }
 
-    get_be32(pb); /* header size */
-    get_be16(pb);
-    get_be32(pb);
-    get_be32(pb); /* number of headers */
+    avio_rb32(pb); /* header size */
+    avio_rb16(pb);
+    avio_rb32(pb);
+    avio_rb32(pb); /* number of headers */
 
     for(;;) {
-        if (url_feof(pb))
+        if (pb->eof_reached)
             return -1;
-        tag = get_le32(pb);
-        tag_size = get_be32(pb);
-        get_be16(pb);
+        tag = avio_rl32(pb);
+        tag_size = avio_rb32(pb);
+        avio_rb16(pb);
 #if 0
         printf("tag=%c%c%c%c (%08x) size=%d\n",
                (tag) & 0xff,
@@ -428,17 +428,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
         switch(tag) {
         case MKTAG('P', 'R', 'O', 'P'):
             /* file header */
-            get_be32(pb); /* max bit rate */
-            get_be32(pb); /* avg bit rate */
-            get_be32(pb); /* max packet size */
-            get_be32(pb); /* avg packet size */
-            get_be32(pb); /* nb packets */
-            get_be32(pb); /* duration */
-            get_be32(pb); /* preroll */
-            indx_off = get_be32(pb); /* index offset */
-            data_off = get_be32(pb); /* data offset */
-            get_be16(pb); /* nb streams */
-            flags = get_be16(pb); /* flags */
+            avio_rb32(pb); /* max bit rate */
+            avio_rb32(pb); /* avg bit rate */
+            avio_rb32(pb); /* max packet size */
+            avio_rb32(pb); /* avg packet size */
+            avio_rb32(pb); /* nb packets */
+            avio_rb32(pb); /* duration */
+            avio_rb32(pb); /* preroll */
+            indx_off = avio_rb32(pb); /* index offset */
+            data_off = avio_rb32(pb); /* data offset */
+            avio_rb16(pb); /* nb streams */
+            flags = avio_rb16(pb); /* flags */
             break;
         case MKTAG('C', 'O', 'N', 'T'):
             rm_read_metadata(s, 1);
@@ -447,14 +447,14 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
             st = av_new_stream(s, 0);
             if (!st)
                 return AVERROR(ENOMEM);
-            st->id = get_be16(pb);
-            get_be32(pb); /* max bit rate */
-            st->codec->bit_rate = get_be32(pb); /* bit rate */
-            get_be32(pb); /* max packet size */
-            get_be32(pb); /* avg packet size */
-            start_time = get_be32(pb); /* start time */
-            get_be32(pb); /* preroll */
-            duration = get_be32(pb); /* duration */
+            st->id = avio_rb16(pb);
+            avio_rb32(pb); /* max bit rate */
+            st->codec->bit_rate = avio_rb32(pb); /* bit rate */
+            avio_rb32(pb); /* max packet size */
+            avio_rb32(pb); /* avg packet size */
+            start_time = avio_rb32(pb); /* start time */
+            avio_rb32(pb); /* preroll */
+            duration = avio_rb32(pb); /* duration */
             st->start_time = start_time;
             st->duration = duration;
             get_str8(pb, buf, sizeof(buf)); /* desc */
@@ -462,45 +462,45 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
             st->codec->codec_type = AVMEDIA_TYPE_DATA;
             st->priv_data = ff_rm_alloc_rmstream();
             if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
-                                          get_be32(pb)) < 0)
+                                          avio_rb32(pb)) < 0)
                 return -1;
             break;
         case MKTAG('D', 'A', 'T', 'A'):
             goto header_end;
         default:
             /* unknown tag: skip it */
-            url_fskip(pb, tag_size - 10);
+            avio_skip(pb, tag_size - 10);
             break;
         }
     }
  header_end:
-    rm->nb_packets = get_be32(pb); /* number of packets */
+    rm->nb_packets = avio_rb32(pb); /* number of packets */
     if (!rm->nb_packets && (flags & 4))
         rm->nb_packets = 3600 * 25;
-    get_be32(pb); /* next data header */
+    avio_rb32(pb); /* next data header */
 
     if (!data_off)
-        data_off = url_ftell(pb) - 18;
-    if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) &&
-        url_fseek(pb, indx_off, SEEK_SET) >= 0) {
+        data_off = avio_tell(pb) - 18;
+    if (indx_off && pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) &&
+        avio_seek(pb, indx_off, SEEK_SET) >= 0) {
         rm_read_index(s);
-        url_fseek(pb, data_off + 18, SEEK_SET);
+        avio_seek(pb, data_off + 18, SEEK_SET);
     }
 
     return 0;
 }
 
-static int get_num(ByteIOContext *pb, int *len)
+static int get_num(AVIOContext *pb, int *len)
 {
     int n, n1;
 
-    n = get_be16(pb);
+    n = avio_rb16(pb);
     (*len)-=2;
     n &= 0x7FFF;
     if (n >= 0x4000) {
         return n - 0x4000;
     } else {
-        n1 = get_be16(pb);
+        n1 = avio_rb16(pb);
         (*len)-=2;
         return (n << 16) | n1;
     }
@@ -511,26 +511,26 @@ static int get_num(ByteIOContext *pb, int *len)
 
 static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){
     RMDemuxContext *rm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     uint32_t state=0xFFFFFFFF;
 
-    while(!url_feof(pb)){
+    while(!pb->eof_reached){
         int len, num, i;
-        *pos= url_ftell(pb) - 3;
+        *pos= avio_tell(pb) - 3;
         if(rm->remaining_len > 0){
             num= rm->current_stream;
             len= rm->remaining_len;
             *timestamp = AV_NOPTS_VALUE;
             *flags= 0;
         }else{
-            state= (state<<8) + get_byte(pb);
+            state= (state<<8) + avio_r8(pb);
 
             if(state == MKBETAG('I', 'N', 'D', 'X')){
                 int n_pkts, expected_len;
-                len = get_be32(pb);
-                url_fskip(pb, 2);
-                n_pkts = get_be32(pb);
+                len = avio_rb32(pb);
+                avio_skip(pb, 2);
+                n_pkts = avio_rb32(pb);
                 expected_len = 20 + n_pkts * 14;
                 if (len == 20)
                     /* some files don't add index entries to chunk size... */
@@ -553,10 +553,10 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
             len=state - 12;
             state= 0xFFFFFFFF;
 
-            num = get_be16(pb);
-            *timestamp = get_be32(pb);
-            get_byte(pb); /* reserved */
-            *flags = get_byte(pb); /* flags */
+            num = avio_rb16(pb);
+            *timestamp = avio_rb32(pb);
+            avio_r8(pb); /* reserved */
+            *flags = avio_r8(pb); /* flags */
         }
         for(i=0;i<s->nb_streams;i++) {
             st = s->streams[i];
@@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
         if (i == s->nb_streams) {
 skip:
             /* skip packet if unknown number */
-            url_fskip(pb, len);
+            avio_skip(pb, len);
             rm->remaining_len = 0;
             continue;
         }
@@ -577,23 +577,23 @@ skip:
     return -1;
 }
 
-static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
+static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
                                    RMDemuxContext *rm, RMStream *vst,
                                    AVPacket *pkt, int len, int *pseq)
 {
     int hdr, seq, pic_num, len2, pos;
     int type;
 
-    hdr = get_byte(pb); len--;
+    hdr = avio_r8(pb); len--;
     type = hdr >> 6;
 
     if(type != 3){  // not frame as a part of packet
-        seq = get_byte(pb); len--;
+        seq = avio_r8(pb); len--;
     }
     if(type != 1){  // not whole frame
         len2 = get_num(pb, &len);
         pos  = get_num(pb, &len);
-        pic_num = get_byte(pb); len--;
+        pic_num = avio_r8(pb); len--;
     }
     if(len<0)
         return -1;
@@ -609,7 +609,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
         pkt->data[0] = 0;
         AV_WL32(pkt->data + 1, 1);
         AV_WL32(pkt->data + 5, 0);
-        get_buffer(pb, pkt->data + 9, len);
+        avio_read(pb, pkt->data + 9, len);
         return 0;
     }
     //now we have to deal with single slice
@@ -624,7 +624,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
         vst->videobufpos = 8*vst->slices + 1;
         vst->cur_slice = 0;
         vst->curpic_num = pic_num;
-        vst->pktpos = url_ftell(pb);
+        vst->pktpos = avio_tell(pb);
     }
     if(type == 2)
         len = FFMIN(len, pos);
@@ -635,7 +635,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
     AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1);
     if(vst->videobufpos + len > vst->videobufsize)
         return 1;
-    if (get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len)
+    if (avio_read(pb, vst->pkt.data + vst->videobufpos, len) != len)
         return AVERROR(EIO);
     vst->videobufpos += len;
     rm->remaining_len-= len;
@@ -700,7 +700,7 @@ void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
 }
 
 int
-ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
+ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
                     AVStream *st, RMStream *ast, int len, AVPacket *pkt,
                     int *seq, int flags, int64_t timestamp)
 {
@@ -730,15 +730,15 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
             switch(st->codec->codec_id) {
                 case CODEC_ID_RA_288:
                     for (x = 0; x < h/2; x++)
-                        get_buffer(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
+                        avio_read(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
                     break;
                 case CODEC_ID_ATRAC3:
                 case CODEC_ID_COOK:
                     for (x = 0; x < w/sps; x++)
-                        get_buffer(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
+                        avio_read(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
                     break;
                 case CODEC_ID_SIPR:
-                    get_buffer(pb, ast->pkt.data + y * w, w);
+                    avio_read(pb, ast->pkt.data + y * w, w);
                     break;
             }
 
@@ -753,10 +753,10 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
         } else if (st->codec->codec_id == CODEC_ID_AAC) {
             int x;
             rm->audio_stream_num = st->index;
-            ast->sub_packet_cnt = (get_be16(pb) & 0xf0) >> 4;
+            ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4;
             if (ast->sub_packet_cnt) {
                 for (x = 0; x < ast->sub_packet_cnt; x++)
-                    ast->sub_packet_lengths[x] = get_be16(pb);
+                    ast->sub_packet_lengths[x] = avio_rb16(pb);
                 rm->audio_pkt_cnt = ast->sub_packet_cnt;
                 ast->audiotimestamp = timestamp;
             } else
@@ -791,7 +791,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
 }
 
 int
-ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
+ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
                       AVStream *st, RMStream *ast, AVPacket *pkt)
 {
     RMDemuxContext *rm = s->priv_data;
@@ -841,14 +841,14 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
                 len = !ast->audio_framesize ? RAW_PACKET_SIZE :
                     ast->coded_framesize * ast->sub_packet_h / 2;
                 flags = (seq++ == 1) ? 2 : 0;
-                pos = url_ftell(s->pb);
+                pos = avio_tell(s->pb);
             } else {
                 len=sync(s, &timestamp, &flags, &i, &pos);
                 if (len > 0)
                     st = s->streams[i];
             }
 
-            if(len<0 || url_feof(s->pb))
+            if(len<0 || s->pb->eof_reached)
                 return AVERROR(EIO);
 
             res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
@@ -904,7 +904,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
     if(rm->old_format)
         return AV_NOPTS_VALUE;
 
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
     rm->remaining_len=0;
     for(;;){
         int seq=1;
@@ -916,9 +916,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
 
         st = s->streams[stream_index2];
         if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            h= get_byte(s->pb); len--;
+            h= avio_r8(s->pb); len--;
             if(!(h & 0x40)){
-                seq = get_byte(s->pb); len--;
+                seq = avio_r8(s->pb); len--;
             }
         }
 
@@ -929,13 +929,13 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
                 break;
         }
 
-        url_fskip(s->pb, len);
+        avio_skip(s->pb, len);
     }
     *ppos = pos;
     return dts;
 }
 
-AVInputFormat rm_demuxer = {
+AVInputFormat ff_rm_demuxer = {
     "rm",
     NULL_IF_CONFIG_SMALL("RealMedia format"),
     sizeof(RMDemuxContext),
@@ -947,7 +947,7 @@ AVInputFormat rm_demuxer = {
     rm_read_dts,
 };
 
-AVInputFormat rdt_demuxer = {
+AVInputFormat ff_rdt_demuxer = {
     "rdt",
     NULL_IF_CONFIG_SMALL("RDT demuxer"),
     sizeof(RMDemuxContext),
diff --git a/ffmpeg-mt/libavformat/rmenc.c b/ffmpeg-mt/libavformat/rmenc.c
index 3b96d13..d64040c 100644
--- a/ffmpeg-mt/libavformat/rmenc.c
+++ b/ffmpeg-mt/libavformat/rmenc.c
@@ -2,23 +2,24 @@
  * "Real" compatible muxer.
  * Copyright (c) 2000, 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "avio_internal.h"
 #include "rm.h"
 
 typedef struct {
@@ -44,19 +45,19 @@ typedef struct {
 #define BUFFER_DURATION 0
 
 
-static void put_str(ByteIOContext *s, const char *tag)
+static void put_str(AVIOContext *s, const char *tag)
 {
-    put_be16(s,strlen(tag));
+    avio_wb16(s,strlen(tag));
     while (*tag) {
-        put_byte(s, *tag++);
+        avio_w8(s, *tag++);
     }
 }
 
-static void put_str8(ByteIOContext *s, const char *tag)
+static void put_str8(AVIOContext *s, const char *tag)
 {
-    put_byte(s, strlen(tag));
+    avio_w8(s, strlen(tag));
     while (*tag) {
-        put_byte(s, *tag++);
+        avio_w8(s, *tag++);
     }
 }
 
@@ -64,7 +65,7 @@ static int rv10_write_header(AVFormatContext *ctx,
                              int data_size, int index_pos)
 {
     RMMuxContext *rm = ctx->priv_data;
-    ByteIOContext *s = ctx->pb;
+    AVIOContext *s = ctx->pb;
     StreamInfo *stream;
     unsigned char *data_offset_ptr, *start_ptr;
     const char *desc, *mimetype;
@@ -74,15 +75,15 @@ static int rv10_write_header(AVFormatContext *ctx,
 
     start_ptr = s->buf_ptr;
 
-    put_tag(s, ".RMF");
-    put_be32(s,18); /* header size */
-    put_be16(s,0);
-    put_be32(s,0);
-    put_be32(s,4 + ctx->nb_streams); /* num headers */
+    ffio_wfourcc(s, ".RMF");
+    avio_wb32(s,18); /* header size */
+    avio_wb16(s,0);
+    avio_wb32(s,0);
+    avio_wb32(s,4 + ctx->nb_streams); /* num headers */
 
-    put_tag(s,"PROP");
-    put_be32(s, 50);
-    put_be16(s, 0);
+    ffio_wfourcc(s,"PROP");
+    avio_wb32(s, 50);
+    avio_wb16(s, 0);
     packet_max_size = 0;
     packet_total_size = 0;
     nb_packets = 0;
@@ -100,37 +101,37 @@ static int rv10_write_header(AVFormatContext *ctx,
         if (v > duration)
             duration = v;
     }
-    put_be32(s, bit_rate); /* max bit rate */
-    put_be32(s, bit_rate); /* avg bit rate */
-    put_be32(s, packet_max_size);        /* max packet size */
+    avio_wb32(s, bit_rate); /* max bit rate */
+    avio_wb32(s, bit_rate); /* avg bit rate */
+    avio_wb32(s, packet_max_size);        /* max packet size */
     if (nb_packets > 0)
         packet_avg_size = packet_total_size / nb_packets;
     else
         packet_avg_size = 0;
-    put_be32(s, packet_avg_size);        /* avg packet size */
-    put_be32(s, nb_packets);  /* num packets */
-    put_be32(s, duration); /* duration */
-    put_be32(s, BUFFER_DURATION);           /* preroll */
-    put_be32(s, index_pos);           /* index offset */
+    avio_wb32(s, packet_avg_size);        /* avg packet size */
+    avio_wb32(s, nb_packets);  /* num packets */
+    avio_wb32(s, duration); /* duration */
+    avio_wb32(s, BUFFER_DURATION);           /* preroll */
+    avio_wb32(s, index_pos);           /* index offset */
     /* computation of data the data offset */
     data_offset_ptr = s->buf_ptr;
-    put_be32(s, 0);           /* data offset : will be patched after */
-    put_be16(s, ctx->nb_streams);    /* num streams */
+    avio_wb32(s, 0);           /* data offset : will be patched after */
+    avio_wb16(s, ctx->nb_streams);    /* num streams */
     flags = 1 | 2; /* save allowed & perfect play */
-    if (url_is_streamed(s))
+    if (!s->seekable)
         flags |= 4; /* live broadcast */
-    put_be16(s, flags);
+    avio_wb16(s, flags);
 
     /* comments */
 
-    put_tag(s,"CONT");
+    ffio_wfourcc(s,"CONT");
     size =  4 * 2 + 10;
     for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
         tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0);
         if(tag) size += strlen(tag->value);
     }
-    put_be32(s,size);
-    put_be16(s,0);
+    avio_wb32(s,size);
+    avio_wb16(s,0);
     for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
         tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0);
         put_str(s, tag ? tag->value : "");
@@ -151,31 +152,31 @@ static int rv10_write_header(AVFormatContext *ctx,
             codec_data_size = 34;
         }
 
-        put_tag(s,"MDPR");
+        ffio_wfourcc(s,"MDPR");
         size = 10 + 9 * 4 + strlen(desc) + strlen(mimetype) + codec_data_size;
-        put_be32(s, size);
-        put_be16(s, 0);
+        avio_wb32(s, size);
+        avio_wb16(s, 0);
 
-        put_be16(s, i); /* stream number */
-        put_be32(s, stream->bit_rate); /* max bit rate */
-        put_be32(s, stream->bit_rate); /* avg bit rate */
-        put_be32(s, stream->packet_max_size);        /* max packet size */
+        avio_wb16(s, i); /* stream number */
+        avio_wb32(s, stream->bit_rate); /* max bit rate */
+        avio_wb32(s, stream->bit_rate); /* avg bit rate */
+        avio_wb32(s, stream->packet_max_size);        /* max packet size */
         if (stream->nb_packets > 0)
             packet_avg_size = stream->packet_total_size /
                 stream->nb_packets;
         else
             packet_avg_size = 0;
-        put_be32(s, packet_avg_size);        /* avg packet size */
-        put_be32(s, 0);           /* start time */
-        put_be32(s, BUFFER_DURATION);           /* preroll */
+        avio_wb32(s, packet_avg_size);        /* avg packet size */
+        avio_wb32(s, 0);           /* start time */
+        avio_wb32(s, BUFFER_DURATION);           /* preroll */
         /* duration */
-        if (url_is_streamed(s) || !stream->total_frames)
-            put_be32(s, (int)(3600 * 1000));
+        if (!s->seekable || !stream->total_frames)
+            avio_wb32(s, (int)(3600 * 1000));
         else
-            put_be32(s, (int)(stream->total_frames * 1000 / stream->frame_rate));
+            avio_wb32(s, (int)(stream->total_frames * 1000 / stream->frame_rate));
         put_str8(s, desc);
         put_str8(s, mimetype);
-        put_be32(s, codec_data_size);
+        avio_wb32(s, codec_data_size);
 
         if (stream->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
             int coded_frame_size, fscode, sample_rate;
@@ -183,13 +184,13 @@ static int rv10_write_header(AVFormatContext *ctx,
             coded_frame_size = (stream->enc->bit_rate *
                                 stream->enc->frame_size) / (8 * sample_rate);
             /* audio codec info */
-            put_tag(s, ".ra");
-            put_byte(s, 0xfd);
-            put_be32(s, 0x00040000); /* version */
-            put_tag(s, ".ra4");
-            put_be32(s, 0x01b53530); /* stream length */
-            put_be16(s, 4); /* unknown */
-            put_be32(s, 0x39); /* header size */
+            avio_write(s, ".ra", 3);
+            avio_w8(s, 0xfd);
+            avio_wb32(s, 0x00040000); /* version */
+            ffio_wfourcc(s, ".ra4");
+            avio_wb32(s, 0x01b53530); /* stream length */
+            avio_wb16(s, 4); /* unknown */
+            avio_wb32(s, 0x39); /* header size */
 
             switch(sample_rate) {
             case 48000:
@@ -208,56 +209,57 @@ static int rv10_write_header(AVFormatContext *ctx,
             case 8000:
                 fscode = 3;
             }
-            put_be16(s, fscode); /* codec additional info, for AC-3, seems
+            avio_wb16(s, fscode); /* codec additional info, for AC-3, seems
                                      to be a frequency code */
             /* special hack to compensate rounding errors... */
             if (coded_frame_size == 557)
                 coded_frame_size--;
-            put_be32(s, coded_frame_size); /* frame length */
-            put_be32(s, 0x51540); /* unknown */
-            put_be32(s, 0x249f0); /* unknown */
-            put_be32(s, 0x249f0); /* unknown */
-            put_be16(s, 0x01);
+            avio_wb32(s, coded_frame_size); /* frame length */
+            avio_wb32(s, 0x51540); /* unknown */
+            avio_wb32(s, 0x249f0); /* unknown */
+            avio_wb32(s, 0x249f0); /* unknown */
+            avio_wb16(s, 0x01);
             /* frame length : seems to be very important */
-            put_be16(s, coded_frame_size);
-            put_be32(s, 0); /* unknown */
-            put_be16(s, stream->enc->sample_rate); /* sample rate */
-            put_be32(s, 0x10); /* unknown */
-            put_be16(s, stream->enc->channels);
+            avio_wb16(s, coded_frame_size);
+            avio_wb32(s, 0); /* unknown */
+            avio_wb16(s, stream->enc->sample_rate); /* sample rate */
+            avio_wb32(s, 0x10); /* unknown */
+            avio_wb16(s, stream->enc->channels);
             put_str8(s, "Int0"); /* codec name */
             if (stream->enc->codec_tag) {
-                put_byte(s, 4); /* tag length */
-                put_le32(s, stream->enc->codec_tag);
+                avio_w8(s, 4); /* tag length */
+                avio_wl32(s, stream->enc->codec_tag);
             } else {
                 av_log(ctx, AV_LOG_ERROR, "Invalid codec tag\n");
                 return -1;
             }
-            put_be16(s, 0); /* title length */
-            put_be16(s, 0); /* author length */
-            put_be16(s, 0); /* copyright length */
-            put_byte(s, 0); /* end of header */
+            avio_wb16(s, 0); /* title length */
+            avio_wb16(s, 0); /* author length */
+            avio_wb16(s, 0); /* copyright length */
+            avio_w8(s, 0); /* end of header */
         } else {
             /* video codec info */
-            put_be32(s,34); /* size */
+            avio_wb32(s,34); /* size */
+            ffio_wfourcc(s, "VIDO");
             if(stream->enc->codec_id == CODEC_ID_RV10)
-                put_tag(s,"VIDORV10");
+                ffio_wfourcc(s,"RV10");
             else
-                put_tag(s,"VIDORV20");
-            put_be16(s, stream->enc->width);
-            put_be16(s, stream->enc->height);
-            put_be16(s, (int) stream->frame_rate); /* frames per seconds ? */
-            put_be32(s,0);     /* unknown meaning */
-            put_be16(s, (int) stream->frame_rate);  /* unknown meaning */
-            put_be32(s,0);     /* unknown meaning */
-            put_be16(s, 8);    /* unknown meaning */
+                ffio_wfourcc(s,"RV20");
+            avio_wb16(s, stream->enc->width);
+            avio_wb16(s, stream->enc->height);
+            avio_wb16(s, (int) stream->frame_rate); /* frames per seconds ? */
+            avio_wb32(s,0);     /* unknown meaning */
+            avio_wb16(s, (int) stream->frame_rate);  /* unknown meaning */
+            avio_wb32(s,0);     /* unknown meaning */
+            avio_wb16(s, 8);    /* unknown meaning */
             /* Seems to be the codec version: only use basic H263. The next
                versions seems to add a diffential DC coding as in
                MPEG... nothing new under the sun */
             if(stream->enc->codec_id == CODEC_ID_RV10)
-                put_be32(s,0x10000000);
+                avio_wb32(s,0x10000000);
             else
-                put_be32(s,0x20103001);
-            //put_be32(s,0x10003000);
+                avio_wb32(s,0x20103001);
+            //avio_wb32(s,0x10003000);
         }
     }
 
@@ -270,12 +272,12 @@ static int rv10_write_header(AVFormatContext *ctx,
     data_offset_ptr[3] = data_pos;
 
     /* data stream */
-    put_tag(s,"DATA");
-    put_be32(s,data_size + 10 + 8);
-    put_be16(s,0);
+    ffio_wfourcc(s, "DATA");
+    avio_wb32(s,data_size + 10 + 8);
+    avio_wb16(s,0);
 
-    put_be32(s, nb_packets); /* number of packets */
-    put_be32(s,0); /* next data header */
+    avio_wb32(s, nb_packets); /* number of packets */
+    avio_wb32(s,0); /* next data header */
     return 0;
 }
 
@@ -283,20 +285,20 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream,
                                 int length, int key_frame)
 {
     int timestamp;
-    ByteIOContext *s = ctx->pb;
+    AVIOContext *s = ctx->pb;
 
     stream->nb_packets++;
     stream->packet_total_size += length;
     if (length > stream->packet_max_size)
         stream->packet_max_size =  length;
 
-    put_be16(s,0); /* version */
-    put_be16(s,length + 12);
-    put_be16(s, stream->num); /* stream number */
+    avio_wb16(s,0); /* version */
+    avio_wb16(s,length + 12);
+    avio_wb16(s, stream->num); /* stream number */
     timestamp = (1000 * (float)stream->nb_frames) / stream->frame_rate;
-    put_be32(s, timestamp); /* timestamp */
-    put_byte(s, 0); /* reserved */
-    put_byte(s, key_frame ? 2 : 0); /* flags */
+    avio_wb32(s, timestamp); /* timestamp */
+    avio_w8(s, 0); /* reserved */
+    avio_w8(s, key_frame ? 2 : 0); /* flags */
 }
 
 static int rm_write_header(AVFormatContext *s)
@@ -339,7 +341,7 @@ static int rm_write_header(AVFormatContext *s)
 
     if (rv10_write_header(s, 0, 0))
         return AVERROR_INVALIDDATA;
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -347,7 +349,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
 {
     uint8_t *buf1;
     RMMuxContext *rm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     StreamInfo *stream = rm->audio_stream;
     int i;
 
@@ -362,11 +364,11 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
             buf1[i] = buf[i+1];
             buf1[i+1] = buf[i];
         }
-        put_buffer(pb, buf1, size);
+        avio_write(pb, buf1, size);
     } else {
-        put_buffer(pb, buf, size);
+        avio_write(pb, buf, size);
     }
-    put_flush_packet(pb);
+    avio_flush(pb);
     stream->nb_frames++;
     av_free(buf1);
     return 0;
@@ -375,7 +377,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
 static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags)
 {
     RMMuxContext *rm = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     StreamInfo *stream = rm->video_stream;
     int key_frame = !!(flags & AV_PKT_FLAG_KEY);
 
@@ -386,32 +388,32 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int
 #if 1
     write_packet_header(s, stream, size + 7 + (size >= 0x4000)*4, key_frame);
     /* bit 7: '1' if final packet of a frame converted in several packets */
-    put_byte(pb, 0x81);
+    avio_w8(pb, 0x81);
     /* bit 7: '1' if I frame. bits 6..0 : sequence number in current
        frame starting from 1 */
     if (key_frame) {
-        put_byte(pb, 0x81);
+        avio_w8(pb, 0x81);
     } else {
-        put_byte(pb, 0x01);
+        avio_w8(pb, 0x01);
     }
     if(size >= 0x4000){
-        put_be32(pb, size); /* total frame size */
-        put_be32(pb, size); /* offset from the start or the end */
+        avio_wb32(pb, size); /* total frame size */
+        avio_wb32(pb, size); /* offset from the start or the end */
     }else{
-        put_be16(pb, 0x4000 | size); /* total frame size */
-        put_be16(pb, 0x4000 | size); /* offset from the start or the end */
+        avio_wb16(pb, 0x4000 | size); /* total frame size */
+        avio_wb16(pb, 0x4000 | size); /* offset from the start or the end */
     }
 #else
     /* full frame */
     write_packet_header(s, size + 6);
-    put_byte(pb, 0xc0);
-    put_be16(pb, 0x4000 + size); /* total frame size */
-    put_be16(pb, 0x4000 + packet_number * 126); /* position in stream */
+    avio_w8(pb, 0xc0);
+    avio_wb16(pb, 0x4000 + size); /* total frame size */
+    avio_wb16(pb, 0x4000 + packet_number * 126); /* position in stream */
 #endif
-    put_byte(pb, stream->nb_frames & 0xff);
+    avio_w8(pb, stream->nb_frames & 0xff);
 
-    put_buffer(pb, buf, size);
-    put_flush_packet(pb);
+    avio_write(pb, buf, size);
+    avio_flush(pb);
 
     stream->nb_frames++;
     return 0;
@@ -430,34 +432,34 @@ static int rm_write_trailer(AVFormatContext *s)
 {
     RMMuxContext *rm = s->priv_data;
     int data_size, index_pos, i;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
         /* end of file: finish to write header */
-        index_pos = url_fseek(pb, 0, SEEK_CUR);
+        index_pos = avio_tell(pb);
         data_size = index_pos - rm->data_pos;
 
         /* FIXME: write index */
 
         /* undocumented end header */
-        put_be32(pb, 0);
-        put_be32(pb, 0);
+        avio_wb32(pb, 0);
+        avio_wb32(pb, 0);
 
-        url_fseek(pb, 0, SEEK_SET);
+        avio_seek(pb, 0, SEEK_SET);
         for(i=0;i<s->nb_streams;i++)
             rm->streams[i].total_frames = rm->streams[i].nb_frames;
         rv10_write_header(s, data_size, 0);
     } else {
         /* undocumented end header */
-        put_be32(pb, 0);
-        put_be32(pb, 0);
+        avio_wb32(pb, 0);
+        avio_wb32(pb, 0);
     }
-    put_flush_packet(pb);
+    avio_flush(pb);
     return 0;
 }
 
 
-AVOutputFormat rm_muxer = {
+AVOutputFormat ff_rm_muxer = {
     "rm",
     NULL_IF_CONFIG_SMALL("RealMedia format"),
     "application/vnd.rn-realmedia",
diff --git a/ffmpeg-mt/libavformat/rpl.c b/ffmpeg-mt/libavformat/rpl.c
index f0fba3e..1ca4a86 100644
--- a/ffmpeg-mt/libavformat/rpl.c
+++ b/ffmpeg-mt/libavformat/rpl.c
@@ -2,20 +2,20 @@
  * ARMovie/RPL demuxer
  * Copyright (c) 2007 Christian Ohm, 2008 Eli Friedman
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -47,11 +47,11 @@ typedef struct RPLContext {
     uint32_t frame_in_part;
 } RPLContext;
 
-static int read_line(ByteIOContext * pb, char* line, int bufsize)
+static int read_line(AVIOContext * pb, char* line, int bufsize)
 {
     int i;
     for (i = 0; i < bufsize - 1; i++) {
-        int b = get_byte(pb);
+        int b = avio_r8(pb);
         if (b == 0)
             break;
         if (b == '\n') {
@@ -76,7 +76,7 @@ static int32_t read_int(const char* line, const char** endptr, int* error)
     return result;
 }
 
-static int32_t read_line_and_int(ByteIOContext * pb, int* error)
+static int32_t read_line_and_int(AVIOContext * pb, int* error)
 {
     char line[RPL_LINE_LENGTH];
     const char *endptr;
@@ -110,7 +110,7 @@ static AVRational read_fps(const char* line, int* error)
 
 static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     RPLContext *rpl = s->priv_data;
     AVStream *vst = NULL, *ast = NULL;
     int total_audio_size;
@@ -250,7 +250,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
     error |= read_line(pb, line, sizeof(line));  // offset to key frame list
 
     // Read the index
-    url_fseek(pb, chunk_catalog_offset, SEEK_SET);
+    avio_seek(pb, chunk_catalog_offset, SEEK_SET);
     total_audio_size = 0;
     for (i = 0; i < number_of_chunks; i++) {
         int64_t offset, video_size, audio_size;
@@ -274,7 +274,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
 static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     RPLContext *rpl = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream* stream;
     AVIndexEntry* index_entry;
     uint32_t ret;
@@ -292,7 +292,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
     index_entry = &stream->index_entries[rpl->chunk_number];
 
     if (rpl->frame_in_part == 0)
-        if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0)
+        if (avio_seek(pb, index_entry->pos, SEEK_SET) < 0)
             return AVERROR(EIO);
 
     if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
@@ -301,9 +301,9 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
         // multiple frames per chunk in Escape 124 samples.
         uint32_t frame_size, frame_flags;
 
-        frame_flags = get_le32(pb);
-        frame_size = get_le32(pb);
-        if (url_fseek(pb, -8, SEEK_CUR) < 0)
+        frame_flags = avio_rl32(pb);
+        frame_size = avio_rl32(pb);
+        if (avio_seek(pb, -8, SEEK_CUR) < 0)
             return AVERROR(EIO);
 
         ret = av_get_packet(pb, pkt, frame_size);
@@ -349,7 +349,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat rpl_demuxer = {
+AVInputFormat ff_rpl_demuxer = {
     "rpl",
     NULL_IF_CONFIG_SMALL("RPL/ARMovie format"),
     sizeof(RPLContext),
diff --git a/ffmpeg-mt/libavformat/rso.c b/ffmpeg-mt/libavformat/rso.c
index 178fd3f..fc39abc 100644
--- a/ffmpeg-mt/libavformat/rso.c
+++ b/ffmpeg-mt/libavformat/rso.c
@@ -2,20 +2,20 @@
  * RSO format common data
  * Copyright (c) 2010 Rafael Carre
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rso.h b/ffmpeg-mt/libavformat/rso.h
index acb0f14..bdb39e8 100644
--- a/ffmpeg-mt/libavformat/rso.h
+++ b/ffmpeg-mt/libavformat/rso.h
@@ -2,20 +2,20 @@
  * RSO format common data
  * Copyright (c) 2010 Rafael Carre
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rsodec.c b/ffmpeg-mt/libavformat/rsodec.c
index e86b8e7..98de8fe 100644
--- a/ffmpeg-mt/libavformat/rsodec.c
+++ b/ffmpeg-mt/libavformat/rsodec.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2001 Fabrice Bellard (original AU code)
  * Copyright (c) 2010 Rafael Carre
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,16 +29,16 @@
 
 static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int id, rate, bps;
     unsigned int size;
     enum CodecID codec;
     AVStream *st;
 
-    id   = get_be16(pb);
-    size = get_be16(pb);
-    rate = get_be16(pb);
-    get_be16(pb);   /* play mode ? (0x0000 = don't loop) */
+    id   = avio_rb16(pb);
+    size = avio_rb16(pb);
+    rate = avio_rb16(pb);
+    avio_rb16(pb);   /* play mode ? (0x0000 = don't loop) */
 
     codec = ff_codec_get_id(ff_codec_rso_tags, id);
 
@@ -88,7 +88,7 @@ static int rso_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat rso_demuxer = {
+AVInputFormat ff_rso_demuxer = {
     .name           =   "rso",
     .long_name      =   NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO format"),
     .extensions     =   "rso",
diff --git a/ffmpeg-mt/libavformat/rsoenc.c b/ffmpeg-mt/libavformat/rsoenc.c
index 5e670f4..338ecf0 100644
--- a/ffmpeg-mt/libavformat/rsoenc.c
+++ b/ffmpeg-mt/libavformat/rsoenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2001 Fabrice Bellard (original AU code)
  * Copyright (c) 2010 Rafael Carre
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,7 +27,7 @@
 
 static int rso_write_header(AVFormatContext *s)
 {
-    ByteIOContext  *pb  = s->pb;
+    AVIOContext  *pb  = s->pb;
     AVCodecContext *enc = s->streams[0]->codec;
 
     if (!enc->codec_tag)
@@ -38,7 +38,7 @@ static int rso_write_header(AVFormatContext *s)
         return AVERROR_INVALIDDATA;
     }
 
-    if (url_is_streamed(s->pb)) {
+    if (!s->pb->seekable) {
         av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n");
         return AVERROR_INVALIDDATA;
     }
@@ -55,29 +55,29 @@ static int rso_write_header(AVFormatContext *s)
     }
 
     /* format header */
-    put_be16(pb, enc->codec_tag);   /* codec ID */
-    put_be16(pb, 0);                /* data size, will be written at EOF */
-    put_be16(pb, enc->sample_rate);
-    put_be16(pb, 0x0000);           /* play mode ? (0x0000 = don't loop) */
+    avio_wb16(pb, enc->codec_tag);   /* codec ID */
+    avio_wb16(pb, 0);                /* data size, will be written at EOF */
+    avio_wb16(pb, enc->sample_rate);
+    avio_wb16(pb, 0x0000);           /* play mode ? (0x0000 = don't loop) */
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
 static int rso_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    put_buffer(s->pb, pkt->data, pkt->size);
+    avio_write(s->pb, pkt->data, pkt->size);
     return 0;
 }
 
 static int rso_write_trailer(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t file_size;
     uint16_t coded_file_size;
 
-    file_size = url_ftell(pb);
+    file_size = avio_tell(pb);
 
     if (file_size < 0)
         return file_size;
@@ -91,16 +91,16 @@ static int rso_write_trailer(AVFormatContext *s)
     }
 
     /* update file size */
-    url_fseek(pb, 2, SEEK_SET);
-    put_be16(pb, coded_file_size);
-    url_fseek(pb, file_size, SEEK_SET);
+    avio_seek(pb, 2, SEEK_SET);
+    avio_wb16(pb, coded_file_size);
+    avio_seek(pb, file_size, SEEK_SET);
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
-AVOutputFormat rso_muxer = {
+AVOutputFormat ff_rso_muxer = {
     .name           =   "rso",
     .long_name      =   NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO format"),
     .extensions     =   "rso",
diff --git a/ffmpeg-mt/libavformat/rtmp.h b/ffmpeg-mt/libavformat/rtmp.h
index b0436c0..45de73e 100644
--- a/ffmpeg-mt/libavformat/rtmp.h
+++ b/ffmpeg-mt/libavformat/rtmp.h
@@ -2,20 +2,20 @@
  * RTMP definitions
  * Copyright (c) 2009 Kostya Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtmppkt.c b/ffmpeg-mt/libavformat/rtmppkt.c
index 58c3abe..63b0628 100644
--- a/ffmpeg-mt/libavformat/rtmppkt.c
+++ b/ffmpeg-mt/libavformat/rtmppkt.c
@@ -2,20 +2,20 @@
  * RTMP input format
  * Copyright (c) 2009 Kostya Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,7 @@
 
 #include "rtmppkt.h"
 #include "flv.h"
+#include "url.h"
 
 void ff_amf_write_bool(uint8_t **dst, int val)
 {
@@ -78,14 +79,14 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
     enum RTMPPacketType type;
     int size = 0;
 
-    if (url_read(h, &hdr, 1) != 1)
+    if (ffurl_read(h, &hdr, 1) != 1)
         return AVERROR(EIO);
     size++;
     channel_id = hdr & 0x3F;
 
     if (channel_id < 2) { //special case for channel number >= 64
         buf[1] = 0;
-        if (url_read_complete(h, buf, channel_id + 1) != channel_id + 1)
+        if (ffurl_read_complete(h, buf, channel_id + 1) != channel_id + 1)
             return AVERROR(EIO);
         size += channel_id + 1;
         channel_id = AV_RL16(buf) + 64;
@@ -98,28 +99,28 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
     if (hdr == RTMP_PS_ONEBYTE) {
         timestamp = prev_pkt[channel_id].ts_delta;
     } else {
-        if (url_read_complete(h, buf, 3) != 3)
+        if (ffurl_read_complete(h, buf, 3) != 3)
             return AVERROR(EIO);
         size += 3;
         timestamp = AV_RB24(buf);
         if (hdr != RTMP_PS_FOURBYTES) {
-            if (url_read_complete(h, buf, 3) != 3)
+            if (ffurl_read_complete(h, buf, 3) != 3)
                 return AVERROR(EIO);
             size += 3;
             data_size = AV_RB24(buf);
-            if (url_read_complete(h, buf, 1) != 1)
+            if (ffurl_read_complete(h, buf, 1) != 1)
                 return AVERROR(EIO);
             size++;
             type = buf[0];
             if (hdr == RTMP_PS_TWELVEBYTES) {
-                if (url_read_complete(h, buf, 4) != 4)
+                if (ffurl_read_complete(h, buf, 4) != 4)
                     return AVERROR(EIO);
                 size += 4;
                 extra = AV_RL32(buf);
             }
         }
         if (timestamp == 0xFFFFFF) {
-            if (url_read_complete(h, buf, 4) != 4)
+            if (ffurl_read_complete(h, buf, 4) != 4)
                 return AVERROR(EIO);
             timestamp = AV_RB32(buf);
         }
@@ -139,7 +140,7 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
     prev_pkt[channel_id].extra      = extra;
     while (data_size > 0) {
         int toread = FFMIN(data_size, chunk_size);
-        if (url_read_complete(h, p->data + offset, toread) != toread) {
+        if (ffurl_read_complete(h, p->data + offset, toread) != toread) {
             ff_rtmp_packet_destroy(p);
             return AVERROR(EIO);
         }
@@ -147,7 +148,7 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
         offset    += chunk_size;
         size      += chunk_size;
         if (data_size > 0) {
-            url_read_complete(h, &t, 1); //marker
+            ffurl_read_complete(h, &t, 1); //marker
             size++;
             if (t != (0xC0 + channel_id))
                 return -1;
@@ -214,15 +215,15 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
     }
     prev_pkt[pkt->channel_id].extra      = pkt->extra;
 
-    url_write(h, pkt_hdr, p-pkt_hdr);
+    ffurl_write(h, pkt_hdr, p-pkt_hdr);
     size = p - pkt_hdr + pkt->data_size;
     while (off < pkt->data_size) {
         int towrite = FFMIN(chunk_size, pkt->data_size - off);
-        url_write(h, pkt->data + off, towrite);
+        ffurl_write(h, pkt->data + off, towrite);
         off += towrite;
         if (off < pkt->data_size) {
             uint8_t marker = 0xC0 | pkt->channel_id;
-            url_write(h, &marker, 1);
+            ffurl_write(h, &marker, 1);
             size++;
         }
     }
diff --git a/ffmpeg-mt/libavformat/rtmppkt.h b/ffmpeg-mt/libavformat/rtmppkt.h
index 431095d..bb34758 100644
--- a/ffmpeg-mt/libavformat/rtmppkt.h
+++ b/ffmpeg-mt/libavformat/rtmppkt.h
@@ -2,20 +2,20 @@
  * RTMP packet utilities
  * Copyright (c) 2009 Kostya Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,6 +23,7 @@
 #define AVFORMAT_RTMPPKT_H
 
 #include "avformat.h"
+#include "url.h"
 
 /** maximum possible number of different RTMP channels */
 #define RTMP_CHANNELS 65599
diff --git a/ffmpeg-mt/libavformat/rtmpproto.c b/ffmpeg-mt/libavformat/rtmpproto.c
index abe8675..9fc5196 100644
--- a/ffmpeg-mt/libavformat/rtmpproto.c
+++ b/ffmpeg-mt/libavformat/rtmpproto.c
@@ -2,20 +2,20 @@
  * RTMP network protocol
  * Copyright (c) 2009 Kostya Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -36,6 +36,7 @@
 #include "flv.h"
 #include "rtmp.h"
 #include "rtmppkt.h"
+#include "url.h"
 
 /* we can't use av_log() with URLContext yet... */
 #if FF_API_URL_CLASS
@@ -485,13 +486,13 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
         tosend[i] = av_lfg_get(&rnd) >> 24;
     client_pos = rtmp_handshake_imprint_with_digest(tosend + 1);
 
-    url_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
-    i = url_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
+    ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
+    i = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
     if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) {
         av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
         return -1;
     }
-    i = url_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE);
+    i = ffurl_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE);
     if (i != RTMP_HANDSHAKE_PACKET_SIZE) {
         av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
         return -1;
@@ -531,9 +532,9 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
                          tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32);
 
         // write reply back to the server
-        url_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE);
+        ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE);
     } else {
-        url_write(rt->stream, serverdata+1, RTMP_HANDSHAKE_PACKET_SIZE);
+        ffurl_write(rt->stream, serverdata+1, RTMP_HANDSHAKE_PACKET_SIZE);
     }
 
     return 0;
@@ -785,7 +786,7 @@ static int rtmp_close(URLContext *h)
         gen_delete_stream(h, rt);
 
     av_freep(&rt->flv_data);
-    url_close(rt->stream);
+    ffurl_close(rt->stream);
     av_free(rt);
     return 0;
 }
@@ -811,7 +812,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
     if (!rt)
         return AVERROR(ENOMEM);
     s->priv_data = rt;
-    rt->is_input = !(flags & URL_WRONLY);
+    rt->is_input = !(flags & AVIO_WRONLY);
 
     av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
                  path, sizeof(path), s->filename);
@@ -820,7 +821,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
         port = RTMP_DEFAULT_PORT;
     ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
 
-    if (url_open(&rt->stream, buf, URL_RDWR) < 0) {
+    if (ffurl_open(&rt->stream, buf, AVIO_RDWR) < 0) {
         av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot open connection %s\n", buf);
         goto fail;
     }
@@ -887,7 +888,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
         rt->flv_off  = 0;
     }
 
-    s->max_packet_size = url_get_max_packet_size(rt->stream);
+    s->max_packet_size = rt->stream->max_packet_size;
     s->is_streamed     = 1;
     return 0;
 
@@ -923,9 +924,9 @@ static int rtmp_read(URLContext *s, uint8_t *buf, int size)
     return orig_size;
 }
 
-static int rtmp_write(URLContext *h, const uint8_t *buf, int size)
+static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
 {
-    RTMPContext *rt = h->priv_data;
+    RTMPContext *rt = s->priv_data;
     int size_temp = size;
     int pktsize, pkttype;
     uint32_t ts;
@@ -989,11 +990,10 @@ static int rtmp_write(URLContext *h, const uint8_t *buf, int size)
     return size;
 }
 
-URLProtocol rtmp_protocol = {
-    "rtmp",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL, /* seek */
-    rtmp_close,
+URLProtocol ff_rtmp_protocol = {
+    .name      = "rtmp",
+    .url_open  = rtmp_open,
+    .url_read  = rtmp_read,
+    .url_write = rtmp_write,
+    .url_close = rtmp_close,
 };
diff --git a/ffmpeg-mt/libavformat/rtp.c b/ffmpeg-mt/libavformat/rtp.c
index 70c5e99..d59b694 100644
--- a/ffmpeg-mt/libavformat/rtp.c
+++ b/ffmpeg-mt/libavformat/rtp.c
@@ -2,20 +2,20 @@
  * RTP input/output format
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtp.h b/ffmpeg-mt/libavformat/rtp.h
index f550ad7..36157ce 100644
--- a/ffmpeg-mt/libavformat/rtp.h
+++ b/ffmpeg-mt/libavformat/rtp.h
@@ -2,20 +2,20 @@
  * RTP definitions
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVFORMAT_RTP_H
diff --git a/ffmpeg-mt/libavformat/rtpdec.c b/ffmpeg-mt/libavformat/rtpdec.c
index 03abb1d..43305a3 100644
--- a/ffmpeg-mt/libavformat/rtpdec.c
+++ b/ffmpeg-mt/libavformat/rtpdec.c
@@ -2,20 +2,20 @@
  * RTP input format
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,6 +25,7 @@
 #include "libavcodec/get_bits.h"
 #include "avformat.h"
 #include "mpegts.h"
+#include "url.h"
 
 #include <unistd.h>
 #include <strings.h>
@@ -41,17 +42,17 @@
          buffer to 'rtp_write_packet' contains all the packets for ONE
          frame. Each packet should have a four byte header containing
          the length in big endian format (same trick as
-         'url_open_dyn_packet_buf')
+         'ffio_open_dyn_packet_buf')
 */
 
-RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = {
+static RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = {
     .enc_name           = "X-MP3-draft-00",
     .codec_type         = AVMEDIA_TYPE_AUDIO,
     .codec_id           = CODEC_ID_MP3ADU,
 };
 
 /* statistics functions */
-RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL;
+static RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL;
 
 void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler)
 {
@@ -237,7 +238,7 @@ static void rtcp_update_jitter(RTPStatistics *s, uint32_t sent_timestamp, uint32
 
 int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
 {
-    ByteIOContext *pb;
+    AVIOContext *pb;
     uint8_t *buf;
     int len;
     int rtcp_bytes;
@@ -264,16 +265,16 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
         return -1;
     s->last_octet_count = s->octet_count;
 
-    if (url_open_dyn_buf(&pb) < 0)
+    if (avio_open_dyn_buf(&pb) < 0)
         return -1;
 
     // Receiver Report
-    put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
-    put_byte(pb, RTCP_RR);
-    put_be16(pb, 7); /* length in words - 1 */
+    avio_w8(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
+    avio_w8(pb, RTCP_RR);
+    avio_wb16(pb, 7); /* length in words - 1 */
     // our own SSRC: we use the server's SSRC + 1 to avoid conflicts
-    put_be32(pb, s->ssrc + 1);
-    put_be32(pb, s->ssrc); // server SSRC
+    avio_wb32(pb, s->ssrc + 1);
+    avio_wb32(pb, s->ssrc); // server SSRC
     // some placeholders we should really fill...
     // RFC 1889/p64
     extended_max= stats->cycles + stats->max_seq;
@@ -290,43 +291,43 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
 
     fraction= (fraction<<24) | lost;
 
-    put_be32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
-    put_be32(pb, extended_max); /* max sequence received */
-    put_be32(pb, stats->jitter>>4); /* jitter */
+    avio_wb32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
+    avio_wb32(pb, extended_max); /* max sequence received */
+    avio_wb32(pb, stats->jitter>>4); /* jitter */
 
     if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE)
     {
-        put_be32(pb, 0); /* last SR timestamp */
-        put_be32(pb, 0); /* delay since last SR */
+        avio_wb32(pb, 0); /* last SR timestamp */
+        avio_wb32(pb, 0); /* delay since last SR */
     } else {
         uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special?
         uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time;
 
-        put_be32(pb, middle_32_bits); /* last SR timestamp */
-        put_be32(pb, delay_since_last); /* delay since last SR */
+        avio_wb32(pb, middle_32_bits); /* last SR timestamp */
+        avio_wb32(pb, delay_since_last); /* delay since last SR */
     }
 
     // CNAME
-    put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
-    put_byte(pb, RTCP_SDES);
+    avio_w8(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
+    avio_w8(pb, RTCP_SDES);
     len = strlen(s->hostname);
-    put_be16(pb, (6 + len + 3) / 4); /* length in words - 1 */
-    put_be32(pb, s->ssrc);
-    put_byte(pb, 0x01);
-    put_byte(pb, len);
-    put_buffer(pb, s->hostname, len);
+    avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */
+    avio_wb32(pb, s->ssrc);
+    avio_w8(pb, 0x01);
+    avio_w8(pb, len);
+    avio_write(pb, s->hostname, len);
     // padding
     for (len = (6 + len) % 4; len % 4; len++) {
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
     }
 
-    put_flush_packet(pb);
-    len = url_close_dyn_buf(pb, &buf);
+    avio_flush(pb);
+    len = avio_close_dyn_buf(pb, &buf);
     if ((len > 0) && buf) {
         int result;
-        dprintf(s->ic, "sending %d bytes of RR\n", len);
-        result= url_write(s->rtp_ctx, buf, len);
-        dprintf(s->ic, "result from url_write: %d\n", result);
+        av_dlog(s->ic, "sending %d bytes of RR\n", len);
+        result= ffurl_write(s->rtp_ctx, buf, len);
+        av_dlog(s->ic, "result from ffurl_write: %d\n", result);
         av_free(buf);
     }
     return 0;
@@ -334,39 +335,39 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
 
 void rtp_send_punch_packets(URLContext* rtp_handle)
 {
-    ByteIOContext *pb;
+    AVIOContext *pb;
     uint8_t *buf;
     int len;
 
     /* Send a small RTP packet */
-    if (url_open_dyn_buf(&pb) < 0)
+    if (avio_open_dyn_buf(&pb) < 0)
         return;
 
-    put_byte(pb, (RTP_VERSION << 6));
-    put_byte(pb, 0); /* Payload type */
-    put_be16(pb, 0); /* Seq */
-    put_be32(pb, 0); /* Timestamp */
-    put_be32(pb, 0); /* SSRC */
+    avio_w8(pb, (RTP_VERSION << 6));
+    avio_w8(pb, 0); /* Payload type */
+    avio_wb16(pb, 0); /* Seq */
+    avio_wb32(pb, 0); /* Timestamp */
+    avio_wb32(pb, 0); /* SSRC */
 
-    put_flush_packet(pb);
-    len = url_close_dyn_buf(pb, &buf);
+    avio_flush(pb);
+    len = avio_close_dyn_buf(pb, &buf);
     if ((len > 0) && buf)
-        url_write(rtp_handle, buf, len);
+        ffurl_write(rtp_handle, buf, len);
     av_free(buf);
 
     /* Send a minimal RTCP RR */
-    if (url_open_dyn_buf(&pb) < 0)
+    if (avio_open_dyn_buf(&pb) < 0)
         return;
 
-    put_byte(pb, (RTP_VERSION << 6));
-    put_byte(pb, RTCP_RR); /* receiver report */
-    put_be16(pb, 1); /* length in words - 1 */
-    put_be32(pb, 0); /* our own SSRC */
+    avio_w8(pb, (RTP_VERSION << 6));
+    avio_w8(pb, RTCP_RR); /* receiver report */
+    avio_wb16(pb, 1); /* length in words - 1 */
+    avio_wb32(pb, 0); /* our own SSRC */
 
-    put_flush_packet(pb);
-    len = url_close_dyn_buf(pb, &buf);
+    avio_flush(pb);
+    len = avio_close_dyn_buf(pb, &buf);
     if ((len > 0) && buf)
-        url_write(rtp_handle, buf, len);
+        ffurl_write(rtp_handle, buf, len);
     av_free(buf);
 }
 
diff --git a/ffmpeg-mt/libavformat/rtpdec.h b/ffmpeg-mt/libavformat/rtpdec.h
index c5a5217..da53efc 100644
--- a/ffmpeg-mt/libavformat/rtpdec.h
+++ b/ffmpeg-mt/libavformat/rtpdec.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2002 Fabrice Bellard
  * Copyright (c) 2006 Ryan Martell <rdm4 at martellventures.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVFORMAT_RTPDEC_H
@@ -25,6 +25,7 @@
 #include "libavcodec/avcodec.h"
 #include "avformat.h"
 #include "rtp.h"
+#include "url.h"
 
 typedef struct PayloadContext PayloadContext;
 typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
@@ -189,7 +190,6 @@ struct RTPDemuxContext {
     int max_frames_per_packet;
 };
 
-extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
 void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler);
 RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
                                                   enum AVMediaType codec_type);
diff --git a/ffmpeg-mt/libavformat/rtpdec_amr.c b/ffmpeg-mt/libavformat/rtpdec_amr.c
index 016d216..802e7c1 100644
--- a/ffmpeg-mt/libavformat/rtpdec_amr.c
+++ b/ffmpeg-mt/libavformat/rtpdec_amr.c
@@ -2,20 +2,20 @@
  * RTP AMR Depacketizer, RFC 3267
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpdec_asf.c b/ffmpeg-mt/libavformat/rtpdec_asf.c
index e31a825..a8326cf 100644
--- a/ffmpeg-mt/libavformat/rtpdec_asf.c
+++ b/ffmpeg-mt/libavformat/rtpdec_asf.c
@@ -2,20 +2,20 @@
  * Microsoft RTP/ASF support.
  * Copyright (c) 2008 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -32,6 +32,7 @@
 #include "rtpdec_formats.h"
 #include "rtsp.h"
 #include "asf.h"
+#include "avio_internal.h"
 
 /**
  * From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not
@@ -72,7 +73,7 @@ static int rtp_asf_fix_header(uint8_t *buf, int len)
 }
 
 /**
- * The following code is basically a buffered ByteIOContext,
+ * The following code is basically a buffered AVIOContext,
  * with the added benefit of returning -EAGAIN (instead of 0)
  * on packet boundaries, such that the ASF demuxer can return
  * safely and resume business at the next packet.
@@ -82,9 +83,9 @@ static int packetizer_read(void *opaque, uint8_t *buf, int buf_size)
     return AVERROR(EAGAIN);
 }
 
-static void init_packetizer(ByteIOContext *pb, uint8_t *buf, int len)
+static void init_packetizer(AVIOContext *pb, uint8_t *buf, int len)
 {
-    init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL);
+    ffio_init_context(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL);
 
     /* this "fills" the buffer with its current content */
     pb->pos     = len;
@@ -95,7 +96,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
 {
     int ret = 0;
     if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
-        ByteIOContext pb;
+        AVIOContext pb;
         RTSPState *rt = s->priv_data;
         int len = strlen(p) * 6 / 8;
         char *buf = av_mallocz(len);
@@ -109,11 +110,11 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
             av_close_input_stream(rt->asf_ctx);
             rt->asf_ctx = NULL;
         }
-        ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL);
+        ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &ff_asf_demuxer, NULL);
         if (ret < 0)
             return ret;
         av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0);
-        rt->asf_pb_pos = url_ftell(&pb);
+        rt->asf_pb_pos = avio_tell(&pb);
         av_free(buf);
         rt->asf_ctx->pb = NULL;
     }
@@ -147,7 +148,7 @@ static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
 }
 
 struct PayloadContext {
-    ByteIOContext *pktbuf, pb;
+    AVIOContext *pktbuf, pb;
     uint8_t *buf;
 };
 
@@ -161,7 +162,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
                                uint32_t *timestamp,
                                const uint8_t *buf, int len, int flags)
 {
-    ByteIOContext *pb = &asf->pb;
+    AVIOContext *pb = &asf->pb;
     int res, mflags, len_off;
     RTSPState *rt = s->priv_data;
 
@@ -176,22 +177,22 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
 
         av_freep(&asf->buf);
 
-        init_put_byte(pb, buf, len, 0, NULL, NULL, NULL, NULL);
+        ffio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL);
 
-        while (url_ftell(pb) + 4 < len) {
-            int start_off = url_ftell(pb);
+        while (avio_tell(pb) + 4 < len) {
+            int start_off = avio_tell(pb);
 
-            mflags = get_byte(pb);
+            mflags = avio_r8(pb);
             if (mflags & 0x80)
                 flags |= RTP_FLAG_KEY;
-            len_off = get_be24(pb);
+            len_off = avio_rb24(pb);
             if (mflags & 0x20)   /**< relative timestamp */
-                url_fskip(pb, 4);
+                avio_skip(pb, 4);
             if (mflags & 0x10)   /**< has duration */
-                url_fskip(pb, 4);
+                avio_skip(pb, 4);
             if (mflags & 0x8)    /**< has location ID */
-                url_fskip(pb, 4);
-            off = url_ftell(pb);
+                avio_skip(pb, 4);
+            off = avio_tell(pb);
 
             if (!(mflags & 0x40)) {
                 /**
@@ -200,23 +201,23 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
                  * ASF packet. This is used to spread one ASF packet over
                  * multiple RTP packets.
                  */
-                if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) {
+                if (asf->pktbuf && len_off != avio_tell(asf->pktbuf)) {
                     uint8_t *p;
-                    url_close_dyn_buf(asf->pktbuf, &p);
+                    avio_close_dyn_buf(asf->pktbuf, &p);
                     asf->pktbuf = NULL;
                     av_free(p);
                 }
                 if (!len_off && !asf->pktbuf &&
-                    (res = url_open_dyn_buf(&asf->pktbuf)) < 0)
+                    (res = avio_open_dyn_buf(&asf->pktbuf)) < 0)
                     return res;
                 if (!asf->pktbuf)
                     return AVERROR(EIO);
 
-                put_buffer(asf->pktbuf, buf + off, len - off);
-                url_fskip(pb, len - off);
+                avio_write(asf->pktbuf, buf + off, len - off);
+                avio_skip(pb, len - off);
                 if (!(flags & RTP_FLAG_MARKER))
                     return -1;
-                out_len     = url_close_dyn_buf(asf->pktbuf, &asf->buf);
+                out_len     = avio_close_dyn_buf(asf->pktbuf, &asf->buf);
                 asf->pktbuf = NULL;
             } else {
                 /**
@@ -233,7 +234,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
                 asf->buf = av_realloc(asf->buf, out_len);
                 memcpy(asf->buf + prev_len, buf + off,
                        FFMIN(cur_len, len - off));
-                url_fskip(pb, cur_len);
+                avio_skip(pb, cur_len);
             }
         }
 
@@ -247,7 +248,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
         int i;
 
         res = av_read_packet(rt->asf_ctx, pkt);
-        rt->asf_pb_pos = url_ftell(pb);
+        rt->asf_pb_pos = avio_tell(pb);
         if (res != 0)
             break;
         for (i = 0; i < s->nb_streams; i++) {
@@ -271,7 +272,7 @@ static void asfrtp_free_context(PayloadContext *asf)
 {
     if (asf->pktbuf) {
         uint8_t *p = NULL;
-        url_close_dyn_buf(asf->pktbuf, &p);
+        avio_close_dyn_buf(asf->pktbuf, &p);
         asf->pktbuf = NULL;
         av_free(p);
     }
@@ -288,7 +289,7 @@ RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
     .open             = asfrtp_new_context, \
     .close            = asfrtp_free_context, \
     .parse_packet     = asfrtp_parse_packet,   \
-};
+}
 
 RTP_ASF_HANDLER(asf_pfv, "x-asf-pf",  AVMEDIA_TYPE_VIDEO);
 RTP_ASF_HANDLER(asf_pfa, "x-asf-pf",  AVMEDIA_TYPE_AUDIO);
diff --git a/ffmpeg-mt/libavformat/rtpdec_formats.h b/ffmpeg-mt/libavformat/rtpdec_formats.h
index 16f5a9d..708c299 100644
--- a/ffmpeg-mt/libavformat/rtpdec_formats.h
+++ b/ffmpeg-mt/libavformat/rtpdec_formats.h
@@ -2,20 +2,20 @@
  * RTP depacketizer declarations
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpdec_h263.c b/ffmpeg-mt/libavformat/rtpdec_h263.c
index ea42fff..0fb1b25 100644
--- a/ffmpeg-mt/libavformat/rtpdec_h263.c
+++ b/ffmpeg-mt/libavformat/rtpdec_h263.c
@@ -2,20 +2,20 @@
  * RTP H.263 Depacketizer, RFC 4629
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpdec_h264.c b/ffmpeg-mt/libavformat/rtpdec_h264.c
index 75db14c..4c9b8ba 100644
--- a/ffmpeg-mt/libavformat/rtpdec_h264.c
+++ b/ffmpeg-mt/libavformat/rtpdec_h264.c
@@ -2,20 +2,20 @@
  * RTP H264 Protocol (RFC3984)
  * Copyright (c) 2006 Ryan Martell
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpdec_latm.c b/ffmpeg-mt/libavformat/rtpdec_latm.c
index 8ed42a7..5bf4c19 100644
--- a/ffmpeg-mt/libavformat/rtpdec_latm.c
+++ b/ffmpeg-mt/libavformat/rtpdec_latm.c
@@ -2,20 +2,20 @@
  * RTP Depacketization of MP4A-LATM, RFC 3016
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,7 +26,7 @@
 #include <strings.h>
 
 struct PayloadContext {
-    ByteIOContext *dyn_buf;
+    AVIOContext *dyn_buf;
     uint8_t *buf;
     int pos, len;
     uint32_t timestamp;
@@ -43,7 +43,7 @@ static void latm_free_context(PayloadContext *data)
         return;
     if (data->dyn_buf) {
         uint8_t *p;
-        url_close_dyn_buf(data->dyn_buf, &p);
+        avio_close_dyn_buf(data->dyn_buf, &p);
         av_free(p);
     }
     av_free(data->buf);
@@ -60,20 +60,20 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
         if (!data->dyn_buf || data->timestamp != *timestamp) {
             av_freep(&data->buf);
             if (data->dyn_buf)
-                url_close_dyn_buf(data->dyn_buf, &data->buf);
+                avio_close_dyn_buf(data->dyn_buf, &data->buf);
             data->dyn_buf = NULL;
             av_freep(&data->buf);
 
             data->timestamp = *timestamp;
-            if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0)
+            if ((ret = avio_open_dyn_buf(&data->dyn_buf)) < 0)
                 return ret;
         }
-        put_buffer(data->dyn_buf, buf, len);
+        avio_write(data->dyn_buf, buf, len);
 
         if (!(flags & RTP_FLAG_MARKER))
             return AVERROR(EAGAIN);
         av_free(data->buf);
-        data->len = url_close_dyn_buf(data->dyn_buf, &data->buf);
+        data->len = avio_close_dyn_buf(data->dyn_buf, &data->buf);
         data->dyn_buf = NULL;
         data->pos = 0;
     }
diff --git a/ffmpeg-mt/libavformat/rtpdec_mpeg4.c b/ffmpeg-mt/libavformat/rtpdec_mpeg4.c
index 137dbd2..9f2fcb3 100644
--- a/ffmpeg-mt/libavformat/rtpdec_mpeg4.c
+++ b/ffmpeg-mt/libavformat/rtpdec_mpeg4.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2010 Fabrice Bellard
  *                    Romain Degez
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -111,8 +111,7 @@ static int parse_fmtp_config(AVCodecContext * codec, char *value)
 {
     /* decode the hexa encoded parameter */
     int len = ff_hex_to_data(NULL, value);
-    if (codec->extradata)
-        av_free(codec->extradata);
+    av_free(codec->extradata);
     codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
     if (!codec->extradata)
         return AVERROR(ENOMEM);
diff --git a/ffmpeg-mt/libavformat/rtpdec_qcelp.c b/ffmpeg-mt/libavformat/rtpdec_qcelp.c
index ceae504..cc16ec1 100644
--- a/ffmpeg-mt/libavformat/rtpdec_qcelp.c
+++ b/ffmpeg-mt/libavformat/rtpdec_qcelp.c
@@ -2,20 +2,20 @@
  * RTP Depacketization of QCELP/PureVoice, RFC 2658
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpdec_qdm2.c b/ffmpeg-mt/libavformat/rtpdec_qdm2.c
index aa94b1f..0d744be 100644
--- a/ffmpeg-mt/libavformat/rtpdec_qdm2.c
+++ b/ffmpeg-mt/libavformat/rtpdec_qdm2.c
@@ -2,20 +2,20 @@
  * QDesign Music 2 (QDM2) payload for RTP
  * Copyright (c) 2010 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpdec_qt.c b/ffmpeg-mt/libavformat/rtpdec_qt.c
index 5cca076..a295ba7 100644
--- a/ffmpeg-mt/libavformat/rtpdec_qt.c
+++ b/ffmpeg-mt/libavformat/rtpdec_qt.c
@@ -2,20 +2,20 @@
  * RTP/Quicktime support.
  * Copyright (c) 2009 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,6 +26,7 @@
  */
 
 #include "avformat.h"
+#include "avio_internal.h"
 #include "rtp.h"
 #include "rtpdec.h"
 #include "isom.h"
@@ -42,7 +43,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
                                uint32_t *timestamp, const uint8_t *buf,
                                int len, int flags)
 {
-    ByteIOContext pb;
+    AVIOContext pb;
     GetBitContext gb;
     int packing_scheme, has_payload_desc, has_packet_info, alen,
         has_marker_bit = flags & RTP_FLAG_MARKER;
@@ -69,7 +70,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
      * http://developer.apple.com/quicktime/icefloe/dispatch026.html
      */
     init_get_bits(&gb, buf, len << 3);
-    init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
+    ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
 
     if (len < 4)
         return AVERROR_INVALIDDATA;
@@ -97,27 +98,27 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
         if (!is_start || !is_finish) {
             av_log_missing_feature(s, "RTP-X-QT with payload description "
                                       "split over several packets", 1);
-            return AVERROR_NOTSUPP;
+            return AVERROR(ENOSYS);
         }
         skip_bits(&gb, 12); // reserved
         data_len = get_bits(&gb, 16);
 
-        url_fseek(&pb, pos + 4, SEEK_SET);
-        tag = get_le32(&pb);
-        if ((st->codec->codec_type == CODEC_TYPE_VIDEO &&
+        avio_seek(&pb, pos + 4, SEEK_SET);
+        tag = avio_rl32(&pb);
+        if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
                  tag != MKTAG('v','i','d','e')) ||
-            (st->codec->codec_type == CODEC_TYPE_AUDIO &&
+            (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
                  tag != MKTAG('s','o','u','n')))
             return AVERROR_INVALIDDATA;
-        av_set_pts_info(st, 32, 1, get_be32(&pb));
+        av_set_pts_info(st, 32, 1, avio_rb32(&pb));
 
         if (pos + data_len > len)
             return AVERROR_INVALIDDATA;
         /* TLVs */
-        while (url_ftell(&pb) + 4 < pos + data_len) {
-            int tlv_len = get_be16(&pb);
-            tag = get_le16(&pb);
-            if (url_ftell(&pb) + tlv_len > pos + data_len)
+        while (avio_tell(&pb) + 4 < pos + data_len) {
+            int tlv_len = avio_rb16(&pb);
+            tag = avio_rl16(&pb);
+            if (avio_tell(&pb) + tlv_len > pos + data_len)
                 return AVERROR_INVALIDDATA;
 
 #define MKTAG16(a,b) MKTAG(a,b,0,0)
@@ -148,22 +149,22 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
                 break;
             }
             default:
-                url_fskip(&pb, tlv_len);
+                avio_skip(&pb, tlv_len);
                 break;
             }
         }
 
         /* 32-bit alignment */
-        url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb));
+        avio_skip(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb));
     } else
-        url_fseek(&pb, 4, SEEK_SET);
+        avio_seek(&pb, 4, SEEK_SET);
 
     if (has_packet_info) {
         av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1);
-        return AVERROR_NOTSUPP;
+        return AVERROR(ENOSYS);
     }
 
-    alen = len - url_ftell(&pb);
+    alen = len - avio_tell(&pb);
     if (alen <= 0)
         return AVERROR_INVALIDDATA;
 
@@ -181,7 +182,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
         }
         if (!qt->pkt.data)
             return AVERROR(ENOMEM);
-        memcpy(qt->pkt.data + qt->pkt.size, buf + url_ftell(&pb), alen);
+        memcpy(qt->pkt.data + qt->pkt.size, buf + avio_tell(&pb), alen);
         qt->pkt.size += alen;
         if (has_marker_bit) {
             *pkt = qt->pkt;
@@ -202,7 +203,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
         qt->remaining = (alen / qt->bytes_per_frame) - 1;
         if (av_new_packet(pkt, qt->bytes_per_frame))
             return AVERROR(ENOMEM);
-        memcpy(pkt->data, buf + url_ftell(&pb), qt->bytes_per_frame);
+        memcpy(pkt->data, buf + avio_tell(&pb), qt->bytes_per_frame);
         pkt->flags = flags & RTP_FLAG_KEY ? AV_PKT_FLAG_KEY : 0;
         pkt->stream_index = st->index;
         if (qt->remaining > 0) {
@@ -214,7 +215,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
             }
             qt->pkt.size = qt->remaining * qt->bytes_per_frame;
             memcpy(qt->pkt.data,
-                   buf + url_ftell(&pb) + qt->bytes_per_frame,
+                   buf + avio_tell(&pb) + qt->bytes_per_frame,
                    qt->remaining * qt->bytes_per_frame);
             qt->pkt.flags = pkt->flags;
             return 1;
@@ -223,7 +224,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
 
     default:  /* unimplemented */
         av_log_missing_feature(NULL, "RTP-X-QT with packing scheme 2", 1);
-        return AVERROR_NOTSUPP;
+        return AVERROR(ENOSYS);
     }
 }
 
@@ -246,9 +247,9 @@ RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \
     .open             = qt_rtp_new,    \
     .close            = qt_rtp_free,   \
     .parse_packet     = qt_rtp_parse_packet, \
-};
+}
 
-RTP_QT_HANDLER(qt,        vid, "X-QT",        CODEC_TYPE_VIDEO);
-RTP_QT_HANDLER(qt,        aud, "X-QT",        CODEC_TYPE_AUDIO);
-RTP_QT_HANDLER(quicktime, vid, "X-QUICKTIME", CODEC_TYPE_VIDEO);
-RTP_QT_HANDLER(quicktime, aud, "X-QUICKTIME", CODEC_TYPE_AUDIO);
+RTP_QT_HANDLER(qt,        vid, "X-QT",        AVMEDIA_TYPE_VIDEO);
+RTP_QT_HANDLER(qt,        aud, "X-QT",        AVMEDIA_TYPE_AUDIO);
+RTP_QT_HANDLER(quicktime, vid, "X-QUICKTIME", AVMEDIA_TYPE_VIDEO);
+RTP_QT_HANDLER(quicktime, aud, "X-QUICKTIME", AVMEDIA_TYPE_AUDIO);
diff --git a/ffmpeg-mt/libavformat/rtpdec_svq3.c b/ffmpeg-mt/libavformat/rtpdec_svq3.c
index 79a5775..8c09262 100644
--- a/ffmpeg-mt/libavformat/rtpdec_svq3.c
+++ b/ffmpeg-mt/libavformat/rtpdec_svq3.c
@@ -2,20 +2,20 @@
  * Sorenson-3 (SVQ3/SV3V) payload for RTP
  * Copyright (c) 2010 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -33,7 +33,7 @@
 #include "rtpdec_formats.h"
 
 struct PayloadContext {
-    ByteIOContext *pktbuf;
+    AVIOContext *pktbuf;
     int64_t        timestamp;
 };
 
@@ -83,10 +83,10 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
 
         if (sv->pktbuf) {
             uint8_t *tmp;
-            url_close_dyn_buf(sv->pktbuf, &tmp);
+            avio_close_dyn_buf(sv->pktbuf, &tmp);
             av_free(tmp);
         }
-        if ((res = url_open_dyn_buf(&sv->pktbuf)) < 0)
+        if ((res = avio_open_dyn_buf(&sv->pktbuf)) < 0)
             return res;
         sv->timestamp   = *timestamp;
     }
@@ -94,13 +94,13 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
     if (!sv->pktbuf)
         return AVERROR_INVALIDDATA;
 
-    put_buffer(sv->pktbuf, buf, len);
+    avio_write(sv->pktbuf, buf, len);
 
     if (end_packet) {
         av_init_packet(pkt);
         pkt->stream_index = st->index;
         *timestamp        = sv->timestamp;
-        pkt->size         = url_close_dyn_buf(sv->pktbuf, &pkt->data);
+        pkt->size         = avio_close_dyn_buf(sv->pktbuf, &pkt->data);
         pkt->destruct     = av_destruct_packet;
         sv->pktbuf        = NULL;
         return 0;
@@ -118,7 +118,7 @@ static void svq3_extradata_free(PayloadContext *sv)
 {
     if (sv->pktbuf) {
         uint8_t *buf;
-        url_close_dyn_buf(sv->pktbuf, &buf);
+        avio_close_dyn_buf(sv->pktbuf, &buf);
         av_free(buf);
     }
     av_free(sv);
diff --git a/ffmpeg-mt/libavformat/rtpdec_vp8.c b/ffmpeg-mt/libavformat/rtpdec_vp8.c
index b18017b..9e50cc4 100644
--- a/ffmpeg-mt/libavformat/rtpdec_vp8.c
+++ b/ffmpeg-mt/libavformat/rtpdec_vp8.c
@@ -2,20 +2,20 @@
  * RTP VP8 Depacketizer
  * Copyright (c) 2010 Josh Allmann
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,7 +31,7 @@
 #include "rtpdec_formats.h"
 
 struct PayloadContext {
-    ByteIOContext *data;
+    AVIOContext *data;
     uint32_t       timestamp;
     int is_keyframe;
 };
@@ -41,7 +41,7 @@ static void prepare_packet(AVPacket *pkt, PayloadContext *vp8, int stream)
     av_init_packet(pkt);
     pkt->stream_index = stream;
     pkt->flags        = vp8->is_keyframe ? AV_PKT_FLAG_KEY : 0;
-    pkt->size         = url_close_dyn_buf(vp8->data, &pkt->data);
+    pkt->size         = avio_close_dyn_buf(vp8->data, &pkt->data);
     pkt->destruct     = av_destruct_packet;
     vp8->data         = NULL;
 }
@@ -85,7 +85,7 @@ static int vp8_handle_packet(AVFormatContext *ctx,
             // that for the next av_get_packet call
             ret = end_packet ? 1 : 0;
         }
-        if ((res = url_open_dyn_buf(&vp8->data)) < 0)
+        if ((res = avio_open_dyn_buf(&vp8->data)) < 0)
             return res;
         vp8->is_keyframe = *buf & 1;
         vp8->timestamp   = ts;
@@ -111,7 +111,7 @@ static int vp8_handle_packet(AVFormatContext *ctx,
             }
         }
 
-        put_buffer(vp8->data, buf, au_len);
+        avio_write(vp8->data, buf, au_len);
         buf += au_len;
         len -= au_len;
     }
@@ -138,7 +138,7 @@ static void vp8_free_context(PayloadContext *vp8)
 {
     if (vp8->data) {
         uint8_t *tmp;
-        url_close_dyn_buf(vp8->data, &tmp);
+        avio_close_dyn_buf(vp8->data, &tmp);
         av_free(tmp);
     }
     av_free(vp8);
diff --git a/ffmpeg-mt/libavformat/rtpdec_xiph.c b/ffmpeg-mt/libavformat/rtpdec_xiph.c
index fe17a42..4d8e834 100644
--- a/ffmpeg-mt/libavformat/rtpdec_xiph.c
+++ b/ffmpeg-mt/libavformat/rtpdec_xiph.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Colin McQuillian
  * Copyright (c) 2010 Josh Allmann
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -42,7 +42,7 @@
 struct PayloadContext {
     unsigned ident;             ///< 24-bit stream configuration identifier
     uint32_t timestamp;
-    ByteIOContext* fragment;    ///< buffer for split payloads
+    AVIOContext* fragment;    ///< buffer for split payloads
     uint8_t *split_buf;
     int split_pos, split_buf_len, split_buf_size;
     int split_pkts;
@@ -57,7 +57,7 @@ static inline void free_fragment_if_needed(PayloadContext * data)
 {
     if (data->fragment) {
         uint8_t* p;
-        url_close_dyn_buf(data->fragment, &p);
+        avio_close_dyn_buf(data->fragment, &p);
         av_free(p);
         data->fragment = NULL;
     }
@@ -176,10 +176,10 @@ static int xiph_handle_packet(AVFormatContext * ctx,
         // end packet has been lost somewhere, so drop buffered data
         free_fragment_if_needed(data);
 
-        if((res = url_open_dyn_buf(&data->fragment)) < 0)
+        if((res = avio_open_dyn_buf(&data->fragment)) < 0)
             return res;
 
-        put_buffer(data->fragment, buf, pkt_len);
+        avio_write(data->fragment, buf, pkt_len);
         data->timestamp = *timestamp;
 
     } else {
@@ -198,12 +198,12 @@ static int xiph_handle_packet(AVFormatContext * ctx,
         }
 
         // copy data to fragment buffer
-        put_buffer(data->fragment, buf, pkt_len);
+        avio_write(data->fragment, buf, pkt_len);
 
         if (fragmented == 3) {
             // end of xiph data packet
             av_init_packet(pkt);
-            pkt->size = url_close_dyn_buf(data->fragment, &pkt->data);
+            pkt->size = avio_close_dyn_buf(data->fragment, &pkt->data);
 
             if (pkt->size < 0) {
                 av_log(ctx, AV_LOG_ERROR,
diff --git a/ffmpeg-mt/libavformat/rtpenc.c b/ffmpeg-mt/libavformat/rtpenc.c
index d5f0b38..7cedff3 100644
--- a/ffmpeg-mt/libavformat/rtpenc.c
+++ b/ffmpeg-mt/libavformat/rtpenc.c
@@ -2,20 +2,20 @@
  * RTP output format
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -93,7 +93,7 @@ static int rtp_write_header(AVFormatContext *s1)
         s->first_rtcp_ntp_time = (s1->start_time_realtime / 1000) * 1000 +
                                  NTP_OFFSET_US;
 
-    max_packet_size = url_fget_max_packet_size(s1->pb);
+    max_packet_size = s1->pb->max_packet_size;
     if (max_packet_size <= 12)
         return AVERROR(EIO);
     s->buf = av_malloc(max_packet_size);
@@ -192,21 +192,21 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
     RTPMuxContext *s = s1->priv_data;
     uint32_t rtp_ts;
 
-    dprintf(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp);
+    av_dlog(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp);
 
     s->last_rtcp_ntp_time = ntp_time;
     rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000},
                           s1->streams[0]->time_base) + s->base_timestamp;
-    put_byte(s1->pb, (RTP_VERSION << 6));
-    put_byte(s1->pb, RTCP_SR);
-    put_be16(s1->pb, 6); /* length in words - 1 */
-    put_be32(s1->pb, s->ssrc);
-    put_be32(s1->pb, ntp_time / 1000000);
-    put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
-    put_be32(s1->pb, rtp_ts);
-    put_be32(s1->pb, s->packet_count);
-    put_be32(s1->pb, s->octet_count);
-    put_flush_packet(s1->pb);
+    avio_w8(s1->pb, (RTP_VERSION << 6));
+    avio_w8(s1->pb, RTCP_SR);
+    avio_wb16(s1->pb, 6); /* length in words - 1 */
+    avio_wb32(s1->pb, s->ssrc);
+    avio_wb32(s1->pb, ntp_time / 1000000);
+    avio_wb32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
+    avio_wb32(s1->pb, rtp_ts);
+    avio_wb32(s1->pb, s->packet_count);
+    avio_wb32(s1->pb, s->octet_count);
+    avio_flush(s1->pb);
 }
 
 /* send an rtp packet. sequence number is incremented, but the caller
@@ -215,17 +215,17 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
 {
     RTPMuxContext *s = s1->priv_data;
 
-    dprintf(s1, "rtp_send_data size=%d\n", len);
+    av_dlog(s1, "rtp_send_data size=%d\n", len);
 
     /* build the RTP header */
-    put_byte(s1->pb, (RTP_VERSION << 6));
-    put_byte(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
-    put_be16(s1->pb, s->seq);
-    put_be32(s1->pb, s->timestamp);
-    put_be32(s1->pb, s->ssrc);
+    avio_w8(s1->pb, (RTP_VERSION << 6));
+    avio_w8(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
+    avio_wb16(s1->pb, s->seq);
+    avio_wb32(s1->pb, s->timestamp);
+    avio_wb32(s1->pb, s->ssrc);
 
-    put_buffer(s1->pb, buf1, len);
-    put_flush_packet(s1->pb);
+    avio_write(s1->pb, buf1, len);
+    avio_flush(s1->pb);
 
     s->seq++;
     s->octet_count += len;
@@ -364,7 +364,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
     int rtcp_bytes;
     int size= pkt->size;
 
-    dprintf(s1, "%d: write len=%d\n", pkt->stream_index, size);
+    av_dlog(s1, "%d: write len=%d\n", pkt->stream_index, size);
 
     rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) /
         RTCP_TX_RATIO_DEN;
@@ -444,7 +444,7 @@ static int rtp_write_trailer(AVFormatContext *s1)
     return 0;
 }
 
-AVOutputFormat rtp_muxer = {
+AVOutputFormat ff_rtp_muxer = {
     "rtp",
     NULL_IF_CONFIG_SMALL("RTP output format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/rtpenc.h b/ffmpeg-mt/libavformat/rtpenc.h
index b9663c5..21c5c31 100644
--- a/ffmpeg-mt/libavformat/rtpenc.h
+++ b/ffmpeg-mt/libavformat/rtpenc.h
@@ -2,20 +2,20 @@
  * RTP muxer definitions
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVFORMAT_RTPENC_H
diff --git a/ffmpeg-mt/libavformat/rtpenc_aac.c b/ffmpeg-mt/libavformat/rtpenc_aac.c
index e19b286..86318df 100644
--- a/ffmpeg-mt/libavformat/rtpenc_aac.c
+++ b/ffmpeg-mt/libavformat/rtpenc_aac.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2007 Luca Abeni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpenc_amr.c b/ffmpeg-mt/libavformat/rtpenc_amr.c
index 367789f..4da7ace 100644
--- a/ffmpeg-mt/libavformat/rtpenc_amr.c
+++ b/ffmpeg-mt/libavformat/rtpenc_amr.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2007 Luca Abeni
  * Copyright (c) 2009 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpenc_chain.c b/ffmpeg-mt/libavformat/rtpenc_chain.c
index 10d9df2..1727740 100644
--- a/ffmpeg-mt/libavformat/rtpenc_chain.c
+++ b/ffmpeg-mt/libavformat/rtpenc_chain.c
@@ -2,25 +2,27 @@
  * RTP muxer chaining code
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
+#include "avio_internal.h"
 #include "rtpenc_chain.h"
+#include "avio_internal.h"
 
 AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
                                        URLContext *handle, int packet_size)
@@ -50,33 +52,26 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
     /* Set the synchronized start time. */
     rtpctx->start_time_realtime = s->start_time_realtime;
 
-    /* Remove the local codec, link to the original codec
-     * context instead, to give the rtp muxer access to
-     * codec parameters. */
-    av_free(rtpctx->streams[0]->codec);
-    rtpctx->streams[0]->codec = st->codec;
+    avcodec_copy_context(rtpctx->streams[0]->codec, st->codec);
 
     if (handle) {
-        url_fdopen(&rtpctx->pb, handle);
+        ffio_fdopen(&rtpctx->pb, handle);
     } else
-        url_open_dyn_packet_buf(&rtpctx->pb, packet_size);
+        ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size);
     ret = av_write_header(rtpctx);
 
     if (ret) {
         if (handle) {
-            url_fclose(rtpctx->pb);
+            avio_close(rtpctx->pb);
         } else {
             uint8_t *ptr;
-            url_close_dyn_buf(rtpctx->pb, &ptr);
+            avio_close_dyn_buf(rtpctx->pb, &ptr);
             av_free(ptr);
         }
-        av_free(rtpctx->streams[0]);
-        av_free(rtpctx);
+        avformat_free_context(rtpctx);
         return NULL;
     }
 
-    /* Copy the RTP AVStream timebase back to the original AVStream */
-    st->time_base = rtpctx->streams[0]->time_base;
     return rtpctx;
 }
 
diff --git a/ffmpeg-mt/libavformat/rtpenc_chain.h b/ffmpeg-mt/libavformat/rtpenc_chain.h
index 9e19b64..6bdddcf 100644
--- a/ffmpeg-mt/libavformat/rtpenc_chain.h
+++ b/ffmpeg-mt/libavformat/rtpenc_chain.h
@@ -2,20 +2,20 @@
  * RTP muxer chaining code
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,6 +23,7 @@
 #define AVFORMAT_RTPENC_CHAIN_H
 
 #include "avformat.h"
+#include "url.h"
 
 AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
                                        URLContext *handle, int packet_size);
diff --git a/ffmpeg-mt/libavformat/rtpenc_h263.c b/ffmpeg-mt/libavformat/rtpenc_h263.c
index 84403a1..fbc696e 100644
--- a/ffmpeg-mt/libavformat/rtpenc_h263.c
+++ b/ffmpeg-mt/libavformat/rtpenc_h263.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2009 Luca Abeni
  * Copyright (c) 2009 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpenc_h264.c b/ffmpeg-mt/libavformat/rtpenc_h264.c
index 697def6..9ca6f7f 100644
--- a/ffmpeg-mt/libavformat/rtpenc_h264.c
+++ b/ffmpeg-mt/libavformat/rtpenc_h264.c
@@ -2,20 +2,20 @@
  * RTP packetization for H.264 (RFC3984)
  * Copyright (c) 2008 Luca Abeni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpenc_mpv.c b/ffmpeg-mt/libavformat/rtpenc_mpv.c
index b23c8f8..f6a5d77 100644
--- a/ffmpeg-mt/libavformat/rtpenc_mpv.c
+++ b/ffmpeg-mt/libavformat/rtpenc_mpv.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2002 Fabrice Bellard
  * Copyright (c) 2007 Luca Abeni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpenc_vp8.c b/ffmpeg-mt/libavformat/rtpenc_vp8.c
index e865514..afedbb4 100644
--- a/ffmpeg-mt/libavformat/rtpenc_vp8.c
+++ b/ffmpeg-mt/libavformat/rtpenc_vp8.c
@@ -2,20 +2,20 @@
  * RTP VP8 Packetizer
  * Copyright (c) 2010 Josh Allmann
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpenc_xiph.c b/ffmpeg-mt/libavformat/rtpenc_xiph.c
index 5768632..07086b1 100644
--- a/ffmpeg-mt/libavformat/rtpenc_xiph.c
+++ b/ffmpeg-mt/libavformat/rtpenc_xiph.c
@@ -2,20 +2,20 @@
  * RTP packetization for Xiph audio and video
  * Copyright (c) 2010 Josh Allmann
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtpproto.c b/ffmpeg-mt/libavformat/rtpproto.c
index 0e2abf5..b92b2e7 100644
--- a/ffmpeg-mt/libavformat/rtpproto.c
+++ b/ffmpeg-mt/libavformat/rtpproto.c
@@ -2,20 +2,20 @@
  * RTP network protocol
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,9 +24,12 @@
  * RTP protocol
  */
 
+#include "libavutil/parseutils.h"
 #include "libavutil/avstring.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "rtpdec.h"
+#include "url.h"
 
 #include <unistd.h>
 #include <stdarg.h>
@@ -34,8 +37,8 @@
 #include "network.h"
 #include "os_support.h"
 #include <fcntl.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#if HAVE_POLL_H
+#include <sys/poll.h>
 #endif
 #include <sys/time.h>
 
@@ -70,10 +73,10 @@ int rtp_set_remote_url(URLContext *h, const char *uri)
                  path, sizeof(path), uri);
 
     ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
-    udp_set_remote_url(s->rtp_hd, buf);
+    ff_udp_set_remote_url(s->rtp_hd, buf);
 
     ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port + 1, "%s", path);
-    udp_set_remote_url(s->rtcp_hd, buf);
+    ff_udp_set_remote_url(s->rtcp_hd, buf);
     return 0;
 }
 
@@ -142,7 +145,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
     char path[1024];
     const char *p;
 
-    is_output = (flags & URL_WRONLY);
+    is_output = (flags & AVIO_WRONLY);
 
     s = av_mallocz(sizeof(RTPContext));
     if (!s)
@@ -161,25 +164,25 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
 
     p = strchr(uri, '?');
     if (p) {
-        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
             ttl = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
             rtcp_port = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "localport", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "localport", p)) {
             local_rtp_port = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
             local_rtp_port = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
             local_rtcp_port = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
             max_packet_size = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "connect", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
             connect = strtol(buf, NULL, 10);
         }
     }
@@ -187,31 +190,31 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
     build_udp_url(buf, sizeof(buf),
                   hostname, rtp_port, local_rtp_port, ttl, max_packet_size,
                   connect);
-    if (url_open(&s->rtp_hd, buf, flags) < 0)
+    if (ffurl_open(&s->rtp_hd, buf, flags) < 0)
         goto fail;
     if (local_rtp_port>=0 && local_rtcp_port<0)
-        local_rtcp_port = udp_get_local_port(s->rtp_hd) + 1;
+        local_rtcp_port = ff_udp_get_local_port(s->rtp_hd) + 1;
 
     build_udp_url(buf, sizeof(buf),
                   hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size,
                   connect);
-    if (url_open(&s->rtcp_hd, buf, flags) < 0)
+    if (ffurl_open(&s->rtcp_hd, buf, flags) < 0)
         goto fail;
 
     /* just to ease handle access. XXX: need to suppress direct handle
        access */
-    s->rtp_fd = url_get_file_handle(s->rtp_hd);
-    s->rtcp_fd = url_get_file_handle(s->rtcp_hd);
+    s->rtp_fd = ffurl_get_file_handle(s->rtp_hd);
+    s->rtcp_fd = ffurl_get_file_handle(s->rtcp_hd);
 
-    h->max_packet_size = url_get_max_packet_size(s->rtp_hd);
+    h->max_packet_size = s->rtp_hd->max_packet_size;
     h->is_streamed = 1;
     return 0;
 
  fail:
     if (s->rtp_hd)
-        url_close(s->rtp_hd);
+        ffurl_close(s->rtp_hd);
     if (s->rtcp_hd)
-        url_close(s->rtcp_hd);
+        ffurl_close(s->rtcp_hd);
     av_free(s);
     return AVERROR(EIO);
 }
@@ -221,17 +224,17 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
     RTPContext *s = h->priv_data;
     struct sockaddr_storage from;
     socklen_t from_len;
-    int len, fd_max, n;
-    fd_set rfds;
-    struct timeval tv;
+    int len, n;
+    struct pollfd p[2] = {{s->rtp_fd, POLLIN, 0}, {s->rtcp_fd, POLLIN, 0}};
+
 #if 0
     for(;;) {
         from_len = sizeof(from);
         len = recvfrom (s->rtp_fd, buf, size, 0,
                         (struct sockaddr *)&from, &from_len);
         if (len < 0) {
-            if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
-                ff_neterrno() == FF_NETERROR(EINTR))
+            if (ff_neterrno() == AVERROR(EAGAIN) ||
+                ff_neterrno() == AVERROR(EINTR))
                 continue;
             return AVERROR(EIO);
         }
@@ -240,46 +243,38 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
 #else
     for(;;) {
         if (url_interrupt_cb())
-            return AVERROR(EINTR);
+            return AVERROR_EXIT;
         /* build fdset to listen to RTP and RTCP packets */
-        FD_ZERO(&rfds);
-        fd_max = s->rtp_fd;
-        FD_SET(s->rtp_fd, &rfds);
-        if (s->rtcp_fd > fd_max)
-            fd_max = s->rtcp_fd;
-        FD_SET(s->rtcp_fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        n = select(fd_max + 1, &rfds, NULL, NULL, &tv);
+        n = poll(p, 2, 100);
         if (n > 0) {
             /* first try RTCP */
-            if (FD_ISSET(s->rtcp_fd, &rfds)) {
+            if (p[1].revents & POLLIN) {
                 from_len = sizeof(from);
                 len = recvfrom (s->rtcp_fd, buf, size, 0,
                                 (struct sockaddr *)&from, &from_len);
                 if (len < 0) {
-                    if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
-                        ff_neterrno() == FF_NETERROR(EINTR))
+                    if (ff_neterrno() == AVERROR(EAGAIN) ||
+                        ff_neterrno() == AVERROR(EINTR))
                         continue;
                     return AVERROR(EIO);
                 }
                 break;
             }
             /* then RTP */
-            if (FD_ISSET(s->rtp_fd, &rfds)) {
+            if (p[0].revents & POLLIN) {
                 from_len = sizeof(from);
                 len = recvfrom (s->rtp_fd, buf, size, 0,
                                 (struct sockaddr *)&from, &from_len);
                 if (len < 0) {
-                    if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
-                        ff_neterrno() == FF_NETERROR(EINTR))
+                    if (ff_neterrno() == AVERROR(EAGAIN) ||
+                        ff_neterrno() == AVERROR(EINTR))
                         continue;
                     return AVERROR(EIO);
                 }
                 break;
             }
         } else if (n < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
+            if (ff_neterrno() == AVERROR(EINTR))
                 continue;
             return AVERROR(EIO);
         }
@@ -302,7 +297,7 @@ static int rtp_write(URLContext *h, const uint8_t *buf, int size)
         hd = s->rtp_hd;
     }
 
-    ret = url_write(hd, buf, size);
+    ret = ffurl_write(hd, buf, size);
 #if 0
     {
         struct timespec ts;
@@ -318,8 +313,8 @@ static int rtp_close(URLContext *h)
 {
     RTPContext *s = h->priv_data;
 
-    url_close(s->rtp_hd);
-    url_close(s->rtcp_hd);
+    ffurl_close(s->rtp_hd);
+    ffurl_close(s->rtcp_hd);
     av_free(s);
     return 0;
 }
@@ -333,7 +328,7 @@ static int rtp_close(URLContext *h)
 int rtp_get_local_rtp_port(URLContext *h)
 {
     RTPContext *s = h->priv_data;
-    return udp_get_local_port(s->rtp_hd);
+    return ff_udp_get_local_port(s->rtp_hd);
 }
 
 /**
@@ -345,7 +340,7 @@ int rtp_get_local_rtp_port(URLContext *h)
 int rtp_get_local_rtcp_port(URLContext *h)
 {
     RTPContext *s = h->priv_data;
-    return udp_get_local_port(s->rtcp_hd);
+    return ff_udp_get_local_port(s->rtcp_hd);
 }
 
 static int rtp_get_file_handle(URLContext *h)
@@ -359,12 +354,11 @@ int rtp_get_rtcp_file_handle(URLContext *h) {
     return s->rtcp_fd;
 }
 
-URLProtocol rtp_protocol = {
-    "rtp",
-    rtp_open,
-    rtp_read,
-    rtp_write,
-    NULL, /* seek */
-    rtp_close,
+URLProtocol ff_rtp_protocol = {
+    .name                = "rtp",
+    .url_open            = rtp_open,
+    .url_read            = rtp_read,
+    .url_write           = rtp_write,
+    .url_close           = rtp_close,
     .url_get_file_handle = rtp_get_file_handle,
 };
diff --git a/ffmpeg-mt/libavformat/rtsp.c b/ffmpeg-mt/libavformat/rtsp.c
index 2b61b89..62c9d35 100644
--- a/ffmpeg-mt/libavformat/rtsp.c
+++ b/ffmpeg-mt/libavformat/rtsp.c
@@ -2,32 +2,34 @@
  * RTSP/SDP client
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/base64.h"
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/parseutils.h"
 #include "libavutil/random_seed.h"
 #include "avformat.h"
+#include "avio_internal.h"
 
 #include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#if HAVE_POLL_H
+#include <poll.h>
 #endif
 #include <strings.h>
 #include "internal.h"
@@ -40,15 +42,16 @@
 #include "rdt.h"
 #include "rtpdec_formats.h"
 #include "rtpenc_chain.h"
+#include "url.h"
 
 //#define DEBUG
 //#define DEBUG_RTP_TCP
 
-/* Timeout values for socket select, in ms,
+/* Timeout values for socket poll, in ms,
  * and read_packet(), in seconds  */
-#define SELECT_TIMEOUT_MS 100
+#define POLL_TIMEOUT_MS 100
 #define READ_PACKET_TIMEOUT_S 10
-#define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / SELECT_TIMEOUT_MS
+#define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / POLL_TIMEOUT_MS
 #define SDP_MAX_SIZE 16384
 #define RECVBUF_SIZE 10 * RTP_MAX_PACKET_LENGTH
 
@@ -99,11 +102,11 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
     *end = AV_NOPTS_VALUE;
 
     get_word_sep(buf, sizeof(buf), "-", &p);
-    *start = parse_date(buf, 1);
+    av_parse_time(start, buf, 1);
     if (*p == '-') {
         p++;
         get_word_sep(buf, sizeof(buf), "-", &p);
-        *end = parse_date(buf, 1);
+        av_parse_time(end, buf, 1);
     }
 //    av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start);
 //    av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end);
@@ -247,7 +250,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
     struct sockaddr_storage sdp_ip;
     int ttl;
 
-    dprintf(s, "sdp: %c='%s'\n", letter, buf);
+    av_dlog(s, "sdp: %c='%s'\n", letter, buf);
 
     p = buf;
     if (s1->skip_media && letter != 'm')
@@ -273,8 +276,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
             s1->default_ip = sdp_ip;
             s1->default_ttl = ttl;
         } else {
-            st = s->streams[s->nb_streams - 1];
-            rtsp_st = st->priv_data;
+            rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
             rtsp_st->sdp_ip = sdp_ip;
             rtsp_st->sdp_ttl = ttl;
         }
@@ -323,10 +325,9 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
         if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
             /* no corresponding stream */
         } else {
-            st = av_new_stream(s, 0);
+            st = av_new_stream(s, rt->nb_rtsp_streams - 1);
             if (!st)
                 return;
-            st->priv_data = rtsp_st;
             rtsp_st->stream_index = st->index;
             st->codec->codec_type = codec_type;
             if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
@@ -355,8 +356,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
             } else {
                 char proto[32];
                 /* get the control url */
-                st = s->streams[s->nb_streams - 1];
-                rtsp_st = st->priv_data;
+                rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
 
                 /* XXX: may need to add full url resolution */
                 av_url_split(proto, sizeof(proto), NULL, 0, NULL, 0,
@@ -377,7 +377,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
             get_word(buf1, sizeof(buf1), &p);
             payload_type = atoi(buf1);
             st = s->streams[s->nb_streams - 1];
-            rtsp_st = st->priv_data;
+            rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
             sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p);
         } else if (av_strstart(p, "fmtp:", &p) ||
                    av_strstart(p, "framesize:", &p)) {
@@ -385,9 +385,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
             // let dynamic protocol handlers have a stab at the line.
             get_word(buf1, sizeof(buf1), &p);
             payload_type = atoi(buf1);
-            for (i = 0; i < s->nb_streams; i++) {
-                st      = s->streams[i];
-                rtsp_st = st->priv_data;
+            for (i = 0; i < rt->nb_rtsp_streams; i++) {
+                rtsp_st = rt->rtsp_streams[i];
                 if (rtsp_st->sdp_payload_type == payload_type &&
                     rtsp_st->dynamic_handler &&
                     rtsp_st->dynamic_handler->parse_sdp_a_line)
@@ -417,7 +416,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
                 if (rt->server_type == RTSP_SERVER_REAL)
                     ff_real_parse_sdp_a_line(s, s->nb_streams - 1, p);
 
-                rtsp_st = s->streams[s->nb_streams - 1]->priv_data;
+                rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
                 if (rtsp_st->dynamic_handler &&
                     rtsp_st->dynamic_handler->parse_sdp_a_line)
                     rtsp_st->dynamic_handler->parse_sdp_a_line(s,
@@ -429,8 +428,14 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
     }
 }
 
+/**
+ * Parse the sdp description and allocate the rtp streams and the
+ * pollfd array used for udp ones.
+ */
+
 int ff_sdp_parse(AVFormatContext *s, const char *content)
 {
+    RTSPState *rt = s->priv_data;
     const char *p;
     int letter;
     /* Some SDP lines, particularly for Realmedia or ASF RTSP streams,
@@ -470,10 +475,45 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
         if (*p == '\n')
             p++;
     }
+    rt->p = av_malloc(sizeof(struct pollfd)*2*(rt->nb_rtsp_streams+1));
+    if (!rt->p) return AVERROR(ENOMEM);
     return 0;
 }
 #endif /* CONFIG_RTPDEC */
 
+void ff_rtsp_undo_setup(AVFormatContext *s)
+{
+    RTSPState *rt = s->priv_data;
+    int i;
+
+    for (i = 0; i < rt->nb_rtsp_streams; i++) {
+        RTSPStream *rtsp_st = rt->rtsp_streams[i];
+        if (!rtsp_st)
+            continue;
+        if (rtsp_st->transport_priv) {
+            if (s->oformat) {
+                AVFormatContext *rtpctx = rtsp_st->transport_priv;
+                av_write_trailer(rtpctx);
+                if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
+                    uint8_t *ptr;
+                    avio_close_dyn_buf(rtpctx->pb, &ptr);
+                    av_free(ptr);
+                } else {
+                    avio_close(rtpctx->pb);
+                }
+                avformat_free_context(rtpctx);
+            } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
+                ff_rdt_parse_close(rtsp_st->transport_priv);
+            else if (CONFIG_RTPDEC)
+                rtp_parse_close(rtsp_st->transport_priv);
+        }
+        rtsp_st->transport_priv = NULL;
+        if (rtsp_st->rtp_handle)
+            ffurl_close(rtsp_st->rtp_handle);
+        rtsp_st->rtp_handle = NULL;
+    }
+}
+
 /* close and free RTSP streams */
 void ff_rtsp_close_streams(AVFormatContext *s)
 {
@@ -481,34 +521,14 @@ void ff_rtsp_close_streams(AVFormatContext *s)
     int i;
     RTSPStream *rtsp_st;
 
+    ff_rtsp_undo_setup(s);
     for (i = 0; i < rt->nb_rtsp_streams; i++) {
         rtsp_st = rt->rtsp_streams[i];
         if (rtsp_st) {
-            if (rtsp_st->transport_priv) {
-                if (s->oformat) {
-                    AVFormatContext *rtpctx = rtsp_st->transport_priv;
-                    av_write_trailer(rtpctx);
-                    if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
-                        uint8_t *ptr;
-                        url_close_dyn_buf(rtpctx->pb, &ptr);
-                        av_free(ptr);
-                    } else {
-                        url_fclose(rtpctx->pb);
-                    }
-                    av_metadata_free(&rtpctx->streams[0]->metadata);
-                    av_metadata_free(&rtpctx->metadata);
-                    av_free(rtpctx->streams[0]);
-                    av_free(rtpctx);
-                } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
-                    ff_rdt_parse_close(rtsp_st->transport_priv);
-                else if (CONFIG_RTPDEC)
-                    rtp_parse_close(rtsp_st->transport_priv);
-            }
-            if (rtsp_st->rtp_handle)
-                url_close(rtsp_st->rtp_handle);
             if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
                 rtsp_st->dynamic_handler->close(
                     rtsp_st->dynamic_protocol_context);
+            av_free(rtsp_st);
         }
     }
     av_free(rt->rtsp_streams);
@@ -516,6 +536,7 @@ void ff_rtsp_close_streams(AVFormatContext *s)
         av_close_input_stream (rt->asf_ctx);
         rt->asf_ctx = NULL;
     }
+    av_free(rt->p);
     av_free(rt->recvbuf);
 }
 
@@ -797,19 +818,19 @@ void ff_rtsp_skip_packet(AVFormatContext *s)
     int ret, len, len1;
     uint8_t buf[1024];
 
-    ret = url_read_complete(rt->rtsp_hd, buf, 3);
+    ret = ffurl_read_complete(rt->rtsp_hd, buf, 3);
     if (ret != 3)
         return;
     len = AV_RB16(buf + 1);
 
-    dprintf(s, "skipping RTP packet len=%d\n", len);
+    av_dlog(s, "skipping RTP packet len=%d\n", len);
 
     /* skip payload */
     while (len > 0) {
         len1 = len;
         if (len1 > sizeof(buf))
             len1 = sizeof(buf);
-        ret = url_read_complete(rt->rtsp_hd, buf, len1);
+        ret = ffurl_read_complete(rt->rtsp_hd, buf, len1);
         if (ret != len1)
             return;
         len -= len1;
@@ -834,9 +855,9 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
     for (;;) {
         q = buf;
         for (;;) {
-            ret = url_read_complete(rt->rtsp_hd, &ch, 1);
+            ret = ffurl_read_complete(rt->rtsp_hd, &ch, 1);
 #ifdef DEBUG_RTP_TCP
-            dprintf(s, "ret=%d c=%02x [%c]\n", ret, ch, ch);
+            av_dlog(s, "ret=%d c=%02x [%c]\n", ret, ch, ch);
 #endif
             if (ret != 1)
                 return AVERROR_EOF;
@@ -855,7 +876,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
         }
         *q = '\0';
 
-        dprintf(s, "line='%s'\n", buf);
+        av_dlog(s, "line='%s'\n", buf);
 
         /* test if last line */
         if (buf[0] == '\0')
@@ -882,7 +903,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
     if (content_length > 0) {
         /* leave some room for a trailing '\0' (useful for simple parsing) */
         content = av_malloc(content_length + 1);
-        (void)url_read_complete(rt->rtsp_hd, content, content_length);
+        ffurl_read_complete(rt->rtsp_hd, content, content_length);
         content[content_length] = '\0';
     }
     if (content_ptr)
@@ -909,11 +930,24 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
     return 0;
 }
 
-int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
-                                        const char *method, const char *url,
-                                        const char *headers,
-                                        const unsigned char *send_content,
-                                        int send_content_length)
+/**
+ * Send a command to the RTSP server without waiting for the reply.
+ *
+ * @param s RTSP (de)muxer context
+ * @param method the method for the request
+ * @param url the target url for the request
+ * @param headers extra header lines to include in the request
+ * @param send_content if non-null, the data to send as request body content
+ * @param send_content_length the length of the send_content data, or 0 if
+ *                            send_content is null
+ *
+ * @return zero if success, nonzero otherwise
+ */
+static int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
+                                               const char *method, const char *url,
+                                               const char *headers,
+                                               const unsigned char *send_content,
+                                               int send_content_length)
 {
     RTSPState *rt = s->priv_data;
     char buf[4096], *out_buf;
@@ -947,16 +981,16 @@ int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
         out_buf = base64buf;
     }
 
-    dprintf(s, "Sending:\n%s--\n", buf);
+    av_dlog(s, "Sending:\n%s--\n", buf);
 
-    url_write(rt->rtsp_hd_out, out_buf, strlen(out_buf));
+    ffurl_write(rt->rtsp_hd_out, out_buf, strlen(out_buf));
     if (send_content_length > 0 && send_content) {
         if (rt->control_transport == RTSP_MODE_TUNNEL) {
             av_log(s, AV_LOG_ERROR, "tunneling of RTSP requests "
                                     "with content data not supported\n");
             return AVERROR_PATCHWELCOME;
         }
-        url_write(rt->rtsp_hd_out, send_content, send_content_length);
+        ffurl_write(rt->rtsp_hd_out, send_content, send_content_length);
     }
     rt->last_cmd_time = av_gettime();
 
@@ -1017,7 +1051,7 @@ retry:
 /**
  * @return 0 on success, <0 on error, 1 if protocol is unavailable.
  */
-static int make_setup_request(AVFormatContext *s, const char *host, int port,
+int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
                               int lower_transport, const char *real_challenge)
 {
     RTSPState *rt = s->priv_data;
@@ -1082,14 +1116,14 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
                                 "?localport=%d", j);
                     /* we will use two ports per rtp stream (rtp and rtcp) */
                     j += 2;
-                    if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0)
+                    if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_RDWR) == 0)
                         goto rtp_opened;
                 }
             }
 
 #if 0
             /* then try on any port */
-            if (url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
+            if (ffurl_open(&rtsp_st->rtp_handle, "rtp://", AVIO_RDONLY) < 0) {
                 err = AVERROR_INVALIDDATA;
                 goto fail;
             }
@@ -1124,7 +1158,7 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
                 continue;
             snprintf(transport, sizeof(transport) - 1,
                      "%s/TCP;", trans_pref);
-            if (rt->server_type == RTSP_SERVER_WMS)
+            if (rt->transport != RTSP_TRANSPORT_RDT)
                 av_strlcat(transport, "unicast;", sizeof(transport));
             av_strlcatf(transport, sizeof(transport),
                         "interleaved=%d-%d",
@@ -1235,7 +1269,7 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
                         namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
             ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
                         port, "?ttl=%d", ttl);
-            if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
+            if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) {
                 err = AVERROR_INVALIDDATA;
                 goto fail;
             }
@@ -1256,20 +1290,15 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
     return 0;
 
 fail:
-    for (i = 0; i < rt->nb_rtsp_streams; i++) {
-        if (rt->rtsp_streams[i]->rtp_handle) {
-            url_close(rt->rtsp_streams[i]->rtp_handle);
-            rt->rtsp_streams[i]->rtp_handle = NULL;
-        }
-    }
+    ff_rtsp_undo_setup(s);
     return err;
 }
 
 void ff_rtsp_close_connections(AVFormatContext *s)
 {
     RTSPState *rt = s->priv_data;
-    if (rt->rtsp_hd_out != rt->rtsp_hd) url_close(rt->rtsp_hd_out);
-    url_close(rt->rtsp_hd);
+    if (rt->rtsp_hd_out != rt->rtsp_hd) ffurl_close(rt->rtsp_hd_out);
+    ffurl_close(rt->rtsp_hd);
     rt->rtsp_hd = rt->rtsp_hd_out = NULL;
 }
 
@@ -1281,7 +1310,7 @@ int ff_rtsp_connect(AVFormatContext *s)
     int port, err, tcp_fd;
     RTSPMessageHeader reply1 = {0}, *reply = &reply1;
     int lower_transport_mask = 0;
-    char real_challenge[64];
+    char real_challenge[64] = "";
     struct sockaddr_storage peer;
     socklen_t peer_len = sizeof(peer);
 
@@ -1367,7 +1396,7 @@ redirect:
                  av_get_random_seed(), av_get_random_seed());
 
         /* GET requests */
-        if (url_alloc(&rt->rtsp_hd, httpname, URL_RDONLY) < 0) {
+        if (ffurl_alloc(&rt->rtsp_hd, httpname, AVIO_RDONLY) < 0) {
             err = AVERROR(EIO);
             goto fail;
         }
@@ -1382,13 +1411,13 @@ redirect:
         ff_http_set_headers(rt->rtsp_hd, headers);
 
         /* complete the connection */
-        if (url_connect(rt->rtsp_hd)) {
+        if (ffurl_connect(rt->rtsp_hd)) {
             err = AVERROR(EIO);
             goto fail;
         }
 
         /* POST requests */
-        if (url_alloc(&rt->rtsp_hd_out, httpname, URL_WRONLY) < 0 ) {
+        if (ffurl_alloc(&rt->rtsp_hd_out, httpname, AVIO_WRONLY) < 0 ) {
             err = AVERROR(EIO);
             goto fail;
         }
@@ -1424,14 +1453,14 @@ redirect:
         ff_http_init_auth_state(rt->rtsp_hd_out, rt->rtsp_hd);
 
         /* complete the connection */
-        if (url_connect(rt->rtsp_hd_out)) {
+        if (ffurl_connect(rt->rtsp_hd_out)) {
             err = AVERROR(EIO);
             goto fail;
         }
     } else {
         /* open the tcp connection */
         ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
-        if (url_open(&rt->rtsp_hd, tcpname, URL_RDWR) < 0) {
+        if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_RDWR) < 0) {
             err = AVERROR(EIO);
             goto fail;
         }
@@ -1439,7 +1468,7 @@ redirect:
     }
     rt->seq = 0;
 
-    tcp_fd = url_get_file_handle(rt->rtsp_hd);
+    tcp_fd = ffurl_get_file_handle(rt->rtsp_hd);
     if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) {
         getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host),
                     NULL, 0, NI_NUMERICHOST);
@@ -1493,18 +1522,20 @@ redirect:
         int lower_transport = ff_log2_tab[lower_transport_mask &
                                   ~(lower_transport_mask - 1)];
 
-        err = make_setup_request(s, host, port, lower_transport,
+        err = ff_rtsp_make_setup_request(s, host, port, lower_transport,
                                  rt->server_type == RTSP_SERVER_REAL ?
                                      real_challenge : NULL);
         if (err < 0)
             goto fail;
         lower_transport_mask &= ~(1 << lower_transport);
         if (lower_transport_mask == 0 && err == 1) {
-            err = FF_NETERROR(EPROTONOSUPPORT);
+            err = AVERROR(EPROTONOSUPPORT);
             goto fail;
         }
     } while (err);
 
+    rt->lower_transport_mask = lower_transport_mask;
+    av_strlcpy(rt->real_challenge, real_challenge, sizeof(rt->real_challenge));
     rt->state = RTSP_STATE_IDLE;
     rt->seek_timestamp = 0; /* default is to start stream at position zero */
     return 0;
@@ -1529,55 +1560,51 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
 {
     RTSPState *rt = s->priv_data;
     RTSPStream *rtsp_st;
-    fd_set rfds;
-    int fd, fd_rtcp, fd_max, n, i, ret, tcp_fd, timeout_cnt = 0;
-    struct timeval tv;
+    int n, i, ret, tcp_fd, timeout_cnt = 0;
+    int max_p = 0;
+    struct pollfd *p = rt->p;
 
     for (;;) {
         if (url_interrupt_cb())
-            return AVERROR(EINTR);
+            return AVERROR_EXIT;
         if (wait_end && wait_end - av_gettime() < 0)
             return AVERROR(EAGAIN);
-        FD_ZERO(&rfds);
+        max_p = 0;
         if (rt->rtsp_hd) {
-            tcp_fd = fd_max = url_get_file_handle(rt->rtsp_hd);
-            FD_SET(tcp_fd, &rfds);
+            tcp_fd = ffurl_get_file_handle(rt->rtsp_hd);
+            p[max_p].fd = tcp_fd;
+            p[max_p++].events = POLLIN;
         } else {
-            fd_max = 0;
             tcp_fd = -1;
         }
         for (i = 0; i < rt->nb_rtsp_streams; i++) {
             rtsp_st = rt->rtsp_streams[i];
             if (rtsp_st->rtp_handle) {
-                fd = url_get_file_handle(rtsp_st->rtp_handle);
-                fd_rtcp = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
-                if (FFMAX(fd, fd_rtcp) > fd_max)
-                    fd_max = FFMAX(fd, fd_rtcp);
-                FD_SET(fd, &rfds);
-                FD_SET(fd_rtcp, &rfds);
+                p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle);
+                p[max_p++].events = POLLIN;
+                p[max_p].fd = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
+                p[max_p++].events = POLLIN;
             }
         }
-        tv.tv_sec = 0;
-        tv.tv_usec = SELECT_TIMEOUT_MS * 1000;
-        n = select(fd_max + 1, &rfds, NULL, NULL, &tv);
+        n = poll(p, max_p, POLL_TIMEOUT_MS);
         if (n > 0) {
+            int j = 1 - (tcp_fd == -1);
             timeout_cnt = 0;
             for (i = 0; i < rt->nb_rtsp_streams; i++) {
                 rtsp_st = rt->rtsp_streams[i];
                 if (rtsp_st->rtp_handle) {
-                    fd = url_get_file_handle(rtsp_st->rtp_handle);
-                    fd_rtcp = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
-                    if (FD_ISSET(fd_rtcp, &rfds) || FD_ISSET(fd, &rfds)) {
-                        ret = url_read(rtsp_st->rtp_handle, buf, buf_size);
+                    if (p[j].revents & POLLIN || p[j+1].revents & POLLIN) {
+                        ret = ffurl_read(rtsp_st->rtp_handle, buf, buf_size);
                         if (ret > 0) {
                             *prtsp_st = rtsp_st;
                             return ret;
                         }
                     }
+                    j+=2;
                 }
             }
 #if CONFIG_RTSP_DEMUXER
-            if (tcp_fd != -1 && FD_ISSET(tcp_fd, &rfds)) {
+            if (tcp_fd != -1 && p[0].revents & POLLIN) {
                 RTSPMessageHeader reply;
 
                 ret = ff_rtsp_read_reply(s, &reply, NULL, 0, NULL);
@@ -1589,7 +1616,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
             }
 #endif
         } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {
-            return FF_NETERROR(ETIMEDOUT);
+            return AVERROR(ETIMEDOUT);
         } else if (n < 0 && errno != EINTR)
             return AVERROR(errno);
     }
@@ -1657,7 +1684,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
     case RTSP_LOWER_TRANSPORT_UDP:
     case RTSP_LOWER_TRANSPORT_UDP_MULTICAST:
         len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end);
-        if (len >=0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
+        if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
             rtp_check_and_send_back_rr(rtsp_st->transport_priv, len);
         break;
     }
@@ -1758,15 +1785,16 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
     /* read the whole sdp file */
     /* XXX: better loading */
     content = av_malloc(SDP_MAX_SIZE);
-    size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
+    size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
     if (size <= 0) {
         av_free(content);
         return AVERROR_INVALIDDATA;
     }
     content[size] ='\0';
 
-    ff_sdp_parse(s, content);
+    err = ff_sdp_parse(s, content);
     av_free(content);
+    if (err) goto fail;
 
     /* open each RTP stream */
     for (i = 0; i < rt->nb_rtsp_streams; i++) {
@@ -1779,7 +1807,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
                     namebuf, rtsp_st->sdp_port,
                     "?localport=%d&ttl=%d", rtsp_st->sdp_port,
                     rtsp_st->sdp_ttl);
-        if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
+        if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) {
             err = AVERROR_INVALIDDATA;
             goto fail;
         }
@@ -1800,7 +1828,7 @@ static int sdp_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat sdp_demuxer = {
+AVInputFormat ff_sdp_demuxer = {
     "sdp",
     NULL_IF_CONFIG_SMALL("SDP"),
     sizeof(RTSPState),
@@ -1829,18 +1857,18 @@ static int rtp_read_header(AVFormatContext *s,
     int payload_type;
     AVCodecContext codec;
     struct sockaddr_storage addr;
-    ByteIOContext pb;
+    AVIOContext pb;
     socklen_t addrlen = sizeof(addr);
 
     if (!ff_network_init())
         return AVERROR(EIO);
 
-    ret = url_open(&in, s->filename, URL_RDONLY);
+    ret = ffurl_open(&in, s->filename, AVIO_RDONLY);
     if (ret)
         goto fail;
 
     while (1) {
-        ret = url_read(in, recvbuf, sizeof(recvbuf));
+        ret = ffurl_read(in, recvbuf, sizeof(recvbuf));
         if (ret == AVERROR(EAGAIN))
             continue;
         if (ret < 0)
@@ -1859,8 +1887,8 @@ static int rtp_read_header(AVFormatContext *s,
         payload_type = recvbuf[1] & 0x7f;
         break;
     }
-    getsockname(url_get_file_handle(in), (struct sockaddr*) &addr, &addrlen);
-    url_close(in);
+    getsockname(ffurl_get_file_handle(in), (struct sockaddr*) &addr, &addrlen);
+    ffurl_close(in);
     in = NULL;
 
     memset(&codec, 0, sizeof(codec));
@@ -1887,7 +1915,7 @@ static int rtp_read_header(AVFormatContext *s,
              port, payload_type);
     av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sdp);
 
-    init_put_byte(&pb, sdp, strlen(sdp), 0, NULL, NULL, NULL, NULL);
+    ffio_init_context(&pb, sdp, strlen(sdp), 0, NULL, NULL, NULL, NULL);
     s->pb = &pb;
 
     /* sdp_read_header initializes this again */
@@ -1899,12 +1927,12 @@ static int rtp_read_header(AVFormatContext *s,
 
 fail:
     if (in)
-        url_close(in);
+        ffurl_close(in);
     ff_network_close();
     return ret;
 }
 
-AVInputFormat rtp_demuxer = {
+AVInputFormat ff_rtp_demuxer = {
     "rtp",
     NULL_IF_CONFIG_SMALL("RTP input format"),
     sizeof(RTSPState),
diff --git a/ffmpeg-mt/libavformat/rtsp.h b/ffmpeg-mt/libavformat/rtsp.h
index eee07ac..e1f1df9 100644
--- a/ffmpeg-mt/libavformat/rtsp.h
+++ b/ffmpeg-mt/libavformat/rtsp.h
@@ -2,20 +2,20 @@
  * RTSP definitions
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef AVFORMAT_RTSP_H
@@ -193,7 +193,7 @@ enum RTSPServerType {
 /**
  * Private data for the RTSP demuxer.
  *
- * @todo Use ByteIOContext instead of URLContext
+ * @todo Use AVIOContext instead of URLContext
  */
 typedef struct RTSPState {
     URLContext *rtsp_hd; /* RTSP TCP connection handle */
@@ -218,7 +218,7 @@ typedef struct RTSPState {
     int64_t seek_timestamp;
 
     /* XXX: currently we use unbuffered input */
-    //    ByteIOContext rtsp_gb;
+    //    AVIOContext rtsp_gb;
 
     int seq;                          /**< RTSP command sequence number */
 
@@ -248,6 +248,9 @@ typedef struct RTSPState {
      * of RTSPMessageHeader->real_challenge */
     enum RTSPServerType server_type;
 
+    /** the "RealChallenge1:" field from the server */
+    char real_challenge[64];
+
     /** plaintext authorization line (username:password) */
     char auth[128];
 
@@ -313,6 +316,21 @@ typedef struct RTSPState {
     /** Filter incoming UDP packets - receive packets only from the right
      * source address and port. */
     int filter_source;
+
+    /**
+     * A mask with all requested transport methods
+     */
+    int lower_transport_mask;
+
+    /**
+     * The number of returned packets
+     */
+    uint64_t packets;
+
+    /**
+     * Polling array for udp
+     */
+    struct pollfd *p;
 } RTSPState;
 
 /**
@@ -361,24 +379,6 @@ extern int rtsp_rtp_port_max;
 /**
  * Send a command to the RTSP server without waiting for the reply.
  *
- * @param s RTSP (de)muxer context
- * @param method the method for the request
- * @param url the target url for the request
- * @param headers extra header lines to include in the request
- * @param send_content if non-null, the data to send as request body content
- * @param send_content_length the length of the send_content data, or 0 if
- *                            send_content is null
- *
- * @return zero if success, nonzero otherwise
- */
-int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
-                                        const char *method, const char *url,
-                                        const char *headers,
-                                        const unsigned char *send_content,
-                                        int send_content_length);
-/**
- * Send a command to the RTSP server without waiting for the reply.
- *
  * @see rtsp_send_cmd_with_content_async
  */
 int ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method,
@@ -504,4 +504,17 @@ int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
  */
 int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt);
 
+/**
+ * Do the SETUP requests for each stream for the chosen
+ * lower transport mode.
+ */
+int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
+                               int lower_transport, const char *real_challenge);
+
+/**
+ * Undo the effect of ff_rtsp_make_setup_request, close the
+ * transport_priv and rtp_handle fields.
+ */
+void ff_rtsp_undo_setup(AVFormatContext *s);
+
 #endif /* AVFORMAT_RTSP_H */
diff --git a/ffmpeg-mt/libavformat/rtspcodes.h b/ffmpeg-mt/libavformat/rtspcodes.h
index 9ee96bf..63ceb66 100644
--- a/ffmpeg-mt/libavformat/rtspcodes.h
+++ b/ffmpeg-mt/libavformat/rtspcodes.h
@@ -2,20 +2,20 @@
  * RTSP definitions
  * copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/rtspdec.c b/ffmpeg-mt/libavformat/rtspdec.c
index eb7de3b..866f313 100644
--- a/ffmpeg-mt/libavformat/rtspdec.c
+++ b/ffmpeg-mt/libavformat/rtspdec.c
@@ -2,20 +2,20 @@
  * RTSP demuxer
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,6 +28,7 @@
 #include "os_support.h"
 #include "rtsp.h"
 #include "rdt.h"
+#include "url.h"
 
 //#define DEBUG
 //#define DEBUG_RTP_TCP
@@ -60,8 +61,9 @@ static int rtsp_read_play(AVFormatContext *s)
             cmd[0] = 0;
         } else {
             snprintf(cmd, sizeof(cmd),
-                     "Range: npt=%0.3f-\r\n",
-                     (double)rt->seek_timestamp / AV_TIME_BASE);
+                     "Range: npt=%"PRId64".%03"PRId64"-\r\n",
+                     rt->seek_timestamp / AV_TIME_BASE,
+                     rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000);
         }
         ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
         if (reply->status_code != RTSP_STATUS_OK) {
@@ -86,6 +88,24 @@ static int rtsp_read_play(AVFormatContext *s)
     return 0;
 }
 
+/* pause the stream */
+static int rtsp_read_pause(AVFormatContext *s)
+{
+    RTSPState *rt = s->priv_data;
+    RTSPMessageHeader reply1, *reply = &reply1;
+
+    if (rt->state != RTSP_STATE_STREAMING)
+        return 0;
+    else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
+        ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL);
+        if (reply->status_code != RTSP_STATUS_OK) {
+            return -1;
+        }
+    }
+    rt->state = RTSP_STATE_PAUSED;
+    return 0;
+}
+
 int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
 {
     RTSPState *rt = s->priv_data;
@@ -118,7 +138,7 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
     ret = ff_sdp_parse(s, (const char *)content);
     av_freep(&content);
     if (ret < 0)
-        return AVERROR_INVALIDDATA;
+        return ret;
 
     return 0;
 }
@@ -166,7 +186,7 @@ int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
     RTSPStream *rtsp_st;
 
 #ifdef DEBUG_RTP_TCP
-    dprintf(s, "tcp_read_packet:\n");
+    av_dlog(s, "tcp_read_packet:\n");
 #endif
 redo:
     for (;;) {
@@ -181,18 +201,18 @@ redo:
         if (rt->state != RTSP_STATE_STREAMING)
             return 0;
     }
-    ret = url_read_complete(rt->rtsp_hd, buf, 3);
+    ret = ffurl_read_complete(rt->rtsp_hd, buf, 3);
     if (ret != 3)
         return -1;
     id  = buf[0];
     len = AV_RB16(buf + 1);
 #ifdef DEBUG_RTP_TCP
-    dprintf(s, "id=%d len=%d\n", id, len);
+    av_dlog(s, "id=%d len=%d\n", id, len);
 #endif
     if (len > buf_size || len < 12)
         goto redo;
     /* get the data */
-    ret = url_read_complete(rt->rtsp_hd, buf, len);
+    ret = ffurl_read_complete(rt->rtsp_hd, buf, len);
     if (ret != len)
         return -1;
     if (rt->transport == RTSP_TRANSPORT_RDT &&
@@ -211,6 +231,20 @@ found:
     *prtsp_st = rtsp_st;
     return len;
 }
+
+static int resetup_tcp(AVFormatContext *s)
+{
+    RTSPState *rt = s->priv_data;
+    char host[1024];
+    int port;
+
+    av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0,
+                 s->filename);
+    ff_rtsp_undo_setup(s);
+    return ff_rtsp_make_setup_request(s, host, port, RTSP_LOWER_TRANSPORT_TCP,
+                                      rt->real_challenge);
+}
+
 static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     RTSPState *rt = s->priv_data;
@@ -218,6 +252,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
     RTSPMessageHeader reply1, *reply = &reply1;
     char cmd[1024];
 
+retry:
     if (rt->server_type == RTSP_SERVER_REAL) {
         int i;
 
@@ -250,7 +285,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
             for (i = 0; i < rt->nb_rtsp_streams; i++) {
                 rule_nr = 0;
                 for (r = 0; r < s->nb_streams; r++) {
-                    if (s->streams[r]->priv_data == rt->rtsp_streams[i]) {
+                    if (s->streams[r]->id == i) {
                         if (s->streams[r]->discard != AVDISCARD_ALL) {
                             if (!first)
                                 av_strlcat(rt->last_subscription, ",",
@@ -277,12 +312,36 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     ret = ff_rtsp_fetch_packet(s, pkt);
-    if (ret < 0)
+    if (ret < 0) {
+        if (ret == AVERROR(ETIMEDOUT) && !rt->packets) {
+            if (rt->lower_transport == RTSP_LOWER_TRANSPORT_UDP &&
+                rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_TCP)) {
+                RTSPMessageHeader reply1, *reply = &reply1;
+                av_log(s, AV_LOG_WARNING, "UDP timeout, retrying with TCP\n");
+                if (rtsp_read_pause(s) != 0)
+                    return -1;
+                // TEARDOWN is required on Real-RTSP, but might make
+                // other servers close the connection.
+                if (rt->server_type == RTSP_SERVER_REAL)
+                    ff_rtsp_send_cmd(s, "TEARDOWN", rt->control_uri, NULL,
+                                     reply, NULL);
+                rt->session_id[0] = '\0';
+                if (resetup_tcp(s) == 0) {
+                    rt->state = RTSP_STATE_IDLE;
+                    rt->need_subscription = 1;
+                    if (rtsp_read_play(s) != 0)
+                        return -1;
+                    goto retry;
+                }
+            }
+        }
         return ret;
+    }
+    rt->packets++;
 
     /* send dummy request to keep TCP connection alive */
     if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) {
-        if (rt->server_type == RTSP_SERVER_WMS) {
+        if (rt->server_type != RTSP_SERVER_REAL) {
             ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
         } else {
             ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);
@@ -292,24 +351,6 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-/* pause the stream */
-static int rtsp_read_pause(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPMessageHeader reply1, *reply = &reply1;
-
-    if (rt->state != RTSP_STATE_STREAMING)
-        return 0;
-    else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
-        ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL);
-        if (reply->status_code != RTSP_STATUS_OK) {
-            return -1;
-        }
-    }
-    rt->state = RTSP_STATE_PAUSED;
-    return 0;
-}
-
 static int rtsp_read_seek(AVFormatContext *s, int stream_index,
                           int64_t timestamp, int flags)
 {
@@ -343,7 +384,7 @@ static int rtsp_read_close(AVFormatContext *s)
 #if 0
     /* NOTE: it is valid to flush the buffer here */
     if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
-        url_fclose(&rt->rtsp_gb);
+        avio_close(&rt->rtsp_gb);
     }
 #endif
     ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
@@ -356,7 +397,7 @@ static int rtsp_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat rtsp_demuxer = {
+AVInputFormat ff_rtsp_demuxer = {
     "rtsp",
     NULL_IF_CONFIG_SMALL("RTSP input format"),
     sizeof(RTSPState),
diff --git a/ffmpeg-mt/libavformat/rtspenc.c b/ffmpeg-mt/libavformat/rtspenc.c
index 3a0b2c7..c1fc97c 100644
--- a/ffmpeg-mt/libavformat/rtspenc.c
+++ b/ffmpeg-mt/libavformat/rtspenc.c
@@ -2,34 +2,37 @@
  * RTSP muxer
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
 
 #include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#if HAVE_POLL_H
+#include <poll.h>
 #endif
 #include "network.h"
+#include "os_support.h"
 #include "rtsp.h"
 #include "internal.h"
+#include "avio_internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avstring.h"
+#include "url.h"
 
 #define SDP_MAX_SIZE 16384
 
@@ -63,7 +66,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
     ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename),
                 "rtsp", NULL, addr, -1, NULL);
     ctx_array[0] = &sdp_ctx;
-    if (avf_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) {
+    if (av_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) {
         av_free(sdp);
         return AVERROR_INVALIDDATA;
     }
@@ -78,14 +81,12 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
     /* Set up the RTSPStreams for each AVStream */
     for (i = 0; i < s->nb_streams; i++) {
         RTSPStream *rtsp_st;
-        AVStream *st = s->streams[i];
 
         rtsp_st = av_mallocz(sizeof(RTSPStream));
         if (!rtsp_st)
             return AVERROR(ENOMEM);
         dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st);
 
-        st->priv_data = rtsp_st;
         rtsp_st->stream_index = i;
 
         av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url));
@@ -104,8 +105,7 @@ static int rtsp_write_record(AVFormatContext *s)
     char cmd[1024];
 
     snprintf(cmd, sizeof(cmd),
-             "Range: npt=%0.3f-\r\n",
-             (double) 0);
+             "Range: npt=0.000-\r\n");
     ff_rtsp_send_cmd(s, "RECORD", rt->control_uri, cmd, reply, NULL);
     if (reply->status_code != RTSP_STATUS_OK)
         return -1;
@@ -137,14 +137,14 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
     int size;
     uint8_t *interleave_header, *interleaved_packet;
 
-    size = url_close_dyn_buf(rtpctx->pb, &buf);
+    size = avio_close_dyn_buf(rtpctx->pb, &buf);
     ptr = buf;
     while (size > 4) {
         uint32_t packet_len = AV_RB32(ptr);
         int id;
         /* The interleaving header is exactly 4 bytes, which happens to be
          * the same size as the packet length header from
-         * url_open_dyn_packet_buf. So by writing the interleaving header
+         * ffio_open_dyn_packet_buf. So by writing the interleaving header
          * over these bytes, we get a consecutive interleaved packet
          * that can be written in one call. */
         interleaved_packet = interleave_header = ptr;
@@ -159,12 +159,12 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
         interleave_header[0] = '$';
         interleave_header[1] = id;
         AV_WB16(interleave_header + 2, packet_len);
-        url_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);
+        ffurl_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);
         ptr += packet_len;
         size -= packet_len;
     }
     av_free(buf);
-    url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
+    ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
     return 0;
 }
 
@@ -172,23 +172,16 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     RTSPState *rt = s->priv_data;
     RTSPStream *rtsp_st;
-    fd_set rfds;
-    int n, tcp_fd;
-    struct timeval tv;
+    int n;
+    struct pollfd p = {ffurl_get_file_handle(rt->rtsp_hd), POLLIN, 0};
     AVFormatContext *rtpctx;
     int ret;
 
-    tcp_fd = url_get_file_handle(rt->rtsp_hd);
-
     while (1) {
-        FD_ZERO(&rfds);
-        FD_SET(tcp_fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 0;
-        n = select(tcp_fd + 1, &rfds, NULL, NULL, &tv);
+        n = poll(&p, 1, 0);
         if (n <= 0)
             break;
-        if (FD_ISSET(tcp_fd, &rfds)) {
+        if (p.revents & POLLIN) {
             RTSPMessageHeader reply;
 
             /* Don't let ff_rtsp_read_reply handle interleaved packets,
@@ -233,7 +226,7 @@ static int rtsp_write_close(AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat rtsp_muxer = {
+AVOutputFormat ff_rtsp_muxer = {
     "rtsp",
     NULL_IF_CONFIG_SMALL("RTSP output format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/sapdec.c b/ffmpeg-mt/libavformat/sapdec.c
index 701eae2..1eb40b7 100644
--- a/ffmpeg-mt/libavformat/sapdec.c
+++ b/ffmpeg-mt/libavformat/sapdec.c
@@ -2,20 +2,20 @@
  * Session Announcement Protocol (RFC 2974) demuxer
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,15 +25,17 @@
 #include "network.h"
 #include "os_support.h"
 #include "internal.h"
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#include "avio_internal.h"
+#include "url.h"
+#if HAVE_POLL_H
+#include <poll.h>
 #endif
 #include <sys/time.h>
 
 struct SAPState {
     URLContext *ann_fd;
     AVFormatContext *sdp_ctx;
-    ByteIOContext sdp_pb;
+    AVIOContext sdp_pb;
     uint16_t hash;
     char *sdp;
     int eof;
@@ -52,7 +54,7 @@ static int sap_read_close(AVFormatContext *s)
     if (sap->sdp_ctx)
         av_close_input_stream(sap->sdp_ctx);
     if (sap->ann_fd)
-        url_close(sap->ann_fd);
+        ffurl_close(sap->ann_fd);
     av_freep(&sap->sdp);
     ff_network_close();
     return 0;
@@ -83,7 +85,7 @@ static int sap_read_header(AVFormatContext *s,
 
     ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d",
                 port);
-    ret = url_open(&sap->ann_fd, url, URL_RDONLY);
+    ret = ffurl_open(&sap->ann_fd, url, AVIO_RDONLY);
     if (ret)
         goto fail;
 
@@ -91,7 +93,7 @@ static int sap_read_header(AVFormatContext *s,
         int addr_type, auth_len;
         int pos;
 
-        ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf) - 1);
+        ret = ffurl_read(sap->ann_fd, recvbuf, sizeof(recvbuf) - 1);
         if (ret == AVERROR(EAGAIN))
             continue;
         if (ret < 0)
@@ -142,7 +144,7 @@ static int sap_read_header(AVFormatContext *s,
     }
 
     av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sap->sdp);
-    init_put_byte(&sap->sdp_pb, sap->sdp, strlen(sap->sdp), 0, NULL, NULL,
+    ffio_init_context(&sap->sdp_pb, sap->sdp, strlen(sap->sdp), 0, NULL, NULL,
                   NULL, NULL);
 
     infmt = av_find_input_format("sdp");
@@ -181,23 +183,19 @@ fail:
 static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
 {
     struct SAPState *sap = s->priv_data;
-    int fd = url_get_file_handle(sap->ann_fd);
+    int fd = ffurl_get_file_handle(sap->ann_fd);
     int n, ret;
-    fd_set rfds;
-    struct timeval tv;
+    struct pollfd p = {fd, POLLIN, 0};
     uint8_t recvbuf[1500];
 
     if (sap->eof)
         return AVERROR_EOF;
 
     while (1) {
-        FD_ZERO(&rfds);
-        FD_SET(fd, &rfds);
-        tv.tv_sec = tv.tv_usec = 0;
-        n = select(fd + 1, &rfds, NULL, NULL, &tv);
-        if (n <= 0 || !FD_ISSET(fd, &rfds))
+        n = poll(&p, 1, 0);
+        if (n <= 0 || !(p.revents & POLLIN))
             break;
-        ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf));
+        ret = ffurl_read(sap->ann_fd, recvbuf, sizeof(recvbuf));
         if (ret >= 8) {
             uint16_t hash = AV_RB16(&recvbuf[2]);
             /* Should ideally check the source IP address, too */
@@ -226,7 +224,7 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-AVInputFormat sap_demuxer = {
+AVInputFormat ff_sap_demuxer = {
     "sap",
     NULL_IF_CONFIG_SMALL("SAP input format"),
     sizeof(struct SAPState),
diff --git a/ffmpeg-mt/libavformat/sapenc.c b/ffmpeg-mt/libavformat/sapenc.c
index 581cec6..455e653 100644
--- a/ffmpeg-mt/libavformat/sapenc.c
+++ b/ffmpeg-mt/libavformat/sapenc.c
@@ -2,24 +2,25 @@
  * Session Announcement Protocol (RFC 2974) muxer
  * Copyright (c) 2010 Martin Storsjo
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avformat.h"
+#include "libavutil/parseutils.h"
 #include "libavutil/random_seed.h"
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
@@ -27,6 +28,7 @@
 #include "network.h"
 #include "os_support.h"
 #include "rtpenc_chain.h"
+#include "url.h"
 
 struct SAPState {
     uint8_t    *ann;
@@ -45,22 +47,19 @@ static int sap_write_close(AVFormatContext *s)
         if (!rtpctx)
             continue;
         av_write_trailer(rtpctx);
-        url_fclose(rtpctx->pb);
-        av_metadata_free(&rtpctx->streams[0]->metadata);
-        av_metadata_free(&rtpctx->metadata);
-        av_free(rtpctx->streams[0]);
-        av_free(rtpctx);
+        avio_close(rtpctx->pb);
+        avformat_free_context(rtpctx);
         s->streams[i]->priv_data = NULL;
     }
 
     if (sap->last_time && sap->ann && sap->ann_fd) {
         sap->ann[0] |= 4; /* Session deletion*/
-        url_write(sap->ann_fd, sap->ann, sap->ann_size);
+        ffurl_write(sap->ann_fd, sap->ann, sap->ann_size);
     }
 
     av_freep(&sap->ann);
     if (sap->ann_fd)
-        url_close(sap->ann_fd);
+        ffurl_close(sap->ann_fd);
     ff_network_close();
     return 0;
 }
@@ -90,16 +89,16 @@ static int sap_write_header(AVFormatContext *s)
     option_list = strrchr(path, '?');
     if (option_list) {
         char buf[50];
-        if (find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
+        if (av_find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
             port = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
+        if (av_find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
             same_port = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
+        if (av_find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
             ttl = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
+        if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
             av_strlcpy(announce_addr, buf, sizeof(announce_addr));
         }
     }
@@ -147,7 +146,7 @@ static int sap_write_header(AVFormatContext *s)
                     "?ttl=%d", ttl);
         if (!same_port)
             base_port += 2;
-        ret = url_open(&fd, url, URL_WRONLY);
+        ret = ffurl_open(&fd, url, AVIO_WRONLY);
         if (ret) {
             ret = AVERROR(EIO);
             goto fail;
@@ -159,13 +158,13 @@ static int sap_write_header(AVFormatContext *s)
 
     ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
                 "?ttl=%d&connect=1", ttl);
-    ret = url_open(&sap->ann_fd, url, URL_WRONLY);
+    ret = ffurl_open(&sap->ann_fd, url, AVIO_WRONLY);
     if (ret) {
         ret = AVERROR(EIO);
         goto fail;
     }
 
-    udp_fd = url_get_file_handle(sap->ann_fd);
+    udp_fd = ffurl_get_file_handle(sap->ann_fd);
     if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) {
         ret = AVERROR(EIO);
         goto fail;
@@ -209,7 +208,7 @@ static int sap_write_header(AVFormatContext *s)
     av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos);
     pos += strlen(&sap->ann[pos]) + 1;
 
-    if (avf_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
+    if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
                        sap->ann_size - pos)) {
         ret = AVERROR_INVALIDDATA;
         goto fail;
@@ -219,7 +218,7 @@ static int sap_write_header(AVFormatContext *s)
     pos += strlen(&sap->ann[pos]);
     sap->ann_size = pos;
 
-    if (sap->ann_size > url_get_max_packet_size(sap->ann_fd)) {
+    if (sap->ann_size > sap->ann_fd->max_packet_size) {
         av_log(s, AV_LOG_ERROR, "Announcement too large to send in one "
                                 "packet\n");
         goto fail;
@@ -240,9 +239,9 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
     int64_t now = av_gettime();
 
     if (!sap->last_time || now - sap->last_time > 5000000) {
-        int ret = url_write(sap->ann_fd, sap->ann, sap->ann_size);
+        int ret = ffurl_write(sap->ann_fd, sap->ann, sap->ann_size);
         /* Don't abort even if we get "Destination unreachable" */
-        if (ret < 0 && ret != FF_NETERROR(ECONNREFUSED))
+        if (ret < 0 && ret != AVERROR(ECONNREFUSED))
             return ret;
         sap->last_time = now;
     }
@@ -250,7 +249,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
     return ff_write_chained(rtpctx, 0, pkt, s);
 }
 
-AVOutputFormat sap_muxer = {
+AVOutputFormat ff_sap_muxer = {
     "sap",
     NULL_IF_CONFIG_SMALL("SAP output format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/sauce.c b/ffmpeg-mt/libavformat/sauce.c
index 4972d33..cf33ab7 100644
--- a/ffmpeg-mt/libavformat/sauce.c
+++ b/ffmpeg-mt/libavformat/sauce.c
@@ -2,20 +2,20 @@
  * SAUCE header parser
  * Copyright (c) 2010 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -30,19 +30,19 @@
 
 int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int get_height)
 {
-    ByteIOContext *pb = avctx->pb;
+    AVIOContext *pb = avctx->pb;
     char buf[36];
     int datatype, filetype, t1, t2, nb_comments, flags;
-    uint64_t start_pos = url_fsize(pb) - 128;
+    uint64_t start_pos = avio_size(pb) - 128;
 
-    url_fseek(pb, start_pos, SEEK_SET);
-    if (get_buffer(pb, buf, 7) != 7)
+    avio_seek(pb, start_pos, SEEK_SET);
+    if (avio_read(pb, buf, 7) != 7)
         return -1;
     if (memcmp(buf, "SAUCE00", 7))
         return -1;
 
 #define GET_SAUCE_META(name,size) \
-    if (get_buffer(pb, buf, size) == size && buf[0]) { \
+    if (avio_read(pb, buf, size) == size && buf[0]) { \
         buf[size] = 0; \
         av_metadata_set2(&avctx->metadata, name, buf, 0); \
     }
@@ -51,14 +51,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
     GET_SAUCE_META("artist",    20)
     GET_SAUCE_META("publisher", 20)
     GET_SAUCE_META("date",      8)
-    url_fskip(pb, 4);
-    datatype    = get_byte(pb);
-    filetype    = get_byte(pb);
-    t1          = get_le16(pb);
-    t2          = get_le16(pb);
-    nb_comments = get_byte(pb);
-    flags       = get_byte(pb);
-    url_fskip(pb, 4);
+    avio_skip(pb, 4);
+    datatype    = avio_r8(pb);
+    filetype    = avio_r8(pb);
+    t1          = avio_rl16(pb);
+    t2          = avio_rl16(pb);
+    nb_comments = avio_r8(pb);
+    flags       = avio_r8(pb);
+    avio_skip(pb, 4);
     GET_SAUCE_META("encoder",   22);
 
     if (got_width && datatype && filetype) {
@@ -82,15 +82,15 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
     *fsize -= 128;
 
     if (nb_comments > 0) {
-        url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
-        if (get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
+        avio_seek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
+        if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
             int i;
             char *str = av_malloc(65*nb_comments + 1);
             *fsize -= 64*nb_comments + 5;
             if (!str)
                 return 0;
             for (i = 0; i < nb_comments; i++) {
-                if (get_buffer(pb, str + 65*i, 64) != 64)
+                if (avio_read(pb, str + 65*i, 64) != 64)
                     break;
                 str[65*i + 64] = '\n';
             }
diff --git a/ffmpeg-mt/libavformat/sauce.h b/ffmpeg-mt/libavformat/sauce.h
index 0ba9ae5..62d8e68 100644
--- a/ffmpeg-mt/libavformat/sauce.h
+++ b/ffmpeg-mt/libavformat/sauce.h
@@ -2,20 +2,20 @@
  * SAUCE header parser
  * Copyright (c) 2010 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/sdp.c b/ffmpeg-mt/libavformat/sdp.c
index 872e76c..005434c 100644
--- a/ffmpeg-mt/libavformat/sdp.c
+++ b/ffmpeg-mt/libavformat/sdp.c
@@ -1,26 +1,27 @@
 /*
  * copyright (c) 2007 Luca Abeni
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <string.h>
 #include "libavutil/avstring.h"
 #include "libavutil/base64.h"
+#include "libavutil/parseutils.h"
 #include "libavcodec/xiph.h"
 #include "avformat.h"
 #include "internal.h"
@@ -136,7 +137,7 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
     if (p) {
         char buff[64];
 
-        if (find_info_tag(buff, sizeof(buff), "ttl", p)) {
+        if (av_find_info_tag(buff, sizeof(buff), "ttl", p)) {
             *ttl = strtol(buff, NULL, 10);
         } else {
             *ttl = 5;
@@ -473,14 +474,14 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
     sdp_write_media_attributes(buff, size, c, payload_type);
 }
 
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
+int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
 {
     AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0);
     struct sdp_session_level s;
     int i, j, port, ttl, is_multicast;
     char dst[32], dst_type[5];
 
-    memset(buff, 0, size);
+    memset(buf, 0, size);
     memset(&s, 0, sizeof(struct sdp_session_level));
     s.user = "-";
     s.src_addr = "127.0.0.1";    /* FIXME: Properly set this */
@@ -505,7 +506,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
             }
         }
     }
-    sdp_write_header(buff, size, &s);
+    sdp_write_header(buf, size, &s);
 
     dst[0] = 0;
     for (i = 0; i < n_files; i++) {
@@ -517,11 +518,11 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
                 ttl = 0;
         }
         for (j = 0; j < ac[i]->nb_streams; j++) {
-            ff_sdp_write_media(buff, size,
+            ff_sdp_write_media(buf, size,
                                   ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
                                   dst_type, (port > 0) ? port + j * 2 : 0, ttl);
             if (port <= 0) {
-                av_strlcatf(buff, size,
+                av_strlcatf(buf, size,
                                    "a=control:streamid=%d\r\n", i + j);
             }
         }
@@ -530,7 +531,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
     return 0;
 }
 #else
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
+int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
 {
     return AVERROR(ENOSYS);
 }
@@ -539,3 +540,10 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
 {
 }
 #endif
+
+#if FF_API_SDP_CREATE
+int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
+{
+    return av_sdp_create(ac, n_files, buff, size);
+}
+#endif
diff --git a/ffmpeg-mt/libavformat/seek.c b/ffmpeg-mt/libavformat/seek.c
index 26b622f..71e2f8a 100644
--- a/ffmpeg-mt/libavformat/seek.c
+++ b/ffmpeg-mt/libavformat/seek.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Ivan Schreter
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -313,7 +313,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s,
     step = s->pb->buffer_size;
     curpos = FFMAX(pos - step / 2, 0);
     for (;;) {
-        url_fseek(s->pb, curpos, SEEK_SET);
+        avio_seek(s->pb, curpos, SEEK_SET);
         search_hi_lo_keyframes(s,
                                ts, time_base,
                                flags,
@@ -385,7 +385,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s,
         }
     }
 
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
     av_free(sync);
     return pos;
 }
@@ -405,7 +405,7 @@ AVParserState *ff_store_parser_state(AVFormatContext *s)
         return NULL;
     }
 
-    state->fpos = url_ftell(s->pb);
+    state->fpos = avio_tell(s->pb);
 
     // copy context structures
     state->cur_st                           = s->cur_st;
@@ -456,7 +456,7 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state)
     if (!state)
         return;
 
-    url_fseek(s->pb, state->fpos, SEEK_SET);
+    avio_seek(s->pb, state->fpos, SEEK_SET);
 
     // copy context structures
     s->cur_st                           = state->cur_st;
diff --git a/ffmpeg-mt/libavformat/seek.h b/ffmpeg-mt/libavformat/seek.h
index 408f7d6..fd95f49 100644
--- a/ffmpeg-mt/libavformat/seek.h
+++ b/ffmpeg-mt/libavformat/seek.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2009 Ivan Schreter
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/segafilm.c b/ffmpeg-mt/libavformat/segafilm.c
index 6274041..0ad5fbb 100644
--- a/ffmpeg-mt/libavformat/segafilm.c
+++ b/ffmpeg-mt/libavformat/segafilm.c
@@ -2,20 +2,20 @@
  * Sega FILM Format (CPK) Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -77,7 +77,7 @@ static int film_read_header(AVFormatContext *s,
                             AVFormatParameters *ap)
 {
     FilmDemuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     unsigned char scratch[256];
     int i;
@@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s,
     film->stereo_buffer_size = 0;
 
     /* load the main FILM header */
-    if (get_buffer(pb, scratch, 16) != 16)
+    if (avio_read(pb, scratch, 16) != 16)
         return AVERROR(EIO);
     data_offset = AV_RB32(&scratch[4]);
     film->version = AV_RB32(&scratch[8]);
@@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s,
     /* load the FDSC chunk */
     if (film->version == 0) {
         /* special case for Lemmings .film files; 20-byte header */
-        if (get_buffer(pb, scratch, 20) != 20)
+        if (avio_read(pb, scratch, 20) != 20)
             return AVERROR(EIO);
         /* make some assumptions about the audio parameters */
         film->audio_type = CODEC_ID_PCM_S8;
@@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s,
         film->audio_bits = 8;
     } else {
         /* normal Saturn .cpk files; 32-byte header */
-        if (get_buffer(pb, scratch, 32) != 32)
+        if (avio_read(pb, scratch, 32) != 32)
             return AVERROR(EIO);
         film->audio_samplerate = AV_RB16(&scratch[24]);
         film->audio_channels = scratch[21];
@@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s,
     }
 
     /* load the sample table */
-    if (get_buffer(pb, scratch, 16) != 16)
+    if (avio_read(pb, scratch, 16) != 16)
         return AVERROR(EIO);
     if (AV_RB32(&scratch[0]) != STAB_TAG)
         return AVERROR_INVALIDDATA;
@@ -174,7 +174,7 @@ static int film_read_header(AVFormatContext *s,
     audio_frame_counter = 0;
     for (i = 0; i < film->sample_count; i++) {
         /* load the next sample record and transfer it to an internal struct */
-        if (get_buffer(pb, scratch, 16) != 16) {
+        if (avio_read(pb, scratch, 16) != 16) {
             av_free(film->sample_table);
             return AVERROR(EIO);
         }
@@ -205,7 +205,7 @@ static int film_read_packet(AVFormatContext *s,
                             AVPacket *pkt)
 {
     FilmDemuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     film_sample *sample;
     int ret = 0;
     int i;
@@ -217,15 +217,15 @@ static int film_read_packet(AVFormatContext *s,
     sample = &film->sample_table[film->current_sample];
 
     /* position the stream (will probably be there anyway) */
-    url_fseek(pb, sample->sample_offset, SEEK_SET);
+    avio_seek(pb, sample->sample_offset, SEEK_SET);
 
     /* do a special song and dance when loading FILM Cinepak chunks */
     if ((sample->stream == film->video_stream_index) &&
         (film->video_type == CODEC_ID_CINEPAK)) {
-        pkt->pos= url_ftell(pb);
+        pkt->pos= avio_tell(pb);
         if (av_new_packet(pkt, sample->sample_size))
             return AVERROR(ENOMEM);
-        get_buffer(pb, pkt->data, sample->sample_size);
+        avio_read(pb, pkt->data, sample->sample_size);
     } else if ((sample->stream == film->audio_stream_index) &&
         (film->audio_channels == 2)) {
         /* stereo PCM needs to be interleaved */
@@ -240,8 +240,8 @@ static int film_read_packet(AVFormatContext *s,
             film->stereo_buffer = av_malloc(film->stereo_buffer_size);
         }
 
-        pkt->pos= url_ftell(pb);
-        ret = get_buffer(pb, film->stereo_buffer, sample->sample_size);
+        pkt->pos= avio_tell(pb);
+        ret = avio_read(pb, film->stereo_buffer, sample->sample_size);
         if (ret != sample->sample_size)
             ret = AVERROR(EIO);
 
@@ -282,7 +282,7 @@ static int film_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat segafilm_demuxer = {
+AVInputFormat ff_segafilm_demuxer = {
     "film_cpk",
     NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"),
     sizeof(FilmDemuxContext),
diff --git a/ffmpeg-mt/libavformat/sierravmd.c b/ffmpeg-mt/libavformat/sierravmd.c
index c239f5c..c0fb222 100644
--- a/ffmpeg-mt/libavformat/sierravmd.c
+++ b/ffmpeg-mt/libavformat/sierravmd.c
@@ -2,20 +2,20 @@
  * Sierra VMD Format Demuxer
  * Copyright (c) 2004 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -81,7 +81,7 @@ static int vmd_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
     VmdDemuxContext *vmd = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st = NULL, *vst;
     unsigned int toc_offset;
     unsigned char *raw_frame_table;
@@ -95,11 +95,11 @@ static int vmd_read_header(AVFormatContext *s,
     int sound_buffers;
 
     /* fetch the main header, including the 2 header length bytes */
-    url_fseek(pb, 0, SEEK_SET);
-    if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
+    avio_seek(pb, 0, SEEK_SET);
+    if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
         return AVERROR(EIO);
 
-    if(vmd->vmd_header[16] == 'i' && vmd->vmd_header[17] == 'v' && vmd->vmd_header[18] == '3')
+    if(vmd->vmd_header[24] == 'i' && vmd->vmd_header[25] == 'v' && vmd->vmd_header[26] == '3')
         vmd->is_indeo3 = 1;
     else
         vmd->is_indeo3 = 0;
@@ -155,7 +155,7 @@ static int vmd_read_header(AVFormatContext *s,
     toc_offset = AV_RL32(&vmd->vmd_header[812]);
     vmd->frame_count = AV_RL16(&vmd->vmd_header[6]);
     vmd->frames_per_block = AV_RL16(&vmd->vmd_header[18]);
-    url_fseek(pb, toc_offset, SEEK_SET);
+    avio_seek(pb, toc_offset, SEEK_SET);
 
     raw_frame_table = NULL;
     vmd->frame_table = NULL;
@@ -172,7 +172,7 @@ static int vmd_read_header(AVFormatContext *s,
         av_free(vmd->frame_table);
         return AVERROR(ENOMEM);
     }
-    if (get_buffer(pb, raw_frame_table, raw_frame_table_size) !=
+    if (avio_read(pb, raw_frame_table, raw_frame_table_size) !=
         raw_frame_table_size) {
         av_free(raw_frame_table);
         av_free(vmd->frame_table);
@@ -189,7 +189,7 @@ static int vmd_read_header(AVFormatContext *s,
             int type;
             uint32_t size;
 
-            get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD);
+            avio_read(pb, chunk, BYTES_PER_FRAME_RECORD);
             type = chunk[0];
             size = AV_RL32(&chunk[2]);
             if(!size && type != 1)
@@ -234,7 +234,7 @@ static int vmd_read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
     VmdDemuxContext *vmd = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret = 0;
     vmd_frame *frame;
 
@@ -243,16 +243,16 @@ static int vmd_read_packet(AVFormatContext *s,
 
     frame = &vmd->frame_table[vmd->current_frame];
     /* position the stream (will probably be there already) */
-    url_fseek(pb, frame->frame_offset, SEEK_SET);
+    avio_seek(pb, frame->frame_offset, SEEK_SET);
 
     if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
         return AVERROR(ENOMEM);
-    pkt->pos= url_ftell(pb);
+    pkt->pos= avio_tell(pb);
     memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
-    if(vmd->is_indeo3)
-        ret = get_buffer(pb, pkt->data, frame->frame_size);
+    if(vmd->is_indeo3 && frame->frame_record[0] == 0x02)
+        ret = avio_read(pb, pkt->data, frame->frame_size);
     else
-        ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD,
+        ret = avio_read(pb, pkt->data + BYTES_PER_FRAME_RECORD,
             frame->frame_size);
 
     if (ret != frame->frame_size) {
@@ -280,7 +280,7 @@ static int vmd_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat vmd_demuxer = {
+AVInputFormat ff_vmd_demuxer = {
     "vmd",
     NULL_IF_CONFIG_SMALL("Sierra VMD format"),
     sizeof(VmdDemuxContext),
diff --git a/ffmpeg-mt/libavformat/siff.c b/ffmpeg-mt/libavformat/siff.c
index 3a0b9bb..23c122f 100644
--- a/ffmpeg-mt/libavformat/siff.c
+++ b/ffmpeg-mt/libavformat/siff.c
@@ -2,20 +2,20 @@
  * Beam Software SIFF demuxer
  * Copyright (c) 2007 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -84,36 +84,36 @@ static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
     return 0;
 }
 
-static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb)
+static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
 {
     AVStream *st;
     int width, height;
 
-    if (get_le32(pb) != TAG_VBHD){
+    if (avio_rl32(pb) != TAG_VBHD){
         av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
         return -1;
     }
-    if(get_be32(pb) != 32){
+    if(avio_rb32(pb) != 32){
         av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
         return -1;
     }
-    if(get_le16(pb) != 1){
+    if(avio_rl16(pb) != 1){
         av_log(s, AV_LOG_ERROR, "Incorrect header version\n");
         return -1;
     }
-    width = get_le16(pb);
-    height = get_le16(pb);
-    url_fskip(pb, 4);
-    c->frames = get_le16(pb);
+    width = avio_rl16(pb);
+    height = avio_rl16(pb);
+    avio_skip(pb, 4);
+    c->frames = avio_rl16(pb);
     if(!c->frames){
         av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
         return -1;
     }
-    c->bits = get_le16(pb);
-    c->rate = get_le16(pb);
+    c->bits = avio_rl16(pb);
+    c->rate = avio_rl16(pb);
     c->block_align = c->rate * (c->bits >> 3);
 
-    url_fskip(pb, 16); //zeroes
+    avio_skip(pb, 16); //zeroes
 
     st = av_new_stream(s, 0);
     if (!st)
@@ -135,33 +135,33 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb
     return 0;
 }
 
-static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb)
+static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
 {
-    if (get_le32(pb) != TAG_SHDR){
+    if (avio_rl32(pb) != TAG_SHDR){
         av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
         return -1;
     }
-    if(get_be32(pb) != 8){
+    if(avio_rb32(pb) != 8){
         av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
         return -1;
     }
-    url_fskip(pb, 4); //unknown value
-    c->rate = get_le16(pb);
-    c->bits = get_le16(pb);
+    avio_skip(pb, 4); //unknown value
+    c->rate = avio_rl16(pb);
+    c->bits = avio_rl16(pb);
     c->block_align = c->rate * (c->bits >> 3);
     return create_audio_stream(s, c);
 }
 
 static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     SIFFContext *c = s->priv_data;
     uint32_t tag;
 
-    if (get_le32(pb) != TAG_SIFF)
+    if (avio_rl32(pb) != TAG_SIFF)
         return -1;
-    url_fskip(pb, 4); //ignore size
-    tag = get_le32(pb);
+    avio_skip(pb, 4); //ignore size
+    tag = avio_rl32(pb);
 
     if (tag != TAG_VBV1 && tag != TAG_SOUN){
         av_log(s, AV_LOG_ERROR, "Not a VBV file\n");
@@ -172,11 +172,11 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return -1;
     if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0)
         return -1;
-    if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){
+    if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){
         av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
         return -1;
     }
-    url_fskip(pb, 4); //ignore size
+    avio_skip(pb, 4); //ignore size
 
     return 0;
 }
@@ -190,12 +190,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (c->cur_frame >= c->frames)
             return AVERROR(EIO);
         if (c->curstrm == -1){
-            c->pktsize = get_le32(s->pb) - 4;
-            c->flags = get_le16(s->pb);
+            c->pktsize = avio_rl32(s->pb) - 4;
+            c->flags = avio_rl16(s->pb);
             c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
             if (c->gmcsize)
-                get_buffer(s->pb, c->gmc, c->gmcsize);
-            c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
+                avio_read(s->pb, c->gmc, c->gmcsize);
+            c->sndsize = (c->flags & VB_HAS_AUDIO) ? avio_rl32(s->pb): 0;
             c->curstrm = !!(c->flags & VB_HAS_AUDIO);
         }
 
@@ -206,7 +206,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
             AV_WL16(pkt->data, c->flags);
             if (c->gmcsize)
                 memcpy(pkt->data + 2, c->gmc, c->gmcsize);
-            get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
+            avio_read(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
             pkt->stream_index = 0;
             c->curstrm = -1;
         }else{
@@ -227,7 +227,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
     return pkt->size;
 }
 
-AVInputFormat siff_demuxer = {
+AVInputFormat ff_siff_demuxer = {
     "siff",
     NULL_IF_CONFIG_SMALL("Beam Software SIFF"),
     sizeof(SIFFContext),
diff --git a/ffmpeg-mt/libavformat/smacker.c b/ffmpeg-mt/libavformat/smacker.c
index 89e9e35..01d1303 100644
--- a/ffmpeg-mt/libavformat/smacker.c
+++ b/ffmpeg-mt/libavformat/smacker.c
@@ -2,20 +2,20 @@
  * Smacker demuxer
  * Copyright (c) 2006 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -98,26 +98,26 @@ static int smacker_probe(AVProbeData *p)
 
 static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     SmackerContext *smk = s->priv_data;
     AVStream *st, *ast[7];
     int i, ret;
     int tbase;
 
     /* read and check header */
-    smk->magic = get_le32(pb);
+    smk->magic = avio_rl32(pb);
     if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4'))
         return -1;
-    smk->width = get_le32(pb);
-    smk->height = get_le32(pb);
-    smk->frames = get_le32(pb);
-    smk->pts_inc = (int32_t)get_le32(pb);
-    smk->flags = get_le32(pb);
+    smk->width = avio_rl32(pb);
+    smk->height = avio_rl32(pb);
+    smk->frames = avio_rl32(pb);
+    smk->pts_inc = (int32_t)avio_rl32(pb);
+    smk->flags = avio_rl32(pb);
     if(smk->flags & SMACKER_FLAG_RING_FRAME)
         smk->frames++;
     for(i = 0; i < 7; i++)
-        smk->audio[i] = get_le32(pb);
-    smk->treesize = get_le32(pb);
+        smk->audio[i] = avio_rl32(pb);
+    smk->treesize = avio_rl32(pb);
 
     if(smk->treesize >= UINT_MAX/4){ // smk->treesize + 16 must not overflow (this check is probably redundant)
         av_log(s, AV_LOG_ERROR, "treesize too large\n");
@@ -125,13 +125,13 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
     }
 
 //FIXME remove extradata "rebuilding"
-    smk->mmap_size = get_le32(pb);
-    smk->mclr_size = get_le32(pb);
-    smk->full_size = get_le32(pb);
-    smk->type_size = get_le32(pb);
+    smk->mmap_size = avio_rl32(pb);
+    smk->mclr_size = avio_rl32(pb);
+    smk->full_size = avio_rl32(pb);
+    smk->type_size = avio_rl32(pb);
     for(i = 0; i < 7; i++)
-        smk->rates[i] = get_le32(pb);
-    smk->pad = get_le32(pb);
+        smk->rates[i] = avio_rl32(pb);
+    smk->pad = avio_rl32(pb);
     /* setup data */
     if(smk->frames > 0xFFFFFF) {
         av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames);
@@ -144,10 +144,10 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     /* read frame info */
     for(i = 0; i < smk->frames; i++) {
-        smk->frm_size[i] = get_le32(pb);
+        smk->frm_size[i] = avio_rl32(pb);
     }
     for(i = 0; i < smk->frames; i++) {
-        smk->frm_flags[i] = get_byte(pb);
+        smk->frm_flags[i] = avio_r8(pb);
     }
 
     /* init video codec */
@@ -207,7 +207,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
         av_free(smk->frm_flags);
         return -1;
     }
-    ret = get_buffer(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
+    ret = avio_read(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
     if(ret != st->codec->extradata_size - 16){
         av_free(smk->frm_size);
         av_free(smk->frm_flags);
@@ -219,7 +219,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
     ((int32_t*)st->codec->extradata)[3] = av_le2ne32(smk->type_size);
 
     smk->curstream = -1;
-    smk->nextpos = url_ftell(pb);
+    smk->nextpos = avio_tell(pb);
 
     return 0;
 }
@@ -235,35 +235,35 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
     int palchange = 0;
     int pos;
 
-    if (url_feof(s->pb) || smk->cur_frame >= smk->frames)
+    if (s->pb->eof_reached || smk->cur_frame >= smk->frames)
         return AVERROR_EOF;
 
     /* if we demuxed all streams, pass another frame */
     if(smk->curstream < 0) {
-        url_fseek(s->pb, smk->nextpos, 0);
+        avio_seek(s->pb, smk->nextpos, 0);
         frame_size = smk->frm_size[smk->cur_frame] & (~3);
         flags = smk->frm_flags[smk->cur_frame];
         /* handle palette change event */
-        pos = url_ftell(s->pb);
+        pos = avio_tell(s->pb);
         if(flags & SMACKER_PAL){
             int size, sz, t, off, j, pos;
             uint8_t *pal = smk->pal;
             uint8_t oldpal[768];
 
             memcpy(oldpal, pal, 768);
-            size = get_byte(s->pb);
+            size = avio_r8(s->pb);
             size = size * 4 - 1;
             frame_size -= size;
             frame_size--;
             sz = 0;
-            pos = url_ftell(s->pb) + size;
+            pos = avio_tell(s->pb) + size;
             while(sz < 256){
-                t = get_byte(s->pb);
+                t = avio_r8(s->pb);
                 if(t & 0x80){ /* skip palette entries */
                     sz += (t & 0x7F) + 1;
                     pal += ((t & 0x7F) + 1) * 3;
                 } else if(t & 0x40){ /* copy with offset */
-                    off = get_byte(s->pb) * 3;
+                    off = avio_r8(s->pb) * 3;
                     j = (t & 0x3F) + 1;
                     while(j-- && sz < 256) {
                         *pal++ = oldpal[off + 0];
@@ -274,12 +274,12 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
                     }
                 } else { /* new entries */
                     *pal++ = smk_pal[t];
-                    *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
-                    *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
+                    *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
+                    *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
                     sz++;
                 }
             }
-            url_fseek(s->pb, pos, 0);
+            avio_seek(s->pb, pos, 0);
             palchange |= 1;
         }
         flags >>= 1;
@@ -288,13 +288,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
         for(i = 0; i < 7; i++) {
             if(flags & 1) {
                 int size;
-                size = get_le32(s->pb) - 4;
+                size = avio_rl32(s->pb) - 4;
                 frame_size -= size;
                 frame_size -= 4;
                 smk->curstream++;
                 smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
                 smk->buf_sizes[smk->curstream] = size;
-                ret = get_buffer(s->pb, smk->bufs[smk->curstream], size);
+                ret = avio_read(s->pb, smk->bufs[smk->curstream], size);
                 if(ret != size)
                     return AVERROR(EIO);
                 smk->stream_id[smk->curstream] = smk->indexes[i];
@@ -307,13 +307,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
             palchange |= 2;
         pkt->data[0] = palchange;
         memcpy(pkt->data + 1, smk->pal, 768);
-        ret = get_buffer(s->pb, pkt->data + 769, frame_size);
+        ret = avio_read(s->pb, pkt->data + 769, frame_size);
         if(ret != frame_size)
             return AVERROR(EIO);
         pkt->stream_index = smk->videoindex;
         pkt->size = ret + 769;
         smk->cur_frame++;
-        smk->nextpos = url_ftell(s->pb);
+        smk->nextpos = avio_tell(s->pb);
     } else {
         if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
             return AVERROR(ENOMEM);
@@ -334,17 +334,14 @@ static int smacker_read_close(AVFormatContext *s)
     int i;
 
     for(i = 0; i < 7; i++)
-        if(smk->bufs[i])
-            av_free(smk->bufs[i]);
-    if(smk->frm_size)
-        av_free(smk->frm_size);
-    if(smk->frm_flags)
-        av_free(smk->frm_flags);
+        av_free(smk->bufs[i]);
+    av_free(smk->frm_size);
+    av_free(smk->frm_flags);
 
     return 0;
 }
 
-AVInputFormat smacker_demuxer = {
+AVInputFormat ff_smacker_demuxer = {
     "smk",
     NULL_IF_CONFIG_SMALL("Smacker video"),
     sizeof(SmackerContext),
diff --git a/ffmpeg-mt/libavformat/sol.c b/ffmpeg-mt/libavformat/sol.c
index 5573ddd..1c9ce69 100644
--- a/ffmpeg-mt/libavformat/sol.c
+++ b/ffmpeg-mt/libavformat/sol.c
@@ -2,20 +2,20 @@
  * Sierra SOL demuxer
  * Copyright Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -87,21 +87,21 @@ static int sol_read_header(AVFormatContext *s,
 {
     int size;
     unsigned int magic,tag;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int id, channels, rate, type;
     enum CodecID codec;
     AVStream *st;
 
     /* check ".snd" header */
-    magic = get_le16(pb);
-    tag = get_le32(pb);
+    magic = avio_rl16(pb);
+    tag = avio_rl32(pb);
     if (tag != MKTAG('S', 'O', 'L', 0))
         return -1;
-    rate = get_le16(pb);
-    type = get_byte(pb);
-    size = get_le32(pb);
+    rate = avio_rl16(pb);
+    type = avio_r8(pb);
+    size = avio_rl32(pb);
     if (magic != 0x0B8D)
-        get_byte(pb); /* newer SOLs contain padding byte */
+        avio_r8(pb); /* newer SOLs contain padding byte */
 
     codec = sol_codec_id(magic, type);
     channels = sol_channels(magic, type);
@@ -130,7 +130,7 @@ static int sol_read_packet(AVFormatContext *s,
 {
     int ret;
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR(EIO);
     ret= av_get_packet(s->pb, pkt, MAX_SIZE);
     pkt->stream_index = 0;
@@ -141,7 +141,7 @@ static int sol_read_packet(AVFormatContext *s,
     return 0;
 }
 
-AVInputFormat sol_demuxer = {
+AVInputFormat ff_sol_demuxer = {
     "sol",
     NULL_IF_CONFIG_SMALL("Sierra SOL format"),
     0,
diff --git a/ffmpeg-mt/libavformat/sox.h b/ffmpeg-mt/libavformat/sox.h
index f4a12e9..e59531b 100644
--- a/ffmpeg-mt/libavformat/sox.h
+++ b/ffmpeg-mt/libavformat/sox.h
@@ -2,20 +2,20 @@
  * SoX native format common data
  * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/soxdec.c b/ffmpeg-mt/libavformat/soxdec.c
index 10c5bbe..74e5372 100644
--- a/ffmpeg-mt/libavformat/soxdec.c
+++ b/ffmpeg-mt/libavformat/soxdec.c
@@ -5,20 +5,20 @@
  * Based on libSoX sox-fmt.c
  * Copyright (c) 2008 robs at users.sourceforge.net
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -44,7 +44,7 @@ static int sox_probe(AVProbeData *p)
 static int sox_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned header_size, comment_size;
     double sample_rate, sample_rate_frac;
     AVStream *st;
@@ -55,20 +55,20 @@ static int sox_read_header(AVFormatContext *s,
 
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
 
-    if (get_le32(pb) == SOX_TAG) {
+    if (avio_rl32(pb) == SOX_TAG) {
         st->codec->codec_id = CODEC_ID_PCM_S32LE;
-        header_size         = get_le32(pb);
-        url_fskip(pb, 8); /* sample count */
-        sample_rate         = av_int2dbl(get_le64(pb));
-        st->codec->channels = get_le32(pb);
-        comment_size        = get_le32(pb);
+        header_size         = avio_rl32(pb);
+        avio_skip(pb, 8); /* sample count */
+        sample_rate         = av_int2dbl(avio_rl64(pb));
+        st->codec->channels = avio_rl32(pb);
+        comment_size        = avio_rl32(pb);
     } else {
         st->codec->codec_id = CODEC_ID_PCM_S32BE;
-        header_size         = get_be32(pb);
-        url_fskip(pb, 8); /* sample count */
-        sample_rate         = av_int2dbl(get_be64(pb));
-        st->codec->channels = get_be32(pb);
-        comment_size        = get_be32(pb);
+        header_size         = avio_rb32(pb);
+        avio_skip(pb, 8); /* sample count */
+        sample_rate         = av_int2dbl(avio_rb64(pb));
+        st->codec->channels = avio_rb32(pb);
+        comment_size        = avio_rb32(pb);
     }
 
     if (comment_size > 0xFFFFFFFFU - SOX_FIXED_HDR - 4U) {
@@ -95,7 +95,7 @@ static int sox_read_header(AVFormatContext *s,
 
     if (comment_size && comment_size < UINT_MAX) {
         char *comment = av_malloc(comment_size+1);
-        if (get_buffer(pb, comment, comment_size) != comment_size) {
+        if (avio_read(pb, comment, comment_size) != comment_size) {
             av_freep(&comment);
             return AVERROR(EIO);
         }
@@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s,
                                AV_METADATA_DONT_STRDUP_VAL);
     }
 
-    url_fskip(pb, header_size - SOX_FIXED_HDR - comment_size);
+    avio_skip(pb, header_size - SOX_FIXED_HDR - comment_size);
 
     st->codec->sample_rate           = sample_rate;
     st->codec->bits_per_coded_sample = 32;
@@ -127,7 +127,7 @@ static int sox_read_packet(AVFormatContext *s,
 {
     int ret, size;
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR_EOF;
 
     size = SOX_SAMPLES*s->streams[0]->codec->block_align;
@@ -140,7 +140,7 @@ static int sox_read_packet(AVFormatContext *s,
     return 0;
 }
 
-AVInputFormat sox_demuxer = {
+AVInputFormat ff_sox_demuxer = {
     "sox",
     NULL_IF_CONFIG_SMALL("SoX native format"),
     0,
diff --git a/ffmpeg-mt/libavformat/soxenc.c b/ffmpeg-mt/libavformat/soxenc.c
index 918bfad..cb71d73 100644
--- a/ffmpeg-mt/libavformat/soxenc.c
+++ b/ffmpeg-mt/libavformat/soxenc.c
@@ -5,20 +5,20 @@
  * Based on libSoX sox-fmt.c
  * Copyright (c) 2008 robs at users.sourceforge.net
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,6 +31,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "sox.h"
 
 typedef struct {
@@ -40,7 +41,7 @@ typedef struct {
 static int sox_write_header(AVFormatContext *s)
 {
     SoXContext *sox = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *enc = s->streams[0]->codec;
     AVMetadataTag *comment;
     size_t comment_len = 0, comment_size;
@@ -53,66 +54,66 @@ static int sox_write_header(AVFormatContext *s)
     sox->header_size = SOX_FIXED_HDR + comment_size;
 
     if (enc->codec_id == CODEC_ID_PCM_S32LE) {
-        put_tag(pb, ".SoX");
-        put_le32(pb, sox->header_size);
-        put_le64(pb, 0); /* number of samples */
-        put_le64(pb, av_dbl2int(enc->sample_rate));
-        put_le32(pb, enc->channels);
-        put_le32(pb, comment_size);
+        ffio_wfourcc(pb, ".SoX");
+        avio_wl32(pb, sox->header_size);
+        avio_wl64(pb, 0); /* number of samples */
+        avio_wl64(pb, av_dbl2int(enc->sample_rate));
+        avio_wl32(pb, enc->channels);
+        avio_wl32(pb, comment_size);
     } else if (enc->codec_id == CODEC_ID_PCM_S32BE) {
-        put_tag(pb, "XoS.");
-        put_be32(pb, sox->header_size);
-        put_be64(pb, 0); /* number of samples */
-        put_be64(pb, av_dbl2int(enc->sample_rate));
-        put_be32(pb, enc->channels);
-        put_be32(pb, comment_size);
+        ffio_wfourcc(pb, "XoS.");
+        avio_wb32(pb, sox->header_size);
+        avio_wb64(pb, 0); /* number of samples */
+        avio_wb64(pb, av_dbl2int(enc->sample_rate));
+        avio_wb32(pb, enc->channels);
+        avio_wb32(pb, comment_size);
     } else {
         av_log(s, AV_LOG_ERROR, "invalid codec; use pcm_s32le or pcm_s32be\n");
         return -1;
     }
 
     if (comment_len)
-        put_buffer(pb, comment->value, comment_len);
+        avio_write(pb, comment->value, comment_len);
 
     for ( ; comment_size > comment_len; comment_len++)
-        put_byte(pb, 0);
+        avio_w8(pb, 0);
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
 static int sox_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
+    AVIOContext *pb = s->pb;
+    avio_write(pb, pkt->data, pkt->size);
     return 0;
 }
 
 static int sox_write_trailer(AVFormatContext *s)
 {
     SoXContext *sox = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *enc = s->streams[0]->codec;
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
         /* update number of samples */
-        int64_t file_size = url_ftell(pb);
+        int64_t file_size = avio_tell(pb);
         int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL;
-        url_fseek(pb, 8, SEEK_SET);
+        avio_seek(pb, 8, SEEK_SET);
         if (enc->codec_id == CODEC_ID_PCM_S32LE) {
-            put_le64(pb, num_samples);
+            avio_wl64(pb, num_samples);
         } else
-            put_be64(pb, num_samples);
-        url_fseek(pb, file_size, SEEK_SET);
+            avio_wb64(pb, num_samples);
+        avio_seek(pb, file_size, SEEK_SET);
 
-        put_flush_packet(pb);
+        avio_flush(pb);
     }
 
     return 0;
 }
 
-AVOutputFormat sox_muxer = {
+AVOutputFormat ff_sox_muxer = {
     "sox",
     NULL_IF_CONFIG_SMALL("SoX native format"),
     NULL,
diff --git a/ffmpeg-mt/libavformat/spdif.c b/ffmpeg-mt/libavformat/spdif.c
index 604141a..777ac47 100644
--- a/ffmpeg-mt/libavformat/spdif.c
+++ b/ffmpeg-mt/libavformat/spdif.c
@@ -2,20 +2,20 @@
  * IEC 61937 common code
  * Copyright (c) 2009 Bartlomiej Wolowiec
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/spdif.h b/ffmpeg-mt/libavformat/spdif.h
index ac5be7c..dedb4e8 100644
--- a/ffmpeg-mt/libavformat/spdif.h
+++ b/ffmpeg-mt/libavformat/spdif.h
@@ -2,20 +2,20 @@
  * IEC 61937 common header
  * Copyright (c) 2009 Bartlomiej Wolowiec
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/spdifdec.c b/ffmpeg-mt/libavformat/spdifdec.c
index 05a9145..1c09025 100644
--- a/ffmpeg-mt/libavformat/spdifdec.c
+++ b/ffmpeg-mt/libavformat/spdifdec.c
@@ -2,20 +2,20 @@
  * IEC 61937 demuxer
  * Copyright (c) 2010 Anssi Hannula <anssi.hannula at iki.fi>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -163,20 +163,20 @@ static int spdif_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
 static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     enum IEC61937DataType data_type;
     enum CodecID codec_id;
     uint32_t state = 0;
     int pkt_size_bits, offset, ret;
 
     while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) {
-        state = (state << 8) | get_byte(pb);
-        if (url_feof(pb))
+        state = (state << 8) | avio_r8(pb);
+        if (pb->eof_reached)
             return AVERROR_EOF;
     }
 
-    data_type = get_le16(pb);
-    pkt_size_bits = get_le16(pb);
+    data_type = avio_rl16(pb);
+    pkt_size_bits = avio_rl16(pb);
 
     if (pkt_size_bits % 16)
         av_log_ask_for_sample(s, "Packet does not end to a 16-bit boundary.");
@@ -185,9 +185,9 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret)
         return ret;
 
-    pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE;
+    pkt->pos = avio_tell(pb) - BURST_HEADER_SIZE;
 
-    if (get_buffer(pb, pkt->data, pkt->size) < pkt->size) {
+    if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
         av_free_packet(pkt);
         return AVERROR_EOF;
     }
@@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     /* skip over the padding to the beginning of the next frame */
-    url_fskip(pb, offset - pkt->size - BURST_HEADER_SIZE);
+    avio_skip(pb, offset - pkt->size - BURST_HEADER_SIZE);
 
     if (!s->nb_streams) {
         /* first packet, create a stream */
@@ -225,7 +225,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-AVInputFormat spdif_demuxer = {
+AVInputFormat ff_spdif_demuxer = {
     "spdif",
     NULL_IF_CONFIG_SMALL("IEC 61937 (compressed data in S/PDIF)"),
     0,
diff --git a/ffmpeg-mt/libavformat/spdifenc.c b/ffmpeg-mt/libavformat/spdifenc.c
index d7a71e1..35c7b16 100644
--- a/ffmpeg-mt/libavformat/spdifenc.c
+++ b/ffmpeg-mt/libavformat/spdifenc.c
@@ -4,20 +4,20 @@
  * Copyright (c) 2010 Anssi Hannula
  * Copyright (c) 2010 Carl Eugen Hoyos
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -45,12 +45,16 @@
  */
 
 #include "avformat.h"
+#include "avio_internal.h"
 #include "spdif.h"
 #include "libavcodec/ac3.h"
 #include "libavcodec/dca.h"
+#include "libavcodec/dcadata.h"
 #include "libavcodec/aacadtsdec.h"
+#include "libavutil/opt.h"
 
 typedef struct IEC61937Context {
+    const AVClass *av_class;
     enum IEC61937DataType data_type;///< burst info - reference to type of payload of the data-burst
     int length_code;                ///< length code in bits or bytes, depending on data type
     int pkt_offset;                 ///< data burst repetition period in bytes
@@ -68,11 +72,28 @@ typedef struct IEC61937Context {
     int hd_buf_count;               ///< number of frames in the hd audio buffer
     int hd_buf_filled;              ///< amount of bytes in the hd audio buffer
 
+    int dtshd_skip;                 ///< counter used for skipping DTS-HD frames
+
+    /* AVOptions: */
+    int dtshd_rate;
+    int dtshd_fallback;
+#define SPDIF_FLAG_BIGENDIAN    0x01
+    int spdif_flags;
+
     /// function, which generates codec dependent header information.
     /// Sets data_type and pkt_offset, and length_code, out_bytes, out_buf if necessary
     int (*header_info) (AVFormatContext *s, AVPacket *pkt);
 } IEC61937Context;
 
+static const AVOption options[] = {
+{ "spdif_flags", "IEC 61937 encapsulation flags", offsetof(IEC61937Context, spdif_flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" },
+{ "be", "output in big-endian format (for use as s16be)", 0, FF_OPT_TYPE_CONST, SPDIF_FLAG_BIGENDIAN, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" },
+{ "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 rate (in Hz, default 0=disabled)", offsetof(IEC61937Context, dtshd_rate), FF_OPT_TYPE_INT, 0, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM },
+{ "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till the end, default 60)", offsetof(IEC61937Context, dtshd_fallback), FF_OPT_TYPE_INT, 60, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+{ NULL },
+};
+
+static const AVClass class = { "spdif", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
 
 static int spdif_header_ac3(AVFormatContext *s, AVPacket *pkt)
 {
@@ -115,15 +136,116 @@ static int spdif_header_eac3(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
+/*
+ * DTS type IV (DTS-HD) can be transmitted with various frame repetition
+ * periods; longer repetition periods allow for longer packets and therefore
+ * higher bitrate. Longer repetition periods mean that the constant bitrate of
+ * the outputted IEC 61937 stream is higher.
+ * The repetition period is measured in IEC 60958 frames (4 bytes).
+ */
+static int spdif_dts4_subtype(int period)
+{
+    switch (period) {
+    case 512:   return 0x0;
+    case 1024:  return 0x1;
+    case 2048:  return 0x2;
+    case 4096:  return 0x3;
+    case 8192:  return 0x4;
+    case 16384: return 0x5;
+    }
+    return -1;
+}
+
+static int spdif_header_dts4(AVFormatContext *s, AVPacket *pkt, int core_size,
+                             int sample_rate, int blocks)
+{
+    IEC61937Context *ctx = s->priv_data;
+    static const char dtshd_start_code[10] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe };
+    int pkt_size = pkt->size;
+    int period;
+    int subtype;
+
+    if (!core_size) {
+        av_log(s, AV_LOG_ERROR, "HD mode not supported for this format\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (!sample_rate) {
+        av_log(s, AV_LOG_ERROR, "Unknown DTS sample rate for HD\n");
+        return AVERROR_INVALIDDATA;
+    }
+
+    period = ctx->dtshd_rate * (blocks << 5) / sample_rate;
+    subtype = spdif_dts4_subtype(period);
+
+    if (subtype < 0) {
+        av_log(s, AV_LOG_ERROR, "Specified HD rate of %d Hz would require an "
+               "impossible repetition period of %d for the current DTS stream"
+               " (blocks = %d, sample rate = %d)\n", ctx->dtshd_rate, period,
+               blocks << 5, sample_rate);
+        return AVERROR(EINVAL);
+    }
+
+    /* set pkt_offset and DTS IV subtype according to the requested output
+     * rate */
+    ctx->pkt_offset = period * 4;
+    ctx->data_type = IEC61937_DTSHD | subtype << 8;
+
+    /* If the bitrate is too high for transmitting at the selected
+     * repetition period setting, strip DTS-HD until a good amount
+     * of consecutive non-overflowing HD frames have been observed.
+     * This generally only happens if the caller is cramming a Master
+     * Audio stream into 192kHz IEC 60958 (which may or may not fit). */
+    if (sizeof(dtshd_start_code) + 2 + pkt_size
+            > ctx->pkt_offset - BURST_HEADER_SIZE && core_size) {
+        if (!ctx->dtshd_skip)
+            av_log(s, AV_LOG_WARNING, "DTS-HD bitrate too high, "
+                                      "temporarily sending core only\n");
+        if (ctx->dtshd_fallback > 0)
+            ctx->dtshd_skip = sample_rate * ctx->dtshd_fallback / (blocks << 5);
+        else
+            /* skip permanently (dtshd_fallback == -1) or just once
+             * (dtshd_fallback == 0) */
+            ctx->dtshd_skip = 1;
+    }
+    if (ctx->dtshd_skip && core_size) {
+        pkt_size = core_size;
+        if (ctx->dtshd_fallback >= 0)
+            --ctx->dtshd_skip;
+    }
+
+    ctx->out_bytes   = sizeof(dtshd_start_code) + 2 + pkt_size;
+    ctx->length_code = ctx->out_bytes;
+
+    av_fast_malloc(&ctx->hd_buf, &ctx->hd_buf_size, ctx->out_bytes);
+    if (!ctx->hd_buf)
+        return AVERROR(ENOMEM);
+
+    ctx->out_buf = ctx->hd_buf;
+
+    memcpy(ctx->hd_buf, dtshd_start_code, sizeof(dtshd_start_code));
+    AV_WB16(ctx->hd_buf + sizeof(dtshd_start_code), pkt_size);
+    memcpy(ctx->hd_buf + sizeof(dtshd_start_code) + 2, pkt->data, pkt_size);
+
+    return 0;
+}
+
 static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
 {
     IEC61937Context *ctx = s->priv_data;
     uint32_t syncword_dts = AV_RB32(pkt->data);
     int blocks;
+    int sample_rate = 0;
+    int core_size = 0;
+
+    if (pkt->size < 9)
+        return AVERROR_INVALIDDATA;
 
     switch (syncword_dts) {
     case DCA_MARKER_RAW_BE:
         blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f;
+        core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1;
+        sample_rate = dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
         break;
     case DCA_MARKER_RAW_LE:
         blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f;
@@ -138,11 +260,22 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
             (((pkt->data[4] & 0x07) << 4) | ((pkt->data[7] & 0x3f) >> 2));
         ctx->extra_bswap = 1;
         break;
+    case DCA_HD_MARKER:
+        /* We only handle HD frames that are paired with core. However,
+           sometimes DTS-HD streams with core have a stray HD frame without
+           core in the beginning of the stream. */
+        av_log(s, AV_LOG_ERROR, "stray DTS-HD frame\n");
+        return AVERROR_INVALIDDATA;
     default:
         av_log(s, AV_LOG_ERROR, "bad DTS syncword 0x%x\n", syncword_dts);
         return AVERROR_INVALIDDATA;
     }
     blocks++;
+
+    if (ctx->dtshd_rate)
+        /* DTS type IV output requested */
+        return spdif_header_dts4(s, pkt, core_size, sample_rate, blocks);
+
     switch (blocks) {
     case  512 >> 5: ctx->data_type = IEC61937_DTS1; break;
     case 1024 >> 5: ctx->data_type = IEC61937_DTS2; break;
@@ -152,6 +285,13 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
                blocks << 5);
         return AVERROR(ENOSYS);
     }
+
+    /* discard extraneous data by default */
+    if (core_size && core_size < pkt->size) {
+        ctx->out_bytes = core_size;
+        ctx->length_code = core_size << 3;
+    }
+
     ctx->pkt_offset = blocks << 7;
 
     if (ctx->out_bytes == ctx->pkt_offset) {
@@ -159,6 +299,9 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
          * preamble as it would not fit in there. This is the case for dts
          * discs and dts-in-wav. */
         ctx->use_preamble = 0;
+    } else if (ctx->out_bytes > ctx->pkt_offset - BURST_HEADER_SIZE) {
+        av_log_ask_for_sample(s, "Unrecognized large DTS frame.");
+        /* This will fail with a "bitrate too high" in the caller */
     }
 
     return 0;
@@ -330,6 +473,15 @@ static int spdif_write_trailer(AVFormatContext *s)
     return 0;
 }
 
+static av_always_inline void spdif_put_16(IEC61937Context *ctx,
+                                          AVIOContext *pb, unsigned int val)
+{
+    if (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)
+        avio_wb16(pb, val);
+    else
+        avio_wl16(pb, val);
+}
+
 static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     IEC61937Context *ctx = s->priv_data;
@@ -354,35 +506,36 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     }
 
     if (ctx->use_preamble) {
-        put_le16(s->pb, SYNCWORD1);       //Pa
-        put_le16(s->pb, SYNCWORD2);       //Pb
-        put_le16(s->pb, ctx->data_type);  //Pc
-        put_le16(s->pb, ctx->length_code);//Pd
+        spdif_put_16(ctx, s->pb, SYNCWORD1);       //Pa
+        spdif_put_16(ctx, s->pb, SYNCWORD2);       //Pb
+        spdif_put_16(ctx, s->pb, ctx->data_type);  //Pc
+        spdif_put_16(ctx, s->pb, ctx->length_code);//Pd
     }
 
-    if (HAVE_BIGENDIAN ^ ctx->extra_bswap) {
-    put_buffer(s->pb, ctx->out_buf, ctx->out_bytes & ~1);
+    if (ctx->extra_bswap ^ (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)) {
+    avio_write(s->pb, ctx->out_buf, ctx->out_bytes & ~1);
     } else {
     av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE);
     if (!ctx->buffer)
         return AVERROR(ENOMEM);
     ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1);
-    put_buffer(s->pb, ctx->buffer, ctx->out_bytes & ~1);
+    avio_write(s->pb, ctx->buffer, ctx->out_bytes & ~1);
     }
 
+    /* a final lone byte has to be MSB aligned */
     if (ctx->out_bytes & 1)
-        put_be16(s->pb, ctx->out_buf[ctx->out_bytes - 1]);
+        spdif_put_16(ctx, s->pb, ctx->out_buf[ctx->out_bytes - 1] << 8);
 
-    put_nbyte(s->pb, 0, padding);
+    ffio_fill(s->pb, 0, padding);
 
     av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n",
            ctx->data_type, ctx->out_bytes, ctx->pkt_offset);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     return 0;
 }
 
-AVOutputFormat spdif_muxer = {
+AVOutputFormat ff_spdif_muxer = {
     "spdif",
     NULL_IF_CONFIG_SMALL("IEC 61937 (used on S/PDIF - IEC958)"),
     NULL,
@@ -393,4 +546,6 @@ AVOutputFormat spdif_muxer = {
     spdif_write_header,
     spdif_write_packet,
     spdif_write_trailer,
+    .flags = AVFMT_NOTIMESTAMPS,
+    .priv_class = &class,
 };
diff --git a/ffmpeg-mt/libavformat/srtdec.c b/ffmpeg-mt/libavformat/srtdec.c
index 104031a..72c5c80 100644
--- a/ffmpeg-mt/libavformat/srtdec.c
+++ b/ffmpeg-mt/libavformat/srtdec.c
@@ -2,20 +2,20 @@
  * SubRip subtitle demuxer
  * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -75,13 +75,13 @@ static inline int is_eol(char c)
 static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     char buffer[2048], *ptr = buffer, *ptr2;
-    int64_t pos = url_ftell(s->pb);
+    int64_t pos = avio_tell(s->pb);
     int res = AVERROR_EOF;
 
     do {
         ptr2 = ptr;
         ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr);
-    } while (!is_eol(*ptr2) && !url_feof(s->pb) && ptr-buffer<sizeof(buffer)-1);
+    } while (!is_eol(*ptr2) && !s->pb->eof_reached && ptr-buffer<sizeof(buffer)-1);
 
     if (buffer[0] && !(res = av_new_packet(pkt, ptr-buffer))) {
         memcpy(pkt->data, buffer, pkt->size);
@@ -92,7 +92,7 @@ static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
     return res;
 }
 
-AVInputFormat srt_demuxer = {
+AVInputFormat ff_srt_demuxer = {
     .name        = "srt",
     .long_name   = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
     .read_probe  = srt_probe,
diff --git a/ffmpeg-mt/libavformat/swf.h b/ffmpeg-mt/libavformat/swf.h
index affebe9..2be6cd5 100644
--- a/ffmpeg-mt/libavformat/swf.h
+++ b/ffmpeg-mt/libavformat/swf.h
@@ -3,20 +3,20 @@
  * Copyright (c) 2000 Fabrice Bellard
  * Copyright (c) 2003 Tinic Uro
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/swfdec.c b/ffmpeg-mt/libavformat/swfdec.c
index 64f775f..eec9524 100644
--- a/ffmpeg-mt/libavformat/swfdec.c
+++ b/ffmpeg-mt/libavformat/swfdec.c
@@ -3,38 +3,38 @@
  * Copyright (c) 2000 Fabrice Bellard
  * Copyright (c) 2003 Tinic Uro
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/intreadwrite.h"
 #include "swf.h"
 
-static int get_swf_tag(ByteIOContext *pb, int *len_ptr)
+static int get_swf_tag(AVIOContext *pb, int *len_ptr)
 {
     int tag, len;
 
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return -1;
 
-    tag = get_le16(pb);
+    tag = avio_rl16(pb);
     len = tag & 0x3f;
     tag = tag >> 6;
     if (len == 0x3f) {
-        len = get_le32(pb);
+        len = avio_rl32(pb);
     }
 //    av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
     *len_ptr = len;
@@ -55,10 +55,10 @@ static int swf_probe(AVProbeData *p)
 static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int nbits, len, tag;
 
-    tag = get_be32(pb) & 0xffffff00;
+    tag = avio_rb32(pb) & 0xffffff00;
 
     if (tag == MKBETAG('C', 'W', 'S', 0)) {
         av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n");
@@ -66,13 +66,13 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
     }
     if (tag != MKBETAG('F', 'W', 'S', 0))
         return AVERROR(EIO);
-    get_le32(pb);
+    avio_rl32(pb);
     /* skip rectangle size */
-    nbits = get_byte(pb) >> 3;
+    nbits = avio_r8(pb) >> 3;
     len = (4 * nbits - 3 + 7) / 8;
-    url_fskip(pb, len);
-    swf->frame_rate = get_le16(pb); /* 8.8 fixed */
-    get_le16(pb); /* frame count */
+    avio_skip(pb, len);
+    swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */
+    avio_rl16(pb); /* frame count */
 
     swf->samples_per_frame = 0;
     s->ctx_flags |= AVFMTCTX_NOHEADER;
@@ -82,17 +82,17 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *vst = NULL, *ast = NULL, *st = 0;
     int tag, len, i, frame, v;
 
     for(;;) {
-        uint64_t pos = url_ftell(pb);
+        uint64_t pos = avio_tell(pb);
         tag = get_swf_tag(pb, &len);
         if (tag < 0)
             return AVERROR(EIO);
         if (tag == TAG_VIDEOSTREAM) {
-            int ch_id = get_le16(pb);
+            int ch_id = avio_rl16(pb);
             len -= 2;
 
             for (i=0; i<s->nb_streams; i++) {
@@ -101,16 +101,16 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
                     goto skip;
             }
 
-            get_le16(pb);
-            get_le16(pb);
-            get_le16(pb);
-            get_byte(pb);
+            avio_rl16(pb);
+            avio_rl16(pb);
+            avio_rl16(pb);
+            avio_r8(pb);
             /* Check for FLV1 */
             vst = av_new_stream(s, ch_id);
             if (!vst)
                 return -1;
             vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb));
+            vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
             av_set_pts_info(vst, 16, 256, swf->frame_rate);
             vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
             len -= 8;
@@ -124,9 +124,9 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
                     goto skip;
             }
 
-            get_byte(pb);
-            v = get_byte(pb);
-            swf->samples_per_frame = get_le16(pb);
+            avio_r8(pb);
+            v = avio_r8(pb);
+            swf->samples_per_frame = avio_rl16(pb);
             ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
             if (!ast)
                 return -1;
@@ -141,12 +141,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
             av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
             len -= 4;
         } else if (tag == TAG_VIDEOFRAME) {
-            int ch_id = get_le16(pb);
+            int ch_id = avio_rl16(pb);
             len -= 2;
             for(i=0; i<s->nb_streams; i++) {
                 st = s->streams[i];
                 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
-                    frame = get_le16(pb);
+                    frame = avio_rl16(pb);
                     av_get_packet(pb, pkt, len-2);
                     pkt->pos = pos;
                     pkt->pts = frame;
@@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
                 st = s->streams[i];
                 if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
             if (st->codec->codec_id == CODEC_ID_MP3) {
-                url_fskip(pb, 4);
+                avio_skip(pb, 4);
                 av_get_packet(pb, pkt, len-4);
             } else { // ADPCM, PCM
                 av_get_packet(pb, pkt, len);
@@ -185,29 +185,29 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
                 vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
                 st = vst;
             }
-            get_le16(pb); /* BITMAP_ID */
+            avio_rl16(pb); /* BITMAP_ID */
             av_new_packet(pkt, len-2);
-            get_buffer(pb, pkt->data, 4);
+            avio_read(pb, pkt->data, 4);
             if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
                 AV_RB32(pkt->data) == 0xffd9ffd8) {
                 /* old SWF files containing SOI/EOI as data start */
                 /* files created by swink have reversed tag */
                 pkt->size -= 4;
-                get_buffer(pb, pkt->data, pkt->size);
+                avio_read(pb, pkt->data, pkt->size);
             } else {
-                get_buffer(pb, pkt->data + 4, pkt->size - 4);
+                avio_read(pb, pkt->data + 4, pkt->size - 4);
             }
             pkt->pos = pos;
             pkt->stream_index = st->index;
             return pkt->size;
         }
     skip:
-        url_fskip(pb, len);
+        avio_skip(pb, len);
     }
     return 0;
 }
 
-AVInputFormat swf_demuxer = {
+AVInputFormat ff_swf_demuxer = {
     "swf",
     NULL_IF_CONFIG_SMALL("Flash format"),
     sizeof(SWFContext),
diff --git a/ffmpeg-mt/libavformat/swfenc.c b/ffmpeg-mt/libavformat/swfenc.c
index 1a1a9ab..4c5c315 100644
--- a/ffmpeg-mt/libavformat/swfenc.c
+++ b/ffmpeg-mt/libavformat/swfenc.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000 Fabrice Bellard
  * Copyright (c) 2003 Tinic Uro
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,39 +27,39 @@
 static void put_swf_tag(AVFormatContext *s, int tag)
 {
     SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
-    swf->tag_pos = url_ftell(pb);
+    swf->tag_pos = avio_tell(pb);
     swf->tag = tag;
     /* reserve some room for the tag */
     if (tag & TAG_LONG) {
-        put_le16(pb, 0);
-        put_le32(pb, 0);
+        avio_wl16(pb, 0);
+        avio_wl32(pb, 0);
     } else {
-        put_le16(pb, 0);
+        avio_wl16(pb, 0);
     }
 }
 
 static void put_swf_end_tag(AVFormatContext *s)
 {
     SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t pos;
     int tag_len, tag;
 
-    pos = url_ftell(pb);
+    pos = avio_tell(pb);
     tag_len = pos - swf->tag_pos - 2;
     tag = swf->tag;
-    url_fseek(pb, swf->tag_pos, SEEK_SET);
+    avio_seek(pb, swf->tag_pos, SEEK_SET);
     if (tag & TAG_LONG) {
         tag &= ~TAG_LONG;
-        put_le16(pb, (tag << 6) | 0x3f);
-        put_le32(pb, tag_len - 4);
+        avio_wl16(pb, (tag << 6) | 0x3f);
+        avio_wl32(pb, tag_len - 4);
     } else {
         assert(tag_len < 0x3f);
-        put_le16(pb, (tag << 6) | tag_len);
+        avio_wl16(pb, (tag << 6) | tag_len);
     }
-    url_fseek(pb, pos, SEEK_SET);
+    avio_seek(pb, pos, SEEK_SET);
 }
 
 static inline void max_nbits(int *nbits_ptr, int val)
@@ -78,7 +78,7 @@ static inline void max_nbits(int *nbits_ptr, int val)
         *nbits_ptr = n;
 }
 
-static void put_swf_rect(ByteIOContext *pb,
+static void put_swf_rect(AVIOContext *pb,
                          int xmin, int xmax, int ymin, int ymax)
 {
     PutBitContext p;
@@ -102,7 +102,7 @@ static void put_swf_rect(ByteIOContext *pb,
     put_bits(&p, nbits, ymax & mask);
 
     flush_put_bits(&p);
-    put_buffer(pb, buf, put_bits_ptr(&p) - p.buf);
+    avio_write(pb, buf, put_bits_ptr(&p) - p.buf);
 }
 
 static void put_swf_line_edge(PutBitContext *pb, int dx, int dy)
@@ -134,7 +134,7 @@ static void put_swf_line_edge(PutBitContext *pb, int dx, int dy)
 
 #define FRAC_BITS 16
 
-static void put_swf_matrix(ByteIOContext *pb,
+static void put_swf_matrix(AVIOContext *pb,
                            int a, int b, int c, int d, int tx, int ty)
 {
     PutBitContext p;
@@ -167,13 +167,13 @@ static void put_swf_matrix(ByteIOContext *pb,
     put_bits(&p, nbits, ty);
 
     flush_put_bits(&p);
-    put_buffer(pb, buf, put_bits_ptr(&p) - p.buf);
+    avio_write(pb, buf, put_bits_ptr(&p) - p.buf);
 }
 
 static int swf_write_header(AVFormatContext *s)
 {
     SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     PutBitContext p;
     uint8_t buf1[256];
     int i, width, height, rate, rate_base;
@@ -229,7 +229,7 @@ static int swf_write_header(AVFormatContext *s)
     else
         swf->samples_per_frame = (swf->audio_enc->sample_rate * rate_base) / rate;
 
-    put_tag(pb, "FWS");
+    avio_write(pb, "FWS", 3);
 
     if (!strcmp("avm2", s->oformat->name))
         version = 9;
@@ -239,20 +239,20 @@ static int swf_write_header(AVFormatContext *s)
         version = 6; /* version 6 and above support FLV1 codec */
     else
         version = 4; /* version 4 for mpeg audio support */
-    put_byte(pb, version);
+    avio_w8(pb, version);
 
-    put_le32(pb, DUMMY_FILE_SIZE); /* dummy size
+    avio_wl32(pb, DUMMY_FILE_SIZE); /* dummy size
                                       (will be patched if not streamed) */
 
     put_swf_rect(pb, 0, width * 20, 0, height * 20);
-    put_le16(pb, (rate * 256) / rate_base); /* frame rate */
-    swf->duration_pos = url_ftell(pb);
-    put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
+    avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */
+    swf->duration_pos = avio_tell(pb);
+    avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
 
     /* avm2/swf v9 (also v8?) files require a file attribute tag */
     if (version == 9) {
         put_swf_tag(s, TAG_FILEATTRIBUTES);
-        put_le32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */
+        avio_wl32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */
         put_swf_end_tag(s);
     }
 
@@ -260,17 +260,17 @@ static int swf_write_header(AVFormatContext *s)
     if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_MJPEG) {
         put_swf_tag(s, TAG_DEFINESHAPE);
 
-        put_le16(pb, SHAPE_ID); /* ID of shape */
+        avio_wl16(pb, SHAPE_ID); /* ID of shape */
         /* bounding rectangle */
         put_swf_rect(pb, 0, width, 0, height);
         /* style info */
-        put_byte(pb, 1); /* one fill style */
-        put_byte(pb, 0x41); /* clipped bitmap fill */
-        put_le16(pb, BITMAP_ID); /* bitmap ID */
+        avio_w8(pb, 1); /* one fill style */
+        avio_w8(pb, 0x41); /* clipped bitmap fill */
+        avio_wl16(pb, BITMAP_ID); /* bitmap ID */
         /* position of the bitmap */
         put_swf_matrix(pb, (int)(1.0 * (1 << FRAC_BITS)), 0,
                        0, (int)(1.0 * (1 << FRAC_BITS)), 0, 0);
-        put_byte(pb, 0); /* no line style */
+        avio_w8(pb, 0); /* no line style */
 
         /* shape drawing */
         init_put_bits(&p, buf1, sizeof(buf1));
@@ -295,7 +295,7 @@ static int swf_write_header(AVFormatContext *s)
         put_bits(&p, 5, 0);
 
         flush_put_bits(&p);
-        put_buffer(pb, buf1, put_bits_ptr(&p) - p.buf);
+        avio_write(pb, buf1, put_bits_ptr(&p) - p.buf);
 
         put_swf_end_tag(s);
     }
@@ -317,16 +317,16 @@ static int swf_write_header(AVFormatContext *s)
         v |= 0x02; /* 16 bit playback */
         if (swf->audio_enc->channels == 2)
             v |= 0x01; /* stereo playback */
-        put_byte(s->pb, v);
+        avio_w8(s->pb, v);
         v |= 0x20; /* mp3 compressed */
-        put_byte(s->pb, v);
-        put_le16(s->pb, swf->samples_per_frame);  /* avg samples per frame */
-        put_le16(s->pb, 0);
+        avio_w8(s->pb, v);
+        avio_wl16(s->pb, swf->samples_per_frame);  /* avg samples per frame */
+        avio_wl16(s->pb, 0);
 
         put_swf_end_tag(s);
     }
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
     return 0;
 }
 
@@ -334,7 +334,7 @@ static int swf_write_video(AVFormatContext *s,
                            AVCodecContext *enc, const uint8_t *buf, int size)
 {
     SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     /* Flash Player limit */
     if (swf->swf_frame_number == 16000)
@@ -345,70 +345,70 @@ static int swf_write_video(AVFormatContext *s,
         if (swf->video_frame_number == 0) {
             /* create a new video object */
             put_swf_tag(s, TAG_VIDEOSTREAM);
-            put_le16(pb, VIDEO_ID);
-            swf->vframes_pos = url_ftell(pb);
-            put_le16(pb, 15000); /* hard flash player limit */
-            put_le16(pb, enc->width);
-            put_le16(pb, enc->height);
-            put_byte(pb, 0);
-            put_byte(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id));
+            avio_wl16(pb, VIDEO_ID);
+            swf->vframes_pos = avio_tell(pb);
+            avio_wl16(pb, 15000); /* hard flash player limit */
+            avio_wl16(pb, enc->width);
+            avio_wl16(pb, enc->height);
+            avio_w8(pb, 0);
+            avio_w8(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id));
             put_swf_end_tag(s);
 
             /* place the video object for the first time */
             put_swf_tag(s, TAG_PLACEOBJECT2);
-            put_byte(pb, 0x36);
-            put_le16(pb, 1);
-            put_le16(pb, VIDEO_ID);
+            avio_w8(pb, 0x36);
+            avio_wl16(pb, 1);
+            avio_wl16(pb, VIDEO_ID);
             put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0);
-            put_le16(pb, swf->video_frame_number);
-            put_tag(pb, "video");
-            put_byte(pb, 0x00);
+            avio_wl16(pb, swf->video_frame_number);
+            avio_write(pb, "video", 5);
+            avio_w8(pb, 0x00);
             put_swf_end_tag(s);
         } else {
             /* mark the character for update */
             put_swf_tag(s, TAG_PLACEOBJECT2);
-            put_byte(pb, 0x11);
-            put_le16(pb, 1);
-            put_le16(pb, swf->video_frame_number);
+            avio_w8(pb, 0x11);
+            avio_wl16(pb, 1);
+            avio_wl16(pb, swf->video_frame_number);
             put_swf_end_tag(s);
         }
 
         /* set video frame data */
         put_swf_tag(s, TAG_VIDEOFRAME | TAG_LONG);
-        put_le16(pb, VIDEO_ID);
-        put_le16(pb, swf->video_frame_number++);
-        put_buffer(pb, buf, size);
+        avio_wl16(pb, VIDEO_ID);
+        avio_wl16(pb, swf->video_frame_number++);
+        avio_write(pb, buf, size);
         put_swf_end_tag(s);
     } else if (enc->codec_id == CODEC_ID_MJPEG) {
         if (swf->swf_frame_number > 0) {
             /* remove the shape */
             put_swf_tag(s, TAG_REMOVEOBJECT);
-            put_le16(pb, SHAPE_ID); /* shape ID */
-            put_le16(pb, 1); /* depth */
+            avio_wl16(pb, SHAPE_ID); /* shape ID */
+            avio_wl16(pb, 1); /* depth */
             put_swf_end_tag(s);
 
             /* free the bitmap */
             put_swf_tag(s, TAG_FREECHARACTER);
-            put_le16(pb, BITMAP_ID);
+            avio_wl16(pb, BITMAP_ID);
             put_swf_end_tag(s);
         }
 
         put_swf_tag(s, TAG_JPEG2 | TAG_LONG);
 
-        put_le16(pb, BITMAP_ID); /* ID of the image */
+        avio_wl16(pb, BITMAP_ID); /* ID of the image */
 
         /* a dummy jpeg header seems to be required */
-        put_be32(pb, 0xffd8ffd9);
+        avio_wb32(pb, 0xffd8ffd9);
         /* write the jpeg image */
-        put_buffer(pb, buf, size);
+        avio_write(pb, buf, size);
 
         put_swf_end_tag(s);
 
         /* draw the shape */
 
         put_swf_tag(s, TAG_PLACEOBJECT);
-        put_le16(pb, SHAPE_ID); /* shape ID */
-        put_le16(pb, 1); /* depth */
+        avio_wl16(pb, SHAPE_ID); /* shape ID */
+        avio_wl16(pb, 1); /* depth */
         put_swf_matrix(pb, 20 << FRAC_BITS, 0, 0, 20 << FRAC_BITS, 0, 0);
         put_swf_end_tag(s);
     }
@@ -419,9 +419,9 @@ static int swf_write_video(AVFormatContext *s,
     if (swf->audio_enc && av_fifo_size(swf->audio_fifo)) {
         int frame_size = av_fifo_size(swf->audio_fifo);
         put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);
-        put_le16(pb, swf->sound_samples);
-        put_le16(pb, 0); // seek samples
-        av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &put_buffer);
+        avio_wl16(pb, swf->sound_samples);
+        avio_wl16(pb, 0); // seek samples
+        av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &avio_write);
         put_swf_end_tag(s);
 
         /* update FIFO */
@@ -432,7 +432,7 @@ static int swf_write_video(AVFormatContext *s,
     put_swf_tag(s, TAG_SHOWFRAME);
     put_swf_end_tag(s);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     return 0;
 }
@@ -473,7 +473,7 @@ static int swf_write_packet(AVFormatContext *s, AVPacket *pkt)
 static int swf_write_trailer(AVFormatContext *s)
 {
     SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVCodecContext *enc, *video_enc;
     int file_size, i;
 
@@ -489,24 +489,24 @@ static int swf_write_trailer(AVFormatContext *s)
     put_swf_tag(s, TAG_END);
     put_swf_end_tag(s);
 
-    put_flush_packet(s->pb);
+    avio_flush(s->pb);
 
     /* patch file size and number of frames if not streamed */
-    if (!url_is_streamed(s->pb) && video_enc) {
-        file_size = url_ftell(pb);
-        url_fseek(pb, 4, SEEK_SET);
-        put_le32(pb, file_size);
-        url_fseek(pb, swf->duration_pos, SEEK_SET);
-        put_le16(pb, swf->video_frame_number);
-        url_fseek(pb, swf->vframes_pos, SEEK_SET);
-        put_le16(pb, swf->video_frame_number);
-        url_fseek(pb, file_size, SEEK_SET);
+    if (s->pb->seekable && video_enc) {
+        file_size = avio_tell(pb);
+        avio_seek(pb, 4, SEEK_SET);
+        avio_wl32(pb, file_size);
+        avio_seek(pb, swf->duration_pos, SEEK_SET);
+        avio_wl16(pb, swf->video_frame_number);
+        avio_seek(pb, swf->vframes_pos, SEEK_SET);
+        avio_wl16(pb, swf->video_frame_number);
+        avio_seek(pb, file_size, SEEK_SET);
     }
     return 0;
 }
 
 #if CONFIG_SWF_MUXER
-AVOutputFormat swf_muxer = {
+AVOutputFormat ff_swf_muxer = {
     "swf",
     NULL_IF_CONFIG_SMALL("Flash format"),
     "application/x-shockwave-flash",
@@ -520,7 +520,7 @@ AVOutputFormat swf_muxer = {
 };
 #endif
 #if CONFIG_AVM2_MUXER
-AVOutputFormat avm2_muxer = {
+AVOutputFormat ff_avm2_muxer = {
     "avm2",
     NULL_IF_CONFIG_SMALL("Flash 9 (AVM2) format"),
     "application/x-shockwave-flash",
diff --git a/ffmpeg-mt/libavformat/tcp.c b/ffmpeg-mt/libavformat/tcp.c
index 14b5e19..0cb3ae3 100644
--- a/ffmpeg-mt/libavformat/tcp.c
+++ b/ffmpeg-mt/libavformat/tcp.c
@@ -2,29 +2,31 @@
  * TCP protocol
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "libavutil/parseutils.h"
 #include <unistd.h>
 #include "internal.h"
 #include "network.h"
 #include "os_support.h"
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#include "url.h"
+#if HAVE_POLL_H
+#include <poll.h>
 #endif
 #include <sys/time.h>
 
@@ -38,9 +40,10 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
     struct addrinfo hints, *ai, *cur_ai;
     int port, fd = -1;
     TCPContext *s = NULL;
-    fd_set wfds, efds;
-    int fd_max, ret;
-    struct timeval tv;
+    int listen_socket = 0;
+    const char *p;
+    char buf[256];
+    int ret;
     socklen_t optlen;
     char hostname[1024],proto[1024],path[1024];
     char portstr[10];
@@ -50,6 +53,11 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
     if (strcmp(proto,"tcp") || port <= 0 || port >= 65536)
         return AVERROR(EINVAL);
 
+    p = strchr(uri, '?');
+    if (p) {
+        if (av_find_info_tag(buf, sizeof(buf), "listen", p))
+            listen_socket = 1;
+    }
     memset(&hints, 0, sizeof(hints));
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
@@ -68,35 +76,42 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
     fd = socket(cur_ai->ai_family, cur_ai->ai_socktype, cur_ai->ai_protocol);
     if (fd < 0)
         goto fail;
-    ff_socket_nonblock(fd, 1);
 
+    if (listen_socket) {
+        int fd1;
+        ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+        listen(fd, 1);
+        fd1 = accept(fd, NULL, NULL);
+        closesocket(fd);
+        fd = fd1;
+    } else {
  redo:
-    ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+        ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+    }
+
+    ff_socket_nonblock(fd, 1);
+
     if (ret < 0) {
-        if (ff_neterrno() == FF_NETERROR(EINTR)) {
-            if (url_interrupt_cb())
+        struct pollfd p = {fd, POLLOUT, 0};
+        if (ff_neterrno() == AVERROR(EINTR)) {
+            if (url_interrupt_cb()) {
+                ret = AVERROR_EXIT;
                 goto fail1;
+            }
             goto redo;
         }
-        if (ff_neterrno() != FF_NETERROR(EINPROGRESS) &&
-            ff_neterrno() != FF_NETERROR(EAGAIN))
+        if (ff_neterrno() != AVERROR(EINPROGRESS) &&
+            ff_neterrno() != AVERROR(EAGAIN))
             goto fail;
 
         /* wait until we are connected or until abort */
         for(;;) {
             if (url_interrupt_cb()) {
-                ret = AVERROR(EINTR);
+                ret = AVERROR_EXIT;
                 goto fail1;
             }
-            fd_max = fd;
-            FD_ZERO(&wfds);
-            FD_ZERO(&efds);
-            FD_SET(fd, &wfds);
-            FD_SET(fd, &efds);
-            tv.tv_sec = 0;
-            tv.tv_usec = 100 * 1000;
-            ret = select(fd_max + 1, NULL, &wfds, &efds, &tv);
-            if (ret > 0 && (FD_ISSET(fd, &wfds) || FD_ISSET(fd, &efds)))
+            ret = poll(&p, 1, 100);
+            if (ret > 0)
                 break;
         }
 
@@ -140,68 +155,29 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
 static int tcp_read(URLContext *h, uint8_t *buf, int size)
 {
     TCPContext *s = h->priv_data;
-    int len, fd_max, ret;
-    fd_set rfds;
-    struct timeval tv;
-
-    for (;;) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        fd_max = s->fd;
-        FD_ZERO(&rfds);
-        FD_SET(s->fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(fd_max + 1, &rfds, NULL, NULL, &tv);
-        if (ret > 0 && FD_ISSET(s->fd, &rfds)) {
-            len = recv(s->fd, buf, size, 0);
-            if (len < 0) {
-                if (ff_neterrno() != FF_NETERROR(EINTR) &&
-                    ff_neterrno() != FF_NETERROR(EAGAIN))
-                    return ff_neterrno();
-            } else return len;
-        } else if (ret < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return -1;
-        }
+    int ret;
+
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+        ret = ff_network_wait_fd(s->fd, 0);
+        if (ret < 0)
+            return ret;
     }
+    ret = recv(s->fd, buf, size, 0);
+    return ret < 0 ? ff_neterrno() : ret;
 }
 
 static int tcp_write(URLContext *h, const uint8_t *buf, int size)
 {
     TCPContext *s = h->priv_data;
-    int ret, size1, fd_max, len;
-    fd_set wfds;
-    struct timeval tv;
-
-    size1 = size;
-    while (size > 0) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        fd_max = s->fd;
-        FD_ZERO(&wfds);
-        FD_SET(s->fd, &wfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(fd_max + 1, NULL, &wfds, NULL, &tv);
-        if (ret > 0 && FD_ISSET(s->fd, &wfds)) {
-            len = send(s->fd, buf, size, 0);
-            if (len < 0) {
-                if (ff_neterrno() != FF_NETERROR(EINTR) &&
-                    ff_neterrno() != FF_NETERROR(EAGAIN))
-                    return ff_neterrno();
-                continue;
-            }
-            size -= len;
-            buf += len;
-        } else if (ret < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return -1;
-        }
+    int ret;
+
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+        ret = ff_network_wait_fd(s->fd, 1);
+        if (ret < 0)
+            return ret;
     }
-    return size1 - size;
+    ret = send(s->fd, buf, size, 0);
+    return ret < 0 ? ff_neterrno() : ret;
 }
 
 static int tcp_close(URLContext *h)
@@ -218,12 +194,11 @@ static int tcp_get_file_handle(URLContext *h)
     return s->fd;
 }
 
-URLProtocol tcp_protocol = {
-    "tcp",
-    tcp_open,
-    tcp_read,
-    tcp_write,
-    NULL, /* seek */
-    tcp_close,
+URLProtocol ff_tcp_protocol = {
+    .name                = "tcp",
+    .url_open            = tcp_open,
+    .url_read            = tcp_read,
+    .url_write           = tcp_write,
+    .url_close           = tcp_close,
     .url_get_file_handle = tcp_get_file_handle,
 };
diff --git a/ffmpeg-mt/libavformat/thp.c b/ffmpeg-mt/libavformat/thp.c
index 82966dd..6cdcefd 100644
--- a/ffmpeg-mt/libavformat/thp.c
+++ b/ffmpeg-mt/libavformat/thp.c
@@ -2,20 +2,20 @@
  * THP Demuxer
  * Copyright (c) 2007 Marco Gerards
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -57,35 +57,35 @@ static int thp_read_header(AVFormatContext *s,
 {
     ThpDemuxContext *thp = s->priv_data;
     AVStream *st;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int i;
 
     /* Read the file header.  */
-                           get_be32(pb); /* Skip Magic.  */
-    thp->version         = get_be32(pb);
+                           avio_rb32(pb); /* Skip Magic.  */
+    thp->version         = avio_rb32(pb);
 
-                           get_be32(pb); /* Max buf size.  */
-                           get_be32(pb); /* Max samples.  */
+                           avio_rb32(pb); /* Max buf size.  */
+                           avio_rb32(pb); /* Max samples.  */
 
-    thp->fps             = av_d2q(av_int2flt(get_be32(pb)), INT_MAX);
-    thp->framecnt        = get_be32(pb);
-    thp->first_framesz   = get_be32(pb);
-                           get_be32(pb); /* Data size.  */
+    thp->fps             = av_d2q(av_int2flt(avio_rb32(pb)), INT_MAX);
+    thp->framecnt        = avio_rb32(pb);
+    thp->first_framesz   = avio_rb32(pb);
+                           avio_rb32(pb); /* Data size.  */
 
-    thp->compoff         = get_be32(pb);
-                           get_be32(pb); /* offsetDataOffset.  */
-    thp->first_frame     = get_be32(pb);
-    thp->last_frame      = get_be32(pb);
+    thp->compoff         = avio_rb32(pb);
+                           avio_rb32(pb); /* offsetDataOffset.  */
+    thp->first_frame     = avio_rb32(pb);
+    thp->last_frame      = avio_rb32(pb);
 
     thp->next_framesz    = thp->first_framesz;
     thp->next_frame      = thp->first_frame;
 
     /* Read the component structure.  */
-    url_fseek (pb, thp->compoff, SEEK_SET);
-    thp->compcount       = get_be32(pb);
+    avio_seek (pb, thp->compoff, SEEK_SET);
+    thp->compcount       = avio_rb32(pb);
 
     /* Read the list of component types.  */
-    get_buffer(pb, thp->components, 16);
+    avio_read(pb, thp->components, 16);
 
     for (i = 0; i < thp->compcount; i++) {
         if (thp->components[i] == 0) {
@@ -103,14 +103,14 @@ static int thp_read_header(AVFormatContext *s,
             st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
             st->codec->codec_id = CODEC_ID_THP;
             st->codec->codec_tag = 0;  /* no fourcc */
-            st->codec->width = get_be32(pb);
-            st->codec->height = get_be32(pb);
+            st->codec->width = avio_rb32(pb);
+            st->codec->height = avio_rb32(pb);
             st->codec->sample_rate = av_q2d(thp->fps);
             thp->vst = st;
             thp->video_stream_index = st->index;
 
             if (thp->version == 0x11000)
-                get_be32(pb); /* Unknown.  */
+                avio_rb32(pb); /* Unknown.  */
         } else if (thp->components[i] == 1) {
             if (thp->has_audio != 0)
                 break;
@@ -123,8 +123,8 @@ static int thp_read_header(AVFormatContext *s,
             st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
             st->codec->codec_id = CODEC_ID_ADPCM_THP;
             st->codec->codec_tag = 0;  /* no fourcc */
-            st->codec->channels    = get_be32(pb); /* numChannels.  */
-            st->codec->sample_rate = get_be32(pb); /* Frequency.  */
+            st->codec->channels    = avio_rb32(pb); /* numChannels.  */
+            st->codec->sample_rate = avio_rb32(pb); /* Frequency.  */
 
             av_set_pts_info(st, 64, 1, st->codec->sample_rate);
 
@@ -140,7 +140,7 @@ static int thp_read_packet(AVFormatContext *s,
                             AVPacket *pkt)
 {
     ThpDemuxContext *thp = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int size;
     int ret;
 
@@ -149,19 +149,19 @@ static int thp_read_packet(AVFormatContext *s,
         if (thp->frame >= thp->framecnt)
             return AVERROR(EIO);
 
-        url_fseek(pb, thp->next_frame, SEEK_SET);
+        avio_seek(pb, thp->next_frame, SEEK_SET);
 
         /* Locate the next frame and read out its size.  */
         thp->next_frame += thp->next_framesz;
-        thp->next_framesz = get_be32(pb);
+        thp->next_framesz = avio_rb32(pb);
 
-                        get_be32(pb); /* Previous total size.  */
-        size          = get_be32(pb); /* Total size of this frame.  */
+                        avio_rb32(pb); /* Previous total size.  */
+        size          = avio_rb32(pb); /* Total size of this frame.  */
 
         /* Store the audiosize so the next time this function is called,
            the audio can be read.  */
         if (thp->has_audio)
-            thp->audiosize = get_be32(pb); /* Audio size.  */
+            thp->audiosize = avio_rb32(pb); /* Audio size.  */
         else
             thp->frame++;
 
@@ -187,7 +187,7 @@ static int thp_read_packet(AVFormatContext *s,
     return 0;
 }
 
-AVInputFormat thp_demuxer = {
+AVInputFormat ff_thp_demuxer = {
     "thp",
     NULL_IF_CONFIG_SMALL("THP"),
     sizeof(ThpDemuxContext),
diff --git a/ffmpeg-mt/libavformat/tiertexseq.c b/ffmpeg-mt/libavformat/tiertexseq.c
index 938eea5..7ca0464 100644
--- a/ffmpeg-mt/libavformat/tiertexseq.c
+++ b/ffmpeg-mt/libavformat/tiertexseq.c
@@ -2,20 +2,20 @@
  * Tiertex Limited SEQ File Demuxer
  * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -78,15 +78,15 @@ static int seq_probe(AVProbeData *p)
     return AVPROBE_SCORE_MAX / 4;
 }
 
-static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb)
+static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb)
 {
     int i, sz;
     TiertexSeqFrameBuffer *seq_buffer;
 
-    url_fseek(pb, 256, SEEK_SET);
+    avio_seek(pb, 256, SEEK_SET);
 
     for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) {
-        sz = get_le16(pb);
+        sz = avio_rl16(pb);
         if (sz == 0)
             break;
         else {
@@ -102,7 +102,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb)
     return 0;
 }
 
-static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_num, unsigned int data_offs, int data_size)
+static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num, unsigned int data_offs, int data_size)
 {
     TiertexSeqFrameBuffer *seq_buffer;
 
@@ -113,25 +113,25 @@ static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_n
     if (seq_buffer->fill_size + data_size > seq_buffer->data_size || data_size <= 0)
         return AVERROR_INVALIDDATA;
 
-    url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
-    if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
+    avio_seek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
+    if (avio_read(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
         return AVERROR(EIO);
 
     seq_buffer->fill_size += data_size;
     return 0;
 }
 
-static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb)
+static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb)
 {
     unsigned int offset_table[4], buffer_num[4];
     TiertexSeqFrameBuffer *seq_buffer;
     int i, e, err;
 
     seq->current_frame_offs += SEQ_FRAME_SIZE;
-    url_fseek(pb, seq->current_frame_offs, SEEK_SET);
+    avio_seek(pb, seq->current_frame_offs, SEEK_SET);
 
     /* sound data */
-    seq->current_audio_data_offs = get_le16(pb);
+    seq->current_audio_data_offs = avio_rl16(pb);
     if (seq->current_audio_data_offs) {
         seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2;
     } else {
@@ -139,7 +139,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb)
     }
 
     /* palette data */
-    seq->current_pal_data_offs = get_le16(pb);
+    seq->current_pal_data_offs = avio_rl16(pb);
     if (seq->current_pal_data_offs) {
         seq->current_pal_data_size = 768;
     } else {
@@ -148,10 +148,10 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb)
 
     /* video data */
     for (i = 0; i < 4; i++)
-        buffer_num[i] = get_byte(pb);
+        buffer_num[i] = avio_r8(pb);
 
     for (i = 0; i < 4; i++)
-        offset_table[i] = get_le16(pb);
+        offset_table[i] = avio_rl16(pb);
 
     for (i = 0; i < 3; i++) {
         if (offset_table[i]) {
@@ -184,7 +184,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     int i, rc;
     SeqDemuxContext *seq = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
 
     /* init internal buffers */
@@ -241,7 +241,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int rc;
     SeqDemuxContext *seq = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     if (!seq->audio_buffer_full) {
         rc = seq_parse_frame_data(seq, pb);
@@ -256,8 +256,8 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
             pkt->data[0] = 0;
             if (seq->current_pal_data_size) {
                 pkt->data[0] |= 1;
-                url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
-                if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
+                avio_seek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
+                if (avio_read(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
                     return AVERROR(EIO);
             }
             if (seq->current_video_data_size) {
@@ -279,7 +279,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
     if (seq->current_audio_data_offs == 0) /* end of data reached */
         return AVERROR(EIO);
 
-    url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET);
+    avio_seek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET);
     rc = av_get_packet(pb, pkt, seq->current_audio_data_size);
     if (rc < 0)
         return rc;
@@ -302,7 +302,7 @@ static int seq_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat tiertexseq_demuxer = {
+AVInputFormat ff_tiertexseq_demuxer = {
     "tiertexseq",
     NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ format"),
     sizeof(SeqDemuxContext),
diff --git a/ffmpeg-mt/libavformat/timefilter.c b/ffmpeg-mt/libavformat/timefilter.c
index 4a58224..b087647 100644
--- a/ffmpeg-mt/libavformat/timefilter.c
+++ b/ffmpeg-mt/libavformat/timefilter.c
@@ -5,20 +5,20 @@
  * Author: Olivier Guilyardi <olivier samalyse com>
  *         Michael Niedermayer <michaelni gmx at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/timefilter.h b/ffmpeg-mt/libavformat/timefilter.h
index ded8ec7..aa7db53 100644
--- a/ffmpeg-mt/libavformat/timefilter.h
+++ b/ffmpeg-mt/libavformat/timefilter.h
@@ -5,20 +5,20 @@
  * Author: Olivier Guilyardi <olivier samalyse com>
  *         Michael Niedermayer <michaelni gmx at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/tmv.c b/ffmpeg-mt/libavformat/tmv.c
index 4be2f32..f894eab 100644
--- a/ffmpeg-mt/libavformat/tmv.c
+++ b/ffmpeg-mt/libavformat/tmv.c
@@ -2,20 +2,20 @@
  * 8088flex TMV file demuxer
  * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -65,12 +65,12 @@ static int tmv_probe(AVProbeData *p)
 static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     TMVContext *tmv   = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *vst, *ast;
     AVRational fps;
     unsigned comp_method, char_cols, char_rows, features;
 
-    if (get_le32(pb) != TMV_TAG)
+    if (avio_rl32(pb) != TMV_TAG)
         return -1;
 
     if (!(vst = av_new_stream(s, 0)))
@@ -79,30 +79,30 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
     if (!(ast = av_new_stream(s, 0)))
         return AVERROR(ENOMEM);
 
-    ast->codec->sample_rate = get_le16(pb);
+    ast->codec->sample_rate = avio_rl16(pb);
     if (!ast->codec->sample_rate) {
         av_log(s, AV_LOG_ERROR, "invalid sample rate\n");
         return -1;
     }
 
-    tmv->audio_chunk_size   = get_le16(pb);
+    tmv->audio_chunk_size   = avio_rl16(pb);
     if (!tmv->audio_chunk_size) {
         av_log(s, AV_LOG_ERROR, "invalid audio chunk size\n");
         return -1;
     }
 
-    comp_method             = get_byte(pb);
+    comp_method             = avio_r8(pb);
     if (comp_method) {
         av_log(s, AV_LOG_ERROR, "unsupported compression method %d\n",
                comp_method);
         return -1;
     }
 
-    char_cols = get_byte(pb);
-    char_rows = get_byte(pb);
+    char_cols = avio_r8(pb);
+    char_rows = avio_r8(pb);
     tmv->video_chunk_size = char_cols * char_rows * 2;
 
-    features  = get_byte(pb);
+    features  = avio_r8(pb);
     if (features & ~(TMV_PADDING | TMV_STEREO)) {
         av_log(s, AV_LOG_ERROR, "unsupported features 0x%02x\n",
                features & ~(TMV_PADDING | TMV_STEREO));
@@ -142,17 +142,17 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
 static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     TMVContext *tmv   = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret, pkt_size = tmv->stream_index ?
                         tmv->audio_chunk_size : tmv->video_chunk_size;
 
-    if (url_feof(pb))
+    if (pb->eof_reached)
         return AVERROR_EOF;
 
     ret = av_get_packet(pb, pkt, pkt_size);
 
     if (tmv->stream_index)
-        url_fskip(pb, tmv->padding);
+        avio_skip(pb, tmv->padding);
 
     pkt->stream_index  = tmv->stream_index;
     tmv->stream_index ^= 1;
@@ -173,12 +173,12 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index,
     pos = timestamp *
           (tmv->audio_chunk_size + tmv->video_chunk_size + tmv->padding);
 
-    url_fseek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET);
+    avio_seek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET);
     tmv->stream_index = 0;
     return 0;
 }
 
-AVInputFormat tmv_demuxer = {
+AVInputFormat ff_tmv_demuxer = {
     "tmv",
     NULL_IF_CONFIG_SMALL("8088flex TMV"),
     sizeof(TMVContext),
diff --git a/ffmpeg-mt/libavformat/tta.c b/ffmpeg-mt/libavformat/tta.c
index 64ed4d8..0036200 100644
--- a/ffmpeg-mt/libavformat/tta.c
+++ b/ffmpeg-mt/libavformat/tta.c
@@ -2,20 +2,20 @@
  * TTA demuxer
  * Copyright (c) 2006 Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -46,26 +46,26 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
     if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
         ff_id3v1_read(s);
 
-    start_offset = url_ftell(s->pb);
-    if (get_le32(s->pb) != AV_RL32("TTA1"))
+    start_offset = avio_tell(s->pb);
+    if (avio_rl32(s->pb) != AV_RL32("TTA1"))
         return -1; // not tta file
 
-    url_fskip(s->pb, 2); // FIXME: flags
-    channels = get_le16(s->pb);
-    bps = get_le16(s->pb);
-    samplerate = get_le32(s->pb);
+    avio_skip(s->pb, 2); // FIXME: flags
+    channels = avio_rl16(s->pb);
+    bps = avio_rl16(s->pb);
+    samplerate = avio_rl32(s->pb);
     if(samplerate <= 0 || samplerate > 1000000){
         av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
         return -1;
     }
 
-    datalen = get_le32(s->pb);
+    datalen = avio_rl32(s->pb);
     if(datalen < 0){
         av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
         return -1;
     }
 
-    url_fskip(s->pb, 4); // header crc
+    avio_skip(s->pb, 4); // header crc
 
     framelen = samplerate*256/245;
     c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
@@ -84,14 +84,14 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
     st->start_time = 0;
     st->duration = datalen;
 
-    framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
+    framepos = avio_tell(s->pb) + 4*c->totalframes + 4;
 
     for (i = 0; i < c->totalframes; i++) {
-        uint32_t size = get_le32(s->pb);
+        uint32_t size = avio_rl32(s->pb);
         av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
         framepos += size;
     }
-    url_fskip(s->pb, 4); // seektable crc
+    avio_skip(s->pb, 4); // seektable crc
 
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_TTA;
@@ -99,15 +99,15 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
     st->codec->sample_rate = samplerate;
     st->codec->bits_per_coded_sample = bps;
 
-    st->codec->extradata_size = url_ftell(s->pb) - start_offset;
+    st->codec->extradata_size = avio_tell(s->pb) - start_offset;
     if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
-        //this check is redundant as get_buffer should fail
+        //this check is redundant as avio_read should fail
         av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
         return -1;
     }
     st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
-    url_fseek(s->pb, start_offset, SEEK_SET);
-    get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
+    avio_seek(s->pb, start_offset, SEEK_SET);
+    avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
 
     return 0;
 }
@@ -138,12 +138,12 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
         return -1;
 
     c->currentframe = index;
-    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+    avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
 
     return 0;
 }
 
-AVInputFormat tta_demuxer = {
+AVInputFormat ff_tta_demuxer = {
     "tta",
     NULL_IF_CONFIG_SMALL("True Audio"),
     sizeof(TTAContext),
diff --git a/ffmpeg-mt/libavformat/tty.c b/ffmpeg-mt/libavformat/tty.c
index 6aa6fa2..ea8d0c7 100644
--- a/ffmpeg-mt/libavformat/tty.c
+++ b/ffmpeg-mt/libavformat/tty.c
@@ -2,20 +2,20 @@
  * Tele-typewriter demuxer
  * Copyright (c) 2010 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -28,7 +28,6 @@
 #include "libavutil/avstring.h"
 #include "avformat.h"
 #include "sauce.h"
-#include <strings.h>
 
 #define LINE_RATE 6000 /* characters per second */
 
@@ -43,19 +42,19 @@ typedef struct {
 static int efi_read(AVFormatContext *avctx, uint64_t start_pos)
 {
     TtyDemuxContext *s = avctx->priv_data;
-    ByteIOContext *pb = avctx->pb;
+    AVIOContext *pb = avctx->pb;
     char buf[37];
     int len;
 
-    url_fseek(pb, start_pos, SEEK_SET);
-    if (get_byte(pb) != 0x1A)
+    avio_seek(pb, start_pos, SEEK_SET);
+    if (avio_r8(pb) != 0x1A)
         return -1;
 
 #define GET_EFI_META(name,size) \
-    len = get_byte(pb); \
+    len = avio_r8(pb); \
     if (len < 1 || len > size) \
         return -1; \
-    if (get_buffer(pb, buf, size) == size) { \
+    if (avio_read(pb, buf, size) == size) { \
         buf[len] = 0; \
         av_metadata_set2(&avctx->metadata, name, buf, 0); \
     }
@@ -89,14 +88,14 @@ static int read_header(AVFormatContext *avctx,
     /* simulate tty display speed */
     s->chars_per_frame = FFMAX(av_q2d(st->time_base) * (ap->sample_rate ? ap->sample_rate : LINE_RATE), 1);
 
-    if (!url_is_streamed(avctx->pb)) {
-        s->fsize = url_fsize(avctx->pb);
+    if (avctx->pb->seekable) {
+        s->fsize = avio_size(avctx->pb);
         st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
 
         if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
             efi_read(avctx, s->fsize - 51);
 
-        url_fseek(avctx->pb, 0, SEEK_SET);
+        avio_seek(avctx->pb, 0, SEEK_SET);
     }
 
     return 0;
@@ -107,13 +106,13 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
     TtyDemuxContext *s = avctx->priv_data;
     int n;
 
-    if (url_feof(avctx->pb))
+    if (avctx->pb->eof_reached)
         return AVERROR_EOF;
 
     n = s->chars_per_frame;
     if (s->fsize) {
         // ignore metadata buffer
-        uint64_t p = url_ftell(avctx->pb);
+        uint64_t p = avio_tell(avctx->pb);
         if (p + s->chars_per_frame > s->fsize)
             n = s->fsize - p;
     }
@@ -121,11 +120,11 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
     pkt->size = av_get_packet(avctx->pb, pkt, n);
     if (pkt->size <= 0)
         return AVERROR(EIO);
-    pkt->flags |= PKT_FLAG_KEY;
+    pkt->flags |= AV_PKT_FLAG_KEY;
     return 0;
 }
 
-AVInputFormat tty_demuxer = {
+AVInputFormat ff_tty_demuxer = {
     .name           = "tty",
     .long_name      = NULL_IF_CONFIG_SMALL("Tele-typewriter"),
     .priv_data_size = sizeof(TtyDemuxContext),
diff --git a/ffmpeg-mt/libavformat/txd.c b/ffmpeg-mt/libavformat/txd.c
index 38bdb1b..0a93b7c 100644
--- a/ffmpeg-mt/libavformat/txd.c
+++ b/ffmpeg-mt/libavformat/txd.c
@@ -2,20 +2,20 @@
  * Renderware TeXture Dictionary (.txd) demuxer
  * Copyright (c) 2007 Ivo van Poorten
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -52,16 +52,16 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
 }
 
 static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int id, chunk_size, marker;
     int ret;
 
 next_chunk:
-    id         = get_le32(pb);
-    chunk_size = get_le32(pb);
-    marker     = get_le32(pb);
+    id         = avio_rl32(pb);
+    chunk_size = avio_rl32(pb);
+    marker     = avio_rl32(pb);
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR_EOF;
     if (marker != TXD_MARKER && marker != TXD_MARKER2) {
         av_log(s, AV_LOG_ERROR, "marker does not match\n");
@@ -73,7 +73,7 @@ next_chunk:
             if (chunk_size > 100)
                 break;
         case TXD_EXTRA:
-            url_fskip(s->pb, chunk_size);
+            avio_skip(s->pb, chunk_size);
         case TXD_FILE:
         case TXD_TEXTURE:
             goto next_chunk;
@@ -90,7 +90,7 @@ next_chunk:
     return 0;
 }
 
-AVInputFormat txd_demuxer =
+AVInputFormat ff_txd_demuxer =
 {
     "txd",
     NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
diff --git a/ffmpeg-mt/libavformat/udp.c b/ffmpeg-mt/libavformat/udp.c
index 0b62c6d..b881ff9 100644
--- a/ffmpeg-mt/libavformat/udp.c
+++ b/ffmpeg-mt/libavformat/udp.c
@@ -2,20 +2,20 @@
  * UDP prototype streaming system
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,13 +27,13 @@
 #define _BSD_SOURCE     /* Needed for using struct ip_mreq with recent glibc */
 #define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */
 #include "avformat.h"
+#include "avio_internal.h"
+#include "libavutil/parseutils.h"
 #include <unistd.h>
 #include "internal.h"
 #include "network.h"
 #include "os_support.h"
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
+#include "url.h"
 #include <sys/time.h>
 
 #ifndef IPV6_ADD_MEMBERSHIP
@@ -242,7 +242,7 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len)
  * @param uri of the remote server
  * @return zero if no error.
  */
-int udp_set_remote_url(URLContext *h, const char *uri)
+int ff_udp_set_remote_url(URLContext *h, const char *uri)
 {
     UDPContext *s = h->priv_data;
     char hostname[256], buf[10];
@@ -259,7 +259,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
     s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr);
     p = strchr(uri, '?');
     if (p) {
-        if (find_info_tag(buf, sizeof(buf), "connect", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
             int was_connected = s->is_connected;
             s->is_connected = strtol(buf, NULL, 10);
             if (s->is_connected && !was_connected) {
@@ -281,7 +281,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
  * @param h media file context
  * @return the local port number
  */
-int udp_get_local_port(URLContext *h)
+int ff_udp_get_local_port(URLContext *h)
 {
     UDPContext *s = h->priv_data;
     return s->local_port;
@@ -313,11 +313,12 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     char buf[256];
     struct sockaddr_storage my_addr;
     int len;
+    int reuse_specified = 0;
 
     h->is_streamed = 1;
     h->max_packet_size = 1472;
 
-    is_output = (flags & URL_WRONLY);
+    is_output = (flags & AVIO_WRONLY);
 
     s = av_mallocz(sizeof(UDPContext));
     if (!s)
@@ -329,20 +330,27 @@ static int udp_open(URLContext *h, const char *uri, int flags)
 
     p = strchr(uri, '?');
     if (p) {
-        s->reuse_socket = find_info_tag(buf, sizeof(buf), "reuse", p);
-        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) {
+            const char *endptr=NULL;
+            s->reuse_socket = strtol(buf, &endptr, 10);
+            /* assume if no digits were found it is a request to enable it */
+            if (buf == endptr)
+                s->reuse_socket = 1;
+            reuse_specified = 1;
+        }
+        if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
             s->ttl = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "localport", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "localport", p)) {
             s->local_port = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
             h->max_packet_size = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "buffer_size", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "buffer_size", p)) {
             s->buffer_size = strtol(buf, NULL, 10);
         }
-        if (find_info_tag(buf, sizeof(buf), "connect", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
             s->is_connected = strtol(buf, NULL, 10);
         }
     }
@@ -353,26 +361,31 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     /* XXX: fix av_url_split */
     if (hostname[0] == '\0' || hostname[0] == '?') {
         /* only accepts null hostname if input */
-        if (flags & URL_WRONLY)
+        if (flags & AVIO_WRONLY)
             goto fail;
     } else {
-        if (udp_set_remote_url(h, uri) < 0)
+        if (ff_udp_set_remote_url(h, uri) < 0)
             goto fail;
     }
 
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
+    if (s->is_multicast && !(h->flags & AVIO_WRONLY))
         s->local_port = port;
     udp_fd = udp_socket_create(s, &my_addr, &len);
     if (udp_fd < 0)
         goto fail;
 
-    if (s->reuse_socket)
+    /* Follow the requested reuse option, unless it's multicast in which
+     * case enable reuse unless explicitely disabled.
+     */
+    if (s->reuse_socket || (s->is_multicast && !reuse_specified)) {
+        s->reuse_socket = 1;
         if (setsockopt (udp_fd, SOL_SOCKET, SO_REUSEADDR, &(s->reuse_socket), sizeof(s->reuse_socket)) != 0)
             goto fail;
+    }
 
     /* the bind is needed to give a port to the socket now */
     /* if multicast, try the multicast address bind first */
-    if (s->is_multicast && !(h->flags & URL_WRONLY)) {
+    if (s->is_multicast && !(h->flags & AVIO_WRONLY)) {
         bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
     }
     /* bind to the local address if not multicast or if the multicast
@@ -385,7 +398,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     s->local_port = udp_port(&my_addr, len);
 
     if (s->is_multicast) {
-        if (h->flags & URL_WRONLY) {
+        if (h->flags & AVIO_WRONLY) {
             /* output */
             if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
                 goto fail;
@@ -432,36 +445,15 @@ static int udp_open(URLContext *h, const char *uri, int flags)
 static int udp_read(URLContext *h, uint8_t *buf, int size)
 {
     UDPContext *s = h->priv_data;
-    int len;
-    fd_set rfds;
     int ret;
-    struct timeval tv;
-
-    for(;;) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        FD_ZERO(&rfds);
-        FD_SET(s->udp_fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(s->udp_fd + 1, &rfds, NULL, NULL, &tv);
-        if (ret < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return AVERROR(EIO);
-        }
-        if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds)))
-            continue;
-        len = recv(s->udp_fd, buf, size, 0);
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
-                return AVERROR(EIO);
-        } else {
-            break;
-        }
+
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+        ret = ff_network_wait_fd(s->udp_fd, 0);
+        if (ret < 0)
+            return ret;
     }
-    return len;
+    ret = recv(s->udp_fd, buf, size, 0);
+    return ret < 0 ? ff_neterrno() : ret;
 }
 
 static int udp_write(URLContext *h, const uint8_t *buf, int size)
@@ -469,41 +461,38 @@ static int udp_write(URLContext *h, const uint8_t *buf, int size)
     UDPContext *s = h->priv_data;
     int ret;
 
-    for(;;) {
-        if (!s->is_connected) {
-            ret = sendto (s->udp_fd, buf, size, 0,
-                          (struct sockaddr *) &s->dest_addr,
-                          s->dest_addr_len);
-        } else
-            ret = send(s->udp_fd, buf, size, 0);
-        if (ret < 0) {
-            if (ff_neterrno() != FF_NETERROR(EINTR) &&
-                ff_neterrno() != FF_NETERROR(EAGAIN))
-                return ff_neterrno();
-        } else {
-            break;
-        }
+    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+        ret = ff_network_wait_fd(s->udp_fd, 1);
+        if (ret < 0)
+            return ret;
     }
-    return size;
+
+    if (!s->is_connected) {
+        ret = sendto (s->udp_fd, buf, size, 0,
+                      (struct sockaddr *) &s->dest_addr,
+                      s->dest_addr_len);
+    } else
+        ret = send(s->udp_fd, buf, size, 0);
+
+    return ret < 0 ? ff_neterrno() : ret;
 }
 
 static int udp_close(URLContext *h)
 {
     UDPContext *s = h->priv_data;
 
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
+    if (s->is_multicast && !(h->flags & AVIO_WRONLY))
         udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
     closesocket(s->udp_fd);
     av_free(s);
     return 0;
 }
 
-URLProtocol udp_protocol = {
-    "udp",
-    udp_open,
-    udp_read,
-    udp_write,
-    NULL, /* seek */
-    udp_close,
+URLProtocol ff_udp_protocol = {
+    .name                = "udp",
+    .url_open            = udp_open,
+    .url_read            = udp_read,
+    .url_write           = udp_write,
+    .url_close           = udp_close,
     .url_get_file_handle = udp_get_file_handle,
 };
diff --git a/ffmpeg-mt/libavformat/url.h b/ffmpeg-mt/libavformat/url.h
new file mode 100644
index 0000000..bde06d9
--- /dev/null
+++ b/ffmpeg-mt/libavformat/url.h
@@ -0,0 +1,175 @@
+/*
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * unbuffered private I/O API
+ */
+
+#ifndef AVFORMAT_URL_H
+#define AVFORMAT_URL_H
+
+#include "avio.h"
+#include "libavformat/version.h"
+
+#if !FF_API_OLD_AVIO
+#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
+
+extern int (*url_interrupt_cb)(void);
+
+typedef struct URLContext {
+    const AVClass *av_class;    /**< information for av_log(). Set by url_open(). */
+    struct URLProtocol *prot;
+    void *priv_data;
+    char *filename;             /**< specified URL */
+    int flags;
+    int max_packet_size;        /**< if non zero, the stream is packetized with this max packet size */
+    int is_streamed;            /**< true if streamed (no seek possible), default = false */
+    int is_connected;
+} URLContext;
+
+typedef struct URLProtocol {
+    const char *name;
+    int     (*url_open)( URLContext *h, const char *url, int flags);
+    int     (*url_read)( URLContext *h, unsigned char *buf, int size);
+    int     (*url_write)(URLContext *h, const unsigned char *buf, int size);
+    int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
+    int     (*url_close)(URLContext *h);
+    struct URLProtocol *next;
+    int (*url_read_pause)(URLContext *h, int pause);
+    int64_t (*url_read_seek)(URLContext *h, int stream_index,
+                             int64_t timestamp, int flags);
+    int (*url_get_file_handle)(URLContext *h);
+    int priv_data_size;
+    const AVClass *priv_data_class;
+    int flags;
+} URLProtocol;
+#endif
+
+/**
+ * Create a URLContext for accessing to the resource indicated by
+ * url, but do not initiate the connection yet.
+ *
+ * @param puc pointer to the location where, in case of success, the
+ * function puts the pointer to the created URLContext
+ * @param flags flags which control how the resource indicated by url
+ * is to be opened
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code in case of failure
+ */
+int ffurl_alloc(URLContext **h, const char *url, int flags);
+
+/**
+ * Connect an URLContext that has been allocated by ffurl_alloc
+ */
+int ffurl_connect(URLContext *h);
+
+/**
+ * Create an URLContext for accessing to the resource indicated by
+ * url, and open it.
+ *
+ * @param puc pointer to the location where, in case of success, the
+ * function puts the pointer to the created URLContext
+ * @param flags flags which control how the resource indicated by url
+ * is to be opened
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code in case of failure
+ */
+int ffurl_open(URLContext **h, const char *url, int flags);
+
+/**
+ * Read up to size bytes from the resource accessed by h, and store
+ * the read bytes in buf.
+ *
+ * @return The number of bytes actually read, or a negative value
+ * corresponding to an AVERROR code in case of error. A value of zero
+ * indicates that it is not possible to read more from the accessed
+ * resource (except if the value of the size argument is also zero).
+ */
+int ffurl_read(URLContext *h, unsigned char *buf, int size);
+
+/**
+ * Read as many bytes as possible (up to size), calling the
+ * read function multiple times if necessary.
+ * This makes special short-read handling in applications
+ * unnecessary, if the return value is < size then it is
+ * certain there was either an error or the end of file was reached.
+ */
+int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
+
+/**
+ * Write size bytes from buf to the resource accessed by h.
+ *
+ * @return the number of bytes actually written, or a negative value
+ * corresponding to an AVERROR code in case of failure
+ */
+int ffurl_write(URLContext *h, const unsigned char *buf, int size);
+
+/**
+ * Change the position that will be used by the next read/write
+ * operation on the resource accessed by h.
+ *
+ * @param pos specifies the new position to set
+ * @param whence specifies how pos should be interpreted, it must be
+ * one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the
+ * current position), SEEK_END (seek from the end), or AVSEEK_SIZE
+ * (return the filesize of the requested resource, pos is ignored).
+ * @return a negative value corresponding to an AVERROR code in case
+ * of failure, or the resulting file position, measured in bytes from
+ * the beginning of the file. You can use this feature together with
+ * SEEK_CUR to read the current file position.
+ */
+int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
+
+/**
+ * Close the resource accessed by the URLContext h, and free the
+ * memory used by it.
+ *
+ * @return a negative value if an error condition occurred, 0
+ * otherwise
+ */
+int ffurl_close(URLContext *h);
+
+/**
+ * Return the filesize of the resource accessed by h, AVERROR(ENOSYS)
+ * if the operation is not supported by h, or another negative value
+ * corresponding to an AVERROR error code in case of failure.
+ */
+int64_t ffurl_size(URLContext *h);
+
+/**
+ * Return the file descriptor associated with this URL. For RTP, this
+ * will return only the RTP file descriptor, not the RTCP file descriptor.
+ *
+ * @return the file descriptor associated with this URL, or <0 on error.
+ */
+int ffurl_get_file_handle(URLContext *h);
+
+/**
+ * Register the URLProtocol protocol.
+ *
+ * @param size the size of the URLProtocol struct referenced
+ */
+int ffurl_register_protocol(URLProtocol *protocol, int size);
+
+/* udp.c */
+int ff_udp_set_remote_url(URLContext *h, const char *uri);
+int ff_udp_get_local_port(URLContext *h);
+
+#endif //AVFORMAT_URL_H
diff --git a/ffmpeg-mt/libavformat/utils.c b/ffmpeg-mt/libavformat/utils.c
index dc43608..1d58682 100644
--- a/ffmpeg-mt/libavformat/utils.c
+++ b/ffmpeg-mt/libavformat/utils.c
@@ -1,24 +1,28 @@
 /*
- * various utility functions for use within FFmpeg
+ * various utility functions for use within Libav
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
+/* #define DEBUG */
+
 #include "avformat.h"
+#include "avio_internal.h"
 #include "internal.h"
 #include "libavcodec/internal.h"
 #include "libavutil/opt.h"
@@ -27,6 +31,7 @@
 #include "libavutil/avstring.h"
 #include "riff.h"
 #include "audiointerleave.h"
+#include "url.h"
 #include <sys/time.h>
 #include <time.h>
 #include <strings.h>
@@ -40,7 +45,7 @@
 
 /**
  * @file
- * various utility functions for use within FFmpeg
+ * various utility functions for use within Libav
  */
 
 unsigned avformat_version(void)
@@ -50,13 +55,13 @@ unsigned avformat_version(void)
 
 const char *avformat_configuration(void)
 {
-    return FFMPEG_CONFIGURATION;
+    return LIBAV_CONFIGURATION;
 }
 
 const char *avformat_license(void)
 {
 #define LICENSE_PREFIX "libavformat license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+    return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
 
 /* fraction handling */
@@ -213,7 +218,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
 #if CONFIG_IMAGE2_MUXER
     if (!short_name && filename &&
         av_filename_number_test(filename) &&
-        av_guess_image2_codec(filename) != CODEC_ID_NONE) {
+        ff_guess_image2_codec(filename) != CODEC_ID_NONE) {
         return av_guess_format("image2", NULL, NULL);
     }
 #endif
@@ -266,7 +271,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
 
 #if CONFIG_IMAGE2_MUXER
         if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){
-            codec_id= av_guess_image2_codec(filename);
+            codec_id= ff_guess_image2_codec(filename);
         }
 #endif
         if(codec_id == CODEC_ID_NONE)
@@ -323,16 +328,16 @@ FF_SYMVER(void, av_init_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
 }
 #endif
 
-int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
+int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
 {
     int ret= av_new_packet(pkt, size);
 
     if(ret<0)
         return ret;
 
-    pkt->pos= url_ftell(s);
+    pkt->pos= avio_tell(s);
 
-    ret= get_buffer(s, pkt->data, size);
+    ret= avio_read(s, pkt->data, size);
     if(ret<=0)
         av_free_packet(pkt);
     else
@@ -341,7 +346,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
     return ret;
 }
 
-int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size)
+int av_append_packet(AVIOContext *s, AVPacket *pkt, int size)
 {
     int ret;
     int old_size;
@@ -351,7 +356,7 @@ int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size)
     ret = av_grow_packet(pkt, size);
     if (ret < 0)
         return ret;
-    ret = get_buffer(s, pkt->data + old_size, size);
+    ret = avio_read(s, pkt->data + old_size, size);
     av_shrink_packet(pkt, old_size + FFMAX(ret, 0));
     return ret;
 }
@@ -367,7 +372,7 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
 {
     AVProbeData lpd = *pd;
     AVInputFormat *fmt1 = NULL, *fmt;
-    int score;
+    int score, id3 = 0;
 
     if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) {
         int id3len = ff_id3v2_tag_len(lpd.buf);
@@ -375,6 +380,7 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
             lpd.buf += id3len;
             lpd.buf_size -= id3len;
         }
+        id3 = 1;
     }
 
     fmt = NULL;
@@ -395,6 +401,16 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
         }else if (score == *score_max)
             fmt = NULL;
     }
+
+    /* a hack for files with huge id3v2 tags -- try to guess by file extension. */
+    if (!fmt && id3 && *score_max < AVPROBE_SCORE_MAX/4) {
+        while ((fmt = av_iformat_next(fmt)))
+            if (fmt->extensions && av_match_ext(lpd.filename, fmt->extensions)) {
+                *score_max = AVPROBE_SCORE_MAX/4;
+                break;
+            }
+    }
+
     return fmt;
 }
 
@@ -442,7 +458,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeDa
  * Open a media file from an IO stream. 'fmt' must be specified.
  */
 int av_open_input_stream(AVFormatContext **ic_ptr,
-                         ByteIOContext *pb, const char *filename,
+                         AVIOContext *pb, const char *filename,
                          AVInputFormat *fmt, AVFormatParameters *ap)
 {
     int err;
@@ -479,7 +495,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
         ic->priv_data = NULL;
     }
 
-    // e.g. AVFMT_NOFILE formats will not have a ByteIOContext
+    // e.g. AVFMT_NOFILE formats will not have a AVIOContext
     if (ic->pb)
         ff_id3v2_read(ic, ID3v2_DEFAULT_MAGIC);
 
@@ -490,7 +506,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
     }
 
     if (pb && !ic->data_offset)
-        ic->data_offset = url_ftell(ic->pb);
+        ic->data_offset = avio_tell(ic->pb);
 
 #if FF_API_OLD_METADATA
     ff_metadata_demux_compat(ic);
@@ -524,7 +540,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
 #define PROBE_BUF_MIN 2048
 #define PROBE_BUF_MAX (1<<20)
 
-int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
+int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
                           const char *filename, void *logctx,
                           unsigned int offset, unsigned int max_probe_size)
 {
@@ -555,7 +571,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
 
         /* read probe data */
         buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE);
-        if ((ret = get_buffer(*pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
+        if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
             /* fail if error was not end of file, otherwise, lower score */
             if (ret != AVERROR_EOF) {
                 av_free(buf);
@@ -585,7 +601,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
     }
 
     /* rewind. reuse probe buffer to avoid seeking */
-    if ((ret = ff_rewind_with_probe_data(*pb, buf, pd.buf_size)) < 0)
+    if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0)
         av_free(buf);
 
     return ret;
@@ -598,7 +614,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
 {
     int err;
     AVProbeData probe_data, *pd = &probe_data;
-    ByteIOContext *pb = NULL;
+    AVIOContext *pb = NULL;
     void *logctx= ap && ap->prealloced_context ? *ic_ptr : NULL;
 
     pd->filename = "";
@@ -616,13 +632,13 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
        hack needed to handle RTSP/TCP */
     if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
         /* if no file needed do not try to open one */
-        if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
+        if ((err=avio_open(&pb, filename, AVIO_RDONLY)) < 0) {
             goto fail;
         }
         if (buf_size > 0) {
-            url_setbufsize(pb, buf_size);
+            ffio_set_buf_size(pb, buf_size);
         }
-        if (!fmt && (err = ff_probe_input_buffer(&pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) {
+        if (!fmt && (err = av_probe_input_buffer(pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) {
             goto fail;
         }
     }
@@ -647,7 +663,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
  fail:
     av_freep(&pd->buf);
     if (pb)
-        url_fclose(pb);
+        avio_close(pb);
     if (ap && ap->prealloced_context)
         av_free(*ic_ptr);
     *ic_ptr = NULL;
@@ -931,6 +947,11 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
     delay= st->codec->has_b_frames;
     presentation_delayed = 0;
 
+    // ignore delay caused by frame threading so that the mpeg2-without-dts
+    // warning will not trigger
+    if (delay && st->codec->active_thread_type&FF_THREAD_FRAME)
+        delay -= st->codec->thread_count-1;
+
     /* XXX: need has_b_frame, but cannot get it if the codec is
         not initialized */
     if (delay &&
@@ -1371,28 +1392,30 @@ void ff_reduce_index(AVFormatContext *s, int stream_index)
     }
 }
 
-int av_add_index_entry(AVStream *st,
-                            int64_t pos, int64_t timestamp, int size, int distance, int flags)
+int ff_add_index_entry(AVIndexEntry **index_entries,
+                       int *nb_index_entries,
+                       unsigned int *index_entries_allocated_size,
+                       int64_t pos, int64_t timestamp, int size, int distance, int flags)
 {
     AVIndexEntry *entries, *ie;
     int index;
 
-    if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))
+    if((unsigned)*nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))
         return -1;
 
-    entries = av_fast_realloc(st->index_entries,
-                              &st->index_entries_allocated_size,
-                              (st->nb_index_entries + 1) *
+    entries = av_fast_realloc(*index_entries,
+                              index_entries_allocated_size,
+                              (*nb_index_entries + 1) *
                               sizeof(AVIndexEntry));
     if(!entries)
         return -1;
 
-    st->index_entries= entries;
+    *index_entries= entries;
 
-    index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY);
+    index= ff_index_search_timestamp(*index_entries, *nb_index_entries, timestamp, AVSEEK_FLAG_ANY);
 
     if(index<0){
-        index= st->nb_index_entries++;
+        index= (*nb_index_entries)++;
         ie= &entries[index];
         assert(index==0 || ie[-1].timestamp < timestamp);
     }else{
@@ -1400,8 +1423,8 @@ int av_add_index_entry(AVStream *st,
         if(ie->timestamp != timestamp){
             if(ie->timestamp <= timestamp)
                 return -1;
-            memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));
-            st->nb_index_entries++;
+            memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(*nb_index_entries - index));
+            (*nb_index_entries)++;
         }else if(ie->pos == pos && distance < ie->min_distance) //do not reduce the distance
             distance= ie->min_distance;
     }
@@ -1415,11 +1438,17 @@ int av_add_index_entry(AVStream *st,
     return index;
 }
 
-int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
-                              int flags)
+int av_add_index_entry(AVStream *st,
+                       int64_t pos, int64_t timestamp, int size, int distance, int flags)
+{
+    return ff_add_index_entry(&st->index_entries, &st->nb_index_entries,
+                              &st->index_entries_allocated_size, pos,
+                              timestamp, size, distance, flags);
+}
+
+int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries,
+                              int64_t wanted_timestamp, int flags)
 {
-    AVIndexEntry *entries= st->index_entries;
-    int nb_entries= st->nb_index_entries;
     int a, b, m;
     int64_t timestamp;
 
@@ -1451,6 +1480,13 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
     return  m;
 }
 
+int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
+                              int flags)
+{
+    return ff_index_search_timestamp(st->index_entries, st->nb_index_entries,
+                                     wanted_timestamp, flags);
+}
+
 #define DEBUG_SEEK
 
 int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
@@ -1511,7 +1547,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
         return -1;
 
     /* do the seek */
-    if ((ret = url_fseek(s->pb, pos, SEEK_SET)) < 0)
+    if ((ret = avio_seek(s->pb, pos, SEEK_SET)) < 0)
         return ret;
 
     av_update_cur_dts(s, st, ts);
@@ -1537,7 +1573,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
 
     if(ts_max == AV_NOPTS_VALUE){
         int step= 1024;
-        filesize = url_fsize(s->pb);
+        filesize = avio_size(s->pb);
         pos_max = filesize - 1;
         do{
             pos_max -= step;
@@ -1646,12 +1682,12 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos,
 #endif
 
     pos_min = s->data_offset;
-    pos_max = url_fsize(s->pb) - 1;
+    pos_max = avio_size(s->pb) - 1;
 
     if     (pos < pos_min) pos= pos_min;
     else if(pos > pos_max) pos= pos_max;
 
-    url_fseek(s->pb, pos, SEEK_SET);
+    avio_seek(s->pb, pos, SEEK_SET);
 
 #if 0
     av_update_cur_dts(s, st, ts);
@@ -1681,11 +1717,11 @@ static int av_seek_frame_generic(AVFormatContext *s,
         if(st->nb_index_entries){
             assert(st->index_entries);
             ie= &st->index_entries[st->nb_index_entries-1];
-            if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
+            if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
                 return ret;
             av_update_cur_dts(s, st, ie->timestamp);
         }else{
-            if ((ret = url_fseek(s->pb, s->data_offset, SEEK_SET)) < 0)
+            if ((ret = avio_seek(s->pb, s->data_offset, SEEK_SET)) < 0)
                 return ret;
         }
         for(i=0;; i++) {
@@ -1712,7 +1748,7 @@ static int av_seek_frame_generic(AVFormatContext *s,
             return 0;
     }
     ie = &st->index_entries[index];
-    if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
+    if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
         return ret;
     av_update_cur_dts(s, st, ie->timestamp);
 
@@ -1936,7 +1972,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
     if (offset < 0)
         offset = 0;
 
-    url_fseek(ic->pb, offset, SEEK_SET);
+    avio_seek(ic->pb, offset, SEEK_SET);
     read_size = 0;
     for(;;) {
         if (read_size >= DURATION_MAX_READ_SIZE<<(FFMAX(retry-1,0)))
@@ -1971,7 +2007,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
 
     fill_all_stream_timings(ic);
 
-    url_fseek(ic->pb, old_offset, SEEK_SET);
+    avio_seek(ic->pb, old_offset, SEEK_SET);
     for (i=0; i<ic->nb_streams; i++) {
         st= ic->streams[i];
         st->cur_dts= st->first_dts;
@@ -1987,7 +2023,7 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
     if (ic->iformat->flags & AVFMT_NOFILE) {
         file_size = 0;
     } else {
-        file_size = url_fsize(ic->pb);
+        file_size = avio_size(ic->pb);
         if (file_size < 0)
             file_size = 0;
     }
@@ -1995,7 +2031,7 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
 
     if ((!strcmp(ic->iformat->name, "mpeg") ||
          !strcmp(ic->iformat->name, "mpegts")) &&
-        file_size && !url_is_streamed(ic->pb)) {
+        file_size && ic->pb->seekable) {
         /* get accurate estimate from the PTSes */
         av_estimate_timings_from_pts(ic, old_offset);
     } else if (av_has_duration(ic)) {
@@ -2144,22 +2180,23 @@ enum CodecID av_codec_get_id(const AVCodecTag * const *tags, unsigned int tag)
 
 static void compute_chapters_end(AVFormatContext *s)
 {
-    unsigned int i;
+    unsigned int i, j;
+    int64_t max_time = s->duration + (s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time;
 
-    for (i=0; i+1<s->nb_chapters; i++)
+    for (i = 0; i < s->nb_chapters; i++)
         if (s->chapters[i]->end == AV_NOPTS_VALUE) {
-            assert(s->chapters[i]->start <= s->chapters[i+1]->start);
-            assert(!av_cmp_q(s->chapters[i]->time_base, s->chapters[i+1]->time_base));
-            s->chapters[i]->end = s->chapters[i+1]->start;
+            AVChapter *ch = s->chapters[i];
+            int64_t   end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q, ch->time_base)
+                                     : INT64_MAX;
+
+            for (j = 0; j < s->nb_chapters; j++) {
+                AVChapter *ch1 = s->chapters[j];
+                int64_t next_start = av_rescale_q(ch1->start, ch1->time_base, ch->time_base);
+                if (j != i && next_start > ch->start && next_start < end)
+                    end = next_start;
+            }
+            ch->end = (end == INT64_MAX) ? ch->start : end;
         }
-
-    if (s->nb_chapters && s->chapters[i]->end == AV_NOPTS_VALUE) {
-        assert(s->start_time != AV_NOPTS_VALUE);
-        assert(s->duration > 0);
-        s->chapters[i]->end = av_rescale_q(s->start_time + s->duration,
-                                           AV_TIME_BASE_Q,
-                                           s->chapters[i]->time_base);
-    }
 }
 
 static int get_std_framerate(int i){
@@ -2192,7 +2229,7 @@ int av_find_stream_info(AVFormatContext *ic)
     int i, count, ret, read_size, j;
     AVStream *st;
     AVPacket pkt1, *pkt;
-    int64_t old_offset = url_ftell(ic->pb);
+    int64_t old_offset = avio_tell(ic->pb);
 
     for(i=0;i<ic->nb_streams;i++) {
         AVCodec *codec;
@@ -2246,7 +2283,7 @@ int av_find_stream_info(AVFormatContext *ic)
     read_size = 0;
     for(;;) {
         if(url_interrupt_cb()){
-            ret= AVERROR(EINTR);
+            ret= AVERROR_EXIT;
             av_log(ic, AV_LOG_DEBUG, "interrupted\n");
             break;
         }
@@ -2421,6 +2458,19 @@ int av_find_stream_info(AVFormatContext *ic)
         }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
             if(!st->codec->bits_per_coded_sample)
                 st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id);
+            // set stream disposition based on audio service type
+            switch (st->codec->audio_service_type) {
+            case AV_AUDIO_SERVICE_TYPE_EFFECTS:
+                st->disposition = AV_DISPOSITION_CLEAN_EFFECTS;    break;
+            case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:
+                st->disposition = AV_DISPOSITION_VISUAL_IMPAIRED;  break;
+            case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:
+                st->disposition = AV_DISPOSITION_HEARING_IMPAIRED; break;
+            case AV_AUDIO_SERVICE_TYPE_COMMENTARY:
+                st->disposition = AV_DISPOSITION_COMMENT;          break;
+            case AV_AUDIO_SERVICE_TYPE_KARAOKE:
+                st->disposition = AV_DISPOSITION_KARAOKE;          break;
+            }
         }
     }
 
@@ -2496,6 +2546,8 @@ int av_find_best_stream(AVFormatContext *ic,
             continue;
         if (wanted_stream_nb >= 0 && stream_number++ != wanted_stream_nb)
             continue;
+        if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))
+            continue;
         if (decoder_ret) {
             decoder = avcodec_find_decoder(ic->streams[i]->codec->codec_id);
             if (!decoder) {
@@ -2507,7 +2559,7 @@ int av_find_best_stream(AVFormatContext *ic,
         if (best_count >= st->codec_info_nb_frames)
             continue;
         best_count = st->codec_info_nb_frames;
-        ret = i;
+        ret = program ? program[i] : i;
         best_decoder = decoder;
         if (program && i == nb_streams - 1 && ret < 0) {
             program = NULL;
@@ -2527,7 +2579,7 @@ int av_read_play(AVFormatContext *s)
     if (s->iformat->read_play)
         return s->iformat->read_play(s);
     if (s->pb)
-        return av_url_read_fpause(s->pb, 0);
+        return ffio_read_pause(s->pb, 0);
     return AVERROR(ENOSYS);
 }
 
@@ -2536,18 +2588,23 @@ int av_read_pause(AVFormatContext *s)
     if (s->iformat->read_pause)
         return s->iformat->read_pause(s);
     if (s->pb)
-        return av_url_read_fpause(s->pb, 1);
+        return ffio_read_pause(s->pb, 1);
     return AVERROR(ENOSYS);
 }
 
 void av_close_input_stream(AVFormatContext *s)
 {
-    int i;
-    AVStream *st;
-
     flush_packet_queue(s);
     if (s->iformat->read_close)
         s->iformat->read_close(s);
+    avformat_free_context(s);
+}
+
+void avformat_free_context(AVFormatContext *s)
+{
+    int i;
+    AVStream *st;
+
     for(i=0;i<s->nb_streams;i++) {
         /* free all data in a stream component */
         st = s->streams[i];
@@ -2593,10 +2650,10 @@ void av_close_input_stream(AVFormatContext *s)
 
 void av_close_input_file(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
+    AVIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
     av_close_input_stream(s);
     if (pb)
-        url_fclose(pb);
+        avio_close(pb);
 }
 
 AVStream *av_new_stream(AVFormatContext *s, int id)
@@ -2882,7 +2939,8 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
     int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
     int num, den, frame_size, i;
 
-//    av_log(s, AV_LOG_DEBUG, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
+    av_dlog(s, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n",
+            pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
 
 /*    if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
         return -1;*/
@@ -2960,8 +3018,6 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
         return ret;
 
     ret= s->oformat->write_packet(s, pkt);
-    if(!ret)
-        ret= url_ferror(s->pb);
     return ret;
 }
 
@@ -3001,7 +3057,7 @@ next_non_null:
     *next_point= this_pktl;
 }
 
-int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
+static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
 {
     AVStream *st = s->streams[ pkt ->stream_index];
     AVStream *st2= s->streams[ next->stream_index];
@@ -3058,17 +3114,19 @@ static int av_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in,
 
 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
     AVStream *st= s->streams[ pkt->stream_index];
+    int ret;
 
     //FIXME/XXX/HACK drop zero sized packets
     if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size==0)
         return 0;
 
-//av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %"PRId64" %"PRId64"\n", pkt->size, pkt->dts, pkt->pts);
-    if(compute_pkt_fields2(s, st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return -1;
+    av_dlog(s, "av_interleaved_write_frame size:%d dts:%"PRId64" pts:%"PRId64"\n",
+            pkt->size, pkt->dts, pkt->pts);
+    if((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
+        return ret;
 
     if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return -1;
+        return AVERROR(EINVAL);
 
     for(;;){
         AVPacket opkt;
@@ -3083,8 +3141,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
 
         if(ret<0)
             return ret;
-        if(url_ferror(s->pb))
-            return url_ferror(s->pb);
     }
 }
 
@@ -3106,15 +3162,11 @@ int av_write_trailer(AVFormatContext *s)
 
         if(ret<0)
             goto fail;
-        if(url_ferror(s->pb))
-            goto fail;
     }
 
     if(s->oformat->write_trailer)
         ret = s->oformat->write_trailer(s);
 fail:
-    if(ret == 0)
-       ret=url_ferror(s->pb);
     for(i=0;i<s->nb_streams;i++) {
         av_freep(&s->streams[i]->priv_data);
         av_freep(&s->streams[i]->index_entries);
@@ -3210,15 +3262,45 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out
         if(st->codec->time_base.den && st->codec->time_base.num)
             print_fps(1/av_q2d(st->codec->time_base), "tbc");
     }
+    if (st->disposition & AV_DISPOSITION_DEFAULT)
+        av_log(NULL, AV_LOG_INFO, " (default)");
+    if (st->disposition & AV_DISPOSITION_DUB)
+        av_log(NULL, AV_LOG_INFO, " (dub)");
+    if (st->disposition & AV_DISPOSITION_ORIGINAL)
+        av_log(NULL, AV_LOG_INFO, " (original)");
+    if (st->disposition & AV_DISPOSITION_COMMENT)
+        av_log(NULL, AV_LOG_INFO, " (comment)");
+    if (st->disposition & AV_DISPOSITION_LYRICS)
+        av_log(NULL, AV_LOG_INFO, " (lyrics)");
+    if (st->disposition & AV_DISPOSITION_KARAOKE)
+        av_log(NULL, AV_LOG_INFO, " (karaoke)");
+    if (st->disposition & AV_DISPOSITION_FORCED)
+        av_log(NULL, AV_LOG_INFO, " (forced)");
+    if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)
+        av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
+    if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
+        av_log(NULL, AV_LOG_INFO, " (visual impaired)");
+    if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)
+        av_log(NULL, AV_LOG_INFO, " (clean effects)");
     av_log(NULL, AV_LOG_INFO, "\n");
     dump_metadata(NULL, st->metadata, "    ");
 }
 
+#if FF_API_DUMP_FORMAT
 void dump_format(AVFormatContext *ic,
                  int index,
                  const char *url,
                  int is_output)
 {
+    av_dump_format(ic, index, url, is_output);
+}
+#endif
+
+void av_dump_format(AVFormatContext *ic,
+                    int index,
+                    const char *url,
+                    int is_output)
+{
     int i;
     uint8_t *printed = av_mallocz(ic->nb_streams);
     if (ic->nb_streams && !printed)
@@ -3294,7 +3376,7 @@ void dump_format(AVFormatContext *ic,
 }
 
 #if FF_API_PARSE_FRAME_PARAM
-#include "libavcore/parseutils.h"
+#include "libavutil/parseutils.h"
 
 int parse_image_size(int *width_ptr, int *height_ptr, const char *str)
 {
@@ -3323,163 +3405,25 @@ uint64_t ff_ntp_time(void)
   return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;
 }
 
-int64_t parse_date(const char *datestr, int duration)
-{
-    const char *p;
-    int64_t t;
-    struct tm dt;
-    int i;
-    static const char * const date_fmt[] = {
-        "%Y-%m-%d",
-        "%Y%m%d",
-    };
-    static const char * const time_fmt[] = {
-        "%H:%M:%S",
-        "%H%M%S",
-    };
-    const char *q;
-    int is_utc, len;
-    char lastch;
-    int negative = 0;
-
-#undef time
-    time_t now = time(0);
-
-    len = strlen(datestr);
-    if (len > 0)
-        lastch = datestr[len - 1];
-    else
-        lastch = '\0';
-    is_utc = (lastch == 'z' || lastch == 'Z');
-
-    memset(&dt, 0, sizeof(dt));
-
-    p = datestr;
-    q = NULL;
-    if (!duration) {
-        if (!strncasecmp(datestr, "now", len))
-            return (int64_t) now * 1000000;
-
-        /* parse the year-month-day part */
-        for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) {
-            q = small_strptime(p, date_fmt[i], &dt);
-            if (q) {
-                break;
-            }
-        }
-
-        /* if the year-month-day part is missing, then take the
-         * current year-month-day time */
-        if (!q) {
-            if (is_utc) {
-                dt = *gmtime(&now);
-            } else {
-                dt = *localtime(&now);
-            }
-            dt.tm_hour = dt.tm_min = dt.tm_sec = 0;
-        } else {
-            p = q;
-        }
+#if FF_API_PARSE_DATE
+#include "libavutil/parseutils.h"
 
-        if (*p == 'T' || *p == 't' || *p == ' ')
-            p++;
-
-        /* parse the hour-minute-second part */
-        for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) {
-            q = small_strptime(p, time_fmt[i], &dt);
-            if (q) {
-                break;
-            }
-        }
-    } else {
-        /* parse datestr as a duration */
-        if (p[0] == '-') {
-            negative = 1;
-            ++p;
-        }
-        /* parse datestr as HH:MM:SS */
-        q = small_strptime(p, time_fmt[0], &dt);
-        if (!q) {
-            /* parse datestr as S+ */
-            dt.tm_sec = strtol(p, (char **)&q, 10);
-            if (q == p)
-                /* the parsing didn't succeed */
-                return INT64_MIN;
-            dt.tm_min = 0;
-            dt.tm_hour = 0;
-        }
-    }
-
-    /* Now we have all the fields that we can get */
-    if (!q) {
-        return INT64_MIN;
-    }
-
-    if (duration) {
-        t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec;
-    } else {
-        dt.tm_isdst = -1;       /* unknown */
-        if (is_utc) {
-            t = mktimegm(&dt);
-        } else {
-            t = mktime(&dt);
-        }
-    }
-
-    t *= 1000000;
-
-    /* parse the .m... part */
-    if (*q == '.') {
-        int val, n;
-        q++;
-        for (val = 0, n = 100000; n >= 1; n /= 10, q++) {
-            if (!isdigit(*q))
-                break;
-            val += n * (*q - '0');
-        }
-        t += val;
-    }
-    return negative ? -t : t;
+int64_t parse_date(const char *timestr, int duration)
+{
+    int64_t timeval;
+    av_parse_time(&timeval, timestr, duration);
+    return timeval;
 }
+#endif
+
+#if FF_API_FIND_INFO_TAG
+#include "libavutil/parseutils.h"
 
 int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
 {
-    const char *p;
-    char tag[128], *q;
-
-    p = info;
-    if (*p == '?')
-        p++;
-    for(;;) {
-        q = tag;
-        while (*p != '\0' && *p != '=' && *p != '&') {
-            if ((q - tag) < sizeof(tag) - 1)
-                *q++ = *p;
-            p++;
-        }
-        *q = '\0';
-        q = arg;
-        if (*p == '=') {
-            p++;
-            while (*p != '&' && *p != '\0') {
-                if ((q - arg) < arg_size - 1) {
-                    if (*p == '+')
-                        *q++ = ' ';
-                    else
-                        *q++ = *p;
-                }
-                p++;
-            }
-        }
-        *q = '\0';
-        if (!strcmp(tag, tag1))
-            return 1;
-        if (*p != '&')
-            break;
-        p++;
-    }
-    return 0;
+    return av_find_info_tag(arg, arg_size, tag1, info);
 }
+#endif
 
 int av_get_frame_filename(char *buf, int buf_size,
                           const char *path, int number)
@@ -3575,26 +3519,25 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size)
     hex_dump_internal(avcl, NULL, level, buf, size);
 }
 
- //FIXME needs to know the time_base
-static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload)
+static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base)
 {
 #undef fprintf
 #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
     PRINT("stream #%d:\n", pkt->stream_index);
     PRINT("  keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0));
-    PRINT("  duration=%0.3f\n", (double)pkt->duration / AV_TIME_BASE);
+    PRINT("  duration=%0.3f\n", pkt->duration * av_q2d(time_base));
     /* DTS is _always_ valid after av_read_frame() */
     PRINT("  dts=");
     if (pkt->dts == AV_NOPTS_VALUE)
         PRINT("N/A");
     else
-        PRINT("%0.3f", (double)pkt->dts / AV_TIME_BASE);
+        PRINT("%0.3f", pkt->dts * av_q2d(time_base));
     /* PTS may not be known if B-frames are present. */
     PRINT("  pts=");
     if (pkt->pts == AV_NOPTS_VALUE)
         PRINT("N/A");
     else
-        PRINT("%0.3f", (double)pkt->pts / AV_TIME_BASE);
+        PRINT("%0.3f", pkt->pts * av_q2d(time_base));
     PRINT("\n");
     PRINT("  size=%d\n", pkt->size);
 #undef PRINT
@@ -3602,14 +3545,31 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int
         av_hex_dump(f, pkt->data, pkt->size);
 }
 
+#if FF_API_PKT_DUMP
 void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload)
 {
-    pkt_dump_internal(NULL, f, 0, pkt, dump_payload);
+    AVRational tb = { 1, AV_TIME_BASE };
+    pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb);
+}
+#endif
+
+void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
+{
+    pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
 }
 
+#if FF_API_PKT_DUMP
 void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload)
 {
-    pkt_dump_internal(avcl, NULL, level, pkt, dump_payload);
+    AVRational tb = { 1, AV_TIME_BASE };
+    pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb);
+}
+#endif
+
+void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
+                      AVStream *st)
+{
+    pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
 }
 
 #if FF_API_URL_SPLIT
@@ -3743,16 +3703,19 @@ int ff_hex_to_data(uint8_t *data, const char *p)
 void av_set_pts_info(AVStream *s, int pts_wrap_bits,
                      unsigned int pts_num, unsigned int pts_den)
 {
-    s->pts_wrap_bits = pts_wrap_bits;
-
-    if(av_reduce(&s->time_base.num, &s->time_base.den, pts_num, pts_den, INT_MAX)){
-        if(s->time_base.num != pts_num)
-            av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, pts_num/s->time_base.num);
+    AVRational new_tb;
+    if(av_reduce(&new_tb.num, &new_tb.den, pts_num, pts_den, INT_MAX)){
+        if(new_tb.num != pts_num)
+            av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, pts_num/new_tb.num);
     }else
         av_log(NULL, AV_LOG_WARNING, "st:%d has too large timebase, reducing\n", s->index);
 
-    if(!s->time_base.num || !s->time_base.den)
-        s->time_base.num= s->time_base.den= 0;
+    if(new_tb.num <= 0 || new_tb.den <= 0) {
+        av_log(NULL, AV_LOG_ERROR, "Ignoring attempt to set invalid timebase for st:%d\n", s->index);
+        return;
+    }
+    s->time_base = new_tb;
+    s->pts_wrap_bits = pts_wrap_bits;
 }
 
 int ff_url_join(char *str, int size, const char *proto,
@@ -3881,3 +3844,54 @@ int ff_find_stream_index(AVFormatContext *s, int id)
     }
     return -1;
 }
+
+void ff_make_absolute_url(char *buf, int size, const char *base,
+                          const char *rel)
+{
+    char *sep;
+    /* Absolute path, relative to the current server */
+    if (base && strstr(base, "://") && rel[0] == '/') {
+        if (base != buf)
+            av_strlcpy(buf, base, size);
+        sep = strstr(buf, "://");
+        if (sep) {
+            sep += 3;
+            sep = strchr(sep, '/');
+            if (sep)
+                *sep = '\0';
+        }
+        av_strlcat(buf, rel, size);
+        return;
+    }
+    /* If rel actually is an absolute url, just copy it */
+    if (!base || strstr(rel, "://") || rel[0] == '/') {
+        av_strlcpy(buf, rel, size);
+        return;
+    }
+    if (base != buf)
+        av_strlcpy(buf, base, size);
+    /* Remove the file name from the base url */
+    sep = strrchr(buf, '/');
+    if (sep)
+        sep[1] = '\0';
+    else
+        buf[0] = '\0';
+    while (av_strstart(rel, "../", NULL) && sep) {
+        /* Remove the path delimiter at the end */
+        sep[0] = '\0';
+        sep = strrchr(buf, '/');
+        /* If the next directory name to pop off is "..", break here */
+        if (!strcmp(sep ? &sep[1] : buf, "..")) {
+            /* Readd the slash we just removed */
+            av_strlcat(buf, "/", size);
+            break;
+        }
+        /* Cut off the directory name */
+        if (sep)
+            sep[1] = '\0';
+        else
+            buf[0] = '\0';
+        rel += 3;
+    }
+    av_strlcat(buf, rel, size);
+}
diff --git a/ffmpeg-mt/libavformat/vc1test.c b/ffmpeg-mt/libavformat/vc1test.c
index 7a006f2..07f3247 100644
--- a/ffmpeg-mt/libavformat/vc1test.c
+++ b/ffmpeg-mt/libavformat/vc1test.c
@@ -2,20 +2,20 @@
  * VC1 Test Bitstreams Format Demuxer
  * Copyright (c) 2006, 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -44,13 +44,13 @@ static int vc1t_probe(AVProbeData *p)
 static int vc1t_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     int frames;
     uint32_t fps;
 
-    frames = get_le24(pb);
-    if(get_byte(pb) != 0xC5 || get_le32(pb) != 4)
+    frames = avio_rl24(pb);
+    if(avio_r8(pb) != 0xC5 || avio_rl32(pb) != 4)
         return -1;
 
     /* init video codec */
@@ -63,13 +63,13 @@ static int vc1t_read_header(AVFormatContext *s,
 
     st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
     st->codec->extradata_size = VC1_EXTRADATA_SIZE;
-    get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
-    st->codec->height = get_le32(pb);
-    st->codec->width = get_le32(pb);
-    if(get_le32(pb) != 0xC)
+    avio_read(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
+    st->codec->height = avio_rl32(pb);
+    st->codec->width = avio_rl32(pb);
+    if(avio_rl32(pb) != 0xC)
         return -1;
-    url_fskip(pb, 8);
-    fps = get_le32(pb);
+    avio_skip(pb, 8);
+    fps = avio_rl32(pb);
     if(fps == 0xFFFFFFFF)
         av_set_pts_info(st, 32, 1, 1000);
     else{
@@ -87,18 +87,18 @@ static int vc1t_read_header(AVFormatContext *s,
 static int vc1t_read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int frame_size;
     int keyframe = 0;
     uint32_t pts;
 
-    if(url_feof(pb))
+    if(pb->eof_reached)
         return AVERROR(EIO);
 
-    frame_size = get_le24(pb);
-    if(get_byte(pb) & 0x80)
+    frame_size = avio_rl24(pb);
+    if(avio_r8(pb) & 0x80)
         keyframe = 1;
-    pts = get_le32(pb);
+    pts = avio_rl32(pb);
     if(av_get_packet(pb, pkt, frame_size) < 0)
         return AVERROR(EIO);
     if(s->streams[0]->time_base.den == 1000)
@@ -109,7 +109,7 @@ static int vc1t_read_packet(AVFormatContext *s,
     return pkt->size;
 }
 
-AVInputFormat vc1t_demuxer = {
+AVInputFormat ff_vc1t_demuxer = {
     "vc1test",
     NULL_IF_CONFIG_SMALL("VC-1 test bitstream format"),
     0,
diff --git a/ffmpeg-mt/libavformat/vc1testenc.c b/ffmpeg-mt/libavformat/vc1testenc.c
index b4b1e02..2b0728d 100644
--- a/ffmpeg-mt/libavformat/vc1testenc.c
+++ b/ffmpeg-mt/libavformat/vc1testenc.c
@@ -2,20 +2,20 @@
  * VC-1 test bitstreams format muxer.
  * Copyright (c) 2008 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
@@ -27,26 +27,27 @@ typedef struct RCVContext {
 static int vc1test_write_header(AVFormatContext *s)
 {
     AVCodecContext *avc = s->streams[0]->codec;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     if (avc->codec_id != CODEC_ID_WMV3) {
         av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n");
         return -1;
     }
-    put_le24(pb, 0); //frames count will be here
-    put_byte(pb, 0xC5);
-    put_le32(pb, 4);
-    put_buffer(pb, avc->extradata, 4);
-    put_le32(pb, avc->height);
-    put_le32(pb, avc->width);
-    put_le32(pb, 0xC);
-    put_le24(pb, 0); // hrd_buffer
-    put_byte(pb, 0x80); // level|cbr|res1
-    put_le32(pb, 0); // hrd_rate
+    avio_wl24(pb, 0); //frames count will be here
+    avio_w8(pb, 0xC5);
+    avio_wl32(pb, 4);
+    avio_write(pb, avc->extradata, 4);
+    avio_wl32(pb, avc->height);
+    avio_wl32(pb, avc->width);
+    avio_wl32(pb, 0xC);
+    avio_wl24(pb, 0); // hrd_buffer
+    avio_w8(pb, 0x80); // level|cbr|res1
+    avio_wl32(pb, 0); // hrd_rate
     if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1)
-        put_le32(pb, s->streams[0]->r_frame_rate.den);
+        avio_wl32(pb, s->streams[0]->r_frame_rate.den);
     else
-        put_le32(pb, 0xFFFFFFFF); //variable framerate
+        avio_wl32(pb, 0xFFFFFFFF); //variable framerate
+    av_set_pts_info(s->streams[0], 32, 1, 1000);
 
     return 0;
 }
@@ -54,14 +55,14 @@ static int vc1test_write_header(AVFormatContext *s)
 static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     RCVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     if (!pkt->size)
         return 0;
-    put_le32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0));
-    put_le32(pb, pkt->pts);
-    put_buffer(pb, pkt->data, pkt->size);
-    put_flush_packet(pb);
+    avio_wl32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0));
+    avio_wl32(pb, pkt->pts);
+    avio_write(pb, pkt->data, pkt->size);
+    avio_flush(pb);
     ctx->frames++;
 
     return 0;
@@ -70,17 +71,17 @@ static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt)
 static int vc1test_write_trailer(AVFormatContext *s)
 {
     RCVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
-    if (!url_is_streamed(s->pb)) {
-        url_fseek(pb, 0, SEEK_SET);
-        put_le24(pb, ctx->frames);
-        put_flush_packet(pb);
+    if (s->pb->seekable) {
+        avio_seek(pb, 0, SEEK_SET);
+        avio_wl24(pb, ctx->frames);
+        avio_flush(pb);
     }
     return 0;
 }
 
-AVOutputFormat vc1t_muxer = {
+AVOutputFormat ff_vc1t_muxer = {
     "rcv",
     NULL_IF_CONFIG_SMALL("VC-1 test bitstream"),
     "",
diff --git a/ffmpeg-mt/libavformat/version.h b/ffmpeg-mt/libavformat/version.h
new file mode 100644
index 0000000..a29c2c6
--- /dev/null
+++ b/ffmpeg-mt/libavformat/version.h
@@ -0,0 +1,114 @@
+/*
+ * Version macros.
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_VERSION_H
+#define AVFORMAT_VERSION_H
+
+#include "libavutil/avutil.h"
+
+#define LIBAVFORMAT_VERSION_MAJOR 52
+#define LIBAVFORMAT_VERSION_MINOR 106
+#define LIBAVFORMAT_VERSION_MICRO  0
+
+#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
+                                               LIBAVFORMAT_VERSION_MINOR, \
+                                               LIBAVFORMAT_VERSION_MICRO)
+#define LIBAVFORMAT_VERSION     AV_VERSION(LIBAVFORMAT_VERSION_MAJOR,   \
+                                           LIBAVFORMAT_VERSION_MINOR,   \
+                                           LIBAVFORMAT_VERSION_MICRO)
+#define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
+
+#define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
+
+/**
+ * Those FF_API_* defines are not part of public API.
+ * They may change, break or disappear at any time.
+ */
+#ifndef FF_API_MAX_STREAMS
+#define FF_API_MAX_STREAMS             (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_OLD_METADATA
+#define FF_API_OLD_METADATA            (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_URL_CLASS
+#define FF_API_URL_CLASS               (LIBAVFORMAT_VERSION_MAJOR >= 53)
+#endif
+#ifndef FF_API_URL_RESETBUF
+#define FF_API_URL_RESETBUF            (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_REGISTER_PROTOCOL
+#define FF_API_REGISTER_PROTOCOL       (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_GUESS_FORMAT
+#define FF_API_GUESS_FORMAT            (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_UDP_GET_FILE
+#define FF_API_UDP_GET_FILE            (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_URL_SPLIT
+#define FF_API_URL_SPLIT               (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_ALLOC_FORMAT_CONTEXT
+#define FF_API_ALLOC_FORMAT_CONTEXT    (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_PARSE_FRAME_PARAM
+#define FF_API_PARSE_FRAME_PARAM       (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_READ_SEEK
+#define FF_API_READ_SEEK               (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_LAVF_UNUSED
+#define FF_API_LAVF_UNUSED             (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_PARAMETERS_CODEC_ID
+#define FF_API_PARAMETERS_CODEC_ID     (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_FIRST_FORMAT
+#define FF_API_FIRST_FORMAT            (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_SYMVER
+#define FF_API_SYMVER                  (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_OLD_AVIO
+#define FF_API_OLD_AVIO                (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_INDEX_BUILT
+#define FF_API_INDEX_BUILT             (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_DUMP_FORMAT
+#define FF_API_DUMP_FORMAT             (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_PARSE_DATE
+#define FF_API_PARSE_DATE              (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_FIND_INFO_TAG
+#define FF_API_FIND_INFO_TAG           (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_PKT_DUMP
+#define FF_API_PKT_DUMP                (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_GUESS_IMG2_CODEC
+#define FF_API_GUESS_IMG2_CODEC        (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_SDP_CREATE
+#define FF_API_SDP_CREATE              (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+
+#endif //AVFORMAT_VERSION_H
diff --git a/ffmpeg-mt/libavformat/voc.c b/ffmpeg-mt/libavformat/voc.c
index 53e02f9..314623e 100644
--- a/ffmpeg-mt/libavformat/voc.c
+++ b/ffmpeg-mt/libavformat/voc.c
@@ -2,20 +2,20 @@
  * Creative Voice File common data.
  * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/voc.h b/ffmpeg-mt/libavformat/voc.h
index 3f995ad..abd8fdb 100644
--- a/ffmpeg-mt/libavformat/voc.h
+++ b/ffmpeg-mt/libavformat/voc.h
@@ -2,20 +2,20 @@
  * Creative Voice File demuxer.
  * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/vocdec.c b/ffmpeg-mt/libavformat/vocdec.c
index aa69dd2..eaa2f25 100644
--- a/ffmpeg-mt/libavformat/vocdec.c
+++ b/ffmpeg-mt/libavformat/vocdec.c
@@ -2,20 +2,20 @@
  * Creative Voice File demuxer.
  * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -41,17 +41,17 @@ static int voc_probe(AVProbeData *p)
 static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     VocDecContext *voc = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int header_size;
     AVStream *st;
 
-    url_fskip(pb, 20);
-    header_size = get_le16(pb) - 22;
+    avio_skip(pb, 20);
+    header_size = avio_rl16(pb) - 22;
     if (header_size != 4) {
         av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size);
         return AVERROR(ENOSYS);
     }
-    url_fskip(pb, header_size);
+    avio_skip(pb, header_size);
     st = av_new_stream(s, 0);
     if (!st)
         return AVERROR(ENOMEM);
@@ -66,35 +66,31 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
 {
     VocDecContext *voc = s->priv_data;
     AVCodecContext *dec = st->codec;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     VocType type;
-    int size, tmp_codec;
+    int size, tmp_codec=-1;
     int sample_rate = 0;
     int channels = 1;
 
     while (!voc->remaining_size) {
-        type = get_byte(pb);
+        type = avio_r8(pb);
         if (type == VOC_TYPE_EOF)
             return AVERROR(EIO);
-        voc->remaining_size = get_le24(pb);
+        voc->remaining_size = avio_rl24(pb);
         if (!voc->remaining_size) {
-            if (url_is_streamed(s->pb))
+            if (!s->pb->seekable)
                 return AVERROR(EIO);
-            voc->remaining_size = url_fsize(pb) - url_ftell(pb);
+            voc->remaining_size = avio_size(pb) - avio_tell(pb);
         }
         max_size -= 4;
 
         switch (type) {
         case VOC_TYPE_VOICE_DATA:
-            dec->sample_rate = 1000000 / (256 - get_byte(pb));
+            dec->sample_rate = 1000000 / (256 - avio_r8(pb));
             if (sample_rate)
                 dec->sample_rate = sample_rate;
             dec->channels = channels;
-            tmp_codec = ff_codec_get_id(ff_voc_codec_tags, get_byte(pb));
-            if (dec->codec_id == CODEC_ID_NONE)
-                dec->codec_id = tmp_codec;
-            else if (dec->codec_id != tmp_codec)
-                av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n");
+            tmp_codec = avio_r8(pb);
             dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);
             voc->remaining_size -= 2;
             max_size -= 2;
@@ -105,37 +101,44 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
             break;
 
         case VOC_TYPE_EXTENDED:
-            sample_rate = get_le16(pb);
-            get_byte(pb);
-            channels = get_byte(pb) + 1;
+            sample_rate = avio_rl16(pb);
+            avio_r8(pb);
+            channels = avio_r8(pb) + 1;
             sample_rate = 256000000 / (channels * (65536 - sample_rate));
             voc->remaining_size = 0;
             max_size -= 4;
             break;
 
         case VOC_TYPE_NEW_VOICE_DATA:
-            dec->sample_rate = get_le32(pb);
-            dec->bits_per_coded_sample = get_byte(pb);
-            dec->channels = get_byte(pb);
-            tmp_codec = ff_codec_get_id(ff_voc_codec_tags, get_byte(pb));
-            if (dec->codec_id == CODEC_ID_NONE)
-                dec->codec_id = tmp_codec;
-            else if (dec->codec_id != tmp_codec)
-                av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n");
-            url_fskip(pb, 4);
+            dec->sample_rate = avio_rl32(pb);
+            dec->bits_per_coded_sample = avio_r8(pb);
+            dec->channels = avio_r8(pb);
+            tmp_codec = avio_rl16(pb);
+            avio_skip(pb, 4);
             voc->remaining_size -= 12;
             max_size -= 12;
             break;
 
         default:
-            url_fskip(pb, voc->remaining_size);
+            avio_skip(pb, voc->remaining_size);
             max_size -= voc->remaining_size;
             voc->remaining_size = 0;
             break;
         }
+    }
+
+    if (tmp_codec >= 0) {
+        tmp_codec = ff_codec_get_id(ff_voc_codec_tags, tmp_codec);
+        if (dec->codec_id == CODEC_ID_NONE)
+            dec->codec_id = tmp_codec;
+        else if (dec->codec_id != tmp_codec)
+            av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n");
         if (dec->codec_id == CODEC_ID_NONE) {
-            av_log(s, AV_LOG_ERROR, "Invalid codec_id\n");
-            if (s->audio_codec_id == CODEC_ID_NONE) return AVERROR(EINVAL);
+            if (s->audio_codec_id == CODEC_ID_NONE) {
+                av_log(s, AV_LOG_ERROR, "unknown codec tag\n");
+                return AVERROR(EINVAL);
+            }
+            av_log(s, AV_LOG_WARNING, "unknown codec tag\n");
         }
     }
 
@@ -153,7 +156,7 @@ static int voc_read_packet(AVFormatContext *s, AVPacket *pkt)
     return voc_get_packet(s, pkt, s->streams[0], 0);
 }
 
-AVInputFormat voc_demuxer = {
+AVInputFormat ff_voc_demuxer = {
     "voc",
     NULL_IF_CONFIG_SMALL("Creative Voice file format"),
     sizeof(VocDecContext),
diff --git a/ffmpeg-mt/libavformat/vocenc.c b/ffmpeg-mt/libavformat/vocenc.c
index 2d3472e..bbb69c8 100644
--- a/ffmpeg-mt/libavformat/vocenc.c
+++ b/ffmpeg-mt/libavformat/vocenc.c
@@ -2,20 +2,20 @@
  * Creative Voice File muxer.
  * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -29,7 +29,7 @@ typedef struct voc_enc_context {
 
 static int voc_write_header(AVFormatContext *s)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     const int header_size = 26;
     const int version = 0x0114;
 
@@ -37,10 +37,10 @@ static int voc_write_header(AVFormatContext *s)
         || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
         return AVERROR_PATCHWELCOME;
 
-    put_buffer(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
-    put_le16(pb, header_size);
-    put_le16(pb, version);
-    put_le16(pb, ~version + 0x1234);
+    avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
+    avio_wl16(pb, header_size);
+    avio_wl16(pb, version);
+    avio_wl16(pb, ~version + 0x1234);
 
     return 0;
 }
@@ -49,47 +49,47 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     VocEncContext *voc = s->priv_data;
     AVCodecContext *enc = s->streams[0]->codec;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
 
     if (!voc->param_written) {
         if (enc->codec_tag > 0xFF) {
-            put_byte(pb, VOC_TYPE_NEW_VOICE_DATA);
-            put_le24(pb, pkt->size + 12);
-            put_le32(pb, enc->sample_rate);
-            put_byte(pb, enc->bits_per_coded_sample);
-            put_byte(pb, enc->channels);
-            put_le16(pb, enc->codec_tag);
-            put_le32(pb, 0);
+            avio_w8(pb, VOC_TYPE_NEW_VOICE_DATA);
+            avio_wl24(pb, pkt->size + 12);
+            avio_wl32(pb, enc->sample_rate);
+            avio_w8(pb, enc->bits_per_coded_sample);
+            avio_w8(pb, enc->channels);
+            avio_wl16(pb, enc->codec_tag);
+            avio_wl32(pb, 0);
         } else {
             if (s->streams[0]->codec->channels > 1) {
-                put_byte(pb, VOC_TYPE_EXTENDED);
-                put_le24(pb, 4);
-                put_le16(pb, 65536-256000000/(enc->sample_rate*enc->channels));
-                put_byte(pb, enc->codec_tag);
-                put_byte(pb, enc->channels - 1);
+                avio_w8(pb, VOC_TYPE_EXTENDED);
+                avio_wl24(pb, 4);
+                avio_wl16(pb, 65536-256000000/(enc->sample_rate*enc->channels));
+                avio_w8(pb, enc->codec_tag);
+                avio_w8(pb, enc->channels - 1);
             }
-            put_byte(pb, VOC_TYPE_VOICE_DATA);
-            put_le24(pb, pkt->size + 2);
-            put_byte(pb, 256 - 1000000 / enc->sample_rate);
-            put_byte(pb, enc->codec_tag);
+            avio_w8(pb, VOC_TYPE_VOICE_DATA);
+            avio_wl24(pb, pkt->size + 2);
+            avio_w8(pb, 256 - 1000000 / enc->sample_rate);
+            avio_w8(pb, enc->codec_tag);
         }
         voc->param_written = 1;
     } else {
-        put_byte(pb, VOC_TYPE_VOICE_DATA_CONT);
-        put_le24(pb, pkt->size);
+        avio_w8(pb, VOC_TYPE_VOICE_DATA_CONT);
+        avio_wl24(pb, pkt->size);
     }
 
-    put_buffer(pb, pkt->data, pkt->size);
+    avio_write(pb, pkt->data, pkt->size);
     return 0;
 }
 
 static int voc_write_trailer(AVFormatContext *s)
 {
-    put_byte(s->pb, 0);
+    avio_w8(s->pb, 0);
     return 0;
 }
 
-AVOutputFormat voc_muxer = {
+AVOutputFormat ff_voc_muxer = {
     "voc",
     NULL_IF_CONFIG_SMALL("Creative Voice file format"),
     "audio/x-voc",
diff --git a/ffmpeg-mt/libavformat/vorbiscomment.c b/ffmpeg-mt/libavformat/vorbiscomment.c
index 59a403f..22176c6 100644
--- a/ffmpeg-mt/libavformat/vorbiscomment.c
+++ b/ffmpeg-mt/libavformat/vorbiscomment.c
@@ -2,20 +2,20 @@
  * VorbisComment writer
  * Copyright (c) 2009 James Darnley
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/vorbiscomment.h b/ffmpeg-mt/libavformat/vorbiscomment.h
index 3dfe9d2..98cc4f8 100644
--- a/ffmpeg-mt/libavformat/vorbiscomment.h
+++ b/ffmpeg-mt/libavformat/vorbiscomment.h
@@ -2,20 +2,20 @@
  * VorbisComment writer
  * Copyright (c) 2009 James Darnley
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavformat/vqf.c b/ffmpeg-mt/libavformat/vqf.c
index b0ec020..14fb8d7 100644
--- a/ffmpeg-mt/libavformat/vqf.c
+++ b/ffmpeg-mt/libavformat/vqf.c
@@ -2,20 +2,20 @@
  * VQF demuxer
  * Copyright (c) 2009 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -54,7 +54,7 @@ static void add_metadata(AVFormatContext *s, const char *tag,
     buf = av_malloc(len+1);
     if (!buf)
         return;
-    get_buffer(s->pb, buf, len);
+    avio_read(s->pb, buf, len);
     buf[len] = 0;
     av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL);
 }
@@ -72,9 +72,9 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
     if (!st)
         return AVERROR(ENOMEM);
 
-    url_fskip(s->pb, 12);
+    avio_skip(s->pb, 12);
 
-    header_size = get_be32(s->pb);
+    header_size = avio_rb32(s->pb);
 
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id   = CODEC_ID_TWINVQ;
@@ -82,12 +82,12 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     do {
         int len;
-        chunk_tag = get_le32(s->pb);
+        chunk_tag = avio_rl32(s->pb);
 
         if (chunk_tag == MKTAG('D','A','T','A'))
             break;
 
-        len = get_be32(s->pb);
+        len = avio_rb32(s->pb);
 
         if ((unsigned) len > INT_MAX/2) {
             av_log(s, AV_LOG_ERROR, "Malformed header\n");
@@ -98,10 +98,10 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
         switch(chunk_tag){
         case MKTAG('C','O','M','M'):
-            st->codec->channels = get_be32(s->pb) + 1;
-            read_bitrate        = get_be32(s->pb);
-            rate_flag           = get_be32(s->pb);
-            url_fskip(s->pb, len-12);
+            st->codec->channels = avio_rb32(s->pb) + 1;
+            read_bitrate        = avio_rb32(s->pb);
+            rate_flag           = avio_rb32(s->pb);
+            avio_skip(s->pb, len-12);
 
             st->codec->bit_rate              = read_bitrate*1000;
             st->codec->bits_per_coded_sample = 16;
@@ -140,7 +140,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
             av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n",
                    ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1],
                    ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]);
-            url_fskip(s->pb, FFMIN(len, header_size));
+            avio_skip(s->pb, FFMIN(len, header_size));
             break;
         }
 
@@ -200,7 +200,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret;
     int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;
 
-    pkt->pos          = url_ftell(s->pb);
+    pkt->pos          = avio_tell(s->pb);
     pkt->stream_index = 0;
 
     if (av_new_packet(pkt, size+2) < 0)
@@ -208,7 +208,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip
     pkt->data[1] = c->last_frame_bits;
-    ret = get_buffer(s->pb, pkt->data+2, size);
+    ret = avio_read(s->pb, pkt->data+2, size);
 
     if (ret<=0) {
         av_free_packet(pkt);
@@ -240,14 +240,14 @@ static int vqf_read_seek(AVFormatContext *s,
     st->cur_dts = av_rescale(pos, st->time_base.den,
                              st->codec->bit_rate * (int64_t)st->time_base.num);
 
-    if ((ret = url_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
+    if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
         return ret;
 
     c->remaining_bits = -7 - ((pos-7)&7);
     return 0;
 }
 
-AVInputFormat vqf_demuxer = {
+AVInputFormat ff_vqf_demuxer = {
     "vqf",
     NULL_IF_CONFIG_SMALL("Nippon Telegraph and Telephone Corporation (NTT) TwinVQ"),
     sizeof(VqfContext),
diff --git a/ffmpeg-mt/libavformat/wav.c b/ffmpeg-mt/libavformat/wav.c
index 894c0c0..47685d4 100644
--- a/ffmpeg-mt/libavformat/wav.c
+++ b/ffmpeg-mt/libavformat/wav.c
@@ -6,23 +6,24 @@
  * RF64 demuxer
  * Copyright (c) 2009 Daniel Verkamp
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "avio_internal.h"
 #include "pcm.h"
 #include "riff.h"
 
@@ -39,12 +40,12 @@ typedef struct {
 static int wav_write_header(AVFormatContext *s)
 {
     WAVContext *wav = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int64_t fmt, fact;
 
-    put_tag(pb, "RIFF");
-    put_le32(pb, 0); /* file length */
-    put_tag(pb, "WAVE");
+    ffio_wfourcc(pb, "RIFF");
+    avio_wl32(pb, 0); /* file length */
+    ffio_wfourcc(pb, "WAVE");
 
     /* format header */
     fmt = ff_start_tag(pb, "fmt ");
@@ -57,9 +58,9 @@ static int wav_write_header(AVFormatContext *s)
     ff_end_tag(pb, fmt);
 
     if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */
-        && !url_is_streamed(s->pb)) {
+        && s->pb->seekable) {
         fact = ff_start_tag(pb, "fact");
-        put_le32(pb, 0);
+        avio_wl32(pb, 0);
         ff_end_tag(pb, fact);
     }
 
@@ -70,16 +71,16 @@ static int wav_write_header(AVFormatContext *s)
     /* data header */
     wav->data = ff_start_tag(pb, "data");
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
     return 0;
 }
 
 static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    ByteIOContext *pb  = s->pb;
+    AVIOContext *pb  = s->pb;
     WAVContext    *wav = s->priv_data;
-    put_buffer(pb, pkt->data, pkt->size);
+    avio_write(pb, pkt->data, pkt->size);
     if(pkt->pts != AV_NOPTS_VALUE) {
         wav->minpts        = FFMIN(wav->minpts, pkt->pts);
         wav->maxpts        = FFMAX(wav->maxpts, pkt->pts);
@@ -91,22 +92,22 @@ static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
 
 static int wav_write_trailer(AVFormatContext *s)
 {
-    ByteIOContext *pb  = s->pb;
+    AVIOContext *pb  = s->pb;
     WAVContext    *wav = s->priv_data;
     int64_t file_size;
 
-    put_flush_packet(pb);
+    avio_flush(pb);
 
-    if (!url_is_streamed(s->pb)) {
+    if (s->pb->seekable) {
         ff_end_tag(pb, wav->data);
 
         /* update file size */
-        file_size = url_ftell(pb);
-        url_fseek(pb, 4, SEEK_SET);
-        put_le32(pb, (uint32_t)(file_size - 8));
-        url_fseek(pb, file_size, SEEK_SET);
+        file_size = avio_tell(pb);
+        avio_seek(pb, 4, SEEK_SET);
+        avio_wl32(pb, (uint32_t)(file_size - 8));
+        avio_seek(pb, file_size, SEEK_SET);
 
-        put_flush_packet(pb);
+        avio_flush(pb);
 
         if(s->streams[0]->codec->codec_tag != 0x01) {
             /* Update num_samps in fact chunk */
@@ -114,16 +115,16 @@ static int wav_write_trailer(AVFormatContext *s)
             number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration,
                                            s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num,
                                            s->streams[0]->time_base.den);
-            url_fseek(pb, wav->data-12, SEEK_SET);
-            put_le32(pb, number_of_samples);
-            url_fseek(pb, file_size, SEEK_SET);
-            put_flush_packet(pb);
+            avio_seek(pb, wav->data-12, SEEK_SET);
+            avio_wl32(pb, number_of_samples);
+            avio_seek(pb, file_size, SEEK_SET);
+            avio_flush(pb);
         }
     }
     return 0;
 }
 
-AVOutputFormat wav_muxer = {
+AVOutputFormat ff_wav_muxer = {
     "wav",
     NULL_IF_CONFIG_SMALL("WAV format"),
     "audio/x-wav",
@@ -141,25 +142,25 @@ AVOutputFormat wav_muxer = {
 
 #if CONFIG_WAV_DEMUXER
 
-static int64_t next_tag(ByteIOContext *pb, unsigned int *tag)
+static int64_t next_tag(AVIOContext *pb, unsigned int *tag)
 {
-    *tag = get_le32(pb);
-    return get_le32(pb);
+    *tag = avio_rl32(pb);
+    return avio_rl32(pb);
 }
 
 /* return the size of the found tag */
-static int64_t find_tag(ByteIOContext *pb, uint32_t tag1)
+static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
 {
     unsigned int tag;
     int64_t size;
 
     for (;;) {
-        if (url_feof(pb))
+        if (pb->eof_reached)
             return -1;
         size = next_tag(pb, &tag);
         if (tag == tag1)
             break;
-        url_fseek(pb, size, SEEK_CUR);
+        avio_skip(pb, size);
     }
     return size;
 }
@@ -192,31 +193,31 @@ static int wav_read_header(AVFormatContext *s,
     int64_t sample_count=0;
     int rf64;
     unsigned int tag;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     WAVContext *wav = s->priv_data;
 
     /* check RIFF header */
-    tag = get_le32(pb);
+    tag = avio_rl32(pb);
 
     rf64 = tag == MKTAG('R', 'F', '6', '4');
     if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
         return -1;
-    get_le32(pb); /* file size */
-    tag = get_le32(pb);
+    avio_rl32(pb); /* file size */
+    tag = avio_rl32(pb);
     if (tag != MKTAG('W', 'A', 'V', 'E'))
         return -1;
 
     if (rf64) {
-        if (get_le32(pb) != MKTAG('d', 's', '6', '4'))
+        if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))
             return -1;
-        size = get_le32(pb);
+        size = avio_rl32(pb);
         if (size < 16)
             return -1;
-        get_le64(pb); /* RIFF size */
-        data_size = get_le64(pb);
-        sample_count = get_le64(pb);
-        url_fskip(pb, size - 16); /* skip rest of ds64 chunk */
+        avio_rl64(pb); /* RIFF size */
+        data_size = avio_rl64(pb);
+        sample_count = avio_rl64(pb);
+        avio_skip(pb, size - 16); /* skip rest of ds64 chunk */
     }
 
     /* parse fmt header */
@@ -233,16 +234,16 @@ static int wav_read_header(AVFormatContext *s,
     av_set_pts_info(st, 64, 1, st->codec->sample_rate);
 
     for (;;) {
-        if (url_feof(pb))
+        if (pb->eof_reached)
             return -1;
         size = next_tag(pb, &tag);
         if (tag == MKTAG('d', 'a', 't', 'a')){
             break;
         }else if (tag == MKTAG('f','a','c','t') && !sample_count){
-            sample_count = get_le32(pb);
+            sample_count = avio_rl32(pb);
             size -= 4;
         }
-        url_fseek(pb, size, SEEK_CUR);
+        avio_skip(pb, size);
     }
     if (rf64)
         size = data_size;
@@ -251,7 +252,7 @@ static int wav_read_header(AVFormatContext *s,
     if (!size) {
         wav->data_end = INT64_MAX;
     } else
-        wav->data_end= url_ftell(pb) + size;
+        wav->data_end= avio_tell(pb) + size;
 
     if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
         sample_count = (size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
@@ -263,19 +264,19 @@ static int wav_read_header(AVFormatContext *s,
 /** Find chunk with w64 GUID by skipping over other chunks
  * @return the size of the found chunk
  */
-static int64_t find_guid(ByteIOContext *pb, const uint8_t guid1[16])
+static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
 {
     uint8_t guid[16];
     int64_t size;
 
-    while (!url_feof(pb)) {
-        get_buffer(pb, guid, 16);
-        size = get_le64(pb);
+    while (!pb->eof_reached) {
+        avio_read(pb, guid, 16);
+        size = avio_rl64(pb);
         if (size <= 24)
             return -1;
         if (!memcmp(guid, guid1, 16))
             return size;
-        url_fskip(pb, FFALIGN(size, INT64_C(8)) - 24);
+        avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24);
     }
     return -1;
 }
@@ -295,7 +296,7 @@ static int wav_read_packet(AVFormatContext *s,
 
     st = s->streams[0];
 
-    left = wav->data_end - url_ftell(s->pb);
+    left = wav->data_end - avio_tell(s->pb);
     if (left <= 0){
         if (CONFIG_W64_DEMUXER && wav->w64)
             left = find_guid(s->pb, guid_data) - 24;
@@ -303,7 +304,7 @@ static int wav_read_packet(AVFormatContext *s,
             left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
         if (left < 0)
             return AVERROR_EOF;
-        wav->data_end= url_ftell(s->pb) + left;
+        wav->data_end= avio_tell(s->pb) + left;
     }
 
     size = MAX_SIZE;
@@ -340,7 +341,7 @@ static int wav_read_seek(AVFormatContext *s,
     return pcm_read_seek(s, stream_index, timestamp, flags);
 }
 
-AVInputFormat wav_demuxer = {
+AVInputFormat ff_wav_demuxer = {
     "wav",
     NULL_IF_CONFIG_SMALL("WAV format"),
     sizeof(WAVContext),
@@ -379,19 +380,19 @@ static int w64_probe(AVProbeData *p)
 static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     int64_t size;
-    ByteIOContext *pb  = s->pb;
+    AVIOContext *pb  = s->pb;
     WAVContext    *wav = s->priv_data;
     AVStream *st;
     uint8_t guid[16];
 
-    get_buffer(pb, guid, 16);
+    avio_read(pb, guid, 16);
     if (memcmp(guid, guid_riff, 16))
         return -1;
 
-    if (get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
+    if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
         return -1;
 
-    get_buffer(pb, guid, 16);
+    avio_read(pb, guid, 16);
     if (memcmp(guid, guid_wave, 16)) {
         av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
         return -1;
@@ -409,7 +410,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     /* subtract chunk header size - normal wav file doesn't count it */
     ff_get_wav_header(pb, st->codec, size - 24);
-    url_fskip(pb, FFALIGN(size, INT64_C(8)) - size);
+    avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);
 
     st->need_parsing = AVSTREAM_PARSE_FULL;
 
@@ -420,13 +421,13 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
         av_log(s, AV_LOG_ERROR, "could not find data guid\n");
         return -1;
     }
-    wav->data_end = url_ftell(pb) + size - 24;
+    wav->data_end = avio_tell(pb) + size - 24;
     wav->w64      = 1;
 
     return 0;
 }
 
-AVInputFormat w64_demuxer = {
+AVInputFormat ff_w64_demuxer = {
     "w64",
     NULL_IF_CONFIG_SMALL("Sony Wave64 format"),
     sizeof(WAVContext),
diff --git a/ffmpeg-mt/libavformat/wc3movie.c b/ffmpeg-mt/libavformat/wc3movie.c
index 03d79e5..292ef66 100644
--- a/ffmpeg-mt/libavformat/wc3movie.c
+++ b/ffmpeg-mt/libavformat/wc3movie.c
@@ -2,20 +2,20 @@
  * Wing Commander III Movie (.mve) File Demuxer
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -85,7 +85,7 @@ static int wc3_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {
     Wc3DemuxContext *wc3 = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int fourcc_tag;
     unsigned int size;
     AVStream *st;
@@ -101,12 +101,12 @@ static int wc3_read_header(AVFormatContext *s,
     wc3->vpkt.data = NULL; wc3->vpkt.size = 0;
 
     /* skip the first 3 32-bit numbers */
-    url_fseek(pb, 12, SEEK_CUR);
+    avio_skip(pb, 12);
 
     /* traverse through the chunks and load the header information before
      * the first BRCH tag */
-    fourcc_tag = get_le32(pb);
-    size = (get_be32(pb) + 1) & (~1);
+    fourcc_tag = avio_rl32(pb);
+    size = (avio_rb32(pb) + 1) & (~1);
 
     do {
         switch (fourcc_tag) {
@@ -114,12 +114,12 @@ static int wc3_read_header(AVFormatContext *s,
         case SOND_TAG:
         case INDX_TAG:
             /* SOND unknown, INDX unnecessary; ignore both */
-            url_fseek(pb, size, SEEK_CUR);
+            avio_skip(pb, size);
             break;
 
         case PC__TAG:
             /* number of palettes, unneeded */
-            url_fseek(pb, 12, SEEK_CUR);
+            avio_skip(pb, 12);
             break;
 
         case BNAM_TAG:
@@ -127,7 +127,7 @@ static int wc3_read_header(AVFormatContext *s,
             buffer = av_malloc(size+1);
             if (!buffer)
                 return AVERROR(ENOMEM);
-            if ((ret = get_buffer(pb, buffer, size)) != size)
+            if ((ret = avio_read(pb, buffer, size)) != size)
                 return AVERROR(EIO);
             buffer[size] = 0;
             av_metadata_set2(&s->metadata, "title", buffer,
@@ -136,13 +136,13 @@ static int wc3_read_header(AVFormatContext *s,
 
         case SIZE_TAG:
             /* video resolution override */
-            wc3->width  = get_le32(pb);
-            wc3->height = get_le32(pb);
+            wc3->width  = avio_rl32(pb);
+            wc3->height = avio_rl32(pb);
             break;
 
         case PALT_TAG:
             /* one of several palettes */
-            url_fseek(pb, -8, SEEK_CUR);
+            avio_seek(pb, -8, SEEK_CUR);
             av_append_packet(pb, &wc3->vpkt, 8 + PALETTE_SIZE);
             break;
 
@@ -154,10 +154,10 @@ static int wc3_read_header(AVFormatContext *s,
             break;
         }
 
-        fourcc_tag = get_le32(pb);
+        fourcc_tag = avio_rl32(pb);
         /* chunk sizes are 16-bit aligned */
-        size = (get_be32(pb) + 1) & (~1);
-        if (url_feof(pb))
+        size = (avio_rb32(pb) + 1) & (~1);
+        if (pb->eof_reached)
             return AVERROR(EIO);
 
     } while (fourcc_tag != BRCH_TAG);
@@ -196,7 +196,7 @@ static int wc3_read_packet(AVFormatContext *s,
                            AVPacket *pkt)
 {
     Wc3DemuxContext *wc3 = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int fourcc_tag;
     unsigned int size;
     int packet_read = 0;
@@ -205,10 +205,10 @@ static int wc3_read_packet(AVFormatContext *s,
 
     while (!packet_read) {
 
-        fourcc_tag = get_le32(pb);
+        fourcc_tag = avio_rl32(pb);
         /* chunk sizes are 16-bit aligned */
-        size = (get_be32(pb) + 1) & (~1);
-        if (url_feof(pb))
+        size = (avio_rb32(pb) + 1) & (~1);
+        if (pb->eof_reached)
             return AVERROR(EIO);
 
         switch (fourcc_tag) {
@@ -219,13 +219,13 @@ static int wc3_read_packet(AVFormatContext *s,
 
         case SHOT_TAG:
             /* load up new palette */
-            url_fseek(pb, -8, SEEK_CUR);
+            avio_seek(pb, -8, SEEK_CUR);
             av_append_packet(pb, &wc3->vpkt, 8 + 4);
             break;
 
         case VGA__TAG:
             /* send out video chunk */
-            url_fseek(pb, -8, SEEK_CUR);
+            avio_seek(pb, -8, SEEK_CUR);
             ret= av_append_packet(pb, &wc3->vpkt, 8 + size);
             // ignore error if we have some data
             if (wc3->vpkt.size > 0)
@@ -240,9 +240,9 @@ static int wc3_read_packet(AVFormatContext *s,
         case TEXT_TAG:
             /* subtitle chunk */
 #if 0
-            url_fseek(pb, size, SEEK_CUR);
+            avio_skip(pb, size);
 #else
-            if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size)
+            if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size)
                 ret = AVERROR(EIO);
             else {
                 int i = 0;
@@ -291,7 +291,7 @@ static int wc3_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat wc3_demuxer = {
+AVInputFormat ff_wc3_demuxer = {
     "wc3movie",
     NULL_IF_CONFIG_SMALL("Wing Commander III movie format"),
     sizeof(Wc3DemuxContext),
diff --git a/ffmpeg-mt/libavformat/westwood.c b/ffmpeg-mt/libavformat/westwood.c
index 10d5798..7c2b17d 100644
--- a/ffmpeg-mt/libavformat/westwood.c
+++ b/ffmpeg-mt/libavformat/westwood.c
@@ -2,20 +2,20 @@
  * Westwood Studios Multimedia Formats Demuxer (VQA, AUD)
  * Copyright (c) 2003 The ffmpeg Project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -126,11 +126,11 @@ static int wsaud_read_header(AVFormatContext *s,
                              AVFormatParameters *ap)
 {
     WsAudDemuxContext *wsaud = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     unsigned char header[AUD_HEADER_SIZE];
 
-    if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
+    if (avio_read(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
         return AVERROR(EIO);
     wsaud->audio_samplerate = AV_RL16(&header[0]);
     if (header[11] == 99)
@@ -168,12 +168,12 @@ static int wsaud_read_packet(AVFormatContext *s,
                              AVPacket *pkt)
 {
     WsAudDemuxContext *wsaud = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
     unsigned int chunk_size;
     int ret = 0;
 
-    if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
+    if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
         AUD_CHUNK_PREAMBLE_SIZE)
         return AVERROR(EIO);
 
@@ -213,7 +213,7 @@ static int wsvqa_read_header(AVFormatContext *s,
                              AVFormatParameters *ap)
 {
     WsVqaDemuxContext *wsvqa = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
     unsigned char *header;
     unsigned char scratch[VQA_PREAMBLE_SIZE];
@@ -231,13 +231,13 @@ static int wsvqa_read_header(AVFormatContext *s,
     st->codec->codec_tag = 0;  /* no fourcc */
 
     /* skip to the start of the VQA header */
-    url_fseek(pb, 20, SEEK_SET);
+    avio_seek(pb, 20, SEEK_SET);
 
     /* the VQA header needs to go to the decoder */
     st->codec->extradata_size = VQA_HEADER_SIZE;
     st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
     header = (unsigned char *)st->codec->extradata;
-    if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
+    if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
         VQA_HEADER_SIZE) {
         av_free(st->codec->extradata);
         return AVERROR(EIO);
@@ -277,7 +277,7 @@ static int wsvqa_read_header(AVFormatContext *s,
     /* there are 0 or more chunks before the FINF chunk; iterate until
      * FINF has been skipped and the file will be ready to be demuxed */
     do {
-        if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
+        if (avio_read(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
             av_free(st->codec->extradata);
             return AVERROR(EIO);
         }
@@ -303,7 +303,7 @@ static int wsvqa_read_header(AVFormatContext *s,
             break;
         }
 
-        url_fseek(pb, chunk_size, SEEK_CUR);
+        avio_skip(pb, chunk_size);
     } while (chunk_tag != FINF_TAG);
 
     return 0;
@@ -313,14 +313,14 @@ static int wsvqa_read_packet(AVFormatContext *s,
                              AVPacket *pkt)
 {
     WsVqaDemuxContext *wsvqa = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int ret = -1;
     unsigned char preamble[VQA_PREAMBLE_SIZE];
     unsigned int chunk_type;
     unsigned int chunk_size;
     int skip_byte;
 
-    while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
+    while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
         chunk_type = AV_RB32(&preamble[0]);
         chunk_size = AV_RB32(&preamble[4]);
         skip_byte = chunk_size & 0x01;
@@ -329,7 +329,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
 
             if (av_new_packet(pkt, chunk_size))
                 return AVERROR(EIO);
-            ret = get_buffer(pb, pkt->data, chunk_size);
+            ret = avio_read(pb, pkt->data, chunk_size);
             if (ret != chunk_size) {
                 av_free_packet(pkt);
                 return AVERROR(EIO);
@@ -348,7 +348,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
             }
             /* stay on 16-bit alignment */
             if (skip_byte)
-                url_fseek(pb, 1, SEEK_CUR);
+                avio_skip(pb, 1);
 
             return ret;
         } else {
@@ -359,7 +359,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
             default:
                 av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type);
             }
-            url_fseek(pb, chunk_size + skip_byte, SEEK_CUR);
+            avio_skip(pb, chunk_size + skip_byte);
         }
     }
 
@@ -367,7 +367,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
 }
 
 #if CONFIG_WSAUD_DEMUXER
-AVInputFormat wsaud_demuxer = {
+AVInputFormat ff_wsaud_demuxer = {
     "wsaud",
     NULL_IF_CONFIG_SMALL("Westwood Studios audio format"),
     sizeof(WsAudDemuxContext),
@@ -377,7 +377,7 @@ AVInputFormat wsaud_demuxer = {
 };
 #endif
 #if CONFIG_WSVQA_DEMUXER
-AVInputFormat wsvqa_demuxer = {
+AVInputFormat ff_wsvqa_demuxer = {
     "wsvqa",
     NULL_IF_CONFIG_SMALL("Westwood Studios VQA format"),
     sizeof(WsVqaDemuxContext),
diff --git a/ffmpeg-mt/libavformat/wtv.c b/ffmpeg-mt/libavformat/wtv.c
index ad6463d..8260fe1 100644
--- a/ffmpeg-mt/libavformat/wtv.c
+++ b/ffmpeg-mt/libavformat/wtv.c
@@ -1,21 +1,21 @@
 /*
  * Windows Television (WTV) demuxer
- * Copyright (c) 2010 Peter Ross <pross at xvid.org>
+ * Copyright (c) 2010-2011 Peter Ross <pross at xvid.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,10 +26,13 @@
  */
 
 #include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
 #include "avformat.h"
+#include "internal.h"
 #include "riff.h"
 #include "asf.h"
 #include "mpegts.h"
+#include <strings.h>
 
 /* Macros for formating GUIDs */
 #define PRI_GUID \
@@ -37,22 +40,294 @@
 #define ARG_GUID(g) \
     g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]
 
+#define PRI_PRETTY_GUID \
+    "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x"
+#define ARG_PRETTY_GUID(g) \
+    AV_RL32(g),AV_RL16(g+4),AV_RL16(g+6),g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]
+#define LEN_PRETTY_GUID 34
+
+/*
+ *
+ * File system routines
+ *
+ */
+
+#define WTV_SECTOR_BITS    12
+#define WTV_SECTOR_SIZE    (1 << WTV_SECTOR_BITS)
+#define WTV_BIGSECTOR_BITS 18
+
 typedef struct {
-    int seen_data;
-} WtvStream;
+    AVIOContext *pb_filesystem;  /** file system (AVFormatContext->pb) */
 
-typedef struct WtvContext {
-    uint64_t pts;
-} WtvContext;
+    int sector_bits;     /** sector shift bits; used to convert sector number into pb_filesystem offset */
+    uint32_t *sectors;   /** file allocation table */
+    int nb_sectors;      /** number of sectors */
+
+    int error;
+    int64_t position;
+    int64_t length;
+} WtvFile;
+
+/**
+ * @return bytes read, 0 on end of file, or <0 on error
+ */
+static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
+{
+    WtvFile *wf = opaque;
+    AVIOContext *pb = wf->pb_filesystem;
+    int nread = 0;
+
+    if (wf->error || pb->error)
+        return -1;
+    if (wf->position >= wf->length || pb->eof_reached)
+        return 0;
+
+    buf_size = FFMIN(buf_size, wf->length - wf->position);
+    while(nread < buf_size) {
+        int n;
+        int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1));
+        int read_request        = FFMIN(buf_size - nread, remaining_in_sector);
+
+        n = avio_read(pb, buf, read_request);
+        if (n <= 0)
+            break;
+        nread += n;
+        buf += n;
+        wf->position += n;
+        if (n == remaining_in_sector) {
+            int i = wf->position >> wf->sector_bits;
+            if (i >= wf->nb_sectors ||
+                (wf->sectors[i] != wf->sectors[i - 1] + (1 << (wf->sector_bits - WTV_SECTOR_BITS)) &&
+                avio_seek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) {
+                wf->error = 1;
+                break;
+            }
+        }
+    }
+    return nread;
+}
+
+/**
+ * @return position (or file length)
+ */
+static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence)
+{
+    WtvFile *wf = opaque;
+    AVIOContext *pb = wf->pb_filesystem;
+
+    if (whence == AVSEEK_SIZE)
+        return wf->length;
+    else if (whence == SEEK_CUR)
+        offset = wf->position + offset;
+    else if (whence == SEEK_END)
+        offset = wf->length;
+
+    wf->error = offset < 0 || offset >= wf->length ||
+                avio_seek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS)
+                              + (offset & ((1 << wf->sector_bits) - 1)), SEEK_SET) < 0;
+    wf->position = offset;
+    return offset;
+}
+
+/**
+ * read non-zero integers (le32) from input stream
+ * @param pb
+ * @param[out] data destination
+ * @param     count maximum number of integers to read
+ * @return    total number of integers read
+ */
+static int read_ints(AVIOContext *pb, uint32_t *data, int count)
+{
+    int i, total = 0;
+    for (i = 0; i < count; i++) {
+        if ((data[total] = avio_rl32(pb)))
+           total++;
+    }
+    return total;
+}
+
+/**
+ * Open file
+ * @param first_sector  First sector
+ * @param length        Length of file (bytes)
+ * @param depth         File allocation table depth
+ * @return NULL on error
+ */
+static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s)
+{
+    AVIOContext *pb;
+    WtvFile *wf;
+    uint8_t *buffer;
+
+    if (avio_seek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0)
+        return NULL;
+
+    wf = av_mallocz(sizeof(WtvFile));
+    if (!wf)
+        return NULL;
+
+    if (depth == 0) {
+        wf->sectors = av_malloc(sizeof(uint32_t));
+        if (!wf->sectors) {
+            av_free(wf);
+            return NULL;
+        }
+        wf->sectors[0]  = first_sector;
+        wf->nb_sectors  = 1;
+        wf->sector_bits = WTV_SECTOR_BITS;
+    } else if (depth == 1) {
+        wf->sectors = av_malloc(WTV_SECTOR_SIZE);
+        if (!wf->sectors) {
+            av_free(wf);
+            return NULL;
+        }
+        wf->nb_sectors  = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4);
+        wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS;
+    } else if (depth == 2) {
+        uint32_t sectors1[WTV_SECTOR_SIZE / 4];
+        int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4);
+        int i;
 
-static int is_zero(uint8_t *v, int n)
+        wf->sectors = av_malloc(nb_sectors1 << WTV_SECTOR_BITS);
+        if (!wf->sectors) {
+            av_free(wf);
+            return NULL;
+        }
+        wf->nb_sectors = 0;
+        for (i = 0; i < nb_sectors1; i++) {
+            if (avio_seek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)
+                break;
+            wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4);
+        }
+        wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS;
+    } else {
+        av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth);
+        av_free(wf);
+        return NULL;
+    }
+
+    if (!wf->nb_sectors) {
+        av_free(wf->sectors);
+        av_free(wf);
+        return NULL;
+    }
+
+    /* check length */
+    length &= 0xFFFFFFFFFFFF;
+    if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) {
+        av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits);
+        length = (int64_t)wf->nb_sectors <<  wf->sector_bits;
+    }
+    wf->length = length;
+
+    /* seek to intial sector */
+    wf->position = 0;
+    if (avio_seek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) {
+        av_free(wf->sectors);
+        av_free(wf);
+        return NULL;
+    }
+
+    wf->pb_filesystem = s->pb;
+    buffer = av_malloc(1 << wf->sector_bits);
+    if (!buffer) {
+        av_free(wf->sectors);
+        av_free(wf);
+        return NULL;
+    }
+
+    pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf,
+                           wtvfile_read_packet, NULL, wtvfile_seek);
+    if (!pb) {
+        av_free(buffer);
+        av_free(wf->sectors);
+        av_free(wf);
+    }
+    return pb;
+}
+
+static const ff_asf_guid dir_entry_guid =
+    {0x92,0xB7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xDF,0x06,0x3B,0x82,0xCC,0x21,0x3D};
+
+/**
+ * Open file using filename
+ * @param[in]  buf       directory buffer
+ * @param      buf_size  directory buffer size
+ * @param[in]  filename
+ * @param      filename_size size of filename
+ * @return NULL on error
+ */
+static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size)
+{
+    const uint8_t *buf_end = buf + buf_size;
+
+    while(buf + 48 <= buf_end) {
+        int dir_length, name_size, first_sector, depth;
+        uint64_t file_length;
+        const uint8_t *name;
+        if (ff_guidcmp(buf, dir_entry_guid)) {
+            av_log(s, AV_LOG_ERROR, "unknown guid "PRI_GUID", expected dir_entry_guid; "
+                   "remaining directory entries ignored\n", ARG_GUID(buf));
+            break;
+        }
+        dir_length  = AV_RL16(buf + 16);
+        file_length = AV_RL64(buf + 24);
+        name_size   = 2 * AV_RL32(buf + 32);
+        if (buf + 48 + name_size > buf_end) {
+            av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n");
+            break;
+        }
+        first_sector = AV_RL32(buf + 40 + name_size);
+        depth        = AV_RL32(buf + 44 + name_size);
+
+        /* compare file name; test optional null terminator */
+        name = buf + 40;
+        if (name_size >= filename_size &&
+            !memcmp(name, filename, filename_size) &&
+            (name_size < filename_size + 2 || !AV_RN16(name + filename_size)))
+            return wtvfile_open_sector(first_sector, file_length, depth, s);
+
+        buf += dir_length;
+    }
+    return 0;
+}
+
+#define wtvfile_open(s, buf, buf_size, filename) \
+    wtvfile_open2(s, buf, buf_size, filename, sizeof(filename))
+
+/**
+ * Close file opened with wtvfile_open_sector(), or wtv_open()
+ */
+static void wtvfile_close(AVIOContext *pb)
 {
-   int i;
-   for (i = 0; i < n; i++)
-      if (v[i]) return 0;
-   return 1;
+    WtvFile *wf = pb->opaque;
+    av_free(wf->sectors);
+    av_free(pb);
 }
 
+/*
+ *
+ * Main demuxer
+ *
+ */
+
+typedef struct {
+    int seen_data;
+} WtvStream;
+
+typedef struct {
+    AVIOContext *pb;       /** timeline file */
+    int64_t epoch;
+    int64_t pts;             /** pts for next data chunk */
+    int64_t last_valid_pts;  /** latest valid pts, used for interative seeking */
+
+    /* maintain private seek index, as the AVIndexEntry->pos is relative to the
+       start of the 'timeline' file, not the file system (AVFormatContext->pb) */
+    AVIndexEntry *index_entries;
+    int nb_index_entries;
+    unsigned int index_entries_allocated_size;
+} WtvContext;
+
 typedef struct {
     enum CodecID id;
     ff_asf_guid guid;
@@ -71,7 +346,7 @@ static enum CodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid g
 /* WTV GUIDs */
 static const ff_asf_guid wtv_guid =
     {0xB7,0xD8,0x00,0x20,0x37,0x49,0xDA,0x11,0xA6,0x4E,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
-static const ff_asf_guid meta_guid =
+static const ff_asf_guid metadata_guid =
     {0x5A,0xFE,0xD7,0x6D,0xC8,0x1D,0x8F,0x4A,0x99,0x22,0xFA,0xB1,0x1C,0x38,0x14,0x53};
 static const ff_asf_guid timestamp_guid =
     {0x5B,0x05,0xE6,0x1B,0x97,0xA9,0x49,0x43,0x88,0x17,0x1A,0x65,0x5A,0x29,0x8A,0x97};
@@ -97,6 +372,8 @@ static const ff_asf_guid EVENTID_StreamIDSpanningEvent =
     {0x68,0xAB,0xF1,0xCA,0x53,0xE1,0x41,0x4D,0xA6,0xB3,0xA7,0xC9,0x98,0xDB,0x75,0xEE};
 static const ff_asf_guid EVENTID_TeletextSpanningEvent =
     {0x50,0xD9,0x99,0x95,0x33,0x5F,0x17,0x46,0xAF,0x7C,0x1E,0x54,0xB5,0x10,0xDA,0xA3};
+static const ff_asf_guid EVENTID_AudioTypeSpanningEvent =
+    {0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3};
 
 /* Windows media GUIDs */
 
@@ -159,14 +436,153 @@ static int read_probe(AVProbeData *p)
 }
 
 /**
+ * Convert win32 FILETIME to ISO-8601 string
+ */
+static void filetime_to_iso8601(char *buf, int buf_size, int64_t value)
+{
+    time_t t = (value / 10000000LL) - 11644473600LL;
+    strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+}
+
+/**
+ * Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string
+ */
+static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
+{
+    time_t t = (value / 10000000LL) - 719162LL*86400LL;
+    strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+}
+
+/**
+ * Convert OLE DATE to ISO-8601 string
+ */
+static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)
+{
+    time_t t = 631112400LL + 86400*av_int2dbl(value);
+    strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+}
+
+static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
+{
+    char mime[1024];
+    char description[1024];
+    unsigned int filesize;
+    AVStream *st;
+    int64_t pos = avio_tell(pb);
+
+    avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));
+    if (strcmp(mime, "image/jpeg"))
+        goto done;
+
+    avio_r8(pb);
+    avio_get_str16le(pb, INT_MAX, description, sizeof(description));
+    filesize = avio_rl32(pb);
+    if (!filesize)
+        goto done;
+
+    st = av_new_stream(s, 0);
+    if (!st)
+        goto done;
+    av_metadata_set2(&st->metadata, "title", description, 0);
+    st->codec->codec_id   = CODEC_ID_MJPEG;
+    st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
+    st->codec->extradata  = av_mallocz(filesize);
+    if (!st->codec->extradata)
+        goto done;
+    st->codec->extradata_size = filesize;
+    avio_read(pb, st->codec->extradata, filesize);
+done:
+    avio_seek(pb, pos + length, SEEK_SET);
+}
+
+static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length)
+{
+    int buf_size = FFMAX(2*length, LEN_PRETTY_GUID) + 1;
+    char *buf = av_malloc(buf_size);
+    if (!buf)
+        return;
+
+    if (type == 0 && length == 4) {
+        snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb));
+    } else if (type == 1) {
+        avio_get_str16le(pb, length, buf, buf_size);
+        if (!strlen(buf)) {
+           av_free(buf);
+           return;
+        }
+    } else if (type == 3 && length == 4) {
+        strcpy(buf, avio_rl32(pb) ? "true" : "false");
+    } else if (type == 4 && length == 8) {
+        int64_t num = avio_rl64(pb);
+        if (!strcmp(key, "WM/EncodingTime") ||
+            !strcmp(key, "WM/MediaOriginalBroadcastDateTime"))
+            filetime_to_iso8601(buf, buf_size, num);
+        else if (!strcmp(key, "WM/WMRVEncodeTime") ||
+                 !strcmp(key, "WM/WMRVEndTime"))
+            crazytime_to_iso8601(buf, buf_size, num);
+        else if (!strcmp(key, "WM/WMRVExpirationDate"))
+            oledate_to_iso8601(buf, buf_size, num);
+        else if (!strcmp(key, "WM/WMRVBitrate"))
+            snprintf(buf, buf_size, "%f", av_int2dbl(num));
+        else
+            snprintf(buf, buf_size, "%"PRIi64, num);
+    } else if (type == 5 && length == 2) {
+        snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb));
+    } else if (type == 6 && length == 16) {
+        ff_asf_guid guid;
+        avio_read(pb, guid, 16);
+        snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid));
+    } else if (type == 2 && !strcmp(key, "WM/Picture")) {
+        get_attachment(s, pb, length);
+        av_freep(&buf);
+        return;
+    } else {
+        av_freep(&buf);
+        av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length);
+        avio_skip(pb, length);
+        return;
+    }
+
+    av_metadata_set2(&s->metadata, key, buf, 0);
+    av_freep(&buf);
+}
+
+/**
+ * Parse metadata entries
+ */
+static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb)
+{
+    ff_asf_guid guid;
+    int length, type;
+    while(!pb->eof_reached) {
+        char key[1024];
+        ff_get_guid(pb, &guid);
+        type   = avio_rl32(pb);
+        length = avio_rl32(pb);
+        if (!length)
+            break;
+        if (ff_guidcmp(&guid, metadata_guid)) {
+            av_log(s, AV_LOG_WARNING, "unknown guid "PRI_GUID", expected metadata_guid; "
+                   "remaining metadata entries ignored\n", ARG_GUID(guid));
+            break;
+        }
+        avio_get_str16le(pb, INT_MAX, key, sizeof(key));
+        get_tag(s, pb, key, type, length);
+    }
+
+    ff_metadata_conv(&s->metadata, NULL, ff_asf_metadata_conv);
+}
+
+/**
  * parse VIDEOINFOHEADER2 structure
  * @return bytes consumed
  */
 static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st)
 {
-    ByteIOContext *pb = s->pb;
+    WtvContext *wtv = s->priv_data;
+    AVIOContext *pb = wtv->pb;
 
-    url_fskip(pb, 72);  // picture aspect ratio is unreliable
+    avio_skip(pb, 72);  // picture aspect ratio is unreliable
     ff_get_bmp_header(pb, st);
 
     return 72 + 40;
@@ -233,7 +649,8 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
                                    ff_asf_guid mediatype, ff_asf_guid subtype,
                                    ff_asf_guid formattype, int size)
 {
-    ByteIOContext *pb = s->pb;
+    WtvContext *wtv = s->priv_data;
+    AVIOContext *pb = wtv->pb;
     if (!ff_guidcmp(subtype, mediasubtype_cpfilters_processed) &&
         !ff_guidcmp(formattype, format_cpfilters_processed)) {
         ff_asf_guid actual_subtype;
@@ -241,17 +658,17 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
 
         if (size < 32) {
             av_log(s, AV_LOG_WARNING, "format buffer size underflow\n");
-            url_fskip(pb, size);
+            avio_skip(pb, size);
             return NULL;
         }
 
-        url_fskip(pb, size - 32);
+        avio_skip(pb, size - 32);
         ff_get_guid(pb, &actual_subtype);
         ff_get_guid(pb, &actual_formattype);
-        url_fseek(pb, -size, SEEK_CUR);
+        avio_seek(pb, -size, SEEK_CUR);
 
         st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32);
-        url_fskip(pb, 32);
+        avio_skip(pb, 32);
         return st;
     } else if (!ff_guidcmp(mediatype, mediatype_audio)) {
         st = new_stream(s, st, sid, AVMEDIA_TYPE_AUDIO);
@@ -262,7 +679,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
         } else {
             if (ff_guidcmp(formattype, format_none))
                 av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
-            url_fskip(pb, size);
+            avio_skip(pb, size);
         }
 
         if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) {
@@ -284,14 +701,14 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
             return NULL;
         if (!ff_guidcmp(formattype, format_videoinfo2)) {
             int consumed = parse_videoinfoheader2(s, st);
-            url_fskip(pb, FFMAX(size - consumed, 0));
+            avio_skip(pb, FFMAX(size - consumed, 0));
         } else if (!ff_guidcmp(formattype, format_mpeg2_video)) {
             int consumed = parse_videoinfoheader2(s, st);
-            url_fskip(pb, FFMAX(size - consumed, 0));
+            avio_skip(pb, FFMAX(size - consumed, 0));
         } else {
             if (ff_guidcmp(formattype, format_none))
                 av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
-            url_fskip(pb, size);
+            avio_skip(pb, size);
         }
 
         if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) {
@@ -309,7 +726,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
             return NULL;
         if (ff_guidcmp(formattype, format_none))
             av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
-        url_fskip(pb, size);
+        avio_skip(pb, size);
         st->codec->codec_id = CODEC_ID_DVB_SUBTITLE;
         return st;
     } else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) &&
@@ -319,87 +736,76 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
             return NULL;
         if (ff_guidcmp(formattype, format_none))
             av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
-        url_fskip(pb, size);
+        avio_skip(pb, size);
         st->codec->codec_id   = CODEC_ID_DVB_TELETEXT;
         return st;
     } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) &&
                !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) {
         if (ff_guidcmp(formattype, format_none))
             av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
-        url_fskip(pb, size);
+        avio_skip(pb, size);
         return NULL;
     }
 
     av_log(s, AV_LOG_WARNING, "unknown media type, mediatype:"PRI_GUID
                               ", subtype:"PRI_GUID", formattype:"PRI_GUID"\n",
                               ARG_GUID(mediatype), ARG_GUID(subtype), ARG_GUID(formattype));
-    url_fskip(pb, size);
+    avio_skip(pb, size);
     return NULL;
 }
 
 enum {
     SEEK_TO_DATA = 0,
-    SEEK_TO_BYTE,
     SEEK_TO_PTS,
 };
 
 /**
  * Parse WTV chunks
- * @param mode SEEK_TO_DATA, SEEK_TO_BYTE, SEEK_TO_PTS
- * @param seekts either byte position or timestamp
+ * @param mode SEEK_TO_DATA or SEEK_TO_PTS
+ * @param seekts timestamp
  * @param[out] len Length of data chunk
  * @return stream index of data chunk, or <0 on error
  */
 static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_ptr)
 {
     WtvContext *wtv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    while (!url_feof(pb)) {
+    AVIOContext *pb = wtv->pb;
+    while (!pb->eof_reached) {
         ff_asf_guid g;
         int len, sid, consumed;
 
-        if (mode == SEEK_TO_BYTE && url_ftell(pb) >= seekts)
-            return 0;
-
         ff_get_guid(pb, &g);
-        if (is_zero(g, sizeof(ff_asf_guid)))
-            return AVERROR_EOF;
-
-        len = get_le32(pb);
+        len = avio_rl32(pb);
         if (len < 32)
             break;
-        sid = get_le32(pb) & 0x7FFF;
-        url_fskip(pb, 8);
+        sid = avio_rl32(pb) & 0x7FFF;
+        avio_skip(pb, 8);
         consumed = 32;
 
         if (!ff_guidcmp(g, stream_guid)) {
             if (ff_find_stream_index(s, sid) < 0) {
                 ff_asf_guid mediatype, subtype, formattype;
                 int size;
-                consumed += 20;
-                url_fskip(pb, 16);
-                if (get_le32(pb)) {
-                    url_fskip(pb, 8);
-                    ff_get_guid(pb, &mediatype);
-                    ff_get_guid(pb, &subtype);
-                    url_fskip(pb, 12);
-                    ff_get_guid(pb, &formattype);
-                    size = get_le32(pb);
-                    parse_media_type(s, 0, sid, mediatype, subtype, formattype, size);
-                    consumed += 72 + size;
-                }
+                avio_skip(pb, 28);
+                ff_get_guid(pb, &mediatype);
+                ff_get_guid(pb, &subtype);
+                avio_skip(pb, 12);
+                ff_get_guid(pb, &formattype);
+                size = avio_rl32(pb);
+                parse_media_type(s, 0, sid, mediatype, subtype, formattype, size);
+                consumed += 92 + size;
             }
         } else if (!ff_guidcmp(g, stream2_guid)) {
             int stream_index = ff_find_stream_index(s, sid);
             if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) {
                 ff_asf_guid mediatype, subtype, formattype;
                 int size;
-                url_fskip(pb, 12);
+                avio_skip(pb, 12);
                 ff_get_guid(pb, &mediatype);
                 ff_get_guid(pb, &subtype);
-                url_fskip(pb, 12);
+                avio_skip(pb, 12);
                 ff_get_guid(pb, &formattype);
-                size = get_le32(pb);
+                size = avio_rl32(pb);
                 parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size);
                 consumed += 76 + size;
             }
@@ -416,24 +822,37 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
                 const uint8_t *pbuf = buf;
                 int buf_size;
 
-                url_fskip(pb, 8);
+                avio_skip(pb, 8);
                 consumed += 8;
                 if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) ||
                     !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) {
-                    url_fskip(pb, 6);
+                    avio_skip(pb, 6);
                     consumed += 6;
                 }
 
                 buf_size = FFMIN(len - consumed, sizeof(buf));
-                get_buffer(pb, buf, buf_size);
+                avio_read(pb, buf, buf_size);
                 consumed += buf_size;
                 ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0);
             }
+        } else if (!ff_guidcmp(g, EVENTID_AudioTypeSpanningEvent)) {
+            int stream_index = ff_find_stream_index(s, sid);
+            if (stream_index >= 0) {
+                AVStream *st = s->streams[stream_index];
+                int audio_type;
+                avio_skip(pb, 8);
+                audio_type = avio_r8(pb);
+                if (audio_type == 2)
+                    st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
+                else if (audio_type == 3)
+                    st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+                consumed += 9;
+            }
         } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) {
             int stream_index = ff_find_stream_index(s, sid);
             if (stream_index >= 0) {
-                url_fskip(pb, 12);
-                if (get_le32(pb))
+                avio_skip(pb, 12);
+                if (avio_rl32(pb))
                     av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index);
                 consumed += 16;
             }
@@ -442,38 +861,43 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
             if (stream_index >= 0) {
                 AVStream *st = s->streams[stream_index];
                 uint8_t language[4];
-                url_fskip(pb, 12);
-                get_buffer(pb, language, 3);
+                avio_skip(pb, 12);
+                avio_read(pb, language, 3);
                 if (language[0]) {
                     language[3] = 0;
                     av_metadata_set2(&st->metadata, "language", language, 0);
+                    if (!strcmp(language, "nar") || !strcmp(language, "NAR"))
+                        st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
                 }
                 consumed += 15;
             }
         } else if (!ff_guidcmp(g, timestamp_guid)) {
             int stream_index = ff_find_stream_index(s, sid);
             if (stream_index >= 0) {
-                url_fskip(pb, 8);
-                wtv->pts = get_le64(pb);
+                avio_skip(pb, 8);
+                wtv->pts = avio_rl64(pb);
                 consumed += 16;
                 if (wtv->pts == -1)
                     wtv->pts = AV_NOPTS_VALUE;
+                else {
+                    wtv->last_valid_pts = wtv->pts;
+                    if (wtv->epoch == AV_NOPTS_VALUE || wtv->pts < wtv->epoch)
+                        wtv->epoch = wtv->pts;
                 if (mode == SEEK_TO_PTS && wtv->pts >= seekts) {
 #define WTV_PAD8(x) (((x) + 7) & ~7)
-                    url_fskip(pb, WTV_PAD8(len) - consumed);
+                    avio_skip(pb, WTV_PAD8(len) - consumed);
                     return 0;
                 }
+                }
             }
         } else if (!ff_guidcmp(g, data_guid)) {
             int stream_index = ff_find_stream_index(s, sid);
-            if (mode == SEEK_TO_DATA && stream_index >= 0) {
+            if (mode == SEEK_TO_DATA && stream_index >= 0 && len > 32) {
                 WtvStream *wst = s->streams[stream_index]->priv_data;
                 wst->seen_data = 1;
                 if (len_ptr) {
                     *len_ptr = len;
                 }
-                if (wtv->pts != AV_NOPTS_VALUE)
-                    av_add_index_entry(s->streams[stream_index], url_ftell(pb) - consumed, wtv->pts, 0, 0, AVINDEX_KEYFRAME);
                 return stream_index;
             }
         } else if (
@@ -481,7 +905,6 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
             !ff_guidcmp(g, /* DSATTRIB_PicSampleSeq */ (const ff_asf_guid){0x02,0xAE,0x5B,0x2F,0x8F,0x7B,0x60,0x4F,0x82,0xD6,0xE4,0xEA,0x2F,0x1F,0x4C,0x99}) ||
             !ff_guidcmp(g, /* DSATTRIB_TRANSPORT_PROPERTIES */ (const ff_asf_guid){0x12,0xF6,0x22,0xB6,0xAD,0x47,0x71,0x46,0xAD,0x6C,0x05,0xA9,0x8E,0x65,0xDE,0x3A}) ||
             !ff_guidcmp(g, /* dvr_ms_vid_frame_rep_data */ (const ff_asf_guid){0xCC,0x32,0x64,0xDD,0x29,0xE2,0xDB,0x40,0x80,0xF6,0xD2,0x63,0x28,0xD2,0x76,0x1F}) ||
-            !ff_guidcmp(g, /* EVENTID_AudioTypeSpanningEvent */ (const ff_asf_guid){0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3}) ||
             !ff_guidcmp(g, /* EVENTID_ChannelChangeSpanningEvent */ (const ff_asf_guid){0xE5,0xC5,0x67,0x90,0x5C,0x4C,0x05,0x42,0x86,0xC8,0x7A,0xFE,0x20,0xFE,0x1E,0xFA}) ||
             !ff_guidcmp(g, /* EVENTID_ChannelInfoSpanningEvent */ (const ff_asf_guid){0x80,0x6D,0xF3,0x41,0x32,0x41,0xC2,0x4C,0xB1,0x21,0x01,0xA4,0x32,0x19,0xD8,0x1B}) ||
             !ff_guidcmp(g, /* EVENTID_ChannelTypeSpanningEvent */ (const ff_asf_guid){0x51,0x1D,0xAB,0x72,0xD2,0x87,0x9B,0x48,0xBA,0x11,0x0E,0x08,0xDC,0x21,0x02,0x43}) ||
@@ -500,31 +923,119 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
         } else
             av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g));
 
-        url_fskip(pb, WTV_PAD8(len) - consumed);
+        avio_skip(pb, WTV_PAD8(len) - consumed);
     }
     return AVERROR_EOF;
 }
 
-#define WTV_CHUNK_START 0x40000
+/* declare utf16le strings */
+#define _ , 0,
+static const uint8_t timeline_le16[] =
+    {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e', 0};
+static const uint8_t table_0_entries_legacy_attrib_le16[] =
+    {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0};
+static const uint8_t table_0_entries_time_le16[] =
+    {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'t'_'i'_'m'_'e', 0};
+static const uint8_t timeline_table_0_entries_Events_le16[] =
+    {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e'_'.'_'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'E'_'v'_'e'_'n'_'t'_'s', 0};
+#undef _
 
 static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    WtvContext *wtv = s->priv_data;
+    int root_sector, root_size;
+    uint8_t root[WTV_SECTOR_SIZE];
+    AVIOContext *pb;
+    int64_t timeline_pos;
     int ret;
 
-    url_fseek(pb, WTV_CHUNK_START, SEEK_SET);
+    wtv->epoch          =
+    wtv->pts            =
+    wtv->last_valid_pts = AV_NOPTS_VALUE;
+
+    /* read root directory sector */
+    avio_skip(s->pb, 0x30);
+    root_size = avio_rl32(s->pb);
+    if (root_size > sizeof(root)) {
+        av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n");
+        return AVERROR_INVALIDDATA;
+    }
+    avio_skip(s->pb, 4);
+    root_sector = avio_rl32(s->pb);
+
+    avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET);
+    root_size = avio_read(s->pb, root, root_size);
+    if (root_size < 0)
+        return AVERROR_INVALIDDATA;
+
+    /* parse chunks up until first data chunk */
+    wtv->pb = wtvfile_open(s, root, root_size, timeline_le16);
+    if (!wtv->pb) {
+        av_log(s, AV_LOG_ERROR, "timeline data missing\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     ret = parse_chunks(s, SEEK_TO_DATA, 0, 0);
     if (ret < 0)
         return ret;
+    avio_seek(wtv->pb, -32, SEEK_CUR);
+
+    timeline_pos = avio_tell(s->pb); // save before opening another file
+
+    /* read metadata */
+    pb = wtvfile_open(s, root, root_size, table_0_entries_legacy_attrib_le16);
+    if (pb) {
+        parse_legacy_attrib(s, pb);
+        wtvfile_close(pb);
+    }
+
+    /* read seek index */
+    if (s->nb_streams) {
+        AVStream *st = s->streams[0];
+        pb = wtvfile_open(s, root, root_size, table_0_entries_time_le16);
+        if (pb) {
+            while(1) {
+                uint64_t timestamp = avio_rl64(pb);
+                uint64_t frame_nb  = avio_rl64(pb);
+                if (pb->eof_reached)
+                    break;
+                ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size,
+                                   0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME);
+            }
+            wtvfile_close(pb);
 
-    url_fseek(pb, -32, SEEK_CUR);
+            if (wtv->nb_index_entries) {
+                pb = wtvfile_open(s, root, root_size, timeline_table_0_entries_Events_le16);
+                if (pb) {
+                    int i;
+                    while (1) {
+                        uint64_t frame_nb = avio_rl64(pb);
+                        uint64_t position = avio_rl64(pb);
+                        if (pb->eof_reached)
+                            break;
+                        for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
+                            AVIndexEntry *e = wtv->index_entries + i;
+                            if (frame_nb > e->size)
+                                break;
+                            if (position > e->pos)
+                                e->pos = position;
+                        }
+                    }
+                    wtvfile_close(pb);
+                    st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp;
+                }
+            }
+        }
+    }
+
+    avio_seek(s->pb, timeline_pos, SEEK_SET);
     return 0;
 }
 
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     WtvContext *wtv = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = wtv->pb;
     int stream_index, len, ret;
 
     stream_index = parse_chunks(s, SEEK_TO_DATA, 0, &len);
@@ -536,72 +1047,61 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         return ret;
     pkt->stream_index = stream_index;
     pkt->pts          = wtv->pts;
-    url_fskip(pb, WTV_PAD8(len) - len);
+    avio_skip(pb, WTV_PAD8(len) - len);
     return 0;
 }
 
-static int read_seek2(AVFormatContext *s, int stream_index,
-                      int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
+static int read_seek(AVFormatContext *s, int stream_index,
+                     int64_t ts, int flags)
 {
     WtvContext *wtv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
+    AVIOContext *pb = wtv->pb;
+    AVStream *st = s->streams[0];
+    int64_t ts_relative;
     int i;
 
-    if (stream_index < 0) {
-        stream_index = av_find_default_stream_index(s);
-        if (stream_index < 0)
-            return -1;
-    }
-    st = s->streams[stream_index];
-
-    if ((flags & AVSEEK_FLAG_FRAME)) {
-        return AVERROR_NOTSUPP;
-    } else if ((flags & AVSEEK_FLAG_BYTE)) {
-        if (ts < url_ftell(pb)) {
-            for (i = st->nb_index_entries - 1; i >= 0; i--) {
-                if (st->index_entries[i].pos <= ts) {
-                    wtv->pts    = st->index_entries[i].timestamp;
-                    url_fseek(pb, st->index_entries[i].pos, SEEK_SET);
-                    break;
-                }
-            }
-            if (i < 0) {
-                wtv->pts = 0;
-                url_fseek(pb, WTV_CHUNK_START, SEEK_SET);
-            }
-        }
-        if (parse_chunks(s, SEEK_TO_BYTE, ts, 0) < 0)
+    if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE))
+        return AVERROR(ENOSYS);
+
+    /* timestamp adjustment is required because wtv->pts values are absolute,
+     * whereas AVIndexEntry->timestamp values are relative to epoch. */
+    ts_relative = ts;
+    if (wtv->epoch != AV_NOPTS_VALUE)
+        ts_relative -= wtv->epoch;
+
+    i = ff_index_search_timestamp(wtv->index_entries, wtv->nb_index_entries, ts_relative, flags);
+    if (i < 0) {
+        if (wtv->last_valid_pts == AV_NOPTS_VALUE || ts < wtv->last_valid_pts)
+            avio_seek(pb, 0, SEEK_SET);
+        else if (st->duration != AV_NOPTS_VALUE && ts_relative > st->duration && wtv->nb_index_entries)
+            avio_seek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET);
+        if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0)
             return AVERROR(ERANGE);
         return 0;
-    } else {
-        ts *= 10;
-        i = av_index_search_timestamp(st, ts, flags);
-        if (i < 0) {
-            if (st->nb_index_entries > 0) {
-                wtv->pts    = st->index_entries[st->nb_index_entries - 1].timestamp;
-                url_fseek(pb, st->index_entries[st->nb_index_entries - 1].pos, SEEK_SET);
-            } else {
-                wtv->pts = 0;
-                url_fseek(pb, WTV_CHUNK_START, SEEK_SET);
-            }
-            if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0)
-                return AVERROR(ERANGE);
-            return 0;
-        }
-        wtv->pts    = st->index_entries[i].timestamp;
-        url_fseek(pb, st->index_entries[i].pos, SEEK_SET);
-        return 0;
     }
+    wtv->pts = wtv->index_entries[i].timestamp;
+    if (wtv->epoch != AV_NOPTS_VALUE)
+        wtv->pts += wtv->epoch;
+    wtv->last_valid_pts = wtv->pts;
+    avio_seek(pb, wtv->index_entries[i].pos, SEEK_SET);
+    return 0;
+}
+
+static int read_close(AVFormatContext *s)
+{
+    WtvContext *wtv = s->priv_data;
+    wtvfile_close(wtv->pb);
+    return 0;
 }
 
-AVInputFormat wtv_demuxer = {
+AVInputFormat ff_wtv_demuxer = {
     .name           = "wtv",
     .long_name      = NULL_IF_CONFIG_SMALL("Windows Television (WTV)"),
     .priv_data_size = sizeof(WtvContext),
     .read_probe     = read_probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
-    .read_seek2     = read_seek2,
-    .flags          = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
+    .read_seek      = read_seek,
+    .read_close     = read_close,
+    .flags          = AVFMT_SHOW_IDS,
 };
diff --git a/ffmpeg-mt/libavformat/wv.c b/ffmpeg-mt/libavformat/wv.c
index 5692230..7106735 100644
--- a/ffmpeg-mt/libavformat/wv.c
+++ b/ffmpeg-mt/libavformat/wv.c
@@ -1,24 +1,25 @@
 /*
  * WavPack demuxer
- * Copyright (c) 2006 Konstantin Shishkov
+ * Copyright (c) 2006,2011 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/audioconvert.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "apetag.h"
@@ -29,6 +30,10 @@
 
 #define WV_EXTRA_SIZE 12
 
+#define WV_START_BLOCK  0x0800
+#define WV_END_BLOCK    0x1000
+#define WV_SINGLE_BLOCK (WV_START_BLOCK | WV_END_BLOCK)
+
 enum WV_FLAGS{
     WV_MONO   = 0x0004,
     WV_HYBRID = 0x0008,
@@ -51,7 +56,9 @@ static const int wv_rates[16] = {
 typedef struct{
     uint32_t blksize, flags;
     int rate, chan, bpp;
+    uint32_t chmask;
     uint32_t samples, soff;
+    int multichannel;
     int block_parsed;
     uint8_t extra[WV_EXTRA_SIZE];
     int64_t pos;
@@ -69,77 +76,117 @@ static int wv_probe(AVProbeData *p)
         return 0;
 }
 
-static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb)
+static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int append)
 {
     WVContext *wc = ctx->priv_data;
     uint32_t tag, ver;
     int size;
     int rate, bpp, chan;
+    uint32_t chmask;
 
-    wc->pos = url_ftell(pb);
-    tag = get_le32(pb);
-    if (tag != MKTAG('w', 'v', 'p', 'k'))
-        return -1;
-    size = get_le32(pb);
-    if(size < 24 || size > WV_BLOCK_LIMIT){
-        av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
-        return -1;
-    }
-    wc->blksize = size;
-    ver = get_le16(pb);
-    if(ver < 0x402 || ver > 0x410){
-        av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
-        return -1;
+    wc->pos = avio_tell(pb);
+    if(!append){
+        tag = avio_rl32(pb);
+        if (tag != MKTAG('w', 'v', 'p', 'k'))
+            return -1;
+        size = avio_rl32(pb);
+        if(size < 24 || size > WV_BLOCK_LIMIT){
+            av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
+            return -1;
+        }
+        wc->blksize = size;
+        ver = avio_rl16(pb);
+        if(ver < 0x402 || ver > 0x410){
+            av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
+            return -1;
+        }
+        avio_r8(pb); // track no
+        avio_r8(pb); // track sub index
+        wc->samples = avio_rl32(pb); // total samples in file
+        wc->soff = avio_rl32(pb); // offset in samples of current block
+        avio_read(pb, wc->extra, WV_EXTRA_SIZE);
+    }else{
+        size = wc->blksize;
     }
-    get_byte(pb); // track no
-    get_byte(pb); // track sub index
-    wc->samples = get_le32(pb); // total samples in file
-    wc->soff = get_le32(pb); // offset in samples of current block
-    get_buffer(pb, wc->extra, WV_EXTRA_SIZE);
     wc->flags = AV_RL32(wc->extra + 4);
     //parse flags
     bpp = ((wc->flags & 3) + 1) << 3;
     chan = 1 + !(wc->flags & WV_MONO);
+    chmask = wc->flags & WV_MONO ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
     rate = wv_rates[(wc->flags >> 23) & 0xF];
-    if((wc->flags & 0x1800) != 0x1800){
-        av_log(ctx, AV_LOG_ERROR, "Multichannel WavPack is not supported yet.\n");
-        return -1;
+    wc->multichannel = !!((wc->flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK);
+    if(wc->multichannel){
+        chan = wc->chan;
+        chmask = wc->chmask;
     }
-    if(rate == -1 && !wc->block_parsed){
-        int64_t block_end = url_ftell(pb) + wc->blksize - 24;
-        if(url_is_streamed(pb)){
-            av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
+    if((rate == -1 || !chan) && !wc->block_parsed){
+        int64_t block_end = avio_tell(pb) + wc->blksize - 24;
+        if(!pb->seekable){
+            av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n");
             return -1;
         }
-        while(url_ftell(pb) < block_end){
+        while(avio_tell(pb) < block_end){
             int id, size;
-            id = get_byte(pb);
-            size = (id & 0x80) ? get_le24(pb) : get_byte(pb);
+            id = avio_r8(pb);
+            size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb);
             size <<= 1;
             if(id&0x40)
                 size--;
-            if((id&0x3F) == 0x27){
-                rate = get_le24(pb);
+            switch(id&0x3F){
+            case 0xD:
+                if(size <= 1){
+                    av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n");
+                    return -1;
+                }
+                chan = avio_r8(pb);
+                switch(size - 2){
+                case 0:
+                    chmask = avio_r8(pb);
+                    break;
+                case 1:
+                    chmask = avio_rl16(pb);
+                    break;
+                case 2:
+                    chmask = avio_rl24(pb);
+                    break;
+                case 3:
+                    chmask = avio_rl32(pb);
+                    break;
+                case 5:
+                    avio_skip(pb, 1);
+                    chan |= (avio_r8(pb) & 0xF) << 8;
+                    chmask = avio_rl24(pb);
+                    break;
+                default:
+                    av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size);
+                    return -1;
+                }
+                break;
+            case 0x27:
+                rate = avio_rl24(pb);
                 break;
-            }else{
-                url_fskip(pb, size);
+            default:
+                avio_skip(pb, size);
             }
+            if(id&0x40)
+                avio_skip(pb, 1);
         }
         if(rate == -1){
             av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
             return -1;
         }
-        url_fseek(pb, block_end - wc->blksize + 24, SEEK_SET);
+        avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET);
     }
     if(!wc->bpp) wc->bpp = bpp;
     if(!wc->chan) wc->chan = chan;
+    if(!wc->chmask) wc->chmask = chmask;
     if(!wc->rate) wc->rate = rate;
 
     if(wc->flags && bpp != wc->bpp){
         av_log(ctx, AV_LOG_ERROR, "Bits per sample differ, this block: %i, header block: %i\n", bpp, wc->bpp);
         return -1;
     }
-    if(wc->flags && chan != wc->chan){
+    if(wc->flags && !wc->multichannel && chan != wc->chan){
         av_log(ctx, AV_LOG_ERROR, "Channels differ, this block: %i, header block: %i\n", chan, wc->chan);
         return -1;
     }
@@ -154,12 +201,12 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb)
 static int wv_read_header(AVFormatContext *s,
                           AVFormatParameters *ap)
 {
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     WVContext *wc = s->priv_data;
     AVStream *st;
 
     wc->block_parsed = 0;
-    if(wv_read_block_header(s, pb) < 0)
+    if(wv_read_block_header(s, pb, 0) < 0)
         return -1;
 
     /* now we are ready: build format streams */
@@ -169,18 +216,19 @@ static int wv_read_header(AVFormatContext *s,
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id = CODEC_ID_WAVPACK;
     st->codec->channels = wc->chan;
+    st->codec->channel_layout = wc->chmask;
     st->codec->sample_rate = wc->rate;
     st->codec->bits_per_coded_sample = wc->bpp;
     av_set_pts_info(st, 64, 1, wc->rate);
     st->start_time = 0;
     st->duration = wc->samples;
 
-    if(!url_is_streamed(s->pb)) {
-        int64_t cur = url_ftell(s->pb);
+    if(s->pb->seekable) {
+        int64_t cur = avio_tell(s->pb);
         ff_ape_parse_tag(s);
         if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
             ff_id3v1_read(s);
-        url_fseek(s->pb, cur, SEEK_SET);
+        avio_seek(s->pb, cur, SEEK_SET);
     }
 
     return 0;
@@ -191,25 +239,70 @@ static int wv_read_packet(AVFormatContext *s,
 {
     WVContext *wc = s->priv_data;
     int ret;
+    int size, ver, off;
 
-    if (url_feof(s->pb))
+    if (s->pb->eof_reached)
         return AVERROR(EIO);
     if(wc->block_parsed){
-        if(wv_read_block_header(s, s->pb) < 0)
+        if(wv_read_block_header(s, s->pb, 0) < 0)
             return -1;
     }
 
-    if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0)
+    off = wc->multichannel ? 4 : 0;
+    if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0)
         return AVERROR(ENOMEM);
-    memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE);
-    ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);
+    if(wc->multichannel)
+        AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12);
+    memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE);
+    ret = avio_read(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
     if(ret != wc->blksize){
         av_free_packet(pkt);
         return AVERROR(EIO);
     }
+    while(!(wc->flags & WV_END_BLOCK)){
+        if(avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
+            av_free_packet(pkt);
+            return -1;
+        }
+        if((ret = av_append_packet(s->pb, pkt, 4)) < 0){
+            av_free_packet(pkt);
+            return ret;
+        }
+        size = AV_RL32(pkt->data + pkt->size - 4);
+        if(size < 24 || size > WV_BLOCK_LIMIT){
+            av_free_packet(pkt);
+            av_log(s, AV_LOG_ERROR, "Incorrect block size %d\n", size);
+            return -1;
+        }
+        wc->blksize = size;
+        ver = avio_rl16(s->pb);
+        if(ver < 0x402 || ver > 0x410){
+            av_free_packet(pkt);
+            av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
+            return -1;
+        }
+        avio_r8(s->pb); // track no
+        avio_r8(s->pb); // track sub index
+        wc->samples = avio_rl32(s->pb); // total samples in file
+        wc->soff = avio_rl32(s->pb); // offset in samples of current block
+        if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){
+            av_free_packet(pkt);
+            return ret;
+        }
+        memcpy(wc->extra, pkt->data + pkt->size - WV_EXTRA_SIZE, WV_EXTRA_SIZE);
+
+        if(wv_read_block_header(s, s->pb, 1) < 0){
+            av_free_packet(pkt);
+            return -1;
+        }
+        ret = av_append_packet(s->pb, pkt, wc->blksize);
+        if(ret < 0){
+            av_free_packet(pkt);
+            return ret;
+        }
+    }
     pkt->stream_index = 0;
     wc->block_parsed = 1;
-    pkt->size = ret + WV_EXTRA_SIZE;
     pkt->pts = wc->soff;
     av_add_index_entry(s->streams[0], wc->pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
     return 0;
@@ -227,18 +320,18 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
     /* if found, seek there */
     if (index >= 0){
         wc->block_parsed = 1;
-        url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+        avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
         return 0;
     }
     /* if timestamp is out of bounds, return error */
     if(timestamp < 0 || timestamp >= s->duration)
         return -1;
 
-    pos = url_ftell(s->pb);
+    pos = avio_tell(s->pb);
     do{
         ret = av_read_frame(s, pkt);
         if (ret < 0){
-            url_fseek(s->pb, pos, SEEK_SET);
+            avio_seek(s->pb, pos, SEEK_SET);
             return -1;
         }
         pts = pkt->pts;
@@ -247,7 +340,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
     return 0;
 }
 
-AVInputFormat wv_demuxer = {
+AVInputFormat ff_wv_demuxer = {
     "wv",
     NULL_IF_CONFIG_SMALL("WavPack"),
     sizeof(WVContext),
diff --git a/ffmpeg-mt/libavformat/xa.c b/ffmpeg-mt/libavformat/xa.c
index 3a866b9..c3421a3 100644
--- a/ffmpeg-mt/libavformat/xa.c
+++ b/ffmpeg-mt/libavformat/xa.c
@@ -2,20 +2,20 @@
  * Maxis XA (.xa) File Demuxer
  * Copyright (c) 2008 Robert Marston
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -66,7 +66,7 @@ static int xa_read_header(AVFormatContext *s,
                AVFormatParameters *ap)
 {
     MaxisXADemuxContext *xa = s->priv_data;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVStream *st;
 
     /*Set up the XA Audio Decoder*/
@@ -76,15 +76,15 @@ static int xa_read_header(AVFormatContext *s,
 
     st->codec->codec_type   = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id     = CODEC_ID_ADPCM_EA_MAXIS_XA;
-    url_fskip(pb, 4);       /* Skip the XA ID */
-    xa->out_size            =  get_le32(pb);
-    url_fskip(pb, 2);       /* Skip the tag */
-    st->codec->channels     = get_le16(pb);
-    st->codec->sample_rate  = get_le32(pb);
+    avio_skip(pb, 4);       /* Skip the XA ID */
+    xa->out_size            =  avio_rl32(pb);
+    avio_skip(pb, 2);       /* Skip the tag */
+    st->codec->channels     = avio_rl16(pb);
+    st->codec->sample_rate  = avio_rl32(pb);
     /* Value in file is average byte rate*/
-    st->codec->bit_rate     = get_le32(pb) * 8;
-    st->codec->block_align  = get_le16(pb);
-    st->codec->bits_per_coded_sample = get_le16(pb);
+    st->codec->bit_rate     = avio_rl32(pb) * 8;
+    st->codec->block_align  = avio_rl16(pb);
+    st->codec->bits_per_coded_sample = avio_rl16(pb);
 
     av_set_pts_info(st, 64, 1, st->codec->sample_rate);
 
@@ -96,7 +96,7 @@ static int xa_read_packet(AVFormatContext *s,
 {
     MaxisXADemuxContext *xa = s->priv_data;
     AVStream *st = s->streams[0];
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     unsigned int packet_size;
     int ret;
 
@@ -118,7 +118,7 @@ static int xa_read_packet(AVFormatContext *s,
     return ret;
 }
 
-AVInputFormat xa_demuxer = {
+AVInputFormat ff_xa_demuxer = {
     "xa",
     NULL_IF_CONFIG_SMALL("Maxis XA File Format"),
     sizeof(MaxisXADemuxContext),
diff --git a/ffmpeg-mt/libavformat/yop.c b/ffmpeg-mt/libavformat/yop.c
index 54d3845..e367187 100644
--- a/ffmpeg-mt/libavformat/yop.c
+++ b/ffmpeg-mt/libavformat/yop.c
@@ -6,20 +6,20 @@
  * derived from the code by
  * Copyright (C) 2009 Thomas P. Higdon <thomas.p.higdon at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -50,7 +50,7 @@ static int yop_probe(AVProbeData *probe_packet)
 static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     YopDecContext *yop = s->priv_data;
-    ByteIOContext *pb  = s->pb;
+    AVIOContext *pb  = s->pb;
 
     AVCodecContext *audio_dec, *video_dec;
     AVStream *audio_stream, *video_stream;
@@ -81,16 +81,16 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
     video_dec->codec_type   = AVMEDIA_TYPE_VIDEO;
     video_dec->codec_id     = CODEC_ID_YOP;
 
-    url_fskip(pb, 6);
+    avio_skip(pb, 6);
 
-    frame_rate              = get_byte(pb);
-    yop->frame_size         = get_byte(pb) * 2048;
-    video_dec->width        = get_le16(pb);
-    video_dec->height       = get_le16(pb);
+    frame_rate              = avio_r8(pb);
+    yop->frame_size         = avio_r8(pb) * 2048;
+    video_dec->width        = avio_rl16(pb);
+    video_dec->height       = avio_rl16(pb);
 
     video_stream->sample_aspect_ratio = (AVRational){1, 2};
 
-    ret = get_buffer(pb, video_dec->extradata, 8);
+    ret = avio_read(pb, video_dec->extradata, 8);
     if (ret < 8)
         return ret < 0 ? ret : AVERROR_EOF;
 
@@ -104,7 +104,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return AVERROR_INVALIDDATA;
     }
 
-    url_fseek(pb, 2048, SEEK_SET);
+    avio_seek(pb, 2048, SEEK_SET);
 
     av_set_pts_info(video_stream, 32, 1, frame_rate);
 
@@ -114,7 +114,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
 static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     YopDecContext *yop = s->priv_data;
-    ByteIOContext *pb  = s->pb;
+    AVIOContext *pb  = s->pb;
 
     int ret;
     int actual_video_data_size = yop->frame_size -
@@ -136,9 +136,9 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret < 0)
         return ret;
 
-    yop->video_packet.pos = url_ftell(pb);
+    yop->video_packet.pos = avio_tell(pb);
 
-    ret = get_buffer(pb, yop->video_packet.data, yop->palette_size);
+    ret = avio_read(pb, yop->video_packet.data, yop->palette_size);
     if (ret < 0) {
         goto err_out;
     }else if (ret < yop->palette_size) {
@@ -153,9 +153,9 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
     // Set position to the start of the frame
     pkt->pos = yop->video_packet.pos;
 
-    url_fskip(pb, yop->audio_block_length - ret);
+    avio_skip(pb, yop->audio_block_length - ret);
 
-    ret = get_buffer(pb, yop->video_packet.data + yop->palette_size,
+    ret = avio_read(pb, yop->video_packet.data + yop->palette_size,
                      actual_video_data_size);
     if (ret < 0)
         goto err_out;
@@ -190,7 +190,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
         return -1;
 
     pos_min        = s->data_offset;
-    pos_max        = url_fsize(s->pb) - yop->frame_size;
+    pos_max        = avio_size(s->pb) - yop->frame_size;
     frame_count    = (pos_max - pos_min) / yop->frame_size;
 
     timestamp      = FFMAX(0, FFMIN(frame_count, timestamp));
@@ -198,11 +198,11 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
     frame_pos      = timestamp * yop->frame_size + pos_min;
     yop->odd_frame = timestamp & 1;
 
-    url_fseek(s->pb, frame_pos, SEEK_SET);
+    avio_seek(s->pb, frame_pos, SEEK_SET);
     return 0;
 }
 
-AVInputFormat yop_demuxer = {
+AVInputFormat ff_yop_demuxer = {
     "yop",
     NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"),
     sizeof(YopDecContext),
diff --git a/ffmpeg-mt/libavformat/yuv4mpeg.c b/ffmpeg-mt/libavformat/yuv4mpeg.c
index 3a48864..d712321 100644
--- a/ffmpeg-mt/libavformat/yuv4mpeg.c
+++ b/ffmpeg-mt/libavformat/yuv4mpeg.c
@@ -2,20 +2,20 @@
  * YUV4MPEG format
  * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
@@ -90,7 +90,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
 static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     AVStream *st = s->streams[pkt->stream_index];
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     AVPicture *picture;
     int* first_pkt = s->priv_data;
     int width, height, h_chroma_shift, v_chroma_shift;
@@ -108,21 +108,21 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
             av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n");
             return AVERROR(EIO);
         } else {
-            put_buffer(pb, buf2, strlen(buf2));
+            avio_write(pb, buf2, strlen(buf2));
         }
     }
 
     /* construct frame header */
 
     m = snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC);
-    put_buffer(pb, buf1, strlen(buf1));
+    avio_write(pb, buf1, strlen(buf1));
 
     width = st->codec->width;
     height = st->codec->height;
 
     ptr = picture->data[0];
     for(i=0;i<height;i++) {
-        put_buffer(pb, ptr, width);
+        avio_write(pb, ptr, width);
         ptr += picture->linesize[0];
     }
 
@@ -135,15 +135,15 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
     ptr1 = picture->data[1];
     ptr2 = picture->data[2];
     for(i=0;i<height;i++) {     /* Cb */
-        put_buffer(pb, ptr1, width);
+        avio_write(pb, ptr1, width);
         ptr1 += picture->linesize[1];
     }
     for(i=0;i<height;i++) {     /* Cr */
-        put_buffer(pb, ptr2, width);
+        avio_write(pb, ptr2, width);
             ptr2 += picture->linesize[2];
     }
     }
-    put_flush_packet(pb);
+    avio_flush(pb);
     return 0;
 }
 
@@ -169,7 +169,7 @@ static int yuv4_write_header(AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat yuv4mpegpipe_muxer = {
+AVOutputFormat ff_yuv4mpegpipe_muxer = {
     "yuv4mpegpipe",
     NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
     "",
@@ -192,7 +192,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
     char header[MAX_YUV4_HEADER+10];  // Include headroom for the longest option
     char *tokstart,*tokend,*header_end;
     int i;
-    ByteIOContext *pb = s->pb;
+    AVIOContext *pb = s->pb;
     int width=-1, height=-1, raten=0, rated=0, aspectn=0, aspectd=0;
     enum PixelFormat pix_fmt=PIX_FMT_NONE,alt_pix_fmt=PIX_FMT_NONE;
     enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
@@ -200,7 +200,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
     struct frame_attributes *s1 = s->priv_data;
 
     for (i=0; i<MAX_YUV4_HEADER; i++) {
-        header[i] = get_byte(pb);
+        header[i] = avio_r8(pb);
         if (header[i] == '\n') {
             header[i+1] = 0x20;  // Add a space after last option. Makes parsing "444" vs "444alpha" easier.
             header[i+2] = 0;
@@ -352,7 +352,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
     struct frame_attributes *s1 = s->priv_data;
 
     for (i=0; i<MAX_FRAME_HEADER; i++) {
-        header[i] = get_byte(s->pb);
+        header[i] = avio_r8(s->pb);
         if (header[i] == '\n') {
             header[i+1] = 0;
             break;
@@ -390,7 +390,7 @@ static int yuv4_probe(AVProbeData *pd)
 }
 
 #if CONFIG_YUV4MPEGPIPE_DEMUXER
-AVInputFormat yuv4mpegpipe_demuxer = {
+AVInputFormat ff_yuv4mpegpipe_demuxer = {
     "yuv4mpegpipe",
     NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
     sizeof(struct frame_attributes),
diff --git a/ffmpeg-mt/libavutil/Makefile b/ffmpeg-mt/libavutil/Makefile
index fe0302c..300acb1 100644
--- a/ffmpeg-mt/libavutil/Makefile
+++ b/ffmpeg-mt/libavutil/Makefile
@@ -4,6 +4,7 @@ NAME = avutil
 
 HEADERS = adler32.h                                                     \
           attributes.h                                                  \
+          audioconvert.h                                                \
           avassert.h                                                    \
           avstring.h                                                    \
           avutil.h                                                      \
@@ -16,6 +17,7 @@ HEADERS = adler32.h                                                     \
           eval.h                                                        \
           fifo.h                                                        \
           file.h                                                        \
+          imgutils.h                                                    \
           intfloat_readwrite.h                                          \
           intreadwrite.h                                                \
           lfg.h                                                         \
@@ -25,16 +27,19 @@ HEADERS = adler32.h                                                     \
           md5.h                                                         \
           mem.h                                                         \
           opt.h                                                         \
+          parseutils.h                                                  \
           pixdesc.h                                                     \
           pixfmt.h                                                      \
           random_seed.h                                                 \
           rational.h                                                    \
+          samplefmt.h                                                   \
           sha1.h                                                        \
 
 BUILT_HEADERS = avconfig.h
 
 OBJS = adler32.o                                                        \
        aes.o                                                            \
+       audioconvert.o                                                   \
        avstring.o                                                       \
        base64.o                                                         \
        cpu.o                                                            \
@@ -44,6 +49,7 @@ OBJS = adler32.o                                                        \
        eval.o                                                           \
        fifo.o                                                           \
        file.o                                                           \
+       imgutils.o                                                       \
        intfloat_readwrite.o                                             \
        inverse.o                                                        \
        lfg.o                                                            \
@@ -54,10 +60,12 @@ OBJS = adler32.o                                                        \
        md5.o                                                            \
        mem.o                                                            \
        opt.o                                                            \
+       parseutils.o                                                     \
        pixdesc.o                                                        \
        random_seed.o                                                    \
        rational.o                                                       \
        rc4.o                                                            \
+       samplefmt.o                                                      \
        sha.o                                                            \
        tree.o                                                           \
        utils.o                                                          \
diff --git a/ffmpeg-mt/libavutil/adler32.h b/ffmpeg-mt/libavutil/adler32.h
index 0b890bc..913db2d 100644
--- a/ffmpeg-mt/libavutil/adler32.h
+++ b/ffmpeg-mt/libavutil/adler32.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/aes.c b/ffmpeg-mt/libavutil/aes.c
index 59f1cf3..346676b 100644
--- a/ffmpeg-mt/libavutil/aes.c
+++ b/ffmpeg-mt/libavutil/aes.c
@@ -3,20 +3,20 @@
  *
  * some optimization ideas from aes128.c by Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/aes.h b/ffmpeg-mt/libavutil/aes.h
index 368f70c..6e5d320 100644
--- a/ffmpeg-mt/libavutil/aes.h
+++ b/ffmpeg-mt/libavutil/aes.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2007 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/arm/bswap.h b/ffmpeg-mt/libavutil/arm/bswap.h
index c5e74cc..478ae98 100644
--- a/ffmpeg-mt/libavutil/arm/bswap.h
+++ b/ffmpeg-mt/libavutil/arm/bswap.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/arm/cpu.c b/ffmpeg-mt/libavutil/arm/cpu.c
index 742c3e4..835513e 100644
--- a/ffmpeg-mt/libavutil/arm/cpu.c
+++ b/ffmpeg-mt/libavutil/arm/cpu.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/arm/intmath.h b/ffmpeg-mt/libavutil/arm/intmath.h
index 2c0aa3b..2f651d1 100644
--- a/ffmpeg-mt/libavutil/arm/intmath.h
+++ b/ffmpeg-mt/libavutil/arm/intmath.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,7 +31,7 @@
 #if HAVE_ARMV6
 
 #define FASTDIV FASTDIV
-static inline av_const int FASTDIV(int a, int b)
+static av_always_inline av_const int FASTDIV(int a, int b)
 {
     int r, t;
     __asm__ volatile("cmp     %3, #2               \n\t"
@@ -43,7 +43,7 @@ static inline av_const int FASTDIV(int a, int b)
 }
 
 #define av_clip_uint8 av_clip_uint8_arm
-static inline av_const uint8_t av_clip_uint8_arm(int a)
+static av_always_inline av_const uint8_t av_clip_uint8_arm(int a)
 {
     unsigned x;
     __asm__ volatile ("usat %0, #8,  %1" : "=r"(x) : "r"(a));
@@ -51,7 +51,7 @@ static inline av_const uint8_t av_clip_uint8_arm(int a)
 }
 
 #define av_clip_int8 av_clip_int8_arm
-static inline av_const uint8_t av_clip_int8_arm(int a)
+static av_always_inline av_const uint8_t av_clip_int8_arm(int a)
 {
     unsigned x;
     __asm__ volatile ("ssat %0, #8,  %1" : "=r"(x) : "r"(a));
@@ -59,7 +59,7 @@ static inline av_const uint8_t av_clip_int8_arm(int a)
 }
 
 #define av_clip_uint16 av_clip_uint16_arm
-static inline av_const uint16_t av_clip_uint16_arm(int a)
+static av_always_inline av_const uint16_t av_clip_uint16_arm(int a)
 {
     unsigned x;
     __asm__ volatile ("usat %0, #16, %1" : "=r"(x) : "r"(a));
@@ -67,7 +67,7 @@ static inline av_const uint16_t av_clip_uint16_arm(int a)
 }
 
 #define av_clip_int16 av_clip_int16_arm
-static inline av_const int16_t av_clip_int16_arm(int a)
+static av_always_inline av_const int16_t av_clip_int16_arm(int a)
 {
     int x;
     __asm__ volatile ("ssat %0, #16, %1" : "=r"(x) : "r"(a));
@@ -77,7 +77,7 @@ static inline av_const int16_t av_clip_int16_arm(int a)
 #else /* HAVE_ARMV6 */
 
 #define FASTDIV FASTDIV
-static inline av_const int FASTDIV(int a, int b)
+static av_always_inline av_const int FASTDIV(int a, int b)
 {
     int r, t;
     __asm__ volatile("umull %1, %0, %2, %3"
@@ -88,7 +88,7 @@ static inline av_const int FASTDIV(int a, int b)
 #endif /* HAVE_ARMV6 */
 
 #define av_clipl_int32 av_clipl_int32_arm
-static inline av_const int32_t av_clipl_int32_arm(int64_t a)
+static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
 {
     int x, y;
     __asm__ volatile ("adds   %1, %R2, %Q2, lsr #31  \n\t"
diff --git a/ffmpeg-mt/libavutil/arm/intreadwrite.h b/ffmpeg-mt/libavutil/arm/intreadwrite.h
index 339f885..a5ee146 100644
--- a/ffmpeg-mt/libavutil/arm/intreadwrite.h
+++ b/ffmpeg-mt/libavutil/arm/intreadwrite.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/arm/timer.h b/ffmpeg-mt/libavutil/arm/timer.h
index 5e8bc8e..4bca877 100644
--- a/ffmpeg-mt/libavutil/arm/timer.h
+++ b/ffmpeg-mt/libavutil/arm/timer.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/attributes.h b/ffmpeg-mt/libavutil/attributes.h
index d93f460..4abe78f 100644
--- a/ffmpeg-mt/libavutil/attributes.h
+++ b/ffmpeg-mt/libavutil/attributes.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -65,7 +65,7 @@
 #endif
 
 #ifndef av_cold
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
+#if AV_GCC_VERSION_AT_LEAST(4,3)
 #    define av_cold __attribute__((cold))
 #else
 #    define av_cold
@@ -73,7 +73,7 @@
 #endif
 
 #ifndef av_flatten
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1)
+#if AV_GCC_VERSION_AT_LEAST(4,1)
 #    define av_flatten __attribute__((flatten))
 #else
 #    define av_flatten
@@ -96,8 +96,21 @@
 #endif
 #endif
 
+/**
+ * Mark a variable as used and prevent the compiler from optimizing it
+ * away.  This is useful for variables accessed only from inline
+ * assembler without the compiler being aware.
+ */
+#ifndef av_used
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+#    define av_used __attribute__((used))
+#else
+#    define av_used
+#endif
+#endif
+
 #ifndef av_alias
-#if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3)
+#if AV_GCC_VERSION_AT_LEAST(3,3)
 #   define av_alias __attribute__((may_alias))
 #else
 #   define av_alias
diff --git a/ffmpeg-mt/libavutil/audioconvert.c b/ffmpeg-mt/libavutil/audioconvert.c
new file mode 100644
index 0000000..f789c77
--- /dev/null
+++ b/ffmpeg-mt/libavutil/audioconvert.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * audio conversion routines
+ */
+
+#include "libavutil/avutil.h"
+#include "libavutil/avstring.h"
+#include "audioconvert.h"
+
+static const char * const channel_names[] = {
+    "FL", "FR", "FC", "LFE", "BL",  "BR",  "FLC", "FRC",
+    "BC", "SL", "SR", "TC",  "TFL", "TFC", "TFR", "TBL",
+    "TBC", "TBR",
+    [29] = "DL",
+    [30] = "DR",
+};
+
+static const char *get_channel_name(int channel_id)
+{
+    if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
+        return NULL;
+    return channel_names[channel_id];
+}
+
+static const struct {
+    const char *name;
+    int         nb_channels;
+    int64_t     layout;
+} channel_layout_map[] = {
+    { "mono",        1,  AV_CH_LAYOUT_MONO },
+    { "stereo",      2,  AV_CH_LAYOUT_STEREO },
+    { "4.0",         4,  AV_CH_LAYOUT_4POINT0 },
+    { "quad",        4,  AV_CH_LAYOUT_QUAD },
+    { "5.0",         5,  AV_CH_LAYOUT_5POINT0 },
+    { "5.0",         5,  AV_CH_LAYOUT_5POINT0_BACK },
+    { "5.1",         6,  AV_CH_LAYOUT_5POINT1 },
+    { "5.1",         6,  AV_CH_LAYOUT_5POINT1_BACK },
+    { "5.1+downmix", 8,  AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, },
+    { "7.1",         8,  AV_CH_LAYOUT_7POINT1 },
+    { "7.1(wide)",   8,  AV_CH_LAYOUT_7POINT1_WIDE },
+    { "7.1+downmix", 10, AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, },
+    { 0 }
+};
+
+int64_t av_get_channel_layout(const char *name)
+{
+    int i = 0;
+    do {
+        if (!strcmp(channel_layout_map[i].name, name))
+            return channel_layout_map[i].layout;
+        i++;
+    } while (channel_layout_map[i].name);
+
+    return 0;
+}
+
+void av_get_channel_layout_string(char *buf, int buf_size,
+                                  int nb_channels, int64_t channel_layout)
+{
+    int i;
+
+    if (nb_channels <= 0)
+        nb_channels = av_get_channel_layout_nb_channels(channel_layout);
+
+    for (i = 0; channel_layout_map[i].name; i++)
+        if (nb_channels    == channel_layout_map[i].nb_channels &&
+            channel_layout == channel_layout_map[i].layout) {
+            av_strlcpy(buf, channel_layout_map[i].name, buf_size);
+            return;
+        }
+
+    snprintf(buf, buf_size, "%d channels", nb_channels);
+    if (channel_layout) {
+        int i,ch;
+        av_strlcat(buf, " (", buf_size);
+        for(i=0,ch=0; i<64; i++) {
+            if ((channel_layout & (1L<<i))) {
+                const char *name = get_channel_name(i);
+                if (name) {
+                    if (ch>0) av_strlcat(buf, "|", buf_size);
+                    av_strlcat(buf, name, buf_size);
+                }
+                ch++;
+            }
+        }
+        av_strlcat(buf, ")", buf_size);
+    }
+}
+
+int av_get_channel_layout_nb_channels(int64_t channel_layout)
+{
+    int count;
+    uint64_t x = channel_layout;
+    for (count = 0; x; count++)
+        x &= x-1; // unset lowest set bit
+    return count;
+}
diff --git a/ffmpeg-mt/libavutil/audioconvert.h b/ffmpeg-mt/libavutil/audioconvert.h
new file mode 100644
index 0000000..e37a2e8
--- /dev/null
+++ b/ffmpeg-mt/libavutil/audioconvert.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ * Copyright (c) 2008 Peter Ross
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_AUDIOCONVERT_H
+#define AVUTIL_AUDIOCONVERT_H
+
+#include <stdint.h>
+
+/**
+ * @file
+ * audio conversion routines
+ */
+
+/* Audio channel masks */
+#define AV_CH_FRONT_LEFT             0x00000001
+#define AV_CH_FRONT_RIGHT            0x00000002
+#define AV_CH_FRONT_CENTER           0x00000004
+#define AV_CH_LOW_FREQUENCY          0x00000008
+#define AV_CH_BACK_LEFT              0x00000010
+#define AV_CH_BACK_RIGHT             0x00000020
+#define AV_CH_FRONT_LEFT_OF_CENTER   0x00000040
+#define AV_CH_FRONT_RIGHT_OF_CENTER  0x00000080
+#define AV_CH_BACK_CENTER            0x00000100
+#define AV_CH_SIDE_LEFT              0x00000200
+#define AV_CH_SIDE_RIGHT             0x00000400
+#define AV_CH_TOP_CENTER             0x00000800
+#define AV_CH_TOP_FRONT_LEFT         0x00001000
+#define AV_CH_TOP_FRONT_CENTER       0x00002000
+#define AV_CH_TOP_FRONT_RIGHT        0x00004000
+#define AV_CH_TOP_BACK_LEFT          0x00008000
+#define AV_CH_TOP_BACK_CENTER        0x00010000
+#define AV_CH_TOP_BACK_RIGHT         0x00020000
+#define AV_CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
+#define AV_CH_STEREO_RIGHT           0x40000000  ///< See AV_CH_STEREO_LEFT.
+
+/** Channel mask value used for AVCodecContext.request_channel_layout
+    to indicate that the user requests the channel order of the decoder output
+    to be the native codec channel order. */
+#define AV_CH_LAYOUT_NATIVE          0x8000000000000000LL
+
+/* Audio channel convenience macros */
+#define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
+#define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
+#define AV_CH_LAYOUT_2_1               (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_SURROUND          (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
+#define AV_CH_LAYOUT_4POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_2_2               (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
+#define AV_CH_LAYOUT_QUAD              (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_5POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
+#define AV_CH_LAYOUT_5POINT1           (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_5POINT0_BACK      (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_5POINT1_BACK      (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_7POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_7POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_7POINT1_WIDE      (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
+
+/**
+ * Return a channel layout id that matches name, 0 if no match.
+ */
+int64_t av_get_channel_layout(const char *name);
+
+/**
+ * Return a description of a channel layout.
+ * If nb_channels is <= 0, it is guessed from the channel_layout.
+ *
+ * @param buf put here the string containing the channel layout
+ * @param buf_size size in bytes of the buffer
+ */
+void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout);
+
+/**
+ * Return the number of channels in the channel layout.
+ */
+int av_get_channel_layout_nb_channels(int64_t channel_layout);
+
+#endif /* AVUTIL_AUDIOCONVERT_H */
diff --git a/ffmpeg-mt/libavutil/avassert.h b/ffmpeg-mt/libavutil/avassert.h
index 8dd4878..8733313 100644
--- a/ffmpeg-mt/libavutil/avassert.h
+++ b/ffmpeg-mt/libavutil/avassert.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2010 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/avr32/bswap.h b/ffmpeg-mt/libavutil/avr32/bswap.h
index e79d53f..857f024 100644
--- a/ffmpeg-mt/libavutil/avr32/bswap.h
+++ b/ffmpeg-mt/libavutil/avr32/bswap.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/avr32/intreadwrite.h b/ffmpeg-mt/libavutil/avr32/intreadwrite.h
index c6fd3aa..e0049fe 100644
--- a/ffmpeg-mt/libavutil/avr32/intreadwrite.h
+++ b/ffmpeg-mt/libavutil/avr32/intreadwrite.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/avstring.c b/ffmpeg-mt/libavutil/avstring.c
index b573dd6..2b8c2d4 100644
--- a/ffmpeg-mt/libavutil/avstring.c
+++ b/ffmpeg-mt/libavutil/avstring.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * Copyright (c) 2007 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/avstring.h b/ffmpeg-mt/libavutil/avstring.h
index 04d1197..b40acf6 100644
--- a/ffmpeg-mt/libavutil/avstring.h
+++ b/ffmpeg-mt/libavutil/avstring.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Mans Rullgard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/avutil.h b/ffmpeg-mt/libavutil/avutil.h
index 74c2b5e..d69e989 100644
--- a/ffmpeg-mt/libavutil/avutil.h
+++ b/ffmpeg-mt/libavutil/avutil.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -40,7 +40,7 @@
 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
 
 #define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 36
+#define LIBAVUTIL_VERSION_MINOR 39
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -93,6 +93,18 @@ enum AVMediaType {
 
 #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
 
+#define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
+#define AV_TIME_BASE            1000000
+#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
+
+/**
+ * Those FF_API_* defines are not part of public API.
+ * They may change, break or disappear at any time.
+ */
+#ifndef FF_API_OLD_IMAGE_NAMES
+#define FF_API_OLD_IMAGE_NAMES (LIBAVUTIL_VERSION_MAJOR < 51)
+#endif
+
 #include "common.h"
 #include "error.h"
 #include "mathematics.h"
diff --git a/ffmpeg-mt/libavutil/base64.c b/ffmpeg-mt/libavutil/base64.c
index 1b70fa9..73872b8 100644
--- a/ffmpeg-mt/libavutil/base64.c
+++ b/ffmpeg-mt/libavutil/base64.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2006 Ryan Martell. (rdm4 at martellventures.com)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/base64.h b/ffmpeg-mt/libavutil/base64.h
index 092980b..96c0a4a 100644
--- a/ffmpeg-mt/libavutil/base64.h
+++ b/ffmpeg-mt/libavutil/base64.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2006 Ryan Martell. (rdm4 at martellventures.com)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/bfin/bswap.h b/ffmpeg-mt/libavutil/bfin/bswap.h
index 363ed40..2837a2f 100644
--- a/ffmpeg-mt/libavutil/bfin/bswap.h
+++ b/ffmpeg-mt/libavutil/bfin/bswap.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Marc Hoffman
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/bfin/timer.h b/ffmpeg-mt/libavutil/bfin/timer.h
index 644573d..49d32a8 100644
--- a/ffmpeg-mt/libavutil/bfin/timer.h
+++ b/ffmpeg-mt/libavutil/bfin/timer.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Marc Hoffman
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/bswap.h b/ffmpeg-mt/libavutil/bswap.h
index 303bcf3..c93825f 100644
--- a/ffmpeg-mt/libavutil/bswap.h
+++ b/ffmpeg-mt/libavutil/bswap.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/colorspace.h b/ffmpeg-mt/libavutil/colorspace.h
index f438159..8757566 100644
--- a/ffmpeg-mt/libavutil/colorspace.h
+++ b/ffmpeg-mt/libavutil/colorspace.h
@@ -2,20 +2,20 @@
  * Colorspace conversion defines
  * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/common.h b/ffmpeg-mt/libavutil/common.h
index 6404076..e5c1dfd 100644
--- a/ffmpeg-mt/libavutil/common.h
+++ b/ffmpeg-mt/libavutil/common.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -64,7 +64,7 @@ extern const uint8_t ff_log2_tab[256];
 
 extern const uint8_t av_reverse[256];
 
-static inline av_const int av_log2_c(unsigned int v)
+static av_always_inline av_const int av_log2_c(unsigned int v)
 {
     int n = 0;
     if (v & 0xffff0000) {
@@ -80,7 +80,7 @@ static inline av_const int av_log2_c(unsigned int v)
     return n;
 }
 
-static inline av_const int av_log2_16bit_c(unsigned int v)
+static av_always_inline av_const int av_log2_16bit_c(unsigned int v)
 {
     int n = 0;
     if (v & 0xff00) {
@@ -107,7 +107,7 @@ static inline av_const int av_log2_16bit_c(unsigned int v)
  * @param amax maximum value of the clip range
  * @return clipped value
  */
-static inline av_const int av_clip_c(int a, int amin, int amax)
+static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
 {
     if      (a < amin) return amin;
     else if (a > amax) return amax;
@@ -119,7 +119,7 @@ static inline av_const int av_clip_c(int a, int amin, int amax)
  * @param a value to clip
  * @return clipped value
  */
-static inline av_const uint8_t av_clip_uint8_c(int a)
+static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
 {
     if (a&(~0xFF)) return (-a)>>31;
     else           return a;
@@ -130,7 +130,7 @@ static inline av_const uint8_t av_clip_uint8_c(int a)
  * @param a value to clip
  * @return clipped value
  */
-static inline av_const int8_t av_clip_int8_c(int a)
+static av_always_inline av_const int8_t av_clip_int8_c(int a)
 {
     if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F;
     else                  return a;
@@ -141,7 +141,7 @@ static inline av_const int8_t av_clip_int8_c(int a)
  * @param a value to clip
  * @return clipped value
  */
-static inline av_const uint16_t av_clip_uint16_c(int a)
+static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
 {
     if (a&(~0xFFFF)) return (-a)>>31;
     else             return a;
@@ -152,7 +152,7 @@ static inline av_const uint16_t av_clip_uint16_c(int a)
  * @param a value to clip
  * @return clipped value
  */
-static inline av_const int16_t av_clip_int16_c(int a)
+static av_always_inline av_const int16_t av_clip_int16_c(int a)
 {
     if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
     else                      return a;
@@ -163,7 +163,7 @@ static inline av_const int16_t av_clip_int16_c(int a)
  * @param a value to clip
  * @return clipped value
  */
-static inline av_const int32_t av_clipl_int32_c(int64_t a)
+static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
 {
     if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
     else                                         return a;
@@ -176,7 +176,7 @@ static inline av_const int32_t av_clipl_int32_c(int64_t a)
  * @param amax maximum value of the clip range
  * @return clipped value
  */
-static inline av_const float av_clipf_c(float a, float amin, float amax)
+static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
 {
     if      (a < amin) return amin;
     else if (a > amax) return amax;
@@ -187,7 +187,7 @@ static inline av_const float av_clipf_c(float a, float amin, float amax)
  * @param x value used to compute ceil(log2(x))
  * @return computed ceiling of log2(x)
  */
-static inline av_const int av_ceil_log2_c(int x)
+static av_always_inline av_const int av_ceil_log2_c(int x)
 {
     return av_log2((x - 1) << 1);
 }
@@ -197,7 +197,7 @@ static inline av_const int av_ceil_log2_c(int x)
  * @param x value to count bits of
  * @return the number of bits set to one in x
  */
-static inline av_const int av_popcount_c(uint32_t x)
+static av_always_inline av_const int av_popcount_c(uint32_t x)
 {
     x -= (x >> 1) & 0x55555555;
     x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
diff --git a/ffmpeg-mt/libavutil/cpu.c b/ffmpeg-mt/libavutil/cpu.c
index 766f13f..ddccd00 100644
--- a/ffmpeg-mt/libavutil/cpu.c
+++ b/ffmpeg-mt/libavutil/cpu.c
@@ -1,23 +1,21 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <stdio.h>
-
 #include "cpu.h"
 #include "config.h"
 
@@ -39,13 +37,14 @@ int av_get_cpu_flags(void)
 #ifdef TEST
 
 #undef printf
+#include <stdio.h>
 
 int main(void)
 {
     int cpu_flags = av_get_cpu_flags();
 
     printf("cpu_flags = 0x%08X\n", cpu_flags);
-    printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s%s\n",
 #if   ARCH_ARM
            cpu_flags & AV_CPU_FLAG_IWMMXT   ? "IWMMXT "     : "",
 #elif ARCH_PPC
@@ -59,8 +58,10 @@ int main(void)
            cpu_flags & AV_CPU_FLAG_SSE3     ? "SSE3 "       : "",
            cpu_flags & AV_CPU_FLAG_SSE3SLOW ? "SSE3(slow) " : "",
            cpu_flags & AV_CPU_FLAG_SSSE3    ? "SSSE3 "      : "",
+           cpu_flags & AV_CPU_FLAG_ATOM     ? "Atom "       : "",
            cpu_flags & AV_CPU_FLAG_SSE4     ? "SSE4.1 "     : "",
            cpu_flags & AV_CPU_FLAG_SSE42    ? "SSE4.2 "     : "",
+           cpu_flags & AV_CPU_FLAG_AVX      ? "AVX "        : "",
            cpu_flags & AV_CPU_FLAG_3DNOW    ? "3DNow "      : "",
            cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt "   : "");
 #endif
diff --git a/ffmpeg-mt/libavutil/cpu.h b/ffmpeg-mt/libavutil/cpu.h
index 71cc265..11ba368 100644
--- a/ffmpeg-mt/libavutil/cpu.h
+++ b/ffmpeg-mt/libavutil/cpu.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -34,8 +34,10 @@
 #define AV_CPU_FLAG_SSE3         0x0040 ///< Prescott SSE3 functions
 #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
 #define AV_CPU_FLAG_SSSE3        0x0080 ///< Conroe SSSE3 functions
+#define AV_CPU_FLAG_ATOM     0x10000000 ///< Atom processor, some SSSE3 instructions are slower
 #define AV_CPU_FLAG_SSE4         0x0100 ///< Penryn SSE4.1 functions
 #define AV_CPU_FLAG_SSE42        0x0200 ///< Nehalem SSE4.2 functions
+#define AV_CPU_FLAG_AVX          0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
 #define AV_CPU_FLAG_IWMMXT       0x0100 ///< XScale IWMMXT
 #define AV_CPU_FLAG_ALTIVEC      0x0001 ///< standard
 
diff --git a/ffmpeg-mt/libavutil/crc.c b/ffmpeg-mt/libavutil/crc.c
index c3d74a2..6c9f928 100644
--- a/ffmpeg-mt/libavutil/crc.c
+++ b/ffmpeg-mt/libavutil/crc.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/crc.h b/ffmpeg-mt/libavutil/crc.h
index 6c0baab..a934119 100644
--- a/ffmpeg-mt/libavutil/crc.h
+++ b/ffmpeg-mt/libavutil/crc.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/crc_data.h b/ffmpeg-mt/libavutil/crc_data.h
index afa25e7..8e4e6af 100644
--- a/ffmpeg-mt/libavutil/crc_data.h
+++ b/ffmpeg-mt/libavutil/crc_data.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2008 Aurelien Jacobs <aurel at gnuage.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/des.c b/ffmpeg-mt/libavutil/des.c
index 9c1a530..e8009a2 100644
--- a/ffmpeg-mt/libavutil/des.c
+++ b/ffmpeg-mt/libavutil/des.c
@@ -2,20 +2,20 @@
  * DES encryption/decryption
  * Copyright (c) 2007 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <inttypes.h>
diff --git a/ffmpeg-mt/libavutil/des.h b/ffmpeg-mt/libavutil/des.h
index e80bdd3..5a6d4a1 100644
--- a/ffmpeg-mt/libavutil/des.h
+++ b/ffmpeg-mt/libavutil/des.h
@@ -2,20 +2,20 @@
  * DES encryption/decryption
  * Copyright (c) 2007 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/error.c b/ffmpeg-mt/libavutil/error.c
index 5cf54aa..23e7e13 100644
--- a/ffmpeg-mt/libavutil/error.c
+++ b/ffmpeg-mt/libavutil/error.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -37,6 +37,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
     case AVERROR_FILTER_NOT_FOUND:  errstr = "Filter not found"; break;
     case AVERROR_BSF_NOT_FOUND:     errstr = "Bitstream filter not found"; break;
     case AVERROR_STREAM_NOT_FOUND:  errstr = "Stream not found"; break;
+    case AVERROR_EXIT:              errstr = "Immediate exit requested"; break;
     }
 
     if (errstr) {
diff --git a/ffmpeg-mt/libavutil/error.h b/ffmpeg-mt/libavutil/error.h
index 290487f..087c08f 100644
--- a/ffmpeg-mt/libavutil/error.h
+++ b/ffmpeg-mt/libavutil/error.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -66,6 +66,8 @@
 #define AVERROR_BSF_NOT_FOUND      (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found
 #define AVERROR_STREAM_NOT_FOUND   (-MKTAG(0xF8,'S','T','R')) ///< Stream not found
 
+#define AVERROR_EXIT (-MKTAG('E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted
+
 /**
  * Put a description of the AVERROR code errnum in errbuf.
  * In case of failure the global variable errno is set to indicate the
diff --git a/ffmpeg-mt/libavutil/eval.c b/ffmpeg-mt/libavutil/eval.c
index 0fef97b..8994393 100644
--- a/ffmpeg-mt/libavutil/eval.c
+++ b/ffmpeg-mt/libavutil/eval.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2002-2006 Michael Niedermayer <michaelni at gmx.at>
  * Copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/eval.h b/ffmpeg-mt/libavutil/eval.h
index ee378a2..a20a006 100644
--- a/ffmpeg-mt/libavutil/eval.h
+++ b/ffmpeg-mt/libavutil/eval.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2002 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/fifo.c b/ffmpeg-mt/libavutil/fifo.c
index cfb716e..f87a99d 100644
--- a/ffmpeg-mt/libavutil/fifo.c
+++ b/ffmpeg-mt/libavutil/fifo.c
@@ -3,20 +3,20 @@
  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  * Copyright (c) 2006 Roman Shaposhnik
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "common.h"
diff --git a/ffmpeg-mt/libavutil/fifo.h b/ffmpeg-mt/libavutil/fifo.h
index 999d0bf..cd361b0 100644
--- a/ffmpeg-mt/libavutil/fifo.h
+++ b/ffmpeg-mt/libavutil/fifo.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/file.c b/ffmpeg-mt/libavutil/file.c
index c79f68a..757e73b 100644
--- a/ffmpeg-mt/libavutil/file.c
+++ b/ffmpeg-mt/libavutil/file.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/file.h b/ffmpeg-mt/libavutil/file.h
index f94d780..8b65bfb 100644
--- a/ffmpeg-mt/libavutil/file.h
+++ b/ffmpeg-mt/libavutil/file.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/imgutils.c b/ffmpeg-mt/libavutil/imgutils.c
new file mode 100644
index 0000000..129fb95
--- /dev/null
+++ b/ffmpeg-mt/libavutil/imgutils.c
@@ -0,0 +1,297 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * misc image utilities
+ */
+
+#include "imgutils.h"
+#include "internal.h"
+#include "libavutil/pixdesc.h"
+
+void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+                                const AVPixFmtDescriptor *pixdesc)
+{
+    int i;
+    memset(max_pixsteps, 0, 4*sizeof(max_pixsteps[0]));
+    if (max_pixstep_comps)
+        memset(max_pixstep_comps, 0, 4*sizeof(max_pixstep_comps[0]));
+
+    for (i = 0; i < 4; i++) {
+        const AVComponentDescriptor *comp = &(pixdesc->comp[i]);
+        if ((comp->step_minus1+1) > max_pixsteps[comp->plane]) {
+            max_pixsteps[comp->plane] = comp->step_minus1+1;
+            if (max_pixstep_comps)
+                max_pixstep_comps[comp->plane] = i;
+        }
+    }
+}
+
+int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane)
+{
+    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+    int max_step     [4];       /* max pixel step for each plane */
+    int max_step_comp[4];       /* the component for each plane which has the max pixel step */
+    int s;
+
+    if (desc->flags & PIX_FMT_BITSTREAM)
+        return (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
+
+    av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
+    s = (max_step_comp[plane] == 1 || max_step_comp[plane] == 2) ? desc->log2_chroma_w : 0;
+    return max_step[plane] * (((width + (1 << s) - 1)) >> s);
+}
+
+int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
+{
+    int i;
+    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+    int max_step     [4];       /* max pixel step for each plane */
+    int max_step_comp[4];       /* the component for each plane which has the max pixel step */
+
+    memset(linesizes, 0, 4*sizeof(linesizes[0]));
+
+    if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
+        return AVERROR(EINVAL);
+
+    if (desc->flags & PIX_FMT_BITSTREAM) {
+        if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1))
+            return AVERROR(EINVAL);
+        linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
+        return 0;
+    }
+
+    av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
+    for (i = 0; i < 4; i++) {
+        int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0;
+        int shifted_w = ((width + (1 << s) - 1)) >> s;
+        if (max_step[i] > INT_MAX / shifted_w)
+            return AVERROR(EINVAL);
+        linesizes[i] = max_step[i] * shifted_w;
+    }
+
+    return 0;
+}
+
+int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+                           uint8_t *ptr, const int linesizes[4])
+{
+    int i, total_size, size[4], has_plane[4];
+
+    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+    memset(data     , 0, sizeof(data[0])*4);
+    memset(size     , 0, sizeof(size));
+    memset(has_plane, 0, sizeof(has_plane));
+
+    if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
+        return AVERROR(EINVAL);
+
+    data[0] = ptr;
+    if (linesizes[0] > (INT_MAX - 1024) / height)
+        return AVERROR(EINVAL);
+    size[0] = linesizes[0] * height;
+
+    if (desc->flags & PIX_FMT_PAL) {
+        size[0] = (size[0] + 3) & ~3;
+        data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
+        return size[0] + 256 * 4;
+    }
+
+    for (i = 0; i < 4; i++)
+        has_plane[desc->comp[i].plane] = 1;
+
+    total_size = size[0];
+    for (i = 1; has_plane[i] && i < 4; i++) {
+        int h, s = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
+        data[i] = data[i-1] + size[i-1];
+        h = (height + (1 << s) - 1) >> s;
+        if (linesizes[i] > INT_MAX / h)
+            return AVERROR(EINVAL);
+        size[i] = h * linesizes[i];
+        if (total_size > INT_MAX - size[i])
+            return AVERROR(EINVAL);
+        total_size += size[i];
+    }
+
+    return total_size;
+}
+
+int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt)
+{
+    int i;
+
+    for (i = 0; i < 256; i++) {
+        int r, g, b;
+
+        switch (pix_fmt) {
+        case PIX_FMT_RGB8:
+            r = (i>>5    )*36;
+            g = ((i>>2)&7)*36;
+            b = (i&3     )*85;
+            break;
+        case PIX_FMT_BGR8:
+            b = (i>>6    )*85;
+            g = ((i>>3)&7)*36;
+            r = (i&7     )*36;
+            break;
+        case PIX_FMT_RGB4_BYTE:
+            r = (i>>3    )*255;
+            g = ((i>>1)&3)*85;
+            b = (i&1     )*255;
+            break;
+        case PIX_FMT_BGR4_BYTE:
+            b = (i>>3    )*255;
+            g = ((i>>1)&3)*85;
+            r = (i&1     )*255;
+            break;
+        case PIX_FMT_GRAY8:
+            r = b = g = i;
+            break;
+        default:
+            return AVERROR(EINVAL);
+        }
+        pal[i] = b + (g<<8) + (r<<16);
+    }
+
+    return 0;
+}
+
+int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
+                   int w, int h, enum PixelFormat pix_fmt, int align)
+{
+    int i, ret;
+    uint8_t *buf;
+
+    if ((ret = av_image_check_size(w, h, 0, NULL)) < 0)
+        return ret;
+    if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, w)) < 0)
+        return ret;
+
+    for (i = 0; i < 4; i++)
+        linesizes[i] = FFALIGN(linesizes[i], align);
+
+    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, NULL, linesizes)) < 0)
+        return ret;
+    buf = av_malloc(ret + align);
+    if (!buf)
+        return AVERROR(ENOMEM);
+    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, buf, linesizes)) < 0) {
+        av_free(buf);
+        return ret;
+    }
+    if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)
+        ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
+
+    return ret;
+}
+
+typedef struct ImgUtils {
+    const AVClass *class;
+    int   log_offset;
+    void *log_ctx;
+} ImgUtils;
+
+static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) };
+
+int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
+{
+    ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx };
+
+    if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
+        return 0;
+
+    av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h);
+    return AVERROR(EINVAL);
+}
+
+void av_image_copy_plane(uint8_t       *dst, int dst_linesize,
+                         const uint8_t *src, int src_linesize,
+                         int bytewidth, int height)
+{
+    if (!dst || !src)
+        return;
+    for (;height > 0; height--) {
+        memcpy(dst, src, bytewidth);
+        dst += dst_linesize;
+        src += src_linesize;
+    }
+}
+
+void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
+                   const uint8_t *src_data[4], const int src_linesizes[4],
+                   enum PixelFormat pix_fmt, int width, int height)
+{
+    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+
+    if (desc->flags & PIX_FMT_HWACCEL)
+        return;
+
+    if (desc->flags & PIX_FMT_PAL) {
+        av_image_copy_plane(dst_data[0], dst_linesizes[0],
+                            src_data[0], src_linesizes[0],
+                            width, height);
+        /* copy the palette */
+        memcpy(dst_data[1], src_data[1], 4*256);
+    } else {
+        int i, planes_nb = 0;
+
+        for (i = 0; i < desc->nb_components; i++)
+            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
+
+        for (i = 0; i < planes_nb; i++) {
+            int h = height;
+            int bwidth = av_image_get_linesize(pix_fmt, width, i);
+            if (i == 1 || i == 2) {
+                h= -((-height)>>desc->log2_chroma_h);
+            }
+            av_image_copy_plane(dst_data[i], dst_linesizes[i],
+                                src_data[i], src_linesizes[i],
+                                bwidth, h);
+        }
+    }
+}
+
+#if FF_API_OLD_IMAGE_NAMES
+void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+                                const AVPixFmtDescriptor *pixdesc)
+{
+    av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc);
+}
+
+int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane)
+{
+    return av_image_get_linesize(pix_fmt, width, plane);
+}
+
+int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
+{
+    return av_image_fill_linesizes(linesizes, pix_fmt, width);
+}
+
+int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+                           uint8_t *ptr, const int linesizes[4])
+{
+    return av_image_fill_pointers(data, pix_fmt, height, ptr, linesizes);
+}
+
+int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
+{
+    return av_image_check_size(w, h, log_offset, log_ctx);
+}
+#endif
diff --git a/ffmpeg-mt/libavutil/imgutils.h b/ffmpeg-mt/libavutil/imgutils.h
new file mode 100644
index 0000000..6ebb1b0
--- /dev/null
+++ b/ffmpeg-mt/libavutil/imgutils.h
@@ -0,0 +1,149 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_IMGUTILS_H
+#define AVUTIL_IMGUTILS_H
+
+/**
+ * @file
+ * misc image utilities
+ */
+
+#include "libavutil/pixdesc.h"
+#include "avutil.h"
+
+/**
+ * Compute the max pixel step for each plane of an image with a
+ * format described by pixdesc.
+ *
+ * The pixel step is the distance in bytes between the first byte of
+ * the group of bytes which describe a pixel component and the first
+ * byte of the successive group in the same plane for the same
+ * component.
+ *
+ * @param max_pixsteps an array which is filled with the max pixel step
+ * for each plane. Since a plane may contain different pixel
+ * components, the computed max_pixsteps[plane] is relative to the
+ * component in the plane with the max pixel step.
+ * @param max_pixstep_comps an array which is filled with the component
+ * for each plane which has the max pixel step. May be NULL.
+ */
+void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+                                const AVPixFmtDescriptor *pixdesc);
+
+/**
+ * Compute the size of an image line with format pix_fmt and width
+ * width for the plane plane.
+ *
+ * @return the computed size in bytes
+ */
+int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
+
+/**
+ * Fill plane linesizes for an image with pixel format pix_fmt and
+ * width width.
+ *
+ * @param linesizes array to be filled with the linesize for each plane
+ * @return >= 0 in case of success, a negative error code otherwise
+ */
+int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
+
+/**
+ * Fill plane data pointers for an image with pixel format pix_fmt and
+ * height height.
+ *
+ * @param data pointers array to be filled with the pointer for each image plane
+ * @param ptr the pointer to a buffer which will contain the image
+ * @param linesizes[4] the array containing the linesize for each
+ * plane, should be filled by av_image_fill_linesizes()
+ * @return the size in bytes required for the image buffer, a negative
+ * error code in case of failure
+ */
+int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+                           uint8_t *ptr, const int linesizes[4]);
+
+/**
+ * Allocate an image with size w and h and pixel format pix_fmt, and
+ * fill pointers and linesizes accordingly.
+ * The allocated image buffer has to be freed by using
+ * av_freep(&pointers[0]).
+ *
+ * @param align the value to use for buffer size alignment
+ * @return the size in bytes required for the image buffer, a negative
+ * error code in case of failure
+ */
+int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
+                   int w, int h, enum PixelFormat pix_fmt, int align);
+
+/**
+ * Copy image plane from src to dst.
+ * That is, copy "height" number of lines of "bytewidth" bytes each.
+ * The first byte of each successive line is separated by *_linesize
+ * bytes.
+ *
+ * @param dst_linesize linesize for the image plane in dst
+ * @param src_linesize linesize for the image plane in src
+ */
+void av_image_copy_plane(uint8_t       *dst, int dst_linesize,
+                         const uint8_t *src, int src_linesize,
+                         int bytewidth, int height);
+
+/**
+ * Copy image in src_data to dst_data.
+ *
+ * @param dst_linesize linesizes for the image in dst_data
+ * @param src_linesize linesizes for the image in src_data
+ */
+void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
+                   const uint8_t *src_data[4], const int src_linesizes[4],
+                   enum PixelFormat pix_fmt, int width, int height);
+
+/**
+ * Check if the given dimension of an image is valid, meaning that all
+ * bytes of the image can be addressed with a signed int.
+ *
+ * @param w the width of the picture
+ * @param h the height of the picture
+ * @param log_offset the offset to sum to the log level for logging with log_ctx
+ * @param log_ctx the parent logging context, it may be NULL
+ * @return >= 0 if valid, a negative error code otherwise
+ */
+int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
+
+int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
+
+#if FF_API_OLD_IMAGE_NAMES
+attribute_deprecated
+void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+                                const AVPixFmtDescriptor *pixdesc);
+
+attribute_deprecated
+int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
+
+attribute_deprecated
+int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
+
+attribute_deprecated
+int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+                           uint8_t *ptr, const int linesizes[4]);
+
+attribute_deprecated
+int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
+#endif
+
+#endif /* AVUTIL_IMGUTILS_H */
diff --git a/ffmpeg-mt/libavutil/integer.c b/ffmpeg-mt/libavutil/integer.c
index 4f9b66c..0114bb0 100644
--- a/ffmpeg-mt/libavutil/integer.c
+++ b/ffmpeg-mt/libavutil/integer.c
@@ -2,20 +2,20 @@
  * arbitrary precision integers
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/integer.h b/ffmpeg-mt/libavutil/integer.h
index 45f733c..f434cfa 100644
--- a/ffmpeg-mt/libavutil/integer.h
+++ b/ffmpeg-mt/libavutil/integer.h
@@ -2,20 +2,20 @@
  * arbitrary precision integers
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/internal.h b/ffmpeg-mt/libavutil/internal.h
index 4e2d4fc..a0531da 100644
--- a/ffmpeg-mt/libavutil/internal.h
+++ b/ffmpeg-mt/libavutil/internal.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,27 +39,13 @@
 #include "timer.h"
 
 #ifndef attribute_align_arg
-#if ARCH_X86_32 && (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(4,2)
+#if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2)
 #    define attribute_align_arg __attribute__((force_align_arg_pointer))
 #else
 #    define attribute_align_arg
 #endif
 #endif
 
-
-/**
- * Mark a variable as used and prevent the compiler from optimizing it away.
- * This is useful for asm that accesses varibles in ways that the compiler does not
- * understand
- */
-#ifndef attribute_used
-#if AV_GCC_VERSION_AT_LEAST(3,1)
-#    define attribute_used __attribute__((used))
-#else
-#    define attribute_used
-#endif
-#endif
-
 #ifndef INT16_MIN
 #define INT16_MIN       (-0x7fff - 1)
 #endif
@@ -114,13 +100,6 @@
 
 /* debug stuff */
 
-/* dprintf macros */
-#ifdef DEBUG
-#    define dprintf(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
-#else
-#    define dprintf(pctx, ...)
-#endif
-
 #define av_abort()      do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
 
 /* math */
@@ -206,7 +185,7 @@
  * Define a function with only the non-default version specified.
  *
  * On systems with ELF shared libraries, all symbols exported from
- * FFmpeg libraries are tagged with the name and major version of the
+ * Libav libraries are tagged with the name and major version of the
  * library to which they belong.  If a function is moved from one
  * library to another, a wrapper must be retained in the original
  * location to preserve binary compatibility.
diff --git a/ffmpeg-mt/libavutil/intfloat_readwrite.c b/ffmpeg-mt/libavutil/intfloat_readwrite.c
index 79fe186..21a1c31 100644
--- a/ffmpeg-mt/libavutil/intfloat_readwrite.c
+++ b/ffmpeg-mt/libavutil/intfloat_readwrite.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -26,18 +26,18 @@
  */
 
 #include <stdint.h>
-#include <math.h>
+#include "mathematics.h"
 #include "intfloat_readwrite.h"
 
 double av_int2dbl(int64_t v){
     if(v+v > 0xFFEULL<<52)
-        return 0.0/0.0;
+        return NAN;
     return ldexp(((v&((1LL<<52)-1)) + (1LL<<52)) * (v>>63|1), (v>>52&0x7FF)-1075);
 }
 
 float av_int2flt(int32_t v){
     if(v+v > 0xFF000000U)
-        return 0.0/0.0;
+        return NAN;
     return ldexp(((v&0x7FFFFF) + (1<<23)) * (v>>31|1), (v>>23&0xFF)-150);
 }
 
@@ -49,7 +49,7 @@ double av_ext2dbl(const AVExtFloat ext){
         m = (m<<8) + ext.mantissa[i];
     e = (((int)ext.exponent[0]&0x7f)<<8) | ext.exponent[1];
     if (e == 0x7fff && m)
-        return 0.0/0.0;
+        return NAN;
     e -= 16383 + 63;        /* In IEEE 80 bits, the whole (i.e. 1.xxxx)
                              * mantissa bit is written as opposed to the
                              * single and double precision formats. */
@@ -88,7 +88,7 @@ AVExtFloat av_dbl2ext(double d){
             ext.mantissa[i] = m>>(56-(i<<3));
     } else if (f != 0.0) {
         ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
-        if (f != 1/0.0)
+        if (f != INFINITY)
             ext.mantissa[0] = ~0;
     }
     if (d < 0)
diff --git a/ffmpeg-mt/libavutil/intfloat_readwrite.h b/ffmpeg-mt/libavutil/intfloat_readwrite.h
index 1b80fc6..10ecbed 100644
--- a/ffmpeg-mt/libavutil/intfloat_readwrite.h
+++ b/ffmpeg-mt/libavutil/intfloat_readwrite.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/intmath.h b/ffmpeg-mt/libavutil/intmath.h
index 8b400ef..3325975 100644
--- a/ffmpeg-mt/libavutil/intmath.h
+++ b/ffmpeg-mt/libavutil/intmath.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/intreadwrite.h b/ffmpeg-mt/libavutil/intreadwrite.h
index 1849a64..c8489f1 100644
--- a/ffmpeg-mt/libavutil/intreadwrite.h
+++ b/ffmpeg-mt/libavutil/intreadwrite.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/inverse.c b/ffmpeg-mt/libavutil/inverse.c
index 74df1c2..bca6183 100644
--- a/ffmpeg-mt/libavutil/inverse.c
+++ b/ffmpeg-mt/libavutil/inverse.c
@@ -2,20 +2,20 @@
  * Inverse table
  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/lfg.c b/ffmpeg-mt/libavutil/lfg.c
index b5db5a4..7fab806 100644
--- a/ffmpeg-mt/libavutil/lfg.c
+++ b/ffmpeg-mt/libavutil/lfg.c
@@ -2,20 +2,20 @@
  * Lagged Fibonacci PRNG
  * Copyright (c) 2008 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/lfg.h b/ffmpeg-mt/libavutil/lfg.h
index 0e89ea3..89a635a 100644
--- a/ffmpeg-mt/libavutil/lfg.h
+++ b/ffmpeg-mt/libavutil/lfg.h
@@ -2,20 +2,20 @@
  * Lagged Fibonacci PRNG
  * Copyright (c) 2008 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/libm.h b/ffmpeg-mt/libavutil/libm.h
index c7c28ac..704bcf9 100644
--- a/ffmpeg-mt/libavutil/libm.h
+++ b/ffmpeg-mt/libavutil/libm.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/lls.c b/ffmpeg-mt/libavutil/lls.c
index 3855792..6797385 100644
--- a/ffmpeg-mt/libavutil/lls.c
+++ b/ffmpeg-mt/libavutil/lls.c
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/lls.h b/ffmpeg-mt/libavutil/lls.h
index d168e59..3db391b 100644
--- a/ffmpeg-mt/libavutil/lls.h
+++ b/ffmpeg-mt/libavutil/lls.h
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/log.c b/ffmpeg-mt/libavutil/log.c
index 6c9e76a..3b82448 100644
--- a/ffmpeg-mt/libavutil/log.c
+++ b/ffmpeg-mt/libavutil/log.c
@@ -2,20 +2,20 @@
  * log functions
  * Copyright (c) 2003 Michel Bardiaux
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/log.h b/ffmpeg-mt/libavutil/log.h
index 3b364be..1cd9269 100644
--- a/ffmpeg-mt/libavutil/log.h
+++ b/ffmpeg-mt/libavutil/log.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -136,6 +136,17 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
 const char* av_default_item_name(void* ctx);
 
 /**
+ * av_dlog macros
+ * Useful to print debug messages that shouldn't get compiled in normally.
+ */
+
+#ifdef DEBUG
+#    define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
+#else
+#    define av_dlog(pctx, ...)
+#endif
+
+/**
  * Skip repeated messages, this requires the user app to use av_log() instead of
  * (f)printf as the 2 would otherwise interfere and lead to
  * "Last message repeated x times" messages below (f)printf messages with some
diff --git a/ffmpeg-mt/libavutil/lzo.c b/ffmpeg-mt/libavutil/lzo.c
index a876fc7..ef01653 100644
--- a/ffmpeg-mt/libavutil/lzo.c
+++ b/ffmpeg-mt/libavutil/lzo.c
@@ -2,20 +2,20 @@
  * LZO 1x decompression
  * Copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -175,6 +175,14 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
     int state= 0;
     int x;
     LZOContext c;
+    if (!*outlen || !*inlen) {
+        int res = 0;
+        if (!*outlen)
+            res |= AV_LZO_OUTPUT_FULL;
+        if (!*inlen)
+            res |= AV_LZO_INPUT_DEPLETED;
+        return res;
+    }
     c.in = in;
     c.in_end = (const uint8_t *)in + *inlen;
     c.out = c.out_start = out;
diff --git a/ffmpeg-mt/libavutil/lzo.h b/ffmpeg-mt/libavutil/lzo.h
index 6788054..01c9280 100644
--- a/ffmpeg-mt/libavutil/lzo.h
+++ b/ffmpeg-mt/libavutil/lzo.h
@@ -2,20 +2,20 @@
  * LZO 1x decompression
  * copyright (c) 2006 Reimar Doeffinger
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/mathematics.c b/ffmpeg-mt/libavutil/mathematics.c
index c6851cb..53155c3 100644
--- a/ffmpeg-mt/libavutil/mathematics.c
+++ b/ffmpeg-mt/libavutil/mathematics.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/mathematics.h b/ffmpeg-mt/libavutil/mathematics.h
index 882a516..35494bb 100644
--- a/ffmpeg-mt/libavutil/mathematics.h
+++ b/ffmpeg-mt/libavutil/mathematics.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/md5.c b/ffmpeg-mt/libavutil/md5.c
index 173ed06..271d71f 100644
--- a/ffmpeg-mt/libavutil/md5.c
+++ b/ffmpeg-mt/libavutil/md5.c
@@ -13,20 +13,20 @@
  * If you use gcc, then version 4.1 or later and -fomit-frame-pointer is
  * strongly recommended.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/md5.h b/ffmpeg-mt/libavutil/md5.h
index 969202a..c178bbb 100644
--- a/ffmpeg-mt/libavutil/md5.h
+++ b/ffmpeg-mt/libavutil/md5.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/mem.c b/ffmpeg-mt/libavutil/mem.c
index 18fe28b..7a54bd0 100644
--- a/ffmpeg-mt/libavutil/mem.c
+++ b/ffmpeg-mt/libavutil/mem.c
@@ -2,20 +2,20 @@
  * default memory allocator for libavutil
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -138,12 +138,11 @@ void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size)
 
 void av_free(void *ptr)
 {
-    /* XXX: this test should not be needed on most libcs */
-    if (ptr)
 #if CONFIG_MEMALIGN_HACK
+    if (ptr)
         free((char*)ptr - ((char*)ptr)[-1]);
 #else
-        free(ptr);
+    free(ptr);
 #endif
 }
 
diff --git a/ffmpeg-mt/libavutil/mem.h b/ffmpeg-mt/libavutil/mem.h
index ab73a32..f52777b 100644
--- a/ffmpeg-mt/libavutil/mem.h
+++ b/ffmpeg-mt/libavutil/mem.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -41,7 +41,7 @@
         static const t __attribute__((aligned(n))) v
 #elif defined(__GNUC__)
     #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
-    #define DECLARE_ASM_CONST(n,t,v)    static const t attribute_used __attribute__ ((aligned (n))) v
+    #define DECLARE_ASM_CONST(n,t,v)    static const t av_used __attribute__ ((aligned (n))) v
 #elif defined(_MSC_VER)
     #define DECLARE_ALIGNED(n,t,v)      __declspec(align(n)) t v
     #define DECLARE_ASM_CONST(n,t,v)    __declspec(align(n)) static const t v
@@ -56,7 +56,7 @@
     #define av_malloc_attrib
 #endif
 
-#if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(4,3)
+#if AV_GCC_VERSION_AT_LEAST(4,3)
     #define av_alloc_size(n) __attribute__((alloc_size(n)))
 #else
     #define av_alloc_size(n)
diff --git a/ffmpeg-mt/libavutil/mips/intreadwrite.h b/ffmpeg-mt/libavutil/mips/intreadwrite.h
index b7479d3..0e0cc06 100644
--- a/ffmpeg-mt/libavutil/mips/intreadwrite.h
+++ b/ffmpeg-mt/libavutil/mips/intreadwrite.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -24,6 +24,8 @@
 #include <stdint.h>
 #include "config.h"
 
+#if HAVE_INLINE_ASM
+
 #define AV_RN32 AV_RN32
 static av_always_inline uint32_t AV_RN32(const void *p)
 {
@@ -91,4 +93,6 @@ static av_always_inline void AV_WN64(void *p, uint64_t v)
 
 #endif /* ARCH_MIPS64 */
 
+#endif /* HAVE_INLINE_ASM */
+
 #endif /* AVUTIL_MIPS_INTREADWRITE_H */
diff --git a/ffmpeg-mt/libavutil/opt.c b/ffmpeg-mt/libavutil/opt.c
index ab6021c..30efb52 100644
--- a/ffmpeg-mt/libavutil/opt.c
+++ b/ffmpeg-mt/libavutil/opt.c
@@ -2,20 +2,20 @@
  * AVOptions
  * Copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/opt.h b/ffmpeg-mt/libavutil/opt.h
index 67c2dd7..3e61737 100644
--- a/ffmpeg-mt/libavutil/opt.h
+++ b/ffmpeg-mt/libavutil/opt.h
@@ -2,20 +2,20 @@
  * AVOptions
  * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/parseutils.c b/ffmpeg-mt/libavutil/parseutils.c
new file mode 100644
index 0000000..cc90131
--- /dev/null
+++ b/ffmpeg-mt/libavutil/parseutils.c
@@ -0,0 +1,750 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * misc parsing utilities
+ */
+
+#include <strings.h>
+#include <sys/time.h>
+#include <time.h>
+#include "parseutils.h"
+#include "libavutil/avutil.h"
+#include "libavutil/eval.h"
+#include "libavutil/avstring.h"
+#include "libavutil/random_seed.h"
+
+typedef struct {
+    const char *abbr;
+    int width, height;
+} VideoSizeAbbr;
+
+typedef struct {
+    const char *abbr;
+    AVRational rate;
+} VideoRateAbbr;
+
+static const VideoSizeAbbr video_size_abbrs[] = {
+    { "ntsc",      720, 480 },
+    { "pal",       720, 576 },
+    { "qntsc",     352, 240 }, /* VCD compliant NTSC */
+    { "qpal",      352, 288 }, /* VCD compliant PAL */
+    { "sntsc",     640, 480 }, /* square pixel NTSC */
+    { "spal",      768, 576 }, /* square pixel PAL */
+    { "film",      352, 240 },
+    { "ntsc-film", 352, 240 },
+    { "sqcif",     128,  96 },
+    { "qcif",      176, 144 },
+    { "cif",       352, 288 },
+    { "4cif",      704, 576 },
+    { "16cif",    1408,1152 },
+    { "qqvga",     160, 120 },
+    { "qvga",      320, 240 },
+    { "vga",       640, 480 },
+    { "svga",      800, 600 },
+    { "xga",      1024, 768 },
+    { "uxga",     1600,1200 },
+    { "qxga",     2048,1536 },
+    { "sxga",     1280,1024 },
+    { "qsxga",    2560,2048 },
+    { "hsxga",    5120,4096 },
+    { "wvga",      852, 480 },
+    { "wxga",     1366, 768 },
+    { "wsxga",    1600,1024 },
+    { "wuxga",    1920,1200 },
+    { "woxga",    2560,1600 },
+    { "wqsxga",   3200,2048 },
+    { "wquxga",   3840,2400 },
+    { "whsxga",   6400,4096 },
+    { "whuxga",   7680,4800 },
+    { "cga",       320, 200 },
+    { "ega",       640, 350 },
+    { "hd480",     852, 480 },
+    { "hd720",    1280, 720 },
+    { "hd1080",   1920,1080 },
+};
+
+static const VideoRateAbbr video_rate_abbrs[]= {
+    { "ntsc",      { 30000, 1001 } },
+    { "pal",       {    25,    1 } },
+    { "qntsc",     { 30000, 1001 } }, /* VCD compliant NTSC */
+    { "qpal",      {    25,    1 } }, /* VCD compliant PAL */
+    { "sntsc",     { 30000, 1001 } }, /* square pixel NTSC */
+    { "spal",      {    25,    1 } }, /* square pixel PAL */
+    { "film",      {    24,    1 } },
+    { "ntsc-film", { 24000, 1001 } },
+};
+
+int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
+{
+    int i;
+    int n = FF_ARRAY_ELEMS(video_size_abbrs);
+    char *p;
+    int width = 0, height = 0;
+
+    for (i = 0; i < n; i++) {
+        if (!strcmp(video_size_abbrs[i].abbr, str)) {
+            width  = video_size_abbrs[i].width;
+            height = video_size_abbrs[i].height;
+            break;
+        }
+    }
+    if (i == n) {
+        p = str;
+        width = strtol(p, &p, 10);
+        if (*p)
+            p++;
+        height = strtol(p, &p, 10);
+    }
+    if (width <= 0 || height <= 0)
+        return AVERROR(EINVAL);
+    *width_ptr  = width;
+    *height_ptr = height;
+    return 0;
+}
+
+int av_parse_video_rate(AVRational *rate, const char *arg)
+{
+    int i, ret;
+    int n = FF_ARRAY_ELEMS(video_rate_abbrs);
+    double res;
+
+    /* First, we check our abbreviation table */
+    for (i = 0; i < n; ++i)
+        if (!strcmp(video_rate_abbrs[i].abbr, arg)) {
+            *rate = video_rate_abbrs[i].rate;
+            return 0;
+        }
+
+    /* Then, we try to parse it as fraction */
+    if ((ret = av_expr_parse_and_eval(&res, arg, NULL, NULL, NULL, NULL, NULL, NULL,
+                                      NULL, 0, NULL)) < 0)
+        return ret;
+    *rate = av_d2q(res, 1001000);
+    if (rate->num <= 0 || rate->den <= 0)
+        return AVERROR(EINVAL);
+    return 0;
+}
+
+typedef struct {
+    const char *name;            ///< a string representing the name of the color
+    uint8_t     rgb_color[3];    ///< RGB values for the color
+} ColorEntry;
+
+static ColorEntry color_table[] = {
+    { "AliceBlue",            { 0xF0, 0xF8, 0xFF } },
+    { "AntiqueWhite",         { 0xFA, 0xEB, 0xD7 } },
+    { "Aqua",                 { 0x00, 0xFF, 0xFF } },
+    { "Aquamarine",           { 0x7F, 0xFF, 0xD4 } },
+    { "Azure",                { 0xF0, 0xFF, 0xFF } },
+    { "Beige",                { 0xF5, 0xF5, 0xDC } },
+    { "Bisque",               { 0xFF, 0xE4, 0xC4 } },
+    { "Black",                { 0x00, 0x00, 0x00 } },
+    { "BlanchedAlmond",       { 0xFF, 0xEB, 0xCD } },
+    { "Blue",                 { 0x00, 0x00, 0xFF } },
+    { "BlueViolet",           { 0x8A, 0x2B, 0xE2 } },
+    { "Brown",                { 0xA5, 0x2A, 0x2A } },
+    { "BurlyWood",            { 0xDE, 0xB8, 0x87 } },
+    { "CadetBlue",            { 0x5F, 0x9E, 0xA0 } },
+    { "Chartreuse",           { 0x7F, 0xFF, 0x00 } },
+    { "Chocolate",            { 0xD2, 0x69, 0x1E } },
+    { "Coral",                { 0xFF, 0x7F, 0x50 } },
+    { "CornflowerBlue",       { 0x64, 0x95, 0xED } },
+    { "Cornsilk",             { 0xFF, 0xF8, 0xDC } },
+    { "Crimson",              { 0xDC, 0x14, 0x3C } },
+    { "Cyan",                 { 0x00, 0xFF, 0xFF } },
+    { "DarkBlue",             { 0x00, 0x00, 0x8B } },
+    { "DarkCyan",             { 0x00, 0x8B, 0x8B } },
+    { "DarkGoldenRod",        { 0xB8, 0x86, 0x0B } },
+    { "DarkGray",             { 0xA9, 0xA9, 0xA9 } },
+    { "DarkGreen",            { 0x00, 0x64, 0x00 } },
+    { "DarkKhaki",            { 0xBD, 0xB7, 0x6B } },
+    { "DarkMagenta",          { 0x8B, 0x00, 0x8B } },
+    { "DarkOliveGreen",       { 0x55, 0x6B, 0x2F } },
+    { "Darkorange",           { 0xFF, 0x8C, 0x00 } },
+    { "DarkOrchid",           { 0x99, 0x32, 0xCC } },
+    { "DarkRed",              { 0x8B, 0x00, 0x00 } },
+    { "DarkSalmon",           { 0xE9, 0x96, 0x7A } },
+    { "DarkSeaGreen",         { 0x8F, 0xBC, 0x8F } },
+    { "DarkSlateBlue",        { 0x48, 0x3D, 0x8B } },
+    { "DarkSlateGray",        { 0x2F, 0x4F, 0x4F } },
+    { "DarkTurquoise",        { 0x00, 0xCE, 0xD1 } },
+    { "DarkViolet",           { 0x94, 0x00, 0xD3 } },
+    { "DeepPink",             { 0xFF, 0x14, 0x93 } },
+    { "DeepSkyBlue",          { 0x00, 0xBF, 0xFF } },
+    { "DimGray",              { 0x69, 0x69, 0x69 } },
+    { "DodgerBlue",           { 0x1E, 0x90, 0xFF } },
+    { "FireBrick",            { 0xB2, 0x22, 0x22 } },
+    { "FloralWhite",          { 0xFF, 0xFA, 0xF0 } },
+    { "ForestGreen",          { 0x22, 0x8B, 0x22 } },
+    { "Fuchsia",              { 0xFF, 0x00, 0xFF } },
+    { "Gainsboro",            { 0xDC, 0xDC, 0xDC } },
+    { "GhostWhite",           { 0xF8, 0xF8, 0xFF } },
+    { "Gold",                 { 0xFF, 0xD7, 0x00 } },
+    { "GoldenRod",            { 0xDA, 0xA5, 0x20 } },
+    { "Gray",                 { 0x80, 0x80, 0x80 } },
+    { "Green",                { 0x00, 0x80, 0x00 } },
+    { "GreenYellow",          { 0xAD, 0xFF, 0x2F } },
+    { "HoneyDew",             { 0xF0, 0xFF, 0xF0 } },
+    { "HotPink",              { 0xFF, 0x69, 0xB4 } },
+    { "IndianRed",            { 0xCD, 0x5C, 0x5C } },
+    { "Indigo",               { 0x4B, 0x00, 0x82 } },
+    { "Ivory",                { 0xFF, 0xFF, 0xF0 } },
+    { "Khaki",                { 0xF0, 0xE6, 0x8C } },
+    { "Lavender",             { 0xE6, 0xE6, 0xFA } },
+    { "LavenderBlush",        { 0xFF, 0xF0, 0xF5 } },
+    { "LawnGreen",            { 0x7C, 0xFC, 0x00 } },
+    { "LemonChiffon",         { 0xFF, 0xFA, 0xCD } },
+    { "LightBlue",            { 0xAD, 0xD8, 0xE6 } },
+    { "LightCoral",           { 0xF0, 0x80, 0x80 } },
+    { "LightCyan",            { 0xE0, 0xFF, 0xFF } },
+    { "LightGoldenRodYellow", { 0xFA, 0xFA, 0xD2 } },
+    { "LightGrey",            { 0xD3, 0xD3, 0xD3 } },
+    { "LightGreen",           { 0x90, 0xEE, 0x90 } },
+    { "LightPink",            { 0xFF, 0xB6, 0xC1 } },
+    { "LightSalmon",          { 0xFF, 0xA0, 0x7A } },
+    { "LightSeaGreen",        { 0x20, 0xB2, 0xAA } },
+    { "LightSkyBlue",         { 0x87, 0xCE, 0xFA } },
+    { "LightSlateGray",       { 0x77, 0x88, 0x99 } },
+    { "LightSteelBlue",       { 0xB0, 0xC4, 0xDE } },
+    { "LightYellow",          { 0xFF, 0xFF, 0xE0 } },
+    { "Lime",                 { 0x00, 0xFF, 0x00 } },
+    { "LimeGreen",            { 0x32, 0xCD, 0x32 } },
+    { "Linen",                { 0xFA, 0xF0, 0xE6 } },
+    { "Magenta",              { 0xFF, 0x00, 0xFF } },
+    { "Maroon",               { 0x80, 0x00, 0x00 } },
+    { "MediumAquaMarine",     { 0x66, 0xCD, 0xAA } },
+    { "MediumBlue",           { 0x00, 0x00, 0xCD } },
+    { "MediumOrchid",         { 0xBA, 0x55, 0xD3 } },
+    { "MediumPurple",         { 0x93, 0x70, 0xD8 } },
+    { "MediumSeaGreen",       { 0x3C, 0xB3, 0x71 } },
+    { "MediumSlateBlue",      { 0x7B, 0x68, 0xEE } },
+    { "MediumSpringGreen",    { 0x00, 0xFA, 0x9A } },
+    { "MediumTurquoise",      { 0x48, 0xD1, 0xCC } },
+    { "MediumVioletRed",      { 0xC7, 0x15, 0x85 } },
+    { "MidnightBlue",         { 0x19, 0x19, 0x70 } },
+    { "MintCream",            { 0xF5, 0xFF, 0xFA } },
+    { "MistyRose",            { 0xFF, 0xE4, 0xE1 } },
+    { "Moccasin",             { 0xFF, 0xE4, 0xB5 } },
+    { "NavajoWhite",          { 0xFF, 0xDE, 0xAD } },
+    { "Navy",                 { 0x00, 0x00, 0x80 } },
+    { "OldLace",              { 0xFD, 0xF5, 0xE6 } },
+    { "Olive",                { 0x80, 0x80, 0x00 } },
+    { "OliveDrab",            { 0x6B, 0x8E, 0x23 } },
+    { "Orange",               { 0xFF, 0xA5, 0x00 } },
+    { "OrangeRed",            { 0xFF, 0x45, 0x00 } },
+    { "Orchid",               { 0xDA, 0x70, 0xD6 } },
+    { "PaleGoldenRod",        { 0xEE, 0xE8, 0xAA } },
+    { "PaleGreen",            { 0x98, 0xFB, 0x98 } },
+    { "PaleTurquoise",        { 0xAF, 0xEE, 0xEE } },
+    { "PaleVioletRed",        { 0xD8, 0x70, 0x93 } },
+    { "PapayaWhip",           { 0xFF, 0xEF, 0xD5 } },
+    { "PeachPuff",            { 0xFF, 0xDA, 0xB9 } },
+    { "Peru",                 { 0xCD, 0x85, 0x3F } },
+    { "Pink",                 { 0xFF, 0xC0, 0xCB } },
+    { "Plum",                 { 0xDD, 0xA0, 0xDD } },
+    { "PowderBlue",           { 0xB0, 0xE0, 0xE6 } },
+    { "Purple",               { 0x80, 0x00, 0x80 } },
+    { "Red",                  { 0xFF, 0x00, 0x00 } },
+    { "RosyBrown",            { 0xBC, 0x8F, 0x8F } },
+    { "RoyalBlue",            { 0x41, 0x69, 0xE1 } },
+    { "SaddleBrown",          { 0x8B, 0x45, 0x13 } },
+    { "Salmon",               { 0xFA, 0x80, 0x72 } },
+    { "SandyBrown",           { 0xF4, 0xA4, 0x60 } },
+    { "SeaGreen",             { 0x2E, 0x8B, 0x57 } },
+    { "SeaShell",             { 0xFF, 0xF5, 0xEE } },
+    { "Sienna",               { 0xA0, 0x52, 0x2D } },
+    { "Silver",               { 0xC0, 0xC0, 0xC0 } },
+    { "SkyBlue",              { 0x87, 0xCE, 0xEB } },
+    { "SlateBlue",            { 0x6A, 0x5A, 0xCD } },
+    { "SlateGray",            { 0x70, 0x80, 0x90 } },
+    { "Snow",                 { 0xFF, 0xFA, 0xFA } },
+    { "SpringGreen",          { 0x00, 0xFF, 0x7F } },
+    { "SteelBlue",            { 0x46, 0x82, 0xB4 } },
+    { "Tan",                  { 0xD2, 0xB4, 0x8C } },
+    { "Teal",                 { 0x00, 0x80, 0x80 } },
+    { "Thistle",              { 0xD8, 0xBF, 0xD8 } },
+    { "Tomato",               { 0xFF, 0x63, 0x47 } },
+    { "Turquoise",            { 0x40, 0xE0, 0xD0 } },
+    { "Violet",               { 0xEE, 0x82, 0xEE } },
+    { "Wheat",                { 0xF5, 0xDE, 0xB3 } },
+    { "White",                { 0xFF, 0xFF, 0xFF } },
+    { "WhiteSmoke",           { 0xF5, 0xF5, 0xF5 } },
+    { "Yellow",               { 0xFF, 0xFF, 0x00 } },
+    { "YellowGreen",          { 0x9A, 0xCD, 0x32 } },
+};
+
+static int color_table_compare(const void *lhs, const void *rhs)
+{
+    return strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
+}
+
+#define ALPHA_SEP '@'
+
+int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
+                   void *log_ctx)
+{
+    char *tail, color_string2[128];
+    const ColorEntry *entry;
+    int len, hex_offset = 0;
+
+    if (color_string[0] == '#') {
+        hex_offset = 1;
+    } else if (!strncmp(color_string, "0x", 2))
+        hex_offset = 2;
+
+    if (slen < 0)
+        slen = strlen(color_string);
+    av_strlcpy(color_string2, color_string + hex_offset,
+               FFMIN(slen-hex_offset+1, sizeof(color_string2)));
+    if ((tail = strchr(color_string2, ALPHA_SEP)))
+        *tail++ = 0;
+    len = strlen(color_string2);
+    rgba_color[3] = 255;
+
+    if (!strcasecmp(color_string2, "random") || !strcasecmp(color_string2, "bikeshed")) {
+        int rgba = av_get_random_seed();
+        rgba_color[0] = rgba >> 24;
+        rgba_color[1] = rgba >> 16;
+        rgba_color[2] = rgba >> 8;
+        rgba_color[3] = rgba;
+    } else if (hex_offset ||
+               strspn(color_string2, "0123456789ABCDEFabcdef") == len) {
+        char *tail;
+        unsigned int rgba = strtoul(color_string2, &tail, 16);
+
+        if (*tail || (len != 6 && len != 8)) {
+            av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string2);
+            return AVERROR(EINVAL);
+        }
+        if (len == 8) {
+            rgba_color[3] = rgba;
+            rgba >>= 8;
+        }
+        rgba_color[0] = rgba >> 16;
+        rgba_color[1] = rgba >> 8;
+        rgba_color[2] = rgba;
+    } else {
+        entry = bsearch(color_string2,
+                        color_table,
+                        FF_ARRAY_ELEMS(color_table),
+                        sizeof(ColorEntry),
+                        color_table_compare);
+        if (!entry) {
+            av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string2);
+            return AVERROR(EINVAL);
+        }
+        memcpy(rgba_color, entry->rgb_color, 3);
+    }
+
+    if (tail) {
+        unsigned long int alpha;
+        const char *alpha_string = tail;
+        if (!strncmp(alpha_string, "0x", 2)) {
+            alpha = strtoul(alpha_string, &tail, 16);
+        } else {
+            alpha = 255 * strtod(alpha_string, &tail);
+        }
+
+        if (tail == alpha_string || *tail || alpha > 255) {
+            av_log(log_ctx, AV_LOG_ERROR, "Invalid alpha value specifier '%s' in '%s'\n",
+                   alpha_string, color_string);
+            return AVERROR(EINVAL);
+        }
+        rgba_color[3] = alpha;
+    }
+
+    return 0;
+}
+
+/* get a positive number between n_min and n_max, for a maximum length
+   of len_max. Return -1 if error. */
+static int date_get_num(const char **pp,
+                        int n_min, int n_max, int len_max)
+{
+    int i, val, c;
+    const char *p;
+
+    p = *pp;
+    val = 0;
+    for(i = 0; i < len_max; i++) {
+        c = *p;
+        if (!isdigit(c))
+            break;
+        val = (val * 10) + c - '0';
+        p++;
+    }
+    /* no number read ? */
+    if (p == *pp)
+        return -1;
+    if (val < n_min || val > n_max)
+        return -1;
+    *pp = p;
+    return val;
+}
+
+/* small strptime for ffmpeg */
+static
+const char *small_strptime(const char *p, const char *fmt,
+                           struct tm *dt)
+{
+    int c, val;
+
+    for(;;) {
+        c = *fmt++;
+        if (c == '\0') {
+            return p;
+        } else if (c == '%') {
+            c = *fmt++;
+            switch(c) {
+            case 'H':
+                val = date_get_num(&p, 0, 23, 2);
+                if (val == -1)
+                    return NULL;
+                dt->tm_hour = val;
+                break;
+            case 'M':
+                val = date_get_num(&p, 0, 59, 2);
+                if (val == -1)
+                    return NULL;
+                dt->tm_min = val;
+                break;
+            case 'S':
+                val = date_get_num(&p, 0, 59, 2);
+                if (val == -1)
+                    return NULL;
+                dt->tm_sec = val;
+                break;
+            case 'Y':
+                val = date_get_num(&p, 0, 9999, 4);
+                if (val == -1)
+                    return NULL;
+                dt->tm_year = val - 1900;
+                break;
+            case 'm':
+                val = date_get_num(&p, 1, 12, 2);
+                if (val == -1)
+                    return NULL;
+                dt->tm_mon = val - 1;
+                break;
+            case 'd':
+                val = date_get_num(&p, 1, 31, 2);
+                if (val == -1)
+                    return NULL;
+                dt->tm_mday = val;
+                break;
+            case '%':
+                goto match;
+            default:
+                return NULL;
+            }
+        } else {
+        match:
+            if (c != *p)
+                return NULL;
+            p++;
+        }
+    }
+    return p;
+}
+
+static time_t mktimegm(struct tm *tm)
+{
+    time_t t;
+
+    int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday;
+
+    if (m < 3) {
+        m += 12;
+        y--;
+    }
+
+    t = 86400 *
+        (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469);
+
+    t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec;
+
+    return t;
+}
+
+int av_parse_time(int64_t *timeval, const char *datestr, int duration)
+{
+    const char *p;
+    int64_t t;
+    struct tm dt;
+    int i;
+    static const char * const date_fmt[] = {
+        "%Y-%m-%d",
+        "%Y%m%d",
+    };
+    static const char * const time_fmt[] = {
+        "%H:%M:%S",
+        "%H%M%S",
+    };
+    const char *q;
+    int is_utc, len;
+    char lastch;
+    int negative = 0;
+
+#undef time
+    time_t now = time(0);
+
+    len = strlen(datestr);
+    if (len > 0)
+        lastch = datestr[len - 1];
+    else
+        lastch = '\0';
+    is_utc = (lastch == 'z' || lastch == 'Z');
+
+    memset(&dt, 0, sizeof(dt));
+
+    p = datestr;
+    q = NULL;
+    if (!duration) {
+        if (!strncasecmp(datestr, "now", len)) {
+            *timeval = (int64_t) now * 1000000;
+            return 0;
+        }
+
+        /* parse the year-month-day part */
+        for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) {
+            q = small_strptime(p, date_fmt[i], &dt);
+            if (q) {
+                break;
+            }
+        }
+
+        /* if the year-month-day part is missing, then take the
+         * current year-month-day time */
+        if (!q) {
+            if (is_utc) {
+                dt = *gmtime(&now);
+            } else {
+                dt = *localtime(&now);
+            }
+            dt.tm_hour = dt.tm_min = dt.tm_sec = 0;
+        } else {
+            p = q;
+        }
+
+        if (*p == 'T' || *p == 't' || *p == ' ')
+            p++;
+
+        /* parse the hour-minute-second part */
+        for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) {
+            q = small_strptime(p, time_fmt[i], &dt);
+            if (q) {
+                break;
+            }
+        }
+    } else {
+        /* parse datestr as a duration */
+        if (p[0] == '-') {
+            negative = 1;
+            ++p;
+        }
+        /* parse datestr as HH:MM:SS */
+        q = small_strptime(p, time_fmt[0], &dt);
+        if (!q) {
+            /* parse datestr as S+ */
+            dt.tm_sec = strtol(p, (char **)&q, 10);
+            if (q == p) {
+                /* the parsing didn't succeed */
+                *timeval = INT64_MIN;
+                return AVERROR(EINVAL);
+            }
+            dt.tm_min = 0;
+            dt.tm_hour = 0;
+        }
+    }
+
+    /* Now we have all the fields that we can get */
+    if (!q) {
+        *timeval = INT64_MIN;
+        return AVERROR(EINVAL);
+    }
+
+    if (duration) {
+        t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec;
+    } else {
+        dt.tm_isdst = -1;       /* unknown */
+        if (is_utc) {
+            t = mktimegm(&dt);
+        } else {
+            t = mktime(&dt);
+        }
+    }
+
+    t *= 1000000;
+
+    /* parse the .m... part */
+    if (*q == '.') {
+        int val, n;
+        q++;
+        for (val = 0, n = 100000; n >= 1; n /= 10, q++) {
+            if (!isdigit(*q))
+                break;
+            val += n * (*q - '0');
+        }
+        t += val;
+    }
+    *timeval = negative ? -t : t;
+    return 0;
+}
+
+int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
+{
+    const char *p;
+    char tag[128], *q;
+
+    p = info;
+    if (*p == '?')
+        p++;
+    for(;;) {
+        q = tag;
+        while (*p != '\0' && *p != '=' && *p != '&') {
+            if ((q - tag) < sizeof(tag) - 1)
+                *q++ = *p;
+            p++;
+        }
+        *q = '\0';
+        q = arg;
+        if (*p == '=') {
+            p++;
+            while (*p != '&' && *p != '\0') {
+                if ((q - arg) < arg_size - 1) {
+                    if (*p == '+')
+                        *q++ = ' ';
+                    else
+                        *q++ = *p;
+                }
+                p++;
+            }
+        }
+        *q = '\0';
+        if (!strcmp(tag, tag1))
+            return 1;
+        if (*p != '&')
+            break;
+        p++;
+    }
+    return 0;
+}
+
+#ifdef TEST
+
+#undef printf
+
+int main(void)
+{
+    printf("Testing av_parse_video_rate()\n");
+    {
+        int i;
+        const char *rates[] = {
+            "-inf",
+            "inf",
+            "nan",
+            "123/0",
+            "-123 / 0",
+            "",
+            "/",
+            " 123  /  321",
+            "foo/foo",
+            "foo/1",
+            "1/foo",
+            "0/0",
+            "/0",
+            "1/",
+            "1",
+            "0",
+            "-123/123",
+            "-foo",
+            "123.23",
+            ".23",
+            "-.23",
+            "-0.234",
+            "-0.0000001",
+            "  21332.2324   ",
+            " -21332.2324   ",
+        };
+
+        for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
+            int ret;
+            AVRational q = (AVRational){0, 0};
+            ret = av_parse_video_rate(&q, rates[i]),
+            printf("'%s' -> %d/%d ret:%d\n",
+                   rates[i], q.num, q.den, ret);
+        }
+    }
+
+    printf("\nTesting av_parse_color()\n");
+    {
+        int i;
+        uint8_t rgba[4];
+        const char *color_names[] = {
+            "bikeshed",
+            "RaNdOm",
+            "foo",
+            "red",
+            "Red ",
+            "RED",
+            "Violet",
+            "Yellow",
+            "Red",
+            "0x000000",
+            "0x0000000",
+            "0xff000000",
+            "0x3e34ff",
+            "0x3e34ffaa",
+            "0xffXXee",
+            "0xfoobar",
+            "0xffffeeeeeeee",
+            "#ff0000",
+            "#ffXX00",
+            "ff0000",
+            "ffXX00",
+            "red at foo",
+            "random at 10",
+            "0xff0000 at 1.0",
+            "red@",
+            "red at 0xfff",
+            "red at 0xf",
+            "red at 2",
+            "red at 0.1",
+            "red at -1",
+            "red at 0.5",
+            "red at 1.0",
+            "red at 256",
+            "red at 10foo",
+            "red at -1.0",
+            "red at -0.0",
+        };
+
+        av_log_set_level(AV_LOG_DEBUG);
+
+        for (i = 0;  i < FF_ARRAY_ELEMS(color_names); i++) {
+            if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
+                printf("%s -> R(%d) G(%d) B(%d) A(%d)\n", color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
+        }
+    }
+
+    return 0;
+}
+
+#endif /* TEST */
diff --git a/ffmpeg-mt/libavutil/parseutils.h b/ffmpeg-mt/libavutil/parseutils.h
new file mode 100644
index 0000000..c0f9aec
--- /dev/null
+++ b/ffmpeg-mt/libavutil/parseutils.h
@@ -0,0 +1,117 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_PARSEUTILS_H
+#define AVUTIL_PARSEUTILS_H
+
+#include "libavutil/rational.h"
+
+/**
+ * @file
+ * misc parsing utilities
+ */
+
+/**
+ * Parse str and put in width_ptr and height_ptr the detected values.
+ *
+ * @param[in,out] width_ptr pointer to the variable which will contain the detected
+ * width value
+ * @param[in,out] height_ptr pointer to the variable which will contain the detected
+ * height value
+ * @param[in] str the string to parse: it has to be a string in the format
+ * width x height or a valid video size abbreviation.
+ * @return >= 0 on success, a negative error code otherwise
+ */
+int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str);
+
+/**
+ * Parse str and store the detected values in *rate.
+ *
+ * @param[in,out] rate pointer to the AVRational which will contain the detected
+ * frame rate
+ * @param[in] str the string to parse: it has to be a string in the format
+ * rate_num / rate_den, a float number or a valid video rate abbreviation
+ * @return >= 0 on success, a negative error code otherwise
+ */
+int av_parse_video_rate(AVRational *rate, const char *str);
+
+/**
+ * Put the RGBA values that correspond to color_string in rgba_color.
+ *
+ * @param color_string a string specifying a color. It can be the name of
+ * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence,
+ * possibly followed by "@" and a string representing the alpha
+ * component.
+ * The alpha component may be a string composed by "0x" followed by an
+ * hexadecimal number or a decimal number between 0.0 and 1.0, which
+ * represents the opacity value (0x00/0.0 means completely transparent,
+ * 0xff/1.0 completely opaque).
+ * If the alpha component is not specified then 0xff is assumed.
+ * The string "random" will result in a random color.
+ * @param slen length of the initial part of color_string containing the
+ * color. It can be set to -1 if color_string is a null terminated string
+ * containing nothing else than the color.
+ * @return >= 0 in case of success, a negative value in case of
+ * failure (for example if color_string cannot be parsed).
+ */
+int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
+                   void *log_ctx);
+
+/**
+ * Parses timestr and returns in *time a corresponding number of
+ * microseconds.
+ *
+ * @param timeval puts here the number of microseconds corresponding
+ * to the string in timestr. If the string represents a duration, it
+ * is the number of microseconds contained in the time interval.  If
+ * the string is a date, is the number of microseconds since 1st of
+ * January, 1970 up to the time of the parsed date.  If timestr cannot
+ * be successfully parsed, set *time to INT64_MIN.
+
+ * @param datestr a string representing a date or a duration.
+ * - If a date the syntax is:
+ * @code
+ * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z]
+ * now
+ * @endcode
+ * If the value is "now" it takes the current time.
+ * Time is local time unless Z is appended, in which case it is
+ * interpreted as UTC.
+ * If the year-month-day part is not specified it takes the current
+ * year-month-day.
+ * - If a duration the syntax is:
+ * @code
+ * [-]HH[:MM[:SS[.m...]]]
+ * [-]S+[.m...]
+ * @endcode
+ * @param duration flag which tells how to interpret timestr, if not
+ * zero timestr is interpreted as a duration, otherwise as a date
+ * @return 0 in case of success, a negative value corresponding to an
+ * AVERROR code otherwise
+ */
+int av_parse_time(int64_t *timeval, const char *timestr, int duration);
+
+/**
+ * Attempt to find a specific tag in a URL.
+ *
+ * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
+ * Return 1 if found.
+ */
+int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
+
+#endif /* AVUTIL_PARSEUTILS_H */
diff --git a/ffmpeg-mt/libavutil/pca.c b/ffmpeg-mt/libavutil/pca.c
index ce08e9c..770dc8d 100644
--- a/ffmpeg-mt/libavutil/pca.c
+++ b/ffmpeg-mt/libavutil/pca.c
@@ -2,20 +2,20 @@
  * principal component analysis (PCA)
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/pca.h b/ffmpeg-mt/libavutil/pca.h
index 00ddd60..436f122 100644
--- a/ffmpeg-mt/libavutil/pca.h
+++ b/ffmpeg-mt/libavutil/pca.h
@@ -2,20 +2,20 @@
  * principal component analysis (PCA)
  * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/pixdesc.c b/ffmpeg-mt/libavutil/pixdesc.c
index 83aa8b0..55d2deb 100644
--- a/ffmpeg-mt/libavutil/pixdesc.c
+++ b/ffmpeg-mt/libavutil/pixdesc.c
@@ -2,20 +2,20 @@
  * pixel format descriptor
  * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/pixdesc.h b/ffmpeg-mt/libavutil/pixdesc.h
index 727e47f..cb75641 100644
--- a/ffmpeg-mt/libavutil/pixdesc.h
+++ b/ffmpeg-mt/libavutil/pixdesc.h
@@ -2,20 +2,20 @@
  * pixel format descriptor
  * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/pixfmt.h b/ffmpeg-mt/libavutil/pixfmt.h
index 8ec91c8..9877724 100644
--- a/ffmpeg-mt/libavutil/pixfmt.h
+++ b/ffmpeg-mt/libavutil/pixfmt.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/ppc/cpu.c b/ffmpeg-mt/libavutil/ppc/cpu.c
index 9dc9471..85c1f2c 100644
--- a/ffmpeg-mt/libavutil/ppc/cpu.c
+++ b/ffmpeg-mt/libavutil/ppc/cpu.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/ppc/intreadwrite.h b/ffmpeg-mt/libavutil/ppc/intreadwrite.h
index 3667703..fec54e6 100644
--- a/ffmpeg-mt/libavutil/ppc/intreadwrite.h
+++ b/ffmpeg-mt/libavutil/ppc/intreadwrite.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/ppc/timer.h b/ffmpeg-mt/libavutil/ppc/timer.h
index 155fc01..0981d0c 100644
--- a/ffmpeg-mt/libavutil/ppc/timer.h
+++ b/ffmpeg-mt/libavutil/ppc/timer.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2005 Luca Barbato <lu_zero at gentoo.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/random_seed.c b/ffmpeg-mt/libavutil/random_seed.c
index db1ba39..6dc8d22 100644
--- a/ffmpeg-mt/libavutil/random_seed.c
+++ b/ffmpeg-mt/libavutil/random_seed.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/random_seed.h b/ffmpeg-mt/libavutil/random_seed.h
index 7f75063..8157d42 100644
--- a/ffmpeg-mt/libavutil/random_seed.h
+++ b/ffmpeg-mt/libavutil/random_seed.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier at gmail.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/rational.c b/ffmpeg-mt/libavutil/rational.c
index 701f067..b2b05cc 100644
--- a/ffmpeg-mt/libavutil/rational.c
+++ b/ffmpeg-mt/libavutil/rational.c
@@ -2,20 +2,20 @@
  * rational numbers
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/rational.h b/ffmpeg-mt/libavutil/rational.h
index 789e4ac..a487114 100644
--- a/ffmpeg-mt/libavutil/rational.h
+++ b/ffmpeg-mt/libavutil/rational.h
@@ -2,20 +2,20 @@
  * rational numbers
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/rc4.c b/ffmpeg-mt/libavutil/rc4.c
index 4e52ba5..3bf710f 100644
--- a/ffmpeg-mt/libavutil/rc4.c
+++ b/ffmpeg-mt/libavutil/rc4.c
@@ -4,20 +4,20 @@
  *
  * loosely based on LibTomCrypt by Tom St Denis
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avutil.h"
diff --git a/ffmpeg-mt/libavutil/rc4.h b/ffmpeg-mt/libavutil/rc4.h
index 07223a5..dc5066d 100644
--- a/ffmpeg-mt/libavutil/rc4.h
+++ b/ffmpeg-mt/libavutil/rc4.h
@@ -1,20 +1,20 @@
 /*
  * RC4 encryption/decryption/pseudo-random number generator
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/samplefmt.c b/ffmpeg-mt/libavutil/samplefmt.c
new file mode 100644
index 0000000..06b50d9
--- /dev/null
+++ b/ffmpeg-mt/libavutil/samplefmt.c
@@ -0,0 +1,73 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "samplefmt.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct SampleFmtInfo {
+    const char *name;
+    int bits;
+} SampleFmtInfo;
+
+/** this table gives more information about formats */
+static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = {
+    [AV_SAMPLE_FMT_U8]  = { .name = "u8",  .bits = 8 },
+    [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 },
+    [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 },
+    [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 },
+    [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 },
+};
+
+const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
+{
+    if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
+        return NULL;
+    return sample_fmt_info[sample_fmt].name;
+}
+
+enum AVSampleFormat av_get_sample_fmt(const char *name)
+{
+    int i;
+
+    for (i = 0; i < AV_SAMPLE_FMT_NB; i++)
+        if (!strcmp(sample_fmt_info[i].name, name))
+            return i;
+    return AV_SAMPLE_FMT_NONE;
+}
+
+char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt)
+{
+    /* print header */
+    if (sample_fmt < 0)
+        snprintf(buf, buf_size, "name  " " depth");
+    else if (sample_fmt < AV_SAMPLE_FMT_NB) {
+        SampleFmtInfo info = sample_fmt_info[sample_fmt];
+        snprintf (buf, buf_size, "%-6s" "   %2d ", info.name, info.bits);
+    }
+
+    return buf;
+}
+
+int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt)
+{
+    return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ?
+        0 : sample_fmt_info[sample_fmt].bits;
+}
diff --git a/ffmpeg-mt/libavutil/samplefmt.h b/ffmpeg-mt/libavutil/samplefmt.h
new file mode 100644
index 0000000..2326f4a
--- /dev/null
+++ b/ffmpeg-mt/libavutil/samplefmt.h
@@ -0,0 +1,70 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_SAMPLEFMT_H
+#define AVUTIL_SAMPLEFMT_H
+
+/**
+ * all in native-endian format
+ */
+enum AVSampleFormat {
+    AV_SAMPLE_FMT_NONE = -1,
+    AV_SAMPLE_FMT_U8,          ///< unsigned 8 bits
+    AV_SAMPLE_FMT_S16,         ///< signed 16 bits
+    AV_SAMPLE_FMT_S32,         ///< signed 32 bits
+    AV_SAMPLE_FMT_FLT,         ///< float
+    AV_SAMPLE_FMT_DBL,         ///< double
+    AV_SAMPLE_FMT_NB           ///< Number of sample formats. DO NOT USE if linking dynamically
+};
+
+/**
+ * Return the name of sample_fmt, or NULL if sample_fmt is not
+ * recognized.
+ */
+const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
+
+/**
+ * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
+ * on error.
+ */
+enum AVSampleFormat av_get_sample_fmt(const char *name);
+
+/**
+ * Generate a string corresponding to the sample format with
+ * sample_fmt, or a header if sample_fmt is negative.
+ *
+ * @param buf the buffer where to write the string
+ * @param buf_size the size of buf
+ * @param sample_fmt the number of the sample format to print the
+ * corresponding info string, or a negative value to print the
+ * corresponding header.
+ * @return the pointer to the filled buffer or NULL if sample_fmt is
+ * unknown or in case of other errors
+ */
+char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
+
+/**
+ * Return sample format bits per sample.
+ *
+ * @param sample_fmt the sample format
+ * @return number of bits per sample or zero if unknown for the given
+ * sample format
+ */
+int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt);
+
+#endif /* AVUTIL_SAMPLEFMT_H */
diff --git a/ffmpeg-mt/libavutil/sh4/bswap.h b/ffmpeg-mt/libavutil/sh4/bswap.h
index 48dd27f..1ff1bfd 100644
--- a/ffmpeg-mt/libavutil/sh4/bswap.h
+++ b/ffmpeg-mt/libavutil/sh4/bswap.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/sha.c b/ffmpeg-mt/libavutil/sha.c
index 2657f7e..6d9c84e 100644
--- a/ffmpeg-mt/libavutil/sha.c
+++ b/ffmpeg-mt/libavutil/sha.c
@@ -4,20 +4,20 @@
  * based on public domain SHA-1 code by Steve Reid <steve at edmweb.com>
  * and on BSD-licensed SHA-2 code by Aaron D. Gifford
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/sha.h b/ffmpeg-mt/libavutil/sha.h
index 543f5a1..df261fa 100644
--- a/ffmpeg-mt/libavutil/sha.h
+++ b/ffmpeg-mt/libavutil/sha.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/sha1.h b/ffmpeg-mt/libavutil/sha1.h
index 3ff5804..b60d770 100644
--- a/ffmpeg-mt/libavutil/sha1.h
+++ b/ffmpeg-mt/libavutil/sha1.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2007 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/softfloat.c b/ffmpeg-mt/libavutil/softfloat.c
index efa0420..55969fb 100644
--- a/ffmpeg-mt/libavutil/softfloat.c
+++ b/ffmpeg-mt/libavutil/softfloat.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/softfloat.h b/ffmpeg-mt/libavutil/softfloat.h
index 97e09ea..3078bd7 100644
--- a/ffmpeg-mt/libavutil/softfloat.h
+++ b/ffmpeg-mt/libavutil/softfloat.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/timer.h b/ffmpeg-mt/libavutil/timer.h
index cd8fba8..a2ca5cf 100644
--- a/ffmpeg-mt/libavutil/timer.h
+++ b/ffmpeg-mt/libavutil/timer.h
@@ -4,20 +4,20 @@
  *
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/tomi/intreadwrite.h b/ffmpeg-mt/libavutil/tomi/intreadwrite.h
index 778b804..9295004 100644
--- a/ffmpeg-mt/libavutil/tomi/intreadwrite.h
+++ b/ffmpeg-mt/libavutil/tomi/intreadwrite.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/tree.c b/ffmpeg-mt/libavutil/tree.c
index 8769c76..067e5b0 100644
--- a/ffmpeg-mt/libavutil/tree.c
+++ b/ffmpeg-mt/libavutil/tree.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/tree.h b/ffmpeg-mt/libavutil/tree.h
index bf09fd0..9115e2f 100644
--- a/ffmpeg-mt/libavutil/tree.h
+++ b/ffmpeg-mt/libavutil/tree.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -67,7 +67,7 @@ void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *ke
  *                 return av_tree_insert(rootp, key, cmp, next);
  *             }
  *             void *tree_remove(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b, AVTreeNode **next)){
- *                 if(*next) av_freep(next);
+ *                 av_freep(next);
  *                 return av_tree_insert(rootp, key, cmp, next);
  *             }
  *             @endcode
diff --git a/ffmpeg-mt/libavutil/utils.c b/ffmpeg-mt/libavutil/utils.c
index 8a1d32e..042e735 100644
--- a/ffmpeg-mt/libavutil/utils.c
+++ b/ffmpeg-mt/libavutil/utils.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,11 +31,11 @@ unsigned avutil_version(void)
 
 const char *avutil_configuration(void)
 {
-    return FFMPEG_CONFIGURATION;
+    return LIBAV_CONFIGURATION;
 }
 
 const char *avutil_license(void)
 {
 #define LICENSE_PREFIX "libavutil license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+    return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
diff --git a/ffmpeg-mt/libavutil/x86/bswap.h b/ffmpeg-mt/libavutil/x86/bswap.h
index b6ceb76..28e3fec 100644
--- a/ffmpeg-mt/libavutil/x86/bswap.h
+++ b/ffmpeg-mt/libavutil/x86/bswap.h
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/x86/cpu.c b/ffmpeg-mt/libavutil/x86/cpu.c
index 4b6cb0d..78aeadf 100644
--- a/ffmpeg-mt/libavutil/x86/cpu.c
+++ b/ffmpeg-mt/libavutil/x86/cpu.c
@@ -3,20 +3,20 @@
  * (c)1997-99 by H. Dietz and R. Fisher
  * Converted to C and improved by Fabrice Bellard.
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -35,6 +35,9 @@
            "=c" (ecx), "=d" (edx)\
          : "0" (index));
 
+#define xgetbv(index,eax,edx)                                   \
+    __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index))
+
 /* Function to test if multimedia instructions are supported...  */
 int ff_get_cpu_flags_x86(void)
 {
@@ -93,6 +96,15 @@ int ff_get_cpu_flags_x86(void)
             rval |= AV_CPU_FLAG_SSE4;
         if (ecx & 0x00100000 )
             rval |= AV_CPU_FLAG_SSE42;
+#if HAVE_AVX
+        /* Check OXSAVE and AVX bits */
+        if ((ecx & 0x18000000) == 0x18000000) {
+            /* Check for OS support */
+            xgetbv(0, eax, edx);
+            if ((eax & 0x6) == 0x6)
+                rval |= AV_CPU_FLAG_AVX;
+        }
+#endif
 #endif
                   ;
     }
@@ -109,15 +121,38 @@ int ff_get_cpu_flags_x86(void)
             rval |= AV_CPU_FLAG_MMX;
         if (ext_caps & (1<<22))
             rval |= AV_CPU_FLAG_MMX2;
+
+        /* Allow for selectively disabling SSE2 functions on AMD processors
+           with SSE2 support but not SSE4a. This includes Athlon64, some
+           Opteron, and some Sempron processors. MMX, SSE, or 3DNow! are faster
+           than SSE2 often enough to utilize this special-case flag.
+           AV_CPU_FLAG_SSE2 and AV_CPU_FLAG_SSE2SLOW are both set in this case
+           so that SSE2 is used unless explicitly disabled by checking
+           AV_CPU_FLAG_SSE2SLOW. */
+        if (!strncmp(vendor.c, "AuthenticAMD", 12) &&
+            rval & AV_CPU_FLAG_SSE2 && !(ecx & 0x00000040)) {
+            rval |= AV_CPU_FLAG_SSE2SLOW;
+        }
     }
 
-    if (!strncmp(vendor.c, "GenuineIntel", 12) &&
-        family == 6 && (model == 9 || model == 13 || model == 14)) {
-        /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah")
-         * theoretically support sse2, but it's usually slower than mmx,
-         * so let's just pretend they don't. */
-        if (rval & AV_CPU_FLAG_SSE2) rval ^= AV_CPU_FLAG_SSE2SLOW|AV_CPU_FLAG_SSE2;
-        if (rval & AV_CPU_FLAG_SSE3) rval ^= AV_CPU_FLAG_SSE3SLOW|AV_CPU_FLAG_SSE3;
+    if (!strncmp(vendor.c, "GenuineIntel", 12)) {
+        if (family == 6 && (model == 9 || model == 13 || model == 14)) {
+            /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah")
+            * theoretically support sse2, but it's usually slower than mmx,
+            * so let's just pretend they don't. AV_CPU_FLAG_SSE2 is disabled and
+            * AV_CPU_FLAG_SSE2SLOW is enabled so that SSE2 is not used unless
+            * explicitly enabled by checking AV_CPU_FLAG_SSE2SLOW. The same
+            * situation applies for AV_CPU_FLAG_SSE3 and AV_CPU_FLAG_SSE3SLOW. */
+            if (rval & AV_CPU_FLAG_SSE2) rval ^= AV_CPU_FLAG_SSE2SLOW|AV_CPU_FLAG_SSE2;
+            if (rval & AV_CPU_FLAG_SSE3) rval ^= AV_CPU_FLAG_SSE3SLOW|AV_CPU_FLAG_SSE3;
+        }
+        /* The Atom processor has SSSE3 support, which is useful in many cases,
+         * but sometimes the SSSE3 version is slower than the SSE2 equivalent
+         * on the Atom, but is generally faster on other processors supporting
+         * SSSE3. This flag allows for selectively disabling certain SSSE3
+         * functions on the Atom. */
+        if (family == 6 && model == 28)
+            rval |= AV_CPU_FLAG_ATOM;
     }
 
     return rval;
diff --git a/ffmpeg-mt/libavutil/x86/intmath.h b/ffmpeg-mt/libavutil/x86/intmath.h
index f3acddc..a7e82b1 100644
--- a/ffmpeg-mt/libavutil/x86/intmath.h
+++ b/ffmpeg-mt/libavutil/x86/intmath.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/x86/intreadwrite.h b/ffmpeg-mt/libavutil/x86/intreadwrite.h
index 4061d19..635096e 100644
--- a/ffmpeg-mt/libavutil/x86/intreadwrite.h
+++ b/ffmpeg-mt/libavutil/x86/intreadwrite.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2010 Alexander Strange <astrange at ithinksw.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/x86/timer.h b/ffmpeg-mt/libavutil/x86/timer.h
index 62a111f..7f51816 100644
--- a/ffmpeg-mt/libavutil/x86/timer.h
+++ b/ffmpeg-mt/libavutil/x86/timer.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libavutil/x86_cpu.h b/ffmpeg-mt/libavutil/x86_cpu.h
index c3341c2..f84eba6 100644
--- a/ffmpeg-mt/libavutil/x86_cpu.h
+++ b/ffmpeg-mt/libavutil/x86_cpu.h
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libpostproc/postprocess.c b/ffmpeg-mt/libpostproc/postprocess.c
index 92c822b..73ffcb4 100644
--- a/ffmpeg-mt/libpostproc/postprocess.c
+++ b/ffmpeg-mt/libpostproc/postprocess.c
@@ -3,20 +3,20 @@
  *
  * AltiVec optimizations (C) 2004 Romain Dolbeau <romain at dolbeau.org>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with FFmpeg; if not, write to the Free Software
+ * along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -71,7 +71,7 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
 ...
 */
 
-//Changelog: use the Subversion log
+//Changelog: use git log
 
 #include "config.h"
 #include "libavutil/avutil.h"
@@ -94,13 +94,13 @@ unsigned postproc_version(void)
 
 const char *postproc_configuration(void)
 {
-    return FFMPEG_CONFIGURATION;
+    return LIBAV_CONFIGURATION;
 }
 
 const char *postproc_license(void)
 {
 #define LICENSE_PREFIX "libpostproc license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+    return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
 
 #if HAVE_ALTIVEC_H
diff --git a/ffmpeg-mt/libpostproc/postprocess.h b/ffmpeg-mt/libpostproc/postprocess.h
index 0713c47..96a1dbe 100644
--- a/ffmpeg-mt/libpostproc/postprocess.h
+++ b/ffmpeg-mt/libpostproc/postprocess.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2003 Michael Niedermayer (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with FFmpeg; if not, write to the Free Software
+ * along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libpostproc/postprocess_altivec_template.c b/ffmpeg-mt/libpostproc/postprocess_altivec_template.c
index c53ebc0..56d7b16 100644
--- a/ffmpeg-mt/libpostproc/postprocess_altivec_template.c
+++ b/ffmpeg-mt/libpostproc/postprocess_altivec_template.c
@@ -3,20 +3,20 @@
  *
  * based on code by Copyright (C) 2001-2003 Michael Niedermayer (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with FFmpeg; if not, write to the Free Software
+ * along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libpostproc/postprocess_internal.h b/ffmpeg-mt/libpostproc/postprocess_internal.h
index 3bc51c4..010e629 100644
--- a/ffmpeg-mt/libpostproc/postprocess_internal.h
+++ b/ffmpeg-mt/libpostproc/postprocess_internal.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2002 Michael Niedermayer (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with FFmpeg; if not, write to the Free Software
+ * along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libpostproc/postprocess_template.c b/ffmpeg-mt/libpostproc/postprocess_template.c
index 918d005..3b6d0f8 100644
--- a/ffmpeg-mt/libpostproc/postprocess_template.c
+++ b/ffmpeg-mt/libpostproc/postprocess_template.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2002 Michael Niedermayer (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or modify
+ * Libav is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with FFmpeg; if not, write to the Free Software
+ * along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/Makefile b/ffmpeg-mt/libswscale/Makefile
index 8c5c4b9..6976079 100644
--- a/ffmpeg-mt/libswscale/Makefile
+++ b/ffmpeg-mt/libswscale/Makefile
@@ -20,4 +20,3 @@ TESTPROGS = colorspace swscale
 DIRS = bfin mlib ppc sparc x86
 
 include $(SUBDIR)../subdir.mak
-$(SUBDIR)swscale-test$(EXESUF): ELIBS = -lavcore
diff --git a/ffmpeg-mt/libswscale/bfin/internal_bfin.S b/ffmpeg-mt/libswscale/bfin/internal_bfin.S
index 5af4654..dea2321 100644
--- a/ffmpeg-mt/libswscale/bfin/internal_bfin.S
+++ b/ffmpeg-mt/libswscale/bfin/internal_bfin.S
@@ -5,20 +5,20 @@
  * Blackfin video color space converter operations
  * convert I420 YV12 to RGB in various formats
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/bfin/swscale_bfin.c b/ffmpeg-mt/libswscale/bfin/swscale_bfin.c
index ce2f172..fa3c03b 100644
--- a/ffmpeg-mt/libswscale/bfin/swscale_bfin.c
+++ b/ffmpeg-mt/libswscale/bfin/swscale_bfin.c
@@ -3,20 +3,20 @@
  *
  * Blackfin software video scaler operations
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/bfin/yuv2rgb_bfin.c b/ffmpeg-mt/libswscale/bfin/yuv2rgb_bfin.c
index eaa83ea..68af522 100644
--- a/ffmpeg-mt/libswscale/bfin/yuv2rgb_bfin.c
+++ b/ffmpeg-mt/libswscale/bfin/yuv2rgb_bfin.c
@@ -4,20 +4,20 @@
  * Blackfin video color space converter operations
  * convert I420 YV12 to RGB in various formats
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/colorspace-test.c b/ffmpeg-mt/libswscale/colorspace-test.c
index 50db7d0..4e7116f 100644
--- a/ffmpeg-mt/libswscale/colorspace-test.c
+++ b/ffmpeg-mt/libswscale/colorspace-test.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/mlib/yuv2rgb_mlib.c b/ffmpeg-mt/libswscale/mlib/yuv2rgb_mlib.c
index e9f1149..526c975 100644
--- a/ffmpeg-mt/libswscale/mlib/yuv2rgb_mlib.c
+++ b/ffmpeg-mt/libswscale/mlib/yuv2rgb_mlib.c
@@ -3,20 +3,20 @@
  *
  * Copyright (C) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/options.c b/ffmpeg-mt/libswscale/options.c
index 5817d3f..59b9994 100644
--- a/ffmpeg-mt/libswscale/options.c
+++ b/ffmpeg-mt/libswscale/options.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/ppc/swscale_altivec_template.c b/ffmpeg-mt/libswscale/ppc/swscale_altivec_template.c
index 299fe51..b123f70 100644
--- a/ffmpeg-mt/libswscale/ppc/swscale_altivec_template.c
+++ b/ffmpeg-mt/libswscale/ppc/swscale_altivec_template.c
@@ -4,20 +4,20 @@
  * Copyright (C) 2004 Romain Dolbeau <romain at dolbeau.org>
  * based on the equivalent C code in swscale.c
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/ppc/yuv2rgb_altivec.c b/ffmpeg-mt/libswscale/ppc/yuv2rgb_altivec.c
index bf605bc..0113c8d 100644
--- a/ffmpeg-mt/libswscale/ppc/yuv2rgb_altivec.c
+++ b/ffmpeg-mt/libswscale/ppc/yuv2rgb_altivec.c
@@ -3,20 +3,20 @@
  *
  * copyright (C) 2004 Marc Hoffman <marc.hoffman at analog.com>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/rgb2rgb.c b/ffmpeg-mt/libswscale/rgb2rgb.c
index 7226853..bc0ed63 100644
--- a/ffmpeg-mt/libswscale/rgb2rgb.c
+++ b/ffmpeg-mt/libswscale/rgb2rgb.c
@@ -6,20 +6,20 @@
  * Written by Nick Kurshev.
  * palette & YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <inttypes.h>
diff --git a/ffmpeg-mt/libswscale/rgb2rgb.h b/ffmpeg-mt/libswscale/rgb2rgb.h
index 31e21af..1ef4fee 100644
--- a/ffmpeg-mt/libswscale/rgb2rgb.h
+++ b/ffmpeg-mt/libswscale/rgb2rgb.h
@@ -6,20 +6,20 @@
  *  Written by Nick Kurshev.
  *  YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/rgb2rgb_template.c b/ffmpeg-mt/libswscale/rgb2rgb_template.c
index 6e74366..d217c07 100644
--- a/ffmpeg-mt/libswscale/rgb2rgb_template.c
+++ b/ffmpeg-mt/libswscale/rgb2rgb_template.c
@@ -7,20 +7,20 @@
  * palette & YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
  * lot of big-endian byte order fixes by Alex Beregszaszi
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -329,7 +329,7 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_
         "movq           %4, %%mm6   \n\t"
         "movq           %5, %%mm7   \n\t"
         "jmp 2f                     \n\t"
-        ASMALIGN(4)
+        ".p2align        4          \n\t"
         "1:                         \n\t"
         PREFETCH"   32(%1)          \n\t"
         "movd         (%1), %%mm0   \n\t"
@@ -484,7 +484,7 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_
         "movq           %4, %%mm6   \n\t"
         "movq           %5, %%mm7   \n\t"
         "jmp            2f          \n\t"
-        ASMALIGN(4)
+        ".p2align        4          \n\t"
         "1:                         \n\t"
         PREFETCH"   32(%1)          \n\t"
         "movd         (%1), %%mm0   \n\t"
@@ -1239,7 +1239,7 @@ static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst,
         "pxor          %4, %%mm7        \n\t"
         "movq       %%mm7, %%mm6        \n\t"
         "pxor          %5, %%mm7        \n\t"
-        ASMALIGN(4)
+        ".p2align       4               \n\t"
         "1:                             \n\t"
         PREFETCH"     32(%1, %0)        \n\t"
         "movq           (%1, %0), %%mm0 \n\t"
@@ -1300,7 +1300,7 @@ static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long s
         "movq     "MANGLE(mask24r)", %%mm5              \n\t"
         "movq     "MANGLE(mask24g)", %%mm6              \n\t"
         "movq     "MANGLE(mask24b)", %%mm7              \n\t"
-        ASMALIGN(4)
+        ".p2align                 4                     \n\t"
         "1:                                             \n\t"
         PREFETCH" 32(%1, %%"REG_a")                     \n\t"
         "movq       (%1, %%"REG_a"), %%mm0              \n\t" // BGR BGR BG
@@ -1369,7 +1369,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u
         //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
         __asm__ volatile(
             "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            ASMALIGN(4)
+            ".p2align                    4              \n\t"
             "1:                                         \n\t"
             PREFETCH"    32(%1, %%"REG_a", 2)           \n\t"
             PREFETCH"    32(%2, %%"REG_a")              \n\t"
@@ -1519,7 +1519,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u
         //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
         __asm__ volatile(
             "xor                %%"REG_a", %%"REG_a"    \n\t"
-            ASMALIGN(4)
+            ".p2align                   4               \n\t"
             "1:                                         \n\t"
             PREFETCH"   32(%1, %%"REG_a", 2)            \n\t"
             PREFETCH"   32(%2, %%"REG_a")               \n\t"
@@ -1648,7 +1648,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
             "xor                 %%"REG_a", %%"REG_a"   \n\t"
             "pcmpeqw                 %%mm7, %%mm7       \n\t"
             "psrlw                      $8, %%mm7       \n\t" // FF,00,FF,00...
-            ASMALIGN(4)
+            ".p2align                    4              \n\t"
             "1:                \n\t"
             PREFETCH" 64(%0, %%"REG_a", 4)              \n\t"
             "movq       (%0, %%"REG_a", 4), %%mm0       \n\t" // YUYV YUYV(0)
@@ -1701,7 +1701,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
 
         __asm__ volatile(
             "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            ASMALIGN(4)
+            ".p2align                    4              \n\t"
             "1:                                         \n\t"
             PREFETCH" 64(%0, %%"REG_a", 4)              \n\t"
             "movq       (%0, %%"REG_a", 4), %%mm0       \n\t" // YUYV YUYV(0)
@@ -1884,7 +1884,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
             "xor                 %%"REG_a", %%"REG_a"   \n\t"
             "pcmpeqw             %%mm7, %%mm7   \n\t"
             "psrlw                  $8, %%mm7   \n\t" // FF,00,FF,00...
-            ASMALIGN(4)
+            ".p2align                4          \n\t"
             "1:                                 \n\t"
             PREFETCH" 64(%0, %%"REG_a", 4)          \n\t"
             "movq       (%0, %%"REG_a", 4), %%mm0   \n\t" // UYVY UYVY(0)
@@ -1937,7 +1937,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
 
         __asm__ volatile(
             "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            ASMALIGN(4)
+            ".p2align                    4          \n\t"
             "1:                                 \n\t"
             PREFETCH" 64(%0, %%"REG_a", 4)          \n\t"
             "movq       (%0, %%"REG_a", 4), %%mm0   \n\t" // YUYV YUYV(0)
@@ -2012,7 +2012,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
                 "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
                 "pxor                    %%mm7, %%mm7       \n\t"
                 "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
-                ASMALIGN(4)
+                ".p2align                    4              \n\t"
                 "1:                                         \n\t"
                 PREFETCH"    64(%0, %%"REG_d")              \n\t"
                 "movd          (%0, %%"REG_d"), %%mm0       \n\t"
@@ -2086,7 +2086,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
             "pxor                    %%mm7, %%mm7       \n\t"
             "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
             "add                 %%"REG_d", %%"REG_d"   \n\t"
-            ASMALIGN(4)
+            ".p2align                    4              \n\t"
             "1:                                         \n\t"
             PREFETCH"    64(%0, %%"REG_d")              \n\t"
             PREFETCH"    64(%1, %%"REG_d")              \n\t"
diff --git a/ffmpeg-mt/libswscale/sparc/yuv2rgb_vis.c b/ffmpeg-mt/libswscale/sparc/yuv2rgb_vis.c
index cc98f04..2111ea8 100644
--- a/ffmpeg-mt/libswscale/sparc/yuv2rgb_vis.c
+++ b/ffmpeg-mt/libswscale/sparc/yuv2rgb_vis.c
@@ -2,20 +2,20 @@
  * VIS optimized software YUV to RGB converter
  * Copyright (c) 2007 Denes Balatoni <dbalatoni at programozo.hu>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/swscale-test.c b/ffmpeg-mt/libswscale/swscale-test.c
index ae5f8b7..22d8a70 100644
--- a/ffmpeg-mt/libswscale/swscale-test.c
+++ b/ffmpeg-mt/libswscale/swscale-test.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
 #include <stdarg.h>
 
 #undef HAVE_AV_CONFIG_H
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/mem.h"
 #include "libavutil/avutil.h"
 #include "libavutil/crc.h"
@@ -104,8 +104,7 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
         int p;
 
         for (p = 0; p < 4; p++)
-            if (src[p])
-                av_freep(&src[p]);
+            av_freep(&src[p]);
 
         av_image_fill_linesizes(srcStride, srcFormat, srcW);
         for (p = 0; p < 4; p++) {
diff --git a/ffmpeg-mt/libswscale/swscale.c b/ffmpeg-mt/libswscale/swscale.c
index 375171f..ed6db72 100644
--- a/ffmpeg-mt/libswscale/swscale.c
+++ b/ffmpeg-mt/libswscale/swscale.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/swscale.h b/ffmpeg-mt/libswscale/swscale.h
index 3cc3202..aae1a6c 100644
--- a/ffmpeg-mt/libswscale/swscale.h
+++ b/ffmpeg-mt/libswscale/swscale.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -48,7 +48,7 @@
  * They may change, break or disappear at any time.
  */
 #ifndef FF_API_SWS_GETCONTEXT
-#define FF_API_SWS_GETCONTEXT  (LIBSWSCALE_VERSION_MAJOR < 1)
+#define FF_API_SWS_GETCONTEXT  (LIBSWSCALE_VERSION_MAJOR < 2)
 #endif
 
 /**
@@ -185,9 +185,9 @@ void sws_freeContext(struct SwsContext *swsContext);
  * @param dstFormat the destination image format
  * @param flags specify which algorithm and options to use for rescaling
  * @return a pointer to an allocated context, or NULL in case of error
- * @deprecated use sws_alloc_context() and sws_init_context()
+ * @note this function is to be removed after a saner alternative is
+ *       written
  */
-attribute_deprecated
 struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
                                   int dstW, int dstH, enum PixelFormat dstFormat,
                                   int flags, SwsFilter *srcFilter,
diff --git a/ffmpeg-mt/libswscale/swscale_internal.h b/ffmpeg-mt/libswscale/swscale_internal.h
index 19dff8f..631f1e0 100644
--- a/ffmpeg-mt/libswscale/swscale_internal.h
+++ b/ffmpeg-mt/libswscale/swscale_internal.h
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/swscale_template.c b/ffmpeg-mt/libswscale/swscale_template.c
index 34868ac..d23df42 100644
--- a/ffmpeg-mt/libswscale/swscale_template.c
+++ b/ffmpeg-mt/libswscale/swscale_template.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -55,7 +55,7 @@
         "movq                             %%mm3, %%mm4      \n\t"\
         "lea                     " offset "(%0), %%"REG_d"  \n\t"\
         "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
-        ASMALIGN(4) /* FIXME Unroll? */\
+        ".p2align                             4             \n\t" /* FIXME Unroll? */\
         "1:                                                 \n\t"\
         "movq                      8(%%"REG_d"), %%mm0      \n\t" /* filterCoeff */\
         "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
@@ -93,7 +93,7 @@
         "pxor                             %%mm6, %%mm6      \n\t"\
         "pxor                             %%mm7, %%mm7      \n\t"\
         "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
-        ASMALIGN(4) \
+        ".p2align                             4             \n\t"\
         "1:                                                 \n\t"\
         "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm0      \n\t" /* srcData */\
         "movq 8+"  x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
@@ -148,7 +148,7 @@
 
 #define YSCALEYUV2YV121 \
     "mov %2, %%"REG_a"                    \n\t"\
-    ASMALIGN(4) /* FIXME Unroll? */\
+    ".p2align               4             \n\t" /* FIXME Unroll? */\
     "1:                                   \n\t"\
     "movq  (%0, %%"REG_a", 2), %%mm0      \n\t"\
     "movq 8(%0, %%"REG_a", 2), %%mm1      \n\t"\
@@ -164,7 +164,7 @@
     "pcmpeqw %%mm7, %%mm7                 \n\t"\
     "psrlw                 $15, %%mm7     \n\t"\
     "psllw                  $6, %%mm7     \n\t"\
-    ASMALIGN(4) /* FIXME Unroll? */\
+    ".p2align                4            \n\t" /* FIXME Unroll? */\
     "1:                                   \n\t"\
     "movq  (%0, %%"REG_a", 2), %%mm0      \n\t"\
     "movq 8(%0, %%"REG_a", 2), %%mm1      \n\t"\
@@ -187,14 +187,14 @@
 #define YSCALEYUV2PACKEDX_UV \
     __asm__ volatile(\
         "xor                   %%"REG_a", %%"REG_a"     \n\t"\
-        ASMALIGN(4)\
+        ".p2align                      4                \n\t"\
         "nop                                            \n\t"\
         "1:                                             \n\t"\
         "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d"     \n\t"\
         "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
         "movq      "VROUNDER_OFFSET"(%0), %%mm3         \n\t"\
         "movq                      %%mm3, %%mm4         \n\t"\
-        ASMALIGN(4)\
+        ".p2align                      4                \n\t"\
         "2:                                             \n\t"\
         "movq               8(%%"REG_d"), %%mm0         \n\t" /* filterCoeff */\
         "movq     (%%"REG_S", %%"REG_a"), %%mm2         \n\t" /* UsrcData */\
@@ -213,7 +213,7 @@
     "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
     "movq      "VROUNDER_OFFSET"(%0), "#dst1"       \n\t"\
     "movq                    "#dst1", "#dst2"       \n\t"\
-    ASMALIGN(4)\
+    ".p2align                      4                \n\t"\
     "2:                                             \n\t"\
     "movq               8(%%"REG_d"), "#coeff"      \n\t" /* filterCoeff */\
     "movq  (%%"REG_S", %%"REG_a", 2), "#src1"       \n\t" /* Y1srcData */\
@@ -241,7 +241,7 @@
 #define YSCALEYUV2PACKEDX_ACCURATE_UV \
     __asm__ volatile(\
         "xor %%"REG_a", %%"REG_a"                       \n\t"\
-        ASMALIGN(4)\
+        ".p2align                      4                \n\t"\
         "nop                                            \n\t"\
         "1:                                             \n\t"\
         "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d"     \n\t"\
@@ -250,7 +250,7 @@
         "pxor                      %%mm5, %%mm5         \n\t"\
         "pxor                      %%mm6, %%mm6         \n\t"\
         "pxor                      %%mm7, %%mm7         \n\t"\
-        ASMALIGN(4)\
+        ".p2align                      4                \n\t"\
         "2:                                             \n\t"\
         "movq     (%%"REG_S", %%"REG_a"), %%mm0         \n\t" /* UsrcData */\
         "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm2         \n\t" /* VsrcData */\
@@ -295,7 +295,7 @@
     "pxor                      %%mm5, %%mm5         \n\t"\
     "pxor                      %%mm7, %%mm7         \n\t"\
     "pxor                      %%mm6, %%mm6         \n\t"\
-    ASMALIGN(4)\
+    ".p2align                      4                \n\t"\
     "2:                                             \n\t"\
     "movq  (%%"REG_S", %%"REG_a", 2), %%mm0         \n\t" /* Y1srcData */\
     "movq 8(%%"REG_S", %%"REG_a", 2), %%mm2         \n\t" /* Y2srcData */\
@@ -381,7 +381,7 @@
     "movq              %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\
     "movq              %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\
     "xor            "#index", "#index"                        \n\t"\
-    ASMALIGN(4)\
+    ".p2align              4            \n\t"\
     "1:                                 \n\t"\
     "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
     "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
@@ -413,7 +413,7 @@
 
 #define REAL_YSCALEYUV2RGB_UV(index, c) \
     "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
+    ".p2align              4            \n\t"\
     "1:                                 \n\t"\
     "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
     "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
@@ -488,7 +488,7 @@
 
 #define REAL_YSCALEYUV2PACKED1(index, c) \
     "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
+    ".p2align              4            \n\t"\
     "1:                                 \n\t"\
     "movq     (%2, "#index"), %%mm3     \n\t" /* uvbuf0[eax]*/\
     "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
@@ -503,7 +503,7 @@
 
 #define REAL_YSCALEYUV2RGB1(index, c) \
     "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
+    ".p2align              4            \n\t"\
     "1:                                 \n\t"\
     "movq     (%2, "#index"), %%mm3     \n\t" /* uvbuf0[eax]*/\
     "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
@@ -552,7 +552,7 @@
 
 #define REAL_YSCALEYUV2PACKED1b(index, c) \
     "xor "#index", "#index"             \n\t"\
-    ASMALIGN(4)\
+    ".p2align              4            \n\t"\
     "1:                                 \n\t"\
     "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
     "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
@@ -571,7 +571,7 @@
 // do vertical chrominance interpolation
 #define REAL_YSCALEYUV2RGB1b(index, c) \
     "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
+    ".p2align              4            \n\t"\
     "1:                                 \n\t"\
     "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
     "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
@@ -1883,7 +1883,7 @@ static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long w
 static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat)
 {
     __asm__ volatile(
-        "movq                    24+%4, %%mm6       \n\t"
+        "movq                   24(%4), %%mm6       \n\t"
         "mov                        %3, %%"REG_a"   \n\t"
         "pxor                    %%mm7, %%mm7       \n\t"
         "1:                                         \n\t"
@@ -1894,9 +1894,9 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin
         "punpcklbw               %%mm7, %%mm1       \n\t"
         "movq                    %%mm0, %%mm2       \n\t"
         "movq                    %%mm1, %%mm3       \n\t"
-        "pmaddwd                    %4, %%mm0       \n\t"
-        "pmaddwd                  8+%4, %%mm1       \n\t"
-        "pmaddwd                 16+%4, %%mm2       \n\t"
+        "pmaddwd                  (%4), %%mm0       \n\t"
+        "pmaddwd                 8(%4), %%mm1       \n\t"
+        "pmaddwd                16(%4), %%mm2       \n\t"
         "pmaddwd                 %%mm6, %%mm3       \n\t"
         "paddd                   %%mm1, %%mm0       \n\t"
         "paddd                   %%mm3, %%mm2       \n\t"
@@ -1908,9 +1908,9 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin
         "punpcklbw               %%mm7, %%mm3       \n\t"
         "movq                    %%mm1, %%mm4       \n\t"
         "movq                    %%mm3, %%mm5       \n\t"
-        "pmaddwd                    %4, %%mm1       \n\t"
-        "pmaddwd                  8+%4, %%mm3       \n\t"
-        "pmaddwd                 16+%4, %%mm4       \n\t"
+        "pmaddwd                  (%4), %%mm1       \n\t"
+        "pmaddwd                 8(%4), %%mm3       \n\t"
+        "pmaddwd                16(%4), %%mm4       \n\t"
         "pmaddwd                 %%mm6, %%mm5       \n\t"
         "paddd                   %%mm3, %%mm1       \n\t"
         "paddd                   %%mm5, %%mm4       \n\t"
@@ -1933,7 +1933,7 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin
         "add                        $4, %%"REG_a"   \n\t"
         " js                        1b              \n\t"
     : "+r" (src)
-    : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])
+    : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "r"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24])
     : "%"REG_a
     );
 }
@@ -2055,7 +2055,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in
             "pxor                %%mm7, %%mm7       \n\t"
             "push           %%"REG_BP"              \n\t" // we use 7 regs here ...
             "mov             %%"REG_a", %%"REG_BP"  \n\t"
-            ASMALIGN(4)
+            ".p2align                4              \n\t"
             "1:                                     \n\t"
             "movzwl   (%2, %%"REG_BP"), %%eax       \n\t"
             "movzwl  2(%2, %%"REG_BP"), %%ebx       \n\t"
@@ -2099,7 +2099,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in
             "pxor                 %%mm7, %%mm7      \n\t"
             "push            %%"REG_BP"             \n\t" // we use 7 regs here ...
             "mov              %%"REG_a", %%"REG_BP" \n\t"
-            ASMALIGN(4)
+            ".p2align                 4             \n\t"
             "1:                                     \n\t"
             "movzwl    (%2, %%"REG_BP"), %%eax      \n\t"
             "movzwl   2(%2, %%"REG_BP"), %%ebx      \n\t"
@@ -2150,7 +2150,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in
         dst-= counter/2;
         __asm__ volatile(
             "pxor                  %%mm7, %%mm7     \n\t"
-            ASMALIGN(4)
+            ".p2align                  4            \n\t"
             "1:                                     \n\t"
             "mov                      %2, %%"REG_c" \n\t"
             "movzwl      (%%"REG_c", %0), %%eax     \n\t"
@@ -2335,7 +2335,7 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
         "xor %%"REG_a", %%"REG_a"            \n\t" // i
         "xor %%"REG_d", %%"REG_d"            \n\t" // xx
         "xorl    %%ecx, %%ecx                \n\t" // xalpha
-        ASMALIGN(4)
+        ".p2align    4                       \n\t"
         "1:                                  \n\t"
         "movzbl    (%0, %%"REG_d"), %%edi    \n\t" //src[xx]
         "movzbl   1(%0, %%"REG_d"), %%esi    \n\t" //src[xx+1]
@@ -2475,7 +2475,7 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst,
             "xor %%"REG_a", %%"REG_a"               \n\t" // i
             "xor %%"REG_d", %%"REG_d"               \n\t" // xx
             "xorl    %%ecx, %%ecx                   \n\t" // xalpha
-            ASMALIGN(4)
+            ".p2align    4                          \n\t"
             "1:                                     \n\t"
             "mov        %0, %%"REG_S"               \n\t"
             "movzbl  (%%"REG_S", %%"REG_d"), %%edi  \n\t" //src[xx]
diff --git a/ffmpeg-mt/libswscale/utils.c b/ffmpeg-mt/libswscale/utils.c
index 166e983..bf61dfd 100644
--- a/ffmpeg-mt/libswscale/utils.c
+++ b/ffmpeg-mt/libswscale/utils.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -53,13 +53,13 @@ unsigned swscale_version(void)
 
 const char *swscale_configuration(void)
 {
-    return FFMPEG_CONFIGURATION;
+    return LIBAV_CONFIGURATION;
 }
 
 const char *swscale_license(void)
 {
 #define LICENSE_PREFIX "libswscale license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+    return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }
 
 #define RET 0xC3 //near return opcode for x86
diff --git a/ffmpeg-mt/libswscale/x86/yuv2rgb_mmx.c b/ffmpeg-mt/libswscale/x86/yuv2rgb_mmx.c
index 6478311..ff3a93d 100644
--- a/ffmpeg-mt/libswscale/x86/yuv2rgb_mmx.c
+++ b/ffmpeg-mt/libswscale/x86/yuv2rgb_mmx.c
@@ -7,20 +7,20 @@
  * 1,4,8bpp support and context / deglobalize stuff
  * by Michael Niedermayer (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/x86/yuv2rgb_template.c b/ffmpeg-mt/libswscale/x86/yuv2rgb_template.c
index 5c062c1..9f0d33b 100644
--- a/ffmpeg-mt/libswscale/x86/yuv2rgb_template.c
+++ b/ffmpeg-mt/libswscale/x86/yuv2rgb_template.c
@@ -4,20 +4,20 @@
  * Copyright (C) 2001-2007 Michael Niedermayer
  *           (c) 2010 Konstantin Shishkov
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/libswscale/yuv2rgb.c b/ffmpeg-mt/libswscale/yuv2rgb.c
index 77d3d39..8ea41af 100644
--- a/ffmpeg-mt/libswscale/yuv2rgb.c
+++ b/ffmpeg-mt/libswscale/yuv2rgb.c
@@ -6,20 +6,20 @@
  * 1,4,8bpp support and context / deglobalize stuff
  * by Michael Niedermayer (michaelni at gmx.at)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/mt-work/raw.sh b/ffmpeg-mt/mt-work/raw.sh
index 0ced88e..1cbf394 100755
--- a/ffmpeg-mt/mt-work/raw.sh
+++ b/ffmpeg-mt/mt-work/raw.sh
@@ -2,7 +2,7 @@
 
 fn=`basename "$1"`
 for th in 1 4; do
-    time ./ffmpeg_g -threads $th -skip_loop_filter all -vsync 0 -y -t 30 -i "$1" -an -f rawvideo "raw/n-$fn-$th.yuv"
+    time ./ffmpeg -threads $th -skip_loop_filter all -vsync 0 -y -t 30 -i "$1" -an -f rawvideo "raw/n-$fn-$th.yuv"
 done
 
 #for th in 1 4; do
diff --git a/ffmpeg-mt/mt-work/test-failures.txt b/ffmpeg-mt/mt-work/test-failures.txt
deleted file mode 100644
index d5a24fa..0000000
--- a/ffmpeg-mt/mt-work/test-failures.txt
+++ /dev/null
@@ -1,2896 +0,0 @@
-TEST    acodec-ac3_fixed
-TEST    acodec-adpcm_ima_qt
-TEST    acodec-adpcm_ima_wav
-TEST    acodec-adpcm_ms
-TEST    acodec-adpcm_swf
-TEST    acodec-adpcm_yam
-TEST    acodec-alac
-TEST    acodec-flac
-TEST    acodec-g726
-TEST    acodec-mp2
-TEST    acodec-pcm
-TEST    acodec-wmav1
-TEST    acodec-wmav2
-TEST    vsynth1-asv1
-TEST    vsynth1-asv2
-TEST    vsynth1-dnxhd_1080i
-TEST    vsynth1-dnxhd_720p
-TEST    vsynth1-dnxhd_720p_rd
-TEST    vsynth1-dv
-TEST    vsynth1-dv50
-TEST    vsynth1-error
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/error	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/error	2011-01-17 13:52:40.000000000 -0500
-@@ -1,4 +1,4 @@
--7416dfd319f04044d4575dc9d1b406e1 *./tests/data/vsynth1/error-mpeg4-adv.avi
--756836 ./tests/data/vsynth1/error-mpeg4-adv.avi
--ef8bfcd6e0883daba95d0f32486ebe2d *./tests/data/error.vsynth1.out.yuv
--stddev:   18.05 PSNR: 23.00 MAXDIFF:  245 bytes:  7603200/  7603200
-+f9d8d7fe421161ac102c935419b9d399 *./tests/data/vsynth1/error-mpeg4-adv.avi
-+  741404 ./tests/data/vsynth1/error-mpeg4-adv.avi
-+1bd3ae7afdba45d121c657cfbe22ff8d *./tests/data/error.vsynth1.out.yuv
-+stddev:   19.74 PSNR: 22.22 MAXDIFF:  236 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-error] Error 1
-TEST    vsynth1-ffv1
-TEST    vsynth1-flashsv
-TEST    vsynth1-flv
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/flv	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/flv	2011-01-17 13:52:43.000000000 -0500
-@@ -1,4 +1,4 @@
--d6a80659cedee7698aefe9c4a8285fa4 *./tests/data/vsynth1/flv.flv
--636269 ./tests/data/vsynth1/flv.flv
--5ab46d8dd01dbb1d63df2a84858a4b05 *./tests/data/flv.vsynth1.out.yuv
--stddev:    8.02 PSNR: 30.04 MAXDIFF:  105 bytes:  7603200/  7603200
-+6601c0822b71b0c005ab4209c8720ccd *./tests/data/vsynth1/flv.flv
-+  640001 ./tests/data/vsynth1/flv.flv
-+08a465c398e4905f9ed45fca89b3efc5 *./tests/data/flv.vsynth1.out.yuv
-+stddev:    8.03 PSNR: 30.03 MAXDIFF:  107 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-flv] Error 1
-TEST    vsynth1-h261
-TEST    vsynth1-h263
-TEST    vsynth1-h263p
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/h263p	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/h263p	2011-01-17 13:52:45.000000000 -0500
-@@ -1,4 +1,4 @@
--bbcadeceba295e1dad148aea1e57c370 *./tests/data/vsynth1/h263p.avi
--2328348 ./tests/data/vsynth1/h263p.avi
--9554cda00c3487ab3ffda2c3ea22fa2f *./tests/data/h263p.vsynth1.out.yuv
--stddev:    2.06 PSNR: 41.83 MAXDIFF:   20 bytes:  7603200/  7603200
-+256f90bef6a24b7bc1a8dd4ae82e4e5c *./tests/data/vsynth1/h263p.avi
-+ 2332538 ./tests/data/vsynth1/h263p.avi
-+e02188c26d01034f6a497934398e6743 *./tests/data/h263p.vsynth1.out.yuv
-+stddev:    2.06 PSNR: 41.83 MAXDIFF:   19 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-h263p] Error 1
-TEST    vsynth1-huffyuv
-TEST    vsynth1-jpegls
-TEST    vsynth1-ljpeg
-TEST    vsynth1-mjpeg
-TEST    vsynth1-mpeg
-TEST    vsynth1-mpeg1b
-TEST    vsynth1-mpeg2
-TEST    vsynth1-mpeg2thread
-TEST    vsynth1-mpeg4
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/mpeg4	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/mpeg4	2011-01-17 13:52:58.000000000 -0500
-@@ -1,4 +1,4 @@
--fd83f2ef5887a62b4d755d7cb5f0ac59 *./tests/data/vsynth1/odivx.mp4
--540144 ./tests/data/vsynth1/odivx.mp4
--8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
--stddev:    7.97 PSNR: 30.10 MAXDIFF:  105 bytes:  7603200/  7603200
-+5295e4d1be6c1a88faf5db972dfcf62f *./tests/data/vsynth1/odivx.mp4
-+  540826 ./tests/data/vsynth1/odivx.mp4
-+4f02d5f83da600985b84958e4e3d2fe0 *./tests/data/mpeg4.vsynth1.out.yuv
-+stddev:   11.07 PSNR: 27.25 MAXDIFF:  192 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-mpeg4] Error 1
-TEST    vsynth1-mpeg4adv
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/mpeg4adv	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/mpeg4adv	2011-01-17 13:53:05.000000000 -0500
-@@ -1,16 +1,16 @@
--7d8eb01fd68d83d62a98585757704d47 *./tests/data/vsynth1/mpeg4-adv.avi
--589716 ./tests/data/vsynth1/mpeg4-adv.avi
--f8b226876b1b2c0b98fd6928fd9adbd8 *./tests/data/mpeg4adv.vsynth1.out.yuv
--stddev:    6.98 PSNR: 31.25 MAXDIFF:   84 bytes:  7603200/  7603200
--d6b7e724a6ad66ab5e4c5a499218b40d *./tests/data/vsynth1/mpeg4-qprd.avi
--710944 ./tests/data/vsynth1/mpeg4-qprd.avi
--e65f4c7f343fe2bad1cac44b7da5f7c4 *./tests/data/mpeg4adv.vsynth1.out.yuv
--stddev:    9.79 PSNR: 28.31 MAXDIFF:  176 bytes:  7603200/  7603200
--2d870c0da9ab2231ab5fc06981e70399 *./tests/data/vsynth1/mpeg4-adap.avi
--403456 ./tests/data/vsynth1/mpeg4-adap.avi
--fa2049396479b5f170aa764fed5b2a31 *./tests/data/mpeg4adv.vsynth1.out.yuv
--stddev:   14.05 PSNR: 25.17 MAXDIFF:  184 bytes:  7603200/  7603200
--3bf17c3d04f52988386ce106a2a58976 *./tests/data/vsynth1/mpeg4-Q.avi
--860678 ./tests/data/vsynth1/mpeg4-Q.avi
--756928496245ecc701f79eebeec8e5e6 *./tests/data/mpeg4adv.vsynth1.out.yuv
--stddev:    5.63 PSNR: 33.12 MAXDIFF:   70 bytes:  7603200/  7603200
-+20eab3e8f00eb71cc57aa02c79b03835 *./tests/data/vsynth1/mpeg4-adv.avi
-+  591856 ./tests/data/vsynth1/mpeg4-adv.avi
-+7837ca6f9c3f87c5f40cc67f3a181ca2 *./tests/data/mpeg4adv.vsynth1.out.yuv
-+stddev:   10.43 PSNR: 27.76 MAXDIFF:  184 bytes:  7603200/  7603200
-+b76c1be43fddf47030a80a60ad56ed7b *./tests/data/vsynth1/mpeg4-qprd.avi
-+  713772 ./tests/data/vsynth1/mpeg4-qprd.avi
-+cbe9d36d28c82d2b1240ca871e7934a3 *./tests/data/mpeg4adv.vsynth1.out.yuv
-+stddev:   10.28 PSNR: 27.89 MAXDIFF:  198 bytes:  7603200/  7603200
-+51da4657ec89c77de32d384dc676714f *./tests/data/vsynth1/mpeg4-adap.avi
-+  409954 ./tests/data/vsynth1/mpeg4-adap.avi
-+710b85cf1bd9dc4b4b84928c1ebc5816 *./tests/data/mpeg4adv.vsynth1.out.yuv
-+stddev:   14.37 PSNR: 24.98 MAXDIFF:  187 bytes:  7603200/  7603200
-+6b88216e0f57a4c60dc1b7c2054acfa4 *./tests/data/vsynth1/mpeg4-Q.avi
-+  865748 ./tests/data/vsynth1/mpeg4-Q.avi
-+767ebbd8c60b10a17f10d833448123e1 *./tests/data/mpeg4adv.vsynth1.out.yuv
-+stddev:    6.49 PSNR: 31.88 MAXDIFF:  147 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-mpeg4adv] Error 1
-TEST    vsynth1-mpeg4nr
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/mpeg4nr	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/mpeg4nr	2011-01-17 13:53:05.000000000 -0500
-@@ -1,4 +1,4 @@
--c02f54157ba08ca12ad979c6308212ad *./tests/data/vsynth1/mpeg4-nr.avi
--675638 ./tests/data/vsynth1/mpeg4-nr.avi
--d2b89d5958fb7331f6c9e5b7ecaaa5b6 *./tests/data/mpeg4nr.vsynth1.out.yuv
--stddev:    6.99 PSNR: 31.23 MAXDIFF:   86 bytes:  7603200/  7603200
-+e8d04b36645ca8b07c354ff8af3a518d *./tests/data/vsynth1/mpeg4-nr.avi
-+  678948 ./tests/data/vsynth1/mpeg4-nr.avi
-+d9d1b444aaae200b0839796794c84964 *./tests/data/mpeg4nr.vsynth1.out.yuv
-+stddev:    9.26 PSNR: 28.79 MAXDIFF:  189 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-mpeg4nr] Error 1
-TEST    vsynth1-mpeg4thread
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/mpeg4thread	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/mpeg4thread	2011-01-17 13:53:06.000000000 -0500
-@@ -1,4 +1,4 @@
--4f4ea04faad7212374919aa1ec7ff994 *./tests/data/vsynth1/mpeg4-thread.avi
--774760 ./tests/data/vsynth1/mpeg4-thread.avi
--64b96cddf5301990e118978b3a3bcd0d *./tests/data/mpeg4thread.vsynth1.out.yuv
--stddev:   10.13 PSNR: 28.02 MAXDIFF:  183 bytes:  7603200/  7603200
-+58bfbd4523ed25452dee0f4a1fe5fc5d *./tests/data/vsynth1/mpeg4-thread.avi
-+  770730 ./tests/data/vsynth1/mpeg4-thread.avi
-+da89e47c9e341294ef92862790fb10cf *./tests/data/mpeg4thread.vsynth1.out.yuv
-+stddev:   10.49 PSNR: 27.71 MAXDIFF:  183 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-mpeg4thread] Error 1
-TEST    vsynth1-msmpeg4
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/msmpeg4	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/msmpeg4	2011-01-17 13:53:07.000000000 -0500
-@@ -1,4 +1,4 @@
--4b08952b0afceb17ee3db31b67f6b778 *./tests/data/vsynth1/msmpeg4.avi
--624718 ./tests/data/vsynth1/msmpeg4.avi
--5ca72c39e3fc5df8e62f223c869589f5 *./tests/data/msmpeg4.vsynth1.out.yuv
--stddev:    7.98 PSNR: 30.09 MAXDIFF:  104 bytes:  7603200/  7603200
-+144f400cf8f624e21a8061dc882ef086 *./tests/data/vsynth1/msmpeg4.avi
-+  629876 ./tests/data/vsynth1/msmpeg4.avi
-+e741bf2208b1ab9b56ed3defe4e10398 *./tests/data/msmpeg4.vsynth1.out.yuv
-+stddev:    7.98 PSNR: 30.08 MAXDIFF:  106 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-msmpeg4] Error 1
-TEST    vsynth1-msmpeg4v2
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/msmpeg4v2	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/msmpeg4v2	2011-01-17 13:53:07.000000000 -0500
-@@ -1,4 +1,4 @@
--88957e35efcc718bce0307627ad3298d *./tests/data/vsynth1/msmpeg4v2.avi
--623788 ./tests/data/vsynth1/msmpeg4v2.avi
--c6ff1041a0ef62c2a2e5ef519e5e94c4 *./tests/data/msmpeg4v2.vsynth1.out.yuv
--stddev:    7.97 PSNR: 30.10 MAXDIFF:  105 bytes:  7603200/  7603200
-+2465f409c9077cc69ee66c6a89bd42ef *./tests/data/vsynth1/msmpeg4v2.avi
-+  628806 ./tests/data/vsynth1/msmpeg4v2.avi
-+934a3e902113a0cef71a40fa494241ca *./tests/data/msmpeg4v2.vsynth1.out.yuv
-+stddev:    7.98 PSNR: 30.09 MAXDIFF:  111 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-msmpeg4v2] Error 1
-TEST    vsynth1-qtrle
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/qtrle	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/qtrle	2011-01-17 13:53:07.000000000 -0500
-@@ -1,4 +1,4 @@
--3f070779d7deb54626515ac7f7002e63 *./tests/data/vsynth1/qtrle.mov
--387772 ./tests/data/vsynth1/qtrle.mov
--a3c2610e2c069c3ad22ec03da83f774f *./tests/data/qtrle.vsynth1.out.yuv
--stddev:   15.14 PSNR: 24.53 MAXDIFF:  174 bytes:  7603200/  7603200
-+028b64ca2f1349f8abc63879066daa00 *./tests/data/vsynth1/qtrle.mov
-+  389285 ./tests/data/vsynth1/qtrle.mov
-+f1ca4fee4fea7e3ae133704a88ccf686 *./tests/data/qtrle.vsynth1.out.yuv
-+stddev:   15.18 PSNR: 24.50 MAXDIFF:  174 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-qtrle] Error 1
-TEST    vsynth1-rc
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/rc	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/rc	2011-01-17 13:53:08.000000000 -0500
-@@ -1,4 +1,4 @@
--1c6dadf75f60f4ba59a0fe0b6eaedf57 *./tests/data/vsynth1/mpeg4-rc.avi
--830160 ./tests/data/vsynth1/mpeg4-rc.avi
--4d95e340db9bc57a559162c039f3784e *./tests/data/rc.vsynth1.out.yuv
--stddev:   10.24 PSNR: 27.92 MAXDIFF:  196 bytes:  7603200/  7603200
-+b7bfcd9bf6141541d8876047b31d77cc *./tests/data/vsynth1/mpeg4-rc.avi
-+  808060 ./tests/data/vsynth1/mpeg4-rc.avi
-+ee2b0bcb7b76b135ce797fd8f56ff32c *./tests/data/rc.vsynth1.out.yuv
-+stddev:   10.30 PSNR: 27.87 MAXDIFF:  196 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-rc] Error 1
-TEST    vsynth1-rgb
-TEST    vsynth1-roq
-TEST    vsynth1-rv10
-TEST    vsynth1-rv20
-TEST    vsynth1-snow
-TEST    vsynth1-snowll
-TEST    vsynth1-svq1
-TEST    vsynth1-wmv1
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/wmv1	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/wmv1	2011-01-17 13:53:20.000000000 -0500
-@@ -1,4 +1,4 @@
--4f3461315776e5118866fa3819cff9b6 *./tests/data/vsynth1/wmv1.avi
--626908 ./tests/data/vsynth1/wmv1.avi
--5182edba5b5e0354b39ce4f3604b62da *./tests/data/wmv1.vsynth1.out.yuv
--stddev:    7.97 PSNR: 30.09 MAXDIFF:  110 bytes:  7603200/  7603200
-+71bded86ad2f948150060dffc8a72ead *./tests/data/vsynth1/wmv1.avi
-+  632036 ./tests/data/vsynth1/wmv1.avi
-+e5e4963a838680b830340123c4b383a5 *./tests/data/wmv1.vsynth1.out.yuv
-+stddev:    7.98 PSNR: 30.09 MAXDIFF:  110 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-wmv1] Error 1
-TEST    vsynth1-wmv2
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth1/wmv2	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth1/wmv2	2011-01-17 13:53:20.000000000 -0500
-@@ -1,4 +1,4 @@
--13efda9d3811345aadc0632fc9a9332b *./tests/data/vsynth1/wmv2.avi
--659852 ./tests/data/vsynth1/wmv2.avi
--5182edba5b5e0354b39ce4f3604b62da *./tests/data/wmv2.vsynth1.out.yuv
--stddev:    7.97 PSNR: 30.09 MAXDIFF:  110 bytes:  7603200/  7603200
-+7658e2222b1e4fbc85abea009c180548 *./tests/data/vsynth1/wmv2.avi
-+  664948 ./tests/data/vsynth1/wmv2.avi
-+e5e4963a838680b830340123c4b383a5 *./tests/data/wmv2.vsynth1.out.yuv
-+stddev:    7.98 PSNR: 30.09 MAXDIFF:  110 bytes:  7603200/  7603200
-make: *** [fate-vsynth1-wmv2] Error 1
-TEST    vsynth1-yuv
-TEST    vsynth2-asv1
-TEST    vsynth2-asv2
-TEST    vsynth2-dnxhd_1080i
-TEST    vsynth2-dnxhd_720p
-TEST    vsynth2-dnxhd_720p_rd
-TEST    vsynth2-dv
-TEST    vsynth2-dv50
-TEST    vsynth2-error
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/error	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/error	2011-01-17 13:53:29.000000000 -0500
-@@ -1,4 +1,4 @@
--90e65096aa9ebafa3fe3f44a5a47cdc4 *./tests/data/vsynth2/error-mpeg4-adv.avi
--176588 ./tests/data/vsynth2/error-mpeg4-adv.avi
--9fe1082179f80179439953c7397a46ef *./tests/data/error.vsynth2.out.yuv
--stddev:    9.00 PSNR: 29.04 MAXDIFF:  168 bytes:  7603200/  7603200
-+e1a3e863e0425bce0f4aacdf4a27d192 *./tests/data/vsynth2/error-mpeg4-adv.avi
-+  180128 ./tests/data/vsynth2/error-mpeg4-adv.avi
-+484f06383403447682759d822cb6ad5a *./tests/data/error.vsynth2.out.yuv
-+stddev:   10.58 PSNR: 27.63 MAXDIFF:  210 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-error] Error 1
-TEST    vsynth2-ffv1
-TEST    vsynth2-flashsv
-TEST    vsynth2-flv
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/flv	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/flv	2011-01-17 13:53:32.000000000 -0500
-@@ -1,4 +1,4 @@
--2edc92093d36506bcc0a5c0e17e86113 *./tests/data/vsynth2/flv.flv
--131360 ./tests/data/vsynth2/flv.flv
--8999c8264fb0941561f64c4a736e9d88 *./tests/data/flv.vsynth2.out.yuv
--stddev:    5.33 PSNR: 33.59 MAXDIFF:   80 bytes:  7603200/  7603200
-+7de024c8ee8880a1886d00d85e569a66 *./tests/data/vsynth2/flv.flv
-+  136249 ./tests/data/vsynth2/flv.flv
-+0df8b34edb3c1ce8658683c056837527 *./tests/data/flv.vsynth2.out.yuv
-+stddev:    5.35 PSNR: 33.56 MAXDIFF:   80 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-flv] Error 1
-TEST    vsynth2-h261
-TEST    vsynth2-h263
-TEST    vsynth2-h263p
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/h263p	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/h263p	2011-01-17 13:53:33.000000000 -0500
-@@ -1,4 +1,4 @@
--c7644d40e9f40bbd98e5a978f9f94bb4 *./tests/data/vsynth2/h263p.avi
--868018 ./tests/data/vsynth2/h263p.avi
--4b0ee791f280029dc03c528f76f195d4 *./tests/data/h263p.vsynth2.out.yuv
--stddev:    1.91 PSNR: 42.50 MAXDIFF:   19 bytes:  7603200/  7603200
-+68026781aaa30b3f20b9c00a15d34d44 *./tests/data/vsynth2/h263p.avi
-+  883722 ./tests/data/vsynth2/h263p.avi
-+f01d197968aca266657d535eed151014 *./tests/data/h263p.vsynth2.out.yuv
-+stddev:    1.91 PSNR: 42.48 MAXDIFF:   19 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-h263p] Error 1
-TEST    vsynth2-huffyuv
-TEST    vsynth2-jpegls
-TEST    vsynth2-ljpeg
-TEST    vsynth2-mjpeg
-TEST    vsynth2-mpeg
-TEST    vsynth2-mpeg1b
-TEST    vsynth2-mpeg2
-TEST    vsynth2-mpeg2thread
-TEST    vsynth2-mpeg4
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/mpeg4	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/mpeg4	2011-01-17 13:53:45.000000000 -0500
-@@ -1,4 +1,4 @@
--47de227982e77830a2db278214a08773 *./tests/data/vsynth2/odivx.mp4
--119797 ./tests/data/vsynth2/odivx.mp4
--90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
--stddev:    5.34 PSNR: 33.57 MAXDIFF:   83 bytes:  7603200/  7603200
-+a8b70f3bd83271ec52565135d74acaae *./tests/data/vsynth2/odivx.mp4
-+  123236 ./tests/data/vsynth2/odivx.mp4
-+f60e67dd6f376b3d3e30c02bb02883e8 *./tests/data/mpeg4.vsynth2.out.yuv
-+stddev:    6.25 PSNR: 32.21 MAXDIFF:  144 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-mpeg4] Error 1
-TEST    vsynth2-mpeg4adv
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/mpeg4adv	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/mpeg4adv	2011-01-17 13:53:49.000000000 -0500
-@@ -1,16 +1,16 @@
--dee7be19486a76d96c88d18eefba8f86 *./tests/data/vsynth2/mpeg4-adv.avi
--141546 ./tests/data/vsynth2/mpeg4-adv.avi
--3f3a21e9db85a9c0f7022f557a5374c1 *./tests/data/mpeg4adv.vsynth2.out.yuv
--stddev:    4.94 PSNR: 34.25 MAXDIFF:   69 bytes:  7603200/  7603200
--fd5ab0f55dbc959316e32923e86290df *./tests/data/vsynth2/mpeg4-qprd.avi
--231458 ./tests/data/vsynth2/mpeg4-qprd.avi
--de8a883865e2dff7a51f66da6c48df48 *./tests/data/mpeg4adv.vsynth2.out.yuv
--stddev:    3.71 PSNR: 36.72 MAXDIFF:   61 bytes:  7603200/  7603200
--547e1849dcf910935ff6383ca49e5706 *./tests/data/vsynth2/mpeg4-adap.avi
--198510 ./tests/data/vsynth2/mpeg4-adap.avi
--4affb83f6adc94f31024b4f9e0168945 *./tests/data/mpeg4adv.vsynth2.out.yuv
--stddev:    3.75 PSNR: 36.65 MAXDIFF:   71 bytes:  7603200/  7603200
--7680d2e7d34399dfdfb8a49cf1e10239 *./tests/data/vsynth2/mpeg4-Q.avi
--163688 ./tests/data/vsynth2/mpeg4-Q.avi
--26dc7c78955fa678fbf150e236eb5627 *./tests/data/mpeg4adv.vsynth2.out.yuv
--stddev:    3.97 PSNR: 36.14 MAXDIFF:   54 bytes:  7603200/  7603200
-+47efa8a368f57670afaf4de17f163b20 *./tests/data/vsynth2/mpeg4-adv.avi
-+  145318 ./tests/data/vsynth2/mpeg4-adv.avi
-+7f2726e0e1626fa4783b9e4215981e2d *./tests/data/mpeg4adv.vsynth2.out.yuv
-+stddev:    6.13 PSNR: 32.37 MAXDIFF:  139 bytes:  7603200/  7603200
-+3e06e5cbda13ad4eb137fc5432cbc9c3 *./tests/data/vsynth2/mpeg4-qprd.avi
-+  232924 ./tests/data/vsynth2/mpeg4-qprd.avi
-+9bd0cae89604ba35f8b6dc34ec9e7b17 *./tests/data/mpeg4adv.vsynth2.out.yuv
-+stddev:    4.59 PSNR: 34.89 MAXDIFF:  134 bytes:  7603200/  7603200
-+635139fc5d20a4c3e48ca555a2fb8e8c *./tests/data/vsynth2/mpeg4-adap.avi
-+  198588 ./tests/data/vsynth2/mpeg4-adap.avi
-+b42247bb0e313234c8abdd88a011f5bd *./tests/data/mpeg4adv.vsynth2.out.yuv
-+stddev:    4.37 PSNR: 35.31 MAXDIFF:  169 bytes:  7603200/  7603200
-+3cc54d51db4cb6183ed9d4137246a5b1 *./tests/data/vsynth2/mpeg4-Q.avi
-+  168386 ./tests/data/vsynth2/mpeg4-Q.avi
-+513e786c0780c3bf3038191fcd9e3cf6 *./tests/data/mpeg4adv.vsynth2.out.yuv
-+stddev:    4.33 PSNR: 35.40 MAXDIFF:  167 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-mpeg4adv] Error 1
-TEST    vsynth2-mpeg4nr
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/mpeg4nr	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/mpeg4nr	2011-01-17 13:53:50.000000000 -0500
-@@ -1,4 +1,4 @@
--c41187c99588fb7229ad330b2f80d28b *./tests/data/vsynth2/mpeg4-nr.avi
--155044 ./tests/data/vsynth2/mpeg4-nr.avi
--f7fc191308679f709405e62271f5c65f *./tests/data/mpeg4nr.vsynth2.out.yuv
--stddev:    4.73 PSNR: 34.63 MAXDIFF:   64 bytes:  7603200/  7603200
-+66b39626eeff8137688afbabbdddbbb0 *./tests/data/vsynth2/mpeg4-nr.avi
-+  159316 ./tests/data/vsynth2/mpeg4-nr.avi
-+15f2aa79d95e4326ad8dc2a0500fa061 *./tests/data/mpeg4nr.vsynth2.out.yuv
-+stddev:    5.22 PSNR: 33.76 MAXDIFF:  119 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-mpeg4nr] Error 1
-TEST    vsynth2-mpeg4thread
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/mpeg4thread	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/mpeg4thread	2011-01-17 13:53:51.000000000 -0500
-@@ -1,4 +1,4 @@
--ba30d10ff70d46e7c5b7fa859ea1faa4 *./tests/data/vsynth2/mpeg4-thread.avi
--250140 ./tests/data/vsynth2/mpeg4-thread.avi
--5355deb8c7609a3f1ff2173aab1dee70 *./tests/data/mpeg4thread.vsynth2.out.yuv
--stddev:    3.69 PSNR: 36.78 MAXDIFF:   65 bytes:  7603200/  7603200
-+584e0eea7f73b8ef2e0c5548ecc0e3bf *./tests/data/vsynth2/mpeg4-thread.avi
-+  249820 ./tests/data/vsynth2/mpeg4-thread.avi
-+14698fef6a6295e8086a9cd342d4e394 *./tests/data/mpeg4thread.vsynth2.out.yuv
-+stddev:    4.37 PSNR: 35.31 MAXDIFF:  162 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-mpeg4thread] Error 1
-TEST    vsynth2-msmpeg4
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/msmpeg4	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/msmpeg4	2011-01-17 13:53:51.000000000 -0500
-@@ -1,4 +1,4 @@
--26dee25a62a66daba4f38ac6bd8f4677 *./tests/data/vsynth2/msmpeg4.avi
--127680 ./tests/data/vsynth2/msmpeg4.avi
--0e1c6e25c71c6a8fa8e506e3d97ca4c9 *./tests/data/msmpeg4.vsynth2.out.yuv
--stddev:    5.33 PSNR: 33.59 MAXDIFF:   78 bytes:  7603200/  7603200
-+d5327814000543bfe24d4bdff3edf503 *./tests/data/vsynth2/msmpeg4.avi
-+  132264 ./tests/data/vsynth2/msmpeg4.avi
-+a2f18f4ffe68434a89a6dd306f0f7eb4 *./tests/data/msmpeg4.vsynth2.out.yuv
-+stddev:    5.35 PSNR: 33.56 MAXDIFF:   77 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-msmpeg4] Error 1
-TEST    vsynth2-msmpeg4v2
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/msmpeg4v2	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/msmpeg4v2	2011-01-17 13:53:51.000000000 -0500
-@@ -1,4 +1,4 @@
--c09815e40a9d260628e1ebad8b2b3774 *./tests/data/vsynth2/msmpeg4v2.avi
--129918 ./tests/data/vsynth2/msmpeg4v2.avi
--8920194f8bf8f9cdd6c65b3df9e1a292 *./tests/data/msmpeg4v2.vsynth2.out.yuv
--stddev:    5.33 PSNR: 33.59 MAXDIFF:   80 bytes:  7603200/  7603200
-+8656813e7a88eb30880b9d9199822541 *./tests/data/vsynth2/msmpeg4v2.avi
-+  134750 ./tests/data/vsynth2/msmpeg4v2.avi
-+fc9e48fe41ebca2f462d4323eab5c346 *./tests/data/msmpeg4v2.vsynth2.out.yuv
-+stddev:    5.35 PSNR: 33.56 MAXDIFF:   80 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-msmpeg4v2] Error 1
-TEST    vsynth2-qtrle
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/qtrle	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/qtrle	2011-01-17 13:53:52.000000000 -0500
-@@ -1,4 +1,4 @@
--5346bba8e03e7de72b482efbcf712a2e *./tests/data/vsynth2/qtrle.mov
--141533 ./tests/data/vsynth2/qtrle.mov
--f967b290c7e6d015c0e78175db828249 *./tests/data/qtrle.vsynth2.out.yuv
--stddev:    5.75 PSNR: 32.93 MAXDIFF:   92 bytes:  7603200/  7603200
-+d2ba4fe353921353143474a2819375d7 *./tests/data/vsynth2/qtrle.mov
-+  141089 ./tests/data/vsynth2/qtrle.mov
-+87ea7098ddb8ce6935f7541c342101b2 *./tests/data/qtrle.vsynth2.out.yuv
-+stddev:    5.96 PSNR: 32.62 MAXDIFF:   89 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-qtrle] Error 1
-TEST    vsynth2-rc
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/rc	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/rc	2011-01-17 13:53:52.000000000 -0500
-@@ -1,4 +1,4 @@
--c25ede9e268b834a09a63f5136cd1b95 *./tests/data/vsynth2/mpeg4-rc.avi
--226332 ./tests/data/vsynth2/mpeg4-rc.avi
--2b34e606af895b62a250de98749a19b0 *./tests/data/rc.vsynth2.out.yuv
--stddev:    4.23 PSNR: 35.60 MAXDIFF:   85 bytes:  7603200/  7603200
-+fe9eb72baeccdff613a094f47f805d8e *./tests/data/vsynth2/mpeg4-rc.avi
-+  228032 ./tests/data/vsynth2/mpeg4-rc.avi
-+a1068ec4bbcf297fd08032ed7fd59eda *./tests/data/rc.vsynth2.out.yuv
-+stddev:    4.30 PSNR: 35.45 MAXDIFF:   85 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-rc] Error 1
-TEST    vsynth2-rgb
-TEST    vsynth2-roq
-TEST    vsynth2-rv10
-TEST    vsynth2-rv20
-TEST    vsynth2-snow
-TEST    vsynth2-snowll
-TEST    vsynth2-svq1
-TEST    vsynth2-wmv1
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/wmv1	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/wmv1	2011-01-17 13:54:02.000000000 -0500
-@@ -1,4 +1,4 @@
--1011e26e7d351c96d7bbfe106d831b69 *./tests/data/vsynth2/wmv1.avi
--129530 ./tests/data/vsynth2/wmv1.avi
--81eee429b665254d19a06607463c0b5e *./tests/data/wmv1.vsynth2.out.yuv
--stddev:    5.33 PSNR: 33.60 MAXDIFF:   77 bytes:  7603200/  7603200
-+01112ed4c12bd214611284a50c8abbed *./tests/data/vsynth2/wmv1.avi
-+  134150 ./tests/data/vsynth2/wmv1.avi
-+6a7491f94708fe1c9e183d49434e4036 *./tests/data/wmv1.vsynth2.out.yuv
-+stddev:    5.34 PSNR: 33.57 MAXDIFF:   77 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-wmv1] Error 1
-TEST    vsynth2-wmv2
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/vsynth2/wmv2	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/vsynth2/wmv2	2011-01-17 13:54:02.000000000 -0500
-@@ -1,4 +1,4 @@
--1f6598e9776ed00aebdc44cc8d48cb7c *./tests/data/vsynth2/wmv2.avi
--129860 ./tests/data/vsynth2/wmv2.avi
--81eee429b665254d19a06607463c0b5e *./tests/data/wmv2.vsynth2.out.yuv
--stddev:    5.33 PSNR: 33.60 MAXDIFF:   77 bytes:  7603200/  7603200
-+7f05f2fea6312103cb46c8230d3352d9 *./tests/data/vsynth2/wmv2.avi
-+  134564 ./tests/data/vsynth2/wmv2.avi
-+6a7491f94708fe1c9e183d49434e4036 *./tests/data/wmv2.vsynth2.out.yuv
-+stddev:    5.34 PSNR: 33.57 MAXDIFF:   77 bytes:  7603200/  7603200
-make: *** [fate-vsynth2-wmv2] Error 1
-TEST    vsynth2-yuv
-TEST    lavf-aiff
-TEST    lavf-alaw
-TEST    lavf-asf
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/lavf/asf	2010-03-09 00:12:36.000000000 -0500
-+++ tests/data/regression/lavf/asf	2011-01-17 13:54:03.000000000 -0500
-@@ -1,3 +1,3 @@
--c544bb40c2f4c09d44318db5228ee499 *./tests/data/lavf/lavf.asf
-+33067713434bcfa0fbe54c5bae3f1519 *./tests/data/lavf/lavf.asf
- 333375 ./tests/data/lavf/lavf.asf
--./tests/data/lavf/lavf.asf CRC=0x9f5ab3e6
-+./tests/data/lavf/lavf.asf CRC=0x71634857
-make: *** [fate-lavf-asf] Error 1
-TEST    lavf-au
-TEST    lavf-avi
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/lavf/avi	2010-03-09 00:12:36.000000000 -0500
-+++ tests/data/regression/lavf/avi	2011-01-17 13:54:03.000000000 -0500
-@@ -1,3 +1,3 @@
--7e5e4db8c04f0acd16cff6b30e60d0e5 *./tests/data/lavf/lavf.avi
--331032 ./tests/data/lavf/lavf.avi
--./tests/data/lavf/lavf.avi CRC=0x2a83e6b0
-+74b23e54eee46c639bf6c3a789e7c67d *./tests/data/lavf/lavf.avi
-+  331948 ./tests/data/lavf/lavf.avi
-+./tests/data/lavf/lavf.avi CRC=0x893290ad
-make: *** [fate-lavf-avi] Error 1
-TEST    lavf-bmp
-TEST    lavf-dv_fmt
-TEST    lavf-ffm
-TEST    lavf-flv_fmt
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/lavf/flv_fmt	2010-03-09 00:12:36.000000000 -0500
-+++ tests/data/regression/lavf/flv_fmt	2011-01-17 13:54:05.000000000 -0500
-@@ -1,3 +1,3 @@
--62c3177547fb5853a5116661802e1ae2 *./tests/data/lavf/lavf.flv
--329541 ./tests/data/lavf/lavf.flv
--./tests/data/lavf/lavf.flv CRC=0x881785d1
-+1d8d3440b8c314ecf1b1d82758c85513 *./tests/data/lavf/lavf.flv
-+  329502 ./tests/data/lavf/lavf.flv
-+./tests/data/lavf/lavf.flv CRC=0x093a3a19
-make: *** [fate-lavf-flv_fmt] Error 1
-TEST    lavf-gif
-TEST    lavf-gxf
-TEST    lavf-jpg
-TEST    lavf-mkv
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/lavf/mkv	2010-10-23 18:46:26.000000000 -0400
-+++ tests/data/regression/lavf/mkv	2011-01-17 13:54:06.000000000 -0500
-@@ -1,3 +1,3 @@
--a36c2d9378b9870880556ced1cb89ecf *./tests/data/lavf/lavf.mkv
--  320478 ./tests/data/lavf/lavf.mkv
--./tests/data/lavf/lavf.mkv CRC=0x2a83e6b0
-+ee09475db82261010f837400fab465ee *./tests/data/lavf/lavf.mkv
-+  321398 ./tests/data/lavf/lavf.mkv
-+./tests/data/lavf/lavf.mkv CRC=0x893290ad
-make: *** [fate-lavf-mkv] Error 1
-TEST    lavf-mmf
-TEST    lavf-mov
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/lavf/mov	2010-03-09 00:12:36.000000000 -0500
-+++ tests/data/regression/lavf/mov	2011-01-17 13:54:07.000000000 -0500
-@@ -1,3 +1,3 @@
--c145305a775eb2de43cdf94eb1ab5240 *./tests/data/lavf/lavf.mov
--357669 ./tests/data/lavf/lavf.mov
--./tests/data/lavf/lavf.mov CRC=0x2f6a9b26
-+c0905dce1e98f9d1d2b638a5b1540f00 *./tests/data/lavf/lavf.mov
-+  358589 ./tests/data/lavf/lavf.mov
-+./tests/data/lavf/lavf.mov CRC=0xd6c04523
-make: *** [fate-lavf-mov] Error 1
-TEST    lavf-mpg
-TEST    lavf-mulaw
-TEST    lavf-mxf
-TEST    lavf-nut
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/lavf/nut	2010-03-09 00:12:36.000000000 -0500
-+++ tests/data/regression/lavf/nut	2011-01-17 13:54:09.000000000 -0500
-@@ -1,3 +1,3 @@
--16b9d2cf8effb7dae316c6b9248a49b7 *./tests/data/lavf/lavf.nut
--319888 ./tests/data/lavf/lavf.nut
--./tests/data/lavf/lavf.nut CRC=0x2a83e6b0
-+969c60338752e6b9c285676247cd1b72 *./tests/data/lavf/lavf.nut
-+  320808 ./tests/data/lavf/lavf.nut
-+./tests/data/lavf/lavf.nut CRC=0x893290ad
-make: *** [fate-lavf-nut] Error 1
-TEST    lavf-ogg
-TEST    lavf-pbmpipe
-TEST    lavf-pcx
-TEST    lavf-pgm
-TEST    lavf-pgmpipe
-TEST    lavf-pixfmt
-TEST    lavf-png
-TEST    lavf-ppm
-TEST    lavf-ppmpipe
-TEST    lavf-rm
-TEST    lavf-sgi
-TEST    lavf-swf
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/lavf/swf	2010-03-09 00:12:36.000000000 -0500
-+++ tests/data/regression/lavf/swf	2011-01-17 13:54:12.000000000 -0500
-@@ -1,3 +1,3 @@
--62c5aeb636fc82cf6ba6277d36e42cb5 *./tests/data/lavf/lavf.swf
--329479 ./tests/data/lavf/lavf.swf
--./tests/data/lavf/lavf.swf CRC=0x881785d1
-+75d9b150f87e1dd8ad8c6c583c85624c *./tests/data/lavf/lavf.swf
-+  329440 ./tests/data/lavf/lavf.swf
-+./tests/data/lavf/lavf.swf CRC=0x093a3a19
-make: *** [fate-lavf-swf] Error 1
-TEST    lavf-tga
-TEST    lavf-tiff
-TEST    lavf-ts
-TEST    lavf-voc
-TEST    lavf-wav
-TEST    lavf-yuv4mpeg
-TEST    lavfi-crop
-TEST    lavfi-crop_scale
-TEST    lavfi-crop_scale_vflip
-TEST    lavfi-crop_vflip
-TEST    lavfi-null
-TEST    lavfi-pixdesc_le
-TEST    lavfi-pixfmts_copy_le
-TEST    lavfi-pixfmts_crop_le
-TEST    lavfi-pixfmts_hflip_le
-TEST    lavfi-pixfmts_null_le
-TEST    lavfi-pixfmts_pad_le
-TEST    lavfi-pixfmts_scale_le
-TEST    lavfi-pixfmts_vflip_le
-TEST    lavfi-scale200
-TEST    lavfi-scale500
-TEST    lavfi-vflip
-TEST    lavfi-vflip_crop
-TEST    lavfi-vflip_vflip
-make: Target `test' not remade because of errors.
-TEST    4xm-1
-TEST    4xm-2
-TEST    8bps
-TEST    aac-demux
-TEST    aasc
-TEST    adpcm-ea-r2
-TEST    adpcm-ea-r3
-TEST    aea-demux
-TEST    alg-mm
-TEST    amv
-TEST    armovie-escape124
-TEST    auravision
-TEST    auravision-v2
-TEST    bethsoft-vid
-TEST    bfi
-TEST    bink-demux
-TEST    bink-demux-video
-TEST    caf
-TEST    cdgraphics
-TEST    cljr
-TEST    corepng
-TEST    creative-adpcm
-TEST    creative-adpcm-8-2.6bit
-TEST    creative-adpcm-8-2bit
-TEST    creative-adpcm-8-4bit
-TEST    creatureshock-avs
-TEST    cryo-apc
-TEST    cscd
-TEST    cvid
-TEST    cvid-palette
-TEST    cyberia-c93
-TEST    cyuv
-TEST    d-cinema-demux
-TEST    delphine-cin
-TEST    deluxepaint-anm
-TEST    dpx
-TEST    duck-dk3
-TEST    duck-dk4
-TEST    duck-tm2
-TEST    ea-cdata
-TEST    ea-cmv
-TEST    ea-dct
-TEST    ea-mad-adpcm-ea-r1
-TEST    ea-mad-pcm-planar
-TEST    ea-tgq
-TEST    ea-tgv-ima-ea-eacs
-TEST    ea-tgv-ima-ea-sead
-TEST    ea-tqi-adpcm
-TEST    ea-vp60
-TEST    ea-vp61
-TEST    feeble-dxa
-TEST    film-cvid-pcm-stereo-8bit
-TEST    flic-af11-palette-change
-TEST    flic-af12
-TEST    flic-magiccarpet
-TEST    fraps-v0
-TEST    fraps-v1
-TEST    fraps-v2
-TEST    fraps-v3
-TEST    fraps-v4
-TEST    fraps-v5
-TEST    frwu
-TEST    funcom-iss
-TEST    id-cin-video
-TEST    idroq-video-dpcm
-TEST    idroq-video-encode
-TEST    iff-byterun1
-TEST    iff-fibonacci
-TEST    iff-ilbm
-TEST    iff-pcm
-TEST    indeo2
-TEST    indeo3
-TEST    indeo5
-TEST    interplay-mve-16bit
-TEST    interplay-mve-8bit
-TEST    iv8-demux
-TEST    kmvc
-TEST    lmlm4-demux
-TEST    loco-rgb
-TEST    loco-yuy2
-TEST    lossless-appleaudio
-TEST    lossless-meridianaudio
-TEST    lossless-monkeysaudio
-TEST    lossless-shortenaudio
-TEST    lossless-tta
-TEST    lossless-wavpackaudio
-TEST    maxis-xa
-TEST    mimic
-TEST    motionpixels
-TEST    mpc7-demux
-TEST    mpc8-demux
-TEST    msrle-8bit
-TEST    msvideo1-16bit
-TEST    msvideo1-8bit
-TEST    mszh
-TEST    mtv
-TEST    mxf-demux
-TEST    nc-demux
-TEST    nsv-demux
-TEST    nuv
-TEST    oma-demux
-TEST    pcm_dvd
-TEST    psx-str
-TEST    psx-str-v3
-TEST    ptx
-TEST    pva-demux
-TEST    qcp-demux
-TEST    qpeg
-TEST    qt-alaw-mono
-TEST    qt-alaw-stereo
-TEST    qt-ima4-mono
-TEST    qt-ima4-stereo
-TEST    qt-mac3-mono
-TEST    qt-mac3-stereo
-TEST    qt-mac6-mono
-TEST    qt-mac6-stereo
-TEST    qt-msadpcm-stereo
-TEST    qt-msimaadpcm-stereo
-TEST    qt-rawpcm-16bit-stereo-signed-be
-TEST    qt-rawpcm-16bit-stereo-signed-le
-TEST    qt-rawpcm-8bit-mono-unsigned
-TEST    qt-rawpcm-8bit-stereo-unsigned
-TEST    qt-ulaw-mono
-TEST    qt-ulaw-stereo
-TEST    qtrle-16bit
-TEST    qtrle-1bit
-TEST    qtrle-24bit
-TEST    qtrle-2bit
-TEST    qtrle-32bit
-TEST    qtrle-4bit
-TEST    qtrle-8bit
-TEST    quickdraw
-TEST    real-14_4
-TEST    real-rv40
-TEST    redcode-demux
-TEST    rl2
-TEST    rpza
-TEST    sierra-audio
-TEST    sierra-vmd
-TEST    siff
-TEST    smacker
-TEST    smc
-TEST    sp5x
-TEST    sub-srt
-TEST    sunraster-1bit-raw
-TEST    sunraster-1bit-rle
-TEST    sunraster-24bit-raw
-TEST    sunraster-24bit-rle
-TEST    sunraster-8bit-raw
-TEST    sunraster-8bit-rle
-TEST    svq1
-TEST    svq3
-TEST    thp-mjpeg-adpcm
-TEST    tiertex-seq
-TEST    tmv
-TEST    truemotion1-15
-TEST    truemotion1-24
-TEST    tscc-15bit
-TEST    tscc-32bit
-TEST    ulti
-TEST    v210
-TEST    vc1
-TEST    vcr1
-TEST    video-xl
-TEST    vmnc-16bit
-TEST    vmnc-32bit
-TEST    vp5
-TEST    vp6a
-TEST    vp6f
-TEST    vqa-cc
-TEST    vqf-demux
-TEST    w64
-TEST    wc3movie-xan
-TEST    westwood-aud
-TEST    wnv1
-TEST    xan-dpcm
-TEST    zlib
-TEST    zmbv-15bit
-TEST    zmbv-16bit
-TEST    zmbv-32bit
-TEST    zmbv-8bit
-TEST    twinvq
-TEST    sipr-16k
-TEST    sipr-8k5
-TEST    sipr-6k5
-TEST    sipr-5k0
-TEST    ra-288
-TEST    ra-cook
-TEST    mpeg2-field-enc
-TEST    qcelp
-TEST    qdm2
-TEST    imc
-TEST    yop
-TEST    pictor
-TEST    dts
-TEST    nellymoser
-TEST    truespeech
-TEST    ac3-2.0
-TEST    ac3-5.1
-TEST    eac3-1
-TEST    eac3-2
-TEST    eac3-3
-TEST    eac3-4
-TEST    atrac1
-TEST    atrac3-1
-TEST    atrac3-2
-TEST    atrac3-3
-TEST    gsm
-TEST    gsm-ms
-TEST    g722dec-1
-TEST    msmpeg4v1
-TEST    wmavoice-7k
-TEST    wmavoice-11k
-TEST    wmavoice-19k
-TEST    wmapro-5.1
-TEST    wmapro-2ch
-TEST    ansi
-TEST    wmv8-drm
-TEST    wmv8-drm-nodec
-TEST    binkaudio-dct
-TEST    binkaudio-rdft
-TEST    txd-pal8
-TEST    txd-16bpp
-TEST    vp3
-TEST    fax-g3
-TEST    fax-g3s
-TEST    ws_snd
-TEST    dxa-scummvm
-TEST    mjpegb
-TEST    rv30
-TEST    sha
-TEST    musepack7
-TEST    amrnb-4k75
-TEST    amrnb-5k15
-TEST    amrnb-5k9
-TEST    amrnb-6k7
-TEST    amrnb-7k4
-TEST    amrnb-7k95
-TEST    amrnb-10k2
-TEST    amrnb-12k2
-TEST    amrwb-6k60
-TEST    amrwb-8k85
-TEST    amrwb-12k65
-TEST    amrwb-14k25
-TEST    amrwb-15k85
-TEST    amrwb-18k25
-TEST    amrwb-19k85
-TEST    amrwb-23k05
-TEST    amrwb-23k85
-TEST    amrwb-23k85-2
-TEST    aac-al04_44
-TEST    aac-al07_96
-TEST    aac-am00_88
-TEST    aac-al_sbr_hq_cm_48_2
-TEST    aac-al_sbr_ps_06_ur
-TEST    mpeg4-als-conformance-00
-TEST    mpeg4-als-conformance-01
-TEST    mpeg4-als-conformance-02
-TEST    mpeg4-als-conformance-03
-TEST    mpeg4-als-conformance-04
-TEST    mpeg4-als-conformance-05
-TEST    fft
-TEST    ifft
-TEST    mdct
-TEST    imdct
-TEST    rdft
-TEST    irdft
-TEST    dct1d
-TEST    idct1d
-TEST    h264-conformance-aud_mw_e
-TEST    h264-conformance-ba1_ft_c
-TEST    h264-conformance-ba1_sony_d
-TEST    h264-conformance-ba2_sony_f
-TEST    h264-conformance-ba3_sva_c
-TEST    h264-conformance-ba_mw_d
-TEST    h264-conformance-bamq1_jvc_c
-TEST    h264-conformance-bamq2_jvc_c
-TEST    h264-conformance-banm_mw_d
-TEST    h264-conformance-basqp1_sony_c
-TEST    h264-conformance-caba1_sony_d
-TEST    h264-conformance-caba1_sva_b
-TEST    h264-conformance-caba2_sony_e
-TEST    h264-conformance-caba2_sva_b
-TEST    h264-conformance-caba3_sony_c
-TEST    h264-conformance-caba3_sva_b
-TEST    h264-conformance-caba3_toshiba_e
-TEST    h264-conformance-cabac_mot_fld0_full
-TEST    h264-conformance-cabac_mot_frm0_full
-TEST    h264-conformance-cabac_mot_mbaff0_full
-TEST    h264-conformance-cabac_mot_picaff0_full
-TEST    h264-conformance-cabaci3_sony_b
-TEST    h264-conformance-cabast3_sony_e
-TEST    h264-conformance-cabastbr3_sony_b
-TEST    h264-conformance-cabref3_sand_d
-TEST    h264-conformance-cacqp3_sony_d
-TEST    h264-conformance-cafi1_sva_c
-TEST    h264-conformance-cama1_sony_c
-TEST    h264-conformance-cama1_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-cama1_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-cama1_toshiba_b	2011-01-17 13:57:12.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0x9a9ce366
--0, 3600, 152064, 0xf4639828
--0, 7200, 152064, 0x625024a3
--0, 10800, 152064, 0x80dc2f9d
--0, 14400, 152064, 0xb2c4feea
--0, 18000, 152064, 0x4ec6ad64
--0, 21600, 152064, 0x1957bec3
--0, 25200, 152064, 0xb682799d
--0, 28800, 152064, 0x34cd2053
--0, 32400, 152064, 0x81490b4c
--0, 36000, 152064, 0x242dc943
--0, 39600, 152064, 0x3e126734
--0, 43200, 152064, 0x8e474ff8
--0, 46800, 152064, 0x239d2fbd
--0, 50400, 152064, 0x0ca3e16f
--0, 54000, 152064, 0x6161d7c2
--0, 57600, 152064, 0xca7ad1af
--0, 61200, 152064, 0xf8ef9026
--0, 64800, 152064, 0x01f2f4c1
--0, 68400, 152064, 0x510b19ec
--0, 72000, 152064, 0xe489028b
--0, 75600, 152064, 0x7a693c1e
--0, 79200, 152064, 0x276b23fe
--0, 82800, 152064, 0x0e9ced3a
--0, 86400, 152064, 0x658228f7
--0, 90000, 152064, 0x6a271bc3
--0, 93600, 152064, 0x431ecd8b
--0, 97200, 152064, 0x23a5ed14
--0, 100800, 152064, 0x76fbe121
--0, 104400, 152064, 0x471f919d
--0, 108000, 152064, 0x16bfabbc
--0, 111600, 152064, 0x0762993f
--0, 115200, 152064, 0x5a2b0b0e
--0, 118800, 152064, 0x81415ef7
--0, 122400, 152064, 0xb96e4164
--0, 126000, 152064, 0xf77aee83
--0, 129600, 152064, 0x6af81633
--0, 133200, 152064, 0xed78e5b5
--0, 136800, 152064, 0x67e38e2c
--0, 140400, 152064, 0x0417ae01
--0, 144000, 152064, 0x3887b312
--0, 147600, 152064, 0x3a4b70fb
--0, 151200, 152064, 0xcaae9e7f
--0, 154800, 152064, 0xaf9597be
--0, 158400, 152064, 0x9bae63d3
--0, 162000, 152064, 0x0e80825f
--0, 165600, 152064, 0x915661fd
--0, 169200, 152064, 0x67d3dc94
--0, 172800, 152064, 0x3dcf240c
--0, 176400, 152064, 0x127ff832
--0, 180000, 152064, 0xc8969981
--0, 183600, 152064, 0x57179c77
--0, 187200, 152064, 0x9f88656c
--0, 190800, 152064, 0xc28ff5d3
--0, 194400, 152064, 0xf100fad9
--0, 198000, 152064, 0xb570ce12
--0, 201600, 152064, 0xe8f28955
--0, 205200, 152064, 0x1f0a9549
--0, 208800, 152064, 0x22b17e9b
--0, 212400, 152064, 0x7cf1400e
--0, 216000, 152064, 0xafd273b7
--0, 219600, 152064, 0xeb9b712e
--0, 223200, 152064, 0x0f81de24
--0, 226800, 152064, 0x8f4e1953
--0, 230400, 152064, 0x682e2170
--0, 234000, 152064, 0xc32ad1b2
--0, 237600, 152064, 0x53a81d79
--0, 241200, 152064, 0x54002596
--0, 244800, 152064, 0x4b5fdbd9
--0, 248400, 152064, 0x96613368
--0, 252000, 152064, 0xd6ac0171
--0, 255600, 152064, 0xf1c1b7b7
--0, 259200, 152064, 0xc730d82f
--0, 262800, 152064, 0x0415d934
--0, 266400, 152064, 0x5338915e
--0, 270000, 152064, 0x8e9dda6d
--0, 273600, 152064, 0xe3a8b0a0
--0, 277200, 152064, 0x5fa36e44
--0, 280800, 152064, 0x0e63dc72
--0, 284400, 152064, 0xd0dad71f
--0, 288000, 152064, 0x0c4aac94
--0, 291600, 152064, 0x60d50e8d
--0, 295200, 152064, 0x96872d7c
--0, 298800, 152064, 0x4fcefc33
--0, 302400, 152064, 0x6b8157c9
--0, 306000, 152064, 0xa40d527d
--0, 309600, 152064, 0x9884480a
--0, 313200, 152064, 0xff5d9754
--0, 316800, 152064, 0x4a26a74d
--0, 320400, 152064, 0x81059e82
-+0, 0, 152064, 0x625024a3
-+0, 3600, 152064, 0x80dc2f9d
-+0, 7200, 152064, 0xb2c4feea
-+0, 10800, 152064, 0x4ec6ad64
-+0, 14400, 152064, 0x1957bec3
-+0, 18000, 152064, 0xb682799d
-+0, 21600, 152064, 0x34cd2053
-+0, 25200, 152064, 0x81490b4c
-+0, 28800, 152064, 0x242dc943
-+0, 32400, 152064, 0x3e126734
-+0, 36000, 152064, 0x8e474ff8
-+0, 39600, 152064, 0x239d2fbd
-+0, 43200, 152064, 0x0ca3e16f
-+0, 46800, 152064, 0x6161d7c2
-+0, 50400, 152064, 0xca7ad1af
-+0, 54000, 152064, 0xf8ef9026
-+0, 57600, 152064, 0x01f2f4c1
-+0, 61200, 152064, 0x510b19ec
-+0, 64800, 152064, 0xe489028b
-+0, 68400, 152064, 0x7a693c1e
-+0, 72000, 152064, 0x276b23fe
-+0, 75600, 152064, 0x0e9ced3a
-+0, 79200, 152064, 0x658228f7
-+0, 82800, 152064, 0x6a271bc3
-+0, 86400, 152064, 0x431ecd8b
-+0, 90000, 152064, 0x23a5ed14
-+0, 93600, 152064, 0x76fbe121
-+0, 97200, 152064, 0x471f919d
-+0, 100800, 152064, 0x16bfabbc
-+0, 104400, 152064, 0x0762993f
-+0, 108000, 152064, 0x5a2b0b0e
-+0, 111600, 152064, 0x81415ef7
-+0, 115200, 152064, 0xb96e4164
-+0, 118800, 152064, 0xf77aee83
-+0, 122400, 152064, 0x6af81633
-+0, 126000, 152064, 0xed78e5b5
-+0, 129600, 152064, 0x67e38e2c
-+0, 133200, 152064, 0x0417ae01
-+0, 136800, 152064, 0x3887b312
-+0, 140400, 152064, 0x3a4b70fb
-+0, 144000, 152064, 0xcaae9e7f
-+0, 147600, 152064, 0xaf9597be
-+0, 151200, 152064, 0x9bae63d3
-+0, 154800, 152064, 0x0e80825f
-+0, 158400, 152064, 0x915661fd
-+0, 162000, 152064, 0x67d3dc94
-+0, 165600, 152064, 0x3dcf240c
-+0, 169200, 152064, 0x127ff832
-+0, 172800, 152064, 0xc8969981
-+0, 176400, 152064, 0x57179c77
-+0, 180000, 152064, 0x9f88656c
-+0, 183600, 152064, 0xc28ff5d3
-+0, 187200, 152064, 0xf100fad9
-+0, 190800, 152064, 0xb570ce12
-+0, 194400, 152064, 0xe8f28955
-+0, 198000, 152064, 0x1f0a9549
-+0, 201600, 152064, 0x22b17e9b
-+0, 205200, 152064, 0x7cf1400e
-+0, 208800, 152064, 0xafd273b7
-+0, 212400, 152064, 0xeb9b712e
-+0, 216000, 152064, 0x0f81de24
-+0, 219600, 152064, 0x8f4e1953
-+0, 223200, 152064, 0x682e2170
-+0, 226800, 152064, 0xc32ad1b2
-+0, 230400, 152064, 0x53a81d79
-+0, 234000, 152064, 0x54002596
-+0, 237600, 152064, 0x4b5fdbd9
-+0, 241200, 152064, 0x96613368
-+0, 244800, 152064, 0xd6ac0171
-+0, 248400, 152064, 0xf1c1b7b7
-+0, 252000, 152064, 0xc730d82f
-+0, 255600, 152064, 0x0415d934
-+0, 259200, 152064, 0x5338915e
-+0, 262800, 152064, 0x8e9dda6d
-+0, 266400, 152064, 0xe3a8b0a0
-+0, 270000, 152064, 0x5fa36e44
-+0, 273600, 152064, 0x0e63dc72
-+0, 277200, 152064, 0xd0dad71f
-+0, 280800, 152064, 0x0c4aac94
-+0, 284400, 152064, 0x60d50e8d
-+0, 288000, 152064, 0x96872d7c
-+0, 291600, 152064, 0x4fcefc33
-+0, 295200, 152064, 0x6b8157c9
-+0, 298800, 152064, 0xa40d527d
-+0, 302400, 152064, 0x9884480a
-+0, 306000, 152064, 0xff5d9754
-+0, 309600, 152064, 0x4a26a74d
-+0, 313200, 152064, 0x81059e82
-make: *** [fate-h264-conformance-cama1_toshiba_b] Error 1
-TEST    h264-conformance-cama1_vtc_c
-TEST    h264-conformance-cama2_vtc_b
-TEST    h264-conformance-cama3_sand_e
-TEST    h264-conformance-cama3_vtc_b
-TEST    h264-conformance-camaci3_sony_c
-TEST    h264-conformance-camanl1_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-camanl1_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-camanl1_toshiba_b	2011-01-17 13:57:13.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0xb1edd842
--0, 3600, 152064, 0x551f8f45
--0, 7200, 152064, 0xb4931cb2
--0, 10800, 152064, 0x78882b27
--0, 14400, 152064, 0x3afef36d
--0, 18000, 152064, 0x85afad0a
--0, 21600, 152064, 0x3a8bab81
--0, 25200, 152064, 0x2a437174
--0, 28800, 152064, 0x22421437
--0, 32400, 152064, 0x39c5f125
--0, 36000, 152064, 0x256eaad2
--0, 39600, 152064, 0x668a5d31
--0, 43200, 152064, 0x412a4aa7
--0, 46800, 152064, 0x3f091baf
--0, 50400, 152064, 0xbf16d262
--0, 54000, 152064, 0x2fc4ce67
--0, 57600, 152064, 0x119cde3e
--0, 61200, 152064, 0xb40b8632
--0, 64800, 152064, 0x4be4f192
--0, 68400, 152064, 0x906c1237
--0, 72000, 152064, 0x95380024
--0, 75600, 152064, 0x6a833025
--0, 79200, 152064, 0x681d1c4f
--0, 82800, 152064, 0x08c8dea4
--0, 86400, 152064, 0xc69226f0
--0, 90000, 152064, 0x86631102
--0, 93600, 152064, 0x7f40c77a
--0, 97200, 152064, 0xc746ddd4
--0, 100800, 152064, 0x5f2bd3cb
--0, 104400, 152064, 0x643c8316
--0, 108000, 152064, 0x5b7fa380
--0, 111600, 152064, 0x82438cf7
--0, 115200, 152064, 0xdee0f7e7
--0, 118800, 152064, 0xc50d41f1
--0, 122400, 152064, 0xf3453631
--0, 126000, 152064, 0x90bce66b
--0, 129600, 152064, 0x045b03f7
--0, 133200, 152064, 0xf64bd756
--0, 136800, 152064, 0xff997ef2
--0, 140400, 152064, 0x3613a0a5
--0, 144000, 152064, 0xe6a7a8d6
--0, 147600, 152064, 0xb0906c42
--0, 151200, 152064, 0x4dfc912b
--0, 154800, 152064, 0x81e3991c
--0, 158400, 152064, 0x4efc61fb
--0, 162000, 152064, 0xed478395
--0, 165600, 152064, 0x4cb25ab6
--0, 169200, 152064, 0x28e7d51f
--0, 172800, 152064, 0x8bcc1a8d
--0, 176400, 152064, 0x2fe1f240
--0, 180000, 152064, 0xb4978ef8
--0, 183600, 152064, 0xe3929556
--0, 187200, 152064, 0xd370632a
--0, 190800, 152064, 0xba86ffb2
--0, 194400, 152064, 0x444bf18c
--0, 198000, 152064, 0xab40bd14
--0, 201600, 152064, 0xfd488a5d
--0, 205200, 152064, 0xe1f09568
--0, 208800, 152064, 0x09ee7a7e
--0, 212400, 152064, 0x9360397c
--0, 216000, 152064, 0xdbd467e9
--0, 219600, 152064, 0x99726777
--0, 223200, 152064, 0x009fd46c
--0, 226800, 152064, 0xcf770fdb
--0, 230400, 152064, 0x2a890fd9
--0, 234000, 152064, 0x7f40de4b
--0, 237600, 152064, 0x04191304
--0, 241200, 152064, 0x15722022
--0, 244800, 152064, 0x59f4ea93
--0, 248400, 152064, 0x28ba373f
--0, 252000, 152064, 0xf9e400b8
--0, 255600, 152064, 0x85c4bd98
--0, 259200, 152064, 0x6917d2a5
--0, 262800, 152064, 0x61cae234
--0, 266400, 152064, 0x752a9a2d
--0, 270000, 152064, 0x1ee2d9bd
--0, 273600, 152064, 0xdce9ab8e
--0, 277200, 152064, 0x51225fd0
--0, 280800, 152064, 0x10e8cb60
--0, 284400, 152064, 0x8d07cd25
--0, 288000, 152064, 0xb18ba61b
--0, 291600, 152064, 0xb0f10280
--0, 295200, 152064, 0x76a71f13
--0, 298800, 152064, 0x3004f5a1
--0, 302400, 152064, 0x9aba5724
--0, 306000, 152064, 0x5db85385
--0, 309600, 152064, 0xbe9d3f5b
--0, 313200, 152064, 0xa71e85bb
--0, 316800, 152064, 0xdcf59cd7
--0, 320400, 152064, 0x5e319459
-+0, 0, 152064, 0xb4931cb2
-+0, 3600, 152064, 0x78882b27
-+0, 7200, 152064, 0x3afef36d
-+0, 10800, 152064, 0x85afad0a
-+0, 14400, 152064, 0x3a8bab81
-+0, 18000, 152064, 0x2a437174
-+0, 21600, 152064, 0x22421437
-+0, 25200, 152064, 0x39c5f125
-+0, 28800, 152064, 0x256eaad2
-+0, 32400, 152064, 0x668a5d31
-+0, 36000, 152064, 0x412a4aa7
-+0, 39600, 152064, 0x3f091baf
-+0, 43200, 152064, 0xbf16d262
-+0, 46800, 152064, 0x2fc4ce67
-+0, 50400, 152064, 0x119cde3e
-+0, 54000, 152064, 0xb40b8632
-+0, 57600, 152064, 0x4be4f192
-+0, 61200, 152064, 0x906c1237
-+0, 64800, 152064, 0x95380024
-+0, 68400, 152064, 0x6a833025
-+0, 72000, 152064, 0x681d1c4f
-+0, 75600, 152064, 0x08c8dea4
-+0, 79200, 152064, 0xc69226f0
-+0, 82800, 152064, 0x86631102
-+0, 86400, 152064, 0x7f40c77a
-+0, 90000, 152064, 0xc746ddd4
-+0, 93600, 152064, 0x5f2bd3cb
-+0, 97200, 152064, 0x643c8316
-+0, 100800, 152064, 0x5b7fa380
-+0, 104400, 152064, 0x82438cf7
-+0, 108000, 152064, 0xdee0f7e7
-+0, 111600, 152064, 0xc50d41f1
-+0, 115200, 152064, 0xf3453631
-+0, 118800, 152064, 0x90bce66b
-+0, 122400, 152064, 0x045b03f7
-+0, 126000, 152064, 0xf64bd756
-+0, 129600, 152064, 0xff997ef2
-+0, 133200, 152064, 0x3613a0a5
-+0, 136800, 152064, 0xe6a7a8d6
-+0, 140400, 152064, 0xb0906c42
-+0, 144000, 152064, 0x4dfc912b
-+0, 147600, 152064, 0x81e3991c
-+0, 151200, 152064, 0x4efc61fb
-+0, 154800, 152064, 0xed478395
-+0, 158400, 152064, 0x4cb25ab6
-+0, 162000, 152064, 0x28e7d51f
-+0, 165600, 152064, 0x8bcc1a8d
-+0, 169200, 152064, 0x2fe1f240
-+0, 172800, 152064, 0xb4978ef8
-+0, 176400, 152064, 0xe3929556
-+0, 180000, 152064, 0xd370632a
-+0, 183600, 152064, 0xba86ffb2
-+0, 187200, 152064, 0x444bf18c
-+0, 190800, 152064, 0xab40bd14
-+0, 194400, 152064, 0xfd488a5d
-+0, 198000, 152064, 0xe1f09568
-+0, 201600, 152064, 0x09ee7a7e
-+0, 205200, 152064, 0x9360397c
-+0, 208800, 152064, 0xdbd467e9
-+0, 212400, 152064, 0x99726777
-+0, 216000, 152064, 0x009fd46c
-+0, 219600, 152064, 0xcf770fdb
-+0, 223200, 152064, 0x2a890fd9
-+0, 226800, 152064, 0x7f40de4b
-+0, 230400, 152064, 0x04191304
-+0, 234000, 152064, 0x15722022
-+0, 237600, 152064, 0x59f4ea93
-+0, 241200, 152064, 0x28ba373f
-+0, 244800, 152064, 0xf9e400b8
-+0, 248400, 152064, 0x85c4bd98
-+0, 252000, 152064, 0x6917d2a5
-+0, 255600, 152064, 0x61cae234
-+0, 259200, 152064, 0x752a9a2d
-+0, 262800, 152064, 0x1ee2d9bd
-+0, 266400, 152064, 0xdce9ab8e
-+0, 270000, 152064, 0x51225fd0
-+0, 273600, 152064, 0x10e8cb60
-+0, 277200, 152064, 0x8d07cd25
-+0, 280800, 152064, 0xb18ba61b
-+0, 284400, 152064, 0xb0f10280
-+0, 288000, 152064, 0x76a71f13
-+0, 291600, 152064, 0x3004f5a1
-+0, 295200, 152064, 0x9aba5724
-+0, 298800, 152064, 0x5db85385
-+0, 302400, 152064, 0xbe9d3f5b
-+0, 306000, 152064, 0xa71e85bb
-+0, 309600, 152064, 0xdcf59cd7
-+0, 313200, 152064, 0x5e319459
-make: *** [fate-h264-conformance-camanl1_toshiba_b] Error 1
-TEST    h264-conformance-camanl2_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-camanl2_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-camanl2_toshiba_b	2011-01-17 13:57:13.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0xb1edd842
--0, 3600, 152064, 0x551f8f45
--0, 7200, 152064, 0xb4931cb2
--0, 10800, 152064, 0x5f352e98
--0, 14400, 152064, 0xeba5fe28
--0, 18000, 152064, 0x85afad0a
--0, 21600, 152064, 0x1120b6a4
--0, 25200, 152064, 0x67506e16
--0, 28800, 152064, 0x22421437
--0, 32400, 152064, 0x929becd6
--0, 36000, 152064, 0x6ffcb4b0
--0, 39600, 152064, 0x668a5d31
--0, 43200, 152064, 0x1b034ebb
--0, 46800, 152064, 0x7e2d213c
--0, 50400, 152064, 0xbf16d262
--0, 54000, 152064, 0xdeaecab3
--0, 57600, 152064, 0xd220d704
--0, 61200, 152064, 0xb40b8632
--0, 64800, 152064, 0xbdf0ef57
--0, 68400, 152064, 0x7e2e10df
--0, 72000, 152064, 0x95380024
--0, 75600, 152064, 0xdb80256d
--0, 79200, 152064, 0xa4561c61
--0, 82800, 152064, 0x08c8dea4
--0, 86400, 152064, 0x7bb917d6
--0, 90000, 152064, 0x796f0e2b
--0, 93600, 152064, 0x7f40c77a
--0, 97200, 152064, 0xda32de2e
--0, 100800, 152064, 0x00ffc15a
--0, 104400, 152064, 0x643c8316
--0, 108000, 152064, 0xb7588f7f
--0, 111600, 152064, 0xa4e07c02
--0, 115200, 152064, 0xdee0f7e7
--0, 118800, 152064, 0x2c3245ee
--0, 122400, 152064, 0x6565355b
--0, 126000, 152064, 0x90bce66b
--0, 129600, 152064, 0x0abffe08
--0, 133200, 152064, 0x119ccc3e
--0, 136800, 152064, 0xff997ef2
--0, 140400, 152064, 0xba4b9820
--0, 144000, 152064, 0xb6dfa596
--0, 147600, 152064, 0xb0906c42
--0, 151200, 152064, 0xf3c29133
--0, 154800, 152064, 0x08cd8e2b
--0, 158400, 152064, 0x4efc61fb
--0, 162000, 152064, 0x5b7c6e48
--0, 165600, 152064, 0xd28a47c2
--0, 169200, 152064, 0x28e7d51f
--0, 172800, 152064, 0x3a5619b1
--0, 176400, 152064, 0xa517e7f2
--0, 180000, 152064, 0xb4978ef8
--0, 183600, 152064, 0x25929175
--0, 187200, 152064, 0x20f05834
--0, 190800, 152064, 0xba86ffb2
--0, 194400, 152064, 0xa265f06f
--0, 198000, 152064, 0x97bbbfb7
--0, 201600, 152064, 0xfd488a5d
--0, 205200, 152064, 0x1b0989da
--0, 208800, 152064, 0xfd1878ce
--0, 212400, 152064, 0x9360397c
--0, 216000, 152064, 0x0d8151a7
--0, 219600, 152064, 0xe7a05bb8
--0, 223200, 152064, 0x009fd46c
--0, 226800, 152064, 0x8751123f
--0, 230400, 152064, 0x8252101a
--0, 234000, 152064, 0x7f40de4b
--0, 237600, 152064, 0x4ea317fe
--0, 241200, 152064, 0x519224d9
--0, 244800, 152064, 0x59f4ea93
--0, 248400, 152064, 0xc93c1dba
--0, 252000, 152064, 0xe3c9fb61
--0, 255600, 152064, 0x85c4bd98
--0, 259200, 152064, 0xcebacfd3
--0, 262800, 152064, 0x7327da99
--0, 266400, 152064, 0x752a9a2d
--0, 270000, 152064, 0x5ea6c8d2
--0, 273600, 152064, 0x66fd8c6f
--0, 277200, 152064, 0x51225fd0
--0, 280800, 152064, 0x58b9be96
--0, 284400, 152064, 0xa5abcdb7
--0, 288000, 152064, 0xb18ba61b
--0, 291600, 152064, 0xc7d20190
--0, 295200, 152064, 0xb6da14aa
--0, 298800, 152064, 0x3004f5a1
--0, 302400, 152064, 0x129354e2
--0, 306000, 152064, 0xffa148d5
--0, 309600, 152064, 0xbe9d3f5b
--0, 313200, 152064, 0x1c7f8976
--0, 316800, 152064, 0xa107a54d
--0, 320400, 152064, 0x5e319459
-+0, 0, 152064, 0xb4931cb2
-+0, 3600, 152064, 0x5f352e98
-+0, 7200, 152064, 0xeba5fe28
-+0, 10800, 152064, 0x85afad0a
-+0, 14400, 152064, 0x1120b6a4
-+0, 18000, 152064, 0x67506e16
-+0, 21600, 152064, 0x22421437
-+0, 25200, 152064, 0x929becd6
-+0, 28800, 152064, 0x6ffcb4b0
-+0, 32400, 152064, 0x668a5d31
-+0, 36000, 152064, 0x1b034ebb
-+0, 39600, 152064, 0x7e2d213c
-+0, 43200, 152064, 0xbf16d262
-+0, 46800, 152064, 0xdeaecab3
-+0, 50400, 152064, 0xd220d704
-+0, 54000, 152064, 0xb40b8632
-+0, 57600, 152064, 0xbdf0ef57
-+0, 61200, 152064, 0x7e2e10df
-+0, 64800, 152064, 0x95380024
-+0, 68400, 152064, 0xdb80256d
-+0, 72000, 152064, 0xa4561c61
-+0, 75600, 152064, 0x08c8dea4
-+0, 79200, 152064, 0x7bb917d6
-+0, 82800, 152064, 0x796f0e2b
-+0, 86400, 152064, 0x7f40c77a
-+0, 90000, 152064, 0xda32de2e
-+0, 93600, 152064, 0x00ffc15a
-+0, 97200, 152064, 0x643c8316
-+0, 100800, 152064, 0xb7588f7f
-+0, 104400, 152064, 0xa4e07c02
-+0, 108000, 152064, 0xdee0f7e7
-+0, 111600, 152064, 0x2c3245ee
-+0, 115200, 152064, 0x6565355b
-+0, 118800, 152064, 0x90bce66b
-+0, 122400, 152064, 0x0abffe08
-+0, 126000, 152064, 0x119ccc3e
-+0, 129600, 152064, 0xff997ef2
-+0, 133200, 152064, 0xba4b9820
-+0, 136800, 152064, 0xb6dfa596
-+0, 140400, 152064, 0xb0906c42
-+0, 144000, 152064, 0xf3c29133
-+0, 147600, 152064, 0x08cd8e2b
-+0, 151200, 152064, 0x4efc61fb
-+0, 154800, 152064, 0x5b7c6e48
-+0, 158400, 152064, 0xd28a47c2
-+0, 162000, 152064, 0x28e7d51f
-+0, 165600, 152064, 0x3a5619b1
-+0, 169200, 152064, 0xa517e7f2
-+0, 172800, 152064, 0xb4978ef8
-+0, 176400, 152064, 0x25929175
-+0, 180000, 152064, 0x20f05834
-+0, 183600, 152064, 0xba86ffb2
-+0, 187200, 152064, 0xa265f06f
-+0, 190800, 152064, 0x97bbbfb7
-+0, 194400, 152064, 0xfd488a5d
-+0, 198000, 152064, 0x1b0989da
-+0, 201600, 152064, 0xfd1878ce
-+0, 205200, 152064, 0x9360397c
-+0, 208800, 152064, 0x0d8151a7
-+0, 212400, 152064, 0xe7a05bb8
-+0, 216000, 152064, 0x009fd46c
-+0, 219600, 152064, 0x8751123f
-+0, 223200, 152064, 0x8252101a
-+0, 226800, 152064, 0x7f40de4b
-+0, 230400, 152064, 0x4ea317fe
-+0, 234000, 152064, 0x519224d9
-+0, 237600, 152064, 0x59f4ea93
-+0, 241200, 152064, 0xc93c1dba
-+0, 244800, 152064, 0xe3c9fb61
-+0, 248400, 152064, 0x85c4bd98
-+0, 252000, 152064, 0xcebacfd3
-+0, 255600, 152064, 0x7327da99
-+0, 259200, 152064, 0x752a9a2d
-+0, 262800, 152064, 0x5ea6c8d2
-+0, 266400, 152064, 0x66fd8c6f
-+0, 270000, 152064, 0x51225fd0
-+0, 273600, 152064, 0x58b9be96
-+0, 277200, 152064, 0xa5abcdb7
-+0, 280800, 152064, 0xb18ba61b
-+0, 284400, 152064, 0xc7d20190
-+0, 288000, 152064, 0xb6da14aa
-+0, 291600, 152064, 0x3004f5a1
-+0, 295200, 152064, 0x129354e2
-+0, 298800, 152064, 0xffa148d5
-+0, 302400, 152064, 0xbe9d3f5b
-+0, 306000, 152064, 0x1c7f8976
-+0, 309600, 152064, 0xa107a54d
-+0, 313200, 152064, 0x5e319459
-make: *** [fate-h264-conformance-camanl2_toshiba_b] Error 1
-TEST    h264-conformance-camanl3_sand_e
-TEST    h264-conformance-camasl3_sony_b
-TEST    h264-conformance-camp_mot_mbaff_l30
-TEST    h264-conformance-camp_mot_mbaff_l31
-TEST    h264-conformance-canl1_sony_e
-TEST    h264-conformance-canl1_sva_b
-TEST    h264-conformance-canl1_toshiba_g
-TEST    h264-conformance-canl2_sony_e
-TEST    h264-conformance-canl2_sva_b
-TEST    h264-conformance-canl3_sony_c
-TEST    h264-conformance-canl3_sva_b
-TEST    h264-conformance-canl4_sva_b
-TEST    h264-conformance-canlma2_sony_c
-TEST    h264-conformance-canlma3_sony_c
-TEST    h264-conformance-capa1_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-capa1_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-capa1_toshiba_b	2011-01-17 13:57:16.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0x4040d2fc
--0, 3600, 152064, 0x0d8f9897
--0, 7200, 152064, 0xc23321cd
--0, 10800, 152064, 0x3c9225eb
--0, 14400, 152064, 0x8927006f
--0, 18000, 152064, 0xf706a302
--0, 21600, 152064, 0x8219c106
--0, 25200, 152064, 0x06c990ea
--0, 28800, 152064, 0x3a0f1135
--0, 32400, 152064, 0x4cff21d3
--0, 36000, 152064, 0x6be0e050
--0, 39600, 152064, 0x718b6c7b
--0, 43200, 152064, 0x24b38713
--0, 46800, 152064, 0x500553fb
--0, 50400, 152064, 0x531ae610
--0, 54000, 152064, 0x46f4ff1b
--0, 57600, 152064, 0xe5abe5ff
--0, 61200, 152064, 0x97daa351
--0, 64800, 152064, 0xfbef0a8f
--0, 68400, 152064, 0xbe76134f
--0, 72000, 152064, 0xa4bf10ea
--0, 75600, 152064, 0xb2fb32af
--0, 79200, 152064, 0xd33027a5
--0, 82800, 152064, 0x78e20c2b
--0, 86400, 152064, 0xefda2d6f
--0, 90000, 152064, 0xb99126f0
--0, 93600, 152064, 0x89d7e465
--0, 97200, 152064, 0x6150ff97
--0, 100800, 152064, 0xde03d937
--0, 104400, 152064, 0xd90ca874
--0, 108000, 152064, 0xb120b294
--0, 111600, 152064, 0x644eade4
--0, 115200, 152064, 0xd1bb004f
--0, 118800, 152064, 0x99806a8b
--0, 122400, 152064, 0x8c6b635f
--0, 126000, 152064, 0xa269fa8b
--0, 129600, 152064, 0xc11c0e64
--0, 133200, 152064, 0xac13f5eb
--0, 136800, 152064, 0x895799cf
--0, 140400, 152064, 0x95a9bea1
--0, 144000, 152064, 0xe998dfba
--0, 147600, 152064, 0xc72d8460
--0, 151200, 152064, 0xd1cb9b9a
--0, 154800, 152064, 0xb49aadd3
--0, 158400, 152064, 0x8bc38547
--0, 162000, 152064, 0x3485984b
--0, 165600, 152064, 0xdf305c0a
--0, 169200, 152064, 0x6a1ec990
--0, 172800, 152064, 0x595e0de4
--0, 176400, 152064, 0xe1baf7c4
--0, 180000, 152064, 0xf08b9b47
--0, 183600, 152064, 0x6532ba6f
--0, 187200, 152064, 0x3de67da6
--0, 190800, 152064, 0x439ffd04
--0, 194400, 152064, 0x6e6c1e97
--0, 198000, 152064, 0x8e5aee7a
--0, 201600, 152064, 0xd634999a
--0, 205200, 152064, 0xadfa9e8b
--0, 208800, 152064, 0x1b9090f5
--0, 212400, 152064, 0x29094dfc
--0, 216000, 152064, 0x56748851
--0, 219600, 152064, 0x2316719d
--0, 223200, 152064, 0x2ee0060b
--0, 226800, 152064, 0x3edb36d4
--0, 230400, 152064, 0x9ef437a3
--0, 234000, 152064, 0x8d9af72e
--0, 237600, 152064, 0xab86389c
--0, 241200, 152064, 0xd3b34576
--0, 244800, 152064, 0x9e5b04f4
--0, 248400, 152064, 0x6a164c17
--0, 252000, 152064, 0xcecf20ab
--0, 255600, 152064, 0x07c8e273
--0, 259200, 152064, 0x9b46fe6a
--0, 262800, 152064, 0xc1e8002b
--0, 266400, 152064, 0xdebdbe53
--0, 270000, 152064, 0x0d2dfd99
--0, 273600, 152064, 0xe8ae925f
--0, 277200, 152064, 0xe1fe6272
--0, 280800, 152064, 0xbb74d5e6
--0, 284400, 152064, 0xc7b5d949
--0, 288000, 152064, 0x9b15b020
--0, 291600, 152064, 0xc8201f44
--0, 295200, 152064, 0x30d03303
--0, 298800, 152064, 0x9f66fbc2
--0, 302400, 152064, 0x482b71ec
--0, 306000, 152064, 0x1c9e50bf
--0, 309600, 152064, 0x89f247e4
--0, 313200, 152064, 0xaa5f9141
--0, 316800, 152064, 0xb816aa8c
--0, 320400, 152064, 0x3112a619
-+0, 0, 152064, 0xc23321cd
-+0, 3600, 152064, 0x3c9225eb
-+0, 7200, 152064, 0x8927006f
-+0, 10800, 152064, 0xf706a302
-+0, 14400, 152064, 0x8219c106
-+0, 18000, 152064, 0x06c990ea
-+0, 21600, 152064, 0x3a0f1135
-+0, 25200, 152064, 0x4cff21d3
-+0, 28800, 152064, 0x6be0e050
-+0, 32400, 152064, 0x718b6c7b
-+0, 36000, 152064, 0x24b38713
-+0, 39600, 152064, 0x500553fb
-+0, 43200, 152064, 0x531ae610
-+0, 46800, 152064, 0x46f4ff1b
-+0, 50400, 152064, 0xe5abe5ff
-+0, 54000, 152064, 0x97daa351
-+0, 57600, 152064, 0xfbef0a8f
-+0, 61200, 152064, 0xbe76134f
-+0, 64800, 152064, 0xa4bf10ea
-+0, 68400, 152064, 0xb2fb32af
-+0, 72000, 152064, 0xd33027a5
-+0, 75600, 152064, 0x78e20c2b
-+0, 79200, 152064, 0xefda2d6f
-+0, 82800, 152064, 0xb99126f0
-+0, 86400, 152064, 0x89d7e465
-+0, 90000, 152064, 0x6150ff97
-+0, 93600, 152064, 0xde03d937
-+0, 97200, 152064, 0xd90ca874
-+0, 100800, 152064, 0xb120b294
-+0, 104400, 152064, 0x644eade4
-+0, 108000, 152064, 0xd1bb004f
-+0, 111600, 152064, 0x99806a8b
-+0, 115200, 152064, 0x8c6b635f
-+0, 118800, 152064, 0xa269fa8b
-+0, 122400, 152064, 0xc11c0e64
-+0, 126000, 152064, 0xac13f5eb
-+0, 129600, 152064, 0x895799cf
-+0, 133200, 152064, 0x95a9bea1
-+0, 136800, 152064, 0xe998dfba
-+0, 140400, 152064, 0xc72d8460
-+0, 144000, 152064, 0xd1cb9b9a
-+0, 147600, 152064, 0xb49aadd3
-+0, 151200, 152064, 0x8bc38547
-+0, 154800, 152064, 0x3485984b
-+0, 158400, 152064, 0xdf305c0a
-+0, 162000, 152064, 0x6a1ec990
-+0, 165600, 152064, 0x595e0de4
-+0, 169200, 152064, 0xe1baf7c4
-+0, 172800, 152064, 0xf08b9b47
-+0, 176400, 152064, 0x6532ba6f
-+0, 180000, 152064, 0x3de67da6
-+0, 183600, 152064, 0x439ffd04
-+0, 187200, 152064, 0x6e6c1e97
-+0, 190800, 152064, 0x8e5aee7a
-+0, 194400, 152064, 0xd634999a
-+0, 198000, 152064, 0xadfa9e8b
-+0, 201600, 152064, 0x1b9090f5
-+0, 205200, 152064, 0x29094dfc
-+0, 208800, 152064, 0x56748851
-+0, 212400, 152064, 0x2316719d
-+0, 216000, 152064, 0x2ee0060b
-+0, 219600, 152064, 0x3edb36d4
-+0, 223200, 152064, 0x9ef437a3
-+0, 226800, 152064, 0x8d9af72e
-+0, 230400, 152064, 0xab86389c
-+0, 234000, 152064, 0xd3b34576
-+0, 237600, 152064, 0x9e5b04f4
-+0, 241200, 152064, 0x6a164c17
-+0, 244800, 152064, 0xcecf20ab
-+0, 248400, 152064, 0x07c8e273
-+0, 252000, 152064, 0x9b46fe6a
-+0, 255600, 152064, 0xc1e8002b
-+0, 259200, 152064, 0xdebdbe53
-+0, 262800, 152064, 0x0d2dfd99
-+0, 266400, 152064, 0xe8ae925f
-+0, 270000, 152064, 0xe1fe6272
-+0, 273600, 152064, 0xbb74d5e6
-+0, 277200, 152064, 0xc7b5d949
-+0, 280800, 152064, 0x9b15b020
-+0, 284400, 152064, 0xc8201f44
-+0, 288000, 152064, 0x30d03303
-+0, 291600, 152064, 0x9f66fbc2
-+0, 295200, 152064, 0x482b71ec
-+0, 298800, 152064, 0x1c9e50bf
-+0, 302400, 152064, 0x89f247e4
-+0, 306000, 152064, 0xaa5f9141
-+0, 309600, 152064, 0xb816aa8c
-+0, 313200, 152064, 0x3112a619
-make: *** [fate-h264-conformance-capa1_toshiba_b] Error 1
-TEST    h264-conformance-capama3_sand_f
-TEST    h264-conformance-capcm1_sand_e
-TEST    h264-conformance-capcmnl1_sand_e
-TEST    h264-conformance-capm3_sony_d
-TEST    h264-conformance-caqp1_sony_b
-TEST    h264-conformance-cavlc_mot_fld0_full_b
-TEST    h264-conformance-cavlc_mot_frm0_full_b
-TEST    h264-conformance-cavlc_mot_mbaff0_full_b
-TEST    h264-conformance-cavlc_mot_picaff0_full_b
-TEST    h264-conformance-cawp1_toshiba_e
-TEST    h264-conformance-cawp5_toshiba_e
-TEST    h264-conformance-ci1_ft_b
-TEST    h264-conformance-ci_mw_d
-TEST    h264-conformance-cvbs3_sony_c
-TEST    h264-conformance-cvcanlma2_sony_c
-TEST    h264-conformance-cvfi1_sony_d
-TEST    h264-conformance-cvfi1_sva_c
-TEST    h264-conformance-cvfi2_sony_h
-TEST    h264-conformance-cvfi2_sva_c
-TEST    h264-conformance-cvma1_sony_d
-TEST    h264-conformance-cvma1_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-cvma1_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-cvma1_toshiba_b	2011-01-17 13:57:20.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0x9a9ce366
--0, 3600, 152064, 0xf4639828
--0, 7200, 152064, 0x625024a3
--0, 10800, 152064, 0x80dc2f9d
--0, 14400, 152064, 0xb2c4feea
--0, 18000, 152064, 0x4ec6ad64
--0, 21600, 152064, 0x1957bec3
--0, 25200, 152064, 0xb682799d
--0, 28800, 152064, 0x34cd2053
--0, 32400, 152064, 0x81490b4c
--0, 36000, 152064, 0x242dc943
--0, 39600, 152064, 0x3e126734
--0, 43200, 152064, 0x8e474ff8
--0, 46800, 152064, 0x239d2fbd
--0, 50400, 152064, 0x0ca3e16f
--0, 54000, 152064, 0x6161d7c2
--0, 57600, 152064, 0xca7ad1af
--0, 61200, 152064, 0xf8ef9026
--0, 64800, 152064, 0x01f2f4c1
--0, 68400, 152064, 0x510b19ec
--0, 72000, 152064, 0xe489028b
--0, 75600, 152064, 0x7a693c1e
--0, 79200, 152064, 0x276b23fe
--0, 82800, 152064, 0x0e9ced3a
--0, 86400, 152064, 0x658228f7
--0, 90000, 152064, 0x6a271bc3
--0, 93600, 152064, 0x431ecd8b
--0, 97200, 152064, 0x23a5ed14
--0, 100800, 152064, 0x76fbe121
--0, 104400, 152064, 0x471f919d
--0, 108000, 152064, 0x16bfabbc
--0, 111600, 152064, 0x0762993f
--0, 115200, 152064, 0x5a2b0b0e
--0, 118800, 152064, 0x81415ef7
--0, 122400, 152064, 0xb96e4164
--0, 126000, 152064, 0xf77aee83
--0, 129600, 152064, 0x6af81633
--0, 133200, 152064, 0xed78e5b5
--0, 136800, 152064, 0x67e38e2c
--0, 140400, 152064, 0x0417ae01
--0, 144000, 152064, 0x3887b312
--0, 147600, 152064, 0x3a4b70fb
--0, 151200, 152064, 0xcaae9e7f
--0, 154800, 152064, 0xaf9597be
--0, 158400, 152064, 0x9bae63d3
--0, 162000, 152064, 0x0e80825f
--0, 165600, 152064, 0x915661fd
--0, 169200, 152064, 0x67d3dc94
--0, 172800, 152064, 0x3dcf240c
--0, 176400, 152064, 0x127ff832
--0, 180000, 152064, 0xc8969981
--0, 183600, 152064, 0x57179c77
--0, 187200, 152064, 0x9f88656c
--0, 190800, 152064, 0xc28ff5d3
--0, 194400, 152064, 0xf100fad9
--0, 198000, 152064, 0xb570ce12
--0, 201600, 152064, 0xe8f28955
--0, 205200, 152064, 0x1f0a9549
--0, 208800, 152064, 0x22b17e9b
--0, 212400, 152064, 0x7cf1400e
--0, 216000, 152064, 0xafd273b7
--0, 219600, 152064, 0xeb9b712e
--0, 223200, 152064, 0x0f81de24
--0, 226800, 152064, 0x8f4e1953
--0, 230400, 152064, 0x682e2170
--0, 234000, 152064, 0xc32ad1b2
--0, 237600, 152064, 0x53a81d79
--0, 241200, 152064, 0x54002596
--0, 244800, 152064, 0x4b5fdbd9
--0, 248400, 152064, 0x96613368
--0, 252000, 152064, 0xd6ac0171
--0, 255600, 152064, 0xf1c1b7b7
--0, 259200, 152064, 0xc730d82f
--0, 262800, 152064, 0x0415d934
--0, 266400, 152064, 0x5338915e
--0, 270000, 152064, 0x8e9dda6d
--0, 273600, 152064, 0xe3a8b0a0
--0, 277200, 152064, 0x5fa36e44
--0, 280800, 152064, 0x0e63dc72
--0, 284400, 152064, 0xd0dad71f
--0, 288000, 152064, 0x0c4aac94
--0, 291600, 152064, 0x60d50e8d
--0, 295200, 152064, 0x96872d7c
--0, 298800, 152064, 0x4fcefc33
--0, 302400, 152064, 0x6b8157c9
--0, 306000, 152064, 0xa40d527d
--0, 309600, 152064, 0x9884480a
--0, 313200, 152064, 0xff5d9754
--0, 316800, 152064, 0x4a26a74d
--0, 320400, 152064, 0x81059e82
-+0, 0, 152064, 0x625024a3
-+0, 3600, 152064, 0x80dc2f9d
-+0, 7200, 152064, 0xb2c4feea
-+0, 10800, 152064, 0x4ec6ad64
-+0, 14400, 152064, 0x1957bec3
-+0, 18000, 152064, 0xb682799d
-+0, 21600, 152064, 0x34cd2053
-+0, 25200, 152064, 0x81490b4c
-+0, 28800, 152064, 0x242dc943
-+0, 32400, 152064, 0x3e126734
-+0, 36000, 152064, 0x8e474ff8
-+0, 39600, 152064, 0x239d2fbd
-+0, 43200, 152064, 0x0ca3e16f
-+0, 46800, 152064, 0x6161d7c2
-+0, 50400, 152064, 0xca7ad1af
-+0, 54000, 152064, 0xf8ef9026
-+0, 57600, 152064, 0x01f2f4c1
-+0, 61200, 152064, 0x510b19ec
-+0, 64800, 152064, 0xe489028b
-+0, 68400, 152064, 0x7a693c1e
-+0, 72000, 152064, 0x276b23fe
-+0, 75600, 152064, 0x0e9ced3a
-+0, 79200, 152064, 0x658228f7
-+0, 82800, 152064, 0x6a271bc3
-+0, 86400, 152064, 0x431ecd8b
-+0, 90000, 152064, 0x23a5ed14
-+0, 93600, 152064, 0x76fbe121
-+0, 97200, 152064, 0x471f919d
-+0, 100800, 152064, 0x16bfabbc
-+0, 104400, 152064, 0x0762993f
-+0, 108000, 152064, 0x5a2b0b0e
-+0, 111600, 152064, 0x81415ef7
-+0, 115200, 152064, 0xb96e4164
-+0, 118800, 152064, 0xf77aee83
-+0, 122400, 152064, 0x6af81633
-+0, 126000, 152064, 0xed78e5b5
-+0, 129600, 152064, 0x67e38e2c
-+0, 133200, 152064, 0x0417ae01
-+0, 136800, 152064, 0x3887b312
-+0, 140400, 152064, 0x3a4b70fb
-+0, 144000, 152064, 0xcaae9e7f
-+0, 147600, 152064, 0xaf9597be
-+0, 151200, 152064, 0x9bae63d3
-+0, 154800, 152064, 0x0e80825f
-+0, 158400, 152064, 0x915661fd
-+0, 162000, 152064, 0x67d3dc94
-+0, 165600, 152064, 0x3dcf240c
-+0, 169200, 152064, 0x127ff832
-+0, 172800, 152064, 0xc8969981
-+0, 176400, 152064, 0x57179c77
-+0, 180000, 152064, 0x9f88656c
-+0, 183600, 152064, 0xc28ff5d3
-+0, 187200, 152064, 0xf100fad9
-+0, 190800, 152064, 0xb570ce12
-+0, 194400, 152064, 0xe8f28955
-+0, 198000, 152064, 0x1f0a9549
-+0, 201600, 152064, 0x22b17e9b
-+0, 205200, 152064, 0x7cf1400e
-+0, 208800, 152064, 0xafd273b7
-+0, 212400, 152064, 0xeb9b712e
-+0, 216000, 152064, 0x0f81de24
-+0, 219600, 152064, 0x8f4e1953
-+0, 223200, 152064, 0x682e2170
-+0, 226800, 152064, 0xc32ad1b2
-+0, 230400, 152064, 0x53a81d79
-+0, 234000, 152064, 0x54002596
-+0, 237600, 152064, 0x4b5fdbd9
-+0, 241200, 152064, 0x96613368
-+0, 244800, 152064, 0xd6ac0171
-+0, 248400, 152064, 0xf1c1b7b7
-+0, 252000, 152064, 0xc730d82f
-+0, 255600, 152064, 0x0415d934
-+0, 259200, 152064, 0x5338915e
-+0, 262800, 152064, 0x8e9dda6d
-+0, 266400, 152064, 0xe3a8b0a0
-+0, 270000, 152064, 0x5fa36e44
-+0, 273600, 152064, 0x0e63dc72
-+0, 277200, 152064, 0xd0dad71f
-+0, 280800, 152064, 0x0c4aac94
-+0, 284400, 152064, 0x60d50e8d
-+0, 288000, 152064, 0x96872d7c
-+0, 291600, 152064, 0x4fcefc33
-+0, 295200, 152064, 0x6b8157c9
-+0, 298800, 152064, 0xa40d527d
-+0, 302400, 152064, 0x9884480a
-+0, 306000, 152064, 0xff5d9754
-+0, 309600, 152064, 0x4a26a74d
-+0, 313200, 152064, 0x81059e82
-make: *** [fate-h264-conformance-cvma1_toshiba_b] Error 1
-TEST    h264-conformance-cvmanl1_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-cvmanl1_toshiba_b	2011-01-17 13:57:20.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0xb1edd842
--0, 3600, 152064, 0x551f8f45
--0, 7200, 152064, 0xb4931cb2
--0, 10800, 152064, 0x78882b27
--0, 14400, 152064, 0x3afef36d
--0, 18000, 152064, 0x85afad0a
--0, 21600, 152064, 0x3a8bab81
--0, 25200, 152064, 0x2a437174
--0, 28800, 152064, 0x22421437
--0, 32400, 152064, 0x39c5f125
--0, 36000, 152064, 0x256eaad2
--0, 39600, 152064, 0x668a5d31
--0, 43200, 152064, 0x412a4aa7
--0, 46800, 152064, 0x3f091baf
--0, 50400, 152064, 0xbf16d262
--0, 54000, 152064, 0x2fc4ce67
--0, 57600, 152064, 0x119cde3e
--0, 61200, 152064, 0xb40b8632
--0, 64800, 152064, 0x4be4f192
--0, 68400, 152064, 0x906c1237
--0, 72000, 152064, 0x95380024
--0, 75600, 152064, 0x6a833025
--0, 79200, 152064, 0x681d1c4f
--0, 82800, 152064, 0x08c8dea4
--0, 86400, 152064, 0xc69226f0
--0, 90000, 152064, 0x86631102
--0, 93600, 152064, 0x7f40c77a
--0, 97200, 152064, 0xc746ddd4
--0, 100800, 152064, 0x5f2bd3cb
--0, 104400, 152064, 0x643c8316
--0, 108000, 152064, 0x5b7fa380
--0, 111600, 152064, 0x82438cf7
--0, 115200, 152064, 0xdee0f7e7
--0, 118800, 152064, 0xc50d41f1
--0, 122400, 152064, 0xf3453631
--0, 126000, 152064, 0x90bce66b
--0, 129600, 152064, 0x045b03f7
--0, 133200, 152064, 0xf64bd756
--0, 136800, 152064, 0xff997ef2
--0, 140400, 152064, 0x3613a0a5
--0, 144000, 152064, 0xe6a7a8d6
--0, 147600, 152064, 0xb0906c42
--0, 151200, 152064, 0x4dfc912b
--0, 154800, 152064, 0x81e3991c
--0, 158400, 152064, 0x4efc61fb
--0, 162000, 152064, 0xed478395
--0, 165600, 152064, 0x4cb25ab6
--0, 169200, 152064, 0x28e7d51f
--0, 172800, 152064, 0x8bcc1a8d
--0, 176400, 152064, 0x2fe1f240
--0, 180000, 152064, 0xb4978ef8
--0, 183600, 152064, 0xe3929556
--0, 187200, 152064, 0xd370632a
--0, 190800, 152064, 0xba86ffb2
--0, 194400, 152064, 0x444bf18c
--0, 198000, 152064, 0xab40bd14
--0, 201600, 152064, 0xfd488a5d
--0, 205200, 152064, 0xe1f09568
--0, 208800, 152064, 0x09ee7a7e
--0, 212400, 152064, 0x9360397c
--0, 216000, 152064, 0xdbd467e9
--0, 219600, 152064, 0x99726777
--0, 223200, 152064, 0x009fd46c
--0, 226800, 152064, 0xcf770fdb
--0, 230400, 152064, 0x2a890fd9
--0, 234000, 152064, 0x7f40de4b
--0, 237600, 152064, 0x04191304
--0, 241200, 152064, 0x15722022
--0, 244800, 152064, 0x59f4ea93
--0, 248400, 152064, 0x28ba373f
--0, 252000, 152064, 0xf9e400b8
--0, 255600, 152064, 0x85c4bd98
--0, 259200, 152064, 0x6917d2a5
--0, 262800, 152064, 0x61cae234
--0, 266400, 152064, 0x752a9a2d
--0, 270000, 152064, 0x1ee2d9bd
--0, 273600, 152064, 0xdce9ab8e
--0, 277200, 152064, 0x51225fd0
--0, 280800, 152064, 0x10e8cb60
--0, 284400, 152064, 0x8d07cd25
--0, 288000, 152064, 0xb18ba61b
--0, 291600, 152064, 0xb0f10280
--0, 295200, 152064, 0x76a71f13
--0, 298800, 152064, 0x3004f5a1
--0, 302400, 152064, 0x9aba5724
--0, 306000, 152064, 0x5db85385
--0, 309600, 152064, 0xbe9d3f5b
--0, 313200, 152064, 0xa71e85bb
--0, 316800, 152064, 0xdcf59cd7
--0, 320400, 152064, 0x5e319459
-+0, 0, 152064, 0xb4931cb2
-+0, 3600, 152064, 0x78882b27
-+0, 7200, 152064, 0x3afef36d
-+0, 10800, 152064, 0x85afad0a
-+0, 14400, 152064, 0x3a8bab81
-+0, 18000, 152064, 0x2a437174
-+0, 21600, 152064, 0x22421437
-+0, 25200, 152064, 0x39c5f125
-+0, 28800, 152064, 0x256eaad2
-+0, 32400, 152064, 0x668a5d31
-+0, 36000, 152064, 0x412a4aa7
-+0, 39600, 152064, 0x3f091baf
-+0, 43200, 152064, 0xbf16d262
-+0, 46800, 152064, 0x2fc4ce67
-+0, 50400, 152064, 0x119cde3e
-+0, 54000, 152064, 0xb40b8632
-+0, 57600, 152064, 0x4be4f192
-+0, 61200, 152064, 0x906c1237
-+0, 64800, 152064, 0x95380024
-+0, 68400, 152064, 0x6a833025
-+0, 72000, 152064, 0x681d1c4f
-+0, 75600, 152064, 0x08c8dea4
-+0, 79200, 152064, 0xc69226f0
-+0, 82800, 152064, 0x86631102
-+0, 86400, 152064, 0x7f40c77a
-+0, 90000, 152064, 0xc746ddd4
-+0, 93600, 152064, 0x5f2bd3cb
-+0, 97200, 152064, 0x643c8316
-+0, 100800, 152064, 0x5b7fa380
-+0, 104400, 152064, 0x82438cf7
-+0, 108000, 152064, 0xdee0f7e7
-+0, 111600, 152064, 0xc50d41f1
-+0, 115200, 152064, 0xf3453631
-+0, 118800, 152064, 0x90bce66b
-+0, 122400, 152064, 0x045b03f7
-+0, 126000, 152064, 0xf64bd756
-+0, 129600, 152064, 0xff997ef2
-+0, 133200, 152064, 0x3613a0a5
-+0, 136800, 152064, 0xe6a7a8d6
-+0, 140400, 152064, 0xb0906c42
-+0, 144000, 152064, 0x4dfc912b
-+0, 147600, 152064, 0x81e3991c
-+0, 151200, 152064, 0x4efc61fb
-+0, 154800, 152064, 0xed478395
-+0, 158400, 152064, 0x4cb25ab6
-+0, 162000, 152064, 0x28e7d51f
-+0, 165600, 152064, 0x8bcc1a8d
-+0, 169200, 152064, 0x2fe1f240
-+0, 172800, 152064, 0xb4978ef8
-+0, 176400, 152064, 0xe3929556
-+0, 180000, 152064, 0xd370632a
-+0, 183600, 152064, 0xba86ffb2
-+0, 187200, 152064, 0x444bf18c
-+0, 190800, 152064, 0xab40bd14
-+0, 194400, 152064, 0xfd488a5d
-+0, 198000, 152064, 0xe1f09568
-+0, 201600, 152064, 0x09ee7a7e
-+0, 205200, 152064, 0x9360397c
-+0, 208800, 152064, 0xdbd467e9
-+0, 212400, 152064, 0x99726777
-+0, 216000, 152064, 0x009fd46c
-+0, 219600, 152064, 0xcf770fdb
-+0, 223200, 152064, 0x2a890fd9
-+0, 226800, 152064, 0x7f40de4b
-+0, 230400, 152064, 0x04191304
-+0, 234000, 152064, 0x15722022
-+0, 237600, 152064, 0x59f4ea93
-+0, 241200, 152064, 0x28ba373f
-+0, 244800, 152064, 0xf9e400b8
-+0, 248400, 152064, 0x85c4bd98
-+0, 252000, 152064, 0x6917d2a5
-+0, 255600, 152064, 0x61cae234
-+0, 259200, 152064, 0x752a9a2d
-+0, 262800, 152064, 0x1ee2d9bd
-+0, 266400, 152064, 0xdce9ab8e
-+0, 270000, 152064, 0x51225fd0
-+0, 273600, 152064, 0x10e8cb60
-+0, 277200, 152064, 0x8d07cd25
-+0, 280800, 152064, 0xb18ba61b
-+0, 284400, 152064, 0xb0f10280
-+0, 288000, 152064, 0x76a71f13
-+0, 291600, 152064, 0x3004f5a1
-+0, 295200, 152064, 0x9aba5724
-+0, 298800, 152064, 0x5db85385
-+0, 302400, 152064, 0xbe9d3f5b
-+0, 306000, 152064, 0xa71e85bb
-+0, 309600, 152064, 0xdcf59cd7
-+0, 313200, 152064, 0x5e319459
-make: *** [fate-h264-conformance-cvmanl1_toshiba_b] Error 1
-TEST    h264-conformance-cvmanl2_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-cvmanl2_toshiba_b	2011-01-17 13:57:20.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0xb1edd842
--0, 3600, 152064, 0x551f8f45
--0, 7200, 152064, 0xb4931cb2
--0, 10800, 152064, 0x5f352e98
--0, 14400, 152064, 0xeba5fe28
--0, 18000, 152064, 0x85afad0a
--0, 21600, 152064, 0x1120b6a4
--0, 25200, 152064, 0x67506e16
--0, 28800, 152064, 0x22421437
--0, 32400, 152064, 0x929becd6
--0, 36000, 152064, 0x6ffcb4b0
--0, 39600, 152064, 0x668a5d31
--0, 43200, 152064, 0x1b034ebb
--0, 46800, 152064, 0x7e2d213c
--0, 50400, 152064, 0xbf16d262
--0, 54000, 152064, 0xdeaecab3
--0, 57600, 152064, 0xd220d704
--0, 61200, 152064, 0xb40b8632
--0, 64800, 152064, 0xbdf0ef57
--0, 68400, 152064, 0x7e2e10df
--0, 72000, 152064, 0x95380024
--0, 75600, 152064, 0xdb80256d
--0, 79200, 152064, 0xa4561c61
--0, 82800, 152064, 0x08c8dea4
--0, 86400, 152064, 0x7bb917d6
--0, 90000, 152064, 0x796f0e2b
--0, 93600, 152064, 0x7f40c77a
--0, 97200, 152064, 0xda32de2e
--0, 100800, 152064, 0x00ffc15a
--0, 104400, 152064, 0x643c8316
--0, 108000, 152064, 0xb7588f7f
--0, 111600, 152064, 0xa4e07c02
--0, 115200, 152064, 0xdee0f7e7
--0, 118800, 152064, 0x2c3245ee
--0, 122400, 152064, 0x6565355b
--0, 126000, 152064, 0x90bce66b
--0, 129600, 152064, 0x0abffe08
--0, 133200, 152064, 0x119ccc3e
--0, 136800, 152064, 0xff997ef2
--0, 140400, 152064, 0xba4b9820
--0, 144000, 152064, 0xb6dfa596
--0, 147600, 152064, 0xb0906c42
--0, 151200, 152064, 0xf3c29133
--0, 154800, 152064, 0x08cd8e2b
--0, 158400, 152064, 0x4efc61fb
--0, 162000, 152064, 0x5b7c6e48
--0, 165600, 152064, 0xd28a47c2
--0, 169200, 152064, 0x28e7d51f
--0, 172800, 152064, 0x3a5619b1
--0, 176400, 152064, 0xa517e7f2
--0, 180000, 152064, 0xb4978ef8
--0, 183600, 152064, 0x25929175
--0, 187200, 152064, 0x20f05834
--0, 190800, 152064, 0xba86ffb2
--0, 194400, 152064, 0xa265f06f
--0, 198000, 152064, 0x97bbbfb7
--0, 201600, 152064, 0xfd488a5d
--0, 205200, 152064, 0x1b0989da
--0, 208800, 152064, 0xfd1878ce
--0, 212400, 152064, 0x9360397c
--0, 216000, 152064, 0x0d8151a7
--0, 219600, 152064, 0xe7a05bb8
--0, 223200, 152064, 0x009fd46c
--0, 226800, 152064, 0x8751123f
--0, 230400, 152064, 0x8252101a
--0, 234000, 152064, 0x7f40de4b
--0, 237600, 152064, 0x4ea317fe
--0, 241200, 152064, 0x519224d9
--0, 244800, 152064, 0x59f4ea93
--0, 248400, 152064, 0xc93c1dba
--0, 252000, 152064, 0xe3c9fb61
--0, 255600, 152064, 0x85c4bd98
--0, 259200, 152064, 0xcebacfd3
--0, 262800, 152064, 0x7327da99
--0, 266400, 152064, 0x752a9a2d
--0, 270000, 152064, 0x5ea6c8d2
--0, 273600, 152064, 0x66fd8c6f
--0, 277200, 152064, 0x51225fd0
--0, 280800, 152064, 0x58b9be96
--0, 284400, 152064, 0xa5abcdb7
--0, 288000, 152064, 0xb18ba61b
--0, 291600, 152064, 0xc7d20190
--0, 295200, 152064, 0xb6da14aa
--0, 298800, 152064, 0x3004f5a1
--0, 302400, 152064, 0x129354e2
--0, 306000, 152064, 0xffa148d5
--0, 309600, 152064, 0xbe9d3f5b
--0, 313200, 152064, 0x1c7f8976
--0, 316800, 152064, 0xa107a54d
--0, 320400, 152064, 0x5e319459
-+0, 0, 152064, 0xb4931cb2
-+0, 3600, 152064, 0x5f352e98
-+0, 7200, 152064, 0xeba5fe28
-+0, 10800, 152064, 0x85afad0a
-+0, 14400, 152064, 0x1120b6a4
-+0, 18000, 152064, 0x67506e16
-+0, 21600, 152064, 0x22421437
-+0, 25200, 152064, 0x929becd6
-+0, 28800, 152064, 0x6ffcb4b0
-+0, 32400, 152064, 0x668a5d31
-+0, 36000, 152064, 0x1b034ebb
-+0, 39600, 152064, 0x7e2d213c
-+0, 43200, 152064, 0xbf16d262
-+0, 46800, 152064, 0xdeaecab3
-+0, 50400, 152064, 0xd220d704
-+0, 54000, 152064, 0xb40b8632
-+0, 57600, 152064, 0xbdf0ef57
-+0, 61200, 152064, 0x7e2e10df
-+0, 64800, 152064, 0x95380024
-+0, 68400, 152064, 0xdb80256d
-+0, 72000, 152064, 0xa4561c61
-+0, 75600, 152064, 0x08c8dea4
-+0, 79200, 152064, 0x7bb917d6
-+0, 82800, 152064, 0x796f0e2b
-+0, 86400, 152064, 0x7f40c77a
-+0, 90000, 152064, 0xda32de2e
-+0, 93600, 152064, 0x00ffc15a
-+0, 97200, 152064, 0x643c8316
-+0, 100800, 152064, 0xb7588f7f
-+0, 104400, 152064, 0xa4e07c02
-+0, 108000, 152064, 0xdee0f7e7
-+0, 111600, 152064, 0x2c3245ee
-+0, 115200, 152064, 0x6565355b
-+0, 118800, 152064, 0x90bce66b
-+0, 122400, 152064, 0x0abffe08
-+0, 126000, 152064, 0x119ccc3e
-+0, 129600, 152064, 0xff997ef2
-+0, 133200, 152064, 0xba4b9820
-+0, 136800, 152064, 0xb6dfa596
-+0, 140400, 152064, 0xb0906c42
-+0, 144000, 152064, 0xf3c29133
-+0, 147600, 152064, 0x08cd8e2b
-+0, 151200, 152064, 0x4efc61fb
-+0, 154800, 152064, 0x5b7c6e48
-+0, 158400, 152064, 0xd28a47c2
-+0, 162000, 152064, 0x28e7d51f
-+0, 165600, 152064, 0x3a5619b1
-+0, 169200, 152064, 0xa517e7f2
-+0, 172800, 152064, 0xb4978ef8
-+0, 176400, 152064, 0x25929175
-+0, 180000, 152064, 0x20f05834
-+0, 183600, 152064, 0xba86ffb2
-+0, 187200, 152064, 0xa265f06f
-+0, 190800, 152064, 0x97bbbfb7
-+0, 194400, 152064, 0xfd488a5d
-+0, 198000, 152064, 0x1b0989da
-+0, 201600, 152064, 0xfd1878ce
-+0, 205200, 152064, 0x9360397c
-+0, 208800, 152064, 0x0d8151a7
-+0, 212400, 152064, 0xe7a05bb8
-+0, 216000, 152064, 0x009fd46c
-+0, 219600, 152064, 0x8751123f
-+0, 223200, 152064, 0x8252101a
-+0, 226800, 152064, 0x7f40de4b
-+0, 230400, 152064, 0x4ea317fe
-+0, 234000, 152064, 0x519224d9
-+0, 237600, 152064, 0x59f4ea93
-+0, 241200, 152064, 0xc93c1dba
-+0, 244800, 152064, 0xe3c9fb61
-+0, 248400, 152064, 0x85c4bd98
-+0, 252000, 152064, 0xcebacfd3
-+0, 255600, 152064, 0x7327da99
-+0, 259200, 152064, 0x752a9a2d
-+0, 262800, 152064, 0x5ea6c8d2
-+0, 266400, 152064, 0x66fd8c6f
-+0, 270000, 152064, 0x51225fd0
-+0, 273600, 152064, 0x58b9be96
-+0, 277200, 152064, 0xa5abcdb7
-+0, 280800, 152064, 0xb18ba61b
-+0, 284400, 152064, 0xc7d20190
-+0, 288000, 152064, 0xb6da14aa
-+0, 291600, 152064, 0x3004f5a1
-+0, 295200, 152064, 0x129354e2
-+0, 298800, 152064, 0xffa148d5
-+0, 302400, 152064, 0xbe9d3f5b
-+0, 306000, 152064, 0x1c7f8976
-+0, 309600, 152064, 0xa107a54d
-+0, 313200, 152064, 0x5e319459
-make: *** [fate-h264-conformance-cvmanl2_toshiba_b] Error 1
-TEST    h264-conformance-cvmapaqp3_sony_e
-TEST    h264-conformance-cvmaqp2_sony_g
-TEST    h264-conformance-cvmaqp3_sony_d
-TEST    h264-conformance-cvmp_mot_fld_l30_b
-TEST    h264-conformance-cvmp_mot_frm_l31_b
-TEST    h264-conformance-cvnlfi1_sony_c
-TEST    h264-conformance-cvnlfi2_sony_h
-TEST    h264-conformance-cvpa1_toshiba_b
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-cvpa1_toshiba_b	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-cvpa1_toshiba_b	2011-01-17 13:57:22.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0x128cd77a
--0, 3600, 152064, 0x565b9fc1
--0, 7200, 152064, 0xbe322679
--0, 10800, 152064, 0x0ea4238f
--0, 14400, 152064, 0x1e08fb3c
--0, 18000, 152064, 0x6da3a93c
--0, 21600, 152064, 0x75e5b181
--0, 25200, 152064, 0xa0b39334
--0, 28800, 152064, 0xa0d10d6d
--0, 32400, 152064, 0x33842bcb
--0, 36000, 152064, 0x9a74e1e4
--0, 39600, 152064, 0xc2037244
--0, 43200, 152064, 0x364b8ae4
--0, 46800, 152064, 0x18c04971
--0, 50400, 152064, 0x7234ecb5
--0, 54000, 152064, 0x3719f8bc
--0, 57600, 152064, 0x1285ead1
--0, 61200, 152064, 0xd3bfab18
--0, 64800, 152064, 0x898111e2
--0, 68400, 152064, 0x681c15fc
--0, 72000, 152064, 0x8e501572
--0, 75600, 152064, 0xd7c838be
--0, 79200, 152064, 0xede424b2
--0, 82800, 152064, 0xcfc20240
--0, 86400, 152064, 0x13992e86
--0, 90000, 152064, 0x56fb251a
--0, 93600, 152064, 0xee9be320
--0, 97200, 152064, 0xea650153
--0, 100800, 152064, 0x2cb6dabe
--0, 104400, 152064, 0xf44fa4b5
--0, 108000, 152064, 0xdac2adff
--0, 111600, 152064, 0x9e15a1dc
--0, 115200, 152064, 0x28d00970
--0, 118800, 152064, 0xe4277347
--0, 122400, 152064, 0xebd25ad1
--0, 126000, 152064, 0x029402da
--0, 129600, 152064, 0x1a2311ef
--0, 133200, 152064, 0xb86bf96a
--0, 136800, 152064, 0x67d7a5b0
--0, 140400, 152064, 0x573abc2d
--0, 144000, 152064, 0xbe97dec0
--0, 147600, 152064, 0x592b91a4
--0, 151200, 152064, 0x9adda65e
--0, 154800, 152064, 0x0354b2cb
--0, 158400, 152064, 0x91e27ff9
--0, 162000, 152064, 0x389f8625
--0, 165600, 152064, 0x90175850
--0, 169200, 152064, 0x2d36c427
--0, 172800, 152064, 0xc0dd14ab
--0, 176400, 152064, 0xd49bf131
--0, 180000, 152064, 0x0d4a9b92
--0, 183600, 152064, 0xae9bb2f1
--0, 187200, 152064, 0x36847ade
--0, 190800, 152064, 0x74810382
--0, 194400, 152064, 0xc56d1d9f
--0, 198000, 152064, 0xcfefe3ae
--0, 201600, 152064, 0xeaa39353
--0, 205200, 152064, 0x14289aef
--0, 208800, 152064, 0x74ba8f3b
--0, 212400, 152064, 0xdcaa518d
--0, 216000, 152064, 0x6e4881c2
--0, 219600, 152064, 0xa4db767d
--0, 223200, 152064, 0x239b0b19
--0, 226800, 152064, 0x5d054236
--0, 230400, 152064, 0x6f392d7c
--0, 234000, 152064, 0x5c2af146
--0, 237600, 152064, 0x26b439af
--0, 241200, 152064, 0xba7043ab
--0, 244800, 152064, 0x0816000c
--0, 248400, 152064, 0x3a713c05
--0, 252000, 152064, 0xb3111f6d
--0, 255600, 152064, 0xdbf8dae2
--0, 259200, 152064, 0x09ddf22e
--0, 262800, 152064, 0x8871fa7e
--0, 266400, 152064, 0x9f5db7a1
--0, 270000, 152064, 0xcc38f225
--0, 273600, 152064, 0xa1d18df9
--0, 277200, 152064, 0x9b1c5d6a
--0, 280800, 152064, 0x9f2bc696
--0, 284400, 152064, 0xc39bd11a
--0, 288000, 152064, 0x4ceca7d0
--0, 291600, 152064, 0x63a60f1d
--0, 295200, 152064, 0x4cd31f28
--0, 298800, 152064, 0x9c9af5d1
--0, 302400, 152064, 0x6def65fc
--0, 306000, 152064, 0x1011466d
--0, 309600, 152064, 0xfeca406d
--0, 313200, 152064, 0xd1ca8a1e
--0, 316800, 152064, 0x30caa195
--0, 320400, 152064, 0x31a09a48
-+0, 0, 152064, 0xbe322679
-+0, 3600, 152064, 0x0ea4238f
-+0, 7200, 152064, 0x1e08fb3c
-+0, 10800, 152064, 0x6da3a93c
-+0, 14400, 152064, 0x75e5b181
-+0, 18000, 152064, 0xa0b39334
-+0, 21600, 152064, 0xa0d10d6d
-+0, 25200, 152064, 0x33842bcb
-+0, 28800, 152064, 0x9a74e1e4
-+0, 32400, 152064, 0xc2037244
-+0, 36000, 152064, 0x364b8ae4
-+0, 39600, 152064, 0x18c04971
-+0, 43200, 152064, 0x7234ecb5
-+0, 46800, 152064, 0x3719f8bc
-+0, 50400, 152064, 0x1285ead1
-+0, 54000, 152064, 0xd3bfab18
-+0, 57600, 152064, 0x898111e2
-+0, 61200, 152064, 0x681c15fc
-+0, 64800, 152064, 0x8e501572
-+0, 68400, 152064, 0xd7c838be
-+0, 72000, 152064, 0xede424b2
-+0, 75600, 152064, 0xcfc20240
-+0, 79200, 152064, 0x13992e86
-+0, 82800, 152064, 0x56fb251a
-+0, 86400, 152064, 0xee9be320
-+0, 90000, 152064, 0xea650153
-+0, 93600, 152064, 0x2cb6dabe
-+0, 97200, 152064, 0xf44fa4b5
-+0, 100800, 152064, 0xdac2adff
-+0, 104400, 152064, 0x9e15a1dc
-+0, 108000, 152064, 0x28d00970
-+0, 111600, 152064, 0xe4277347
-+0, 115200, 152064, 0xebd25ad1
-+0, 118800, 152064, 0x029402da
-+0, 122400, 152064, 0x1a2311ef
-+0, 126000, 152064, 0xb86bf96a
-+0, 129600, 152064, 0x67d7a5b0
-+0, 133200, 152064, 0x573abc2d
-+0, 136800, 152064, 0xbe97dec0
-+0, 140400, 152064, 0x592b91a4
-+0, 144000, 152064, 0x9adda65e
-+0, 147600, 152064, 0x0354b2cb
-+0, 151200, 152064, 0x91e27ff9
-+0, 154800, 152064, 0x389f8625
-+0, 158400, 152064, 0x90175850
-+0, 162000, 152064, 0x2d36c427
-+0, 165600, 152064, 0xc0dd14ab
-+0, 169200, 152064, 0xd49bf131
-+0, 172800, 152064, 0x0d4a9b92
-+0, 176400, 152064, 0xae9bb2f1
-+0, 180000, 152064, 0x36847ade
-+0, 183600, 152064, 0x74810382
-+0, 187200, 152064, 0xc56d1d9f
-+0, 190800, 152064, 0xcfefe3ae
-+0, 194400, 152064, 0xeaa39353
-+0, 198000, 152064, 0x14289aef
-+0, 201600, 152064, 0x74ba8f3b
-+0, 205200, 152064, 0xdcaa518d
-+0, 208800, 152064, 0x6e4881c2
-+0, 212400, 152064, 0xa4db767d
-+0, 216000, 152064, 0x239b0b19
-+0, 219600, 152064, 0x5d054236
-+0, 223200, 152064, 0x6f392d7c
-+0, 226800, 152064, 0x5c2af146
-+0, 230400, 152064, 0x26b439af
-+0, 234000, 152064, 0xba7043ab
-+0, 237600, 152064, 0x0816000c
-+0, 241200, 152064, 0x3a713c05
-+0, 244800, 152064, 0xb3111f6d
-+0, 248400, 152064, 0xdbf8dae2
-+0, 252000, 152064, 0x09ddf22e
-+0, 255600, 152064, 0x8871fa7e
-+0, 259200, 152064, 0x9f5db7a1
-+0, 262800, 152064, 0xcc38f225
-+0, 266400, 152064, 0xa1d18df9
-+0, 270000, 152064, 0x9b1c5d6a
-+0, 273600, 152064, 0x9f2bc696
-+0, 277200, 152064, 0xc39bd11a
-+0, 280800, 152064, 0x4ceca7d0
-+0, 284400, 152064, 0x63a60f1d
-+0, 288000, 152064, 0x4cd31f28
-+0, 291600, 152064, 0x9c9af5d1
-+0, 295200, 152064, 0x6def65fc
-+0, 298800, 152064, 0x1011466d
-+0, 302400, 152064, 0xfeca406d
-+0, 306000, 152064, 0xd1ca8a1e
-+0, 309600, 152064, 0x30caa195
-+0, 313200, 152064, 0x31a09a48
-make: *** [fate-h264-conformance-cvpa1_toshiba_b] Error 1
-TEST    h264-conformance-cvpcmnl1_sva_c
-TEST    h264-conformance-cvpcmnl2_sva_c
-TEST    h264-conformance-cvwp1_toshiba_e
-TEST    h264-conformance-cvwp2_toshiba_e
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-cvwp2_toshiba_e	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-cvwp2_toshiba_e	2011-01-17 13:57:22.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0xf503fb79
--0, 3600, 152064, 0xeaa4ba5d
--0, 7200, 152064, 0x50865a33
--0, 10800, 152064, 0x34125f86
--0, 14400, 152064, 0xc5a8bb68
--0, 18000, 152064, 0xe6e9b376
--0, 21600, 152064, 0x4e41d48e
--0, 25200, 152064, 0xea73cc5d
--0, 28800, 152064, 0xc0c60ac0
--0, 32400, 152064, 0xd7110670
--0, 36000, 152064, 0x00465d0d
--0, 39600, 152064, 0xa37a726b
--0, 43200, 152064, 0x5dd13b2a
--0, 46800, 152064, 0x08471f31
--0, 50400, 152064, 0x2bb2b055
--0, 54000, 152064, 0xd06d7f1c
--0, 57600, 152064, 0x91fde84a
--0, 61200, 152064, 0xdbb52d2b
--0, 64800, 152064, 0x505c08b4
--0, 68400, 152064, 0xd8aeef9f
--0, 72000, 152064, 0x4e3f8721
--0, 75600, 152064, 0xce534aee
--0, 79200, 152064, 0x51f80737
--0, 82800, 152064, 0x8fa0e443
--0, 86400, 152064, 0xe8c9db17
--0, 90000, 152064, 0xc84bcee6
--0, 93600, 152064, 0xa7916158
--0, 97200, 152064, 0x16149c36
--0, 100800, 152064, 0xe55213fd
--0, 104400, 152064, 0xa701e59d
--0, 108000, 152064, 0xad65e200
--0, 111600, 152064, 0x4606dc82
--0, 115200, 152064, 0x582f9f64
--0, 118800, 152064, 0xc630662a
--0, 122400, 152064, 0xe54bacf5
--0, 126000, 152064, 0x230e387f
--0, 129600, 152064, 0x1a9c746c
--0, 133200, 152064, 0xfa002d7c
--0, 136800, 152064, 0xe617c4a9
--0, 140400, 152064, 0xd3a4df19
--0, 144000, 152064, 0x25b9ca8c
--0, 147600, 152064, 0x0c505f7c
--0, 151200, 152064, 0x43f84f88
--0, 154800, 152064, 0x859fb3af
--0, 158400, 152064, 0x9680fc13
--0, 162000, 152064, 0x3fe6ecb6
--0, 165600, 152064, 0xf4c05a9c
--0, 169200, 152064, 0x16ba3b13
--0, 172800, 152064, 0x72f33fb9
--0, 176400, 152064, 0x3076e567
--0, 180000, 152064, 0x4e69b604
--0, 183600, 152064, 0x9c37a98b
--0, 187200, 152064, 0x0d5756c7
--0, 190800, 152064, 0xa4a46a81
--0, 194400, 152064, 0xadfc89d7
--0, 198000, 152064, 0x35693493
--0, 201600, 152064, 0xe3baedbf
--0, 205200, 152064, 0x78cfb405
--0, 208800, 152064, 0xd85c7074
--0, 212400, 152064, 0x14ab350e
--0, 216000, 152064, 0xaf55433e
--0, 219600, 152064, 0x75a8e79f
--0, 223200, 152064, 0x2fb599f6
--0, 226800, 152064, 0xbe30bdfe
--0, 230400, 152064, 0x8b07a5ce
--0, 234000, 152064, 0x99b32730
--0, 237600, 152064, 0x9265182d
--0, 241200, 152064, 0x91e789fd
--0, 244800, 152064, 0x1c1e6d16
--0, 248400, 152064, 0xfa06bdaa
--0, 252000, 152064, 0x7177041f
--0, 255600, 152064, 0xd902f99d
--0, 259200, 152064, 0x29bdc134
--0, 262800, 152064, 0xd713ab76
--0, 266400, 152064, 0x60e4788e
--0, 270000, 152064, 0xb18c7789
--0, 273600, 152064, 0x0b7829a5
--0, 277200, 152064, 0xf676d780
--0, 280800, 152064, 0xa88a3a57
--0, 284400, 152064, 0x825cf289
--0, 288000, 152064, 0x78928201
--0, 291600, 152064, 0x013a589c
--0, 295200, 152064, 0x9269fa64
--0, 298800, 152064, 0x6db5f5fa
--0, 302400, 152064, 0x49ad9d6a
--0, 306000, 152064, 0x1b7c290f
--0, 309600, 152064, 0x99716ad1
--0, 313200, 152064, 0x371527c2
--0, 316800, 152064, 0x9f351841
--0, 320400, 152064, 0x884bb432
-+0, 0, 152064, 0x50865a33
-+0, 3600, 152064, 0x34125f86
-+0, 7200, 152064, 0xc5a8bb68
-+0, 10800, 152064, 0xe6e9b376
-+0, 14400, 152064, 0x4e41d48e
-+0, 18000, 152064, 0xea73cc5d
-+0, 21600, 152064, 0xc0c60ac0
-+0, 25200, 152064, 0xd7110670
-+0, 28800, 152064, 0x00465d0d
-+0, 32400, 152064, 0xa37a726b
-+0, 36000, 152064, 0x5dd13b2a
-+0, 39600, 152064, 0x08471f31
-+0, 43200, 152064, 0x2bb2b055
-+0, 46800, 152064, 0xd06d7f1c
-+0, 50400, 152064, 0x91fde84a
-+0, 54000, 152064, 0xdbb52d2b
-+0, 57600, 152064, 0x505c08b4
-+0, 61200, 152064, 0xd8aeef9f
-+0, 64800, 152064, 0x4e3f8721
-+0, 68400, 152064, 0xce534aee
-+0, 72000, 152064, 0x51f80737
-+0, 75600, 152064, 0x8fa0e443
-+0, 79200, 152064, 0xe8c9db17
-+0, 82800, 152064, 0xc84bcee6
-+0, 86400, 152064, 0xa7916158
-+0, 90000, 152064, 0x16149c36
-+0, 93600, 152064, 0xe55213fd
-+0, 97200, 152064, 0xa701e59d
-+0, 100800, 152064, 0xad65e200
-+0, 104400, 152064, 0x4606dc82
-+0, 108000, 152064, 0x582f9f64
-+0, 111600, 152064, 0xc630662a
-+0, 115200, 152064, 0xe54bacf5
-+0, 118800, 152064, 0x230e387f
-+0, 122400, 152064, 0x1a9c746c
-+0, 126000, 152064, 0xfa002d7c
-+0, 129600, 152064, 0xe617c4a9
-+0, 133200, 152064, 0xd3a4df19
-+0, 136800, 152064, 0x25b9ca8c
-+0, 140400, 152064, 0x0c505f7c
-+0, 144000, 152064, 0x43f84f88
-+0, 147600, 152064, 0x859fb3af
-+0, 151200, 152064, 0x9680fc13
-+0, 154800, 152064, 0x3fe6ecb6
-+0, 158400, 152064, 0xf4c05a9c
-+0, 162000, 152064, 0x16ba3b13
-+0, 165600, 152064, 0x72f33fb9
-+0, 169200, 152064, 0x3076e567
-+0, 172800, 152064, 0x4e69b604
-+0, 176400, 152064, 0x9c37a98b
-+0, 180000, 152064, 0x0d5756c7
-+0, 183600, 152064, 0xa4a46a81
-+0, 187200, 152064, 0xadfc89d7
-+0, 190800, 152064, 0x35693493
-+0, 194400, 152064, 0xe3baedbf
-+0, 198000, 152064, 0x78cfb405
-+0, 201600, 152064, 0xd85c7074
-+0, 205200, 152064, 0x14ab350e
-+0, 208800, 152064, 0xaf55433e
-+0, 212400, 152064, 0x75a8e79f
-+0, 216000, 152064, 0x2fb599f6
-+0, 219600, 152064, 0xbe30bdfe
-+0, 223200, 152064, 0x8b07a5ce
-+0, 226800, 152064, 0x99b32730
-+0, 230400, 152064, 0x9265182d
-+0, 234000, 152064, 0x91e789fd
-+0, 237600, 152064, 0x1c1e6d16
-+0, 241200, 152064, 0xfa06bdaa
-+0, 244800, 152064, 0x7177041f
-+0, 248400, 152064, 0xd902f99d
-+0, 252000, 152064, 0x29bdc134
-+0, 255600, 152064, 0xd713ab76
-+0, 259200, 152064, 0x60e4788e
-+0, 262800, 152064, 0xb18c7789
-+0, 266400, 152064, 0x0b7829a5
-+0, 270000, 152064, 0xf676d780
-+0, 273600, 152064, 0xa88a3a57
-+0, 277200, 152064, 0x825cf289
-+0, 280800, 152064, 0x78928201
-+0, 284400, 152064, 0x013a589c
-+0, 288000, 152064, 0x9269fa64
-+0, 291600, 152064, 0x6db5f5fa
-+0, 295200, 152064, 0x49ad9d6a
-+0, 298800, 152064, 0x1b7c290f
-+0, 302400, 152064, 0x99716ad1
-+0, 306000, 152064, 0x371527c2
-+0, 309600, 152064, 0x9f351841
-+0, 313200, 152064, 0x884bb432
-make: *** [fate-h264-conformance-cvwp2_toshiba_e] Error 1
-TEST    h264-conformance-cvwp3_toshiba_e
---- /Users/astrange/Projects/video/ffmpeg-soc/tests/ref/fate/h264-conformance-cvwp3_toshiba_e	2010-05-11 03:02:59.000000000 -0400
-+++ tests/data/fate/h264-conformance-cvwp3_toshiba_e	2011-01-17 13:57:23.000000000 -0500
-@@ -1,90 +1,88 @@
--0, 0, 152064, 0x3b3ffd31
--0, 3600, 152064, 0x14e0b899
--0, 7200, 152064, 0x50865a33
--0, 10800, 152064, 0x12e749e5
--0, 14400, 152064, 0xe5921130
--0, 18000, 152064, 0x2ca3b10d
--0, 21600, 152064, 0xa9a39f04
--0, 25200, 152064, 0x2c78761a
--0, 28800, 152064, 0x70890ad7
--0, 32400, 152064, 0x4fc30132
--0, 36000, 152064, 0x10e4d2c9
--0, 39600, 152064, 0xa3326b50
--0, 43200, 152064, 0x8e054bf1
--0, 46800, 152064, 0x5bd91687
--0, 50400, 152064, 0x70bab119
--0, 54000, 152064, 0x9a1ab472
--0, 57600, 152064, 0x490776a0
--0, 61200, 152064, 0xdbb52d2b
--0, 64800, 152064, 0x142714b9
--0, 68400, 152064, 0xa051ee6f
--0, 72000, 152064, 0xafa97fdf
--0, 75600, 152064, 0x1ae67347
--0, 79200, 152064, 0xc4f42ed6
--0, 82800, 152064, 0x4445dc60
--0, 86400, 152064, 0xaef4d04b
--0, 90000, 152064, 0x6a51be82
--0, 93600, 152064, 0x48356190
--0, 97200, 152064, 0xc09b5f5d
--0, 100800, 152064, 0x933d3379
--0, 104400, 152064, 0xfb57e471
--0, 108000, 152064, 0xb5b2f45c
--0, 111600, 152064, 0xce36e45e
--0, 115200, 152064, 0x582f9f64
--0, 118800, 152064, 0x2f45b1fd
--0, 122400, 152064, 0x90708fa0
--0, 126000, 152064, 0xee483b8f
--0, 129600, 152064, 0xd2163e6c
--0, 133200, 152064, 0x39492dfe
--0, 136800, 152064, 0xf89cc57f
--0, 140400, 152064, 0xbfc3c411
--0, 144000, 152064, 0x919eb007
--0, 147600, 152064, 0x2c526309
--0, 151200, 152064, 0x39f067a2
--0, 154800, 152064, 0xb7653abb
--0, 158400, 152064, 0xe26a035c
--0, 162000, 152064, 0xcef1eb3b
--0, 165600, 152064, 0xb8b3c55f
--0, 169200, 152064, 0x16ba3b13
--0, 172800, 152064, 0x153a3117
--0, 176400, 152064, 0x90a21859
--0, 180000, 152064, 0x9231b756
--0, 183600, 152064, 0x65fcbcb9
--0, 187200, 152064, 0x447eaf44
--0, 190800, 152064, 0xa26b6a8e
--0, 194400, 152064, 0x100464f8
--0, 198000, 152064, 0x479648ec
--0, 201600, 152064, 0x6742f51f
--0, 205200, 152064, 0x14e9d906
--0, 208800, 152064, 0xa058ab87
--0, 212400, 152064, 0x8d093874
--0, 216000, 152064, 0xef7f2965
--0, 219600, 152064, 0x200d02bd
--0, 223200, 152064, 0x2fb599f6
--0, 226800, 152064, 0xf65fb6e4
--0, 230400, 152064, 0x489a9152
--0, 234000, 152064, 0xbe8a2fc2
--0, 237600, 152064, 0xea04097e
--0, 241200, 152064, 0xaf0cd627
--0, 244800, 152064, 0xc0a26b27
--0, 248400, 152064, 0x985f67e7
--0, 252000, 152064, 0x7d1b4c4c
--0, 255600, 152064, 0x9908f838
--0, 259200, 152064, 0xb8fef131
--0, 262800, 152064, 0xb1feaf6c
--0, 266400, 152064, 0x37b16bda
--0, 270000, 152064, 0x242471aa
--0, 273600, 152064, 0xf18c3839
--0, 277200, 152064, 0xf676d780
--0, 280800, 152064, 0x17bd0f76
--0, 284400, 152064, 0x3703e7a6
--0, 288000, 152064, 0x69ba8a8a
--0, 291600, 152064, 0x205281b3
--0, 295200, 152064, 0x54bf51e1
--0, 298800, 152064, 0xf6daf8ed
--0, 302400, 152064, 0x8728e805
--0, 306000, 152064, 0xe98cd2b0
--0, 309600, 152064, 0x7ef76e26
--0, 313200, 152064, 0x0fbf5230
--0, 316800, 152064, 0x9e4d104b
--0, 320400, 152064, 0xd562b815
-+0, 0, 152064, 0x50865a33
-+0, 3600, 152064, 0x12e749e5
-+0, 7200, 152064, 0xe5921130
-+0, 10800, 152064, 0x2ca3b10d
-+0, 14400, 152064, 0xa9a39f04
-+0, 18000, 152064, 0x2c78761a
-+0, 21600, 152064, 0x70890ad7
-+0, 25200, 152064, 0x4fc30132
-+0, 28800, 152064, 0x10e4d2c9
-+0, 32400, 152064, 0xa3326b50
-+0, 36000, 152064, 0x8e054bf1
-+0, 39600, 152064, 0x5bd91687
-+0, 43200, 152064, 0x70bab119
-+0, 46800, 152064, 0x9a1ab472
-+0, 50400, 152064, 0x490776a0
-+0, 54000, 152064, 0xdbb52d2b
-+0, 57600, 152064, 0x142714b9
-+0, 61200, 152064, 0xa051ee6f
-+0, 64800, 152064, 0xafa97fdf
-+0, 68400, 152064, 0x1ae67347
-+0, 72000, 152064, 0xc4f42ed6
-+0, 75600, 152064, 0x4445dc60
-+0, 79200, 152064, 0xaef4d04b
-+0, 82800, 152064, 0x6a51be82
-+0, 86400, 152064, 0x48356190
-+0, 90000, 152064, 0xc09b5f5d
-+0, 93600, 152064, 0x933d3379
-+0, 97200, 152064, 0xfb57e471
-+0, 100800, 152064, 0xb5b2f45c
-+0, 104400, 152064, 0xce36e45e
-+0, 108000, 152064, 0x582f9f64
-+0, 111600, 152064, 0x2f45b1fd
-+0, 115200, 152064, 0x90708fa0
-+0, 118800, 152064, 0xee483b8f
-+0, 122400, 152064, 0xd2163e6c
-+0, 126000, 152064, 0x39492dfe
-+0, 129600, 152064, 0xf89cc57f
-+0, 133200, 152064, 0xbfc3c411
-+0, 136800, 152064, 0x919eb007
-+0, 140400, 152064, 0x2c526309
-+0, 144000, 152064, 0x39f067a2
-+0, 147600, 152064, 0xb7653abb
-+0, 151200, 152064, 0xe26a035c
-+0, 154800, 152064, 0xcef1eb3b
-+0, 158400, 152064, 0xb8b3c55f
-+0, 162000, 152064, 0x16ba3b13
-+0, 165600, 152064, 0x153a3117
-+0, 169200, 152064, 0x90a21859
-+0, 172800, 152064, 0x9231b756
-+0, 176400, 152064, 0x65fcbcb9
-+0, 180000, 152064, 0x447eaf44
-+0, 183600, 152064, 0xa26b6a8e
-+0, 187200, 152064, 0x100464f8
-+0, 190800, 152064, 0x479648ec
-+0, 194400, 152064, 0x6742f51f
-+0, 198000, 152064, 0x14e9d906
-+0, 201600, 152064, 0xa058ab87
-+0, 205200, 152064, 0x8d093874
-+0, 208800, 152064, 0xef7f2965
-+0, 212400, 152064, 0x200d02bd
-+0, 216000, 152064, 0x2fb599f6
-+0, 219600, 152064, 0xf65fb6e4
-+0, 223200, 152064, 0x489a9152
-+0, 226800, 152064, 0xbe8a2fc2
-+0, 230400, 152064, 0xea04097e
-+0, 234000, 152064, 0xaf0cd627
-+0, 237600, 152064, 0xc0a26b27
-+0, 241200, 152064, 0x985f67e7
-+0, 244800, 152064, 0x7d1b4c4c
-+0, 248400, 152064, 0x9908f838
-+0, 252000, 152064, 0xb8fef131
-+0, 255600, 152064, 0xb1feaf6c
-+0, 259200, 152064, 0x37b16bda
-+0, 262800, 152064, 0x242471aa
-+0, 266400, 152064, 0xf18c3839
-+0, 270000, 152064, 0xf676d780
-+0, 273600, 152064, 0x17bd0f76
-+0, 277200, 152064, 0x3703e7a6
-+0, 280800, 152064, 0x69ba8a8a
-+0, 284400, 152064, 0x205281b3
-+0, 288000, 152064, 0x54bf51e1
-+0, 291600, 152064, 0xf6daf8ed
-+0, 295200, 152064, 0x8728e805
-+0, 298800, 152064, 0xe98cd2b0
-+0, 302400, 152064, 0x7ef76e26
-+0, 306000, 152064, 0x0fbf5230
-+0, 309600, 152064, 0x9e4d104b
-+0, 313200, 152064, 0xd562b815
-make: *** [fate-h264-conformance-cvwp3_toshiba_e] Error 1
-TEST    h264-conformance-cvwp5_toshiba_e
-TEST    h264-conformance-fi1_sony_e
-TEST    h264-conformance-frext-alphaconformanceg
-TEST    h264-conformance-frext-bcrm_freh10
-TEST    h264-conformance-frext-brcm_freh11
-TEST    h264-conformance-frext-brcm_freh3
-TEST    h264-conformance-frext-brcm_freh4
-TEST    h264-conformance-frext-brcm_freh5
-TEST    h264-conformance-frext-brcm_freh8
-TEST    h264-conformance-frext-brcm_freh9
-TEST    h264-conformance-frext-freh12_b
-TEST    h264-conformance-frext-freh1_b
-TEST    h264-conformance-frext-freh2_b
-TEST    h264-conformance-frext-freh6
-TEST    h264-conformance-frext-freh7_b
-TEST    h264-conformance-frext-frext01_jvc_d
-TEST    h264-conformance-frext-frext02_jvc_c
-TEST    h264-conformance-frext-frext1_panasonic_c
-TEST    h264-conformance-frext-frext2_panasonic_b
-TEST    h264-conformance-frext-frext3_panasonic_d
-TEST    h264-conformance-frext-frext4_panasonic_a
-TEST    h264-conformance-frext-frext_mmco4_sony_b
-TEST    h264-conformance-frext-hcaff1_hhi_b
-TEST    h264-conformance-frext-hcafr1_hhi_c
-TEST    h264-conformance-frext-hcafr2_hhi_a
-TEST    h264-conformance-frext-hcafr3_hhi_a
-TEST    h264-conformance-frext-hcafr4_hhi_a
-TEST    h264-conformance-frext-hcamff1_hhi_b
-TEST    h264-conformance-frext-hpca_brcm_c
-TEST    h264-conformance-frext-hpcadq_brcm_b
-TEST    h264-conformance-frext-hpcafl_bcrm_c
-TEST    h264-conformance-frext-hpcaflnl_bcrm_c
-TEST    h264-conformance-frext-hpcalq_brcm_b
-TEST    h264-conformance-frext-hpcamapalq_bcrm_b
-TEST    h264-conformance-frext-hpcamolq_brcm_b
-TEST    h264-conformance-frext-hpcanl_brcm_c
-TEST    h264-conformance-frext-hpcaq2lq_brcm_b
-TEST    h264-conformance-frext-hpcv_brcm_a
-TEST    h264-conformance-frext-hpcvfl_bcrm_a
-TEST    h264-conformance-frext-hpcvflnl_bcrm_a
-TEST    h264-conformance-frext-hpcvmolq_brcm_b
-TEST    h264-conformance-frext-hpcvnl_brcm_a
-TEST    h264-conformance-hcbp2_hhi_a
-TEST    h264-conformance-hcmp1_hhi_a
-TEST    h264-conformance-ls_sva_d
-TEST    h264-conformance-midr_mw_d
-TEST    h264-conformance-mps_mw_a
-TEST    h264-conformance-mr1_bt_a
-TEST    h264-conformance-mr1_mw_a
-TEST    h264-conformance-mr2_mw_a
-TEST    h264-conformance-mr2_tandberg_e
-TEST    h264-conformance-mr3_tandberg_b
-TEST    h264-conformance-mr4_tandberg_c
-TEST    h264-conformance-mr5_tandberg_c
-TEST    h264-conformance-mr6_bt_b
-TEST    h264-conformance-mr7_bt_b
-TEST    h264-conformance-mr8_bt_b
-TEST    h264-conformance-mr9_bt_b
-TEST    h264-conformance-mv1_brcm_d
-TEST    h264-conformance-nl1_sony_d
-TEST    h264-conformance-nl2_sony_h
-TEST    h264-conformance-nl3_sva_e
-TEST    h264-conformance-nlmq1_jvc_c
-TEST    h264-conformance-nlmq2_jvc_c
-TEST    h264-conformance-nrf_mw_e
-TEST    h264-conformance-sharp_mp_field_1_b
-TEST    h264-conformance-sharp_mp_field_2_b
-TEST    h264-conformance-sharp_mp_field_3_b
-TEST    h264-conformance-sharp_mp_paff_1r2
-TEST    h264-conformance-sharp_mp_paff_2r
-TEST    h264-conformance-sl1_sva_b
-TEST    h264-conformance-sva_ba1_b
-TEST    h264-conformance-sva_ba2_d
-TEST    h264-conformance-sva_base_b
-TEST    h264-conformance-sva_cl1_e
-TEST    h264-conformance-sva_fm1_e
-TEST    h264-conformance-sva_nl1_b
-TEST    h264-conformance-sva_nl2_e
-TEST    h264-interlace-crop
-TEST    mp3-float-conf-compl
-TEST    mp3-float-conf-he_32khz
-TEST    mp3-float-conf-he_44khz
-TEST    mp3-float-conf-he_48khz
-TEST    mp3-float-conf-hecommon
-TEST    mp3-float-conf-si
-TEST    mp3-float-conf-si_block
-TEST    vorbis-1
-TEST    vorbis-2
-TEST    vorbis-3
-TEST    vorbis-4
-TEST    vorbis-5
-TEST    vorbis-6
-TEST    vorbis-7
-TEST    vorbis-8
-TEST    vorbis-9
-TEST    vorbis-10
-TEST    vorbis-11
-TEST    vorbis-12
-TEST    vorbis-13
-TEST    vorbis-14
-TEST    vorbis-15
-TEST    vorbis-16
-TEST    vorbis-17
-TEST    vorbis-18
-TEST    vorbis-19
-TEST    vp8-test-vector-001
-TEST    vp8-test-vector-002
-TEST    vp8-test-vector-003
-TEST    vp8-test-vector-004
-TEST    vp8-test-vector-005
-TEST    vp8-test-vector-006
-TEST    vp8-test-vector-007
-TEST    vp8-test-vector-008
-TEST    vp8-test-vector-009
-TEST    vp8-test-vector-010
-TEST    vp8-test-vector-011
-TEST    vp8-test-vector-012
-TEST    vp8-test-vector-013
-TEST    vp8-test-vector-014
-TEST    vp8-test-vector-015
-TEST    vp8-test-vector-016
-TEST    vp8-test-vector-017
-TEST    vp8-sign-bias
-TEST    vp8-test-vector-emu-edge-001
-TEST    vp8-test-vector-emu-edge-002
-TEST    vp8-test-vector-emu-edge-003
-TEST    vp8-test-vector-emu-edge-004
-TEST    vp8-test-vector-emu-edge-005
-TEST    vp8-test-vector-emu-edge-006
-TEST    vp8-test-vector-emu-edge-007
-TEST    vp8-test-vector-emu-edge-008
-TEST    vp8-test-vector-emu-edge-009
-TEST    vp8-test-vector-emu-edge-010
-TEST    vp8-test-vector-emu-edge-011
-TEST    vp8-test-vector-emu-edge-012
-TEST    vp8-test-vector-emu-edge-013
-TEST    vp8-test-vector-emu-edge-014
-TEST    vp8-test-vector-emu-edge-015
-TEST    vp8-test-vector-emu-edge-016
-TEST    vp8-test-vector-emu-edge-017
-TEST    vp8-sign-bias-emu-edge
-make: Target `fate' not remade because of errors.
diff --git a/ffmpeg-mt/mt-work/test.sh b/ffmpeg-mt/mt-work/test.sh
index a88a35b..dac4f43 100755
--- a/ffmpeg-mt/mt-work/test.sh
+++ b/ffmpeg-mt/mt-work/test.sh
@@ -2,11 +2,11 @@
 
 fn=`basename "$1"`
 for th in 1 2 3 4; do
-    time ./ffmpeg_g -threads $th -flags2 +fast  -vsync 0 -y -t 30 -i "$1" -an -f framecrc "crc/$fn-$th.txt" >/dev/null 2>&1
+    time ./ffmpeg -threads $th -flags2 +fast  -vsync 0 -y -t 30 -i "$1" -an -f framecrc "crc/$fn-$th.txt" >/dev/null 2>&1
 done
 
-./ffmpeg_g -threads 1 -y -t 10 -i "$1" -an -f framecrc "crc/$fn-1-vsync.txt" >/dev/null 2>&1
-./ffmpeg_g -threads 3 -y -t 10 -i "$1" -an -f framecrc "crc/$fn-3-vsync.txt" >/dev/null 2>&1
+./ffmpeg -threads 1 -y -t 10 -i "$1" -an -f framecrc "crc/$fn-1-vsync.txt" >/dev/null 2>&1
+./ffmpeg -threads 3 -y -t 10 -i "$1" -an -f framecrc "crc/$fn-3-vsync.txt" >/dev/null 2>&1
 
 md5 "crc/$fn-"[1234].txt
 echo
diff --git a/ffmpeg-mt/mt-work/todo.txt b/ffmpeg-mt/mt-work/todo.txt
index cb3db11..013853e 100644
--- a/ffmpeg-mt/mt-work/todo.txt
+++ b/ffmpeg-mt/mt-work/todo.txt
@@ -2,7 +2,7 @@ Todo
 
 -- For other people
 - Multithread vp8 or vc1.
-- Multithread an intra codec like mjpeg.
+- Multithread an intra codec like mjpeg (trivial).
 - Fix mpeg1 (see below).
 - Try the first three items under Optimization.
 - Fix h264 (see below).
@@ -11,18 +11,11 @@ Todo
 -- Bug fixes
 
 General critical:
-- 'make test' fails.
-There seems to be some problem related to draw_edges/the mpeg4 encoder.
-- 'make fate' fails to due unknown H264 bugs.
-This works on mainline_patches, so diffing h264*.c and reverting hunks
-until it works should find the problem.
 - Error resilience has to run before ff_report_frame_progress()
 is called. Otherwise there will be race conditions. (This might already
 work.) In general testing error paths should be done more.
-
-mpeg*:
-- ARM asm depends on specific offsets into MpegEncContext
-which are different here.
+- 'make fate THREADS=2' doesn't pass. Most failures are due to
+bugs in vsync in ffmpeg.c, which are currently obscuring real failures.
 
 h264:
 - Files split at the wrong NAL unit don't (and can't)
@@ -48,7 +41,7 @@ with threads on. Currently disabled for this reason.
 -- Prove correct
 
 - decode_update_progress() in h264.c
-h264_race_checking branch has some work on h264,
+race_checking branch has some work on h264,
 but not that function. It might be worth putting
 the branch under #ifdef DEBUG in mainline, but
 the code would have to be cleaner.
@@ -57,9 +50,11 @@ the code would have to be cleaner.
 
 -- Optimization
 
+- Merge h264 decode_update_progress() with loop_filter().
+Add CODEC_CAP_DRAW_HORIZ_BAND as a side effect.
 - EMU_EDGE is always set for h264 PAFF+MT
 because draw_edges() writes into the other field's
-thread's pixels.
+thread's pixels. Needs an option to skip T/B fields.
 - Check update_thread_context() functions and make
 sure they only copy what they need to.
 - Try some more optimization of the "ref < 48; ref++"
@@ -78,8 +73,6 @@ the input in the meantime), closing the codec and
 reopening it. Or don't support it.
 - Support encoding. Might need more threading primitives
 for good ratecontrol; would be nice for audio and libavfilter too.
-- After merging to mainline, deprecate avcodec_thread_init
-and just set thread_count.
 - Async decoding part 1: instead of trying to
 start every thread at the beginning, return a picture
 if the earliest thread is already done, but don't wait
diff --git a/ffmpeg-mt/mt-work/valgrind-check.sh b/ffmpeg-mt/mt-work/valgrind-check.sh
index dc3833a..142942c 100755
--- a/ffmpeg-mt/mt-work/valgrind-check.sh
+++ b/ffmpeg-mt/mt-work/valgrind-check.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-valgrind --leak-check=full ./ffmpeg_g -threads 3 -vsync 0 -y -t 30 -i "$1" -an -f framecrc /dev/null
\ No newline at end of file
+valgrind --leak-check=full ./ffmpeg -threads 3 -vsync 0 -y -t 30 -i "$1" -an -f framecrc /dev/null
diff --git a/ffmpeg-mt/subdir.mak b/ffmpeg-mt/subdir.mak
index 8a407fe..7fdeddc 100644
--- a/ffmpeg-mt/subdir.mak
+++ b/ffmpeg-mt/subdir.mak
@@ -60,7 +60,6 @@ distclean:: clean
 install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
 	$(Q)mkdir -p "$(SHLIBDIR)"
 	$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	$$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
 	$(Q)cd "$(SHLIBDIR)" && \
 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
 	$(Q)cd "$(SHLIBDIR)" && \
diff --git a/ffmpeg-mt/tests/audiogen.c b/ffmpeg-mt/tests/audiogen.c
index 852e042..ddd1e18 100644
--- a/ffmpeg-mt/tests/audiogen.c
+++ b/ffmpeg-mt/tests/audiogen.c
@@ -4,20 +4,20 @@
  *
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tests/base64.c b/ffmpeg-mt/tests/base64.c
index 75ba8bc..aad7dfb 100644
--- a/ffmpeg-mt/tests/base64.c
+++ b/ffmpeg-mt/tests/base64.c
@@ -1,18 +1,18 @@
 /*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tests/codec-regression.sh b/ffmpeg-mt/tests/codec-regression.sh
index 71d50a1..b705bc1 100755
--- a/ffmpeg-mt/tests/codec-regression.sh
+++ b/ffmpeg-mt/tests/codec-regression.sh
@@ -249,8 +249,8 @@ do_video_decoding "" "-pix_fmt yuv420p"
 fi
 
 if [ -n "$do_qtrle" ] ; then
-do_video_encoding qtrle.mov "" ""
-do_video_decoding "" ""
+do_video_encoding qtrle.mov "" "-an -vcodec qtrle"
+do_video_decoding "" "-pix_fmt yuv420p"
 fi
 
 if [ -n "$do_rgb" ] ; then
diff --git a/ffmpeg-mt/tests/fate-run.sh b/ffmpeg-mt/tests/fate-run.sh
index c4a9a13..3a6b46b 100755
--- a/ffmpeg-mt/tests/fate-run.sh
+++ b/ffmpeg-mt/tests/fate-run.sh
@@ -15,6 +15,7 @@ command=$5
 cmp=${6:-diff}
 ref=${7:-"${base}/ref/fate/${test}"}
 fuzz=$8
+threads=${9:-1}
 
 outdir="tests/data/fate"
 outfile="${outdir}/${test}"
@@ -48,7 +49,7 @@ run(){
 }
 
 ffmpeg(){
-    run ffmpeg -v 0 "$@"
+    run ffmpeg -v 0 -threads $threads "$@"
 }
 
 framecrc(){
@@ -77,7 +78,7 @@ regtest(){
     cleanfiles="$cleanfiles $outfile $errfile"
     outfile=tests/data/regression/$2/$t
     errfile=tests/data/$t.$2.err
-    ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path"
+    ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads"
 }
 
 codectest(){
diff --git a/ffmpeg-mt/tests/fate-update.sh b/ffmpeg-mt/tests/fate-update.sh
deleted file mode 100755
index 6b4668f..0000000
--- a/ffmpeg-mt/tests/fate-update.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /bin/sh
-
-set -e
-
-base=$(dirname $0)
-ref="${base}/ref/fate"
-
-FATE_DB_URL="http://fate.multimedia.cx/fate-tests.sqlite.bz2"
-FATE_DB=$(mktemp fate-db.XXXXXX)
-SQL_TESTS='SELECT id,short_name,command FROM test_spec WHERE active=1 ORDER BY short_name'
-
-do_sql(){
-    sqlite3 -noheader -separator ' ' "$FATE_DB" "$@"
-}
-
-wget -q -O - "$FATE_DB_URL" | bunzip2 > "$FATE_DB"
-mkdir -p "$ref"
-exec 3>"$base/fate.mak"
-
-do_sql "$SQL_TESTS" | while read id name command; do
-    case "$name" in
-        00-full-regression|ffmpeg-help|binsize-*) continue ;;
-    esac
-    case "$command" in
-        {MD5}*)
-            command="${command#*ffmpeg}"; command="${command% -}"
-            command="md5 $command"
-            ;;
-        {*}*)   continue ;;
-        *-f\ framecrc\ -)
-            command="${command#*ffmpeg}"; command="${command% -f *}"
-            command="framecrc $command"
-            ;;
-        *-f\ framemd5\ -)
-            command="${command#*ffmpeg}"; command="${command% -f *}"
-            command="framemd5 $command"
-            ;;
-        *-f\ crc\ -)
-            command="${command#*ffmpeg}"; command="${command% -f *}"
-            command="crc $command"
-            ;;
-        *)
-            echo "Unhandled command '$command'"
-            exit 1
-            ;;
-    esac
-    command=$(echo "$command" | sed 's/\$SAMPLES_PATH/$(SAMPLES)/g')
-    command=$(echo "$command" | sed 's/ *$//')
-    do_sql "SELECT expected_stdout FROM test_spec WHERE id=$id" | awk '/./{print}' > "$ref/$name"
-    printf "FATE_TESTS += fate-${name}\n" >&3
-    printf "fate-${name}: CMD = %s\n" "$command" >&3
-done
-
-exec 3<&-
-rm -f "$FATE_DB"
diff --git a/ffmpeg-mt/tests/fate.mak b/ffmpeg-mt/tests/fate.mak
index 21158fc..0e33311 100644
--- a/ffmpeg-mt/tests/fate.mak
+++ b/ffmpeg-mt/tests/fate.mak
@@ -204,8 +204,10 @@ FATE_TESTS += fate-pcm_dvd
 fate-pcm_dvd: CMD = framecrc  -i $(SAMPLES)/pcm-dvd/coolitnow-partial.vob -vn
 FATE_TESTS += fate-psx-str
 fate-psx-str: CMD = framecrc  -i $(SAMPLES)/psx-str/descent-partial.str
-FATE_TESTS += fate-psx-str-v3
-fate-psx-str-v3: CMD = framecrc  -i $(SAMPLES)/psx-str/abc000_cut.str
+FATE_TESTS += fate-psx-str-v3-mdec
+fate-psx-str-v3-mdec: CMD = framecrc  -i $(SAMPLES)/psx-str/abc000_cut.str -an
+FATE_TESTS += fate-psx-str-v3-adpcm_xa
+fate-psx-str-v3-adpcm_xa: CMD = framecrc  -i $(SAMPLES)/psx-str/abc000_cut.str -vn
 FATE_TESTS += fate-ptx
 fate-ptx: CMD = framecrc  -i $(SAMPLES)/ptx/_113kw_pic.ptx -pix_fmt rgb24
 FATE_TESTS += fate-pva-demux
diff --git a/ffmpeg-mt/tests/fate.sh b/ffmpeg-mt/tests/fate.sh
index 56729d8..6f0e0ff 100755
--- a/ffmpeg-mt/tests/fate.sh
+++ b/ffmpeg-mt/tests/fate.sh
@@ -29,7 +29,6 @@ checkout(){
     case "$repo" in
         file:*|/*) src="${repo#file:}"      ;;
         git:*)     git clone "$repo" "$src" ;;
-        svn:*)     svn co    "$repo" "$src" ;;
     esac
 }
 
@@ -37,7 +36,6 @@ update()(
     cd ${src} || return
     case "$repo" in
         git:*) git pull ;;
-        svn:*) svn up   ;;
     esac
 )
 
diff --git a/ffmpeg-mt/tests/fate/aac.mak b/ffmpeg-mt/tests/fate/aac.mak
index 05835f8..41df4f6 100644
--- a/ffmpeg-mt/tests/fate/aac.mak
+++ b/ffmpeg-mt/tests/fate/aac.mak
@@ -18,6 +18,10 @@ FATE_AAC += fate-aac-al_sbr_ps_06_ur
 fate-aac-al_sbr_ps_06_ur: CMD = pcm -i $(SAMPLES)/aac/al_sbr_ps_06_new.mp4
 fate-aac-al_sbr_ps_06_ur: REF = $(SAMPLES)/aac/al_sbr_ps_06_ur.s16
 
+FATE_AAC += fate-aac-latm_000000001180bc60
+fate-aac-latm_000000001180bc60: CMD = pcm -i $(SAMPLES)/aac/latm_000000001180bc60.mpg
+fate-aac-latm_000000001180bc60: REF = $(SAMPLES)/aac/latm_000000001180bc60.s16
+
 FATE_TESTS += $(FATE_AAC)
 fate-aac: $(FATE_AAC)
 $(FATE_AAC): CMP = oneoff
diff --git a/ffmpeg-mt/tests/fate/fft.mak b/ffmpeg-mt/tests/fate/fft.mak
index 97da53f..042a7bf 100644
--- a/ffmpeg-mt/tests/fate/fft.mak
+++ b/ffmpeg-mt/tests/fate/fft.mak
@@ -1,35 +1,31 @@
-FATE_FFT += fate-fft
-fate-fft: libavcodec/fft-test$(EXESUF)
-fate-fft: CMD = run libavcodec/fft-test
-
-FATE_FFT += fate-ifft
-fate-ifft: libavcodec/fft-test$(EXESUF)
-fate-ifft: CMD = run libavcodec/fft-test -i
-
-FATE_FFT += fate-mdct
-fate-mdct: libavcodec/fft-test$(EXESUF)
-fate-mdct: CMD = run libavcodec/fft-test -m
-
-FATE_FFT += fate-imdct
-fate-imdct: libavcodec/fft-test$(EXESUF)
-fate-imdct: CMD = run libavcodec/fft-test -m -i
+FATE_FFT = fate-fft   fate-ifft   \
+           fate-mdct  fate-imdct  \
+           fate-rdft  fate-irdft  \
+           fate-dct1d fate-idct1d
+
+fate-fft:    CMD = run libavcodec/fft-test
+fate-ifft:   CMD = run libavcodec/fft-test -i
+fate-mdct:   CMD = run libavcodec/fft-test -m
+fate-imdct:  CMD = run libavcodec/fft-test -m -i
+fate-rdft:   CMD = run libavcodec/fft-test -r
+fate-irdft:  CMD = run libavcodec/fft-test -r -i
+fate-dct1d:  CMD = run libavcodec/fft-test -d
+fate-idct1d: CMD = run libavcodec/fft-test -d -i
 
-FATE_FFT += fate-rdft
-fate-rdft: libavcodec/fft-test$(EXESUF)
-fate-rdft: CMD = run libavcodec/fft-test -r
+fate-fft-test: $(FATE_FFT)
+$(FATE_FFT): libavcodec/fft-test$(EXESUF)
+$(FATE_FFT): REF = /dev/null
 
-FATE_FFT += fate-irdft
-fate-irdft: libavcodec/fft-test$(EXESUF)
-fate-irdft: CMD = run libavcodec/fft-test -r -i
+FATE_FFT_FIXED = fate-fft-fixed  fate-ifft-fixed  \
+                 fate-mdct-fixed fate-imdct-fixed
 
-FATE_FFT += fate-dct1d
-fate-dct1d: libavcodec/fft-test$(EXESUF)
-fate-dct1d: CMD = run libavcodec/fft-test -d
+fate-fft-fixed:   CMD = run libavcodec/fft-fixed-test
+fate-ifft-fixed:  CMD = run libavcodec/fft-fixed-test -i
+fate-mdct-fixed:  CMD = run libavcodec/fft-fixed-test -m
+fate-imdct-fixed: CMD = run libavcodec/fft-fixed-test -m -i
 
-FATE_FFT += fate-idct1d
-fate-idct1d: libavcodec/fft-test$(EXESUF)
-fate-idct1d: CMD = run libavcodec/fft-test -d -i
+fate-fft-fixed-test: $(FATE_FFT_FIXED)
+$(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF)
+$(FATE_FFT_FIXED): REF = /dev/null
 
-FATE_TESTS += $(FATE_FFT)
-fate-fft-test: $(FATE_FFT)
-$(FATE_FFT): REF = /dev/null
+FATE_TESTS += $(FATE_FFT) $(FATE_FFT_FIXED)
diff --git a/ffmpeg-mt/tests/fate/h264.mak b/ffmpeg-mt/tests/fate/h264.mak
index b4bec53..259e1e0 100644
--- a/ffmpeg-mt/tests/fate/h264.mak
+++ b/ffmpeg-mt/tests/fate/h264.mak
@@ -164,7 +164,11 @@ FATE_H264 = aud_mw_e                                                    \
             sva_nl1_b                                                   \
             sva_nl2_e                                                   \
 
-FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%) fate-h264-interlace-crop
+FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)                    \
+              fate-h264-interlace-crop                                  \
+              fate-h264-lossless                                        \
+              fate-h264-extreme-plane-pred                              \
+
 FATE_TESTS += $(FATE_H264)
 fate-h264: $(FATE_H264)
 
@@ -335,3 +339,5 @@ fate-h264-conformance-sva_nl1_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/
 fate-h264-conformance-sva_nl2_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_NL2_E.264
 
 fate-h264-interlace-crop: CMD = framecrc  -vframes 3 -i $(SAMPLES)/h264/interlaced_crop.mp4
+fate-h264-lossless: CMD = framecrc -i $(SAMPLES)/h264/lossless.h264
+fate-h264-extreme-plane-pred: CMD = framemd5 -strict 1 -vsync 0 -i $(SAMPLES)/h264/extreme-plane-pred.h264
diff --git a/ffmpeg-mt/tests/fate/vp8.mak b/ffmpeg-mt/tests/fate/vp8.mak
index 4609120..2b17130 100644
--- a/ffmpeg-mt/tests/fate/vp8.mak
+++ b/ffmpeg-mt/tests/fate/vp8.mak
@@ -6,18 +6,15 @@ fate-vp8-test-vector$(2)-$(1): CMD = framemd5 $(3) -i $(SAMPLES)/vp8-test-vector
 fate-vp8-test-vector$(2)-$(1): REF = $(SRC_PATH_BARE)/tests/ref/fate/vp8-test-vector-$(1)
 endef
 
-define FATE_VP8_FULL_SUITE
-$(foreach N,$(VP8_SUITE),$(eval $(call FATE_VP8_SUITE,$(N),$(2),$(VP8_OPT$(1)))))
+define FATE_VP8_FULL
+$(foreach N,$(VP8_SUITE),$(eval $(call FATE_VP8_SUITE,$(N),$(1),$(2))))
 
-FATE_VP8 += fate-vp8-sign-bias$(2)
-fate-vp8-sign-bias$(2): CMD = framemd5 $(VP8_OPT$(1)) -i $(SAMPLES)/vp8/sintel-signbias.ivf
-fate-vp8-sign-bias$(2): REF = $(SRC_PATH_BARE)/tests/ref/fate/vp8-sign-bias
+FATE_VP8 += fate-vp8-sign-bias$(1)
+fate-vp8-sign-bias$(1): CMD = framemd5 $(2) -i $(SAMPLES)/vp8/sintel-signbias.ivf
+fate-vp8-sign-bias$(1): REF = $(SRC_PATH_BARE)/tests/ref/fate/vp8-sign-bias
 endef
 
-VP8_OPTS = _ _emu_edge_
-VP8_OPT_ =
-VP8_OPT_emu_edge_ = -flags emu_edge
-
-$(foreach O,$(VP8_OPTS),$(eval $(call FATE_VP8_FULL_SUITE,$(O),$(subst _,-,$(O:_=)))))
+$(eval $(call FATE_VP8_FULL))
+$(eval $(call FATE_VP8_FULL,-emu-edge,-flags emu_edge))
 FATE_TESTS += $(FATE_VP8)
 fate-vp8: $(FATE_VP8)
diff --git a/ffmpeg-mt/tests/lavf-regression.sh b/ffmpeg-mt/tests/lavf-regression.sh
index 736629b..b14a58e 100755
--- a/ffmpeg-mt/tests/lavf-regression.sh
+++ b/ffmpeg-mt/tests/lavf-regression.sh
@@ -40,7 +40,7 @@ do_image_formats()
 do_audio_only()
 {
     file=${outfile}lavf.$1
-    do_ffmpeg $file -t 1 -qscale 10 -f s16le -i $pcm_src
+    do_ffmpeg $file -t 1 -qscale 10 $2 -f s16le -i $pcm_src $3
     do_ffmpeg_crc $file -i $target_path/$file
 }
 
@@ -206,6 +206,10 @@ if [ -n "$do_voc" ] ; then
 do_audio_only voc
 fi
 
+if [ -n "$do_voc_s16" ] ; then
+do_audio_only s16.voc "-ac 2" "-acodec pcm_s16le"
+fi
+
 if [ -n "$do_ogg" ] ; then
 do_audio_only ogg
 fi
diff --git a/ffmpeg-mt/tests/lavfi-regression.sh b/ffmpeg-mt/tests/lavfi-regression.sh
index f9f9f7c..ed13f70 100755
--- a/ffmpeg-mt/tests/lavfi-regression.sh
+++ b/ffmpeg-mt/tests/lavfi-regression.sh
@@ -14,11 +14,20 @@ eval do_$test=y
 rm -f "$logfile"
 rm -f "$benchfile"
 
+do_video_filter() {
+    label=$1
+    filters=$2
+    shift 2
+    printf '%-20s' $label >>$logfile
+    run_ffmpeg -f image2 -vcodec pgmyuv -i $raw_src    \
+        -vf "$filters" -vcodec rawvideo $* -f nut md5: >>$logfile
+}
+
 do_lavfi() {
     vfilters="slicify=random,$2"
 
     if [ $test = $1 ] ; then
-        do_video_encoding ${test}.nut "" "-vcodec rawvideo -vf $vfilters"
+        do_video_filter $test "$vfilters"
     fi
 }
 
@@ -48,10 +57,7 @@ do_lavfi_pixfmts(){
 
     pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
     for pix_fmt in $pix_fmts; do
-        output=${test}-${pix_fmt}.nut
-        do_video_encoding $output "" \
-            "-vf slicify=random,format=$pix_fmt,$filter=$filter_args -vcodec rawvideo -pix_fmt $pix_fmt"
-        rm ${outfile}${output}
+        do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
     done
 
     rm $exclude_fmts $out_fmts
@@ -69,10 +75,7 @@ do_lavfi_pixfmts "vflip"   ""
 if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then
     pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2 | sort)"
     for pix_fmt in $pix_fmts; do
-        output=lavfi_pixdesc-${pix_fmt}.nut
-        do_video_encoding $output "" \
-            "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
-        rm ${outfile}${output}
+        do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt
     done
 fi
 
diff --git a/ffmpeg-mt/tests/md5.sh b/ffmpeg-mt/tests/md5.sh
index 6809169..16b0281 100644
--- a/ffmpeg-mt/tests/md5.sh
+++ b/ffmpeg-mt/tests/md5.sh
@@ -6,6 +6,8 @@ elif [ X"$(echo | md5 2> /dev/null)" != X ]; then
     do_md5sum() { md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
 elif [ -x /sbin/md5 ]; then
     do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
+elif openssl version >/dev/null 2>&1; then
+    do_md5sum() { openssl md5 $1 | sed 's/MD5(\(.*\))= \(.*\)/\2 *\1/'; }
 else
     do_md5sum() { echo No md5sum program found; }
 fi
diff --git a/ffmpeg-mt/tests/ref/acodec/ac3_fixed b/ffmpeg-mt/tests/ref/acodec/ac3_fixed
index 17159e1..a3032d0 100644
--- a/ffmpeg-mt/tests/ref/acodec/ac3_fixed
+++ b/ffmpeg-mt/tests/ref/acodec/ac3_fixed
@@ -1,2 +1,2 @@
-9823c8f74097eab5d148cf0536ae932e *./tests/data/acodec/ac3.rm
+5ddb6d25dd117db29627f9d286153a7a *./tests/data/acodec/ac3.rm
 98751 ./tests/data/acodec/ac3.rm
diff --git a/ffmpeg-mt/tests/ref/acodec/pcm b/ffmpeg-mt/tests/ref/acodec/pcm
index 1d876e4..033f8bc 100644
--- a/ffmpeg-mt/tests/ref/acodec/pcm
+++ b/ffmpeg-mt/tests/ref/acodec/pcm
@@ -22,12 +22,12 @@ stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
 1058444 ./tests/data/acodec/pcm_s16le.wav
 95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
 stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
-352a6bcf51d0f3ca4bf27c423a3d4d14 *./tests/data/acodec/pcm_s16be.mkv
- 1060650 ./tests/data/acodec/pcm_s16be.mkv
+af717ca95eaca310772eb1238c745d1b *./tests/data/acodec/pcm_s16be.mkv
+1060638 ./tests/data/acodec/pcm_s16be.mkv
 95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
 stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
-2c089d83b2699c02c9358415e00a9707 *./tests/data/acodec/pcm_s16le.mkv
- 1060650 ./tests/data/acodec/pcm_s16le.mkv
+c4f51bf32fad2f7af8ea5beedb56168b *./tests/data/acodec/pcm_s16le.mkv
+1060638 ./tests/data/acodec/pcm_s16le.mkv
 95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
 stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
 07ffe7ffb78f3648b6524debdde5aec1 *./tests/data/acodec/pcm_s24be.mov
diff --git a/ffmpeg-mt/tests/ref/fate/bink-demux-video b/ffmpeg-mt/tests/ref/fate/bink-demux-video
index 22fb3c5..f3adf76 100644
--- a/ffmpeg-mt/tests/ref/fate/bink-demux-video
+++ b/ffmpeg-mt/tests/ref/fate/bink-demux-video
@@ -13,8 +13,8 @@
 0, 72000, 460800, 0x71c0f48e
 0, 78000, 460800, 0x5fc8f783
 0, 84000, 460800, 0xd23d336a
-0, 90000, 460800, 0xa7aca9e0
-0, 96000, 460800, 0x1dff2144
-0, 102000, 460800, 0x82cf8b2b
-0, 108000, 460800, 0x4cbe3544
+0, 90000, 460800, 0xadcfa9e0
+0, 96000, 460800, 0x24222144
+0, 102000, 460800, 0x88f28b2b
+0, 108000, 460800, 0x52e13544
 0, 114000, 460800, 0x7e724731
diff --git a/ffmpeg-mt/tests/ref/fate/h264-extreme-plane-pred b/ffmpeg-mt/tests/ref/fate/h264-extreme-plane-pred
new file mode 100644
index 0000000..d8bee85
--- /dev/null
+++ b/ffmpeg-mt/tests/ref/fate/h264-extreme-plane-pred
@@ -0,0 +1,100 @@
+0, 0, 152064, 1e857d2dfeea75297e090ffe9e37a249
+0, 3600, 152064, 29d8336b4e9b77298025074dbad641d1
+0, 7200, 152064, 3f1a87d2088a7708f4ed06890c8cd018
+0, 10800, 152064, 56b8b8d9fefbd501c4f7918f21f9b015
+0, 14400, 152064, 597392c162ea79af1e5d3dd552ffeb47
+0, 18000, 152064, 064fdd170aa24463409b1cb0ddc7f5b6
+0, 21600, 152064, 9924da4026b10110fa644039e73f92c1
+0, 25200, 152064, afdb77f4a4c87faaf35988bf2d1d7c18
+0, 28800, 152064, 80714dc3bf376f38c00f8c67fc534fae
+0, 32400, 152064, fb0ab4028e1e9879b0bf0e414c0ccb33
+0, 36000, 152064, 03c694f4b9e6116214078131f3edff91
+0, 39600, 152064, 22d2de0d8f9e5477230b50c50ec46269
+0, 43200, 152064, 470e9a6c5bbb15e151afbfd6b2f254a3
+0, 46800, 152064, b585555552169640b1a896094335b624
+0, 50400, 152064, e261e0f650e6d649a35773520e7f5bff
+0, 54000, 152064, 2d1bf889eef057016e473a041fbceac0
+0, 57600, 152064, b1a3f8ebf1de26bc8c32d47a4a53c862
+0, 61200, 152064, d5cdb80386dbb996ca007a0e210a9905
+0, 64800, 152064, 05a200df7b8baa19d2a0309476727dd7
+0, 68400, 152064, 890d62163f4aa70a2055d50de0395a35
+0, 72000, 152064, c00bdd1c5f0d69bae66ba46a897ad0ad
+0, 75600, 152064, 65f76c6d453822eb48b180ac630cbdce
+0, 79200, 152064, d6b85fc02c6d8efa53a9f0f148a0520e
+0, 82800, 152064, adcb1621c5100b8e201592328bcd11be
+0, 86400, 152064, bad7da936734cf4304c1564d6d3e74b9
+0, 90000, 152064, a98d1232d0c22e6967415700d980c67f
+0, 93600, 152064, 3fa1110c3ada7d37f0495a26774a58fb
+0, 97200, 152064, 37613c65cfd3d77e8dda3b5b913e467f
+0, 100800, 152064, 42a5cf583a82e722e04c04b10fd36542
+0, 104400, 152064, 41c2870e102e3584780cd0243baa1900
+0, 108000, 152064, da389397c874f5fd974c57278bd1e327
+0, 111600, 152064, 238c265971ef9144d3fe6bc95a2ea060
+0, 115200, 152064, 085c83a54aa9327e1e3ee76ffa337538
+0, 118800, 152064, f462966f59018b39c10f9a65a80a41f8
+0, 122400, 152064, 6e9697b7c8193b38551af4ef56861b7a
+0, 126000, 152064, e68113abf3e81a28cafd95d91871886e
+0, 129600, 152064, 35a78df5ac1ff6ee469626b750241c9b
+0, 133200, 152064, b3302a87e334634a9f92ce51acf96ab3
+0, 136800, 152064, 52198528552cefe90004a2b045b33e8f
+0, 140400, 152064, 12d9ad991d4bb7935342c8b6474d1726
+0, 144000, 152064, 2e6a508aba965f292c7b2e82bd0debbe
+0, 147600, 152064, 8daff69112bb5fbc0158cbbf7fbe057e
+0, 151200, 152064, 5495a0bb6c88a115957d98b272b0d643
+0, 154800, 152064, 955db92ab0c482381200247a207e12bc
+0, 158400, 152064, c0f81c5f95fd658c153798a514fedd22
+0, 162000, 152064, 3cfc7b9c2d73621cdb04d7e7e8bc2b3b
+0, 165600, 152064, e8b6d1d526d6443cba2e64ccd5393a4f
+0, 169200, 152064, 7722e2420db0279c9eb7c6f7dfa89c07
+0, 172800, 152064, 41b908a50b97a2e927f2e6e285e27592
+0, 176400, 152064, e05f0ddd08debc2a0578893662c33ce0
+0, 180000, 152064, 1edcedca921dbb68c0ce53371abddd8f
+0, 183600, 152064, cdbf0c89feb336e58472f0163e43b02b
+0, 187200, 152064, 39c4d20ecfeee09800feae5ad783e0bd
+0, 190800, 152064, f60d05d20b3f338aa5917490d2b58f77
+0, 194400, 152064, 76e5eae7a5205f6f6aaf8099197dbb1f
+0, 198000, 152064, f7c4c80e79b691826915b7810ab7c2a6
+0, 201600, 152064, afbc098dcaa8c2a3f41dfc3e846e8e7b
+0, 205200, 152064, 6582805bbe4ab9a9138a23deb2ca45a8
+0, 208800, 152064, 54444ce52dd1ce7bc24e9cbaba89dc59
+0, 212400, 152064, c81193469c0cd5a50c451d869e07a786
+0, 216000, 152064, 89f2295b63db3adce2961630569749a5
+0, 219600, 152064, 3f4d6dd4dd819168a358384d6b134d00
+0, 223200, 152064, 45d3b5c72609a15c1be5a45f790a24c4
+0, 226800, 152064, f2283a8bf9599754d2e251c5f0861199
+0, 230400, 152064, 06a9ccf8132c494884954bb4cc148c11
+0, 234000, 152064, e20e0143fc840db46a88a8556d887ea2
+0, 237600, 152064, bcb1ca471f70109293a15b7e1b0f3a7f
+0, 241200, 152064, 0c5f59f091b3fd5ced9bb626e5b66ec8
+0, 244800, 152064, 4dd6cf80daf74390afe0423f726c2fb6
+0, 248400, 152064, fd52e6d570960cf100ac7c973dbd222e
+0, 252000, 152064, 684758faa9b5517b2e5dbbabccc6125b
+0, 255600, 152064, e538a3bcb2125c8ac324a5be49470960
+0, 259200, 152064, 0c91795b7f52e942a1c28b4c6510c6fa
+0, 262800, 152064, b33315c61d714bd70d2adce3309633fe
+0, 266400, 152064, af2554b6b1d3f215641f85494a78ad3d
+0, 270000, 152064, e59b20b3b2c5ec215ea34ab4850f940e
+0, 273600, 152064, fb543e874bdd9749aaa710d1551e0ebd
+0, 277200, 152064, 4383abaf938da0282fecabed153bca0e
+0, 280800, 152064, 4ce40ffa75b42320593e40596c34862a
+0, 284400, 152064, f337d0cc81b5c1b1b92c3f367ed5f9cd
+0, 288000, 152064, 0f5a8c41fb7334811a485239d9126808
+0, 291600, 152064, 0daf3d981474940bdf10a93148d69353
+0, 295200, 152064, 21a51f1686071a6af7973df92361964b
+0, 298800, 152064, 1f0d471c7b1fa86f236c2dee32822464
+0, 302400, 152064, cedc6fd29d67976f899a6a8afba6b38d
+0, 306000, 152064, 4af936d3d3b456953c7beb551476824a
+0, 309600, 152064, bcaf539953adb1952fefc2cdec6c2f60
+0, 313200, 152064, d1dfeafa0939fddc256986c2b00f73c7
+0, 316800, 152064, 99c9a2c7b198e2c8cfe007ff4330f036
+0, 320400, 152064, 4db6a7edfc44389536983aeeb15edb66
+0, 324000, 152064, 8d840674b90e3b488a34e04645430ee7
+0, 327600, 152064, ad7b3e55a2eb62fc5102cc5af49301aa
+0, 331200, 152064, f24484a975ec64acb50df3e9f9e8eddd
+0, 334800, 152064, 5794617c7e40bfcb7f024bda2f2a991d
+0, 338400, 152064, ae1c22fcfa7f3b3b62dd2ace4e4b4dc7
+0, 342000, 152064, ad9d13345ae5322a578e43653e9a9c16
+0, 345600, 152064, be1b86ee130ea9255d9640117559818d
+0, 349200, 152064, 81ed195d2831e62fc2cd4fa886de8e20
+0, 352800, 152064, 8dde0af730b03ea8b3acd14d42daba04
+0, 356400, 152064, c8ffbd5ba1af8b881daf511e4d8c26f3
diff --git a/ffmpeg-mt/tests/ref/fate/h264-lossless b/ffmpeg-mt/tests/ref/fate/h264-lossless
new file mode 100644
index 0000000..c6659ca
--- /dev/null
+++ b/ffmpeg-mt/tests/ref/fate/h264-lossless
@@ -0,0 +1,10 @@
+0, 0, 460800, 0x7731dd2f
+0, 1500, 460800, 0x944b8c64
+0, 3000, 460800, 0xbe833041
+0, 4500, 460800, 0xbe95d96a
+0, 6000, 460800, 0xfe7ea5e6
+0, 7500, 460800, 0x381743c7
+0, 9000, 460800, 0x63fcc2e9
+0, 10500, 460800, 0x79574960
+0, 12000, 460800, 0xdab9e18a
+0, 13500, 460800, 0xd88e8fe8
diff --git a/ffmpeg-mt/tests/ref/fate/psx-str-v3 b/ffmpeg-mt/tests/ref/fate/psx-str-v3
deleted file mode 100644
index 3ea065b..0000000
--- a/ffmpeg-mt/tests/ref/fate/psx-str-v3
+++ /dev/null
@@ -1,96 +0,0 @@
-0, 0, 76800, 0x2677be82
-1, 0, 8064, 0xa307ed8c
-1, 4800, 8064, 0xd2551927
-0, 6000, 76800, 0x1f323c75
-1, 9600, 8064, 0x3264a799
-0, 12000, 76800, 0xc8be3be9
-1, 14400, 8064, 0x75da1393
-0, 18000, 76800, 0x1f323c75
-1, 19200, 8064, 0x68665f59
-0, 24000, 76800, 0x7e484488
-1, 24000, 8064, 0xaf266a18
-1, 28800, 8064, 0x4d4b69fd
-0, 30000, 76800, 0x8bd644aa
-1, 33600, 8064, 0x129d7e17
-0, 36000, 76800, 0xaa62e7b8
-1, 38400, 8064, 0x78c56725
-0, 42000, 76800, 0xaa62e7b8
-1, 43200, 8064, 0x59902cf1
-0, 48000, 76800, 0x53fadb39
-1, 48000, 8064, 0x6e699c87
-1, 52800, 8064, 0xc30692d7
-0, 54000, 76800, 0x53fadb39
-1, 57600, 8064, 0x29c043e5
-0, 60000, 76800, 0x1ff9d964
-1, 62400, 8064, 0x61907704
-0, 66000, 76800, 0x1ff9d964
-1, 67200, 8064, 0xf9210630
-0, 72000, 76800, 0xd8c8d947
-1, 72000, 8064, 0xc0bdda08
-1, 76800, 8064, 0x6171b96d
-0, 78000, 76800, 0xd8c8d947
-1, 81600, 8064, 0x082947cf
-0, 84000, 76800, 0x6d0bd94c
-1, 86400, 8064, 0xf7bbf1ce
-0, 90000, 76800, 0x6d0bd94c
-1, 91200, 8064, 0xe50e4436
-0, 96000, 76800, 0x7e66d948
-1, 96000, 8064, 0x2a860844
-1, 100800, 8064, 0xedcb502c
-0, 102000, 76800, 0x7e66d948
-1, 105600, 8064, 0x448e3c7f
-0, 108000, 76800, 0x8eecfd72
-1, 110400, 8064, 0xf782f366
-0, 114000, 76800, 0xb15f29ab
-1, 115200, 8064, 0xf57f66a5
-0, 120000, 76800, 0x08e5502e
-1, 120000, 8064, 0xdcc36939
-1, 124800, 8064, 0x34959d99
-0, 126000, 76800, 0xaa58796d
-1, 129600, 8064, 0xa5c20433
-0, 132000, 76800, 0xe254a27c
-1, 134400, 8064, 0xf1364e9b
-0, 138000, 76800, 0xeec8cf68
-1, 139200, 8064, 0x232fe9c7
-0, 144000, 76800, 0x812bf8ee
-1, 144000, 8064, 0xdc068d5a
-1, 148800, 8064, 0x4962e812
-0, 150000, 76800, 0x929922ef
-1, 153600, 8064, 0x36a6709b
-0, 156000, 76800, 0xe1174e06
-1, 158400, 8064, 0xa2837bd8
-0, 162000, 76800, 0x2da77bf1
-1, 163200, 8064, 0x68612ddb
-0, 168000, 76800, 0xd0f6a727
-1, 168000, 8064, 0x8d76d1cb
-1, 172800, 8064, 0x7707cfc7
-0, 174000, 76800, 0x31bfd168
-0, 180000, 76800, 0xb87af225
-0, 186000, 76800, 0xd0080859
-0, 192000, 76800, 0x99ab15ba
-0, 198000, 76800, 0x99ab15ba
-0, 204000, 76800, 0x99ab15ba
-0, 210000, 76800, 0x99ab15ba
-0, 216000, 76800, 0x99ab15ba
-0, 222000, 76800, 0x99ab15ba
-0, 228000, 76800, 0x99ab15ba
-0, 234000, 76800, 0x99ab15ba
-0, 240000, 76800, 0x99ab15ba
-0, 246000, 76800, 0x99ab15ba
-0, 252000, 76800, 0x99ab15ba
-0, 258000, 76800, 0x99ab15ba
-0, 264000, 76800, 0x99ab15ba
-0, 270000, 76800, 0x99ab15ba
-0, 276000, 76800, 0x99ab15ba
-0, 282000, 76800, 0x99ab15ba
-0, 288000, 76800, 0x0c1617d5
-0, 294000, 76800, 0xb1c81b5d
-0, 300000, 76800, 0xb4e41e44
-0, 306000, 76800, 0x765725e2
-0, 312000, 76800, 0x25cd3109
-0, 318000, 76800, 0xa42b5291
-0, 324000, 76800, 0x15bb6ee4
-0, 330000, 76800, 0xb33c9f50
-0, 336000, 76800, 0x1ca1b874
-0, 342000, 76800, 0x7506e92a
-0, 348000, 76800, 0x97c9030a
diff --git a/ffmpeg-mt/tests/ref/fate/psx-str-v3-adpcm_xa b/ffmpeg-mt/tests/ref/fate/psx-str-v3-adpcm_xa
new file mode 100644
index 0000000..ee0c354
--- /dev/null
+++ b/ffmpeg-mt/tests/ref/fate/psx-str-v3-adpcm_xa
@@ -0,0 +1,37 @@
+0, 0, 8064, 0xa307ed8c
+0, 4800, 8064, 0xd2551927
+0, 9600, 8064, 0x3264a799
+0, 14400, 8064, 0x75da1393
+0, 19200, 8064, 0x68665f59
+0, 24000, 8064, 0xaf266a18
+0, 28800, 8064, 0x4d4b69fd
+0, 33600, 8064, 0x129d7e17
+0, 38400, 8064, 0x78c56725
+0, 43200, 8064, 0x59902cf1
+0, 48000, 8064, 0x6e699c87
+0, 52800, 8064, 0xc30692d7
+0, 57600, 8064, 0x29c043e5
+0, 62400, 8064, 0x61907704
+0, 67200, 8064, 0xf9210630
+0, 72000, 8064, 0xc0bdda08
+0, 76800, 8064, 0x6171b96d
+0, 81600, 8064, 0x082947cf
+0, 86400, 8064, 0xf7bbf1ce
+0, 91200, 8064, 0xe50e4436
+0, 96000, 8064, 0x2a860844
+0, 100800, 8064, 0xedcb502c
+0, 105600, 8064, 0x448e3c7f
+0, 110400, 8064, 0xf782f366
+0, 115200, 8064, 0xf57f66a5
+0, 120000, 8064, 0xdcc36939
+0, 124800, 8064, 0x34959d99
+0, 129600, 8064, 0xa5c20433
+0, 134400, 8064, 0xf1364e9b
+0, 139200, 8064, 0x232fe9c7
+0, 144000, 8064, 0xdc068d5a
+0, 148800, 8064, 0x4962e812
+0, 153600, 8064, 0x36a6709b
+0, 158400, 8064, 0xa2837bd8
+0, 163200, 8064, 0x68612ddb
+0, 168000, 8064, 0x8d76d1cb
+0, 172800, 8064, 0x7707cfc7
diff --git a/ffmpeg-mt/tests/ref/fate/psx-str-v3-mdec b/ffmpeg-mt/tests/ref/fate/psx-str-v3-mdec
new file mode 100644
index 0000000..52a3835
--- /dev/null
+++ b/ffmpeg-mt/tests/ref/fate/psx-str-v3-mdec
@@ -0,0 +1,59 @@
+0, 0, 76800, 0x2677be82
+0, 6000, 76800, 0x1f323c75
+0, 12000, 76800, 0xc8be3be9
+0, 18000, 76800, 0x1f323c75
+0, 24000, 76800, 0x7e484488
+0, 30000, 76800, 0x8bd644aa
+0, 36000, 76800, 0xaa62e7b8
+0, 42000, 76800, 0xaa62e7b8
+0, 48000, 76800, 0x53fadb39
+0, 54000, 76800, 0x53fadb39
+0, 60000, 76800, 0x1ff9d964
+0, 66000, 76800, 0x1ff9d964
+0, 72000, 76800, 0xd8c8d947
+0, 78000, 76800, 0xd8c8d947
+0, 84000, 76800, 0x6d0bd94c
+0, 90000, 76800, 0x6d0bd94c
+0, 96000, 76800, 0x7e66d948
+0, 102000, 76800, 0x7e66d948
+0, 108000, 76800, 0x8eecfd72
+0, 114000, 76800, 0xb15f29ab
+0, 120000, 76800, 0x08e5502e
+0, 126000, 76800, 0xaa58796d
+0, 132000, 76800, 0xe254a27c
+0, 138000, 76800, 0xeec8cf68
+0, 144000, 76800, 0x812bf8ee
+0, 150000, 76800, 0x929922ef
+0, 156000, 76800, 0xe1174e06
+0, 162000, 76800, 0x2da77bf1
+0, 168000, 76800, 0xd0f6a727
+0, 174000, 76800, 0x31bfd168
+0, 180000, 76800, 0xb87af225
+0, 186000, 76800, 0xd0080859
+0, 192000, 76800, 0x99ab15ba
+0, 198000, 76800, 0x99ab15ba
+0, 204000, 76800, 0x99ab15ba
+0, 210000, 76800, 0x99ab15ba
+0, 216000, 76800, 0x99ab15ba
+0, 222000, 76800, 0x99ab15ba
+0, 228000, 76800, 0x99ab15ba
+0, 234000, 76800, 0x99ab15ba
+0, 240000, 76800, 0x99ab15ba
+0, 246000, 76800, 0x99ab15ba
+0, 252000, 76800, 0x99ab15ba
+0, 258000, 76800, 0x99ab15ba
+0, 264000, 76800, 0x99ab15ba
+0, 270000, 76800, 0x99ab15ba
+0, 276000, 76800, 0x99ab15ba
+0, 282000, 76800, 0x99ab15ba
+0, 288000, 76800, 0x0c1617d5
+0, 294000, 76800, 0xb1c81b5d
+0, 300000, 76800, 0xb4e41e44
+0, 306000, 76800, 0x765725e2
+0, 312000, 76800, 0x25cd3109
+0, 318000, 76800, 0xa42b5291
+0, 324000, 76800, 0x15bb6ee4
+0, 330000, 76800, 0xb33c9f50
+0, 336000, 76800, 0x1ca1b874
+0, 342000, 76800, 0x7506e92a
+0, 348000, 76800, 0x97c9030a
diff --git a/ffmpeg-mt/tests/ref/fate/sierra-vmd b/ffmpeg-mt/tests/ref/fate/sierra-vmd
index 4d9e4cd..91a8e46 100644
--- a/ffmpeg-mt/tests/ref/fate/sierra-vmd
+++ b/ffmpeg-mt/tests/ref/fate/sierra-vmd
@@ -1,5 +1,5 @@
 0, 0, 230400, 0x0224ab01
-1, 0, 123480, 0xc1059826
+1, 0, 123480, 0x3a794c13
 0, 9000, 230400, 0x449e4d81
 0, 18000, 230400, 0x3e15e07a
 0, 27000, 230400, 0xdabe4172
@@ -27,277 +27,306 @@
 0, 225000, 230400, 0x76aebdae
 0, 234000, 230400, 0x81357545
 0, 243000, 230400, 0x38baeebd
-1, 252000, 4410, 0x261a09c0
+1, 252000, 4410, 0x109d04e0
 0, 252000, 230400, 0x1c5c44d4
-1, 261000, 4410, 0x68e9489e
+1, 261000, 4410, 0x224d244f
 0, 261000, 230400, 0x60e189cc
-1, 270000, 4410, 0xb830827a
+1, 270000, 4410, 0xbb72413d
 0, 270000, 230400, 0xb1f4381c
-1, 279000, 4410, 0xb053b70c
+1, 279000, 4410, 0xaa5f5b86
 0, 279000, 230400, 0xb5048fed
-1, 288000, 4410, 0xd8845d5d
+1, 288000, 4410, 0x94e7aea7
 0, 288000, 230400, 0xc947c30e
-1, 297000, 4410, 0xd741f940
+1, 297000, 4410, 0xad497ca0
 0, 297000, 230400, 0xe8e31c07
-1, 306000, 4410, 0x4860193c
+1, 306000, 4410, 0x1de10c9e
 0, 306000, 230400, 0x6d49dd02
-1, 315000, 4410, 0x2e70df5f
+1, 315000, 4410, 0x9f55efa8
 0, 315000, 230400, 0x293e15d3
-1, 324000, 4410, 0x4b3e0e54
+1, 324000, 4410, 0x220a072a
 0, 324000, 230400, 0x354d792e
-1, 333000, 4410, 0x4afbf661
+1, 333000, 4410, 0xa7dafb29
 0, 333000, 230400, 0x35468780
-1, 342000, 4410, 0x485c3903
+1, 342000, 4410, 0xd5e29c7a
 0, 342000, 230400, 0x365d3991
-1, 351000, 4410, 0xc0a1a00c
+1, 351000, 4410, 0xb8465006
 0, 351000, 230400, 0xc9debef2
-1, 360000, 4410, 0x0ce2d38e
+1, 360000, 4410, 0x518669c7
 0, 360000, 230400, 0x4c4634c2
-1, 369000, 4410, 0x5b52dfa3
+1, 369000, 4410, 0xb5b5efca
 0, 369000, 230400, 0x347c2dca
-1, 378000, 4410, 0x0d6c02ba
+1, 378000, 4410, 0x8600015d
 0, 378000, 230400, 0x1efa0aaa
-1, 387000, 4410, 0x55f31fe1
+1, 387000, 4410, 0xe2f68fe9
 0, 387000, 230400, 0xa79a0b5a
-1, 396000, 4410, 0x7350b1b2
+1, 396000, 4410, 0x8d3458d9
 0, 396000, 230400, 0xfdb2dcdb
-1, 405000, 4410, 0x2b918eea
+1, 405000, 4410, 0xf1ff4775
 0, 405000, 230400, 0x42dbea33
-1, 414000, 4410, 0x6df6cf92
+1, 414000, 4410, 0x830f67c9
 0, 414000, 230400, 0x2a207e43
-1, 423000, 4410, 0x2ddd1782
+1, 423000, 4410, 0x110e0bc1
 0, 423000, 230400, 0x86573783
-1, 432000, 4410, 0x12265e8e
+1, 432000, 4410, 0x71682f47
 0, 432000, 230400, 0xc3968473
-1, 441000, 4410, 0x00c62139
+1, 441000, 4410, 0x38119095
 0, 441000, 230400, 0x8f62a7b4
-1, 450000, 4410, 0xf2579b6c
+1, 450000, 4410, 0xd2494db6
 0, 450000, 230400, 0x5a2e3073
-1, 459000, 4410, 0x3bc24a12
+1, 459000, 4410, 0x8b552509
 0, 459000, 230400, 0xd24f5e2c
-1, 468000, 4410, 0x0ce25212
+1, 468000, 4410, 0x71e52909
 0, 468000, 230400, 0x1df3c67d
-1, 477000, 4410, 0xad70de9a
+1, 477000, 4410, 0x9f0a6f4d
 0, 477000, 230400, 0xe4fd884d
-1, 486000, 4410, 0x232705e4
+1, 486000, 4410, 0x901302f2
 0, 486000, 230400, 0x9a228555
-1, 495000, 4410, 0x5ceba444
+1, 495000, 4410, 0x855d5222
 0, 495000, 230400, 0x9eba8ed5
-1, 504000, 4410, 0x17a3660b
+1, 504000, 4410, 0x324bb2fe
 0, 504000, 230400, 0x3d808a3d
-1, 513000, 4410, 0x291bb07e
+1, 513000, 4410, 0xe85f583f
 0, 513000, 230400, 0xf57e866d
-1, 522000, 4410, 0xc13ccf88
+1, 522000, 4410, 0x2cbc67c4
 0, 522000, 230400, 0x85f594f5
-1, 531000, 4410, 0xfb0cd542
+1, 531000, 4410, 0xc82e6aa1
 0, 531000, 230400, 0xb09f99dd
-1, 540000, 4410, 0xb6438478
+1, 540000, 4410, 0xb9fc423c
 0, 540000, 230400, 0x2b368475
-1, 549000, 4410, 0x263e9df2
+1, 549000, 4410, 0x6b9b4ef9
 0, 549000, 230400, 0xa2417afd
-1, 558000, 4410, 0x81621e20
+1, 558000, 4410, 0x39290f10
 0, 558000, 230400, 0x590b709d
-1, 567000, 4410, 0xe9a51d77
+1, 567000, 4410, 0xad718eb4
 0, 567000, 230400, 0x5d617705
-1, 576000, 4410, 0x69a3c758
+1, 576000, 4410, 0x82f463ac
 0, 576000, 230400, 0xabf981ad
-1, 585000, 4410, 0x725af958
+1, 585000, 4410, 0xfac87cac
 0, 585000, 230400, 0x5a8590cd
-1, 594000, 4410, 0x09db995d
+1, 594000, 4410, 0x9e8bcca7
 0, 594000, 230400, 0x1bff853d
-1, 603000, 4410, 0x42963941
+1, 603000, 4410, 0x52f79c99
 0, 603000, 230400, 0x71d08055
-1, 612000, 4410, 0x33a29bc4
+1, 612000, 4410, 0xf2d14de2
 0, 612000, 230400, 0x2ebd817d
-1, 621000, 4410, 0x02ee2bd1
+1, 621000, 4410, 0x367f95e1
 0, 621000, 230400, 0x6e838255
-1, 630000, 4410, 0xda968535
+1, 630000, 4410, 0x8bfac293
 0, 630000, 230400, 0x043984cd
-1, 639000, 4410, 0x5414a080
+1, 639000, 4410, 0x01ea5040
 0, 639000, 230400, 0x7ff18495
-1, 648000, 4410, 0x021ac433
+1, 648000, 4410, 0x8ff5e212
 0, 648000, 230400, 0xa43b8385
-1, 657000, 4410, 0x50195048
+1, 657000, 4410, 0x93f32824
 0, 657000, 230400, 0x72b5825d
-1, 666000, 4410, 0xc40921c7
+1, 666000, 4410, 0x998f90dc
 0, 666000, 230400, 0x3a178085
-1, 675000, 4410, 0xdbb622e0
+1, 675000, 4410, 0x65231170
 0, 675000, 230400, 0x67748245
-1, 684000, 4410, 0xc8d07342
+1, 684000, 4410, 0xc79039a1
 0, 684000, 230400, 0xeddf81d5
-1, 693000, 4410, 0x6ed9b17a
+1, 693000, 4410, 0x0b0e58bd
 0, 693000, 230400, 0x8b088665
-1, 702000, 4410, 0x39ac6a03
+1, 702000, 4410, 0xc24ab4fa
 0, 702000, 230400, 0x6c408e15
-1, 711000, 4410, 0x119ed51c
+1, 711000, 4410, 0xd3796a8e
 0, 711000, 230400, 0x81f196dd
-1, 720000, 4410, 0xc9a20539
+1, 720000, 4410, 0xa37f8295
 0, 720000, 230400, 0xab9f953d
-1, 729000, 4410, 0x6db5fdbd
+1, 729000, 4410, 0xb760fed7
 0, 729000, 230400, 0xa5f69795
-1, 738000, 4410, 0x64c6b468
+1, 738000, 4410, 0x05495a34
 0, 738000, 230400, 0xa772950d
-1, 747000, 4410, 0x1286686e
+1, 747000, 4410, 0x6f203437
 0, 747000, 230400, 0x6a5596d5
-1, 756000, 4410, 0x76632813
+1, 756000, 4410, 0x71299402
 0, 756000, 230400, 0x1355958d
-1, 765000, 4410, 0x9923669b
+1, 765000, 4410, 0x72e7b346
 0, 765000, 230400, 0x4134981d
-1, 774000, 4410, 0x1cf31b5c
+1, 774000, 4410, 0x879b0dae
 0, 774000, 230400, 0x8b929515
-1, 783000, 4410, 0xa9f14389
+1, 783000, 4410, 0x041aa1bd
 0, 783000, 230400, 0x482f95c5
-1, 792000, 4410, 0x9438c5cc
+1, 792000, 4410, 0x18a962e6
 0, 792000, 230400, 0x7a9795d5
-1, 801000, 4410, 0x48dd0a72
+1, 801000, 4410, 0x21d20539
 0, 801000, 230400, 0x21c29abd
-1, 810000, 4410, 0xb0fe24dd
+1, 810000, 4410, 0x8f449267
 0, 810000, 230400, 0x9ae6a475
-1, 819000, 4410, 0xdb9d03ac
+1, 819000, 4410, 0xecdc01d6
 0, 819000, 230400, 0x3734aee5
-1, 828000, 4410, 0x487d7ac3
+1, 828000, 4410, 0x458abd5a
 0, 828000, 230400, 0xa0a1b365
-1, 837000, 4410, 0x2b61d4d5
+1, 837000, 4410, 0xa070ea63
 0, 837000, 230400, 0x2dcab1c5
-1, 846000, 4410, 0xab934d9c
+1, 846000, 4410, 0xc25b26ce
 0, 846000, 230400, 0x9c8b6c44
-1, 855000, 4410, 0xd2ee6f94
+1, 855000, 4410, 0x4d9237ca
 0, 855000, 230400, 0x5da75feb
-1, 864000, 4410, 0x012c3002
+1, 864000, 4410, 0x748e1801
 0, 864000, 230400, 0x4d02f8e3
-1, 873000, 4410, 0xfccbd3cc
+1, 873000, 4410, 0xc96b69e6
 0, 873000, 230400, 0x66824f3a
-1, 882000, 4410, 0xe53230d8
+1, 882000, 4410, 0x6663186c
 0, 882000, 230400, 0x0c9257e2
-1, 891000, 4410, 0x2f6a6102
+1, 891000, 4410, 0x7f6d3081
 0, 891000, 230400, 0xb2927092
-1, 900000, 4410, 0x77bb876a
+1, 900000, 4410, 0x1a0343b5
 0, 900000, 230400, 0xb5dc6e9a
-1, 909000, 4410, 0xbcb76718
+1, 909000, 4410, 0xc48e338c
 0, 909000, 230400, 0x6e567bc6
-1, 918000, 4410, 0x51c00790
+1, 918000, 4410, 0x26fc03c8
 0, 918000, 230400, 0xbf9e0f7a
-1, 927000, 4410, 0x51b8fc5a
+1, 927000, 4410, 0x69be7e2d
 0, 927000, 230400, 0xb16f684a
-1, 936000, 4410, 0x20fe9b42
+1, 936000, 4410, 0x69a74da1
 0, 936000, 230400, 0xf9e55e81
-1, 945000, 4410, 0x363c5566
+1, 945000, 4410, 0x85bd2ab3
 0, 945000, 230400, 0xd8d0bcba
-1, 954000, 4410, 0x3424a84c
+1, 954000, 4410, 0xeff05426
 0, 954000, 230400, 0x44720ac0
-1, 963000, 4410, 0x7c3053c0
+1, 963000, 4410, 0x292829e0
 0, 963000, 230400, 0x7d4c2058
-1, 972000, 4410, 0x368f2f30
+1, 972000, 4410, 0x8f741798
 0, 972000, 230400, 0xb0973eb9
-1, 981000, 4410, 0x0f1e6fd2
+1, 981000, 4410, 0x6b9337e9
 0, 981000, 230400, 0x405a13ce
-1, 990000, 4410, 0x3a1fe07e
+1, 990000, 4410, 0xe4e1703f
 0, 990000, 230400, 0x6422f00a
-1, 999000, 4410, 0x74afd86a
+1, 999000, 4410, 0x043d6c35
 0, 999000, 230400, 0x924b6c1e
-1, 1008000, 4410, 0xfdf911dd
+1, 1008000, 4410, 0x3a8988e7
 0, 1008000, 230400, 0xcf7809c0
-1, 1017000, 4410, 0x1206a561
+1, 1017000, 4410, 0x1fa7d2a9
 0, 1017000, 230400, 0x883a3863
-1, 1026000, 4410, 0x5f0f33d5
+1, 1026000, 4410, 0xe28799e3
 0, 1026000, 230400, 0x6adc9e03
-1, 1035000, 4410, 0xca3d88e0
+1, 1035000, 4410, 0xc2df4470
 0, 1035000, 230400, 0x4f5ab7a8
-1, 1044000, 4410, 0xdf8f19ea
+1, 1044000, 4410, 0x694d0cf5
 0, 1044000, 230400, 0xdc0aab94
-1, 1053000, 4410, 0xe3275b9e
-1, 1062000, 4410, 0xee1945c5
-1, 1071000, 4410, 0x0afbd006
-1, 1080000, 4410, 0x90ff8f14
-1, 1089000, 4410, 0xfc0c887a
-1, 1098000, 4410, 0xae9bc232
-1, 1107000, 4410, 0x5f688eb8
-1, 1116000, 4410, 0x9a307469
-1, 1125000, 4410, 0x27f1e324
-1, 1134000, 4410, 0x0c0d4ca2
-1, 1143000, 4410, 0xd7e8ce74
-1, 1152000, 4410, 0x16a4bfd6
-1, 1161000, 4410, 0xbfb02f6d
-1, 1170000, 4410, 0xf4b81a79
-1, 1179000, 4410, 0x05d97288
-1, 1188000, 4410, 0x3a7db4be
-1, 1197000, 4410, 0xc6bea83e
-1, 1206000, 4410, 0x436f62ed
-1, 1215000, 4410, 0x6fabea0c
-1, 1224000, 4410, 0x954878aa
-1, 1233000, 4410, 0x4d10f579
-1, 1242000, 4410, 0xac65932a
-1, 1251000, 4410, 0x6889f957
-1, 1260000, 4410, 0x65cf5830
-1, 1269000, 4410, 0x87a7af71
-1, 1278000, 4410, 0x82378c13
-1, 1287000, 4410, 0x88ab6bd5
-1, 1296000, 4410, 0xf90a3342
-1, 1305000, 4410, 0xd790a1bc
-1, 1314000, 4410, 0x89919d7c
-1, 1323000, 4410, 0x7ffb22bf
-1, 1332000, 4410, 0xfefbcce3
-1, 1341000, 4410, 0x07714e80
-1, 1350000, 4410, 0x73078f53
-1, 1359000, 4410, 0x35c23078
-1, 1368000, 4410, 0x452538bb
-1, 1377000, 4410, 0x61493f33
-1, 1386000, 4410, 0x2137c390
-1, 1395000, 4410, 0x78c9393f
-1, 1404000, 4410, 0x7aeaf8e1
-1, 1413000, 4410, 0x4bb8da1c
-1, 1422000, 4410, 0x5995dfc2
-1, 1431000, 4410, 0xccce8872
-1, 1440000, 4410, 0xca2753a4
-1, 1449000, 4410, 0x4296ff6d
-1, 1458000, 4410, 0xe582d191
-1, 1467000, 4410, 0xc40268da
-1, 1476000, 4410, 0xda1d475e
-1, 1485000, 4410, 0x5e91e4e0
-1, 1494000, 4410, 0xfeb44475
-1, 1503000, 4410, 0x17ff8e38
-1, 1512000, 4410, 0x3bd58bcf
-1, 1521000, 4410, 0x9476e23c
-1, 1530000, 4410, 0x440651ab
-1, 1539000, 4410, 0xb08cdc74
-1, 1548000, 4410, 0x6fc3031f
-1, 1557000, 4410, 0x197ab39a
-1, 1566000, 4410, 0xf92f0e3d
-1, 1575000, 4410, 0xd5f6b678
-1, 1584000, 4410, 0x8af127a6
-1, 1593000, 4410, 0xe22f585e
-1, 1602000, 4410, 0x67515610
-1, 1611000, 4410, 0x21569d7a
-1, 1620000, 4410, 0x114597d8
-1, 1629000, 4410, 0xba213fb6
-1, 1638000, 4410, 0x1aca9fee
-1, 1647000, 4410, 0x48cdd264
-1, 1656000, 4410, 0x533619ec
-1, 1665000, 4410, 0x21466244
-1, 1674000, 4410, 0x26e00e88
-1, 1683000, 4410, 0x8e51d07c
-1, 1692000, 4410, 0xa6c4048a
-1, 1701000, 4410, 0x98ce10e4
-1, 1710000, 4410, 0x379bc8c2
-1, 1719000, 4410, 0x404b09c6
-1, 1728000, 4410, 0xfc89da8a
-1, 1737000, 4410, 0xbdbe6914
-1, 1746000, 4410, 0x2cb09f08
-1, 1755000, 4410, 0x835bf2d9
-1, 1764000, 4410, 0xa4611790
-1, 1773000, 4410, 0x67740896
-1, 1782000, 4410, 0x489f6bd0
-1, 1791000, 4410, 0x072bae9c
-1, 1800000, 4410, 0xadce5a89
-1, 1809000, 4410, 0x209f2c2c
-1, 1818000, 4410, 0xf5706665
-1, 1827000, 4410, 0x631841cb
-1, 1836000, 4410, 0xa1a2c65f
-1, 1845000, 4410, 0x8818b96b
-1, 1854000, 4410, 0x63158025
-1, 1863000, 4410, 0xf6ae79f5
-1, 1872000, 4410, 0xb3dcd214
-1, 1881000, 4410, 0x7a745449
-1, 1890000, 4410, 0x5d2b15f4
-1, 1899000, 4410, 0x48764b7c
-1, 1908000, 4410, 0x1294e119
+1, 1053000, 4410, 0x5aac2dcf
+1, 1062000, 4410, 0x259fa2db
+1, 1071000, 4410, 0xd16d6803
+1, 1080000, 4410, 0xa4b3478a
+1, 1089000, 4410, 0xdbe0443d
+1, 1098000, 4410, 0x26c16119
+1, 1107000, 4410, 0x0c06475c
+1, 1116000, 4410, 0x6ffaba2d
+1, 1125000, 4410, 0x5b287192
+1, 1134000, 4410, 0xf2cf2651
+1, 1143000, 4410, 0x3857673a
+1, 1152000, 4410, 0x5b555feb
+1, 1161000, 4410, 0x93f997af
+1, 1170000, 4410, 0xb3ba8d35
+1, 1179000, 4410, 0x66433944
+1, 1188000, 4410, 0xf0005a5f
+1, 1197000, 4410, 0xb948541f
+1, 1206000, 4410, 0xc8f1b16f
+1, 1215000, 4410, 0x7d4b7506
+1, 1224000, 4410, 0xac723c55
+1, 1233000, 4410, 0x2926fab5
+1, 1242000, 4410, 0x31684995
+1, 1251000, 4410, 0x35ebfca4
+1, 1260000, 4410, 0x9cd42c18
+1, 1269000, 4410, 0xd7ecd7b1
+1, 1278000, 4410, 0x5e13c602
+1, 1287000, 4410, 0xe955b5e3
+1, 1296000, 4410, 0xefad19a1
+1, 1305000, 4410, 0x435950de
+1, 1314000, 4410, 0x9d624ebe
+1, 1323000, 4410, 0x774a9158
+1, 1332000, 4410, 0x8c41e66a
+1, 1341000, 4410, 0x70112740
+1, 1350000, 4410, 0x55abc7a2
+1, 1359000, 4410, 0x0ec3183c
+1, 1368000, 4410, 0x54609c56
+1, 1377000, 4410, 0x60d49f92
+1, 1386000, 4410, 0x5fb061c8
+1, 1395000, 4410, 0x6e119c98
+1, 1404000, 4410, 0x3f39fc69
+1, 1413000, 4410, 0xef466d0e
+1, 1422000, 4410, 0xf4cb6fe1
+1, 1431000, 4410, 0xc4434439
+1, 1440000, 4410, 0xd02329d2
+1, 1449000, 4410, 0x216cffaf
+1, 1458000, 4410, 0x7e59e8c1
+1, 1467000, 4410, 0xc7c3346d
+1, 1476000, 4410, 0x5b3723af
+1, 1485000, 4410, 0x76097270
+1, 1494000, 4410, 0xae39a233
+1, 1503000, 4410, 0x686a471c
+1, 1512000, 4410, 0x3af3c5e0
+1, 1521000, 4410, 0x11ac711e
+1, 1530000, 4410, 0xcd8da8ce
+1, 1539000, 4410, 0x21296e3a
+1, 1548000, 4410, 0x77168188
+1, 1557000, 4410, 0x5fcf59cd
+1, 1566000, 4410, 0x390c8717
+1, 1575000, 4410, 0x3d5d5b3c
+1, 1584000, 4410, 0x3b8f13d3
+1, 1593000, 4410, 0x5b002c2f
+1, 1602000, 4410, 0x9e1d2b08
+1, 1611000, 4410, 0x69454ebd
+1, 1620000, 4410, 0x62a54bec
+1, 1629000, 4410, 0x4d231fdb
+1, 1638000, 4410, 0x65624ff7
+1, 1647000, 4410, 0x6fc66932
+1, 1656000, 4410, 0x23200cf6
+1, 1665000, 4410, 0xf8033122
+1, 1674000, 4410, 0x0fce0744
+1, 1683000, 4410, 0x9302683e
+1, 1692000, 4410, 0xd2380245
+1, 1701000, 4410, 0x482e0872
+1, 1710000, 4410, 0xe98e6461
+1, 1719000, 4410, 0x1db404e3
+1, 1728000, 4410, 0x47a26d45
+1, 1737000, 4410, 0x449a348a
+1, 1746000, 4410, 0xee874f84
+1, 1755000, 4410, 0xc4ecf965
+1, 1764000, 4410, 0xcc450bc8
+1, 1773000, 4410, 0xb18d044b
+1, 1782000, 4410, 0x895435e8
+1, 1791000, 4410, 0x57e7574e
+1, 1800000, 4410, 0x8041ad3d
+1, 1809000, 4410, 0x853d1616
+1, 1818000, 4410, 0xa11bb32b
+1, 1827000, 4410, 0xe10ea0de
+1, 1836000, 4410, 0xdf2ee328
+1, 1845000, 4410, 0xd5a6dcae
+1, 1854000, 4410, 0xd176c00b
+1, 1863000, 4410, 0x9cd6bcf3
+1, 1872000, 4410, 0x2569690a
+1, 1881000, 4410, 0x6824aa1d
+1, 1890000, 4410, 0xa9110afa
+1, 1899000, 4410, 0x115c25be
+1, 1908000, 4410, 0x1100f085
+1, 1917000, 4410, 0x00000000
+1, 1926000, 4410, 0x00000000
+1, 1935000, 4410, 0x00000000
+1, 1944000, 4410, 0x00000000
+1, 1953000, 4410, 0x00000000
+1, 1962000, 4410, 0x00000000
+1, 1971000, 4410, 0x00000000
+1, 1980000, 4410, 0x00000000
+1, 1989000, 4410, 0x00000000
+1, 1998000, 4410, 0x00000000
+1, 2007000, 4410, 0x00000000
+1, 2016000, 4410, 0x00000000
+1, 2025000, 4410, 0x00000000
+1, 2034000, 4410, 0x00000000
+1, 2043000, 4410, 0x00000000
+1, 2052000, 4410, 0x00000000
+1, 2061000, 4410, 0x00000000
+1, 2070000, 4410, 0x00000000
+1, 2079000, 4410, 0x00000000
+1, 2088000, 4410, 0x00000000
+1, 2097000, 4410, 0x00000000
+1, 2106000, 4410, 0x00000000
+1, 2115000, 4410, 0x00000000
+1, 2124000, 4410, 0x00000000
+1, 2133000, 4410, 0x00000000
+1, 2142000, 4410, 0x00000000
+1, 2151000, 4410, 0x00000000
+1, 2160000, 4410, 0x00000000
+1, 2169000, 4410, 0x00000000
diff --git a/ffmpeg-mt/tests/ref/fate/vc1 b/ffmpeg-mt/tests/ref/fate/vc1
index 123237c..69e9b4a 100644
--- a/ffmpeg-mt/tests/ref/fate/vc1
+++ b/ffmpeg-mt/tests/ref/fate/vc1
@@ -2,14 +2,14 @@
 0, 3600, 38016, 0xf4715db5
 0, 7200, 38016, 0xf4715db5
 0, 10800, 38016, 0xf46af0e1
-0, 14400, 38016, 0x96992cf1
-0, 18000, 38016, 0xbaadd874
-0, 21600, 38016, 0x751f4328
-0, 25200, 38016, 0x751f4328
-0, 28800, 38016, 0xf7294772
-0, 32400, 38016, 0xf7294772
-0, 36000, 38016, 0xf1d12133
-0, 39600, 38016, 0xf1d12133
-0, 43200, 38016, 0xf1d12133
-0, 46800, 38016, 0xf1d12133
-0, 50400, 38016, 0xf1d12133
+0, 14400, 38016, 0x9c1c2cf1
+0, 18000, 38016, 0xff12d87f
+0, 21600, 38016, 0x7408432b
+0, 25200, 38016, 0x7408432b
+0, 28800, 38016, 0x8d11479a
+0, 32400, 38016, 0x8d11479a
+0, 36000, 38016, 0xc4a121ab
+0, 39600, 38016, 0xc4a121ab
+0, 43200, 38016, 0xc4a121ab
+0, 46800, 38016, 0xc4a121ab
+0, 50400, 38016, 0xc4a121ab
diff --git a/ffmpeg-mt/tests/ref/fate/wmv8-drm b/ffmpeg-mt/tests/ref/fate/wmv8-drm
index 4dc0f0e..0150535 100644
--- a/ffmpeg-mt/tests/ref/fate/wmv8-drm
+++ b/ffmpeg-mt/tests/ref/fate/wmv8-drm
@@ -34,129 +34,129 @@
 0, 123750, 84480, 0xabf7c25d
 0, 127500, 84480, 0x912600ee
 0, 131250, 84480, 0x7ee7c70b
-0, 135000, 84480, 0xe212b0d1
-0, 138750, 84480, 0xd4fa6c16
-0, 142500, 84480, 0xd10fa126
-0, 146250, 84480, 0xda91d3aa
-0, 150000, 84480, 0xd90be940
-0, 153750, 84480, 0x908a009b
-0, 157500, 84480, 0xdd26d6e9
-0, 161250, 84480, 0xfeda8de9
-0, 165000, 84480, 0x96d66505
-0, 168750, 84480, 0xf43b4b1b
-0, 172500, 84480, 0xd44122c2
-0, 176250, 84480, 0xc65da7a9
-0, 180000, 84480, 0xbf4178f2
-0, 183750, 84480, 0x96be846a
-0, 187500, 84480, 0x73e6459e
-0, 191250, 84480, 0x70086917
-0, 195000, 84480, 0x9b12571d
-0, 198750, 84480, 0xe4ce7bce
-0, 202500, 84480, 0x845672e5
-0, 206250, 84480, 0x1c17e189
-0, 210000, 84480, 0x12a877d0
-0, 213750, 84480, 0xca62e8ed
-0, 217500, 84480, 0x87beb28f
-0, 221250, 84480, 0x1ba915a4
-0, 225000, 84480, 0x159fc9c4
-0, 228750, 84480, 0xcec3e3ef
-0, 232500, 84480, 0x96a42f48
-0, 236250, 84480, 0xcd17decf
-0, 240000, 84480, 0x4cf95d6c
-0, 243750, 84480, 0xa258400e
-0, 247500, 84480, 0xb9c566d8
-0, 251250, 84480, 0xc39f6dab
-0, 255000, 84480, 0xd08a0880
-0, 258750, 84480, 0x41e3a70f
-0, 262500, 84480, 0x0ded83d9
-0, 266250, 84480, 0x74a915ea
-0, 270000, 84480, 0x00c2c849
-0, 273750, 84480, 0x709a9b07
-0, 277500, 84480, 0xfb276daa
-0, 281250, 84480, 0x89ca744b
-0, 285000, 84480, 0x457ba569
-0, 288750, 84480, 0xc37c8d57
-0, 292500, 84480, 0x1890a97e
-0, 296250, 84480, 0xe455b8d0
-0, 300000, 84480, 0x1f6bdbce
-0, 303750, 84480, 0x9df90ed1
-0, 307500, 84480, 0xff80328c
-0, 311250, 84480, 0x0e115940
-0, 315000, 84480, 0x09ddc11d
-0, 318750, 84480, 0xeef241e9
-0, 322500, 84480, 0xbe3578b4
-0, 326250, 84480, 0x2a83f0f3
-0, 330000, 84480, 0xb41d01c2
-0, 333750, 84480, 0x630efd97
-0, 337500, 84480, 0xd592140d
-0, 341250, 84480, 0x7110f627
-0, 345000, 84480, 0x2dbaa590
-0, 348750, 84480, 0x13d80be5
-0, 352500, 84480, 0xb8f3740d
-0, 356250, 84480, 0xd9a6fcef
-0, 360000, 84480, 0x56bfa4e3
-0, 363750, 84480, 0x49364550
-0, 367500, 84480, 0x0a2f1690
-0, 371250, 84480, 0xb87fccbf
-0, 375000, 84480, 0xb2aa69f7
-0, 378750, 84480, 0x176bf378
-0, 382500, 84480, 0xe7a6de45
-0, 386250, 84480, 0x8e3900a6
-0, 390000, 84480, 0x24a72099
-0, 393750, 84480, 0x5394df95
-0, 397500, 84480, 0xd648c92e
-0, 401250, 84480, 0xab95fb62
-0, 405000, 84480, 0xe3239cb0
-0, 408750, 84480, 0xb4f93467
-0, 412500, 84480, 0x94d0d01d
-0, 416250, 84480, 0x6316a25e
-0, 420000, 84480, 0x6316a25e
-0, 423750, 84480, 0x6316a25e
-0, 427500, 84480, 0x6316a25e
-0, 431250, 84480, 0x6316a25e
-0, 435000, 84480, 0x6316a25e
-0, 438750, 84480, 0x6316a25e
+0, 135000, 84480, 0x09c5b0d1
+0, 138750, 84480, 0x6dbe6c0c
+0, 142500, 84480, 0x0fe0a120
+0, 146250, 84480, 0x2352d3a2
+0, 150000, 84480, 0xb22ce92e
+0, 153750, 84480, 0x31db0099
+0, 157500, 84480, 0xad2dd73a
+0, 161250, 84480, 0xb9af8e20
+0, 165000, 84480, 0x7b956549
+0, 168750, 84480, 0x3f774b87
+0, 172500, 84480, 0x824a23a3
+0, 176250, 84480, 0x4469a8d8
+0, 180000, 84480, 0xc80c7a0a
+0, 183750, 84480, 0xcf958549
+0, 187500, 84480, 0x449746e3
+0, 191250, 84480, 0xbac66a82
+0, 195000, 84480, 0x99e85855
+0, 198750, 84480, 0xa4a17d17
+0, 202500, 84480, 0xe29c7587
+0, 206250, 84480, 0x551de592
+0, 210000, 84480, 0xe0877bce
+0, 213750, 84480, 0x9660eb35
+0, 217500, 84480, 0x0a34b644
+0, 221250, 84480, 0x352919f0
+0, 225000, 84480, 0xef56ce27
+0, 228750, 84480, 0x030fe862
+0, 232500, 84480, 0x2eba33e2
+0, 236250, 84480, 0x242de401
+0, 240000, 84480, 0xbadd61ca
+0, 243750, 84480, 0x2060465b
+0, 247500, 84480, 0x256e6965
+0, 251250, 84480, 0x243b7084
+0, 255000, 84480, 0x8b3c0b47
+0, 258750, 84480, 0xc174a9af
+0, 262500, 84480, 0xb6d48686
+0, 266250, 84480, 0xa3dd1871
+0, 270000, 84480, 0x04cdcaf7
+0, 273750, 84480, 0x55f89c94
+0, 277500, 84480, 0xda657032
+0, 281250, 84480, 0x38ba7698
+0, 285000, 84480, 0x4d03a7f2
+0, 288750, 84480, 0x115d9035
+0, 292500, 84480, 0x24c6acc6
+0, 296250, 84480, 0xdd2bbcae
+0, 300000, 84480, 0xb4fee0b9
+0, 303750, 84480, 0xc51c14e0
+0, 307500, 84480, 0xfb7737de
+0, 311250, 84480, 0x38675fb0
+0, 315000, 84480, 0x4752c710
+0, 318750, 84480, 0xfeb7491b
+0, 322500, 84480, 0xaa248122
+0, 326250, 84480, 0x9a4af87c
+0, 330000, 84480, 0xedcf09df
+0, 333750, 84480, 0x563a05df
+0, 337500, 84480, 0x0dde1e03
+0, 341250, 84480, 0xd8f0ff65
+0, 345000, 84480, 0xbeb9ae1a
+0, 348750, 84480, 0x416d1468
+0, 352500, 84480, 0x66c87d4c
+0, 356250, 84480, 0xa67c0774
+0, 360000, 84480, 0xd8f8aec1
+0, 363750, 84480, 0xadfa502b
+0, 367500, 84480, 0x50bf20e4
+0, 371250, 84480, 0xbcb3d8cc
+0, 375000, 84480, 0xa54677d7
+0, 378750, 84480, 0x3566042d
+0, 382500, 84480, 0x4c9eed57
+0, 386250, 84480, 0xc3b90e58
+0, 390000, 84480, 0x3c042bfa
+0, 393750, 84480, 0x19f8e890
+0, 397500, 84480, 0xd3dacfb9
+0, 401250, 84480, 0x2365fc6f
+0, 405000, 84480, 0xa2c19d00
+0, 408750, 84480, 0xce94336f
+0, 412500, 84480, 0xfa9bcf14
+0, 416250, 84480, 0x24d6a243
+0, 420000, 84480, 0x24d6a243
+0, 423750, 84480, 0x24d6a243
+0, 427500, 84480, 0x24d6a243
+0, 431250, 84480, 0x24d6a243
+0, 435000, 84480, 0x24d6a243
+0, 438750, 84480, 0x24d6a243
 0, 442500, 84480, 0xae1c8854
-0, 446250, 84480, 0x30fe68bf
-0, 450000, 84480, 0xfd1435c8
-0, 453750, 84480, 0xddf57fab
-0, 457500, 84480, 0xc3553a51
-0, 461250, 84480, 0xd9ce7ae8
-0, 465000, 84480, 0x671765cb
-0, 468750, 84480, 0x78336eab
-0, 472500, 84480, 0xb66b659c
-0, 476250, 84480, 0x0e1f68bb
-0, 480000, 84480, 0x8f4669dc
-0, 483750, 84480, 0x60c47360
-0, 487500, 84480, 0x93037246
-0, 491250, 84480, 0xdebe620d
-0, 495000, 84480, 0x7555161e
-0, 498750, 84480, 0xcbaf4311
-0, 502500, 84480, 0x8e3783a0
-0, 506250, 84480, 0x3888008f
-0, 510000, 84480, 0x8a4fa114
-0, 513750, 84480, 0xac0bf10b
-0, 517500, 84480, 0xb485ff7f
-0, 521250, 84480, 0xeaec2133
-0, 525000, 84480, 0x105827cd
-0, 528750, 84480, 0x55ff4b2d
-0, 532500, 84480, 0x78c64a49
-0, 536250, 84480, 0x3897731d
-0, 540000, 84480, 0x9ca891aa
-0, 543750, 84480, 0x24a6ab0a
-0, 547500, 84480, 0x88fdc6fb
-0, 551250, 84480, 0x05afea61
-0, 555000, 84480, 0xe703e2cf
-0, 558750, 84480, 0x9eb0e64a
-0, 562500, 84480, 0x92a7f0ab
-0, 566250, 84480, 0xec2bfbfb
-0, 570000, 84480, 0x7db600ad
-0, 573750, 84480, 0x4abd6393
-0, 577500, 84480, 0x54ce06b5
-0, 581250, 84480, 0x7cb6f150
-0, 585000, 84480, 0x099d4aeb
-0, 588750, 84480, 0x0bcfdc31
-0, 592500, 84480, 0xe4e72d1f
-0, 596250, 84480, 0xbce22331
-0, 600000, 84480, 0x020545d7
-0, 603750, 84480, 0x71869e48
+0, 446250, 84480, 0xbb8968bf
+0, 450000, 84480, 0x6f923623
+0, 453750, 84480, 0x22e98029
+0, 457500, 84480, 0x8ac33af3
+0, 461250, 84480, 0x05947b6e
+0, 465000, 84480, 0xfc35661a
+0, 468750, 84480, 0x0e6b6e47
+0, 472500, 84480, 0x82c764bb
+0, 476250, 84480, 0x57a36833
+0, 480000, 84480, 0xc8dd690a
+0, 483750, 84480, 0x02c47232
+0, 487500, 84480, 0x6645715d
+0, 491250, 84480, 0xc64860f7
+0, 495000, 84480, 0x4f5614b3
+0, 498750, 84480, 0xa70842ca
+0, 502500, 84480, 0x379d8458
+0, 506250, 84480, 0xa14701cf
+0, 510000, 84480, 0xad1aa2b2
+0, 513750, 84480, 0xee28f320
+0, 517500, 84480, 0x505801e9
+0, 521250, 84480, 0x7947233b
+0, 525000, 84480, 0x3ce72a9d
+0, 528750, 84480, 0xa6834e64
+0, 532500, 84480, 0xfebf4d70
+0, 536250, 84480, 0x4a0775e2
+0, 540000, 84480, 0x9d7e945b
+0, 543750, 84480, 0xaa9eadd9
+0, 547500, 84480, 0xaa85c9b1
+0, 551250, 84480, 0xa005edaf
+0, 555000, 84480, 0x7fc4e5cc
+0, 558750, 84480, 0xb0f6e8d1
+0, 562500, 84480, 0x9ef9f330
+0, 566250, 84480, 0xbe14ff1f
+0, 570000, 84480, 0xd494048c
+0, 573750, 84480, 0x046166a7
+0, 577500, 84480, 0x052a09b2
+0, 581250, 84480, 0x71fff4ab
+0, 585000, 84480, 0xb9684e41
+0, 588750, 84480, 0x1ddce068
+0, 592500, 84480, 0xb9de300e
+0, 596250, 84480, 0x13962590
+0, 600000, 84480, 0xde79482f
+0, 603750, 84480, 0x7d1ca064
diff --git a/ffmpeg-mt/tests/ref/lavf/rm b/ffmpeg-mt/tests/ref/lavf/rm
index d9ec51e..a85c763 100644
--- a/ffmpeg-mt/tests/ref/lavf/rm
+++ b/ffmpeg-mt/tests/ref/lavf/rm
@@ -1,2 +1,2 @@
-e1990def7b195a568340f2c1a89d6587 *./tests/data/lavf/lavf.rm
+a1c71456f21d5459d2824d75bbdcc80c *./tests/data/lavf/lavf.rm
 346706 ./tests/data/lavf/lavf.rm
diff --git a/ffmpeg-mt/tests/ref/lavf/ts b/ffmpeg-mt/tests/ref/lavf/ts
index 5b046fb..e4bdb63 100644
--- a/ffmpeg-mt/tests/ref/lavf/ts
+++ b/ffmpeg-mt/tests/ref/lavf/ts
@@ -1,3 +1,3 @@
-e0c183639709d6e75bc553a3ed1333dd *./tests/data/lavf/lavf.ts
+e8d609b8a5b5854a4485718434b287f7 *./tests/data/lavf/lavf.ts
 406644 ./tests/data/lavf/lavf.ts
 ./tests/data/lavf/lavf.ts CRC=0x133216c1
diff --git a/ffmpeg-mt/tests/ref/lavf/voc_s16 b/ffmpeg-mt/tests/ref/lavf/voc_s16
new file mode 100644
index 0000000..425d965
--- /dev/null
+++ b/ffmpeg-mt/tests/ref/lavf/voc_s16
@@ -0,0 +1,3 @@
+b20728bf036d2e23508869acbad4e576 *./tests/data/lavf/lavf.s16.voc
+163840 ./tests/data/lavf/lavf.s16.voc
+./tests/data/lavf/lavf.s16.voc CRC=0xfa9b6c39
diff --git a/ffmpeg-mt/tests/ref/lavfi/crop b/ffmpeg-mt/tests/ref/lavfi/crop
index 75c39f7..32041c2 100644
--- a/ffmpeg-mt/tests/ref/lavfi/crop
+++ b/ffmpeg-mt/tests/ref/lavfi/crop
@@ -1,2 +1 @@
-3d163f156eaddf41d2be20736f973539 *./tests/data/lavfi/crop.nut
-3554654 ./tests/data/lavfi/crop.nut
+crop                3d163f156eaddf41d2be20736f973539
diff --git a/ffmpeg-mt/tests/ref/lavfi/crop_scale b/ffmpeg-mt/tests/ref/lavfi/crop_scale
index b7ad1a9..82e5394 100644
--- a/ffmpeg-mt/tests/ref/lavfi/crop_scale
+++ b/ffmpeg-mt/tests/ref/lavfi/crop_scale
@@ -1,2 +1 @@
-0a3d45d58b805b8c47416b9239535f94 *./tests/data/lavfi/crop_scale.nut
-8941454 ./tests/data/lavfi/crop_scale.nut
+crop_scale          0a3d45d58b805b8c47416b9239535f94
diff --git a/ffmpeg-mt/tests/ref/lavfi/crop_scale_vflip b/ffmpeg-mt/tests/ref/lavfi/crop_scale_vflip
index bd573a3..07c729a 100644
--- a/ffmpeg-mt/tests/ref/lavfi/crop_scale_vflip
+++ b/ffmpeg-mt/tests/ref/lavfi/crop_scale_vflip
@@ -1,2 +1 @@
-e88a4dfb960d0bb28ee875567bedde5d *./tests/data/lavfi/crop_scale_vflip.nut
-750727 ./tests/data/lavfi/crop_scale_vflip.nut
+crop_scale_vflip    e88a4dfb960d0bb28ee875567bedde5d
diff --git a/ffmpeg-mt/tests/ref/lavfi/crop_vflip b/ffmpeg-mt/tests/ref/lavfi/crop_vflip
index 96fc9bd..a3f8200 100644
--- a/ffmpeg-mt/tests/ref/lavfi/crop_vflip
+++ b/ffmpeg-mt/tests/ref/lavfi/crop_vflip
@@ -1,2 +1 @@
-628542e17b6900ee79b1429183ae01b0 *./tests/data/lavfi/crop_vflip.nut
-3554654 ./tests/data/lavfi/crop_vflip.nut
+crop_vflip          628542e17b6900ee79b1429183ae01b0
diff --git a/ffmpeg-mt/tests/ref/lavfi/null b/ffmpeg-mt/tests/ref/lavfi/null
index b4d006e..3c3b7b7 100644
--- a/ffmpeg-mt/tests/ref/lavfi/null
+++ b/ffmpeg-mt/tests/ref/lavfi/null
@@ -1,2 +1 @@
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/null.nut
-7604654 ./tests/data/lavfi/null.nut
+null                eba2f135a08829387e2f698ff72a2939
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixdesc_be b/ffmpeg-mt/tests/ref/lavfi/pixdesc_be
index df0981f..03abcd5 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixdesc_be
+++ b/ffmpeg-mt/tests/ref/lavfi/pixdesc_be
@@ -1,84 +1,42 @@
-037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/lavfi_pixdesc-abgr.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-abgr.nut
-c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/lavfi_pixdesc-argb.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-argb.nut
-0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/lavfi_pixdesc-bgr24.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-bgr24.nut
-50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut
-49f01b1f1f0c84fd9e776dd34cc3c280 *./tests/data/lavfi/lavfi_pixdesc-bgr555be.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr555be.nut
-257cf78afa35dc31e9696f139c916715 *./tests/data/lavfi/lavfi_pixdesc-bgr565be.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr565be.nut
-24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/lavfi_pixdesc-bgr8.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr8.nut
-76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/lavfi_pixdesc-bgra.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-bgra.nut
-db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/lavfi_pixdesc-gray.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-gray.nut
-7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/lavfi_pixdesc-gray16be.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16be.nut
-10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/lavfi_pixdesc-gray16le.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16le.nut
-668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/lavfi_pixdesc-monob.nut
-634329 ./tests/data/lavfi/lavfi_pixdesc-monob.nut
-9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/lavfi_pixdesc-monow.nut
-634329 ./tests/data/lavfi/lavfi_pixdesc-monow.nut
-e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/lavfi_pixdesc-nv12.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-nv12.nut
-9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/lavfi_pixdesc-nv21.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-nv21.nut
-b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/lavfi_pixdesc-rgb24.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-rgb24.nut
-460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut
-cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut
-c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut
-912a62c5e53bfcbac2a0340e10973cf2 *./tests/data/lavfi/lavfi_pixdesc-rgb555be.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb555be.nut
-9cadf742e05ddc23a3b5b270f89aad3c *./tests/data/lavfi/lavfi_pixdesc-rgb565be.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb565be.nut
-4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/lavfi_pixdesc-rgb8.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb8.nut
-93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/lavfi_pixdesc-rgba.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-rgba.nut
-adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut
-2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut
-5703854 ./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut
-8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut
-16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut
-2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut
-c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut
-5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut
-e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut
-5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut
-0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut
-ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut
-1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut
-a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut
-12673454 ./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut
-32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut
-0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut
-9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut
-ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut
-f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut
+abgr                037bf9df6a765520ad6d490066bf4b89
+argb                c442a8261c2265a07212ef0f72e35f5a
+bgr24               0d0cb38ab3fa0b2ec0865c14f78b217b
+bgr4_byte           50d23cc82d9dcef2fd12adb81fb9b806
+bgr555be            49f01b1f1f0c84fd9e776dd34cc3c280
+bgr565be            257cf78afa35dc31e9696f139c916715
+bgr8                24bd566170343d06fec6fccfff5abc54
+bgra                76a18a5151242fa137133f604cd624d2
+gray                db08f7f0751900347e6b8649e4164d21
+gray16be            7becf34ae825a3df3969bf4c6bfeb5e2
+gray16le            10bd87059b5c189f3caef2837f4f2b5c
+monob               668ebe8b8103b9046b251b2fa8a1d88f
+monow               9251497f3b0634f1165d12d5a289d943
+nv12                e0af357888584d36eec5aa0f673793ef
+nv21                9a3297f3b34baa038b1f37cb202b512f
+rgb24               b41eba9651e1b5fe386289b506188105
+rgb48be             460b6de89b156290a12d3941db8bd731
+rgb48le             cd93cb34d15996987367dabda3a10128
+rgb4_byte           c93ba89b74c504e7f5ae9d9ab1546c73
+rgb555be            912a62c5e53bfcbac2a0340e10973cf2
+rgb565be            9cadf742e05ddc23a3b5b270f89aad3c
+rgb8                4a9d8e4f2f154e83a7e1735be6300700
+rgba                93a5b3712e6eb8c5b9a09ffc7b9fbc12
+uyvy422             adcf64516a19fce44df77082bdb16291
+yuv410p             2d9225153c83ee1132397d619d94d1b3
+yuv411p             8b298af3e43348ca1b11eb8a3252ac6c
+yuv420p             eba2f135a08829387e2f698ff72a2939
+yuv420p16be         16c009a235cd52b74791a895423152a3
+yuv420p16le         2d59c4f1d0314a5a957a7cfc4b6fabcc
+yuv422p             c9bba4529821d796a6ab09f6a5fd355a
+yuv422p16be         5499502e1c29534a158a1fe60e889f60
+yuv422p16le         e3d61fde6978591596bc36b914386623
+yuv440p             5a064afe2b453bb52cdb3f176b1aa1cf
+yuv444p             0a98447b78fd476aa39686da6a74fa2e
+yuv444p16be         ea602a24b8e6969679265078bd8607b6
+yuv444p16le         1262a0dc57ee147967fc896d04206313
+yuva420p            a29884f3f3dfe1e00b961bc17bef3d47
+yuvj420p            32eec78ba51857b16ce9b813a49b7189
+yuvj422p            0dfa0ed434f73be51428758c69e082cb
+yuvj440p            9c3a093ff64a83ac4cf0b1e65390e236
+yuvj444p            ede1e5882d5c5bba48ea33cf1209d231
+yuyv422             f2569f2b5069a0ee0cecae33de0455e3
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixdesc_le b/ffmpeg-mt/tests/ref/lavfi/pixdesc_le
index 3182fa9..5832f89 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixdesc_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixdesc_le
@@ -1,84 +1,42 @@
-037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/lavfi_pixdesc-abgr.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-abgr.nut
-c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/lavfi_pixdesc-argb.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-argb.nut
-0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/lavfi_pixdesc-bgr24.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-bgr24.nut
-50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut
-378d6ac4223651a1adcbf94a3d0d807b *./tests/data/lavfi/lavfi_pixdesc-bgr555le.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr555le.nut
-1dfdd03995c287e3c754b164bf26a355 *./tests/data/lavfi/lavfi_pixdesc-bgr565le.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr565le.nut
-24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/lavfi_pixdesc-bgr8.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr8.nut
-76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/lavfi_pixdesc-bgra.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-bgra.nut
-db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/lavfi_pixdesc-gray.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-gray.nut
-7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/lavfi_pixdesc-gray16be.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16be.nut
-10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/lavfi_pixdesc-gray16le.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16le.nut
-668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/lavfi_pixdesc-monob.nut
-634329 ./tests/data/lavfi/lavfi_pixdesc-monob.nut
-9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/lavfi_pixdesc-monow.nut
-634329 ./tests/data/lavfi/lavfi_pixdesc-monow.nut
-e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/lavfi_pixdesc-nv12.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-nv12.nut
-9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/lavfi_pixdesc-nv21.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-nv21.nut
-b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/lavfi_pixdesc-rgb24.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-rgb24.nut
-460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut
-cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut
-c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut
-a937a0fc764fb57dc1b3af87cba0273c *./tests/data/lavfi/lavfi_pixdesc-rgb555le.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb555le.nut
-d39aa298bb525e9be8860351c6f62dab *./tests/data/lavfi/lavfi_pixdesc-rgb565le.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb565le.nut
-4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/lavfi_pixdesc-rgb8.nut
-5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb8.nut
-93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/lavfi_pixdesc-rgba.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-rgba.nut
-adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut
-2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut
-5703854 ./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut
-8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut
-16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut
-2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut
-c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut
-5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut
-e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut
-20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut
-5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut
-0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut
-ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut
-1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut
-30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut
-a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut
-12673454 ./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut
-32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut
-7604654 ./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut
-0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut
-9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut
-ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut
-15207903 ./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut
-f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut
-10139054 ./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut
+abgr                037bf9df6a765520ad6d490066bf4b89
+argb                c442a8261c2265a07212ef0f72e35f5a
+bgr24               0d0cb38ab3fa0b2ec0865c14f78b217b
+bgr4_byte           50d23cc82d9dcef2fd12adb81fb9b806
+bgr555le            378d6ac4223651a1adcbf94a3d0d807b
+bgr565le            1dfdd03995c287e3c754b164bf26a355
+bgr8                24bd566170343d06fec6fccfff5abc54
+bgra                76a18a5151242fa137133f604cd624d2
+gray                db08f7f0751900347e6b8649e4164d21
+gray16be            7becf34ae825a3df3969bf4c6bfeb5e2
+gray16le            10bd87059b5c189f3caef2837f4f2b5c
+monob               668ebe8b8103b9046b251b2fa8a1d88f
+monow               9251497f3b0634f1165d12d5a289d943
+nv12                e0af357888584d36eec5aa0f673793ef
+nv21                9a3297f3b34baa038b1f37cb202b512f
+rgb24               b41eba9651e1b5fe386289b506188105
+rgb48be             460b6de89b156290a12d3941db8bd731
+rgb48le             cd93cb34d15996987367dabda3a10128
+rgb4_byte           c93ba89b74c504e7f5ae9d9ab1546c73
+rgb555le            a937a0fc764fb57dc1b3af87cba0273c
+rgb565le            d39aa298bb525e9be8860351c6f62dab
+rgb8                4a9d8e4f2f154e83a7e1735be6300700
+rgba                93a5b3712e6eb8c5b9a09ffc7b9fbc12
+uyvy422             adcf64516a19fce44df77082bdb16291
+yuv410p             2d9225153c83ee1132397d619d94d1b3
+yuv411p             8b298af3e43348ca1b11eb8a3252ac6c
+yuv420p             eba2f135a08829387e2f698ff72a2939
+yuv420p16be         16c009a235cd52b74791a895423152a3
+yuv420p16le         2d59c4f1d0314a5a957a7cfc4b6fabcc
+yuv422p             c9bba4529821d796a6ab09f6a5fd355a
+yuv422p16be         5499502e1c29534a158a1fe60e889f60
+yuv422p16le         e3d61fde6978591596bc36b914386623
+yuv440p             5a064afe2b453bb52cdb3f176b1aa1cf
+yuv444p             0a98447b78fd476aa39686da6a74fa2e
+yuv444p16be         ea602a24b8e6969679265078bd8607b6
+yuv444p16le         1262a0dc57ee147967fc896d04206313
+yuva420p            a29884f3f3dfe1e00b961bc17bef3d47
+yuvj420p            32eec78ba51857b16ce9b813a49b7189
+yuvj422p            0dfa0ed434f73be51428758c69e082cb
+yuvj440p            9c3a093ff64a83ac4cf0b1e65390e236
+yuvj444p            ede1e5882d5c5bba48ea33cf1209d231
+yuyv422             f2569f2b5069a0ee0cecae33de0455e3
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixfmts_copy_le b/ffmpeg-mt/tests/ref/lavfi/pixfmts_copy_le
index 4a3a738..5832f89 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixfmts_copy_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixfmts_copy_le
@@ -1,84 +1,42 @@
-037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/pixfmts_copy_le-abgr.nut
-20276703 ./tests/data/lavfi/pixfmts_copy_le-abgr.nut
-c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/pixfmts_copy_le-argb.nut
-20276703 ./tests/data/lavfi/pixfmts_copy_le-argb.nut
-0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/pixfmts_copy_le-bgr24.nut
-15207903 ./tests/data/lavfi/pixfmts_copy_le-bgr24.nut
-50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/pixfmts_copy_le-bgr4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_copy_le-bgr4_byte.nut
-378d6ac4223651a1adcbf94a3d0d807b *./tests/data/lavfi/pixfmts_copy_le-bgr555le.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-bgr555le.nut
-1dfdd03995c287e3c754b164bf26a355 *./tests/data/lavfi/pixfmts_copy_le-bgr565le.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-bgr565le.nut
-24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/pixfmts_copy_le-bgr8.nut
-5070254 ./tests/data/lavfi/pixfmts_copy_le-bgr8.nut
-76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/pixfmts_copy_le-bgra.nut
-20276703 ./tests/data/lavfi/pixfmts_copy_le-bgra.nut
-db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/pixfmts_copy_le-gray.nut
-5070254 ./tests/data/lavfi/pixfmts_copy_le-gray.nut
-7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/pixfmts_copy_le-gray16be.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-gray16be.nut
-10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/pixfmts_copy_le-gray16le.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-gray16le.nut
-668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/pixfmts_copy_le-monob.nut
-634329 ./tests/data/lavfi/pixfmts_copy_le-monob.nut
-9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/pixfmts_copy_le-monow.nut
-634329 ./tests/data/lavfi/pixfmts_copy_le-monow.nut
-e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/pixfmts_copy_le-nv12.nut
-7604654 ./tests/data/lavfi/pixfmts_copy_le-nv12.nut
-9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/pixfmts_copy_le-nv21.nut
-7604654 ./tests/data/lavfi/pixfmts_copy_le-nv21.nut
-b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/pixfmts_copy_le-rgb24.nut
-15207903 ./tests/data/lavfi/pixfmts_copy_le-rgb24.nut
-460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/pixfmts_copy_le-rgb48be.nut
-30414303 ./tests/data/lavfi/pixfmts_copy_le-rgb48be.nut
-cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/pixfmts_copy_le-rgb48le.nut
-30414303 ./tests/data/lavfi/pixfmts_copy_le-rgb48le.nut
-c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/pixfmts_copy_le-rgb4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_copy_le-rgb4_byte.nut
-a937a0fc764fb57dc1b3af87cba0273c *./tests/data/lavfi/pixfmts_copy_le-rgb555le.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-rgb555le.nut
-d39aa298bb525e9be8860351c6f62dab *./tests/data/lavfi/pixfmts_copy_le-rgb565le.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-rgb565le.nut
-4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/pixfmts_copy_le-rgb8.nut
-5070254 ./tests/data/lavfi/pixfmts_copy_le-rgb8.nut
-93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/pixfmts_copy_le-rgba.nut
-20276703 ./tests/data/lavfi/pixfmts_copy_le-rgba.nut
-adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/pixfmts_copy_le-uyvy422.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-uyvy422.nut
-2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/pixfmts_copy_le-yuv410p.nut
-5703854 ./tests/data/lavfi/pixfmts_copy_le-yuv410p.nut
-8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/pixfmts_copy_le-yuv411p.nut
-7604654 ./tests/data/lavfi/pixfmts_copy_le-yuv411p.nut
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/pixfmts_copy_le-yuv420p.nut
-7604654 ./tests/data/lavfi/pixfmts_copy_le-yuv420p.nut
-16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/pixfmts_copy_le-yuv420p16be.nut
-15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv420p16be.nut
-2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/pixfmts_copy_le-yuv420p16le.nut
-15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv420p16le.nut
-c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/pixfmts_copy_le-yuv422p.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-yuv422p.nut
-5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/pixfmts_copy_le-yuv422p16be.nut
-20276703 ./tests/data/lavfi/pixfmts_copy_le-yuv422p16be.nut
-e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/pixfmts_copy_le-yuv422p16le.nut
-20276703 ./tests/data/lavfi/pixfmts_copy_le-yuv422p16le.nut
-5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/pixfmts_copy_le-yuv440p.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-yuv440p.nut
-0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/pixfmts_copy_le-yuv444p.nut
-15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv444p.nut
-ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/pixfmts_copy_le-yuv444p16be.nut
-30414303 ./tests/data/lavfi/pixfmts_copy_le-yuv444p16be.nut
-1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/pixfmts_copy_le-yuv444p16le.nut
-30414303 ./tests/data/lavfi/pixfmts_copy_le-yuv444p16le.nut
-a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/pixfmts_copy_le-yuva420p.nut
-12673454 ./tests/data/lavfi/pixfmts_copy_le-yuva420p.nut
-32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/pixfmts_copy_le-yuvj420p.nut
-7604654 ./tests/data/lavfi/pixfmts_copy_le-yuvj420p.nut
-0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/pixfmts_copy_le-yuvj422p.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-yuvj422p.nut
-9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/pixfmts_copy_le-yuvj440p.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-yuvj440p.nut
-ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/pixfmts_copy_le-yuvj444p.nut
-15207903 ./tests/data/lavfi/pixfmts_copy_le-yuvj444p.nut
-f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/pixfmts_copy_le-yuyv422.nut
-10139054 ./tests/data/lavfi/pixfmts_copy_le-yuyv422.nut
+abgr                037bf9df6a765520ad6d490066bf4b89
+argb                c442a8261c2265a07212ef0f72e35f5a
+bgr24               0d0cb38ab3fa0b2ec0865c14f78b217b
+bgr4_byte           50d23cc82d9dcef2fd12adb81fb9b806
+bgr555le            378d6ac4223651a1adcbf94a3d0d807b
+bgr565le            1dfdd03995c287e3c754b164bf26a355
+bgr8                24bd566170343d06fec6fccfff5abc54
+bgra                76a18a5151242fa137133f604cd624d2
+gray                db08f7f0751900347e6b8649e4164d21
+gray16be            7becf34ae825a3df3969bf4c6bfeb5e2
+gray16le            10bd87059b5c189f3caef2837f4f2b5c
+monob               668ebe8b8103b9046b251b2fa8a1d88f
+monow               9251497f3b0634f1165d12d5a289d943
+nv12                e0af357888584d36eec5aa0f673793ef
+nv21                9a3297f3b34baa038b1f37cb202b512f
+rgb24               b41eba9651e1b5fe386289b506188105
+rgb48be             460b6de89b156290a12d3941db8bd731
+rgb48le             cd93cb34d15996987367dabda3a10128
+rgb4_byte           c93ba89b74c504e7f5ae9d9ab1546c73
+rgb555le            a937a0fc764fb57dc1b3af87cba0273c
+rgb565le            d39aa298bb525e9be8860351c6f62dab
+rgb8                4a9d8e4f2f154e83a7e1735be6300700
+rgba                93a5b3712e6eb8c5b9a09ffc7b9fbc12
+uyvy422             adcf64516a19fce44df77082bdb16291
+yuv410p             2d9225153c83ee1132397d619d94d1b3
+yuv411p             8b298af3e43348ca1b11eb8a3252ac6c
+yuv420p             eba2f135a08829387e2f698ff72a2939
+yuv420p16be         16c009a235cd52b74791a895423152a3
+yuv420p16le         2d59c4f1d0314a5a957a7cfc4b6fabcc
+yuv422p             c9bba4529821d796a6ab09f6a5fd355a
+yuv422p16be         5499502e1c29534a158a1fe60e889f60
+yuv422p16le         e3d61fde6978591596bc36b914386623
+yuv440p             5a064afe2b453bb52cdb3f176b1aa1cf
+yuv444p             0a98447b78fd476aa39686da6a74fa2e
+yuv444p16be         ea602a24b8e6969679265078bd8607b6
+yuv444p16le         1262a0dc57ee147967fc896d04206313
+yuva420p            a29884f3f3dfe1e00b961bc17bef3d47
+yuvj420p            32eec78ba51857b16ce9b813a49b7189
+yuvj422p            0dfa0ed434f73be51428758c69e082cb
+yuvj440p            9c3a093ff64a83ac4cf0b1e65390e236
+yuvj444p            ede1e5882d5c5bba48ea33cf1209d231
+yuyv422             f2569f2b5069a0ee0cecae33de0455e3
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixfmts_crop_le b/ffmpeg-mt/tests/ref/lavfi/pixfmts_crop_le
index 3a867cd..3016a7f 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixfmts_crop_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixfmts_crop_le
@@ -1,72 +1,36 @@
-cd761690872843d1b7ab0c695393c751 *./tests/data/lavfi/pixfmts_crop_le-abgr.nut
-2001202 ./tests/data/lavfi/pixfmts_crop_le-abgr.nut
-2ec6ef18769bcd651c2e8904d5a3ee67 *./tests/data/lavfi/pixfmts_crop_le-argb.nut
-2001202 ./tests/data/lavfi/pixfmts_crop_le-argb.nut
-3450fd00cf1493d1ded75544d82ba3ec *./tests/data/lavfi/pixfmts_crop_le-bgr24.nut
-1501202 ./tests/data/lavfi/pixfmts_crop_le-bgr24.nut
-2f6ac3cdd4676ab4e2982bdf0664945b *./tests/data/lavfi/pixfmts_crop_le-bgr4_byte.nut
-500591 ./tests/data/lavfi/pixfmts_crop_le-bgr4_byte.nut
-d22442fc13b464f9ba455b08df4e981f *./tests/data/lavfi/pixfmts_crop_le-bgr555le.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-bgr555le.nut
-891664e5a54ae5968901347da92bc5e9 *./tests/data/lavfi/pixfmts_crop_le-bgr565le.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-bgr565le.nut
-4b7159e05765bd4703180072d86423c8 *./tests/data/lavfi/pixfmts_crop_le-bgr8.nut
-500591 ./tests/data/lavfi/pixfmts_crop_le-bgr8.nut
-395c9f706fccda721471acaa5c96c16c *./tests/data/lavfi/pixfmts_crop_le-bgra.nut
-2001202 ./tests/data/lavfi/pixfmts_crop_le-bgra.nut
-8c4850e66562a587a292dc728a65ea4a *./tests/data/lavfi/pixfmts_crop_le-gray.nut
-500591 ./tests/data/lavfi/pixfmts_crop_le-gray.nut
-daa5a6b98fb4a280c57c57bff1a2ab5a *./tests/data/lavfi/pixfmts_crop_le-gray16be.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-gray16be.nut
-84f5ea7259073edcb893113b42213c8e *./tests/data/lavfi/pixfmts_crop_le-gray16le.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-gray16le.nut
-3b90ed64b687d3dc186c6ef521dc71a8 *./tests/data/lavfi/pixfmts_crop_le-rgb24.nut
-1501202 ./tests/data/lavfi/pixfmts_crop_le-rgb24.nut
-a808128041a1962deaa8620c7448feba *./tests/data/lavfi/pixfmts_crop_le-rgb48be.nut
-3001202 ./tests/data/lavfi/pixfmts_crop_le-rgb48be.nut
-ce92d02cc322608d5be377cb1940677b *./tests/data/lavfi/pixfmts_crop_le-rgb48le.nut
-3001202 ./tests/data/lavfi/pixfmts_crop_le-rgb48le.nut
-6958029f73c6cdfed4f71020d816f027 *./tests/data/lavfi/pixfmts_crop_le-rgb4_byte.nut
-500591 ./tests/data/lavfi/pixfmts_crop_le-rgb4_byte.nut
-eeb78f8ce6186fba55c941469e60ba67 *./tests/data/lavfi/pixfmts_crop_le-rgb555le.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-rgb555le.nut
-6a49700680be9a0d434411825a769556 *./tests/data/lavfi/pixfmts_crop_le-rgb565le.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-rgb565le.nut
-88b0398c265d1ed7a837dc084fa0917c *./tests/data/lavfi/pixfmts_crop_le-rgb8.nut
-500591 ./tests/data/lavfi/pixfmts_crop_le-rgb8.nut
-fd00b24c7597268c32759a84a1de2de4 *./tests/data/lavfi/pixfmts_crop_le-rgba.nut
-2001202 ./tests/data/lavfi/pixfmts_crop_le-rgba.nut
-a9f2eaa747bf988b7bebe4f442b9c67a *./tests/data/lavfi/pixfmts_crop_le-yuv410p.nut
-563227 ./tests/data/lavfi/pixfmts_crop_le-yuv410p.nut
-3334d3aef8dba238658090ac172375d1 *./tests/data/lavfi/pixfmts_crop_le-yuv411p.nut
-750727 ./tests/data/lavfi/pixfmts_crop_le-yuv411p.nut
-bfea0188ddd4889787c403caae119cc7 *./tests/data/lavfi/pixfmts_crop_le-yuv420p.nut
-750727 ./tests/data/lavfi/pixfmts_crop_le-yuv420p.nut
-8365eff38b8c329aeb95fc605fa229bb *./tests/data/lavfi/pixfmts_crop_le-yuv420p16be.nut
-1501202 ./tests/data/lavfi/pixfmts_crop_le-yuv420p16be.nut
-5e8dd38d973d5854abe1ad4efad20cc1 *./tests/data/lavfi/pixfmts_crop_le-yuv420p16le.nut
-1501202 ./tests/data/lavfi/pixfmts_crop_le-yuv420p16le.nut
-f2f930a91fe00d4252c4720b5ecd8961 *./tests/data/lavfi/pixfmts_crop_le-yuv422p.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-yuv422p.nut
-167e4338811a7d272925a4c6417d60da *./tests/data/lavfi/pixfmts_crop_le-yuv422p16be.nut
-2001202 ./tests/data/lavfi/pixfmts_crop_le-yuv422p16be.nut
-3359395d5875d581fa1e975013d30114 *./tests/data/lavfi/pixfmts_crop_le-yuv422p16le.nut
-2001202 ./tests/data/lavfi/pixfmts_crop_le-yuv422p16le.nut
-2472417d980e395ad6843cbb8b633b29 *./tests/data/lavfi/pixfmts_crop_le-yuv440p.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-yuv440p.nut
-1f151980486848c96bc5585ced99003e *./tests/data/lavfi/pixfmts_crop_le-yuv444p.nut
-1501202 ./tests/data/lavfi/pixfmts_crop_le-yuv444p.nut
-d69280c2856865d2ea94bd5292aac1c6 *./tests/data/lavfi/pixfmts_crop_le-yuv444p16be.nut
-3001202 ./tests/data/lavfi/pixfmts_crop_le-yuv444p16be.nut
-33f43e030bedf9723be4f63c3e9fc80e *./tests/data/lavfi/pixfmts_crop_le-yuv444p16le.nut
-3001202 ./tests/data/lavfi/pixfmts_crop_le-yuv444p16le.nut
-7536753dfbc7932560fb50c921369a0e *./tests/data/lavfi/pixfmts_crop_le-yuva420p.nut
-1251202 ./tests/data/lavfi/pixfmts_crop_le-yuva420p.nut
-21f891093006d42d7683b0e1d773a657 *./tests/data/lavfi/pixfmts_crop_le-yuvj420p.nut
-750727 ./tests/data/lavfi/pixfmts_crop_le-yuvj420p.nut
-9a43d474c407590ad8f213880586b45e *./tests/data/lavfi/pixfmts_crop_le-yuvj422p.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-yuvj422p.nut
-977351350450ebdbf7a9d20020c6b5a5 *./tests/data/lavfi/pixfmts_crop_le-yuvj440p.nut
-1001202 ./tests/data/lavfi/pixfmts_crop_le-yuvj440p.nut
-4a50ba26859dad91dcf7000de0d0efa1 *./tests/data/lavfi/pixfmts_crop_le-yuvj444p.nut
-1501202 ./tests/data/lavfi/pixfmts_crop_le-yuvj444p.nut
+abgr                cd761690872843d1b7ab0c695393c751
+argb                2ec6ef18769bcd651c2e8904d5a3ee67
+bgr24               3450fd00cf1493d1ded75544d82ba3ec
+bgr4_byte           2f6ac3cdd4676ab4e2982bdf0664945b
+bgr555le            d22442fc13b464f9ba455b08df4e981f
+bgr565le            891664e5a54ae5968901347da92bc5e9
+bgr8                4b7159e05765bd4703180072d86423c8
+bgra                395c9f706fccda721471acaa5c96c16c
+gray                8c4850e66562a587a292dc728a65ea4a
+gray16be            daa5a6b98fb4a280c57c57bff1a2ab5a
+gray16le            84f5ea7259073edcb893113b42213c8e
+rgb24               3b90ed64b687d3dc186c6ef521dc71a8
+rgb48be             a808128041a1962deaa8620c7448feba
+rgb48le             ce92d02cc322608d5be377cb1940677b
+rgb4_byte           6958029f73c6cdfed4f71020d816f027
+rgb555le            eeb78f8ce6186fba55c941469e60ba67
+rgb565le            6a49700680be9a0d434411825a769556
+rgb8                88b0398c265d1ed7a837dc084fa0917c
+rgba                fd00b24c7597268c32759a84a1de2de4
+yuv410p             a9f2eaa747bf988b7bebe4f442b9c67a
+yuv411p             3334d3aef8dba238658090ac172375d1
+yuv420p             bfea0188ddd4889787c403caae119cc7
+yuv420p16be         8365eff38b8c329aeb95fc605fa229bb
+yuv420p16le         5e8dd38d973d5854abe1ad4efad20cc1
+yuv422p             f2f930a91fe00d4252c4720b5ecd8961
+yuv422p16be         167e4338811a7d272925a4c6417d60da
+yuv422p16le         3359395d5875d581fa1e975013d30114
+yuv440p             2472417d980e395ad6843cbb8b633b29
+yuv444p             1f151980486848c96bc5585ced99003e
+yuv444p16be         d69280c2856865d2ea94bd5292aac1c6
+yuv444p16le         33f43e030bedf9723be4f63c3e9fc80e
+yuva420p            7536753dfbc7932560fb50c921369a0e
+yuvj420p            21f891093006d42d7683b0e1d773a657
+yuvj422p            9a43d474c407590ad8f213880586b45e
+yuvj440p            977351350450ebdbf7a9d20020c6b5a5
+yuvj444p            4a50ba26859dad91dcf7000de0d0efa1
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixfmts_hflip_le b/ffmpeg-mt/tests/ref/lavfi/pixfmts_hflip_le
index 50b831b..09976f2 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixfmts_hflip_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixfmts_hflip_le
@@ -1,72 +1,36 @@
-49468c6c9ceee5d52b08b1270a909323 *./tests/data/lavfi/pixfmts_hflip_le-abgr.nut
-20276703 ./tests/data/lavfi/pixfmts_hflip_le-abgr.nut
-50ba9f16c6475530602f2983278b82d0 *./tests/data/lavfi/pixfmts_hflip_le-argb.nut
-20276703 ./tests/data/lavfi/pixfmts_hflip_le-argb.nut
-cc53d2011d097972db0d22756c3699e3 *./tests/data/lavfi/pixfmts_hflip_le-bgr24.nut
-15207903 ./tests/data/lavfi/pixfmts_hflip_le-bgr24.nut
-aac987e7d1a6a96477cfc0b48a4285de *./tests/data/lavfi/pixfmts_hflip_le-bgr4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_hflip_le-bgr4_byte.nut
-ccee08679bac84a1f960c6c9070c5538 *./tests/data/lavfi/pixfmts_hflip_le-bgr555le.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-bgr555le.nut
-3703466e19e1b52e03a34fd244a8e8e4 *./tests/data/lavfi/pixfmts_hflip_le-bgr565le.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-bgr565le.nut
-50b505a889f0428242305acb642da107 *./tests/data/lavfi/pixfmts_hflip_le-bgr8.nut
-5070254 ./tests/data/lavfi/pixfmts_hflip_le-bgr8.nut
-01ca21e7e6a8d1281b4553bde8e8a404 *./tests/data/lavfi/pixfmts_hflip_le-bgra.nut
-20276703 ./tests/data/lavfi/pixfmts_hflip_le-bgra.nut
-03efcb4ab52a24c0af0e03cfd26c9377 *./tests/data/lavfi/pixfmts_hflip_le-gray.nut
-5070254 ./tests/data/lavfi/pixfmts_hflip_le-gray.nut
-9bcbca979601ddc4869f846f08f3d1dd *./tests/data/lavfi/pixfmts_hflip_le-gray16be.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-gray16be.nut
-c1b8965adcc7f847ee343149ff507073 *./tests/data/lavfi/pixfmts_hflip_le-gray16le.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-gray16le.nut
-754f1722fc738590cc407ac65749bfe8 *./tests/data/lavfi/pixfmts_hflip_le-rgb24.nut
-15207903 ./tests/data/lavfi/pixfmts_hflip_le-rgb24.nut
-10743e1577dc3198dbbc7c0b3b8f429e *./tests/data/lavfi/pixfmts_hflip_le-rgb48be.nut
-30414303 ./tests/data/lavfi/pixfmts_hflip_le-rgb48be.nut
-dd945a44f39119221407bf7a04f1bc49 *./tests/data/lavfi/pixfmts_hflip_le-rgb48le.nut
-30414303 ./tests/data/lavfi/pixfmts_hflip_le-rgb48le.nut
-c8a3f995fcf3e0919239ea2c413ddc29 *./tests/data/lavfi/pixfmts_hflip_le-rgb4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_hflip_le-rgb4_byte.nut
-8778ee0cf58ce9ad1d99a1eca9f95e87 *./tests/data/lavfi/pixfmts_hflip_le-rgb555le.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-rgb555le.nut
-2cb690eb3fcb72da3771ad6a48931158 *./tests/data/lavfi/pixfmts_hflip_le-rgb565le.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-rgb565le.nut
-9e462b811b9b6173397b9cfc1f6b2f17 *./tests/data/lavfi/pixfmts_hflip_le-rgb8.nut
-5070254 ./tests/data/lavfi/pixfmts_hflip_le-rgb8.nut
-d3d0dc1ecef3ed72f26a2986d0efc204 *./tests/data/lavfi/pixfmts_hflip_le-rgba.nut
-20276703 ./tests/data/lavfi/pixfmts_hflip_le-rgba.nut
-acb543ebbbf63eefe533e6faffc006da *./tests/data/lavfi/pixfmts_hflip_le-yuv410p.nut
-5703854 ./tests/data/lavfi/pixfmts_hflip_le-yuv410p.nut
-c626cf6d191139b4ca7efc0155f957f1 *./tests/data/lavfi/pixfmts_hflip_le-yuv411p.nut
-7604654 ./tests/data/lavfi/pixfmts_hflip_le-yuv411p.nut
-2d5c80f9ba2ddd85b2aeda3564cc7d64 *./tests/data/lavfi/pixfmts_hflip_le-yuv420p.nut
-7604654 ./tests/data/lavfi/pixfmts_hflip_le-yuv420p.nut
-758b0c1e2113b15e7afde48da4e4d024 *./tests/data/lavfi/pixfmts_hflip_le-yuv420p16be.nut
-15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuv420p16be.nut
-480ccd951dcb806bc875d307e02e50a0 *./tests/data/lavfi/pixfmts_hflip_le-yuv420p16le.nut
-15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuv420p16le.nut
-6e728f4eb9eae287c224f396d84be6ea *./tests/data/lavfi/pixfmts_hflip_le-yuv422p.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuv422p.nut
-a05d43cd62b790087bd37083174557de *./tests/data/lavfi/pixfmts_hflip_le-yuv422p16be.nut
-20276703 ./tests/data/lavfi/pixfmts_hflip_le-yuv422p16be.nut
-6954abebcbc62d81068d58d0c62bdd5b *./tests/data/lavfi/pixfmts_hflip_le-yuv422p16le.nut
-20276703 ./tests/data/lavfi/pixfmts_hflip_le-yuv422p16le.nut
-a99e2b57ed601f39852715c9d675d0d3 *./tests/data/lavfi/pixfmts_hflip_le-yuv440p.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuv440p.nut
-947e47f7bb5fdccc659d19b7df2b6fc3 *./tests/data/lavfi/pixfmts_hflip_le-yuv444p.nut
-15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuv444p.nut
-e5ef45bc3d2f5b0b2542d5151340c382 *./tests/data/lavfi/pixfmts_hflip_le-yuv444p16be.nut
-30414303 ./tests/data/lavfi/pixfmts_hflip_le-yuv444p16be.nut
-70793e3d66d0c23a0cdedabe9c24c2a7 *./tests/data/lavfi/pixfmts_hflip_le-yuv444p16le.nut
-30414303 ./tests/data/lavfi/pixfmts_hflip_le-yuv444p16le.nut
-d83ec0c01498189f179ec574918185f1 *./tests/data/lavfi/pixfmts_hflip_le-yuva420p.nut
-12673454 ./tests/data/lavfi/pixfmts_hflip_le-yuva420p.nut
-df3aaaec3bb157c3bde5f0365af30f4f *./tests/data/lavfi/pixfmts_hflip_le-yuvj420p.nut
-7604654 ./tests/data/lavfi/pixfmts_hflip_le-yuvj420p.nut
-d113871528d510a192797af59df9c05c *./tests/data/lavfi/pixfmts_hflip_le-yuvj422p.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuvj422p.nut
-e8f7ed76e57c892a1e9e27a3f29452db *./tests/data/lavfi/pixfmts_hflip_le-yuvj440p.nut
-10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuvj440p.nut
-2c3ae369607608c6dcb0d830f00f971a *./tests/data/lavfi/pixfmts_hflip_le-yuvj444p.nut
-15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuvj444p.nut
+abgr                49468c6c9ceee5d52b08b1270a909323
+argb                50ba9f16c6475530602f2983278b82d0
+bgr24               cc53d2011d097972db0d22756c3699e3
+bgr4_byte           aac987e7d1a6a96477cfc0b48a4285de
+bgr555le            ccee08679bac84a1f960c6c9070c5538
+bgr565le            3703466e19e1b52e03a34fd244a8e8e4
+bgr8                50b505a889f0428242305acb642da107
+bgra                01ca21e7e6a8d1281b4553bde8e8a404
+gray                03efcb4ab52a24c0af0e03cfd26c9377
+gray16be            9bcbca979601ddc4869f846f08f3d1dd
+gray16le            c1b8965adcc7f847ee343149ff507073
+rgb24               754f1722fc738590cc407ac65749bfe8
+rgb48be             10743e1577dc3198dbbc7c0b3b8f429e
+rgb48le             dd945a44f39119221407bf7a04f1bc49
+rgb4_byte           c8a3f995fcf3e0919239ea2c413ddc29
+rgb555le            8778ee0cf58ce9ad1d99a1eca9f95e87
+rgb565le            2cb690eb3fcb72da3771ad6a48931158
+rgb8                9e462b811b9b6173397b9cfc1f6b2f17
+rgba                d3d0dc1ecef3ed72f26a2986d0efc204
+yuv410p             acb543ebbbf63eefe533e6faffc006da
+yuv411p             c626cf6d191139b4ca7efc0155f957f1
+yuv420p             2d5c80f9ba2ddd85b2aeda3564cc7d64
+yuv420p16be         758b0c1e2113b15e7afde48da4e4d024
+yuv420p16le         480ccd951dcb806bc875d307e02e50a0
+yuv422p             6e728f4eb9eae287c224f396d84be6ea
+yuv422p16be         a05d43cd62b790087bd37083174557de
+yuv422p16le         6954abebcbc62d81068d58d0c62bdd5b
+yuv440p             a99e2b57ed601f39852715c9d675d0d3
+yuv444p             947e47f7bb5fdccc659d19b7df2b6fc3
+yuv444p16be         e5ef45bc3d2f5b0b2542d5151340c382
+yuv444p16le         70793e3d66d0c23a0cdedabe9c24c2a7
+yuva420p            d83ec0c01498189f179ec574918185f1
+yuvj420p            df3aaaec3bb157c3bde5f0365af30f4f
+yuvj422p            d113871528d510a192797af59df9c05c
+yuvj440p            e8f7ed76e57c892a1e9e27a3f29452db
+yuvj444p            2c3ae369607608c6dcb0d830f00f971a
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixfmts_null_le b/ffmpeg-mt/tests/ref/lavfi/pixfmts_null_le
index 3100624..5832f89 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixfmts_null_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixfmts_null_le
@@ -1,84 +1,42 @@
-037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/pixfmts_null_le-abgr.nut
-20276703 ./tests/data/lavfi/pixfmts_null_le-abgr.nut
-c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/pixfmts_null_le-argb.nut
-20276703 ./tests/data/lavfi/pixfmts_null_le-argb.nut
-0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/pixfmts_null_le-bgr24.nut
-15207903 ./tests/data/lavfi/pixfmts_null_le-bgr24.nut
-50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/pixfmts_null_le-bgr4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_null_le-bgr4_byte.nut
-378d6ac4223651a1adcbf94a3d0d807b *./tests/data/lavfi/pixfmts_null_le-bgr555le.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-bgr555le.nut
-1dfdd03995c287e3c754b164bf26a355 *./tests/data/lavfi/pixfmts_null_le-bgr565le.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-bgr565le.nut
-24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/pixfmts_null_le-bgr8.nut
-5070254 ./tests/data/lavfi/pixfmts_null_le-bgr8.nut
-76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/pixfmts_null_le-bgra.nut
-20276703 ./tests/data/lavfi/pixfmts_null_le-bgra.nut
-db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/pixfmts_null_le-gray.nut
-5070254 ./tests/data/lavfi/pixfmts_null_le-gray.nut
-7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/pixfmts_null_le-gray16be.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-gray16be.nut
-10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/pixfmts_null_le-gray16le.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-gray16le.nut
-668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/pixfmts_null_le-monob.nut
-634329 ./tests/data/lavfi/pixfmts_null_le-monob.nut
-9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/pixfmts_null_le-monow.nut
-634329 ./tests/data/lavfi/pixfmts_null_le-monow.nut
-e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/pixfmts_null_le-nv12.nut
-7604654 ./tests/data/lavfi/pixfmts_null_le-nv12.nut
-9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/pixfmts_null_le-nv21.nut
-7604654 ./tests/data/lavfi/pixfmts_null_le-nv21.nut
-b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/pixfmts_null_le-rgb24.nut
-15207903 ./tests/data/lavfi/pixfmts_null_le-rgb24.nut
-460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/pixfmts_null_le-rgb48be.nut
-30414303 ./tests/data/lavfi/pixfmts_null_le-rgb48be.nut
-cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/pixfmts_null_le-rgb48le.nut
-30414303 ./tests/data/lavfi/pixfmts_null_le-rgb48le.nut
-c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/pixfmts_null_le-rgb4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_null_le-rgb4_byte.nut
-a937a0fc764fb57dc1b3af87cba0273c *./tests/data/lavfi/pixfmts_null_le-rgb555le.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-rgb555le.nut
-d39aa298bb525e9be8860351c6f62dab *./tests/data/lavfi/pixfmts_null_le-rgb565le.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-rgb565le.nut
-4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/pixfmts_null_le-rgb8.nut
-5070254 ./tests/data/lavfi/pixfmts_null_le-rgb8.nut
-93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/pixfmts_null_le-rgba.nut
-20276703 ./tests/data/lavfi/pixfmts_null_le-rgba.nut
-adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/pixfmts_null_le-uyvy422.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-uyvy422.nut
-2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/pixfmts_null_le-yuv410p.nut
-5703854 ./tests/data/lavfi/pixfmts_null_le-yuv410p.nut
-8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/pixfmts_null_le-yuv411p.nut
-7604654 ./tests/data/lavfi/pixfmts_null_le-yuv411p.nut
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/pixfmts_null_le-yuv420p.nut
-7604654 ./tests/data/lavfi/pixfmts_null_le-yuv420p.nut
-16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/pixfmts_null_le-yuv420p16be.nut
-15207903 ./tests/data/lavfi/pixfmts_null_le-yuv420p16be.nut
-2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/pixfmts_null_le-yuv420p16le.nut
-15207903 ./tests/data/lavfi/pixfmts_null_le-yuv420p16le.nut
-c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/pixfmts_null_le-yuv422p.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-yuv422p.nut
-5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/pixfmts_null_le-yuv422p16be.nut
-20276703 ./tests/data/lavfi/pixfmts_null_le-yuv422p16be.nut
-e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/pixfmts_null_le-yuv422p16le.nut
-20276703 ./tests/data/lavfi/pixfmts_null_le-yuv422p16le.nut
-5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/pixfmts_null_le-yuv440p.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-yuv440p.nut
-0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/pixfmts_null_le-yuv444p.nut
-15207903 ./tests/data/lavfi/pixfmts_null_le-yuv444p.nut
-ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/pixfmts_null_le-yuv444p16be.nut
-30414303 ./tests/data/lavfi/pixfmts_null_le-yuv444p16be.nut
-1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/pixfmts_null_le-yuv444p16le.nut
-30414303 ./tests/data/lavfi/pixfmts_null_le-yuv444p16le.nut
-a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/pixfmts_null_le-yuva420p.nut
-12673454 ./tests/data/lavfi/pixfmts_null_le-yuva420p.nut
-32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/pixfmts_null_le-yuvj420p.nut
-7604654 ./tests/data/lavfi/pixfmts_null_le-yuvj420p.nut
-0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/pixfmts_null_le-yuvj422p.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-yuvj422p.nut
-9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/pixfmts_null_le-yuvj440p.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-yuvj440p.nut
-ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/pixfmts_null_le-yuvj444p.nut
-15207903 ./tests/data/lavfi/pixfmts_null_le-yuvj444p.nut
-f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/pixfmts_null_le-yuyv422.nut
-10139054 ./tests/data/lavfi/pixfmts_null_le-yuyv422.nut
+abgr                037bf9df6a765520ad6d490066bf4b89
+argb                c442a8261c2265a07212ef0f72e35f5a
+bgr24               0d0cb38ab3fa0b2ec0865c14f78b217b
+bgr4_byte           50d23cc82d9dcef2fd12adb81fb9b806
+bgr555le            378d6ac4223651a1adcbf94a3d0d807b
+bgr565le            1dfdd03995c287e3c754b164bf26a355
+bgr8                24bd566170343d06fec6fccfff5abc54
+bgra                76a18a5151242fa137133f604cd624d2
+gray                db08f7f0751900347e6b8649e4164d21
+gray16be            7becf34ae825a3df3969bf4c6bfeb5e2
+gray16le            10bd87059b5c189f3caef2837f4f2b5c
+monob               668ebe8b8103b9046b251b2fa8a1d88f
+monow               9251497f3b0634f1165d12d5a289d943
+nv12                e0af357888584d36eec5aa0f673793ef
+nv21                9a3297f3b34baa038b1f37cb202b512f
+rgb24               b41eba9651e1b5fe386289b506188105
+rgb48be             460b6de89b156290a12d3941db8bd731
+rgb48le             cd93cb34d15996987367dabda3a10128
+rgb4_byte           c93ba89b74c504e7f5ae9d9ab1546c73
+rgb555le            a937a0fc764fb57dc1b3af87cba0273c
+rgb565le            d39aa298bb525e9be8860351c6f62dab
+rgb8                4a9d8e4f2f154e83a7e1735be6300700
+rgba                93a5b3712e6eb8c5b9a09ffc7b9fbc12
+uyvy422             adcf64516a19fce44df77082bdb16291
+yuv410p             2d9225153c83ee1132397d619d94d1b3
+yuv411p             8b298af3e43348ca1b11eb8a3252ac6c
+yuv420p             eba2f135a08829387e2f698ff72a2939
+yuv420p16be         16c009a235cd52b74791a895423152a3
+yuv420p16le         2d59c4f1d0314a5a957a7cfc4b6fabcc
+yuv422p             c9bba4529821d796a6ab09f6a5fd355a
+yuv422p16be         5499502e1c29534a158a1fe60e889f60
+yuv422p16le         e3d61fde6978591596bc36b914386623
+yuv440p             5a064afe2b453bb52cdb3f176b1aa1cf
+yuv444p             0a98447b78fd476aa39686da6a74fa2e
+yuv444p16be         ea602a24b8e6969679265078bd8607b6
+yuv444p16le         1262a0dc57ee147967fc896d04206313
+yuva420p            a29884f3f3dfe1e00b961bc17bef3d47
+yuvj420p            32eec78ba51857b16ce9b813a49b7189
+yuvj422p            0dfa0ed434f73be51428758c69e082cb
+yuvj440p            9c3a093ff64a83ac4cf0b1e65390e236
+yuvj444p            ede1e5882d5c5bba48ea33cf1209d231
+yuyv422             f2569f2b5069a0ee0cecae33de0455e3
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixfmts_pad_le b/ffmpeg-mt/tests/ref/lavfi/pixfmts_pad_le
index 243a500..73a44f6 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixfmts_pad_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixfmts_pad_le
@@ -1,34 +1,17 @@
-e8e5e350c856c051d502cd435a2aa0bd *./tests/data/lavfi/pixfmts_pad_le-abgr.nut
-40001503 ./tests/data/lavfi/pixfmts_pad_le-abgr.nut
-a98e0a1213824ee4566d4891468bb614 *./tests/data/lavfi/pixfmts_pad_le-argb.nut
-40001503 ./tests/data/lavfi/pixfmts_pad_le-argb.nut
-ac7417cea8d6e799a31a3c9a39b8f202 *./tests/data/lavfi/pixfmts_pad_le-bgr24.nut
-30001503 ./tests/data/lavfi/pixfmts_pad_le-bgr24.nut
-6113a09a023cb2b08e9cad78eb1eb37a *./tests/data/lavfi/pixfmts_pad_le-bgra.nut
-40001503 ./tests/data/lavfi/pixfmts_pad_le-bgra.nut
-65eed443acc66c4f02bab6df4ebed515 *./tests/data/lavfi/pixfmts_pad_le-rgb24.nut
-30001503 ./tests/data/lavfi/pixfmts_pad_le-rgb24.nut
-74d4158ad0c626e9a7c6923b9ca73294 *./tests/data/lavfi/pixfmts_pad_le-rgba.nut
-40001503 ./tests/data/lavfi/pixfmts_pad_le-rgba.nut
-a5210eb6a9b10c3269899b935df9a2d6 *./tests/data/lavfi/pixfmts_pad_le-yuv410p.nut
-11251454 ./tests/data/lavfi/pixfmts_pad_le-yuv410p.nut
-a23380c9698e2d80c9fa8a8b6d4f6854 *./tests/data/lavfi/pixfmts_pad_le-yuv411p.nut
-15001503 ./tests/data/lavfi/pixfmts_pad_le-yuv411p.nut
-f8733600369adaea28aa445dbdf2ed4c *./tests/data/lavfi/pixfmts_pad_le-yuv420p.nut
-15001503 ./tests/data/lavfi/pixfmts_pad_le-yuv420p.nut
-3e0d822c11c716e7636387b1bf27c5ff *./tests/data/lavfi/pixfmts_pad_le-yuv422p.nut
-20001503 ./tests/data/lavfi/pixfmts_pad_le-yuv422p.nut
-225dd7fbc8cceb24c26b765187d43a9e *./tests/data/lavfi/pixfmts_pad_le-yuv440p.nut
-20001503 ./tests/data/lavfi/pixfmts_pad_le-yuv440p.nut
-45484f0411d336ce94636da0395f4692 *./tests/data/lavfi/pixfmts_pad_le-yuv444p.nut
-30001503 ./tests/data/lavfi/pixfmts_pad_le-yuv444p.nut
-919722724765dc3a716c38fa53b20580 *./tests/data/lavfi/pixfmts_pad_le-yuva420p.nut
-25001503 ./tests/data/lavfi/pixfmts_pad_le-yuva420p.nut
-4f20e2799966c21a9d9e0788b0956925 *./tests/data/lavfi/pixfmts_pad_le-yuvj420p.nut
-15001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj420p.nut
-e4d84b0683f77a76f1c17d976eff127c *./tests/data/lavfi/pixfmts_pad_le-yuvj422p.nut
-20001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj422p.nut
-9ccc1f03d8d9a00dc4a5888bd77093ad *./tests/data/lavfi/pixfmts_pad_le-yuvj440p.nut
-20001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj440p.nut
-7d202babcedf836e9ae9776163ee9425 *./tests/data/lavfi/pixfmts_pad_le-yuvj444p.nut
-30001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj444p.nut
+abgr                e8e5e350c856c051d502cd435a2aa0bd
+argb                a98e0a1213824ee4566d4891468bb614
+bgr24               ac7417cea8d6e799a31a3c9a39b8f202
+bgra                6113a09a023cb2b08e9cad78eb1eb37a
+rgb24               65eed443acc66c4f02bab6df4ebed515
+rgba                74d4158ad0c626e9a7c6923b9ca73294
+yuv410p             a5210eb6a9b10c3269899b935df9a2d6
+yuv411p             a23380c9698e2d80c9fa8a8b6d4f6854
+yuv420p             f8733600369adaea28aa445dbdf2ed4c
+yuv422p             3e0d822c11c716e7636387b1bf27c5ff
+yuv440p             225dd7fbc8cceb24c26b765187d43a9e
+yuv444p             45484f0411d336ce94636da0395f4692
+yuva420p            919722724765dc3a716c38fa53b20580
+yuvj420p            4f20e2799966c21a9d9e0788b0956925
+yuvj422p            e4d84b0683f77a76f1c17d976eff127c
+yuvj440p            9ccc1f03d8d9a00dc4a5888bd77093ad
+yuvj444p            7d202babcedf836e9ae9776163ee9425
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixfmts_scale_le b/ffmpeg-mt/tests/ref/lavfi/pixfmts_scale_le
index 2363c8e..3ecfed7 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixfmts_scale_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixfmts_scale_le
@@ -1,84 +1,42 @@
-d894cb97f6c80eb21bdbe8a4eea62d86 *./tests/data/lavfi/pixfmts_scale_le-abgr.nut
-4001453 ./tests/data/lavfi/pixfmts_scale_le-abgr.nut
-54346f2b2eef10919e0f247241df3b24 *./tests/data/lavfi/pixfmts_scale_le-argb.nut
-4001453 ./tests/data/lavfi/pixfmts_scale_le-argb.nut
-570f8d6b51a838aed022ef67535f6bdc *./tests/data/lavfi/pixfmts_scale_le-bgr24.nut
-3001203 ./tests/data/lavfi/pixfmts_scale_le-bgr24.nut
-ee1d35a7baf8e9016891929a2f565c0b *./tests/data/lavfi/pixfmts_scale_le-bgr4_byte.nut
-1001203 ./tests/data/lavfi/pixfmts_scale_le-bgr4_byte.nut
-36b745067197f9ca8c1731cac51329c9 *./tests/data/lavfi/pixfmts_scale_le-bgr555le.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-bgr555le.nut
-3a514a298c6161a071ddf9963c06509d *./tests/data/lavfi/pixfmts_scale_le-bgr565le.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-bgr565le.nut
-7f007fa6c153a16e808a9c51605a4016 *./tests/data/lavfi/pixfmts_scale_le-bgr8.nut
-1001203 ./tests/data/lavfi/pixfmts_scale_le-bgr8.nut
-a5e7040f9a80cccd65e5acf2ca09ace5 *./tests/data/lavfi/pixfmts_scale_le-bgra.nut
-4001453 ./tests/data/lavfi/pixfmts_scale_le-bgra.nut
-d7786a7d9d99ac74230cc045cab5632c *./tests/data/lavfi/pixfmts_scale_le-gray.nut
-1001203 ./tests/data/lavfi/pixfmts_scale_le-gray.nut
-af39ce3a497f6734b157c8b94544f537 *./tests/data/lavfi/pixfmts_scale_le-gray16be.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-gray16be.nut
-7ac1b788bcc472010df7a97e762485e0 *./tests/data/lavfi/pixfmts_scale_le-gray16le.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-gray16le.nut
-88c4c050758e64d120f50c7eff694381 *./tests/data/lavfi/pixfmts_scale_le-monob.nut
-125371 ./tests/data/lavfi/pixfmts_scale_le-monob.nut
-d31772ebaa877fc2a78565937f7f9673 *./tests/data/lavfi/pixfmts_scale_le-monow.nut
-125371 ./tests/data/lavfi/pixfmts_scale_le-monow.nut
-4676d59db43d657dc12841f6bc3ab452 *./tests/data/lavfi/pixfmts_scale_le-nv12.nut
-1501203 ./tests/data/lavfi/pixfmts_scale_le-nv12.nut
-69c699510ff1fb777b118ebee1002f14 *./tests/data/lavfi/pixfmts_scale_le-nv21.nut
-1501203 ./tests/data/lavfi/pixfmts_scale_le-nv21.nut
-514692e28e8ff6860e415ce4fcf6eb8c *./tests/data/lavfi/pixfmts_scale_le-rgb24.nut
-3001203 ./tests/data/lavfi/pixfmts_scale_le-rgb24.nut
-1894cd30dabcd3180518e4d5f09f25e7 *./tests/data/lavfi/pixfmts_scale_le-rgb48be.nut
-6001453 ./tests/data/lavfi/pixfmts_scale_le-rgb48be.nut
-1354e6e27ce3c1d4d4989ee56030c94b *./tests/data/lavfi/pixfmts_scale_le-rgb48le.nut
-6001453 ./tests/data/lavfi/pixfmts_scale_le-rgb48le.nut
-d81ffd3add95842a618eec81024f0b5c *./tests/data/lavfi/pixfmts_scale_le-rgb4_byte.nut
-1001203 ./tests/data/lavfi/pixfmts_scale_le-rgb4_byte.nut
-a350ef1dc2c9688ed49e7ba018843795 *./tests/data/lavfi/pixfmts_scale_le-rgb555le.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-rgb555le.nut
-6f4bb711238baa762d73305213f8d035 *./tests/data/lavfi/pixfmts_scale_le-rgb565le.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-rgb565le.nut
-091d0170b354ef0e97312b95feb5483f *./tests/data/lavfi/pixfmts_scale_le-rgb8.nut
-1001203 ./tests/data/lavfi/pixfmts_scale_le-rgb8.nut
-a3d362f222098a00e63867f612018659 *./tests/data/lavfi/pixfmts_scale_le-rgba.nut
-4001453 ./tests/data/lavfi/pixfmts_scale_le-rgba.nut
-314bd486277111a95d9369b944fa0400 *./tests/data/lavfi/pixfmts_scale_le-uyvy422.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-uyvy422.nut
-7df8f6d69b56a8dcb6c7ee908e5018b5 *./tests/data/lavfi/pixfmts_scale_le-yuv410p.nut
-1126203 ./tests/data/lavfi/pixfmts_scale_le-yuv410p.nut
-1143e7c5cc28fe0922b051b17733bc4c *./tests/data/lavfi/pixfmts_scale_le-yuv411p.nut
-1501203 ./tests/data/lavfi/pixfmts_scale_le-yuv411p.nut
-fdad2d8df8985e3d17e73c71f713cb14 *./tests/data/lavfi/pixfmts_scale_le-yuv420p.nut
-1501203 ./tests/data/lavfi/pixfmts_scale_le-yuv420p.nut
-29a0265764530070f5cd3251cc01f66a *./tests/data/lavfi/pixfmts_scale_le-yuv420p16be.nut
-3001203 ./tests/data/lavfi/pixfmts_scale_le-yuv420p16be.nut
-6f3a265b084a78baec229238d9f7945f *./tests/data/lavfi/pixfmts_scale_le-yuv420p16le.nut
-3001203 ./tests/data/lavfi/pixfmts_scale_le-yuv420p16le.nut
-918e37701ee7377d16a8a6c119c56a40 *./tests/data/lavfi/pixfmts_scale_le-yuv422p.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-yuv422p.nut
-ef3e865fc1d0c68977c735323c50af6e *./tests/data/lavfi/pixfmts_scale_le-yuv422p16be.nut
-4001453 ./tests/data/lavfi/pixfmts_scale_le-yuv422p16be.nut
-428a9b96214c09cb5a983ce36d6961ff *./tests/data/lavfi/pixfmts_scale_le-yuv422p16le.nut
-4001453 ./tests/data/lavfi/pixfmts_scale_le-yuv422p16le.nut
-461503fdb9b90451020aa3b25ddf041c *./tests/data/lavfi/pixfmts_scale_le-yuv440p.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-yuv440p.nut
-81b2eba962d12e8d64f003ac56f6faf2 *./tests/data/lavfi/pixfmts_scale_le-yuv444p.nut
-3001203 ./tests/data/lavfi/pixfmts_scale_le-yuv444p.nut
-99a3738c70c8fbdc5a0e4ad4bf50648d *./tests/data/lavfi/pixfmts_scale_le-yuv444p16be.nut
-6001453 ./tests/data/lavfi/pixfmts_scale_le-yuv444p16be.nut
-385d0cc5240d62da0871915be5d86f0a *./tests/data/lavfi/pixfmts_scale_le-yuv444p16le.nut
-6001453 ./tests/data/lavfi/pixfmts_scale_le-yuv444p16le.nut
-8673a9131fb47de69788863f93a50eb7 *./tests/data/lavfi/pixfmts_scale_le-yuva420p.nut
-2501203 ./tests/data/lavfi/pixfmts_scale_le-yuva420p.nut
-30427bd6caf5bda93a173dbebe759e09 *./tests/data/lavfi/pixfmts_scale_le-yuvj420p.nut
-1501203 ./tests/data/lavfi/pixfmts_scale_le-yuvj420p.nut
-fc8288f64fd149573f73cf8da05d8e6d *./tests/data/lavfi/pixfmts_scale_le-yuvj422p.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-yuvj422p.nut
-26d0b4713a87ab9637a4062c22e6e70d *./tests/data/lavfi/pixfmts_scale_le-yuvj440p.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-yuvj440p.nut
-894e6184d987a5ec4dc6f77bb75ef38c *./tests/data/lavfi/pixfmts_scale_le-yuvj444p.nut
-3001203 ./tests/data/lavfi/pixfmts_scale_le-yuvj444p.nut
-169e19ac91b257bd84ace0fdf56559ad *./tests/data/lavfi/pixfmts_scale_le-yuyv422.nut
-2001203 ./tests/data/lavfi/pixfmts_scale_le-yuyv422.nut
+abgr                d894cb97f6c80eb21bdbe8a4eea62d86
+argb                54346f2b2eef10919e0f247241df3b24
+bgr24               570f8d6b51a838aed022ef67535f6bdc
+bgr4_byte           ee1d35a7baf8e9016891929a2f565c0b
+bgr555le            36b745067197f9ca8c1731cac51329c9
+bgr565le            3a514a298c6161a071ddf9963c06509d
+bgr8                7f007fa6c153a16e808a9c51605a4016
+bgra                a5e7040f9a80cccd65e5acf2ca09ace5
+gray                d7786a7d9d99ac74230cc045cab5632c
+gray16be            af39ce3a497f6734b157c8b94544f537
+gray16le            7ac1b788bcc472010df7a97e762485e0
+monob               88c4c050758e64d120f50c7eff694381
+monow               d31772ebaa877fc2a78565937f7f9673
+nv12                4676d59db43d657dc12841f6bc3ab452
+nv21                69c699510ff1fb777b118ebee1002f14
+rgb24               514692e28e8ff6860e415ce4fcf6eb8c
+rgb48be             1894cd30dabcd3180518e4d5f09f25e7
+rgb48le             1354e6e27ce3c1d4d4989ee56030c94b
+rgb4_byte           d81ffd3add95842a618eec81024f0b5c
+rgb555le            a350ef1dc2c9688ed49e7ba018843795
+rgb565le            6f4bb711238baa762d73305213f8d035
+rgb8                091d0170b354ef0e97312b95feb5483f
+rgba                a3d362f222098a00e63867f612018659
+uyvy422             314bd486277111a95d9369b944fa0400
+yuv410p             7df8f6d69b56a8dcb6c7ee908e5018b5
+yuv411p             1143e7c5cc28fe0922b051b17733bc4c
+yuv420p             fdad2d8df8985e3d17e73c71f713cb14
+yuv420p16be         29a0265764530070f5cd3251cc01f66a
+yuv420p16le         6f3a265b084a78baec229238d9f7945f
+yuv422p             918e37701ee7377d16a8a6c119c56a40
+yuv422p16be         ef3e865fc1d0c68977c735323c50af6e
+yuv422p16le         428a9b96214c09cb5a983ce36d6961ff
+yuv440p             461503fdb9b90451020aa3b25ddf041c
+yuv444p             81b2eba962d12e8d64f003ac56f6faf2
+yuv444p16be         99a3738c70c8fbdc5a0e4ad4bf50648d
+yuv444p16le         385d0cc5240d62da0871915be5d86f0a
+yuva420p            8673a9131fb47de69788863f93a50eb7
+yuvj420p            30427bd6caf5bda93a173dbebe759e09
+yuvj422p            fc8288f64fd149573f73cf8da05d8e6d
+yuvj440p            26d0b4713a87ab9637a4062c22e6e70d
+yuvj444p            894e6184d987a5ec4dc6f77bb75ef38c
+yuyv422             169e19ac91b257bd84ace0fdf56559ad
diff --git a/ffmpeg-mt/tests/ref/lavfi/pixfmts_vflip_le b/ffmpeg-mt/tests/ref/lavfi/pixfmts_vflip_le
index 15e899a..3b140a2 100644
--- a/ffmpeg-mt/tests/ref/lavfi/pixfmts_vflip_le
+++ b/ffmpeg-mt/tests/ref/lavfi/pixfmts_vflip_le
@@ -1,84 +1,42 @@
-25e72e9dbd01ab00727c976d577f7be5 *./tests/data/lavfi/pixfmts_vflip_le-abgr.nut
-20276703 ./tests/data/lavfi/pixfmts_vflip_le-abgr.nut
-19869bf1a5ac0b6af4d8bbe2c104533c *./tests/data/lavfi/pixfmts_vflip_le-argb.nut
-20276703 ./tests/data/lavfi/pixfmts_vflip_le-argb.nut
-89108a4ba00201f79b75b9305c42352d *./tests/data/lavfi/pixfmts_vflip_le-bgr24.nut
-15207903 ./tests/data/lavfi/pixfmts_vflip_le-bgr24.nut
-407fcf564ed764c38e1d748f700ab921 *./tests/data/lavfi/pixfmts_vflip_le-bgr4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_vflip_le-bgr4_byte.nut
-bd7b3ec4d684dfad075d89a606cb8b74 *./tests/data/lavfi/pixfmts_vflip_le-bgr555le.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-bgr555le.nut
-fdb617533e1e7ff512ea5b6b6233e738 *./tests/data/lavfi/pixfmts_vflip_le-bgr565le.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-bgr565le.nut
-c60f93fd152c6903391d1fe9decd3547 *./tests/data/lavfi/pixfmts_vflip_le-bgr8.nut
-5070254 ./tests/data/lavfi/pixfmts_vflip_le-bgr8.nut
-7f9b799fb48544e49ce93e91d7f9fca8 *./tests/data/lavfi/pixfmts_vflip_le-bgra.nut
-20276703 ./tests/data/lavfi/pixfmts_vflip_le-bgra.nut
-30d9014a9d43b5f37e7aa64be3a3ecfc *./tests/data/lavfi/pixfmts_vflip_le-gray.nut
-5070254 ./tests/data/lavfi/pixfmts_vflip_le-gray.nut
-6b84b85d3326182fa1217e138249edc5 *./tests/data/lavfi/pixfmts_vflip_le-gray16be.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-gray16be.nut
-66bb8faa09dc149734aca3c768a6d4e1 *./tests/data/lavfi/pixfmts_vflip_le-gray16le.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-gray16le.nut
-d0cf8732677a5360b6160133043590d8 *./tests/data/lavfi/pixfmts_vflip_le-monob.nut
-634329 ./tests/data/lavfi/pixfmts_vflip_le-monob.nut
-ff9869d067ecb94eb9d90c9750c31fea *./tests/data/lavfi/pixfmts_vflip_le-monow.nut
-634329 ./tests/data/lavfi/pixfmts_vflip_le-monow.nut
-046f00f598ce14d9854a3534a5c99114 *./tests/data/lavfi/pixfmts_vflip_le-nv12.nut
-7604654 ./tests/data/lavfi/pixfmts_vflip_le-nv12.nut
-01ea369dd2d0d3ed7451dc5c8d61497f *./tests/data/lavfi/pixfmts_vflip_le-nv21.nut
-7604654 ./tests/data/lavfi/pixfmts_vflip_le-nv21.nut
-eaefabc168d0b14576bab45bc1e56e1e *./tests/data/lavfi/pixfmts_vflip_le-rgb24.nut
-15207903 ./tests/data/lavfi/pixfmts_vflip_le-rgb24.nut
-4e0c384163ebab06a08e74637beb02bc *./tests/data/lavfi/pixfmts_vflip_le-rgb48be.nut
-30414303 ./tests/data/lavfi/pixfmts_vflip_le-rgb48be.nut
-a77bfeefcd96750cf0e1917a2e2bf1e7 *./tests/data/lavfi/pixfmts_vflip_le-rgb48le.nut
-30414303 ./tests/data/lavfi/pixfmts_vflip_le-rgb48le.nut
-8c6ff02df0b06dd2d574836c3741b2a2 *./tests/data/lavfi/pixfmts_vflip_le-rgb4_byte.nut
-5070254 ./tests/data/lavfi/pixfmts_vflip_le-rgb4_byte.nut
-4f8eaad29a17e0f8e9d8ab743e76b999 *./tests/data/lavfi/pixfmts_vflip_le-rgb555le.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-rgb555le.nut
-73f247a3315dceaea3022ac7c197c5ef *./tests/data/lavfi/pixfmts_vflip_le-rgb565le.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-rgb565le.nut
-13a8d89ef78d8127297d899005456ff0 *./tests/data/lavfi/pixfmts_vflip_le-rgb8.nut
-5070254 ./tests/data/lavfi/pixfmts_vflip_le-rgb8.nut
-1fc6e920a42ec812aaa3b2aa02f37987 *./tests/data/lavfi/pixfmts_vflip_le-rgba.nut
-20276703 ./tests/data/lavfi/pixfmts_vflip_le-rgba.nut
-ffbd36720c77398d9a0d03ce2625928f *./tests/data/lavfi/pixfmts_vflip_le-uyvy422.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-uyvy422.nut
-7bfb39d7afb49d6a6173e6b23ae321eb *./tests/data/lavfi/pixfmts_vflip_le-yuv410p.nut
-5703854 ./tests/data/lavfi/pixfmts_vflip_le-yuv410p.nut
-4a90048cc3a65fac150e53289700efe1 *./tests/data/lavfi/pixfmts_vflip_le-yuv411p.nut
-7604654 ./tests/data/lavfi/pixfmts_vflip_le-yuv411p.nut
-2e6d6062e8cad37fb3ab2c433b55f382 *./tests/data/lavfi/pixfmts_vflip_le-yuv420p.nut
-7604654 ./tests/data/lavfi/pixfmts_vflip_le-yuv420p.nut
-539076782902664a8acf381bf4f713e8 *./tests/data/lavfi/pixfmts_vflip_le-yuv420p16be.nut
-15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuv420p16be.nut
-0f609e588e5a258644ef85170d70e030 *./tests/data/lavfi/pixfmts_vflip_le-yuv420p16le.nut
-15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuv420p16le.nut
-d7f5cb44d9b0210d66d6a8762640ab34 *./tests/data/lavfi/pixfmts_vflip_le-yuv422p.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuv422p.nut
-9bd8f8c961822b586fa4cf992be54acc *./tests/data/lavfi/pixfmts_vflip_le-yuv422p16be.nut
-20276703 ./tests/data/lavfi/pixfmts_vflip_le-yuv422p16be.nut
-9c4a1239605c7952b736ac3130163f14 *./tests/data/lavfi/pixfmts_vflip_le-yuv422p16le.nut
-20276703 ./tests/data/lavfi/pixfmts_vflip_le-yuv422p16le.nut
-876385e96165acf51271b20e5d85a416 *./tests/data/lavfi/pixfmts_vflip_le-yuv440p.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuv440p.nut
-9c3c667d1613b72d15bc6d851c5eb8f7 *./tests/data/lavfi/pixfmts_vflip_le-yuv444p.nut
-15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuv444p.nut
-0f4afa4a4aacf4bb6b87641abde71ea9 *./tests/data/lavfi/pixfmts_vflip_le-yuv444p16be.nut
-30414303 ./tests/data/lavfi/pixfmts_vflip_le-yuv444p16be.nut
-8f31557bc52adfe00ae8b40a9b8c23f8 *./tests/data/lavfi/pixfmts_vflip_le-yuv444p16le.nut
-30414303 ./tests/data/lavfi/pixfmts_vflip_le-yuv444p16le.nut
-c705d1cf061d8c6580ac690b55f92276 *./tests/data/lavfi/pixfmts_vflip_le-yuva420p.nut
-12673454 ./tests/data/lavfi/pixfmts_vflip_le-yuva420p.nut
-41fd02b204da0ab62452cd14b595e2e4 *./tests/data/lavfi/pixfmts_vflip_le-yuvj420p.nut
-7604654 ./tests/data/lavfi/pixfmts_vflip_le-yuvj420p.nut
-7f6ca9bc1812cde02036d7d29a7cce43 *./tests/data/lavfi/pixfmts_vflip_le-yuvj422p.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuvj422p.nut
-40591908cca457f51dee30a86c3e8ffd *./tests/data/lavfi/pixfmts_vflip_le-yuvj440p.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuvj440p.nut
-77e5e095881c52a04fd9f5abd1d7b5ac *./tests/data/lavfi/pixfmts_vflip_le-yuvj444p.nut
-15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuvj444p.nut
-e944ff7316cd03c42c091717ce74f602 *./tests/data/lavfi/pixfmts_vflip_le-yuyv422.nut
-10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuyv422.nut
+abgr                25e72e9dbd01ab00727c976d577f7be5
+argb                19869bf1a5ac0b6af4d8bbe2c104533c
+bgr24               89108a4ba00201f79b75b9305c42352d
+bgr4_byte           407fcf564ed764c38e1d748f700ab921
+bgr555le            bd7b3ec4d684dfad075d89a606cb8b74
+bgr565le            fdb617533e1e7ff512ea5b6b6233e738
+bgr8                c60f93fd152c6903391d1fe9decd3547
+bgra                7f9b799fb48544e49ce93e91d7f9fca8
+gray                30d9014a9d43b5f37e7aa64be3a3ecfc
+gray16be            6b84b85d3326182fa1217e138249edc5
+gray16le            66bb8faa09dc149734aca3c768a6d4e1
+monob               d0cf8732677a5360b6160133043590d8
+monow               ff9869d067ecb94eb9d90c9750c31fea
+nv12                046f00f598ce14d9854a3534a5c99114
+nv21                01ea369dd2d0d3ed7451dc5c8d61497f
+rgb24               eaefabc168d0b14576bab45bc1e56e1e
+rgb48be             4e0c384163ebab06a08e74637beb02bc
+rgb48le             a77bfeefcd96750cf0e1917a2e2bf1e7
+rgb4_byte           8c6ff02df0b06dd2d574836c3741b2a2
+rgb555le            4f8eaad29a17e0f8e9d8ab743e76b999
+rgb565le            73f247a3315dceaea3022ac7c197c5ef
+rgb8                13a8d89ef78d8127297d899005456ff0
+rgba                1fc6e920a42ec812aaa3b2aa02f37987
+uyvy422             ffbd36720c77398d9a0d03ce2625928f
+yuv410p             7bfb39d7afb49d6a6173e6b23ae321eb
+yuv411p             4a90048cc3a65fac150e53289700efe1
+yuv420p             2e6d6062e8cad37fb3ab2c433b55f382
+yuv420p16be         539076782902664a8acf381bf4f713e8
+yuv420p16le         0f609e588e5a258644ef85170d70e030
+yuv422p             d7f5cb44d9b0210d66d6a8762640ab34
+yuv422p16be         9bd8f8c961822b586fa4cf992be54acc
+yuv422p16le         9c4a1239605c7952b736ac3130163f14
+yuv440p             876385e96165acf51271b20e5d85a416
+yuv444p             9c3c667d1613b72d15bc6d851c5eb8f7
+yuv444p16be         0f4afa4a4aacf4bb6b87641abde71ea9
+yuv444p16le         8f31557bc52adfe00ae8b40a9b8c23f8
+yuva420p            c705d1cf061d8c6580ac690b55f92276
+yuvj420p            41fd02b204da0ab62452cd14b595e2e4
+yuvj422p            7f6ca9bc1812cde02036d7d29a7cce43
+yuvj440p            40591908cca457f51dee30a86c3e8ffd
+yuvj444p            77e5e095881c52a04fd9f5abd1d7b5ac
+yuyv422             e944ff7316cd03c42c091717ce74f602
diff --git a/ffmpeg-mt/tests/ref/lavfi/scale200 b/ffmpeg-mt/tests/ref/lavfi/scale200
index 6bbe88b..17103a2 100644
--- a/ffmpeg-mt/tests/ref/lavfi/scale200
+++ b/ffmpeg-mt/tests/ref/lavfi/scale200
@@ -1,2 +1 @@
-aebdc1c3e08da2a925ba7212b1fadee0 *./tests/data/lavfi/scale200.nut
-3001204 ./tests/data/lavfi/scale200.nut
+scale200            aebdc1c3e08da2a925ba7212b1fadee0
diff --git a/ffmpeg-mt/tests/ref/lavfi/scale500 b/ffmpeg-mt/tests/ref/lavfi/scale500
index 52e8495..93ba4f2 100644
--- a/ffmpeg-mt/tests/ref/lavfi/scale500
+++ b/ffmpeg-mt/tests/ref/lavfi/scale500
@@ -1,2 +1 @@
-ef865c51156e55ce1ce38c8f90a709e6 *./tests/data/lavfi/scale500.nut
-18751503 ./tests/data/lavfi/scale500.nut
+scale500            ef865c51156e55ce1ce38c8f90a709e6
diff --git a/ffmpeg-mt/tests/ref/lavfi/vflip b/ffmpeg-mt/tests/ref/lavfi/vflip
index 977f2d2..66b8732 100644
--- a/ffmpeg-mt/tests/ref/lavfi/vflip
+++ b/ffmpeg-mt/tests/ref/lavfi/vflip
@@ -1,2 +1 @@
-2e6d6062e8cad37fb3ab2c433b55f382 *./tests/data/lavfi/vflip.nut
-7604654 ./tests/data/lavfi/vflip.nut
+vflip               2e6d6062e8cad37fb3ab2c433b55f382
diff --git a/ffmpeg-mt/tests/ref/lavfi/vflip_crop b/ffmpeg-mt/tests/ref/lavfi/vflip_crop
index bd19894..6bb832f 100644
--- a/ffmpeg-mt/tests/ref/lavfi/vflip_crop
+++ b/ffmpeg-mt/tests/ref/lavfi/vflip_crop
@@ -1,2 +1 @@
-72ee0d0dfc8af0cd94a466760313654d *./tests/data/lavfi/vflip_crop.nut
-3554654 ./tests/data/lavfi/vflip_crop.nut
+vflip_crop          72ee0d0dfc8af0cd94a466760313654d
diff --git a/ffmpeg-mt/tests/ref/lavfi/vflip_vflip b/ffmpeg-mt/tests/ref/lavfi/vflip_vflip
index 55595dd..b719745 100644
--- a/ffmpeg-mt/tests/ref/lavfi/vflip_vflip
+++ b/ffmpeg-mt/tests/ref/lavfi/vflip_vflip
@@ -1,2 +1 @@
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/vflip_vflip.nut
-7604654 ./tests/data/lavfi/vflip_vflip.nut
+vflip_vflip         eba2f135a08829387e2f698ff72a2939
diff --git a/ffmpeg-mt/tests/ref/seek/ac3_rm b/ffmpeg-mt/tests/ref/seek/ac3_rm
index 7b7d5b0..4705447 100644
--- a/ffmpeg-mt/tests/ref/seek/ac3_rm
+++ b/ffmpeg-mt/tests/ref/seek/ac3_rm
@@ -5,7 +5,8 @@ ret:-1         st:-1 flags:1  ts: 1.894167
 ret:-1         st: 0 flags:0  ts: 0.788000
 ret: 0         st: 0 flags:1  ts:-0.317000
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret:-1         st:-1 flags:0  ts: 2.576668
+ret: 0         st:-1 flags:0  ts: 2.576668
+ret: 0         st: 0 flags:1 dts: 2.577000 pts: 2.577000 pos:  42397 size:   558
 ret:-1         st:-1 flags:1  ts: 1.470835
 ret:-1         st: 0 flags:0  ts: 0.365000
 ret: 0         st: 0 flags:1  ts:-0.741000
@@ -19,7 +20,8 @@ ret:-1         st:-1 flags:0  ts: 1.730004
 ret:-1         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:0  ts:-0.482000
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret:-1         st: 0 flags:1  ts: 2.413000
+ret: 0         st: 0 flags:1  ts: 2.413000
+ret: 0         st: 0 flags:1 dts: 2.368000 pts: 2.368000 pos:  38981 size:   558
 ret:-1         st:-1 flags:0  ts: 1.306672
 ret:-1         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:0  ts:-0.905000
@@ -28,7 +30,8 @@ ret:-1         st: 0 flags:1  ts: 1.989000
 ret:-1         st:-1 flags:0  ts: 0.883340
 ret: 0         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret:-1         st: 0 flags:0  ts: 2.672000
+ret: 0         st: 0 flags:0  ts: 2.672000
+ret: 0         st: 0 flags:1 dts: 2.821000 pts: 2.821000 pos:  46383 size:   556
 ret:-1         st: 0 flags:1  ts: 1.566000
 ret:-1         st:-1 flags:0  ts: 0.460008
 ret: 0         st:-1 flags:1  ts:-0.645825
diff --git a/ffmpeg-mt/tests/ref/seek/lavf_asf b/ffmpeg-mt/tests/ref/seek/lavf_asf
index afaed99..757fd0e 100644
--- a/ffmpeg-mt/tests/ref/seek/lavf_asf
+++ b/ffmpeg-mt/tests/ref/seek/lavf_asf
@@ -1,53 +1,47 @@
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    575 size: 28487
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 1 flags:1 dts: 3.544000 pts: 3.544000 pos: 147775 size:   209
+ret: 0         st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size:   209
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
 ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 1 flags:0  ts: 2.577000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    575 size: 28487
+ret:-1         st: 1 flags:0  ts: 2.577000
+ret:-1         st: 1 flags:1  ts: 1.471000
 ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size:   209
 ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    575 size: 28487
 ret: 0         st: 0 flags:0  ts: 2.153000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
 ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
 ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
+ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:  29375 size:   208
+ret:-1         st: 1 flags:1  ts: 2.836000
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size:   209
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    575 size: 28487
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 1 flags:0  ts: 1.307000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
+ret:-1         st: 1 flags:0  ts: 1.307000
 ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
+ret: 0         st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos:  70975 size:   209
 ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    575 size: 28487
 ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
 ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:   209
 ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 1 flags:0  ts: 2.672000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    575 size: 28487
+ret:-1         st: 1 flags:0  ts: 2.672000
+ret:-1         st: 1 flags:1  ts: 1.566000
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size:   209
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    575 size: 28487
diff --git a/ffmpeg-mt/tests/ref/seek/wmav1_asf b/ffmpeg-mt/tests/ref/seek/wmav1_asf
index a2892b6..47c5b46 100644
--- a/ffmpeg-mt/tests/ref/seek/wmav1_asf
+++ b/ffmpeg-mt/tests/ref/seek/wmav1_asf
@@ -1,53 +1,53 @@
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 3.286000 pts: 3.286000 pos:   3604 size:   743
+ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   3604 size:   743
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  32404 size:   743
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  16404 size:   743
 ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
 ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos:  45204 size:   743
 ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 1.300000 pts: 1.300000 pos:  22804 size:   743
 ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:   6804 size:   743
 ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
 ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos:  38804 size:   743
 ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  16404 size:   743
 ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
 ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos:  48404 size:   743
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  32404 size:   743
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos:  10004 size:   743
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos:  38804 size:   743
 ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos:  26004 size:   743
 ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   3604 size:   743
 ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
 ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  32404 size:   743
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  16404 size:   743
 ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
 ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos:  48404 size:   743
 ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos:  26004 size:   743
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos:  10004 size:   743
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    404 size:   743
diff --git a/ffmpeg-mt/tests/ref/seek/wmav2_asf b/ffmpeg-mt/tests/ref/seek/wmav2_asf
index bd1b79e..7c58da2 100644
--- a/ffmpeg-mt/tests/ref/seek/wmav2_asf
+++ b/ffmpeg-mt/tests/ref/seek/wmav2_asf
@@ -1,53 +1,53 @@
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 3.286000 pts: 3.286000 pos:   3644 size:   743
+ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   3644 size:   743
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  32444 size:   743
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  16444 size:   743
 ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
 ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos:  45244 size:   743
 ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 1.300000 pts: 1.300000 pos:  22844 size:   743
 ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:   6844 size:   743
 ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
 ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos:  38844 size:   743
 ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  16444 size:   743
 ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
 ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos:  48444 size:   743
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  32444 size:   743
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos:  10044 size:   743
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos:  38844 size:   743
 ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos:  26044 size:   743
 ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   3644 size:   743
 ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
 ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  32444 size:   743
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  16444 size:   743
 ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
 ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos:  48444 size:   743
 ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos:  26044 size:   743
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos:  10044 size:   743
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    444 size:   743
diff --git a/ffmpeg-mt/tests/ref/vsynth1/qtrle b/ffmpeg-mt/tests/ref/vsynth1/qtrle
index 8aa578f..9988897 100644
--- a/ffmpeg-mt/tests/ref/vsynth1/qtrle
+++ b/ffmpeg-mt/tests/ref/vsynth1/qtrle
@@ -1,4 +1,4 @@
-3f070779d7deb54626515ac7f7002e63 *./tests/data/vsynth1/qtrle.mov
-387772 ./tests/data/vsynth1/qtrle.mov
-a3c2610e2c069c3ad22ec03da83f774f *./tests/data/qtrle.vsynth1.out.yuv
-stddev:   15.14 PSNR: 24.53 MAXDIFF:  174 bytes:  7603200/  7603200
+d14041925ce5ec5001dc519276b1a1ab *./tests/data/vsynth1/qtrle.mov
+15263232 ./tests/data/vsynth1/qtrle.mov
+243325fb2cae1a9245efd49aff936327 *./tests/data/qtrle.vsynth1.out.yuv
+stddev:    3.42 PSNR: 37.43 MAXDIFF:   48 bytes:  7603200/  7603200
diff --git a/ffmpeg-mt/tests/ref/vsynth2/qtrle b/ffmpeg-mt/tests/ref/vsynth2/qtrle
index 756ed69..6b2a011 100644
--- a/ffmpeg-mt/tests/ref/vsynth2/qtrle
+++ b/ffmpeg-mt/tests/ref/vsynth2/qtrle
@@ -1,4 +1,4 @@
-5346bba8e03e7de72b482efbcf712a2e *./tests/data/vsynth2/qtrle.mov
-141533 ./tests/data/vsynth2/qtrle.mov
-f967b290c7e6d015c0e78175db828249 *./tests/data/qtrle.vsynth2.out.yuv
-stddev:    5.75 PSNR: 32.93 MAXDIFF:   92 bytes:  7603200/  7603200
+d8c1604dc46d9aa4ec0385e6722c6989 *./tests/data/vsynth2/qtrle.mov
+14798419 ./tests/data/vsynth2/qtrle.mov
+b2418e0e3a9a8619b31219cbcf24dc82 *./tests/data/qtrle.vsynth2.out.yuv
+stddev:    1.26 PSNR: 46.06 MAXDIFF:   13 bytes:  7603200/  7603200
diff --git a/ffmpeg-mt/tests/regression-funcs.sh b/ffmpeg-mt/tests/regression-funcs.sh
index 28da0c1..4093656 100755
--- a/ffmpeg-mt/tests/regression-funcs.sh
+++ b/ffmpeg-mt/tests/regression-funcs.sh
@@ -9,6 +9,7 @@ test_ref=$2
 raw_src_dir=$3
 target_exec=$4
 target_path=$5
+threads=${6:-1}
 
 datadir="./tests/data"
 target_datadir="${target_path}/${datadir}"
@@ -52,15 +53,20 @@ echov(){
 
 . $(dirname $0)/md5.sh
 
-FFMPEG_OPTS="-v 0 -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact"
+FFMPEG_OPTS="-v 0 -threads $threads -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact"
+
+run_ffmpeg()
+{
+    $echov $ffmpeg $FFMPEG_OPTS $*
+    $ffmpeg $FFMPEG_OPTS $*
+}
 
 do_ffmpeg()
 {
     f="$1"
     shift
     set -- $* ${target_path}/$f
-    $echov $ffmpeg $FFMPEG_OPTS $*
-    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
+    run_ffmpeg -benchmark $* > $bench
     do_md5sum $f >> $logfile
     if [ $f = $raw_dst ] ; then
         $tiny_psnr $f $raw_ref >> $logfile
@@ -78,8 +84,7 @@ do_ffmpeg_nomd5()
     f="$1"
     shift
     set -- $* ${target_path}/$f
-    $echov $ffmpeg $FFMPEG_OPTS $*
-    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
+    run_ffmpeg -benchmark $* > $bench
     if [ $f = $raw_dst ] ; then
         $tiny_psnr $f $raw_ref >> $logfile
     elif [ $f = $pcm_dst ] ; then
@@ -95,8 +100,7 @@ do_ffmpeg_crc()
 {
     f="$1"
     shift
-    $echov $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
-    $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
+    run_ffmpeg $* -f crc "$target_crcfile"
     echo "$f $(cat $crcfile)" >> $logfile
 }
 
@@ -104,8 +108,7 @@ do_ffmpeg_nocheck()
 {
     f="$1"
     shift
-    $echov $ffmpeg $FFMPEG_OPTS $*
-    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
+    run_ffmpeg -benchmark $* > $bench
     expr "$(cat $bench)" : '.*utime=\(.*s\)' > $bench2
     echo $(cat $bench2) $f >> $benchfile
 }
diff --git a/ffmpeg-mt/tests/rotozoom.c b/ffmpeg-mt/tests/rotozoom.c
index 47da1b0..25f0e02 100644
--- a/ffmpeg-mt/tests/rotozoom.c
+++ b/ffmpeg-mt/tests/rotozoom.c
@@ -3,20 +3,20 @@
  *
  * copyright (c) Sebastien Bechet <s.bechet at av7.net>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tests/seek_test.c b/ffmpeg-mt/tests/seek_test.c
index 81a7821..5d4f41c 100644
--- a/ffmpeg-mt/tests/seek_test.c
+++ b/ffmpeg-mt/tests/seek_test.c
@@ -2,20 +2,20 @@
  * Copyright (c) 2003 Fabrice Bellard
  * Copyright (c) 2007 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tests/tiny_psnr.c b/ffmpeg-mt/tests/tiny_psnr.c
index 512d47b..efa5e01 100644
--- a/ffmpeg-mt/tests/tiny_psnr.c
+++ b/ffmpeg-mt/tests/tiny_psnr.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tests/videogen.c b/ffmpeg-mt/tests/videogen.c
index 4238e3f..f114801 100644
--- a/ffmpeg-mt/tests/videogen.c
+++ b/ffmpeg-mt/tests/videogen.c
@@ -4,20 +4,20 @@
  *
  * Copyright (c) 2002 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tools/graph2dot.c b/ffmpeg-mt/tools/graph2dot.c
index 5e0da9a..5ec6e20 100644
--- a/ffmpeg-mt/tools/graph2dot.c
+++ b/ffmpeg-mt/tools/graph2dot.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008-2010 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -22,6 +22,7 @@
 
 #undef HAVE_AV_CONFIG_H
 #include "libavutil/pixdesc.h"
+#include "libavutil/audioconvert.h"
 #include "libavfilter/avfiltergraph.h"
 
 static void usage(void)
@@ -67,10 +68,18 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
                          dst_filter_ctx->filter->name);
 
                 fprintf(outfile, "\"%s\" -> \"%s\"", filter_ctx_label, dst_filter_ctx_label);
-                fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ];\n",
-                        link->type == AVMEDIA_TYPE_VIDEO ? av_pix_fmt_descriptors[link->format].name :
-                        link->type == AVMEDIA_TYPE_AUDIO ? av_get_sample_fmt_name(link->format) : "unknown",
-                        link->w, link->h, link->time_base.num, link->time_base.den);
+                if (link->type == AVMEDIA_TYPE_VIDEO) {
+                    fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]",
+                            av_pix_fmt_descriptors[link->format].name,
+                            link->w, link->h, link->time_base.num, link->time_base.den);
+                } else if (link->type == AVMEDIA_TYPE_AUDIO) {
+                    char buf[255];
+                    av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
+                    fprintf(outfile, " [ label= \"fmt:%s sr:%"PRId64" cl:%s\" ]",
+                            av_get_sample_fmt_name(link->format),
+                            link->sample_rate, buf);
+                }
+                fprintf(outfile, ";\n");
             }
         }
     }
diff --git a/ffmpeg-mt/tools/lavfi-showfiltfmts.c b/ffmpeg-mt/tools/lavfi-showfiltfmts.c
index 19bb6f6..30d4725 100644
--- a/ffmpeg-mt/tools/lavfi-showfiltfmts.c
+++ b/ffmpeg-mt/tools/lavfi-showfiltfmts.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2009 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tools/pktdumper.c b/ffmpeg-mt/tools/pktdumper.c
index ee60414..3ab39ee 100644
--- a/ffmpeg-mt/tools/pktdumper.c
+++ b/ffmpeg-mt/tools/pktdumper.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2005 Francois Revol
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tools/probetest.c b/ffmpeg-mt/tools/probetest.c
index b4bb5ae..7f8d54e 100644
--- a/ffmpeg-mt/tools/probetest.c
+++ b/ffmpeg-mt/tools/probetest.c
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/tools/qt-faststart.c b/ffmpeg-mt/tools/qt-faststart.c
index ace4c11..eefeafd 100644
--- a/ffmpeg-mt/tools/qt-faststart.c
+++ b/ffmpeg-mt/tools/qt-faststart.c
@@ -8,7 +8,7 @@
  * is in front of the data, thus facilitating network streaming.
  *
  * To compile this program, start from the base directory from which you
- * are building FFmpeg and type:
+ * are building Libav and type:
  *  make tools/qt-faststart
  * The qt-faststart program will be built in the tools/ directory. If you
  * do not build the program in this manner, correct results are not
diff --git a/ffmpeg-mt/tools/trasher.c b/ffmpeg-mt/tools/trasher.c
index 114eb78..e099aa3 100644
--- a/ffmpeg-mt/tools/trasher.c
+++ b/ffmpeg-mt/tools/trasher.c
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2007 Michael Niedermayer
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/ffmpeg-mt/version.sh b/ffmpeg-mt/version.sh
index f45c60d..6ec2b25 100755
--- a/ffmpeg-mt/version.sh
+++ b/ffmpeg-mt/version.sh
@@ -1,33 +1,15 @@
 #!/bin/sh
 
-# check for SVN revision number
-revision=$(cd "$1" && cat snapshot_version 2> /dev/null)
-test $revision || revision=$(cd "$1" && LC_ALL=C svn info 2> /dev/null | grep "Last Changed Rev" | cut -d' ' -f4)
-test $revision || revision=$(cd "$1" && grep committed-rev .svn/entries 2>/dev/null | head -n 1 | cut -d '"' -f2)
-test $revision || revision=$(cd "$1" && sed -n -e '/^dir$/{n
-p
-q
-}' .svn/entries 2>/dev/null)
-test $revision && revision=SVN-r$revision
-
-# check for git svn revision number
-if ! test $revision; then
-    revision=$(cd "$1" && git svn find-rev HEAD 2> /dev/null)
-    test $revision && revision=git-svn-r$revision
-fi
-
 # check for git short hash
-if ! test $revision; then
-    revision=$(cd "$1" && git describe --always 2> /dev/null)
-    test $revision && revision=git-$revision
-fi
+revision=$(cd "$1" && git describe --always 2> /dev/null)
+test "$revision" && revision=git-$revision
 
 # no revision number found
-test $revision || revision=UNKNOWN
+test "$revision" || revision=UNKNOWN
 
 # releases extract the version number from the VERSION file
 version=$(cd "$1" && cat VERSION 2> /dev/null)
-test $version || version=$revision
+test "$version" || version=$revision
 
 test -n "$3" && version=$version-$3
 
@@ -36,7 +18,7 @@ if [ -z "$2" ]; then
     exit
 fi
 
-NEW_REVISION="#define FFMPEG_VERSION \"$version\""
+NEW_REVISION="#define LIBAV_VERSION \"$version\""
 OLD_REVISION=$(cat version.h 2> /dev/null)
 
 # Update version.h only on revision changes to avoid spurious rebuilds
diff --git a/libass/.gitignore b/libass/.gitignore
index 8c2001f..8df5344 100644
--- a/libass/.gitignore
+++ b/libass/.gitignore
@@ -16,6 +16,6 @@ Makefile.in
 /libtool
 /ltmain.sh
 /missing
+/compile
 /libass.pc
-/shave/shave
-/shave/shave-libtool
+/m4
diff --git a/libass/Makefile.in b/libass/Makefile.in
index f9479d5..66c0152 100644
--- a/libass/Makefile.in
+++ b/libass/Makefile.in
@@ -150,6 +150,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -181,6 +182,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -210,6 +212,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -242,7 +245,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff --git a/libass/aclocal.m4 b/libass/aclocal.m4
index 79938b7..47de7f1 100644
--- a/libass/aclocal.m4
+++ b/libass/aclocal.m4
@@ -13,8 +13,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
-[m4_warning([this file was generated for autoconf 2.67.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
diff --git a/libass/autom4te.cache/output.0 b/libass/autom4te.cache/output.0
index 44cd9f6..1976fdf 100644
--- a/libass/autom4te.cache/output.0
+++ b/libass/autom4te.cache/output.0
@@ -1,6 +1,6 @@
 @%:@! /bin/sh
 @%:@ Guess values for system-dependent variables and create Makefiles.
-@%:@ Generated by GNU Autoconf 2.67 for libass 0.9.11.
+@%:@ Generated by GNU Autoconf 2.68 for libass 0.9.11.
 @%:@ 
 @%:@ 
 @%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -89,6 +89,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in @%:@((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -171,6 +172,14 @@ test x\$exitcode = x0 || exit 1"
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
 test \$(( 1 + 1 )) = 2 || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
@@ -214,11 +223,18 @@ IFS=$as_save_IFS
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
+	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+	case $- in @%:@ ((((
+	  *v*x* | *x*v* ) as_opts=-vx ;;
+	  *v* ) as_opts=-v ;;
+	  *x* ) as_opts=-x ;;
+	  * ) as_opts= ;;
+	esac
+	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -525,155 +541,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
-
-
-# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-$*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "$0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
 
 test -n "$DJDIR" || exec 7<&0 </dev/null
 exec 6>&1
@@ -766,9 +635,11 @@ OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-lt_ECHO
+MANIFEST_TOOL
 RANLIB
+ac_ct_AR
 AR
+DLLTOOL
 OBJDUMP
 LN_S
 NM
@@ -874,6 +745,7 @@ with_pic
 enable_fast_install
 enable_dependency_tracking
 with_gnu_ld
+with_sysroot
 enable_libtool_lock
 enable_test
 enable_enca
@@ -1304,7 +1176,7 @@ Try \`$0 --help' for more information"
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1540,6 +1412,8 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects @<:@default=use
                           both@:>@
   --with-gnu-ld           assume the C compiler uses GNU ld @<:@default=no@:>@
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
 
 Some influential environment variables:
   CC          C compiler command
@@ -1636,7 +1510,7 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 libass configure 0.9.11
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1682,7 +1556,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_compile
@@ -1728,7 +1602,7 @@ fi
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_link
@@ -1742,7 +1616,7 @@ ac_fn_c_check_header_compile ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1760,7 +1634,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_header_compile
 
@@ -1796,7 +1670,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_cpp
@@ -1838,7 +1712,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_run
@@ -1851,7 +1725,7 @@ ac_fn_c_check_func ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1906,7 +1780,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_func
 
@@ -1919,7 +1793,7 @@ ac_fn_c_check_type ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1960,7 +1834,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_type
 
@@ -1972,10 +1846,10 @@ $as_echo "$ac_res" >&6; }
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval "test \"\${$3+set}\"" = set; then :
+  if eval \${$3+:} false; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2038,7 +1912,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2047,7 +1921,7 @@ eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_header_mongrel
 
@@ -2060,7 +1934,7 @@ ac_fn_c_find_intX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
 $as_echo_n "checking for int$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2121,7 +1995,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_find_intX_t
 
@@ -2134,7 +2008,7 @@ ac_fn_c_find_uintX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
 $as_echo_n "checking for uint$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2174,7 +2048,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_find_uintX_t
 cat >config.log <<_ACEOF
@@ -2182,7 +2056,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2440,7 +2314,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
@@ -2516,7 +2390,7 @@ if $ac_cache_corrupted; then
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
 ## -------------------- ##
 ## Main body of script. ##
@@ -2548,7 +2422,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2577,7 +2451,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2664,11 +2538,11 @@ am_lf='
 '
 case `pwd` in
   *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
 esac
 
 # Do `set' in a subshell so we don't clobber the current shell's
@@ -2691,7 +2565,7 @@ if (
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
       as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5 
+alias in your environment" "$LINENO" 5
    fi
 
    test "$2" = conftest.file
@@ -2701,7 +2575,7 @@ then
    :
 else
    as_fn_error $? "newly created file is older than distributed files!
-Check your system clock" "$LINENO" 5 
+Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -2754,7 +2628,7 @@ if test "$cross_compiling" != no; then
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -2794,7 +2668,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -2847,7 +2721,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then :
+  if ${ac_cv_path_mkdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2898,7 +2772,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2938,7 +2812,7 @@ done
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2980,7 +2854,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
   am__isrc=' -I$(srcdir)'
   # test to see if srcdir already configured
   if test -f $srcdir/config.status; then
-    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
   fi
 fi
 
@@ -3048,8 +2922,8 @@ esac
 
 
 
-macro_version='2.2.6b'
-macro_revision='1.3017'
+macro_version='2.4'
+macro_revision='1.3293'
 
     
     
@@ -3067,27 +2941,27 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -3105,14 +2979,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
@@ -3120,7 +2994,7 @@ fi
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -3136,6 +3010,75 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "" 
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+    
+    
+    
+
+
+    
+    
+    
+
+
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
@@ -3208,7 +3151,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3248,7 +3191,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3301,7 +3244,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3341,7 +3284,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3400,7 +3343,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3444,7 +3387,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3499,7 +3442,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3614,7 +3557,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3657,7 +3600,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3716,7 +3659,7 @@ $as_echo "$ac_try_echo"; } >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
@@ -3727,7 +3670,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3768,7 +3711,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -3778,7 +3721,7 @@ OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3815,7 +3758,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -3893,7 +3836,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -3992,7 +3935,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4117,7 +4060,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -4172,7 +4115,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_SED"; then
-    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
   ac_cv_path_SED=$SED
@@ -4199,7 +4142,7 @@ Xsed="$SED -e 1s/^X//"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -4248,7 +4191,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
@@ -4262,7 +4205,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4314,7 +4257,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -4329,7 +4272,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then :
+if ${ac_cv_path_FGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -4381,7 +4324,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_FGREP"; then
-    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_FGREP=$FGREP
@@ -4460,7 +4403,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then :
+if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -4497,10 +4440,10 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+if ${lt_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -4527,7 +4470,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then :
+if ${lt_cv_path_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -4580,14 +4523,17 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -4625,13 +4571,13 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  for ac_prog in dumpbin "link -dump"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DUMPBIN"; then
@@ -4680,6 +4626,15 @@ esac
   fi
 fi
 
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -4694,18 +4649,18 @@ test -z "$NM" && NM=nm
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
 $as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then :
+if ${lt_cv_nm_interface+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:__oline__: output\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -4729,7 +4684,7 @@ fi
 # find the maximum length of command line arguments
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
 $as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+if ${lt_cv_sys_max_cmd_len+:} false; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
@@ -4762,6 +4717,11 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -4826,8 +4786,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -4869,8 +4829,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6;
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -4919,9 +4879,83 @@ esac
     
     
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+    
+    
+    
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+    
+    
+    
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then :
+if ${lt_cv_ld_reload_flag+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
@@ -4935,6 +4969,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -4957,7 +4996,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -4997,7 +5036,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then
 set dummy objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -5056,7 +5095,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
 $as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then :
+if ${lt_cv_deplibs_check_method+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -5098,16 +5137,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -5137,6 +5178,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -5145,11 +5190,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -5252,6 +5297,21 @@ esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -5267,12 +5327,166 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
     
 
 
+    
+    
+    
+
+
+    
+    
+    
+
+
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+    
+    
+    
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+    
+    
+    
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -5285,7 +5499,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5305,14 +5519,18 @@ $as_echo "no" >&6; }
 fi
 
 
+    test -n "$AR" && break
+  done
 fi
-if test -z "$ac_cv_prog_AR"; then
+if test -z "$AR"; then
   ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -5325,7 +5543,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
+    ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5344,6 +5562,10 @@ else
 $as_echo "no" >&6; }
 fi
 
+
+  test -n "$ac_ct_AR" && break
+done
+
   if test "x$ac_ct_AR" = x; then
     AR="false"
   else
@@ -5355,29 +5577,85 @@ ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
   fi
-else
-  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+    
+    
+    
+
 
     
     
     
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
     
     
     
 
 
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -5417,7 +5695,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -5476,7 +5754,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -5516,7 +5794,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
 set dummy ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -5587,6 +5865,18 @@ if test -n "$RANLIB"; then
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+    
+    
+    
+
+
     
     
     
@@ -5633,7 +5923,7 @@ compiler=$CC
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   
@@ -5694,8 +5984,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -5731,6 +6021,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -5756,8 +6047,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && test -s "$nlist"; then
@@ -5772,6 +6063,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -5783,7 +6086,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT@&t at _DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -5809,8 +6112,8 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
@@ -5820,8 +6123,8 @@ _LT_EOF
   test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -5858,6 +6161,13 @@ else
 $as_echo "ok" >&6; }
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
 
     
     
@@ -5879,6 +6189,47 @@ fi
     
 
 
+    
+    
+    
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+@%:@ Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot; 
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+    
+    
+    
 
 @%:@ Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
@@ -5911,7 +6262,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line __oline__ "configure"' > conftest.$ac_ext
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6005,7 +6356,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   CFLAGS="$CFLAGS -belf"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then :
+if ${lt_cv_cc_needs_belf+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -6073,6 +6424,123 @@ esac
 
 need_locks="$enable_libtool_lock"
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+    
+    
+    
+
 
   case $host_os in
     rhapsody* | darwin*)
@@ -6081,7 +6549,7 @@ need_locks="$enable_libtool_lock"
 set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DSYMUTIL"; then
@@ -6121,7 +6589,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
 set dummy dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DSYMUTIL"; then
@@ -6173,7 +6641,7 @@ fi
 set dummy ${ac_tool_prefix}nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NMEDIT"; then
@@ -6213,7 +6681,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then
 set dummy nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NMEDIT"; then
@@ -6265,7 +6733,7 @@ fi
 set dummy ${ac_tool_prefix}lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then :
+if ${ac_cv_prog_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LIPO"; then
@@ -6305,7 +6773,7 @@ if test -z "$ac_cv_prog_LIPO"; then
 set dummy lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LIPO"; then
@@ -6357,7 +6825,7 @@ fi
 set dummy ${ac_tool_prefix}otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then :
+if ${ac_cv_prog_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL"; then
@@ -6397,7 +6865,7 @@ if test -z "$ac_cv_prog_OTOOL"; then
 set dummy otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL"; then
@@ -6449,7 +6917,7 @@ fi
 set dummy ${ac_tool_prefix}otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL64"; then
@@ -6489,7 +6957,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then
 set dummy otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL64"; then
@@ -6564,7 +7032,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
 $as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+if ${lt_cv_apple_cc_single_mod+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
@@ -6593,7 +7061,7 @@ fi
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_exported_symbols_list=no
@@ -6623,6 +7091,38 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -6650,7 +7150,7 @@ $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -6670,7 +7170,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -6786,7 +7286,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -6798,7 +7298,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6929,7 +7429,7 @@ for ac_header in dlfcn.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
 "
-if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 @%:@define HAVE_DLFCN_H 1
 _ACEOF
@@ -6940,6 +7440,8 @@ done
 
 
 
+
+
 # Set options
 
 
@@ -7069,6 +7571,7 @@ LIBTOOL_DEPS="$ltmain"
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
+
     
     
     
@@ -7113,7 +7616,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
 $as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then :
+if ${lt_cv_objdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
@@ -7141,19 +7644,6 @@ _ACEOF
 
 
 
-
-
-    
-    
-    
-
-
-    
-    
-    
-
-
-
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -7166,23 +7656,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -7211,7 +7684,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -7221,7 +7694,7 @@ file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7287,7 +7760,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
 $as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7420,11 +7893,16 @@ if test -n "$compiler"; then
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
@@ -7440,15 +7918,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -7477,8 +7955,6 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -7526,6 +8002,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -7568,6 +8050,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -7630,7 +8119,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -7642,25 +8137,25 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_wl=''
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	*Sun\ C*)
+	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
+	  lt_prog_compiler_wl='-Wl,'
 	  ;;
 	esac
 	;;
@@ -7692,7 +8187,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -7749,13 +8244,17 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic@&t@ -DPIC"
     ;;
 esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-    
-    
-    
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
@@ -7763,7 +8262,7 @@ $as_echo "$lt_prog_compiler_pic" >&6; }
 if test -n "$lt_prog_compiler_pic"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works=no
@@ -7779,15 +8278,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -7816,13 +8315,18 @@ fi
     
 
 
+
+    
+    
+    
+
 #
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
@@ -7835,7 +8339,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -7865,7 +8369,7 @@ fi
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7884,16 +8388,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -7920,7 +8424,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7939,16 +8443,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8058,13 +8562,39 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu)
+  linux* | k*bsd*-gnu | gnu*)
     link_all_deplibs=no
     ;;
   esac
 
   ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -8098,11 +8628,12 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -8138,10 +8669,12 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -8159,6 +8692,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -8184,15 +8722,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -8203,13 +8742,17 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -8225,17 +8768,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
 	  hardcode_libdir_flag_spec=
 	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -8249,8 +8792,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -8268,8 +8811,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8315,8 +8858,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8356,8 +8899,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -8445,7 +8990,13 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8458,25 +9009,32 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+  
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -8485,7 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8498,30 +9062,42 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+  
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -8553,20 +9129,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -8576,7 +9195,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec=''
+  fi
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -8584,7 +9207,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -8627,7 +9250,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -8635,7 +9258,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -8650,8 +9273,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -8669,16 +9292,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -8690,7 +9313,46 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
 	  ;;
 	esac
       fi
@@ -8718,26 +9380,39 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foo(void) {}
+int foo (void) { return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-        
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8799,17 +9474,17 @@ rm -f core conftest.err conftest.$ac_objext \
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8819,13 +9494,13 @@ rm -f core conftest.err conftest.$ac_objext \
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -8838,9 +9513,9 @@ rm -f core conftest.err conftest.$ac_objext \
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -9028,44 +9703,50 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
@@ -9236,16 +9917,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -9258,7 +9946,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -9278,7 +9966,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -9366,7 +10060,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -9397,8 +10091,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -9419,36 +10114,83 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -9532,6 +10274,20 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -9577,8 +10333,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[3-9]*)
@@ -9645,12 +10403,17 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9663,13 +10426,17 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  shlibpath_overrides_runpath=yes
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -9678,7 +10445,7 @@ rm -f core conftest.err conftest.$ac_objext \
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -9993,6 +10760,11 @@ fi
     
 
 
+    
+    
+    
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
@@ -10065,7 +10837,7 @@ else
   # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10099,7 +10871,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   
@@ -10113,12 +10885,12 @@ fi
 
   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = x""yes; then :
+if test "x$ac_cv_func_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+if ${ac_cv_lib_dld_shl_load+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10152,16 +10924,16 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = x""yes; then :
+if test "x$ac_cv_func_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10195,12 +10967,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+if ${ac_cv_lib_svld_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10234,12 +11006,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+if ${ac_cv_lib_dld_dld_link+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10273,7 +11045,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
@@ -10314,7 +11086,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
 $as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then :
+if ${lt_cv_dlopen_self+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10323,7 +11095,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line __oline__ "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10364,7 +11136,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10373,7 +11151,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10410,7 +11192,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; }
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then :
+if ${lt_cv_dlopen_self_static+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10419,7 +11201,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line __oline__ "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10460,7 +11242,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10469,7 +11257,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10661,7 +11453,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10701,7 +11493,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10754,7 +11546,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10794,7 +11586,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10853,7 +11645,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10897,7 +11689,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10952,7 +11744,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -10981,7 +11773,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11018,7 +11810,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -11096,7 +11888,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -11195,7 +11987,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -11330,7 +12122,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -11446,7 +12238,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -11464,7 +12256,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
 fi
 set dummy $CC; ac_cc=`$as_echo "$2" |
 		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then :
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11585,7 +12377,7 @@ fi
 # Checks for header files.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11697,7 +12489,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then :
+if ${ac_cv_header_stdbool_h+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11729,7 +12521,7 @@ else
 	char b[false == 0 ? 1 : -1];
 	char c[__bool_true_false_are_defined == 1 ? 1 : -1];
 	char d[(bool) 0.5 == true ? 1 : -1];
-	bool e = &s;
+	/* See body of main program for 'e'.  */
 	char f[(_Bool) 0.0 == false ? 1 : -1];
 	char g[true];
 	char h[sizeof (_Bool)];
@@ -11740,25 +12532,6 @@ else
 	_Bool n[m];
 	char o[sizeof n == m * sizeof n[0] ? 1 : -1];
 	char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-#	if defined __xlc__ || defined __GNUC__
-	 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-	    reported by James Lemley on 2005-10-05; see
-	    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-	    This test is not quite right, since xlc is allowed to
-	    reject this program, as the initializer for xlcbug is
-	    not one of the forms that C requires support for.
-	    However, doing the test right would require a runtime
-	    test, and that would make cross-compilation harder.
-	    Let us hope that IBM fixes the xlc bug, and also adds
-	    support for this kind of constant expression.  In the
-	    meantime, this test will reject xlc, which is OK, since
-	    our stdbool.h substitute should suffice.  We also test
-	    this with GCC, where it should work, to detect more
-	    quickly whether someone messes up the test in the
-	    future.  */
-	 char digs[] = "0123456789";
-	 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-#	endif
 	/* Catch a bug in an HP-UX C compiler.  See
 	   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
 	   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -11770,6 +12543,7 @@ int
 main ()
 {
 
+	bool e = &s;
 	*pq |= q;
 	*pq |= ! q;
 	/* Refer to every declared value, to avoid compiler optimizations.  */
@@ -11790,7 +12564,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
 $as_echo "$ac_cv_header_stdbool_h" >&6; }
 ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = x""yes; then :
+if test "x$ac_cv_type__Bool" = xyes; then :
   
 cat >>confdefs.h <<_ACEOF
 @%:@define HAVE__BOOL 1
@@ -11822,7 +12596,7 @@ done
 # Checks for typedefs, structures, and compiler characteristics.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11902,7 +12676,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then :
+if ${ac_cv_c_inline+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_inline=no
@@ -11954,7 +12728,7 @@ _ACEOF
 esac
 
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = x""yes; then :
+if test "x$ac_cv_type_size_t" = xyes; then :
   
 else
   
@@ -12010,7 +12784,7 @@ done
 # Checks for libraries.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv_open" >&5
 $as_echo_n "checking for library containing iconv_open... " >&6; }
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -12044,11 +12818,11 @@ for ac_lib in '' iconv; do
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_iconv_open+set}" = set; then :
+  if ${ac_cv_search_iconv_open+:} false; then :
   break
 fi
 done
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
   
 else
   ac_cv_search_iconv_open=no
@@ -12068,7 +12842,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fabs in -lm" >&5
 $as_echo_n "checking for fabs in -lm... " >&6; }
-if test "${ac_cv_lib_m_fabs+set}" = set; then :
+if ${ac_cv_lib_m_fabs+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12102,7 +12876,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fabs" >&5
 $as_echo "$ac_cv_lib_m_fabs" >&6; }
-if test "x$ac_cv_lib_m_fabs" = x""yes; then :
+if test "x$ac_cv_lib_m_fabs" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 @%:@define HAVE_LIBM 1
 _ACEOF
@@ -12141,7 +12915,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -12184,7 +12958,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
@@ -12314,7 +13088,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables FREETYPE_CFLAGS
 and FREETYPE_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12329,7 +13103,7 @@ and FREETYPE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	FREETYPE_CFLAGS=$pkg_cv_FREETYPE_CFLAGS
 	FREETYPE_LIBS=$pkg_cv_FREETYPE_LIBS
@@ -12411,7 +13185,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables FONTCONFIG_CFLAGS
 and FONTCONFIG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12426,7 +13200,7 @@ and FONTCONFIG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS
 	FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS
@@ -12590,7 +13364,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables LIBPNG_CFLAGS
 and LIBPNG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12605,7 +13379,7 @@ and LIBPNG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	LIBPNG_CFLAGS=$pkg_cv_LIBPNG_CFLAGS
 	LIBPNG_LIBS=$pkg_cv_LIBPNG_LIBS
@@ -12720,10 +13494,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
+    if test "x$cache_file" != "x/dev/null"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -12764,22 +13549,22 @@ fi
 
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_LIBPNG\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -12880,6 +13665,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in @%:@((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -13187,7 +13973,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13253,7 +14039,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 libass config.status 0.9.11
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -13381,131 +14167,153 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
-for var in SED \
+for var in SHELL \
+ECHO \
+SED \
 GREP \
 EGREP \
 FGREP \
@@ -13518,8 +14326,13 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
+archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -13529,14 +14342,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-SHELL \
-ECHO \
+nm_file_list_spec \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
 lt_prog_compiler_pic \
+lt_prog_compiler_wl \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
+MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -13552,7 +14365,6 @@ no_undefined_flag \
 hardcode_libdir_flag_spec \
 hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
-fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -13560,12 +14372,13 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
+install_override_mode \
 finish_eval \
 old_striplib \
 striplib; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13587,14 +14400,15 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
+postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13602,12 +14416,6 @@ sys_lib_dlsearch_path_spec; do
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
-  ;;
-esac
-
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -13644,7 +14452,7 @@ do
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
     "libass.pc") CONFIG_FILES="$CONFIG_FILES libass.pc" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -13667,9 +14475,10 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -13677,12 +14486,13 @@ $debug ||
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -13704,7 +14514,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -13713,18 +14523,18 @@ _ACEOF
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -13732,7 +14542,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -13780,7 +14590,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -13812,8 +14622,8 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
 # VPATH may cause trouble with some makes, so we remove sole $(srcdir),
@@ -13846,7 +14656,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -13858,11 +14668,11 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -13947,7 +14757,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -13960,7 +14770,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -13979,7 +14789,7 @@ do
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -13988,7 +14798,7 @@ do
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -14014,8 +14824,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -14151,23 +14961,24 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -14176,21 +14987,21 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
-	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error $? "could not create -" "$LINENO" 5 
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
 _am_arg="$ac_file"
@@ -14351,7 +15162,8 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -14399,6 +15211,12 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -14448,9 +15266,11 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -14458,13 +15278,30 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == "file_magic".
+# Command to use when deplibs_check_method = "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
 # The archiver.
 AR=$lt_AR
+
+# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -14473,6 +15310,9 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
 # A C compiler.
 LTCC=$lt_CC
 
@@ -14491,14 +15331,14 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
 
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
 
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
@@ -14506,6 +15346,9 @@ MAGIC_CMD=$MAGIC_CMD
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -14562,6 +15405,9 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -14601,6 +15447,10 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -14613,12 +15463,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -14705,9 +15555,6 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -14723,6 +15570,9 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -14755,212 +15605,169 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
-
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
@@ -14975,7 +15782,7 @@ _ACEOF
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
diff --git a/libass/autom4te.cache/output.1 b/libass/autom4te.cache/output.1
index 44cd9f6..1976fdf 100644
--- a/libass/autom4te.cache/output.1
+++ b/libass/autom4te.cache/output.1
@@ -1,6 +1,6 @@
 @%:@! /bin/sh
 @%:@ Guess values for system-dependent variables and create Makefiles.
-@%:@ Generated by GNU Autoconf 2.67 for libass 0.9.11.
+@%:@ Generated by GNU Autoconf 2.68 for libass 0.9.11.
 @%:@ 
 @%:@ 
 @%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -89,6 +89,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in @%:@((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -171,6 +172,14 @@ test x\$exitcode = x0 || exit 1"
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
 test \$(( 1 + 1 )) = 2 || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
@@ -214,11 +223,18 @@ IFS=$as_save_IFS
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
+	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+	case $- in @%:@ ((((
+	  *v*x* | *x*v* ) as_opts=-vx ;;
+	  *v* ) as_opts=-v ;;
+	  *x* ) as_opts=-x ;;
+	  * ) as_opts= ;;
+	esac
+	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -525,155 +541,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
-
-
-# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-$*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "$0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
 
 test -n "$DJDIR" || exec 7<&0 </dev/null
 exec 6>&1
@@ -766,9 +635,11 @@ OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-lt_ECHO
+MANIFEST_TOOL
 RANLIB
+ac_ct_AR
 AR
+DLLTOOL
 OBJDUMP
 LN_S
 NM
@@ -874,6 +745,7 @@ with_pic
 enable_fast_install
 enable_dependency_tracking
 with_gnu_ld
+with_sysroot
 enable_libtool_lock
 enable_test
 enable_enca
@@ -1304,7 +1176,7 @@ Try \`$0 --help' for more information"
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1540,6 +1412,8 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects @<:@default=use
                           both@:>@
   --with-gnu-ld           assume the C compiler uses GNU ld @<:@default=no@:>@
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
 
 Some influential environment variables:
   CC          C compiler command
@@ -1636,7 +1510,7 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 libass configure 0.9.11
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1682,7 +1556,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_compile
@@ -1728,7 +1602,7 @@ fi
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_link
@@ -1742,7 +1616,7 @@ ac_fn_c_check_header_compile ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1760,7 +1634,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_header_compile
 
@@ -1796,7 +1670,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_cpp
@@ -1838,7 +1712,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_run
@@ -1851,7 +1725,7 @@ ac_fn_c_check_func ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1906,7 +1780,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_func
 
@@ -1919,7 +1793,7 @@ ac_fn_c_check_type ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1960,7 +1834,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_type
 
@@ -1972,10 +1846,10 @@ $as_echo "$ac_res" >&6; }
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval "test \"\${$3+set}\"" = set; then :
+  if eval \${$3+:} false; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2038,7 +1912,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2047,7 +1921,7 @@ eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_header_mongrel
 
@@ -2060,7 +1934,7 @@ ac_fn_c_find_intX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
 $as_echo_n "checking for int$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2121,7 +1995,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_find_intX_t
 
@@ -2134,7 +2008,7 @@ ac_fn_c_find_uintX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
 $as_echo_n "checking for uint$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2174,7 +2048,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_find_uintX_t
 cat >config.log <<_ACEOF
@@ -2182,7 +2056,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2440,7 +2314,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
@@ -2516,7 +2390,7 @@ if $ac_cache_corrupted; then
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
 ## -------------------- ##
 ## Main body of script. ##
@@ -2548,7 +2422,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2577,7 +2451,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2664,11 +2538,11 @@ am_lf='
 '
 case `pwd` in
   *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
 esac
 
 # Do `set' in a subshell so we don't clobber the current shell's
@@ -2691,7 +2565,7 @@ if (
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
       as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5 
+alias in your environment" "$LINENO" 5
    fi
 
    test "$2" = conftest.file
@@ -2701,7 +2575,7 @@ then
    :
 else
    as_fn_error $? "newly created file is older than distributed files!
-Check your system clock" "$LINENO" 5 
+Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -2754,7 +2628,7 @@ if test "$cross_compiling" != no; then
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -2794,7 +2668,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -2847,7 +2721,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then :
+  if ${ac_cv_path_mkdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2898,7 +2772,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2938,7 +2812,7 @@ done
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2980,7 +2854,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
   am__isrc=' -I$(srcdir)'
   # test to see if srcdir already configured
   if test -f $srcdir/config.status; then
-    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
   fi
 fi
 
@@ -3048,8 +2922,8 @@ esac
 
 
 
-macro_version='2.2.6b'
-macro_revision='1.3017'
+macro_version='2.4'
+macro_revision='1.3293'
 
     
     
@@ -3067,27 +2941,27 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -3105,14 +2979,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
@@ -3120,7 +2994,7 @@ fi
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -3136,6 +3010,75 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "" 
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+    
+    
+    
+
+
+    
+    
+    
+
+
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
@@ -3208,7 +3151,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3248,7 +3191,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3301,7 +3244,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3341,7 +3284,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3400,7 +3343,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3444,7 +3387,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3499,7 +3442,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3614,7 +3557,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3657,7 +3600,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3716,7 +3659,7 @@ $as_echo "$ac_try_echo"; } >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
@@ -3727,7 +3670,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3768,7 +3711,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -3778,7 +3721,7 @@ OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3815,7 +3758,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -3893,7 +3836,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -3992,7 +3935,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4117,7 +4060,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -4172,7 +4115,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_SED"; then
-    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
   ac_cv_path_SED=$SED
@@ -4199,7 +4142,7 @@ Xsed="$SED -e 1s/^X//"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -4248,7 +4191,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
@@ -4262,7 +4205,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4314,7 +4257,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -4329,7 +4272,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then :
+if ${ac_cv_path_FGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -4381,7 +4324,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_FGREP"; then
-    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_FGREP=$FGREP
@@ -4460,7 +4403,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then :
+if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -4497,10 +4440,10 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+if ${lt_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -4527,7 +4470,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then :
+if ${lt_cv_path_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -4580,14 +4523,17 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -4625,13 +4571,13 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  for ac_prog in dumpbin "link -dump"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DUMPBIN"; then
@@ -4680,6 +4626,15 @@ esac
   fi
 fi
 
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -4694,18 +4649,18 @@ test -z "$NM" && NM=nm
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
 $as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then :
+if ${lt_cv_nm_interface+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:__oline__: output\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -4729,7 +4684,7 @@ fi
 # find the maximum length of command line arguments
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
 $as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+if ${lt_cv_sys_max_cmd_len+:} false; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
@@ -4762,6 +4717,11 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -4826,8 +4786,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -4869,8 +4829,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6;
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -4919,9 +4879,83 @@ esac
     
     
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+    
+    
+    
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+    
+    
+    
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then :
+if ${lt_cv_ld_reload_flag+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
@@ -4935,6 +4969,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -4957,7 +4996,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -4997,7 +5036,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then
 set dummy objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -5056,7 +5095,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
 $as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then :
+if ${lt_cv_deplibs_check_method+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -5098,16 +5137,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -5137,6 +5178,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -5145,11 +5190,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -5252,6 +5297,21 @@ esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -5267,12 +5327,166 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
     
 
 
+    
+    
+    
+
+
+    
+    
+    
+
+
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+    
+    
+    
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+    
+    
+    
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -5285,7 +5499,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5305,14 +5519,18 @@ $as_echo "no" >&6; }
 fi
 
 
+    test -n "$AR" && break
+  done
 fi
-if test -z "$ac_cv_prog_AR"; then
+if test -z "$AR"; then
   ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -5325,7 +5543,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
+    ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5344,6 +5562,10 @@ else
 $as_echo "no" >&6; }
 fi
 
+
+  test -n "$ac_ct_AR" && break
+done
+
   if test "x$ac_ct_AR" = x; then
     AR="false"
   else
@@ -5355,29 +5577,85 @@ ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
   fi
-else
-  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+    
+    
+    
+
 
     
     
     
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
     
     
     
 
 
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -5417,7 +5695,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -5476,7 +5754,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -5516,7 +5794,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
 set dummy ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -5587,6 +5865,18 @@ if test -n "$RANLIB"; then
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+    
+    
+    
+
+
     
     
     
@@ -5633,7 +5923,7 @@ compiler=$CC
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   
@@ -5694,8 +5984,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -5731,6 +6021,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -5756,8 +6047,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && test -s "$nlist"; then
@@ -5772,6 +6063,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -5783,7 +6086,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT@&t at _DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -5809,8 +6112,8 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
@@ -5820,8 +6123,8 @@ _LT_EOF
   test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -5858,6 +6161,13 @@ else
 $as_echo "ok" >&6; }
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
 
     
     
@@ -5879,6 +6189,47 @@ fi
     
 
 
+    
+    
+    
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+@%:@ Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot; 
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+    
+    
+    
 
 @%:@ Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
@@ -5911,7 +6262,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line __oline__ "configure"' > conftest.$ac_ext
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6005,7 +6356,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   CFLAGS="$CFLAGS -belf"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then :
+if ${lt_cv_cc_needs_belf+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -6073,6 +6424,123 @@ esac
 
 need_locks="$enable_libtool_lock"
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+    
+    
+    
+
 
   case $host_os in
     rhapsody* | darwin*)
@@ -6081,7 +6549,7 @@ need_locks="$enable_libtool_lock"
 set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DSYMUTIL"; then
@@ -6121,7 +6589,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
 set dummy dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DSYMUTIL"; then
@@ -6173,7 +6641,7 @@ fi
 set dummy ${ac_tool_prefix}nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NMEDIT"; then
@@ -6213,7 +6681,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then
 set dummy nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NMEDIT"; then
@@ -6265,7 +6733,7 @@ fi
 set dummy ${ac_tool_prefix}lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then :
+if ${ac_cv_prog_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LIPO"; then
@@ -6305,7 +6773,7 @@ if test -z "$ac_cv_prog_LIPO"; then
 set dummy lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LIPO"; then
@@ -6357,7 +6825,7 @@ fi
 set dummy ${ac_tool_prefix}otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then :
+if ${ac_cv_prog_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL"; then
@@ -6397,7 +6865,7 @@ if test -z "$ac_cv_prog_OTOOL"; then
 set dummy otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL"; then
@@ -6449,7 +6917,7 @@ fi
 set dummy ${ac_tool_prefix}otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL64"; then
@@ -6489,7 +6957,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then
 set dummy otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL64"; then
@@ -6564,7 +7032,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
 $as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+if ${lt_cv_apple_cc_single_mod+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
@@ -6593,7 +7061,7 @@ fi
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_exported_symbols_list=no
@@ -6623,6 +7091,38 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -6650,7 +7150,7 @@ $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -6670,7 +7170,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -6786,7 +7286,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -6798,7 +7298,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6929,7 +7429,7 @@ for ac_header in dlfcn.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
 "
-if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 @%:@define HAVE_DLFCN_H 1
 _ACEOF
@@ -6940,6 +7440,8 @@ done
 
 
 
+
+
 # Set options
 
 
@@ -7069,6 +7571,7 @@ LIBTOOL_DEPS="$ltmain"
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
+
     
     
     
@@ -7113,7 +7616,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
 $as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then :
+if ${lt_cv_objdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
@@ -7141,19 +7644,6 @@ _ACEOF
 
 
 
-
-
-    
-    
-    
-
-
-    
-    
-    
-
-
-
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -7166,23 +7656,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -7211,7 +7684,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -7221,7 +7694,7 @@ file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7287,7 +7760,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
 $as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7420,11 +7893,16 @@ if test -n "$compiler"; then
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
@@ -7440,15 +7918,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -7477,8 +7955,6 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -7526,6 +8002,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -7568,6 +8050,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -7630,7 +8119,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -7642,25 +8137,25 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_wl=''
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	*Sun\ C*)
+	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
+	  lt_prog_compiler_wl='-Wl,'
 	  ;;
 	esac
 	;;
@@ -7692,7 +8187,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -7749,13 +8244,17 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic@&t@ -DPIC"
     ;;
 esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-    
-    
-    
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
@@ -7763,7 +8262,7 @@ $as_echo "$lt_prog_compiler_pic" >&6; }
 if test -n "$lt_prog_compiler_pic"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works=no
@@ -7779,15 +8278,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -7816,13 +8315,18 @@ fi
     
 
 
+
+    
+    
+    
+
 #
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
@@ -7835,7 +8339,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -7865,7 +8369,7 @@ fi
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7884,16 +8388,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -7920,7 +8424,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7939,16 +8443,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8058,13 +8562,39 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu)
+  linux* | k*bsd*-gnu | gnu*)
     link_all_deplibs=no
     ;;
   esac
 
   ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -8098,11 +8628,12 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -8138,10 +8669,12 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -8159,6 +8692,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -8184,15 +8722,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -8203,13 +8742,17 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -8225,17 +8768,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
 	  hardcode_libdir_flag_spec=
 	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -8249,8 +8792,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -8268,8 +8811,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8315,8 +8858,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8356,8 +8899,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -8445,7 +8990,13 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8458,25 +9009,32 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+  
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -8485,7 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8498,30 +9062,42 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+  
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -8553,20 +9129,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -8576,7 +9195,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec=''
+  fi
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -8584,7 +9207,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -8627,7 +9250,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -8635,7 +9258,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -8650,8 +9273,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -8669,16 +9292,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -8690,7 +9313,46 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
 	  ;;
 	esac
       fi
@@ -8718,26 +9380,39 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foo(void) {}
+int foo (void) { return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-        
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8799,17 +9474,17 @@ rm -f core conftest.err conftest.$ac_objext \
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8819,13 +9494,13 @@ rm -f core conftest.err conftest.$ac_objext \
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -8838,9 +9513,9 @@ rm -f core conftest.err conftest.$ac_objext \
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -9028,44 +9703,50 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
@@ -9236,16 +9917,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -9258,7 +9946,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -9278,7 +9966,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -9366,7 +10060,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -9397,8 +10091,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -9419,36 +10114,83 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -9532,6 +10274,20 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -9577,8 +10333,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[3-9]*)
@@ -9645,12 +10403,17 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9663,13 +10426,17 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  shlibpath_overrides_runpath=yes
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -9678,7 +10445,7 @@ rm -f core conftest.err conftest.$ac_objext \
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -9993,6 +10760,11 @@ fi
     
 
 
+    
+    
+    
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
@@ -10065,7 +10837,7 @@ else
   # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10099,7 +10871,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   
@@ -10113,12 +10885,12 @@ fi
 
   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = x""yes; then :
+if test "x$ac_cv_func_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+if ${ac_cv_lib_dld_shl_load+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10152,16 +10924,16 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = x""yes; then :
+if test "x$ac_cv_func_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10195,12 +10967,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+if ${ac_cv_lib_svld_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10234,12 +11006,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+if ${ac_cv_lib_dld_dld_link+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10273,7 +11045,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
@@ -10314,7 +11086,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
 $as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then :
+if ${lt_cv_dlopen_self+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10323,7 +11095,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line __oline__ "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10364,7 +11136,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10373,7 +11151,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10410,7 +11192,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; }
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then :
+if ${lt_cv_dlopen_self_static+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10419,7 +11201,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line __oline__ "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10460,7 +11242,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10469,7 +11257,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10661,7 +11453,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10701,7 +11493,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10754,7 +11546,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10794,7 +11586,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10853,7 +11645,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10897,7 +11689,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10952,7 +11744,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -10981,7 +11773,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11018,7 +11810,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -11096,7 +11888,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -11195,7 +11987,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -11330,7 +12122,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -11446,7 +12238,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -11464,7 +12256,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
 fi
 set dummy $CC; ac_cc=`$as_echo "$2" |
 		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then :
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11585,7 +12377,7 @@ fi
 # Checks for header files.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11697,7 +12489,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then :
+if ${ac_cv_header_stdbool_h+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11729,7 +12521,7 @@ else
 	char b[false == 0 ? 1 : -1];
 	char c[__bool_true_false_are_defined == 1 ? 1 : -1];
 	char d[(bool) 0.5 == true ? 1 : -1];
-	bool e = &s;
+	/* See body of main program for 'e'.  */
 	char f[(_Bool) 0.0 == false ? 1 : -1];
 	char g[true];
 	char h[sizeof (_Bool)];
@@ -11740,25 +12532,6 @@ else
 	_Bool n[m];
 	char o[sizeof n == m * sizeof n[0] ? 1 : -1];
 	char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-#	if defined __xlc__ || defined __GNUC__
-	 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-	    reported by James Lemley on 2005-10-05; see
-	    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-	    This test is not quite right, since xlc is allowed to
-	    reject this program, as the initializer for xlcbug is
-	    not one of the forms that C requires support for.
-	    However, doing the test right would require a runtime
-	    test, and that would make cross-compilation harder.
-	    Let us hope that IBM fixes the xlc bug, and also adds
-	    support for this kind of constant expression.  In the
-	    meantime, this test will reject xlc, which is OK, since
-	    our stdbool.h substitute should suffice.  We also test
-	    this with GCC, where it should work, to detect more
-	    quickly whether someone messes up the test in the
-	    future.  */
-	 char digs[] = "0123456789";
-	 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-#	endif
 	/* Catch a bug in an HP-UX C compiler.  See
 	   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
 	   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -11770,6 +12543,7 @@ int
 main ()
 {
 
+	bool e = &s;
 	*pq |= q;
 	*pq |= ! q;
 	/* Refer to every declared value, to avoid compiler optimizations.  */
@@ -11790,7 +12564,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
 $as_echo "$ac_cv_header_stdbool_h" >&6; }
 ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = x""yes; then :
+if test "x$ac_cv_type__Bool" = xyes; then :
   
 cat >>confdefs.h <<_ACEOF
 @%:@define HAVE__BOOL 1
@@ -11822,7 +12596,7 @@ done
 # Checks for typedefs, structures, and compiler characteristics.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11902,7 +12676,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then :
+if ${ac_cv_c_inline+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_inline=no
@@ -11954,7 +12728,7 @@ _ACEOF
 esac
 
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = x""yes; then :
+if test "x$ac_cv_type_size_t" = xyes; then :
   
 else
   
@@ -12010,7 +12784,7 @@ done
 # Checks for libraries.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv_open" >&5
 $as_echo_n "checking for library containing iconv_open... " >&6; }
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -12044,11 +12818,11 @@ for ac_lib in '' iconv; do
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_iconv_open+set}" = set; then :
+  if ${ac_cv_search_iconv_open+:} false; then :
   break
 fi
 done
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
   
 else
   ac_cv_search_iconv_open=no
@@ -12068,7 +12842,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fabs in -lm" >&5
 $as_echo_n "checking for fabs in -lm... " >&6; }
-if test "${ac_cv_lib_m_fabs+set}" = set; then :
+if ${ac_cv_lib_m_fabs+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12102,7 +12876,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fabs" >&5
 $as_echo "$ac_cv_lib_m_fabs" >&6; }
-if test "x$ac_cv_lib_m_fabs" = x""yes; then :
+if test "x$ac_cv_lib_m_fabs" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 @%:@define HAVE_LIBM 1
 _ACEOF
@@ -12141,7 +12915,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -12184,7 +12958,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
@@ -12314,7 +13088,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables FREETYPE_CFLAGS
 and FREETYPE_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12329,7 +13103,7 @@ and FREETYPE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	FREETYPE_CFLAGS=$pkg_cv_FREETYPE_CFLAGS
 	FREETYPE_LIBS=$pkg_cv_FREETYPE_LIBS
@@ -12411,7 +13185,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables FONTCONFIG_CFLAGS
 and FONTCONFIG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12426,7 +13200,7 @@ and FONTCONFIG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS
 	FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS
@@ -12590,7 +13364,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables LIBPNG_CFLAGS
 and LIBPNG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12605,7 +13379,7 @@ and LIBPNG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	LIBPNG_CFLAGS=$pkg_cv_LIBPNG_CFLAGS
 	LIBPNG_LIBS=$pkg_cv_LIBPNG_LIBS
@@ -12720,10 +13494,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
+    if test "x$cache_file" != "x/dev/null"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -12764,22 +13549,22 @@ fi
 
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_LIBPNG\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -12880,6 +13665,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in @%:@((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -13187,7 +13973,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13253,7 +14039,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 libass config.status 0.9.11
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -13381,131 +14167,153 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
-for var in SED \
+for var in SHELL \
+ECHO \
+SED \
 GREP \
 EGREP \
 FGREP \
@@ -13518,8 +14326,13 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
+archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -13529,14 +14342,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-SHELL \
-ECHO \
+nm_file_list_spec \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
 lt_prog_compiler_pic \
+lt_prog_compiler_wl \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
+MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -13552,7 +14365,6 @@ no_undefined_flag \
 hardcode_libdir_flag_spec \
 hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
-fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -13560,12 +14372,13 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
+install_override_mode \
 finish_eval \
 old_striplib \
 striplib; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13587,14 +14400,15 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
+postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13602,12 +14416,6 @@ sys_lib_dlsearch_path_spec; do
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
-  ;;
-esac
-
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -13644,7 +14452,7 @@ do
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
     "libass.pc") CONFIG_FILES="$CONFIG_FILES libass.pc" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -13667,9 +14475,10 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -13677,12 +14486,13 @@ $debug ||
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -13704,7 +14514,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -13713,18 +14523,18 @@ _ACEOF
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -13732,7 +14542,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -13780,7 +14590,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -13812,8 +14622,8 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
 # VPATH may cause trouble with some makes, so we remove sole $(srcdir),
@@ -13846,7 +14656,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -13858,11 +14668,11 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -13947,7 +14757,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -13960,7 +14770,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -13979,7 +14789,7 @@ do
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -13988,7 +14798,7 @@ do
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -14014,8 +14824,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -14151,23 +14961,24 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -14176,21 +14987,21 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
-	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error $? "could not create -" "$LINENO" 5 
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
 _am_arg="$ac_file"
@@ -14351,7 +15162,8 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -14399,6 +15211,12 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -14448,9 +15266,11 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -14458,13 +15278,30 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == "file_magic".
+# Command to use when deplibs_check_method = "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
 # The archiver.
 AR=$lt_AR
+
+# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -14473,6 +15310,9 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
 # A C compiler.
 LTCC=$lt_CC
 
@@ -14491,14 +15331,14 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
 
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
 
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
@@ -14506,6 +15346,9 @@ MAGIC_CMD=$MAGIC_CMD
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -14562,6 +15405,9 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -14601,6 +15447,10 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -14613,12 +15463,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -14705,9 +15555,6 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -14723,6 +15570,9 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -14755,212 +15605,169 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
-
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
@@ -14975,7 +15782,7 @@ _ACEOF
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
diff --git a/libass/autom4te.cache/output.2 b/libass/autom4te.cache/output.2
index 44cd9f6..1976fdf 100644
--- a/libass/autom4te.cache/output.2
+++ b/libass/autom4te.cache/output.2
@@ -1,6 +1,6 @@
 @%:@! /bin/sh
 @%:@ Guess values for system-dependent variables and create Makefiles.
-@%:@ Generated by GNU Autoconf 2.67 for libass 0.9.11.
+@%:@ Generated by GNU Autoconf 2.68 for libass 0.9.11.
 @%:@ 
 @%:@ 
 @%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -89,6 +89,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in @%:@((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -171,6 +172,14 @@ test x\$exitcode = x0 || exit 1"
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
 test \$(( 1 + 1 )) = 2 || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
@@ -214,11 +223,18 @@ IFS=$as_save_IFS
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
+	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+	case $- in @%:@ ((((
+	  *v*x* | *x*v* ) as_opts=-vx ;;
+	  *v* ) as_opts=-v ;;
+	  *x* ) as_opts=-x ;;
+	  * ) as_opts= ;;
+	esac
+	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -525,155 +541,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
-
-
-# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-$*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "$0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
 
 test -n "$DJDIR" || exec 7<&0 </dev/null
 exec 6>&1
@@ -766,9 +635,11 @@ OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-lt_ECHO
+MANIFEST_TOOL
 RANLIB
+ac_ct_AR
 AR
+DLLTOOL
 OBJDUMP
 LN_S
 NM
@@ -874,6 +745,7 @@ with_pic
 enable_fast_install
 enable_dependency_tracking
 with_gnu_ld
+with_sysroot
 enable_libtool_lock
 enable_test
 enable_enca
@@ -1304,7 +1176,7 @@ Try \`$0 --help' for more information"
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1540,6 +1412,8 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects @<:@default=use
                           both@:>@
   --with-gnu-ld           assume the C compiler uses GNU ld @<:@default=no@:>@
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
 
 Some influential environment variables:
   CC          C compiler command
@@ -1636,7 +1510,7 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 libass configure 0.9.11
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1682,7 +1556,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_compile
@@ -1728,7 +1602,7 @@ fi
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_link
@@ -1742,7 +1616,7 @@ ac_fn_c_check_header_compile ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1760,7 +1634,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_header_compile
 
@@ -1796,7 +1670,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_cpp
@@ -1838,7 +1712,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } @%:@ ac_fn_c_try_run
@@ -1851,7 +1725,7 @@ ac_fn_c_check_func ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1906,7 +1780,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_func
 
@@ -1919,7 +1793,7 @@ ac_fn_c_check_type ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1960,7 +1834,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_type
 
@@ -1972,10 +1846,10 @@ $as_echo "$ac_res" >&6; }
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval "test \"\${$3+set}\"" = set; then :
+  if eval \${$3+:} false; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2038,7 +1912,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2047,7 +1921,7 @@ eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_check_header_mongrel
 
@@ -2060,7 +1934,7 @@ ac_fn_c_find_intX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
 $as_echo_n "checking for int$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2121,7 +1995,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_find_intX_t
 
@@ -2134,7 +2008,7 @@ ac_fn_c_find_uintX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
 $as_echo_n "checking for uint$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2174,7 +2048,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } @%:@ ac_fn_c_find_uintX_t
 cat >config.log <<_ACEOF
@@ -2182,7 +2056,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2440,7 +2314,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
@@ -2516,7 +2390,7 @@ if $ac_cache_corrupted; then
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
 ## -------------------- ##
 ## Main body of script. ##
@@ -2548,7 +2422,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2577,7 +2451,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2664,11 +2538,11 @@ am_lf='
 '
 case `pwd` in
   *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
 esac
 
 # Do `set' in a subshell so we don't clobber the current shell's
@@ -2691,7 +2565,7 @@ if (
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
       as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5 
+alias in your environment" "$LINENO" 5
    fi
 
    test "$2" = conftest.file
@@ -2701,7 +2575,7 @@ then
    :
 else
    as_fn_error $? "newly created file is older than distributed files!
-Check your system clock" "$LINENO" 5 
+Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -2754,7 +2628,7 @@ if test "$cross_compiling" != no; then
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -2794,7 +2668,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -2847,7 +2721,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then :
+  if ${ac_cv_path_mkdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2898,7 +2772,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2938,7 +2812,7 @@ done
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2980,7 +2854,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
   am__isrc=' -I$(srcdir)'
   # test to see if srcdir already configured
   if test -f $srcdir/config.status; then
-    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
   fi
 fi
 
@@ -3048,8 +2922,8 @@ esac
 
 
 
-macro_version='2.2.6b'
-macro_revision='1.3017'
+macro_version='2.4'
+macro_revision='1.3293'
 
     
     
@@ -3067,27 +2941,27 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -3105,14 +2979,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
@@ -3120,7 +2994,7 @@ fi
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -3136,6 +3010,75 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "" 
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+    
+    
+    
+
+
+    
+    
+    
+
+
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
@@ -3208,7 +3151,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3248,7 +3191,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3301,7 +3244,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3341,7 +3284,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3400,7 +3343,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3444,7 +3387,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3499,7 +3442,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3614,7 +3557,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3657,7 +3600,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3716,7 +3659,7 @@ $as_echo "$ac_try_echo"; } >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
@@ -3727,7 +3670,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3768,7 +3711,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -3778,7 +3721,7 @@ OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3815,7 +3758,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -3893,7 +3836,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -3992,7 +3935,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4117,7 +4060,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -4172,7 +4115,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_SED"; then
-    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
   ac_cv_path_SED=$SED
@@ -4199,7 +4142,7 @@ Xsed="$SED -e 1s/^X//"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -4248,7 +4191,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
@@ -4262,7 +4205,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4314,7 +4257,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -4329,7 +4272,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then :
+if ${ac_cv_path_FGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -4381,7 +4324,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_FGREP"; then
-    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_FGREP=$FGREP
@@ -4460,7 +4403,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then :
+if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -4497,10 +4440,10 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+if ${lt_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -4527,7 +4470,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then :
+if ${lt_cv_path_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -4580,14 +4523,17 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -4625,13 +4571,13 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  for ac_prog in dumpbin "link -dump"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DUMPBIN"; then
@@ -4680,6 +4626,15 @@ esac
   fi
 fi
 
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -4694,18 +4649,18 @@ test -z "$NM" && NM=nm
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
 $as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then :
+if ${lt_cv_nm_interface+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:__oline__: output\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -4729,7 +4684,7 @@ fi
 # find the maximum length of command line arguments
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
 $as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+if ${lt_cv_sys_max_cmd_len+:} false; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
@@ -4762,6 +4717,11 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -4826,8 +4786,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -4869,8 +4829,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6;
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -4919,9 +4879,83 @@ esac
     
     
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+    
+    
+    
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+    
+    
+    
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then :
+if ${lt_cv_ld_reload_flag+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
@@ -4935,6 +4969,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -4957,7 +4996,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -4997,7 +5036,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then
 set dummy objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -5056,7 +5095,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
 $as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then :
+if ${lt_cv_deplibs_check_method+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -5098,16 +5137,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -5137,6 +5178,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -5145,11 +5190,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -5252,6 +5297,21 @@ esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -5267,12 +5327,166 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
     
 
 
+    
+    
+    
+
+
+    
+    
+    
+
+
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+    
+    
+    
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+    
+    
+    
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -5285,7 +5499,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5305,14 +5519,18 @@ $as_echo "no" >&6; }
 fi
 
 
+    test -n "$AR" && break
+  done
 fi
-if test -z "$ac_cv_prog_AR"; then
+if test -z "$AR"; then
   ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -5325,7 +5543,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
+    ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5344,6 +5562,10 @@ else
 $as_echo "no" >&6; }
 fi
 
+
+  test -n "$ac_ct_AR" && break
+done
+
   if test "x$ac_ct_AR" = x; then
     AR="false"
   else
@@ -5355,29 +5577,85 @@ ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
   fi
-else
-  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+    
+    
+    
+
 
     
     
     
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
     
     
     
 
 
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -5417,7 +5695,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -5476,7 +5754,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -5516,7 +5794,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
 set dummy ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -5587,6 +5865,18 @@ if test -n "$RANLIB"; then
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+    
+    
+    
+
+
     
     
     
@@ -5633,7 +5923,7 @@ compiler=$CC
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   
@@ -5694,8 +5984,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -5731,6 +6021,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -5756,8 +6047,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && test -s "$nlist"; then
@@ -5772,6 +6063,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -5783,7 +6086,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT@&t at _DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -5809,8 +6112,8 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
@@ -5820,8 +6123,8 @@ _LT_EOF
   test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -5858,6 +6161,13 @@ else
 $as_echo "ok" >&6; }
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
 
     
     
@@ -5879,6 +6189,47 @@ fi
     
 
 
+    
+    
+    
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+@%:@ Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot; 
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+    
+    
+    
 
 @%:@ Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
@@ -5911,7 +6262,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line __oline__ "configure"' > conftest.$ac_ext
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6005,7 +6356,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   CFLAGS="$CFLAGS -belf"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then :
+if ${lt_cv_cc_needs_belf+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -6073,6 +6424,123 @@ esac
 
 need_locks="$enable_libtool_lock"
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+    
+    
+    
+
 
   case $host_os in
     rhapsody* | darwin*)
@@ -6081,7 +6549,7 @@ need_locks="$enable_libtool_lock"
 set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DSYMUTIL"; then
@@ -6121,7 +6589,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
 set dummy dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DSYMUTIL"; then
@@ -6173,7 +6641,7 @@ fi
 set dummy ${ac_tool_prefix}nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NMEDIT"; then
@@ -6213,7 +6681,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then
 set dummy nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NMEDIT"; then
@@ -6265,7 +6733,7 @@ fi
 set dummy ${ac_tool_prefix}lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then :
+if ${ac_cv_prog_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LIPO"; then
@@ -6305,7 +6773,7 @@ if test -z "$ac_cv_prog_LIPO"; then
 set dummy lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LIPO"; then
@@ -6357,7 +6825,7 @@ fi
 set dummy ${ac_tool_prefix}otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then :
+if ${ac_cv_prog_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL"; then
@@ -6397,7 +6865,7 @@ if test -z "$ac_cv_prog_OTOOL"; then
 set dummy otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL"; then
@@ -6449,7 +6917,7 @@ fi
 set dummy ${ac_tool_prefix}otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL64"; then
@@ -6489,7 +6957,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then
 set dummy otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL64"; then
@@ -6564,7 +7032,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
 $as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+if ${lt_cv_apple_cc_single_mod+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
@@ -6593,7 +7061,7 @@ fi
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_exported_symbols_list=no
@@ -6623,6 +7091,38 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -6650,7 +7150,7 @@ $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -6670,7 +7170,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -6786,7 +7286,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -6798,7 +7298,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6929,7 +7429,7 @@ for ac_header in dlfcn.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
 "
-if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 @%:@define HAVE_DLFCN_H 1
 _ACEOF
@@ -6940,6 +7440,8 @@ done
 
 
 
+
+
 # Set options
 
 
@@ -7069,6 +7571,7 @@ LIBTOOL_DEPS="$ltmain"
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
+
     
     
     
@@ -7113,7 +7616,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
 $as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then :
+if ${lt_cv_objdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
@@ -7141,19 +7644,6 @@ _ACEOF
 
 
 
-
-
-    
-    
-    
-
-
-    
-    
-    
-
-
-
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -7166,23 +7656,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -7211,7 +7684,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -7221,7 +7694,7 @@ file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7287,7 +7760,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
 $as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7420,11 +7893,16 @@ if test -n "$compiler"; then
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
@@ -7440,15 +7918,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -7477,8 +7955,6 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -7526,6 +8002,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -7568,6 +8050,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -7630,7 +8119,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -7642,25 +8137,25 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_wl=''
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	*Sun\ C*)
+	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
+	  lt_prog_compiler_wl='-Wl,'
 	  ;;
 	esac
 	;;
@@ -7692,7 +8187,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -7749,13 +8244,17 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic@&t@ -DPIC"
     ;;
 esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-    
-    
-    
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
@@ -7763,7 +8262,7 @@ $as_echo "$lt_prog_compiler_pic" >&6; }
 if test -n "$lt_prog_compiler_pic"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works=no
@@ -7779,15 +8278,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -7816,13 +8315,18 @@ fi
     
 
 
+
+    
+    
+    
+
 #
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
@@ -7835,7 +8339,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -7865,7 +8369,7 @@ fi
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7884,16 +8388,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -7920,7 +8424,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7939,16 +8443,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:__oline__: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8058,13 +8562,39 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu)
+  linux* | k*bsd*-gnu | gnu*)
     link_all_deplibs=no
     ;;
   esac
 
   ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -8098,11 +8628,12 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -8138,10 +8669,12 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -8159,6 +8692,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -8184,15 +8722,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -8203,13 +8742,17 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -8225,17 +8768,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
 	  hardcode_libdir_flag_spec=
 	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -8249,8 +8792,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -8268,8 +8811,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8315,8 +8858,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8356,8 +8899,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -8445,7 +8990,13 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8458,25 +9009,32 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+  
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -8485,7 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8498,30 +9062,42 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+  
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -8553,20 +9129,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -8576,7 +9195,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec=''
+  fi
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -8584,7 +9207,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -8627,7 +9250,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -8635,7 +9258,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -8650,8 +9273,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -8669,16 +9292,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -8690,7 +9313,46 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
 	  ;;
 	esac
       fi
@@ -8718,26 +9380,39 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foo(void) {}
+int foo (void) { return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-        
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8799,17 +9474,17 @@ rm -f core conftest.err conftest.$ac_objext \
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8819,13 +9494,13 @@ rm -f core conftest.err conftest.$ac_objext \
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -8838,9 +9513,9 @@ rm -f core conftest.err conftest.$ac_objext \
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -9028,44 +9703,50 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
@@ -9236,16 +9917,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -9258,7 +9946,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -9278,7 +9966,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -9366,7 +10060,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -9397,8 +10091,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -9419,36 +10114,83 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -9532,6 +10274,20 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -9577,8 +10333,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[3-9]*)
@@ -9645,12 +10403,17 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9663,13 +10426,17 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  shlibpath_overrides_runpath=yes
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -9678,7 +10445,7 @@ rm -f core conftest.err conftest.$ac_objext \
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -9993,6 +10760,11 @@ fi
     
 
 
+    
+    
+    
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
@@ -10065,7 +10837,7 @@ else
   # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10099,7 +10871,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   
@@ -10113,12 +10885,12 @@ fi
 
   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = x""yes; then :
+if test "x$ac_cv_func_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+if ${ac_cv_lib_dld_shl_load+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10152,16 +10924,16 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = x""yes; then :
+if test "x$ac_cv_func_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10195,12 +10967,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+if ${ac_cv_lib_svld_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10234,12 +11006,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+if ${ac_cv_lib_dld_dld_link+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10273,7 +11045,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
@@ -10314,7 +11086,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
 $as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then :
+if ${lt_cv_dlopen_self+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10323,7 +11095,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line __oline__ "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10364,7 +11136,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10373,7 +11151,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10410,7 +11192,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; }
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then :
+if ${lt_cv_dlopen_self_static+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10419,7 +11201,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line __oline__ "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10460,7 +11242,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10469,7 +11257,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10661,7 +11453,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10701,7 +11493,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10754,7 +11546,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10794,7 +11586,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10853,7 +11645,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10897,7 +11689,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10952,7 +11744,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -10981,7 +11773,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11018,7 +11810,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -11096,7 +11888,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -11195,7 +11987,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -11330,7 +12122,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -11446,7 +12238,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -11464,7 +12256,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
 fi
 set dummy $CC; ac_cc=`$as_echo "$2" |
 		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then :
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11585,7 +12377,7 @@ fi
 # Checks for header files.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11697,7 +12489,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then :
+if ${ac_cv_header_stdbool_h+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11729,7 +12521,7 @@ else
 	char b[false == 0 ? 1 : -1];
 	char c[__bool_true_false_are_defined == 1 ? 1 : -1];
 	char d[(bool) 0.5 == true ? 1 : -1];
-	bool e = &s;
+	/* See body of main program for 'e'.  */
 	char f[(_Bool) 0.0 == false ? 1 : -1];
 	char g[true];
 	char h[sizeof (_Bool)];
@@ -11740,25 +12532,6 @@ else
 	_Bool n[m];
 	char o[sizeof n == m * sizeof n[0] ? 1 : -1];
 	char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-#	if defined __xlc__ || defined __GNUC__
-	 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-	    reported by James Lemley on 2005-10-05; see
-	    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-	    This test is not quite right, since xlc is allowed to
-	    reject this program, as the initializer for xlcbug is
-	    not one of the forms that C requires support for.
-	    However, doing the test right would require a runtime
-	    test, and that would make cross-compilation harder.
-	    Let us hope that IBM fixes the xlc bug, and also adds
-	    support for this kind of constant expression.  In the
-	    meantime, this test will reject xlc, which is OK, since
-	    our stdbool.h substitute should suffice.  We also test
-	    this with GCC, where it should work, to detect more
-	    quickly whether someone messes up the test in the
-	    future.  */
-	 char digs[] = "0123456789";
-	 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-#	endif
 	/* Catch a bug in an HP-UX C compiler.  See
 	   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
 	   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -11770,6 +12543,7 @@ int
 main ()
 {
 
+	bool e = &s;
 	*pq |= q;
 	*pq |= ! q;
 	/* Refer to every declared value, to avoid compiler optimizations.  */
@@ -11790,7 +12564,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
 $as_echo "$ac_cv_header_stdbool_h" >&6; }
 ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = x""yes; then :
+if test "x$ac_cv_type__Bool" = xyes; then :
   
 cat >>confdefs.h <<_ACEOF
 @%:@define HAVE__BOOL 1
@@ -11822,7 +12596,7 @@ done
 # Checks for typedefs, structures, and compiler characteristics.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11902,7 +12676,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then :
+if ${ac_cv_c_inline+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_inline=no
@@ -11954,7 +12728,7 @@ _ACEOF
 esac
 
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = x""yes; then :
+if test "x$ac_cv_type_size_t" = xyes; then :
   
 else
   
@@ -12010,7 +12784,7 @@ done
 # Checks for libraries.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv_open" >&5
 $as_echo_n "checking for library containing iconv_open... " >&6; }
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -12044,11 +12818,11 @@ for ac_lib in '' iconv; do
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_iconv_open+set}" = set; then :
+  if ${ac_cv_search_iconv_open+:} false; then :
   break
 fi
 done
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
   
 else
   ac_cv_search_iconv_open=no
@@ -12068,7 +12842,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fabs in -lm" >&5
 $as_echo_n "checking for fabs in -lm... " >&6; }
-if test "${ac_cv_lib_m_fabs+set}" = set; then :
+if ${ac_cv_lib_m_fabs+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12102,7 +12876,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fabs" >&5
 $as_echo "$ac_cv_lib_m_fabs" >&6; }
-if test "x$ac_cv_lib_m_fabs" = x""yes; then :
+if test "x$ac_cv_lib_m_fabs" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 @%:@define HAVE_LIBM 1
 _ACEOF
@@ -12141,7 +12915,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -12184,7 +12958,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
@@ -12314,7 +13088,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables FREETYPE_CFLAGS
 and FREETYPE_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12329,7 +13103,7 @@ and FREETYPE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	FREETYPE_CFLAGS=$pkg_cv_FREETYPE_CFLAGS
 	FREETYPE_LIBS=$pkg_cv_FREETYPE_LIBS
@@ -12411,7 +13185,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables FONTCONFIG_CFLAGS
 and FONTCONFIG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12426,7 +13200,7 @@ and FONTCONFIG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS
 	FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS
@@ -12590,7 +13364,7 @@ installed software in a non-standard prefix.
 
 Alternatively, you may set the environment variables LIBPNG_CFLAGS
 and LIBPNG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5         
+See the pkg-config man page for more details." "$LINENO" 5        
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12605,7 +13379,7 @@ and LIBPNG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }        
+See \`config.log' for more details" "$LINENO" 5; }        
 else
 	LIBPNG_CFLAGS=$pkg_cv_LIBPNG_CFLAGS
 	LIBPNG_LIBS=$pkg_cv_LIBPNG_LIBS
@@ -12720,10 +13494,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
+    if test "x$cache_file" != "x/dev/null"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -12764,22 +13549,22 @@ fi
 
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
   as_fn_error $? "conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_LIBPNG\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5 
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -12880,6 +13665,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in @%:@((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -13187,7 +13973,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13253,7 +14039,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 libass config.status 0.9.11
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -13381,131 +14167,153 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
-for var in SED \
+for var in SHELL \
+ECHO \
+SED \
 GREP \
 EGREP \
 FGREP \
@@ -13518,8 +14326,13 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
+archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -13529,14 +14342,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-SHELL \
-ECHO \
+nm_file_list_spec \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
 lt_prog_compiler_pic \
+lt_prog_compiler_wl \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
+MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -13552,7 +14365,6 @@ no_undefined_flag \
 hardcode_libdir_flag_spec \
 hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
-fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -13560,12 +14372,13 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
+install_override_mode \
 finish_eval \
 old_striplib \
 striplib; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13587,14 +14400,15 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
+postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13602,12 +14416,6 @@ sys_lib_dlsearch_path_spec; do
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
-  ;;
-esac
-
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -13644,7 +14452,7 @@ do
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
     "libass.pc") CONFIG_FILES="$CONFIG_FILES libass.pc" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -13667,9 +14475,10 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -13677,12 +14486,13 @@ $debug ||
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -13704,7 +14514,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -13713,18 +14523,18 @@ _ACEOF
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -13732,7 +14542,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -13780,7 +14590,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -13812,8 +14622,8 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
 # VPATH may cause trouble with some makes, so we remove sole $(srcdir),
@@ -13846,7 +14656,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -13858,11 +14668,11 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -13947,7 +14757,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -13960,7 +14770,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -13979,7 +14789,7 @@ do
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -13988,7 +14798,7 @@ do
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -14014,8 +14824,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -14151,23 +14961,24 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -14176,21 +14987,21 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
-	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error $? "could not create -" "$LINENO" 5 
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
 _am_arg="$ac_file"
@@ -14351,7 +15162,8 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -14399,6 +15211,12 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -14448,9 +15266,11 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -14458,13 +15278,30 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == "file_magic".
+# Command to use when deplibs_check_method = "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
 # The archiver.
 AR=$lt_AR
+
+# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -14473,6 +15310,9 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
 # A C compiler.
 LTCC=$lt_CC
 
@@ -14491,14 +15331,14 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
 
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
 
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
@@ -14506,6 +15346,9 @@ MAGIC_CMD=$MAGIC_CMD
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -14562,6 +15405,9 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -14601,6 +15447,10 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -14613,12 +15463,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -14705,9 +15555,6 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -14723,6 +15570,9 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -14755,212 +15605,169 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
-
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
@@ -14975,7 +15782,7 @@ _ACEOF
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
diff --git a/libass/autom4te.cache/requests b/libass/autom4te.cache/requests
index b8a0baa..a805d24 100644
--- a/libass/autom4te.cache/requests
+++ b/libass/autom4te.cache/requests
@@ -1,4 +1,4 @@
-# This file was generated by Autom4te Tue Aug  3 21:06:07 PDT 2010.
+# This file was generated by Autom4te Sat Apr  9 10:01:39 PDT 2011.
 # It contains the lists of macros which have been traced.
 # It can be safely removed.
 
@@ -69,14 +69,16 @@
                         'LT_SYS_SYMBOL_USCORE' => 1,
                         '_AM_PROG_TAR' => 1,
                         'AC_LIBTOOL_GCJ' => 1,
+                        '_LT_WITH_SYSROOT' => 1,
                         'LT_SYS_DLOPEN_DEPLIBS' => 1,
                         'LT_FUNC_DLSYM_USCORE' => 1,
-                        '_LT_AC_LANG_F77' => 1,
                         'AC_LIBTOOL_CONFIG' => 1,
+                        '_LT_AC_LANG_F77' => 1,
                         '_AM_SUBST_NOTMAKE' => 1,
                         'AC_LTDL_DLLIB' => 1,
                         '_AM_AUTOCONF_VERSION' => 1,
                         'AM_DISABLE_SHARED' => 1,
+                        '_LT_PROG_ECHO_BACKSLASH' => 1,
                         '_LTDL_SETUP' => 1,
                         '_LT_AC_LANG_CXX' => 1,
                         'AM_PROG_LIBTOOL' => 1,
@@ -94,6 +96,7 @@
                         '_AM_SET_OPTION' => 1,
                         'AC_LTDL_PREOPEN' => 1,
                         '_LT_LINKER_BOILERPLATE' => 1,
+                        '_LT_PREPARE_SED_QUOTE_VARS' => 1,
                         'AC_LIBTOOL_LANG_CXX_CONFIG' => 1,
                         'AC_LIBTOOL_PROG_CC_C_O' => 1,
                         'gl_PREREQ_ARGZ' => 1,
@@ -118,12 +121,15 @@
                         '_LT_AC_LANG_GCJ_CONFIG' => 1,
                         'AC_ENABLE_SHARED' => 1,
                         'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
+                        '_LT_REQUIRED_DARWIN_CHECKS' => 1,
                         'AC_ENABLE_STATIC' => 1,
                         '_LT_AC_TAGVAR' => 1,
                         'AM_PROG_CC_C_O' => 1,
                         'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
                         'AM_CONDITIONAL' => 1,
                         'LT_LIB_DLLOAD' => 1,
+                        '_LT_PROG_F77' => 1,
+                        '_LT_PROG_CXX' => 1,
                         'LTDL_INIT' => 1,
                         'LTVERSION_VERSION' => 1,
                         'AM_PROG_INSTALL_SH' => 1,
@@ -160,14 +166,16 @@
                         'LT_INIT' => 1,
                         'LT_AC_PROG_GCJ' => 1,
                         'LT_SYS_DLOPEN_SELF' => 1,
-                        'AM_DEP_TRACK' => 1,
                         'AM_DISABLE_STATIC' => 1,
+                        'AM_DEP_TRACK' => 1,
+                        '_LT_AC_PROG_CXXCPP' => 1,
                         '_AC_PROG_LIBTOOL' => 1,
                         '_AM_IF_OPTION' => 1,
                         'AC_PATH_TOOL_PREFIX' => 1,
-                        'm4_pattern_allow' => 1,
                         'AC_LIBTOOL_F77' => 1,
+                        'm4_pattern_allow' => 1,
                         'AM_SET_LEADING_DOT' => 1,
+                        '_LT_PROG_FC' => 1,
                         'LT_AC_PROG_EGREP' => 1,
                         '_AM_DEPENDENCIES' => 1,
                         'AC_LIBTOOL_LANG_C_CONFIG' => 1,
@@ -199,9 +207,9 @@
                         '_LT_COMPILER_OPTION' => 1,
                         '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
                         'AM_RUN_LOG' => 1,
-                        'AC_LIBTOOL_PICMODE' => 1,
                         'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
                         'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
+                        'AC_LIBTOOL_PICMODE' => 1,
                         'LT_PATH_LD' => 1,
                         'AC_CHECK_LIBM' => 1,
                         'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
@@ -238,6 +246,7 @@
                         'AC_CANONICAL_HOST' => 1,
                         'AC_PROG_LIBTOOL' => 1,
                         'AM_INIT_AUTOMAKE' => 1,
+                        'AM_PATH_GUILE' => 1,
                         'AC_CONFIG_SUBDIRS' => 1,
                         'AM_AUTOMAKE_VERSION' => 1,
                         'LT_CONFIG_LTDL_DIR' => 1,
@@ -246,15 +255,20 @@
                         'm4_sinclude' => 1,
                         'LT_SUPPORTED_TAG' => 1,
                         'AM_MAINTAINER_MODE' => 1,
+                        'AM_NLS' => 1,
                         'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
+                        'AM_MAKEFILE_INCLUDE' => 1,
                         '_m4_warn' => 1,
                         'AM_PROG_CXX_C_O' => 1,
                         '_AM_COND_ENDIF' => 1,
+                        '_AM_MAKEFILE_INCLUDE' => 1,
                         'AM_ENABLE_MULTILIB' => 1,
                         'AM_SILENT_RULES' => 1,
+                        'AM_PROG_MOC' => 1,
                         'AC_CONFIG_FILES' => 1,
                         'LT_INIT' => 1,
                         'include' => 1,
+                        'AM_PROG_AR' => 1,
                         'AM_GNU_GETTEXT' => 1,
                         'AC_LIBSOURCE' => 1,
                         'AM_PROG_FC_C_O' => 1,
@@ -264,12 +278,14 @@
                         '_AM_SUBST_NOTMAKE' => 1,
                         'AC_CONFIG_AUX_DIR' => 1,
                         'sinclude' => 1,
-                        'm4_pattern_allow' => 1,
                         'AM_PROG_CC_C_O' => 1,
+                        'm4_pattern_allow' => 1,
+                        'AM_XGETTEXT_OPTION' => 1,
                         'AC_CANONICAL_SYSTEM' => 1,
                         'AM_CONDITIONAL' => 1,
                         'AC_CONFIG_HEADERS' => 1,
                         'AC_DEFINE_TRACE_LITERAL' => 1,
+                        'AM_POT_TOOLS' => 1,
                         'm4_include' => 1,
                         '_AM_COND_ELSE' => 1,
                         'AC_SUBST_TRACE' => 1
@@ -341,14 +357,16 @@
                         'LT_SYS_SYMBOL_USCORE' => 1,
                         '_AM_PROG_TAR' => 1,
                         'AC_LIBTOOL_GCJ' => 1,
+                        '_LT_WITH_SYSROOT' => 1,
                         'LT_SYS_DLOPEN_DEPLIBS' => 1,
                         'LT_FUNC_DLSYM_USCORE' => 1,
-                        '_LT_AC_LANG_F77' => 1,
                         'AC_LIBTOOL_CONFIG' => 1,
+                        '_LT_AC_LANG_F77' => 1,
                         '_AM_SUBST_NOTMAKE' => 1,
                         'AC_LTDL_DLLIB' => 1,
                         '_AM_AUTOCONF_VERSION' => 1,
                         'AM_DISABLE_SHARED' => 1,
+                        '_LT_PROG_ECHO_BACKSLASH' => 1,
                         '_LTDL_SETUP' => 1,
                         '_LT_AC_LANG_CXX' => 1,
                         'AM_PROG_LIBTOOL' => 1,
@@ -366,6 +384,7 @@
                         '_AM_SET_OPTION' => 1,
                         'AC_LTDL_PREOPEN' => 1,
                         '_LT_LINKER_BOILERPLATE' => 1,
+                        '_LT_PREPARE_SED_QUOTE_VARS' => 1,
                         'AC_LIBTOOL_LANG_CXX_CONFIG' => 1,
                         'AC_LIBTOOL_PROG_CC_C_O' => 1,
                         'gl_PREREQ_ARGZ' => 1,
@@ -390,12 +409,15 @@
                         '_LT_AC_LANG_GCJ_CONFIG' => 1,
                         'AC_ENABLE_SHARED' => 1,
                         'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
+                        '_LT_REQUIRED_DARWIN_CHECKS' => 1,
                         'AC_ENABLE_STATIC' => 1,
                         '_LT_AC_TAGVAR' => 1,
                         'AM_PROG_CC_C_O' => 1,
                         'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
                         'AM_CONDITIONAL' => 1,
                         'LT_LIB_DLLOAD' => 1,
+                        '_LT_PROG_F77' => 1,
+                        '_LT_PROG_CXX' => 1,
                         'LTDL_INIT' => 1,
                         'LTVERSION_VERSION' => 1,
                         'AM_PROG_INSTALL_SH' => 1,
@@ -432,14 +454,16 @@
                         'LT_INIT' => 1,
                         'LT_AC_PROG_GCJ' => 1,
                         'LT_SYS_DLOPEN_SELF' => 1,
-                        'AM_DEP_TRACK' => 1,
                         'AM_DISABLE_STATIC' => 1,
+                        'AM_DEP_TRACK' => 1,
+                        '_LT_AC_PROG_CXXCPP' => 1,
                         '_AC_PROG_LIBTOOL' => 1,
                         '_AM_IF_OPTION' => 1,
                         'AC_PATH_TOOL_PREFIX' => 1,
-                        'm4_pattern_allow' => 1,
                         'AC_LIBTOOL_F77' => 1,
+                        'm4_pattern_allow' => 1,
                         'AM_SET_LEADING_DOT' => 1,
+                        '_LT_PROG_FC' => 1,
                         'LT_AC_PROG_EGREP' => 1,
                         '_AM_DEPENDENCIES' => 1,
                         'AC_LIBTOOL_LANG_C_CONFIG' => 1,
@@ -471,9 +495,9 @@
                         '_LT_COMPILER_OPTION' => 1,
                         '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
                         'AM_RUN_LOG' => 1,
-                        'AC_LIBTOOL_PICMODE' => 1,
                         'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
                         'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
+                        'AC_LIBTOOL_PICMODE' => 1,
                         'LT_PATH_LD' => 1,
                         'AC_CHECK_LIBM' => 1,
                         'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
diff --git a/libass/autom4te.cache/traces.0 b/libass/autom4te.cache/traces.0
index 1fc5e8c..f029359 100644
--- a/libass/autom4te.cache/traces.0
+++ b/libass/autom4te.cache/traces.0
@@ -54,7 +54,7 @@ AS_IF([test -z "$ARGZ_H"],
 	   ;; #(
 	 *) lt_cv_sys_argz_works=yes ;;
 	 esac]])
-     AS_IF([test $lt_cv_sys_argz_works = yes],
+     AS_IF([test "$lt_cv_sys_argz_works" = yes],
         [AC_DEFINE([HAVE_WORKING_ARGZ], 1,
                    [This value is set to 1 to indicate that the system argz facility works])],
         [ARGZ_H=argz.h
@@ -63,7 +63,8 @@ AS_IF([test -z "$ARGZ_H"],
 AC_SUBST([ARGZ_H])
 ])
 m4trace:/usr/share/aclocal/argz.m4:79: -1- AC_DEFUN([gl_PREREQ_ARGZ], [:])
-m4trace:/usr/share/aclocal/libtool.m4:67: -1- AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+m4trace:/usr/share/aclocal/libtool.m4:69: -1- AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
 AC_BEFORE([$0], [LTDL_INIT])dnl
@@ -80,6 +81,8 @@ AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
 dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
@@ -95,30 +98,21 @@ _LT_SETUP
 # Only expand once:
 m4_define([LT_INIT])
 ])
-m4trace:/usr/share/aclocal/libtool.m4:102: -1- AU_DEFUN([AC_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:102: -1- AC_DEFUN([AC_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:107: -1- AU_DEFUN([AC_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:107: -1- AC_DEFUN([AC_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:103: -1- AU_DEFUN([AM_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:103: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LIBTOOL' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:108: -1- AU_DEFUN([AM_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:108: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LIBTOOL' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:562: -1- AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt}
+m4trace:/usr/share/aclocal/libtool.m4:607: -1- AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt}
 AC_MSG_NOTICE([creating $CONFIG_LT])
-cat >"$CONFIG_LT" <<_LTEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate a libtool stub with the current configuration.
-
-lt_cl_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_LTEOF
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
 
 cat >>"$CONFIG_LT" <<\_LTEOF
-AS_SHELL_SANITIZE
-_AS_PREPARE
-
-exec AS_MESSAGE_FD>&1
+lt_cl_silent=false
 exec AS_MESSAGE_LOG_FD>>config.log
 {
   echo
@@ -144,7 +138,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -189,18 +183,16 @@ chmod +x "$CONFIG_LT"
 # appending to config.log, which fails on DOS, as config.log is still kept
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
-if test "$no_create" != yes; then
-  lt_cl_success=:
-  test "$silent" = yes &&
-    lt_config_lt_args="$lt_config_lt_args --quiet"
-  exec AS_MESSAGE_LOG_FD>/dev/null
-  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-  exec AS_MESSAGE_LOG_FD>>config.log
-  $lt_cl_success || AS_EXIT(1)
-fi
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
 ])
-m4trace:/usr/share/aclocal/libtool.m4:757: -1- AC_DEFUN([LT_SUPPORTED_TAG], [])
-m4trace:/usr/share/aclocal/libtool.m4:768: -1- AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4trace:/usr/share/aclocal/libtool.m4:788: -1- AC_DEFUN([LT_SUPPORTED_TAG], [])
+m4trace:/usr/share/aclocal/libtool.m4:799: -1- AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl
 m4_case([$1],
   [C],			[_LT_LANG(C)],
   [C++],		[_LT_LANG(CXX)],
@@ -212,23 +204,56 @@ m4_case([$1],
     [_LT_LANG($1)],
     [m4_fatal([$0: unsupported language: "$1"])])])dnl
 ])
-m4trace:/usr/share/aclocal/libtool.m4:830: -1- AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
-m4trace:/usr/share/aclocal/libtool.m4:830: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_CXX' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:861: -1- AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+m4trace:/usr/share/aclocal/libtool.m4:861: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_CXX' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(C++)])
-m4trace:/usr/share/aclocal/libtool.m4:831: -1- AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
-m4trace:/usr/share/aclocal/libtool.m4:831: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_F77' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:862: -1- AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+m4trace:/usr/share/aclocal/libtool.m4:862: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_F77' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(Fortran 77)])
-m4trace:/usr/share/aclocal/libtool.m4:832: -1- AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
-m4trace:/usr/share/aclocal/libtool.m4:832: -1- AC_DEFUN([AC_LIBTOOL_FC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_FC' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:863: -1- AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+m4trace:/usr/share/aclocal/libtool.m4:863: -1- AC_DEFUN([AC_LIBTOOL_FC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_FC' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(Fortran)])
-m4trace:/usr/share/aclocal/libtool.m4:833: -1- AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-m4trace:/usr/share/aclocal/libtool.m4:833: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_GCJ' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:864: -1- AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+m4trace:/usr/share/aclocal/libtool.m4:864: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_GCJ' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(Java)])
-m4trace:/usr/share/aclocal/libtool.m4:1402: -1- AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4trace:/usr/share/aclocal/libtool.m4:865: -1- AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+m4trace:/usr/share/aclocal/libtool.m4:865: -1- AC_DEFUN([AC_LIBTOOL_RC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_RC' is obsolete.
+You should run autoupdate.])dnl
+LT_LANG(Windows Resource)])
+m4trace:/usr/share/aclocal/libtool.m4:1181: -1- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+m4trace:/usr/share/aclocal/libtool.m4:1445: -1- AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_SED])dnl
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
@@ -244,15 +269,15 @@ AC_CACHE_CHECK([$1], [$2],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        $2=yes
@@ -267,11 +292,11 @@ else
     m4_if([$6], , :, [$6])
 fi
 ])
-m4trace:/usr/share/aclocal/libtool.m4:1444: -1- AU_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:1444: -1- AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_COMPILER_OPTION' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:1487: -1- AU_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:1487: -1- AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_COMPILER_OPTION' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:1453: -1- AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4trace:/usr/share/aclocal/libtool.m4:1496: -1- AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_SED])dnl
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
@@ -284,7 +309,7 @@ AC_CACHE_CHECK([$1], [$2],
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
@@ -303,11 +328,11 @@ else
     m4_if([$5], , :, [$5])
 fi
 ])
-m4trace:/usr/share/aclocal/libtool.m4:1488: -1- AU_DEFUN([AC_LIBTOOL_LINKER_OPTION], [m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:1488: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_LINKER_OPTION' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:1531: -1- AU_DEFUN([AC_LIBTOOL_LINKER_OPTION], [m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:1531: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_LINKER_OPTION' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:1495: -1- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:/usr/share/aclocal/libtool.m4:1538: -1- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 # find the maximum length of command line arguments
 AC_MSG_CHECKING([the maximum length of command line arguments])
 AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
@@ -341,6 +366,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -405,8 +435,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -432,11 +462,11 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
 _LT_DECL([], [max_cmd_len], [0],
     [What is the maximum length of a command?])
 ])
-m4trace:/usr/share/aclocal/libtool.m4:1623: -1- AU_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:1623: -1- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_SYS_MAX_CMD_LEN' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:1671: -1- AU_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:1671: -1- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_SYS_MAX_CMD_LEN' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:1724: -1- AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl
+m4trace:/usr/share/aclocal/libtool.m4:1782: -1- AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl
 if test "x$enable_dlopen" != xyes; then
   enable_dlopen=unknown
   enable_dlopen_self=unknown
@@ -550,11 +580,11 @@ _LT_DECL([dlopen_self], [enable_dlopen_self], [0],
 _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
 	 [Whether dlopen of statically linked programs is supported])
 ])
-m4trace:/usr/share/aclocal/libtool.m4:1841: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:1841: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN_SELF' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:1899: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:1899: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN_SELF' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:2741: -1- AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl
+m4trace:/usr/share/aclocal/libtool.m4:2884: -1- AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl
 AC_MSG_CHECKING([for $1])
 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
 [case $MAGIC_CMD in
@@ -613,15 +643,16 @@ fi
 _LT_DECL([], [MAGIC_CMD], [0],
 	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
 ])
-m4trace:/usr/share/aclocal/libtool.m4:2803: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:2803: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:2946: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:2946: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:2826: -1- AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl
+m4trace:/usr/share/aclocal/libtool.m4:2969: -1- AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
@@ -702,15 +733,15 @@ AC_SUBST([LD])
 
 _LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
 ])
-m4trace:/usr/share/aclocal/libtool.m4:2914: -1- AU_DEFUN([AM_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:2914: -1- AC_DEFUN([AM_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LD' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:3058: -1- AU_DEFUN([AM_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:3058: -1- AC_DEFUN([AM_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LD' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:2915: -1- AU_DEFUN([AC_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:2915: -1- AC_DEFUN([AC_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LD' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:3059: -1- AU_DEFUN([AC_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:3059: -1- AC_DEFUN([AC_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LD' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:3179: -1- AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl
+m4trace:/usr/share/aclocal/libtool.m4:3353: -1- AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl
 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
 [if test -n "$NM"; then
   # Let the user override the test.
@@ -759,7 +790,19 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   AC_SUBST([DUMPBIN])
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -772,31 +815,31 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
   [lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
   cat conftest.out >&AS_MESSAGE_LOG_FD
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
   fi
   rm -f conftest*])
 ])
-m4trace:/usr/share/aclocal/libtool.m4:3257: -1- AU_DEFUN([AM_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:3257: -1- AC_DEFUN([AM_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_NM' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:3443: -1- AU_DEFUN([AM_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:3443: -1- AC_DEFUN([AM_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_NM' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:3258: -1- AU_DEFUN([AC_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:3258: -1- AC_DEFUN([AC_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_NM' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:3444: -1- AU_DEFUN([AC_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:3444: -1- AC_DEFUN([AC_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_NM' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:3267: -1- AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:/usr/share/aclocal/libtool.m4:3514: -1- AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
@@ -809,28 +852,28 @@ case $host in
 esac
 AC_SUBST([LIBM])
 ])
-m4trace:/usr/share/aclocal/libtool.m4:3286: -1- AU_DEFUN([AC_CHECK_LIBM], [m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:3286: -1- AC_DEFUN([AC_CHECK_LIBM], [AC_DIAGNOSE([obsolete], [The macro `AC_CHECK_LIBM' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:3533: -1- AU_DEFUN([AC_CHECK_LIBM], [m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:3533: -1- AC_DEFUN([AC_CHECK_LIBM], [AC_DIAGNOSE([obsolete], [The macro `AC_CHECK_LIBM' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:6987: -1- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+m4trace:/usr/share/aclocal/libtool.m4:7498: -1- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
   [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
     [AC_CHECK_TOOL(GCJ, gcj,)
       test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
       AC_SUBST(GCJFLAGS)])])[]dnl
 ])
-m4trace:/usr/share/aclocal/libtool.m4:6996: -1- AU_DEFUN([LT_AC_PROG_GCJ], [m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:6996: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_GCJ' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:7507: -1- AU_DEFUN([LT_AC_PROG_GCJ], [m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:7507: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_GCJ' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:7003: -1- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,)
+m4trace:/usr/share/aclocal/libtool.m4:7514: -1- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,)
 ])
-m4trace:/usr/share/aclocal/libtool.m4:7008: -1- AU_DEFUN([LT_AC_PROG_RC], [m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:7008: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_RC' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:7519: -1- AU_DEFUN([LT_AC_PROG_RC], [m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:7519: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_RC' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:7119: -1- AU_DEFUN([LT_AC_PROG_SED], [m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])])
-m4trace:/usr/share/aclocal/libtool.m4:7119: -1- AC_DEFUN([LT_AC_PROG_SED], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_SED' is obsolete.
+m4trace:/usr/share/aclocal/libtool.m4:7639: -1- AU_DEFUN([LT_AC_PROG_SED], [m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])])
+m4trace:/usr/share/aclocal/libtool.m4:7639: -1- AC_DEFUN([LT_AC_PROG_SED], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_SED' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])])
 m4trace:/usr/share/aclocal/ltdl.m4:16: -1- AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT])
@@ -1047,13 +1090,19 @@ AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h],
 AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
 AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
 
+m4_pattern_allow([LT_LIBEXT])dnl
 AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
 
+name=
+eval "lt_libprefix=\"$libname_spec\""
+m4_pattern_allow([LT_LIBPREFIX])dnl
+AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix])
+
 name=ltdl
-LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`
+eval "LTDLOPEN=\"$libname_spec\""
 AC_SUBST([LTDLOPEN])
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:437: -1- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:443: -1- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
   [lt_cv_sys_dlopen_deplibs],
   [# PORTME does your system automatically load deplibs for dlopen?
@@ -1149,11 +1198,11 @@ if test "$lt_cv_sys_dlopen_deplibs" != yes; then
     [Define if the OS needs help to load dependent libraries for dlopen().])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:536: -1- AU_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:536: -1- AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYS_DLOPEN_DEPLIBS' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:542: -1- AU_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:542: -1- AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYS_DLOPEN_DEPLIBS' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:543: -1- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:549: -1- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
 AC_CACHE_CHECK([which extension is used for runtime loadable modules],
   [libltdl_cv_shlibext],
 [
@@ -1166,11 +1215,11 @@ if test -n "$libltdl_cv_shlibext"; then
     [Define to the extension used for runtime loadable modules, say, ".so".])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:559: -1- AU_DEFUN([AC_LTDL_SHLIBEXT], [m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:559: -1- AC_DEFUN([AC_LTDL_SHLIBEXT], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBEXT' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:565: -1- AU_DEFUN([AC_LTDL_SHLIBEXT], [m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:565: -1- AC_DEFUN([AC_LTDL_SHLIBEXT], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBEXT' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:566: -1- AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:572: -1- AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
 AC_CACHE_CHECK([which variable specifies run-time module search path],
   [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"])
 if test -n "$lt_cv_module_path_var"; then
@@ -1179,11 +1228,11 @@ if test -n "$lt_cv_module_path_var"; then
     [Define to the name of the environment variable that determines the run-time module search path.])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:578: -1- AU_DEFUN([AC_LTDL_SHLIBPATH], [m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:578: -1- AC_DEFUN([AC_LTDL_SHLIBPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBPATH' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:584: -1- AU_DEFUN([AC_LTDL_SHLIBPATH], [m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:584: -1- AC_DEFUN([AC_LTDL_SHLIBPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBPATH' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:585: -1- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:591: -1- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
 AC_CACHE_CHECK([for the default library search path],
   [lt_cv_sys_dlsearch_path],
   [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"])
@@ -1201,11 +1250,11 @@ if test -n "$lt_cv_sys_dlsearch_path"; then
     [Define to the system default library search path.])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:606: -1- AU_DEFUN([AC_LTDL_SYSSEARCHPATH], [m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:606: -1- AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYSSEARCHPATH' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:612: -1- AU_DEFUN([AC_LTDL_SYSSEARCHPATH], [m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:612: -1- AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYSSEARCHPATH' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:632: -1- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$])
+m4trace:/usr/share/aclocal/ltdl.m4:638: -1- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$])
 LT_DLLOADERS=
 AC_SUBST([LT_DLLOADERS])
 
@@ -1295,11 +1344,11 @@ AC_SUBST([LIBADD_DL])
 
 AC_LANG_POP
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:725: -1- AU_DEFUN([AC_LTDL_DLLIB], [m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:725: -1- AC_DEFUN([AC_LTDL_DLLIB], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLLIB' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:731: -1- AU_DEFUN([AC_LTDL_DLLIB], [m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:731: -1- AC_DEFUN([AC_LTDL_DLLIB], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLLIB' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:733: -1- AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:739: -1- AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
 AC_CACHE_CHECK([for _ prefix in compiled symbols],
   [lt_cv_sys_symbol_underscore],
   [lt_cv_sys_symbol_underscore=no
@@ -1333,11 +1382,11 @@ _LT_EOF
   sys_symbol_underscore=$lt_cv_sys_symbol_underscore
   AC_SUBST([sys_symbol_underscore])
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:770: -1- AU_DEFUN([AC_LTDL_SYMBOL_USCORE], [m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:770: -1- AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYMBOL_USCORE' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:776: -1- AU_DEFUN([AC_LTDL_SYMBOL_USCORE], [m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:776: -1- AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYMBOL_USCORE' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:777: -1- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:783: -1- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl
 if test x"$lt_cv_sys_symbol_underscore" = xyes; then
   if test x"$libltdl_cv_func_dlopen" = xyes ||
      test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then
@@ -1359,30 +1408,30 @@ if test x"$libltdl_cv_need_uscore" = xyes; then
     [Define if dlsym() requires a leading underscore in symbol names.])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:802: -1- AU_DEFUN([AC_LTDL_DLSYM_USCORE], [m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:802: -1- AC_DEFUN([AC_LTDL_DLSYM_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLSYM_USCORE' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:808: -1- AU_DEFUN([AC_LTDL_DLSYM_USCORE], [m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:808: -1- AC_DEFUN([AC_LTDL_DLSYM_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLSYM_USCORE' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])])
-m4trace:/usr/share/aclocal/ltoptions.m4:13: -1- AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-m4trace:/usr/share/aclocal/ltoptions.m4:110: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen])
+m4trace:/usr/share/aclocal/ltoptions.m4:14: -1- AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+m4trace:/usr/share/aclocal/ltoptions.m4:111: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `dlopen' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:110: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:111: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `dlopen' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:145: -1- AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:/usr/share/aclocal/ltoptions.m4:146: -1- AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 _LT_SET_OPTION([LT_INIT], [win32-dll])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `win32-dll' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:145: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:146: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete.
 You should run autoupdate.])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
 _LT_SET_OPTION([LT_INIT], [win32-dll])
@@ -1390,60 +1439,60 @@ AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `win32-dll' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:194: -1- AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+m4trace:/usr/share/aclocal/ltoptions.m4:195: -1- AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:198: -1- AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared])
+m4trace:/usr/share/aclocal/ltoptions.m4:199: -1- AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:202: -1- AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:202: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_SHARED' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:203: -1- AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+m4trace:/usr/share/aclocal/ltoptions.m4:203: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_SHARED' is obsolete.
 You should run autoupdate.])dnl
 AC_ENABLE_SHARED($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:203: -1- AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:203: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_SHARED' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:204: -1- AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+m4trace:/usr/share/aclocal/ltoptions.m4:204: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_SHARED' is obsolete.
 You should run autoupdate.])dnl
 AC_DISABLE_SHARED($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:248: -1- AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+m4trace:/usr/share/aclocal/ltoptions.m4:249: -1- AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:252: -1- AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static])
+m4trace:/usr/share/aclocal/ltoptions.m4:253: -1- AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:256: -1- AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:256: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_STATIC' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:257: -1- AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+m4trace:/usr/share/aclocal/ltoptions.m4:257: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_STATIC' is obsolete.
 You should run autoupdate.])dnl
 AC_ENABLE_STATIC($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:257: -1- AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:257: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_STATIC' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:258: -1- AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+m4trace:/usr/share/aclocal/ltoptions.m4:258: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_STATIC' is obsolete.
 You should run autoupdate.])dnl
 AC_DISABLE_STATIC($@)])
-m4trace:/usr/share/aclocal/ltoptions.m4:302: -1- AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+m4trace:/usr/share/aclocal/ltoptions.m4:303: -1- AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:302: -1- AC_DEFUN([AC_ENABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_ENABLE_FAST_INSTALL' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:303: -1- AC_DEFUN([AC_ENABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_ENABLE_FAST_INSTALL' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:309: -1- AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+m4trace:/usr/share/aclocal/ltoptions.m4:310: -1- AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `disable-fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:309: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_DISABLE_FAST_INSTALL' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:310: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_DISABLE_FAST_INSTALL' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `disable-fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:342: -1- AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only])
+m4trace:/usr/share/aclocal/ltoptions.m4:343: -1- AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `pic-only' option into LT_INIT's first parameter.])
 ])
-m4trace:/usr/share/aclocal/ltoptions.m4:342: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_PICMODE' is obsolete.
+m4trace:/usr/share/aclocal/ltoptions.m4:343: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_PICMODE' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
@@ -1451,8 +1500,8 @@ AC_DIAGNOSE([obsolete],
 put the `pic-only' option into LT_INIT's first parameter.])
 ])
 m4trace:/usr/share/aclocal/ltsugar.m4:13: -1- AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-m4trace:/usr/share/aclocal/ltversion.m4:18: -1- AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6b'
-macro_revision='1.3017'
+m4trace:/usr/share/aclocal/ltversion.m4:18: -1- AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4'
+macro_revision='1.3293'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
@@ -1491,19 +1540,22 @@ m4trace:/usr/share/aclocal/lt~obsolete.m4:75: -1- AC_DEFUN([_LT_AC_TAGCONFIG])
 m4trace:/usr/share/aclocal/lt~obsolete.m4:77: -1- AC_DEFUN([_LT_AC_LANG_CXX])
 m4trace:/usr/share/aclocal/lt~obsolete.m4:78: -1- AC_DEFUN([_LT_AC_LANG_F77])
 m4trace:/usr/share/aclocal/lt~obsolete.m4:79: -1- AC_DEFUN([_LT_AC_LANG_GCJ])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:80: -1- AC_DEFUN([AC_LIBTOOL_RC])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:81: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:82: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:83: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:84: -1- AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:85: -1- AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:86: -1- AC_DEFUN([_LT_AC_LANG_F77_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:87: -1- AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:88: -1- AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:89: -1- AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:90: -1- AC_DEFUN([_LT_AC_LANG_RC_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:91: -1- AC_DEFUN([AC_LIBTOOL_CONFIG])
-m4trace:/usr/share/aclocal/lt~obsolete.m4:92: -1- AC_DEFUN([_LT_AC_FILE_LTDLL_C])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:80: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:81: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:82: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:83: -1- AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:84: -1- AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:85: -1- AC_DEFUN([_LT_AC_LANG_F77_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:86: -1- AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:87: -1- AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:88: -1- AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:89: -1- AC_DEFUN([_LT_AC_LANG_RC_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:90: -1- AC_DEFUN([AC_LIBTOOL_CONFIG])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:91: -1- AC_DEFUN([_LT_AC_FILE_LTDLL_C])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:93: -1- AC_DEFUN([_LT_AC_PROG_CXXCPP])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:96: -1- AC_DEFUN([_LT_PROG_F77])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:97: -1- AC_DEFUN([_LT_PROG_FC])
+m4trace:/usr/share/aclocal/lt~obsolete.m4:98: -1- AC_DEFUN([_LT_PROG_CXX])
 m4trace:/usr/share/aclocal/pkg.m4:27: -1- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
@@ -2243,7 +2295,7 @@ m4trace:configure.ac:2: -1- AM_INIT_AUTOMAKE
 m4trace:configure.ac:2: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$])
 m4trace:configure.ac:2: -1- AM_SET_CURRENT_AUTOMAKE_VERSION
 m4trace:configure.ac:2: -1- AM_AUTOMAKE_VERSION([1.11.1])
-m4trace:configure.ac:2: -1- _AM_AUTOCONF_VERSION([2.67])
+m4trace:configure.ac:2: -1- _AM_AUTOCONF_VERSION([2.68])
 m4trace:configure.ac:2: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
 m4trace:configure.ac:2: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
 m4trace:configure.ac:2: -1- m4_pattern_allow([^INSTALL_DATA$])
@@ -2311,7 +2363,7 @@ m4trace:configure.ac:2: -1- _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT
 m4trace:configure.ac:2: -2- _AM_MANGLE_OPTION([silent-rules])
 m4trace:configure.ac:7: -1- AC_PROG_LIBTOOL
 m4trace:configure.ac:7: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
-You should run autoupdate.], [/usr/share/aclocal/libtool.m4:102: AC_PROG_LIBTOOL is expanded from...
+You should run autoupdate.], [/usr/share/aclocal/libtool.m4:107: AC_PROG_LIBTOOL is expanded from...
 configure.ac:7: the top level])
 m4trace:configure.ac:7: -1- LT_INIT
 m4trace:configure.ac:7: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$])
@@ -2330,6 +2382,8 @@ m4trace:configure.ac:7: -1- m4_pattern_allow([^host$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^host_cpu$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^host_vendor$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^host_os$])
+m4trace:configure.ac:7: -1- _LT_PREPARE_SED_QUOTE_VARS
+m4trace:configure.ac:7: -1- _LT_PROG_ECHO_BACKSLASH
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CFLAGS$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^LDFLAGS$])
@@ -2382,12 +2436,15 @@ m4trace:configure.ac:7: -1- m4_pattern_allow([^LN_S$])
 m4trace:configure.ac:7: -1- LT_CMD_MAX_LEN
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OBJDUMP$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OBJDUMP$])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^DLLTOOL$])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^DLLTOOL$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^AR$])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^ac_ct_AR$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^STRIP$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^RANLIB$])
+m4trace:configure.ac:7: -1- _LT_WITH_SYSROOT
 m4trace:configure.ac:7: -1- m4_pattern_allow([LT_OBJDIR])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^LT_OBJDIR$])
-m4trace:configure.ac:7: -1- m4_pattern_allow([^lt_ECHO$])
 m4trace:configure.ac:7: -1- _LT_CC_BASENAME([$compiler])
 m4trace:configure.ac:7: -1- _LT_PATH_TOOL_PREFIX([${ac_tool_prefix}file], [/usr/bin$PATH_SEPARATOR$PATH])
 m4trace:configure.ac:7: -1- _LT_PATH_TOOL_PREFIX([file], [/usr/bin$PATH_SEPARATOR$PATH])
@@ -2401,11 +2458,14 @@ m4trace:configure.ac:7: -1- _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGV
      esac], [_LT_TAGVAR(lt_prog_compiler_pic, )=
      _LT_TAGVAR(lt_prog_compiler_can_build_shared, )=no])
 m4trace:configure.ac:7: -1- _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [lt_cv_prog_compiler_static_works], [$lt_tmp_static_flag], [], [_LT_TAGVAR(lt_prog_compiler_static, )=])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^MANIFEST_TOOL$])
+m4trace:configure.ac:7: -1- _LT_REQUIRED_DARWIN_CHECKS
 m4trace:configure.ac:7: -1- m4_pattern_allow([^DSYMUTIL$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^NMEDIT$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^LIPO$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OTOOL$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OTOOL64$])
+m4trace:configure.ac:7: -1- _LT_LINKER_OPTION([if $CC understands -b], [lt_cv_prog_compiler__b], [-b], [_LT_TAGVAR(archive_cmds, )='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, )='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])
 m4trace:configure.ac:7: -1- LT_SYS_DLOPEN_SELF
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CPP$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CPPFLAGS$])
diff --git a/libass/autom4te.cache/traces.1 b/libass/autom4te.cache/traces.1
index 9eb66d6..4f4d7f5 100644
--- a/libass/autom4te.cache/traces.1
+++ b/libass/autom4te.cache/traces.1
@@ -237,7 +237,7 @@ m4trace:configure.ac:2: -1- AC_SUBST_TRACE([am__untar])
 m4trace:configure.ac:2: -1- m4_pattern_allow([^am__untar$])
 m4trace:configure.ac:7: -1- AC_PROG_LIBTOOL
 m4trace:configure.ac:7: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
-You should run autoupdate.], [m4/libtool.m4:102: AC_PROG_LIBTOOL is expanded from...
+You should run autoupdate.], [m4/libtool.m4:107: AC_PROG_LIBTOOL is expanded from...
 configure.ac:7: the top level])
 m4trace:configure.ac:7: -1- LT_INIT
 m4trace:configure.ac:7: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$])
@@ -385,9 +385,18 @@ m4trace:configure.ac:7: -1- m4_pattern_allow([^OBJDUMP$])
 m4trace:configure.ac:7: -1- AC_SUBST([OBJDUMP])
 m4trace:configure.ac:7: -1- AC_SUBST_TRACE([OBJDUMP])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OBJDUMP$])
+m4trace:configure.ac:7: -1- AC_SUBST([DLLTOOL])
+m4trace:configure.ac:7: -1- AC_SUBST_TRACE([DLLTOOL])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^DLLTOOL$])
+m4trace:configure.ac:7: -1- AC_SUBST([DLLTOOL])
+m4trace:configure.ac:7: -1- AC_SUBST_TRACE([DLLTOOL])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^DLLTOOL$])
 m4trace:configure.ac:7: -1- AC_SUBST([AR])
 m4trace:configure.ac:7: -1- AC_SUBST_TRACE([AR])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^AR$])
+m4trace:configure.ac:7: -1- AC_SUBST([ac_ct_AR])
+m4trace:configure.ac:7: -1- AC_SUBST_TRACE([ac_ct_AR])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^ac_ct_AR$])
 m4trace:configure.ac:7: -1- AC_SUBST([STRIP])
 m4trace:configure.ac:7: -1- AC_SUBST_TRACE([STRIP])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^STRIP$])
@@ -400,10 +409,10 @@ m4trace:configure.ac:7: -1- m4_pattern_allow([^LT_OBJDIR$])
 m4trace:configure.ac:7: -1- AH_OUTPUT([LT_OBJDIR], [/* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
 @%:@undef LT_OBJDIR])
-m4trace:configure.ac:7: -1- AC_SUBST([lt_ECHO])
-m4trace:configure.ac:7: -1- AC_SUBST_TRACE([lt_ECHO])
-m4trace:configure.ac:7: -1- m4_pattern_allow([^lt_ECHO$])
 m4trace:configure.ac:7: -1- LT_SUPPORTED_TAG([CC])
+m4trace:configure.ac:7: -1- AC_SUBST([MANIFEST_TOOL])
+m4trace:configure.ac:7: -1- AC_SUBST_TRACE([MANIFEST_TOOL])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^MANIFEST_TOOL$])
 m4trace:configure.ac:7: -1- AC_SUBST([DSYMUTIL])
 m4trace:configure.ac:7: -1- AC_SUBST_TRACE([DSYMUTIL])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^DSYMUTIL$])
diff --git a/libass/autom4te.cache/traces.2 b/libass/autom4te.cache/traces.2
index 6e6706a..6fd133f 100644
--- a/libass/autom4te.cache/traces.2
+++ b/libass/autom4te.cache/traces.2
@@ -54,7 +54,7 @@ AS_IF([test -z "$ARGZ_H"],
 	   ;; #(
 	 *) lt_cv_sys_argz_works=yes ;;
 	 esac]])
-     AS_IF([test $lt_cv_sys_argz_works = yes],
+     AS_IF([test "$lt_cv_sys_argz_works" = yes],
         [AC_DEFINE([HAVE_WORKING_ARGZ], 1,
                    [This value is set to 1 to indicate that the system argz facility works])],
         [ARGZ_H=argz.h
@@ -277,13 +277,19 @@ AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h],
 AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
 AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
 
+m4_pattern_allow([LT_LIBEXT])dnl
 AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
 
+name=
+eval "lt_libprefix=\"$libname_spec\""
+m4_pattern_allow([LT_LIBPREFIX])dnl
+AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix])
+
 name=ltdl
-LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`
+eval "LTDLOPEN=\"$libname_spec\""
 AC_SUBST([LTDLOPEN])
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:437: -1- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:443: -1- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
   [lt_cv_sys_dlopen_deplibs],
   [# PORTME does your system automatically load deplibs for dlopen?
@@ -379,11 +385,11 @@ if test "$lt_cv_sys_dlopen_deplibs" != yes; then
     [Define if the OS needs help to load dependent libraries for dlopen().])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:536: -1- AU_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:536: -1- AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYS_DLOPEN_DEPLIBS' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:542: -1- AU_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:542: -1- AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYS_DLOPEN_DEPLIBS' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:543: -1- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:549: -1- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
 AC_CACHE_CHECK([which extension is used for runtime loadable modules],
   [libltdl_cv_shlibext],
 [
@@ -396,11 +402,11 @@ if test -n "$libltdl_cv_shlibext"; then
     [Define to the extension used for runtime loadable modules, say, ".so".])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:559: -1- AU_DEFUN([AC_LTDL_SHLIBEXT], [m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:559: -1- AC_DEFUN([AC_LTDL_SHLIBEXT], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBEXT' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:565: -1- AU_DEFUN([AC_LTDL_SHLIBEXT], [m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:565: -1- AC_DEFUN([AC_LTDL_SHLIBEXT], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBEXT' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_MODULE_EXT], [LT_SYS_MODULE_EXT($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:566: -1- AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:572: -1- AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
 AC_CACHE_CHECK([which variable specifies run-time module search path],
   [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"])
 if test -n "$lt_cv_module_path_var"; then
@@ -409,11 +415,11 @@ if test -n "$lt_cv_module_path_var"; then
     [Define to the name of the environment variable that determines the run-time module search path.])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:578: -1- AU_DEFUN([AC_LTDL_SHLIBPATH], [m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:578: -1- AC_DEFUN([AC_LTDL_SHLIBPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBPATH' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:584: -1- AU_DEFUN([AC_LTDL_SHLIBPATH], [m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:584: -1- AC_DEFUN([AC_LTDL_SHLIBPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SHLIBPATH' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_MODULE_PATH], [LT_SYS_MODULE_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:585: -1- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:591: -1- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
 AC_CACHE_CHECK([for the default library search path],
   [lt_cv_sys_dlsearch_path],
   [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"])
@@ -431,11 +437,11 @@ if test -n "$lt_cv_sys_dlsearch_path"; then
     [Define to the system default library search path.])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:606: -1- AU_DEFUN([AC_LTDL_SYSSEARCHPATH], [m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:606: -1- AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYSSEARCHPATH' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:612: -1- AU_DEFUN([AC_LTDL_SYSSEARCHPATH], [m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:612: -1- AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYSSEARCHPATH' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_DLSEARCH_PATH], [LT_SYS_DLSEARCH_PATH($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:632: -1- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$])
+m4trace:/usr/share/aclocal/ltdl.m4:638: -1- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$])
 LT_DLLOADERS=
 AC_SUBST([LT_DLLOADERS])
 
@@ -525,11 +531,11 @@ AC_SUBST([LIBADD_DL])
 
 AC_LANG_POP
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:725: -1- AU_DEFUN([AC_LTDL_DLLIB], [m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:725: -1- AC_DEFUN([AC_LTDL_DLLIB], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLLIB' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:731: -1- AU_DEFUN([AC_LTDL_DLLIB], [m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:731: -1- AC_DEFUN([AC_LTDL_DLLIB], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLLIB' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_LIB_DLLOAD], [LT_LIB_DLLOAD($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:733: -1- AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:739: -1- AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
 AC_CACHE_CHECK([for _ prefix in compiled symbols],
   [lt_cv_sys_symbol_underscore],
   [lt_cv_sys_symbol_underscore=no
@@ -563,11 +569,11 @@ _LT_EOF
   sys_symbol_underscore=$lt_cv_sys_symbol_underscore
   AC_SUBST([sys_symbol_underscore])
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:770: -1- AU_DEFUN([AC_LTDL_SYMBOL_USCORE], [m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:770: -1- AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYMBOL_USCORE' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:776: -1- AU_DEFUN([AC_LTDL_SYMBOL_USCORE], [m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:776: -1- AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_SYMBOL_USCORE' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:777: -1- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl
+m4trace:/usr/share/aclocal/ltdl.m4:783: -1- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl
 if test x"$lt_cv_sys_symbol_underscore" = xyes; then
   if test x"$libltdl_cv_func_dlopen" = xyes ||
      test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then
@@ -589,8 +595,8 @@ if test x"$libltdl_cv_need_uscore" = xyes; then
     [Define if dlsym() requires a leading underscore in symbol names.])
 fi
 ])
-m4trace:/usr/share/aclocal/ltdl.m4:802: -1- AU_DEFUN([AC_LTDL_DLSYM_USCORE], [m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])])
-m4trace:/usr/share/aclocal/ltdl.m4:802: -1- AC_DEFUN([AC_LTDL_DLSYM_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLSYM_USCORE' is obsolete.
+m4trace:/usr/share/aclocal/ltdl.m4:808: -1- AU_DEFUN([AC_LTDL_DLSYM_USCORE], [m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])])
+m4trace:/usr/share/aclocal/ltdl.m4:808: -1- AC_DEFUN([AC_LTDL_DLSYM_USCORE], [AC_DIAGNOSE([obsolete], [The macro `AC_LTDL_DLSYM_USCORE' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_FUNC_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE($@)])])
 m4trace:/usr/share/aclocal/pkg.m4:27: -1- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
@@ -1277,7 +1283,8 @@ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
 AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ])
-m4trace:m4/libtool.m4:67: -1- AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+m4trace:m4/libtool.m4:69: -1- AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
 AC_BEFORE([$0], [LTDL_INIT])dnl
@@ -1294,6 +1301,8 @@ AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
 dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
@@ -1309,30 +1318,21 @@ _LT_SETUP
 # Only expand once:
 m4_define([LT_INIT])
 ])
-m4trace:m4/libtool.m4:102: -1- AU_DEFUN([AC_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:m4/libtool.m4:102: -1- AC_DEFUN([AC_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
+m4trace:m4/libtool.m4:107: -1- AU_DEFUN([AC_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
+m4trace:m4/libtool.m4:107: -1- AC_DEFUN([AC_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:m4/libtool.m4:103: -1- AU_DEFUN([AM_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:m4/libtool.m4:103: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LIBTOOL' is obsolete.
+m4trace:m4/libtool.m4:108: -1- AU_DEFUN([AM_PROG_LIBTOOL], [m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
+m4trace:m4/libtool.m4:108: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LIBTOOL' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_INIT], [LT_INIT($@)])])
-m4trace:m4/libtool.m4:562: -1- AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt}
+m4trace:m4/libtool.m4:607: -1- AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt}
 AC_MSG_NOTICE([creating $CONFIG_LT])
-cat >"$CONFIG_LT" <<_LTEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate a libtool stub with the current configuration.
-
-lt_cl_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_LTEOF
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
 
 cat >>"$CONFIG_LT" <<\_LTEOF
-AS_SHELL_SANITIZE
-_AS_PREPARE
-
-exec AS_MESSAGE_FD>&1
+lt_cl_silent=false
 exec AS_MESSAGE_LOG_FD>>config.log
 {
   echo
@@ -1358,7 +1358,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -1403,18 +1403,16 @@ chmod +x "$CONFIG_LT"
 # appending to config.log, which fails on DOS, as config.log is still kept
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
-if test "$no_create" != yes; then
-  lt_cl_success=:
-  test "$silent" = yes &&
-    lt_config_lt_args="$lt_config_lt_args --quiet"
-  exec AS_MESSAGE_LOG_FD>/dev/null
-  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-  exec AS_MESSAGE_LOG_FD>>config.log
-  $lt_cl_success || AS_EXIT(1)
-fi
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
 ])
-m4trace:m4/libtool.m4:757: -1- AC_DEFUN([LT_SUPPORTED_TAG], [])
-m4trace:m4/libtool.m4:768: -1- AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4trace:m4/libtool.m4:788: -1- AC_DEFUN([LT_SUPPORTED_TAG], [])
+m4trace:m4/libtool.m4:799: -1- AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl
 m4_case([$1],
   [C],			[_LT_LANG(C)],
   [C++],		[_LT_LANG(CXX)],
@@ -1426,23 +1424,56 @@ m4_case([$1],
     [_LT_LANG($1)],
     [m4_fatal([$0: unsupported language: "$1"])])])dnl
 ])
-m4trace:m4/libtool.m4:830: -1- AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
-m4trace:m4/libtool.m4:830: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_CXX' is obsolete.
+m4trace:m4/libtool.m4:861: -1- AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+m4trace:m4/libtool.m4:861: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_CXX' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(C++)])
-m4trace:m4/libtool.m4:831: -1- AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
-m4trace:m4/libtool.m4:831: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_F77' is obsolete.
+m4trace:m4/libtool.m4:862: -1- AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+m4trace:m4/libtool.m4:862: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_F77' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(Fortran 77)])
-m4trace:m4/libtool.m4:832: -1- AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
-m4trace:m4/libtool.m4:832: -1- AC_DEFUN([AC_LIBTOOL_FC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_FC' is obsolete.
+m4trace:m4/libtool.m4:863: -1- AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+m4trace:m4/libtool.m4:863: -1- AC_DEFUN([AC_LIBTOOL_FC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_FC' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(Fortran)])
-m4trace:m4/libtool.m4:833: -1- AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-m4trace:m4/libtool.m4:833: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_GCJ' is obsolete.
+m4trace:m4/libtool.m4:864: -1- AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+m4trace:m4/libtool.m4:864: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_GCJ' is obsolete.
 You should run autoupdate.])dnl
 LT_LANG(Java)])
-m4trace:m4/libtool.m4:1402: -1- AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4trace:m4/libtool.m4:865: -1- AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+m4trace:m4/libtool.m4:865: -1- AC_DEFUN([AC_LIBTOOL_RC], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_RC' is obsolete.
+You should run autoupdate.])dnl
+LT_LANG(Windows Resource)])
+m4trace:m4/libtool.m4:1181: -1- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+m4trace:m4/libtool.m4:1445: -1- AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_SED])dnl
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
@@ -1458,15 +1489,15 @@ AC_CACHE_CHECK([$1], [$2],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        $2=yes
@@ -1481,11 +1512,11 @@ else
     m4_if([$6], , :, [$6])
 fi
 ])
-m4trace:m4/libtool.m4:1444: -1- AU_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])])
-m4trace:m4/libtool.m4:1444: -1- AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_COMPILER_OPTION' is obsolete.
+m4trace:m4/libtool.m4:1487: -1- AU_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])])
+m4trace:m4/libtool.m4:1487: -1- AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_COMPILER_OPTION' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [_LT_COMPILER_OPTION], [_LT_COMPILER_OPTION($@)])])
-m4trace:m4/libtool.m4:1453: -1- AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4trace:m4/libtool.m4:1496: -1- AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_SED])dnl
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
@@ -1498,7 +1529,7 @@ AC_CACHE_CHECK([$1], [$2],
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
@@ -1517,11 +1548,11 @@ else
     m4_if([$5], , :, [$5])
 fi
 ])
-m4trace:m4/libtool.m4:1488: -1- AU_DEFUN([AC_LIBTOOL_LINKER_OPTION], [m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])])
-m4trace:m4/libtool.m4:1488: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_LINKER_OPTION' is obsolete.
+m4trace:m4/libtool.m4:1531: -1- AU_DEFUN([AC_LIBTOOL_LINKER_OPTION], [m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])])
+m4trace:m4/libtool.m4:1531: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_LINKER_OPTION' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [_LT_LINKER_OPTION], [_LT_LINKER_OPTION($@)])])
-m4trace:m4/libtool.m4:1495: -1- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:m4/libtool.m4:1538: -1- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 # find the maximum length of command line arguments
 AC_MSG_CHECKING([the maximum length of command line arguments])
 AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
@@ -1555,6 +1586,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -1619,8 +1655,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -1646,11 +1682,11 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
 _LT_DECL([], [max_cmd_len], [0],
     [What is the maximum length of a command?])
 ])
-m4trace:m4/libtool.m4:1623: -1- AU_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])])
-m4trace:m4/libtool.m4:1623: -1- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_SYS_MAX_CMD_LEN' is obsolete.
+m4trace:m4/libtool.m4:1671: -1- AU_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])])
+m4trace:m4/libtool.m4:1671: -1- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_SYS_MAX_CMD_LEN' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_CMD_MAX_LEN], [LT_CMD_MAX_LEN($@)])])
-m4trace:m4/libtool.m4:1724: -1- AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl
+m4trace:m4/libtool.m4:1782: -1- AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl
 if test "x$enable_dlopen" != xyes; then
   enable_dlopen=unknown
   enable_dlopen_self=unknown
@@ -1764,11 +1800,11 @@ _LT_DECL([dlopen_self], [enable_dlopen_self], [0],
 _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
 	 [Whether dlopen of statically linked programs is supported])
 ])
-m4trace:m4/libtool.m4:1841: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])])
-m4trace:m4/libtool.m4:1841: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN_SELF' is obsolete.
+m4trace:m4/libtool.m4:1899: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])])
+m4trace:m4/libtool.m4:1899: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN_SELF' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_SYS_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF($@)])])
-m4trace:m4/libtool.m4:2741: -1- AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl
+m4trace:m4/libtool.m4:2884: -1- AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl
 AC_MSG_CHECKING([for $1])
 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
 [case $MAGIC_CMD in
@@ -1827,15 +1863,16 @@ fi
 _LT_DECL([], [MAGIC_CMD], [0],
 	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
 ])
-m4trace:m4/libtool.m4:2803: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])])
-m4trace:m4/libtool.m4:2803: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete.
+m4trace:m4/libtool.m4:2946: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])])
+m4trace:m4/libtool.m4:2946: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])])
-m4trace:m4/libtool.m4:2826: -1- AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl
+m4trace:m4/libtool.m4:2969: -1- AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
@@ -1916,15 +1953,15 @@ AC_SUBST([LD])
 
 _LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
 ])
-m4trace:m4/libtool.m4:2914: -1- AU_DEFUN([AM_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:m4/libtool.m4:2914: -1- AC_DEFUN([AM_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LD' is obsolete.
+m4trace:m4/libtool.m4:3058: -1- AU_DEFUN([AM_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
+m4trace:m4/libtool.m4:3058: -1- AC_DEFUN([AM_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_LD' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:m4/libtool.m4:2915: -1- AU_DEFUN([AC_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:m4/libtool.m4:2915: -1- AC_DEFUN([AC_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LD' is obsolete.
+m4trace:m4/libtool.m4:3059: -1- AU_DEFUN([AC_PROG_LD], [m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
+m4trace:m4/libtool.m4:3059: -1- AC_DEFUN([AC_PROG_LD], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_LD' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_LD], [LT_PATH_LD($@)])])
-m4trace:m4/libtool.m4:3179: -1- AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl
+m4trace:m4/libtool.m4:3353: -1- AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl
 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
 [if test -n "$NM"; then
   # Let the user override the test.
@@ -1973,7 +2010,19 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   AC_SUBST([DUMPBIN])
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -1986,31 +2035,31 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
   [lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
   cat conftest.out >&AS_MESSAGE_LOG_FD
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
   fi
   rm -f conftest*])
 ])
-m4trace:m4/libtool.m4:3257: -1- AU_DEFUN([AM_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:m4/libtool.m4:3257: -1- AC_DEFUN([AM_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_NM' is obsolete.
+m4trace:m4/libtool.m4:3443: -1- AU_DEFUN([AM_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
+m4trace:m4/libtool.m4:3443: -1- AC_DEFUN([AM_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AM_PROG_NM' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:m4/libtool.m4:3258: -1- AU_DEFUN([AC_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:m4/libtool.m4:3258: -1- AC_DEFUN([AC_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_NM' is obsolete.
+m4trace:m4/libtool.m4:3444: -1- AU_DEFUN([AC_PROG_NM], [m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
+m4trace:m4/libtool.m4:3444: -1- AC_DEFUN([AC_PROG_NM], [AC_DIAGNOSE([obsolete], [The macro `AC_PROG_NM' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PATH_NM], [LT_PATH_NM($@)])])
-m4trace:m4/libtool.m4:3267: -1- AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:m4/libtool.m4:3514: -1- AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
@@ -2023,50 +2072,50 @@ case $host in
 esac
 AC_SUBST([LIBM])
 ])
-m4trace:m4/libtool.m4:3286: -1- AU_DEFUN([AC_CHECK_LIBM], [m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])])
-m4trace:m4/libtool.m4:3286: -1- AC_DEFUN([AC_CHECK_LIBM], [AC_DIAGNOSE([obsolete], [The macro `AC_CHECK_LIBM' is obsolete.
+m4trace:m4/libtool.m4:3533: -1- AU_DEFUN([AC_CHECK_LIBM], [m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])])
+m4trace:m4/libtool.m4:3533: -1- AC_DEFUN([AC_CHECK_LIBM], [AC_DIAGNOSE([obsolete], [The macro `AC_CHECK_LIBM' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_LIB_M], [LT_LIB_M($@)])])
-m4trace:m4/libtool.m4:6987: -1- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+m4trace:m4/libtool.m4:7498: -1- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
   [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
     [AC_CHECK_TOOL(GCJ, gcj,)
       test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
       AC_SUBST(GCJFLAGS)])])[]dnl
 ])
-m4trace:m4/libtool.m4:6996: -1- AU_DEFUN([LT_AC_PROG_GCJ], [m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])])
-m4trace:m4/libtool.m4:6996: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_GCJ' is obsolete.
+m4trace:m4/libtool.m4:7507: -1- AU_DEFUN([LT_AC_PROG_GCJ], [m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])])
+m4trace:m4/libtool.m4:7507: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_GCJ' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PROG_GCJ], [LT_PROG_GCJ($@)])])
-m4trace:m4/libtool.m4:7003: -1- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,)
+m4trace:m4/libtool.m4:7514: -1- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,)
 ])
-m4trace:m4/libtool.m4:7008: -1- AU_DEFUN([LT_AC_PROG_RC], [m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])])
-m4trace:m4/libtool.m4:7008: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_RC' is obsolete.
+m4trace:m4/libtool.m4:7519: -1- AU_DEFUN([LT_AC_PROG_RC], [m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])])
+m4trace:m4/libtool.m4:7519: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_RC' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [LT_PROG_RC], [LT_PROG_RC($@)])])
-m4trace:m4/libtool.m4:7119: -1- AU_DEFUN([LT_AC_PROG_SED], [m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])])
-m4trace:m4/libtool.m4:7119: -1- AC_DEFUN([LT_AC_PROG_SED], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_SED' is obsolete.
+m4trace:m4/libtool.m4:7639: -1- AU_DEFUN([LT_AC_PROG_SED], [m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])])
+m4trace:m4/libtool.m4:7639: -1- AC_DEFUN([LT_AC_PROG_SED], [AC_DIAGNOSE([obsolete], [The macro `LT_AC_PROG_SED' is obsolete.
 You should run autoupdate.])dnl
 m4_if($#, 0, [AC_PROG_SED], [AC_PROG_SED($@)])])
-m4trace:m4/ltoptions.m4:13: -1- AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-m4trace:m4/ltoptions.m4:110: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen])
+m4trace:m4/ltoptions.m4:14: -1- AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+m4trace:m4/ltoptions.m4:111: -1- AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `dlopen' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:110: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN' is obsolete.
+m4trace:m4/ltoptions.m4:111: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_DLOPEN' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `dlopen' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:145: -1- AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4trace:m4/ltoptions.m4:146: -1- AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 _LT_SET_OPTION([LT_INIT], [win32-dll])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `win32-dll' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:145: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete.
+m4trace:m4/ltoptions.m4:146: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete.
 You should run autoupdate.])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
 _LT_SET_OPTION([LT_INIT], [win32-dll])
@@ -2074,60 +2123,60 @@ AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `win32-dll' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:194: -1- AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+m4trace:m4/ltoptions.m4:195: -1- AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
 ])
-m4trace:m4/ltoptions.m4:198: -1- AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared])
+m4trace:m4/ltoptions.m4:199: -1- AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared])
 ])
-m4trace:m4/ltoptions.m4:202: -1- AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-m4trace:m4/ltoptions.m4:202: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_SHARED' is obsolete.
+m4trace:m4/ltoptions.m4:203: -1- AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+m4trace:m4/ltoptions.m4:203: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_SHARED' is obsolete.
 You should run autoupdate.])dnl
 AC_ENABLE_SHARED($@)])
-m4trace:m4/ltoptions.m4:203: -1- AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-m4trace:m4/ltoptions.m4:203: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_SHARED' is obsolete.
+m4trace:m4/ltoptions.m4:204: -1- AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+m4trace:m4/ltoptions.m4:204: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_SHARED' is obsolete.
 You should run autoupdate.])dnl
 AC_DISABLE_SHARED($@)])
-m4trace:m4/ltoptions.m4:248: -1- AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+m4trace:m4/ltoptions.m4:249: -1- AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
 ])
-m4trace:m4/ltoptions.m4:252: -1- AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static])
+m4trace:m4/ltoptions.m4:253: -1- AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static])
 ])
-m4trace:m4/ltoptions.m4:256: -1- AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-m4trace:m4/ltoptions.m4:256: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_STATIC' is obsolete.
+m4trace:m4/ltoptions.m4:257: -1- AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+m4trace:m4/ltoptions.m4:257: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_ENABLE_STATIC' is obsolete.
 You should run autoupdate.])dnl
 AC_ENABLE_STATIC($@)])
-m4trace:m4/ltoptions.m4:257: -1- AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-m4trace:m4/ltoptions.m4:257: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_STATIC' is obsolete.
+m4trace:m4/ltoptions.m4:258: -1- AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+m4trace:m4/ltoptions.m4:258: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DIAGNOSE([obsolete], [The macro `AM_DISABLE_STATIC' is obsolete.
 You should run autoupdate.])dnl
 AC_DISABLE_STATIC($@)])
-m4trace:m4/ltoptions.m4:302: -1- AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+m4trace:m4/ltoptions.m4:303: -1- AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:302: -1- AC_DEFUN([AC_ENABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_ENABLE_FAST_INSTALL' is obsolete.
+m4trace:m4/ltoptions.m4:303: -1- AC_DEFUN([AC_ENABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_ENABLE_FAST_INSTALL' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:309: -1- AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+m4trace:m4/ltoptions.m4:310: -1- AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `disable-fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:309: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_DISABLE_FAST_INSTALL' is obsolete.
+m4trace:m4/ltoptions.m4:310: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_DIAGNOSE([obsolete], [The macro `AC_DISABLE_FAST_INSTALL' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `disable-fast-install' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:342: -1- AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only])
+m4trace:m4/ltoptions.m4:343: -1- AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `pic-only' option into LT_INIT's first parameter.])
 ])
-m4trace:m4/ltoptions.m4:342: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_PICMODE' is obsolete.
+m4trace:m4/ltoptions.m4:343: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_DIAGNOSE([obsolete], [The macro `AC_LIBTOOL_PICMODE' is obsolete.
 You should run autoupdate.])dnl
 _LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
@@ -2135,8 +2184,8 @@ AC_DIAGNOSE([obsolete],
 put the `pic-only' option into LT_INIT's first parameter.])
 ])
 m4trace:m4/ltsugar.m4:13: -1- AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-m4trace:m4/ltversion.m4:18: -1- AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6b'
-macro_revision='1.3017'
+m4trace:m4/ltversion.m4:18: -1- AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4'
+macro_revision='1.3293'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
@@ -2175,19 +2224,22 @@ m4trace:m4/lt~obsolete.m4:75: -1- AC_DEFUN([_LT_AC_TAGCONFIG])
 m4trace:m4/lt~obsolete.m4:77: -1- AC_DEFUN([_LT_AC_LANG_CXX])
 m4trace:m4/lt~obsolete.m4:78: -1- AC_DEFUN([_LT_AC_LANG_F77])
 m4trace:m4/lt~obsolete.m4:79: -1- AC_DEFUN([_LT_AC_LANG_GCJ])
-m4trace:m4/lt~obsolete.m4:80: -1- AC_DEFUN([AC_LIBTOOL_RC])
-m4trace:m4/lt~obsolete.m4:81: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])
-m4trace:m4/lt~obsolete.m4:82: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG])
-m4trace:m4/lt~obsolete.m4:83: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])
-m4trace:m4/lt~obsolete.m4:84: -1- AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])
-m4trace:m4/lt~obsolete.m4:85: -1- AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])
-m4trace:m4/lt~obsolete.m4:86: -1- AC_DEFUN([_LT_AC_LANG_F77_CONFIG])
-m4trace:m4/lt~obsolete.m4:87: -1- AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])
-m4trace:m4/lt~obsolete.m4:88: -1- AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])
-m4trace:m4/lt~obsolete.m4:89: -1- AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])
-m4trace:m4/lt~obsolete.m4:90: -1- AC_DEFUN([_LT_AC_LANG_RC_CONFIG])
-m4trace:m4/lt~obsolete.m4:91: -1- AC_DEFUN([AC_LIBTOOL_CONFIG])
-m4trace:m4/lt~obsolete.m4:92: -1- AC_DEFUN([_LT_AC_FILE_LTDLL_C])
+m4trace:m4/lt~obsolete.m4:80: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])
+m4trace:m4/lt~obsolete.m4:81: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG])
+m4trace:m4/lt~obsolete.m4:82: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])
+m4trace:m4/lt~obsolete.m4:83: -1- AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])
+m4trace:m4/lt~obsolete.m4:84: -1- AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])
+m4trace:m4/lt~obsolete.m4:85: -1- AC_DEFUN([_LT_AC_LANG_F77_CONFIG])
+m4trace:m4/lt~obsolete.m4:86: -1- AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])
+m4trace:m4/lt~obsolete.m4:87: -1- AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])
+m4trace:m4/lt~obsolete.m4:88: -1- AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])
+m4trace:m4/lt~obsolete.m4:89: -1- AC_DEFUN([_LT_AC_LANG_RC_CONFIG])
+m4trace:m4/lt~obsolete.m4:90: -1- AC_DEFUN([AC_LIBTOOL_CONFIG])
+m4trace:m4/lt~obsolete.m4:91: -1- AC_DEFUN([_LT_AC_FILE_LTDLL_C])
+m4trace:m4/lt~obsolete.m4:93: -1- AC_DEFUN([_LT_AC_PROG_CXXCPP])
+m4trace:m4/lt~obsolete.m4:96: -1- AC_DEFUN([_LT_PROG_F77])
+m4trace:m4/lt~obsolete.m4:97: -1- AC_DEFUN([_LT_PROG_FC])
+m4trace:m4/lt~obsolete.m4:98: -1- AC_DEFUN([_LT_PROG_CXX])
 m4trace:configure.ac:1: -1- m4_pattern_forbid([^_?A[CHUM]_])
 m4trace:configure.ac:1: -1- m4_pattern_forbid([_AC_])
 m4trace:configure.ac:1: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
@@ -2243,7 +2295,7 @@ m4trace:configure.ac:2: -1- AM_INIT_AUTOMAKE
 m4trace:configure.ac:2: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$])
 m4trace:configure.ac:2: -1- AM_SET_CURRENT_AUTOMAKE_VERSION
 m4trace:configure.ac:2: -1- AM_AUTOMAKE_VERSION([1.11.1])
-m4trace:configure.ac:2: -1- _AM_AUTOCONF_VERSION([2.67])
+m4trace:configure.ac:2: -1- _AM_AUTOCONF_VERSION([2.68])
 m4trace:configure.ac:2: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
 m4trace:configure.ac:2: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
 m4trace:configure.ac:2: -1- m4_pattern_allow([^INSTALL_DATA$])
@@ -2311,7 +2363,7 @@ m4trace:configure.ac:2: -1- _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT
 m4trace:configure.ac:2: -2- _AM_MANGLE_OPTION([silent-rules])
 m4trace:configure.ac:7: -1- AC_PROG_LIBTOOL
 m4trace:configure.ac:7: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
-You should run autoupdate.], [m4/libtool.m4:102: AC_PROG_LIBTOOL is expanded from...
+You should run autoupdate.], [m4/libtool.m4:107: AC_PROG_LIBTOOL is expanded from...
 configure.ac:7: the top level])
 m4trace:configure.ac:7: -1- LT_INIT
 m4trace:configure.ac:7: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$])
@@ -2330,6 +2382,8 @@ m4trace:configure.ac:7: -1- m4_pattern_allow([^host$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^host_cpu$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^host_vendor$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^host_os$])
+m4trace:configure.ac:7: -1- _LT_PREPARE_SED_QUOTE_VARS
+m4trace:configure.ac:7: -1- _LT_PROG_ECHO_BACKSLASH
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CC$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CFLAGS$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^LDFLAGS$])
@@ -2382,12 +2436,15 @@ m4trace:configure.ac:7: -1- m4_pattern_allow([^LN_S$])
 m4trace:configure.ac:7: -1- LT_CMD_MAX_LEN
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OBJDUMP$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OBJDUMP$])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^DLLTOOL$])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^DLLTOOL$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^AR$])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^ac_ct_AR$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^STRIP$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^RANLIB$])
+m4trace:configure.ac:7: -1- _LT_WITH_SYSROOT
 m4trace:configure.ac:7: -1- m4_pattern_allow([LT_OBJDIR])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^LT_OBJDIR$])
-m4trace:configure.ac:7: -1- m4_pattern_allow([^lt_ECHO$])
 m4trace:configure.ac:7: -1- _LT_CC_BASENAME([$compiler])
 m4trace:configure.ac:7: -1- _LT_PATH_TOOL_PREFIX([${ac_tool_prefix}file], [/usr/bin$PATH_SEPARATOR$PATH])
 m4trace:configure.ac:7: -1- _LT_PATH_TOOL_PREFIX([file], [/usr/bin$PATH_SEPARATOR$PATH])
@@ -2401,11 +2458,14 @@ m4trace:configure.ac:7: -1- _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGV
      esac], [_LT_TAGVAR(lt_prog_compiler_pic, )=
      _LT_TAGVAR(lt_prog_compiler_can_build_shared, )=no])
 m4trace:configure.ac:7: -1- _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [lt_cv_prog_compiler_static_works], [$lt_tmp_static_flag], [], [_LT_TAGVAR(lt_prog_compiler_static, )=])
+m4trace:configure.ac:7: -1- m4_pattern_allow([^MANIFEST_TOOL$])
+m4trace:configure.ac:7: -1- _LT_REQUIRED_DARWIN_CHECKS
 m4trace:configure.ac:7: -1- m4_pattern_allow([^DSYMUTIL$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^NMEDIT$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^LIPO$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OTOOL$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^OTOOL64$])
+m4trace:configure.ac:7: -1- _LT_LINKER_OPTION([if $CC understands -b], [lt_cv_prog_compiler__b], [-b], [_LT_TAGVAR(archive_cmds, )='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, )='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])
 m4trace:configure.ac:7: -1- LT_SYS_DLOPEN_SELF
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CPP$])
 m4trace:configure.ac:7: -1- m4_pattern_allow([^CPPFLAGS$])
diff --git a/libass/configure b/libass/configure
index fd9d746..e0ac7f4 100755
--- a/libass/configure
+++ b/libass/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for libass 0.9.11.
+# Generated by GNU Autoconf 2.68 for libass 0.9.11.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -89,6 +89,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -171,6 +172,14 @@ test x\$exitcode = x0 || exit 1"
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
 test \$(( 1 + 1 )) = 2 || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
@@ -214,11 +223,18 @@ IFS=$as_save_IFS
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
+	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+	case $- in # ((((
+	  *v*x* | *x*v* ) as_opts=-vx ;;
+	  *v* ) as_opts=-v ;;
+	  *x* ) as_opts=-x ;;
+	  * ) as_opts= ;;
+	esac
+	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -525,155 +541,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
-
-
-# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-$*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "$0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
 
 test -n "$DJDIR" || exec 7<&0 </dev/null
 exec 6>&1
@@ -766,9 +635,11 @@ OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-lt_ECHO
+MANIFEST_TOOL
 RANLIB
+ac_ct_AR
 AR
+DLLTOOL
 OBJDUMP
 LN_S
 NM
@@ -874,6 +745,7 @@ with_pic
 enable_fast_install
 enable_dependency_tracking
 with_gnu_ld
+with_sysroot
 enable_libtool_lock
 enable_test
 enable_enca
@@ -1304,7 +1176,7 @@ Try \`$0 --help' for more information"
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1540,6 +1412,8 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
 
 Some influential environment variables:
   CC          C compiler command
@@ -1636,7 +1510,7 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 libass configure 0.9.11
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1682,7 +1556,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
@@ -1728,7 +1602,7 @@ fi
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_link
@@ -1742,7 +1616,7 @@ ac_fn_c_check_header_compile ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1760,7 +1634,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_header_compile
 
@@ -1796,7 +1670,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_cpp
@@ -1838,7 +1712,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_run
@@ -1851,7 +1725,7 @@ ac_fn_c_check_func ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1906,7 +1780,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_func
 
@@ -1919,7 +1793,7 @@ ac_fn_c_check_type ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1960,7 +1834,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_type
 
@@ -1972,10 +1846,10 @@ $as_echo "$ac_res" >&6; }
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval "test \"\${$3+set}\"" = set; then :
+  if eval \${$3+:} false; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2038,7 +1912,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2047,7 +1921,7 @@ eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_header_mongrel
 
@@ -2060,7 +1934,7 @@ ac_fn_c_find_intX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
 $as_echo_n "checking for int$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2121,7 +1995,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_find_intX_t
 
@@ -2134,7 +2008,7 @@ ac_fn_c_find_uintX_t ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
 $as_echo_n "checking for uint$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -2174,7 +2048,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_find_uintX_t
 cat >config.log <<_ACEOF
@@ -2182,7 +2056,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2440,7 +2314,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
@@ -2577,7 +2451,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2664,11 +2538,11 @@ am_lf='
 '
 case `pwd` in
   *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
 esac
 
 # Do `set' in a subshell so we don't clobber the current shell's
@@ -2754,7 +2628,7 @@ if test "$cross_compiling" != no; then
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -2794,7 +2668,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -2847,7 +2721,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then :
+  if ${ac_cv_path_mkdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2898,7 +2772,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2938,7 +2812,7 @@ done
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -3048,8 +2922,8 @@ esac
 
 
 
-macro_version='2.2.6b'
-macro_revision='1.3017'
+macro_version='2.4'
+macro_revision='1.3293'
 
 
 
@@ -3071,7 +2945,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
@@ -3087,7 +2961,7 @@ fi
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -3105,7 +2979,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
@@ -3120,7 +2994,7 @@ fi
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -3136,6 +3010,75 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
@@ -3208,7 +3151,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3248,7 +3191,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3301,7 +3244,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3341,7 +3284,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3400,7 +3343,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3444,7 +3387,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3499,7 +3442,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3614,7 +3557,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3657,7 +3600,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3716,7 +3659,7 @@ $as_echo "$ac_try_echo"; } >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
@@ -3727,7 +3670,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3768,7 +3711,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -3778,7 +3721,7 @@ OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3815,7 +3758,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -3893,7 +3836,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -3992,7 +3935,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4117,7 +4060,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -4199,7 +4142,7 @@ Xsed="$SED -e 1s/^X//"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -4262,7 +4205,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4329,7 +4272,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then :
+if ${ac_cv_path_FGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -4460,7 +4403,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then :
+if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -4500,7 +4443,7 @@ fi
 test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+if ${lt_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -4527,7 +4470,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then :
+if ${lt_cv_path_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -4580,14 +4523,17 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -4625,13 +4571,13 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  for ac_prog in dumpbin "link -dump"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DUMPBIN"; then
@@ -4680,6 +4626,15 @@ esac
   fi
 fi
 
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
 
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -4694,18 +4649,18 @@ test -z "$NM" && NM=nm
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
 $as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then :
+if ${lt_cv_nm_interface+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4702: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4705: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4708: output\"" >&5)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -4729,7 +4684,7 @@ fi
 # find the maximum length of command line arguments
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
 $as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+if ${lt_cv_sys_max_cmd_len+:} false; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
@@ -4762,6 +4717,11 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -4826,8 +4786,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -4869,8 +4829,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6;
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -4919,9 +4879,83 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then :
+if ${lt_cv_ld_reload_flag+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
@@ -4935,6 +4969,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -4957,7 +4996,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -4997,7 +5036,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then
 set dummy objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -5056,7 +5095,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
 $as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then :
+if ${lt_cv_deplibs_check_method+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -5098,16 +5137,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -5137,6 +5178,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -5145,11 +5190,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -5252,6 +5297,21 @@ esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -5267,12 +5327,166 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
+
+
+
+
+
+
+
+
+
+
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -5285,7 +5499,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5305,14 +5519,18 @@ $as_echo "no" >&6; }
 fi
 
 
+    test -n "$AR" && break
+  done
 fi
-if test -z "$ac_cv_prog_AR"; then
+if test -z "$AR"; then
   ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -5325,7 +5543,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
+    ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5344,6 +5562,10 @@ else
 $as_echo "no" >&6; }
 fi
 
+
+  test -n "$ac_ct_AR" && break
+done
+
   if test "x$ac_ct_AR" = x; then
     AR="false"
   else
@@ -5355,12 +5577,10 @@ ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
   fi
-else
-  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
+: ${AR=ar}
+: ${AR_FLAGS=cru}
 
 
 
@@ -5372,12 +5592,70 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -5417,7 +5695,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -5476,7 +5754,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -5516,7 +5794,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
 set dummy ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -5587,6 +5865,18 @@ if test -n "$RANLIB"; then
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
 
 
 
@@ -5633,7 +5923,7 @@ compiler=$CC
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -5694,8 +5984,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -5731,6 +6021,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -5756,8 +6047,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && test -s "$nlist"; then
@@ -5772,6 +6063,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -5783,7 +6086,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT_DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -5809,8 +6112,8 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
@@ -5820,8 +6123,8 @@ _LT_EOF
   test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -5858,6 +6161,14 @@ else
 $as_echo "ok" >&6; }
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+
 
 
 
@@ -5880,6 +6191,46 @@ fi
 
 
 
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
@@ -5911,7 +6262,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5914 "configure"' > conftest.$ac_ext
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6005,7 +6356,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   CFLAGS="$CFLAGS -belf"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then :
+if ${lt_cv_cc_needs_belf+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -6073,6 +6424,123 @@ esac
 
 need_locks="$enable_libtool_lock"
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+
+
+
+
 
   case $host_os in
     rhapsody* | darwin*)
@@ -6081,7 +6549,7 @@ need_locks="$enable_libtool_lock"
 set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DSYMUTIL"; then
@@ -6121,7 +6589,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
 set dummy dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DSYMUTIL"; then
@@ -6173,7 +6641,7 @@ fi
 set dummy ${ac_tool_prefix}nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NMEDIT"; then
@@ -6213,7 +6681,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then
 set dummy nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NMEDIT"; then
@@ -6265,7 +6733,7 @@ fi
 set dummy ${ac_tool_prefix}lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then :
+if ${ac_cv_prog_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LIPO"; then
@@ -6305,7 +6773,7 @@ if test -z "$ac_cv_prog_LIPO"; then
 set dummy lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LIPO"; then
@@ -6357,7 +6825,7 @@ fi
 set dummy ${ac_tool_prefix}otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then :
+if ${ac_cv_prog_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL"; then
@@ -6397,7 +6865,7 @@ if test -z "$ac_cv_prog_OTOOL"; then
 set dummy otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL"; then
@@ -6449,7 +6917,7 @@ fi
 set dummy ${ac_tool_prefix}otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL64"; then
@@ -6489,7 +6957,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then
 set dummy otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL64"; then
@@ -6564,7 +7032,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
 $as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+if ${lt_cv_apple_cc_single_mod+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
@@ -6593,7 +7061,7 @@ fi
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_exported_symbols_list=no
@@ -6623,6 +7091,38 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -6650,7 +7150,7 @@ $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -6670,7 +7170,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -6786,7 +7286,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -6798,7 +7298,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6929,7 +7429,7 @@ for ac_header in dlfcn.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
 "
-if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_DLFCN_H 1
 _ACEOF
@@ -6940,6 +7440,8 @@ done
 
 
 
+
+
 # Set options
 
 
@@ -7092,6 +7594,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
+
 test -z "$LN_S" && LN_S="ln -s"
 
 
@@ -7113,7 +7616,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
 $as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then :
+if ${lt_cv_objdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
@@ -7141,19 +7644,6 @@ _ACEOF
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -7166,23 +7656,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -7211,7 +7684,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -7221,7 +7694,7 @@ file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7287,7 +7760,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
 $as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -7420,11 +7893,16 @@ if test -n "$compiler"; then
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
@@ -7440,15 +7918,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7443: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7447: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -7477,8 +7955,6 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -7526,6 +8002,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -7568,6 +8050,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -7630,7 +8119,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -7642,25 +8137,25 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_wl=''
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	*Sun\ C*)
+	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
+	  lt_prog_compiler_wl='-Wl,'
 	  ;;
 	esac
 	;;
@@ -7692,7 +8187,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -7749,13 +8244,17 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
     ;;
 esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-
-
-
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
@@ -7763,7 +8262,7 @@ $as_echo "$lt_prog_compiler_pic" >&6; }
 if test -n "$lt_prog_compiler_pic"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works=no
@@ -7779,15 +8278,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7782: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7786: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -7816,13 +8315,18 @@ fi
 
 
 
+
+
+
+
+
 #
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
@@ -7835,7 +8339,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -7865,7 +8369,7 @@ fi
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7884,16 +8388,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7887: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7891: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -7920,7 +8424,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -7939,16 +8443,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7942: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7946: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8058,13 +8562,39 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu)
+  linux* | k*bsd*-gnu | gnu*)
     link_all_deplibs=no
     ;;
   esac
 
   ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -8098,11 +8628,12 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -8138,10 +8669,12 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -8159,6 +8692,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -8184,15 +8722,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -8203,13 +8742,17 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -8225,17 +8768,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
 	  hardcode_libdir_flag_spec=
 	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -8249,8 +8792,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -8268,8 +8811,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8315,8 +8858,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8356,8 +8899,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -8445,7 +8990,13 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8458,25 +9009,32 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -8485,7 +9043,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8498,30 +9062,42 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -8553,20 +9129,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -8576,7 +9195,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec=''
+  fi
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -8584,7 +9207,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -8627,7 +9250,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -8635,7 +9258,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -8650,8 +9273,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -8669,16 +9292,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -8690,7 +9313,46 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
 	  ;;
 	esac
       fi
@@ -8718,26 +9380,39 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foo(void) {}
+int foo (void) { return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8799,17 +9474,17 @@ rm -f core conftest.err conftest.$ac_objext \
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -8819,13 +9494,13 @@ rm -f core conftest.err conftest.$ac_objext \
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -8838,9 +9513,9 @@ rm -f core conftest.err conftest.$ac_objext \
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -9028,44 +9703,50 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
@@ -9236,16 +9917,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -9258,7 +9946,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -9278,7 +9966,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -9366,7 +10060,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -9397,8 +10091,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -9419,36 +10114,83 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -9532,6 +10274,20 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -9577,8 +10333,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[3-9]*)
@@ -9645,12 +10403,17 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9663,13 +10426,17 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  shlibpath_overrides_runpath=yes
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -9678,7 +10445,7 @@ rm -f core conftest.err conftest.$ac_objext \
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -9993,6 +10760,11 @@ fi
 
 
 
+
+
+
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
@@ -10065,7 +10837,7 @@ else
   # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10099,7 +10871,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
 
@@ -10113,12 +10885,12 @@ fi
 
   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = x""yes; then :
+if test "x$ac_cv_func_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+if ${ac_cv_lib_dld_shl_load+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10152,16 +10924,16 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = x""yes; then :
+if test "x$ac_cv_func_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10195,12 +10967,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+if ${ac_cv_lib_svld_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10234,12 +11006,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+if ${ac_cv_lib_dld_dld_link+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10273,7 +11045,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
@@ -10314,7 +11086,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
 $as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then :
+if ${lt_cv_dlopen_self+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10323,7 +11095,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10326 "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10364,7 +11136,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10373,7 +11151,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10410,7 +11192,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; }
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then :
+if ${lt_cv_dlopen_self_static+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -10419,7 +11201,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10422 "configure"
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10460,7 +11242,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -10469,7 +11257,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -10661,7 +11453,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10701,7 +11493,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10754,7 +11546,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10794,7 +11586,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10853,7 +11645,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -10897,7 +11689,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -10952,7 +11744,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -10981,7 +11773,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11018,7 +11810,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -11096,7 +11888,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -11195,7 +11987,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -11330,7 +12122,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -11446,7 +12238,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -11464,7 +12256,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
 fi
 set dummy $CC; ac_cc=`$as_echo "$2" |
 		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then :
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11585,7 +12377,7 @@ fi
 # Checks for header files.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11697,7 +12489,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then :
+if ${ac_cv_header_stdbool_h+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11729,7 +12521,7 @@ else
 	char b[false == 0 ? 1 : -1];
 	char c[__bool_true_false_are_defined == 1 ? 1 : -1];
 	char d[(bool) 0.5 == true ? 1 : -1];
-	bool e = &s;
+	/* See body of main program for 'e'.  */
 	char f[(_Bool) 0.0 == false ? 1 : -1];
 	char g[true];
 	char h[sizeof (_Bool)];
@@ -11740,25 +12532,6 @@ else
 	_Bool n[m];
 	char o[sizeof n == m * sizeof n[0] ? 1 : -1];
 	char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-#	if defined __xlc__ || defined __GNUC__
-	 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-	    reported by James Lemley on 2005-10-05; see
-	    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-	    This test is not quite right, since xlc is allowed to
-	    reject this program, as the initializer for xlcbug is
-	    not one of the forms that C requires support for.
-	    However, doing the test right would require a runtime
-	    test, and that would make cross-compilation harder.
-	    Let us hope that IBM fixes the xlc bug, and also adds
-	    support for this kind of constant expression.  In the
-	    meantime, this test will reject xlc, which is OK, since
-	    our stdbool.h substitute should suffice.  We also test
-	    this with GCC, where it should work, to detect more
-	    quickly whether someone messes up the test in the
-	    future.  */
-	 char digs[] = "0123456789";
-	 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-#	endif
 	/* Catch a bug in an HP-UX C compiler.  See
 	   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
 	   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -11770,6 +12543,7 @@ int
 main ()
 {
 
+	bool e = &s;
 	*pq |= q;
 	*pq |= ! q;
 	/* Refer to every declared value, to avoid compiler optimizations.  */
@@ -11790,7 +12564,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
 $as_echo "$ac_cv_header_stdbool_h" >&6; }
 ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = x""yes; then :
+if test "x$ac_cv_type__Bool" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE__BOOL 1
@@ -11822,7 +12596,7 @@ done
 # Checks for typedefs, structures, and compiler characteristics.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11902,7 +12676,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then :
+if ${ac_cv_c_inline+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_inline=no
@@ -11954,7 +12728,7 @@ _ACEOF
 esac
 
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = x""yes; then :
+if test "x$ac_cv_type_size_t" = xyes; then :
 
 else
 
@@ -12010,7 +12784,7 @@ done
 # Checks for libraries.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv_open" >&5
 $as_echo_n "checking for library containing iconv_open... " >&6; }
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -12044,11 +12818,11 @@ for ac_lib in '' iconv; do
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if test "${ac_cv_search_iconv_open+set}" = set; then :
+  if ${ac_cv_search_iconv_open+:} false; then :
   break
 fi
 done
-if test "${ac_cv_search_iconv_open+set}" = set; then :
+if ${ac_cv_search_iconv_open+:} false; then :
 
 else
   ac_cv_search_iconv_open=no
@@ -12068,7 +12842,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fabs in -lm" >&5
 $as_echo_n "checking for fabs in -lm... " >&6; }
-if test "${ac_cv_lib_m_fabs+set}" = set; then :
+if ${ac_cv_lib_m_fabs+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12102,7 +12876,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fabs" >&5
 $as_echo "$ac_cv_lib_m_fabs" >&6; }
-if test "x$ac_cv_lib_m_fabs" = x""yes; then :
+if test "x$ac_cv_lib_m_fabs" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBM 1
 _ACEOF
@@ -12141,7 +12915,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -12184,7 +12958,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
@@ -12329,7 +13103,7 @@ and FREETYPE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
 	FREETYPE_CFLAGS=$pkg_cv_FREETYPE_CFLAGS
 	FREETYPE_LIBS=$pkg_cv_FREETYPE_LIBS
@@ -12426,7 +13200,7 @@ and FONTCONFIG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
 	FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS
 	FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS
@@ -12605,7 +13379,7 @@ and LIBPNG_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
 	LIBPNG_CFLAGS=$pkg_cv_LIBPNG_CFLAGS
 	LIBPNG_LIBS=$pkg_cv_LIBPNG_LIBS
@@ -12720,10 +13494,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
+    if test "x$cache_file" != "x/dev/null"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -12779,7 +13564,7 @@ if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -12880,6 +13665,7 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -13187,7 +13973,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by libass $as_me 0.9.11, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13253,7 +14039,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 libass config.status 0.9.11
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -13381,131 +14167,153 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
-for var in SED \
+for var in SHELL \
+ECHO \
+SED \
 GREP \
 EGREP \
 FGREP \
@@ -13518,8 +14326,13 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
+archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -13529,14 +14342,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-SHELL \
-ECHO \
+nm_file_list_spec \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
 lt_prog_compiler_pic \
+lt_prog_compiler_wl \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
+MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -13552,7 +14365,6 @@ no_undefined_flag \
 hardcode_libdir_flag_spec \
 hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
-fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -13560,12 +14372,13 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
+install_override_mode \
 finish_eval \
 old_striplib \
 striplib; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13587,14 +14400,15 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
+postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13602,12 +14416,6 @@ sys_lib_dlsearch_path_spec; do
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
-  ;;
-esac
-
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -13644,7 +14452,7 @@ do
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
     "libass.pc") CONFIG_FILES="$CONFIG_FILES libass.pc" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -13667,9 +14475,10 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -13677,12 +14486,13 @@ $debug ||
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -13704,7 +14514,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -13732,7 +14542,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -13780,7 +14590,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -13812,7 +14622,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
   || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
@@ -13846,7 +14656,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -13858,8 +14668,8 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
     as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
@@ -13960,7 +14770,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -13979,7 +14789,7 @@ do
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -13988,7 +14798,7 @@ do
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -14014,8 +14824,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -14151,21 +14961,22 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
@@ -14176,20 +14987,20 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
+      mv "$ac_tmp/config.h" "$ac_file" \
 	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
       || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
@@ -14351,7 +15162,8 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -14399,6 +15211,12 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -14448,9 +15266,11 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -14458,13 +15278,30 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == "file_magic".
+# Command to use when deplibs_check_method = "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
 # The archiver.
 AR=$lt_AR
+
+# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -14473,6 +15310,9 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
 # A C compiler.
 LTCC=$lt_CC
 
@@ -14491,14 +15331,14 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
 
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
 
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
@@ -14506,6 +15346,9 @@ MAGIC_CMD=$MAGIC_CMD
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -14562,6 +15405,9 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -14601,6 +15447,10 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -14613,12 +15463,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -14705,9 +15555,6 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -14723,6 +15570,9 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -14755,212 +15605,169 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
-
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
diff --git a/libass/libass/Makefile.in b/libass/libass/Makefile.in
index 1df3818..3dabf76 100644
--- a/libass/libass/Makefile.in
+++ b/libass/libass/Makefile.in
@@ -132,6 +132,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -163,6 +164,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -192,6 +194,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -224,7 +227,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff --git a/libass/libass/ass.c b/libass/libass/ass.c
index 3683772..8e4f0f4 100644
--- a/libass/libass/ass.c
+++ b/libass/libass/ass.c
@@ -164,6 +164,32 @@ static void rskip_spaces(char **str, char *limit)
 }
 
 /**
+ * \brief Set up default style
+ * \param style style to edit to defaults
+ * The parameters are mostly taken directly from VSFilter source for
+ * best compatibility.
+ */
+static void set_default_style(ASS_Style *style)
+{
+    style->Name             = strdup("Default");
+    style->FontName         = strdup("Arial");
+    style->FontSize         = 18;
+    style->PrimaryColour    = 0xffffff00;
+    style->SecondaryColour  = 0x00ffff00;
+    style->OutlineColour    = 0x00000000;
+    style->BackColour       = 0x00000000;
+    style->Bold             = 200;
+    style->ScaleX           = 1.0;
+    style->ScaleY           = 1.0;
+    style->Spacing          = 0;
+    style->BorderStyle      = 1;
+    style->Outline          = 2;
+    style->Shadow           = 3;
+    style->Alignment        = 2;
+    style->MarginL = style->MarginR = style->MarginV = 20;
+}
+
+/**
  * \brief find style by name
  * \param track track
  * \param name style name
@@ -177,7 +203,6 @@ static int lookup_style(ASS_Track *track, char *name)
     if (*name == '*')
         ++name;                 // FIXME: what does '*' really mean ?
     for (i = track->n_styles - 1; i >= 0; --i) {
-        // FIXME: mb strcasecmp ?
         if (strcmp(track->styles[i].Name, name) == 0)
             return i;
     }
@@ -308,8 +333,8 @@ static int process_event_tail(ASS_Track *track, ASS_Event *event,
         // add "Default" style to the end
         // will be used if track does not contain a default style (or even does not contain styles at all)
         int sid = ass_alloc_style(track);
-        track->styles[sid].Name = strdup("Default");
-        track->styles[sid].FontName = strdup("Arial");
+        set_default_style(&track->styles[sid]);
+        track->default_style = sid;
     }
 
     for (i = 0; i < n_ignored; ++i) {
@@ -468,6 +493,14 @@ static int process_style(ASS_Track *track, char *str)
 
     q = format = strdup(track->style_format);
 
+    // Add default style first
+    if (track->n_styles == 0) {
+        // will be used if track does not contain a default style (or even does not contain styles at all)
+        int sid = ass_alloc_style(track);
+        set_default_style(&track->styles[sid]);
+        track->default_style = sid;
+    }
+
     ass_msg(track->library, MSGL_V, "[%p] Style: %s", track, str);
 
     sid = ass_alloc_style(track);
diff --git a/libass/libass/ass_render.c b/libass/libass/ass_render.c
index 8ca6911..2f3405e 100644
--- a/libass/libass/ass_render.c
+++ b/libass/libass/ass_render.c
@@ -1302,6 +1302,11 @@ get_bitmap_glyph(ASS_Renderer *render_priv, GlyphInfo *info)
             FT_Done_Glyph(outline);
         }
     }
+
+    // VSFilter compatibility: invisible fill and no border?
+    // In this case no shadow is supposed to be rendered.
+    if (!info->outline_glyph && (info->c[0] >> 24) == 0xFF)
+        info->bm_s = 0;
 }
 
 /**
diff --git a/libass/ltmain.sh b/libass/ltmain.sh
index d88da2c..6f650ae 100755
--- a/libass/ltmain.sh
+++ b/libass/ltmain.sh
@@ -1,9 +1,9 @@
-# Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.6b
+# libtool (GNU libtool) 2.4
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -32,50 +32,56 @@
 #
 # Provide generalized library-building support services.
 #
-#     --config             show all configuration variables
-#     --debug              enable verbose shell tracing
-# -n, --dry-run            display commands without modifying any files
-#     --features           display basic configuration information and exit
-#     --mode=MODE          use operation mode MODE
-#     --preserve-dup-deps  don't remove duplicate dependency libraries
-#     --quiet, --silent    don't print informational messages
-#     --tag=TAG            use configuration variables from tag TAG
-# -v, --verbose            print informational messages (default)
-#     --version            print version information
-# -h, --help               print short or long help message
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
 #
 # MODE must be one of the following:
 #
-#       clean              remove files from the build directory
-#       compile            compile a source file into a libtool object
-#       execute            automatically set library path, then run a program
-#       finish             complete the installation of libtool libraries
-#       install            install libraries or executables
-#       link               create a library or an executable
-#       uninstall          remove libraries from an installed directory
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
 #
-# MODE-ARGS vary depending on the MODE.
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
 #
 # When reporting a bug, please describe a test case to reproduce it and
 # include the following information:
 #
-#       host-triplet:	$host
-#       shell:		$SHELL
-#       compiler:		$LTCC
-#       compiler flags:		$LTCFLAGS
-#       linker:		$LD (gnu? $with_gnu_ld)
-#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2
-#       automake:		$automake_version
-#       autoconf:		$autoconf_version
+#         host-triplet:	$host
+#         shell:		$SHELL
+#         compiler:		$LTCC
+#         compiler flags:		$LTCFLAGS
+#         linker:		$LD (gnu? $with_gnu_ld)
+#         $progname:	(GNU libtool) 2.4 Debian-2.4-2
+#         automake:	$automake_version
+#         autoconf:	$autoconf_version
 #
 # Report bugs to <bug-libtool at gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
 
-PROGRAM=ltmain.sh
+PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.2.6b Debian-2.2.6b-2"
+VERSION="2.4 Debian-2.4-2"
 TIMESTAMP=""
-package_revision=1.3017
+package_revision=1.3293
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -91,10 +97,15 @@ fi
 BIN_SH=xpg4; export BIN_SH # for Tru64
 DUALCASE=1; export DUALCASE # for MKS sh
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
 # NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
 lt_user_locale=
 lt_safe_locale=
 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
@@ -107,15 +118,24 @@ do
 	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
 	fi"
 done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
 
 $lt_unset CDPATH
 
 
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
 
 
 
 : ${CP="cp -f"}
-: ${ECHO="echo"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
 : ${EGREP="/bin/grep -E"}
 : ${FGREP="/bin/grep -F"}
 : ${GREP="/bin/grep"}
@@ -144,6 +164,27 @@ IFS=" 	$lt_nl"
 dirname="s,/[^/]*$,,"
 basename="s,^.*/,,"
 
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
 # func_dirname_and_basename file append nondir_replacement
 # perform func_basename and func_dirname in a single function
 # call:
@@ -158,33 +199,183 @@ basename="s,^.*/,,"
 # those functions but instead duplicate the functionality here.
 func_dirname_and_basename ()
 {
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+    # Extract subdirectory from the argument.
+    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+    case ${2} in
+      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+    esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+		s@/\./@/@g
+		t dotsl
+		s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
 }
 
-# Generated shell functions inserted here.
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
 
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
 
 # The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
 func_dirname_and_basename "$progpath"
 progname=$func_basename_result
-case $progname in
-  -*) progname=./$progname ;;
-esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in
@@ -215,6 +406,15 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
 # Same as above, but do not quote variable references.
 double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
 # Re-`\' parameter expansions in output of double_quote_subst that were
 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 # in input to double_quote_subst, that '$' was protected from expansion.
@@ -243,7 +443,7 @@ opt_warning=:
 # name if it has been set yet.
 func_echo ()
 {
-    $ECHO "$progname${mode+: }$mode: $*"
+    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
 }
 
 # func_verbose arg...
@@ -258,18 +458,25 @@ func_verbose ()
     :
 }
 
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
 # func_error arg...
 # Echo program name prefixed message to standard error.
 func_error ()
 {
-    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
 }
 
 # func_warning arg...
 # Echo program name prefixed warning message to standard error.
 func_warning ()
 {
-    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
 
     # bash bug again:
     :
@@ -326,9 +533,9 @@ func_mkdir_p ()
         case $my_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
       done
-      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
 
       save_mkdir_p_IFS="$IFS"; IFS=':'
       for my_dir in $my_dir_list; do
@@ -378,7 +585,7 @@ func_mktempdir ()
         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
     fi
 
-    $ECHO "X$my_tmpdir" | $Xsed
+    $ECHO "$my_tmpdir"
 }
 
 
@@ -392,7 +599,7 @@ func_quote_for_eval ()
 {
     case $1 in
       *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
       *)
         func_quote_for_eval_unquoted_result="$1" ;;
     esac
@@ -419,7 +626,7 @@ func_quote_for_expand ()
 {
     case $1 in
       *[\\\`\"]*)
-	my_arg=`$ECHO "X$1" | $Xsed \
+	my_arg=`$ECHO "$1" | $SED \
 	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
       *)
         my_arg="$1" ;;
@@ -488,15 +695,39 @@ func_show_eval_locale ()
     fi
 }
 
-
-
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+    ;;
+  * )
+    func_tr_sh_result=$1
+    ;;
+  esac
+}
 
 
 # func_version
 # Echo version message to standard output and exit.
 func_version ()
 {
-    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+    $opt_debug
+
+    $SED -n '/(C)/!b go
+	:more
+	/\./!{
+	  N
+	  s/\n# / /
+	  b more
+	}
+	:go
+	/^# '$PROGRAM' (GNU /,/# warranty; / {
         s/^# //
 	s/^# *$//
         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
@@ -509,22 +740,28 @@ func_version ()
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $SED -n '/^# Usage:/,/# -h/ {
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
         s/^# //
 	s/^# *$//
 	s/\$progname/'$progname'/
 	p
     }' < "$progpath"
-    $ECHO
+    echo
     $ECHO "run \`$progname --help | more' for full usage"
     exit $?
 }
 
-# func_help
-# Echo long help message to standard output and exit.
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
 func_help ()
 {
+    $opt_debug
+
     $SED -n '/^# Usage:/,/# Report bugs to/ {
+	:print
         s/^# //
 	s/^# *$//
 	s*\$progname*'$progname'*
@@ -537,8 +774,15 @@ func_help ()
 	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
 	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
 	p
-     }' < "$progpath"
-    exit $?
+	d
+     }
+     /^# .* home page:/b print
+     /^# General help using/b print
+     ' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
 }
 
 # func_missing_arg argname
@@ -546,63 +790,106 @@ func_help ()
 # exit_cmd.
 func_missing_arg ()
 {
-    func_error "missing argument for $1"
+    $opt_debug
+
+    func_error "missing argument for $1."
     exit_cmd=exit
 }
 
-exit_cmd=:
 
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
 
 
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+    my_sed_long_arg='1s/^--[^=]*=//'
+
+    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
 
 
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell, and then maybe $ECHO will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
 
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
 
 magic="%%%MAGIC variable%%%"
 magic_exe="%%%MAGIC EXE variable%%%"
 
 # Global variables.
-# $mode is unset
 nonopt=
-execute_dlfiles=
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 extracted_archives=
 extracted_serial=0
 
-opt_dry_run=false
-opt_duplicate_deps=false
-opt_silent=false
-opt_debug=:
-
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
 # left over by shells.
 exec_cmd=
 
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+    eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+    func_quote_for_eval "${2}"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+    func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
 # func_fatal_configuration arg...
 # Echo program name prefixed message to standard error, followed by
 # a configuration failure hint, and exit.
@@ -636,16 +923,16 @@ func_config ()
 # Display the features supported by this script.
 func_features ()
 {
-    $ECHO "host: $host"
+    echo "host: $host"
     if test "$build_libtool_libs" = yes; then
-      $ECHO "enable shared libraries"
+      echo "enable shared libraries"
     else
-      $ECHO "disable shared libraries"
+      echo "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      $ECHO "enable static libraries"
+      echo "enable static libraries"
     else
-      $ECHO "disable static libraries"
+      echo "disable static libraries"
     fi
 
     exit $?
@@ -692,117 +979,204 @@ func_enable_tag ()
   esac
 }
 
-# Parse options once, thoroughly.  This comes as soon as possible in
-# the script to make things like `libtool --version' happen quickly.
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
 {
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
 
-  # Shorthand for --mode=foo, only valid as the first argument
-  case $1 in
-  clean|clea|cle|cl)
-    shift; set dummy --mode clean ${1+"$@"}; shift
-    ;;
-  compile|compil|compi|comp|com|co|c)
-    shift; set dummy --mode compile ${1+"$@"}; shift
-    ;;
-  execute|execut|execu|exec|exe|ex|e)
-    shift; set dummy --mode execute ${1+"$@"}; shift
-    ;;
-  finish|finis|fini|fin|fi|f)
-    shift; set dummy --mode finish ${1+"$@"}; shift
-    ;;
-  install|instal|insta|inst|ins|in|i)
-    shift; set dummy --mode install ${1+"$@"}; shift
-    ;;
-  link|lin|li|l)
-    shift; set dummy --mode link ${1+"$@"}; shift
-    ;;
-  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-    shift; set dummy --mode uninstall ${1+"$@"}; shift
-    ;;
-  esac
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+  shift; set dummy --mode clean ${1+"$@"}; shift
+  ;;
+compile|compil|compi|comp|com|co|c)
+  shift; set dummy --mode compile ${1+"$@"}; shift
+  ;;
+execute|execut|execu|exec|exe|ex|e)
+  shift; set dummy --mode execute ${1+"$@"}; shift
+  ;;
+finish|finis|fini|fin|fi|f)
+  shift; set dummy --mode finish ${1+"$@"}; shift
+  ;;
+install|instal|insta|inst|ins|in|i)
+  shift; set dummy --mode install ${1+"$@"}; shift
+  ;;
+link|lin|li|l)
+  shift; set dummy --mode link ${1+"$@"}; shift
+  ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+  shift; set dummy --mode uninstall ${1+"$@"}; shift
+  ;;
+esac
 
-  # Parse non-mode specific arguments:
-  while test "$#" -gt 0; do
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly.  This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+  # this just eases exit handling
+  while test $# -gt 0; do
     opt="$1"
     shift
-
     case $opt in
-      --config)		func_config					;;
-
-      --debug)		preserve_args="$preserve_args $opt"
+      --debug|-x)	opt_debug='set -x'
 			func_echo "enabling shell trace mode"
-			opt_debug='set -x'
 			$opt_debug
 			;;
-
-      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			execute_dlfiles="$execute_dlfiles $1"
-			shift
+      --dry-run|--dryrun|-n)
+			opt_dry_run=:
 			;;
-
-      --dry-run | -n)	opt_dry_run=:					;;
-      --features)       func_features					;;
-      --finish)		mode="finish"					;;
-
-      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			case $1 in
-			  # Valid mode arguments:
-			  clean)	;;
-			  compile)	;;
-			  execute)	;;
-			  finish)	;;
-			  install)	;;
-			  link)		;;
-			  relink)	;;
-			  uninstall)	;;
-
-			  # Catch anything else as an error
-			  *) func_error "invalid argument for $opt"
-			     exit_cmd=exit
-			     break
-			     ;;
-		        esac
-
-			mode="$1"
+      --config)
+			opt_config=:
+func_config
+			;;
+      --dlopen|-dlopen)
+			optarg="$1"
+			opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
 			shift
 			;;
-
       --preserve-dup-deps)
-			opt_duplicate_deps=:				;;
-
-      --quiet|--silent)	preserve_args="$preserve_args $opt"
-			opt_silent=:
+			opt_preserve_dup_deps=:
 			;;
-
-      --verbose| -v)	preserve_args="$preserve_args $opt"
+      --features)
+			opt_features=:
+func_features
+			;;
+      --finish)
+			opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+			;;
+      --help)
+			opt_help=:
+			;;
+      --help-all)
+			opt_help_all=:
+opt_help=': help-all'
+			;;
+      --mode)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_mode="$optarg"
+case $optarg in
+  # Valid mode arguments:
+  clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+  # Catch anything else as an error
+  *) func_error "invalid argument for $opt"
+     exit_cmd=exit
+     break
+     ;;
+esac
+			shift
+			;;
+      --no-silent|--no-quiet)
 			opt_silent=false
+func_append preserve_args " $opt"
 			;;
-
-      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			preserve_args="$preserve_args $opt $1"
-			func_enable_tag "$1"	# tagname is set here
+      --no-verbose)
+			opt_verbose=false
+func_append preserve_args " $opt"
+			;;
+      --silent|--quiet)
+			opt_silent=:
+func_append preserve_args " $opt"
+        opt_verbose=false
+			;;
+      --verbose|-v)
+			opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+			;;
+      --tag)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
 			shift
 			;;
 
+      -\?|-h)		func_usage				;;
+      --help)		func_help				;;
+      --version)	func_version				;;
+
       # Separate optargs to long options:
-      -dlopen=*|--mode=*|--tag=*)
-			func_opt_split "$opt"
-			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+      --*=*)
+			func_split_long_opt "$opt"
+			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
 			shift
 			;;
 
-      -\?|-h)		func_usage					;;
-      --help)		opt_help=:					;;
-      --version)	func_version					;;
-
-      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
-
-      *)		nonopt="$opt"
-			break
+      # Separate non-argument short options:
+      -\?*|-h*|-n*|-v*)
+			func_split_short_opt "$opt"
+			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+			shift
 			;;
+
+      --)		break					;;
+      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
+      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
     esac
   done
 
+  # Validate options:
+
+  # save first non-option argument
+  if test "$#" -gt 0; then
+    nonopt="$opt"
+    shift
+  fi
+
+  # preserve --debug
+  test "$opt_debug" = : || func_append preserve_args " --debug"
 
   case $host in
     *cygwin* | *mingw* | *pw32* | *cegcc*)
@@ -810,82 +1184,44 @@ func_enable_tag ()
       opt_duplicate_compiler_generated_deps=:
       ;;
     *)
-      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
       ;;
   esac
 
-  # Having warned about all mis-specified options, bail out if
-  # anything was wrong.
-  $exit_cmd $EXIT_FAILURE
-}
+  $opt_help || {
+    # Sanity checks first:
+    func_check_version_match
 
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
-{
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      else
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
+    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+      func_fatal_configuration "not configured to build any kind of library"
     fi
 
-    exit $EXIT_MISMATCH
-  fi
-}
-
-
-## ----------- ##
-##    Main.    ##
-## ----------- ##
+    # Darwin sucks
+    eval std_shrext=\"$shrext_cmds\"
 
-$opt_help || {
-  # Sanity checks first:
-  func_check_version_match
+    # Only execute mode is allowed to have -dlopen flags.
+    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+      func_error "unrecognized option \`-dlopen'"
+      $ECHO "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
 
-  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-    func_fatal_configuration "not configured to build any kind of library"
-  fi
+    # Change the help message to a mode-specific one.
+    generic_help="$help"
+    help="Try \`$progname --help --mode=$opt_mode' for more information."
+  }
 
-  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
 
+  # Bail if the options were screwed
+  $exit_cmd $EXIT_FAILURE
+}
 
-  # Darwin sucks
-  eval std_shrext=\"$shrext_cmds\"
 
 
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    func_error "unrecognized option \`-dlopen'"
-    $ECHO "$help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$progname --help --mode=$mode' for more information."
-}
 
+## ----------- ##
+##    Main.    ##
+## ----------- ##
 
 # func_lalib_p file
 # True iff FILE is a libtool `.la' library or `.lo' object file.
@@ -950,12 +1286,9 @@ func_ltwrapper_executable_p ()
 # temporary ltwrapper_script.
 func_ltwrapper_scriptname ()
 {
-    func_ltwrapper_scriptname_result=""
-    if func_ltwrapper_executable_p "$1"; then
-	func_dirname_and_basename "$1" "" "."
-	func_stripname '' '.exe' "$func_basename_result"
-	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
-    fi
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
 }
 
 # func_ltwrapper_p file
@@ -1001,6 +1334,37 @@ func_source ()
 }
 
 
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result="=$func_stripname_result"
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
 # func_infer_tag arg
 # Infer tagged configuration to use if any are available and
 # if one wasn't chosen via the "--tag" command line option.
@@ -1013,13 +1377,15 @@ func_infer_tag ()
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
-        func_quote_for_eval "$arg"
-	CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	func_append_quoted CC_quoted "$arg"
       done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
       case $@ in
       # Blanks in the command may have been stripped by the calling shell,
       # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
       # Blanks at the start of $base_compile will cause this to fail
       # if we don't check for them as well.
       *)
@@ -1030,11 +1396,13 @@ func_infer_tag ()
 	    CC_quoted=
 	    for arg in $CC; do
 	      # Double-quote args containing other shell metacharacters.
-	      func_quote_for_eval "$arg"
-	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	      func_append_quoted CC_quoted "$arg"
 	    done
+	    CC_expanded=`func_echo_all $CC`
+	    CC_quoted_expanded=`func_echo_all $CC_quoted`
 	    case "$@ " in
-	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
+	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
 	      # The compiler in the base compile command matches
 	      # the one in the tagged configuration.
 	      # Assume this is the tagged configuration we want.
@@ -1097,6 +1465,486 @@ EOF
     }
 }
 
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+  $opt_debug
+  func_convert_core_file_wine_to_w32_result="$1"
+  if test -n "$1"; then
+    # Unfortunately, winepath does not exit with a non-zero error code, so we
+    # are forced to check the contents of stdout. On the other hand, if the
+    # command is not found, the shell will set an exit code of 127 and print
+    # *an error message* to stdout. So we must check for both error code of
+    # zero AND non-empty stdout, which explains the odd construction:
+    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$lt_sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $opt_debug
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=""
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $opt_debug
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $opt_debug
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $opt_debug
+  if test -z "$2" && test -n "$1" ; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  \`$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result="$1"
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $opt_debug
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  \`$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result="$3"
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $opt_debug
+  case $4 in
+  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $opt_debug
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $opt_debug
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $opt_debug
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
 # func_mode_compile arg...
 func_mode_compile ()
 {
@@ -1137,12 +1985,12 @@ func_mode_compile ()
 	  ;;
 
 	-pie | -fpie | -fPIE)
-          pie_flag="$pie_flag $arg"
+          func_append pie_flag " $arg"
 	  continue
 	  ;;
 
 	-shared | -static | -prefer-pic | -prefer-non-pic)
-	  later="$later $arg"
+	  func_append later " $arg"
 	  continue
 	  ;;
 
@@ -1163,15 +2011,14 @@ func_mode_compile ()
 	  save_ifs="$IFS"; IFS=','
 	  for arg in $args; do
 	    IFS="$save_ifs"
-	    func_quote_for_eval "$arg"
-	    lastarg="$lastarg $func_quote_for_eval_result"
+	    func_append_quoted lastarg "$arg"
 	  done
 	  IFS="$save_ifs"
 	  func_stripname ' ' '' "$lastarg"
 	  lastarg=$func_stripname_result
 
 	  # Add the arguments to base_compile.
-	  base_compile="$base_compile $lastarg"
+	  func_append base_compile " $lastarg"
 	  continue
 	  ;;
 
@@ -1187,8 +2034,7 @@ func_mode_compile ()
       esac    #  case $arg_mode
 
       # Aesthetically quote the previous argument.
-      func_quote_for_eval "$lastarg"
-      base_compile="$base_compile $func_quote_for_eval_result"
+      func_append_quoted base_compile "$lastarg"
     done # for arg
 
     case $arg_mode in
@@ -1213,7 +2059,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -1288,7 +2134,7 @@ func_mode_compile ()
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
     else
       output_obj=
@@ -1319,17 +2165,16 @@ compiler."
 	$opt_dry_run || $RM $removelist
 	exit $EXIT_FAILURE
       fi
-      removelist="$removelist $output_obj"
+      func_append removelist " $output_obj"
       $ECHO "$srcfile" > "$lockfile"
     fi
 
     $opt_dry_run || $RM $removelist
-    removelist="$removelist $lockfile"
+    func_append removelist " $lockfile"
     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 
-    if test -n "$fix_srcfile_path"; then
-      eval srcfile=\"$fix_srcfile_path\"
-    fi
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
     func_quote_for_eval "$srcfile"
     qsrcfile=$func_quote_for_eval_result
 
@@ -1349,7 +2194,7 @@ compiler."
 
       if test -z "$output_obj"; then
 	# Place PIC objects in $objdir
-	command="$command -o $lobj"
+	func_append command " -o $lobj"
       fi
 
       func_show_eval_locale "$command"	\
@@ -1396,11 +2241,11 @@ compiler."
 	command="$base_compile $qsrcfile $pic_flag"
       fi
       if test "$compiler_c_o" = yes; then
-	command="$command -o $obj"
+	func_append command " -o $obj"
       fi
 
       # Suppress compiler output if we already did a PIC compilation.
-      command="$command$suppress_output"
+      func_append command "$suppress_output"
       func_show_eval_locale "$command" \
         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
@@ -1445,13 +2290,13 @@ compiler."
 }
 
 $opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
+  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
 {
     # We need to display help for each of the modes.
-    case $mode in
+    case $opt_mode in
       "")
         # Generic help is extracted from the usage comments
         # at the start of this file.
@@ -1482,10 +2327,11 @@ This mode accepts the following additional options:
 
   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
   -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
   -shared           do not build a \`.o' file suitable for static linking
   -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
 
 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 from the given SOURCEFILE.
@@ -1538,7 +2384,7 @@ either the \`install' or \`cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
-  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 
 The rest of the components are interpreted as arguments to that command (only
 BSD-compatible install options are recognized)."
@@ -1558,6 +2404,8 @@ The following components of LINK-COMMAND are treated specially:
 
   -all-static       do not do any dynamic linking at all
   -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
@@ -1586,6 +2434,11 @@ The following components of LINK-COMMAND are treated specially:
   -version-info CURRENT[:REVISION[:AGE]]
                     specify library version info [each variable defaults to 0]
   -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
 All other options (arguments beginning with \`-') are ignored.
 
@@ -1619,18 +2472,44 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
 
       *)
-        func_fatal_help "invalid operation mode \`$mode'"
+        func_fatal_help "invalid operation mode \`$opt_mode'"
         ;;
     esac
 
-    $ECHO
+    echo
     $ECHO "Try \`$progname --help' for more information about other modes."
-
-    exit $?
 }
 
-  # Now that we've collected a possible --mode arg, show help if necessary
-  $opt_help && func_mode_help
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	echo
+	func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+	H
+	d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
 
 
 # func_mode_execute arg...
@@ -1643,13 +2522,16 @@ func_mode_execute ()
       func_fatal_help "you must specify a COMMAND"
 
     # Handle -dlopen flags immediately.
-    for file in $execute_dlfiles; do
+    for file in $opt_dlopen; do
       test -f "$file" \
 	|| func_fatal_help "\`$file' is not a file"
 
       dir=
       case $file in
       *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$lib' is not a valid libtool archive"
@@ -1671,7 +2553,7 @@ func_mode_execute ()
 	dir="$func_dirname_result"
 
 	if test -f "$dir/$objdir/$dlname"; then
-	  dir="$dir/$objdir"
+	  func_append dir "/$objdir"
 	else
 	  if test ! -f "$dir/$dlname"; then
 	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
@@ -1712,7 +2594,7 @@ func_mode_execute ()
     for file
     do
       case $file in
-      -*) ;;
+      -* | *.la | *.lo ) ;;
       *)
 	# Do a test to see if this is really a libtool program.
 	if func_ltwrapper_script_p "$file"; then
@@ -1728,8 +2610,7 @@ func_mode_execute ()
 	;;
       esac
       # Quote arguments (to preserve shell metacharacters).
-      func_quote_for_eval "$file"
-      args="$args $func_quote_for_eval_result"
+      func_append_quoted args "$file"
     done
 
     if test "X$opt_dry_run" = Xfalse; then
@@ -1754,29 +2635,66 @@ func_mode_execute ()
       # Display what would be done.
       if test -n "$shlibpath_var"; then
 	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	$ECHO "export $shlibpath_var"
+	echo "export $shlibpath_var"
       fi
       $ECHO "$cmd$args"
       exit $EXIT_SUCCESS
     fi
 }
 
-test "$mode" = execute && func_mode_execute ${1+"$@"}
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
 
 
 # func_mode_finish arg...
 func_mode_finish ()
 {
     $opt_debug
-    libdirs="$nonopt"
+    libs=
+    libdirs=
     admincmds=
 
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-	libdirs="$libdirs $dir"
-      done
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+	func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+	if func_lalib_unsafe_p "$opt"; then
+	  func_append libs " $opt"
+	else
+	  func_warning "\`$opt' is not a valid libtool archive"
+	fi
+
+      else
+	func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+	    > $tmpdir/tmp-la
+	  mv -f $tmpdir/tmp-la $lib
+	done
+        ${RM}r "$tmpdir"
+      fi
+    fi
 
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
       for libdir in $libdirs; do
 	if test -n "$finish_cmds"; then
 	  # Do each command in the finish commands.
@@ -1786,7 +2704,7 @@ func_mode_finish ()
 	if test -n "$finish_eval"; then
 	  # Do the single finish_eval.
 	  eval cmds=\"$finish_eval\"
-	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+	  $opt_dry_run || eval "$cmds" || func_append admincmds "
        $cmds"
 	fi
       done
@@ -1795,53 +2713,55 @@ func_mode_finish ()
     # Exit here if they wanted silent mode.
     $opt_silent && exit $EXIT_SUCCESS
 
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    $ECHO "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $ECHO "   $libdir"
-    done
-    $ECHO
-    $ECHO "If you ever happen to want to link against installed libraries"
-    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
-    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $ECHO "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $ECHO "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $ECHO "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+	$ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+	echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+	echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+	libdir=LIBDIR
+	eval flag=\"$hardcode_libdir_flag_spec\"
 
-      $ECHO "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $ECHO "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-    fi
-    $ECHO
+	$ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+	$ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      fi
+      echo
 
-    $ECHO "See any operating system documentation about shared libraries for"
-    case $host in
-      solaris2.[6789]|solaris2.1[0-9])
-        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-	$ECHO "pages."
-	;;
-      *)
-        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
-        ;;
-    esac
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+	solaris2.[6789]|solaris2.1[0-9])
+	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	  echo "pages."
+	  ;;
+	*)
+	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
+	  ;;
+      esac
+      echo "----------------------------------------------------------------------"
+    fi
     exit $EXIT_SUCCESS
 }
 
-test "$mode" = finish && func_mode_finish ${1+"$@"}
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
 
 
 # func_mode_install arg...
@@ -1852,7 +2772,7 @@ func_mode_install ()
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
+       case $nonopt in *shtool*) :;; *) false;; esac; then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -1866,7 +2786,12 @@ func_mode_install ()
     # The real first argument should be the name of the installation program.
     # Aesthetically quote it.
     func_quote_for_eval "$arg"
-    install_prog="$install_prog$func_quote_for_eval_result"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
 
     # We need to accept at least all the BSD install flags.
     dest=
@@ -1876,10 +2801,12 @@ func_mode_install ()
     install_type=
     isdir=no
     stripme=
+    no_mode=:
     for arg
     do
+      arg2=
       if test -n "$dest"; then
-	files="$files $dest"
+	func_append files " $dest"
 	dest=$arg
 	continue
       fi
@@ -1887,10 +2814,9 @@ func_mode_install ()
       case $arg in
       -d) isdir=yes ;;
       -f)
-	case " $install_prog " in
-	*[\\\ /]cp\ *) ;;
-	*) prev=$arg ;;
-	esac
+	if $install_cp; then :; else
+	  prev=$arg
+	fi
 	;;
       -g | -m | -o)
 	prev=$arg
@@ -1904,6 +2830,10 @@ func_mode_install ()
       *)
 	# If the previous option needed an argument, then skip it.
 	if test -n "$prev"; then
+	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	    arg2=$install_override_mode
+	    no_mode=false
+	  fi
 	  prev=
 	else
 	  dest=$arg
@@ -1914,7 +2844,11 @@ func_mode_install ()
 
       # Aesthetically quote the argument.
       func_quote_for_eval "$arg"
-      install_prog="$install_prog $func_quote_for_eval_result"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+	func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
     done
 
     test -z "$install_prog" && \
@@ -1923,6 +2857,13 @@ func_mode_install ()
     test -n "$prev" && \
       func_fatal_help "the \`$prev' option requires an argument"
 
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+	func_quote_for_eval "$install_override_mode"
+	func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
     if test -z "$files"; then
       if test -z "$dest"; then
 	func_fatal_help "no file or destination specified"
@@ -1977,10 +2918,13 @@ func_mode_install ()
       case $file in
       *.$libext)
 	# Do the static libraries later.
-	staticlibs="$staticlibs $file"
+	func_append staticlibs " $file"
 	;;
 
       *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$file' is not a valid libtool archive"
@@ -1994,23 +2938,23 @@ func_mode_install ()
 	if test "X$destdir" = "X$libdir"; then
 	  case "$current_libdirs " in
 	  *" $libdir "*) ;;
-	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  *) func_append current_libdirs " $libdir" ;;
 	  esac
 	else
 	  # Note the libdir as a future libdir.
 	  case "$future_libdirs " in
 	  *" $libdir "*) ;;
-	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  *) func_append future_libdirs " $libdir" ;;
 	  esac
 	fi
 
 	func_dirname "$file" "/" ""
 	dir="$func_dirname_result"
-	dir="$dir$objdir"
+	func_append dir "$objdir"
 
 	if test -n "$relink_command"; then
 	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
+	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
 
 	  # Don't allow the user to place us outside of our expected
 	  # location b/c this prevents finding dependent libraries that
@@ -2023,9 +2967,9 @@ func_mode_install ()
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 	  else
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 	  fi
 
 	  func_warning "relinking \`$file'"
@@ -2043,7 +2987,7 @@ func_mode_install ()
 	  test -n "$relink_command" && srcname="$realname"T
 
 	  # Install the shared library and build the symlinks.
-	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
 	      'exit $?'
 	  tstripme="$stripme"
 	  case $host_os in
@@ -2083,7 +3027,7 @@ func_mode_install ()
 	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
 	# Maybe install the static library, too.
-	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
 	;;
 
       *.lo)
@@ -2183,7 +3127,7 @@ func_mode_install ()
 	    if test -f "$lib"; then
 	      func_source "$lib"
 	    fi
-	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
 	    if test -n "$libdir" && test ! -f "$libfile"; then
 	      func_warning "\`$lib' has not been installed in \`$libdir'"
 	      finalize=no
@@ -2202,7 +3146,7 @@ func_mode_install ()
 		file="$func_basename_result"
 	        outputname="$tmpdir/$file"
 	        # Replace the output file specification.
-	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 
 	        $opt_silent || {
 	          func_quote_for_expand "$relink_command"
@@ -2221,7 +3165,7 @@ func_mode_install ()
 	    }
 	  else
 	    # Install the binary that we compiled earlier.
-	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
 	  fi
 	fi
 
@@ -2280,7 +3224,7 @@ func_mode_install ()
     fi
 }
 
-test "$mode" = install && func_mode_install ${1+"$@"}
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
 
 
 # func_generate_dlsyms outputname originator pic_p
@@ -2323,6 +3267,22 @@ func_generate_dlsyms ()
 extern \"C\" {
 #endif
 
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
 /* External symbol declarations for the compiler. */\
 "
 
@@ -2332,10 +3292,11 @@ extern \"C\" {
 	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
 	  # Add our own program objects to the symbol list.
-	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	  for progfile in $progfiles; do
-	    func_verbose "extracting global C symbols from \`$progfile'"
-	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
 	  done
 
 	  if test -n "$exclude_expsyms"; then
@@ -2371,7 +3332,7 @@ extern \"C\" {
 	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 	      eval '$MV "$nlist"T "$nlist"'
 	      case $host in
-	        *cygwin | *mingw* | *cegcc* )
+	        *cygwin* | *mingw* | *cegcc* )
 	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 	          ;;
@@ -2384,10 +3345,52 @@ extern \"C\" {
 	  func_verbose "extracting global C symbols from \`$dlprefile'"
 	  func_basename "$dlprefile"
 	  name="$func_basename_result"
-	  $opt_dry_run || {
-	    eval '$ECHO ": $name " >> "$nlist"'
-	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	  }
+          case $host in
+	    *cygwin* | *mingw* | *cegcc* )
+	      # if an import library, we need to obtain dlname
+	      if func_win32_import_lib_p "$dlprefile"; then
+	        func_tr_sh "$dlprefile"
+	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
+	        dlprefile_dlbasename=""
+	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+	          # Use subshell, to avoid clobbering current variable values
+	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+	          if test -n "$dlprefile_dlname" ; then
+	            func_basename "$dlprefile_dlname"
+	            dlprefile_dlbasename="$func_basename_result"
+	          else
+	            # no lafile. user explicitly requested -dlpreopen <import library>.
+	            $sharedlib_from_linklib_cmd "$dlprefile"
+	            dlprefile_dlbasename=$sharedlib_from_linklib_result
+	          fi
+	        fi
+	        $opt_dry_run || {
+	          if test -n "$dlprefile_dlbasename" ; then
+	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+	          else
+	            func_warning "Could not compute DLL name from $name"
+	            eval '$ECHO ": $name " >> "$nlist"'
+	          fi
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+	        }
+	      else # not an import lib
+	        $opt_dry_run || {
+	          eval '$ECHO ": $name " >> "$nlist"'
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	        }
+	      fi
+	    ;;
+	    *)
+	      $opt_dry_run || {
+	        eval '$ECHO ": $name " >> "$nlist"'
+	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	      }
+	    ;;
+          esac
 	done
 
 	$opt_dry_run || {
@@ -2415,36 +3418,19 @@ extern \"C\" {
 	  if test -f "$nlist"S; then
 	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 	  else
-	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
 	  fi
 
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+	  echo >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
 typedef struct {
   const char *name;
   void *address;
 } lt_dlsymlist;
-"
-	  case $host in
-	  *cygwin* | *mingw* | *cegcc* )
-	    $ECHO >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
-   runtime relocations are performed -- see ld's documentation
-   on pseudo-relocs.  */"
-	    lt_dlsym_const= ;;
-	  *osf5*)
-	    echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
-	    lt_dlsym_const= ;;
-	  *)
-	    lt_dlsym_const=const ;;
-	  esac
-
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
-extern $lt_dlsym_const lt_dlsymlist
+extern LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[];
-$lt_dlsym_const lt_dlsymlist
+LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[] =
 {\
   { \"$my_originator\", (void *) 0 },"
@@ -2457,7 +3443,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] =
 	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 	    ;;
 	  esac
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+	  echo >> "$output_objdir/$my_dlsyms" "\
   {0, (void *) 0}
 };
 
@@ -2500,7 +3486,7 @@ static const void *lt_preloaded_setup() {
 	for arg in $LTCFLAGS; do
 	  case $arg in
 	  -pie | -fpie | -fPIE) ;;
-	  *) symtab_cflags="$symtab_cflags $arg" ;;
+	  *) func_append symtab_cflags " $arg" ;;
 	  esac
 	done
 
@@ -2515,16 +3501,16 @@ static const void *lt_preloaded_setup() {
 	case $host in
 	*cygwin* | *mingw* | *cegcc* )
 	  if test -f "$output_objdir/$my_outputname.def"; then
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 	  else
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 	  fi
 	  ;;
 	*)
-	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 	  ;;
 	esac
 	;;
@@ -2538,8 +3524,8 @@ static const void *lt_preloaded_setup() {
       # really was required.
 
       # Nullify the symbol file.
-      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
     fi
 }
 
@@ -2549,6 +3535,7 @@ static const void *lt_preloaded_setup() {
 # Need a lot of goo to handle *both* DLLs and import libs
 # Has to be a shell function in order to 'eat' the argument
 # that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
   $opt_debug
@@ -2559,9 +3546,11 @@ func_win32_libid ()
     win32_libid_type="x86 archive import"
     ;;
   *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_nmres=`eval $NM -f posix -A $1 |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      func_to_tool_file "$1" func_convert_file_msys_to_w32
+      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
 	$SED -n -e '
 	    1,100{
 		/ I /{
@@ -2590,6 +3579,131 @@ func_win32_libid ()
   $ECHO "$win32_libid_type"
 }
 
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $opt_debug
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $opt_debug
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[	 ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive which possess that section. Heuristic: eliminate
+    # all those which have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $opt_debug
+  if func_cygming_gnu_implib_p "$1" ; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1" ; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=""
+  fi
+}
 
 
 # func_extract_an_archive dir oldlib
@@ -2598,7 +3712,18 @@ func_extract_an_archive ()
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+		   'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
@@ -2669,7 +3794,7 @@ func_extract_archives ()
 	    darwin_file=
 	    darwin_files=
 	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
 	      $LIPO -create -output "$darwin_file" $darwin_files
 	    done # $darwin_filelist
 	    $RM -rf unfat-$$
@@ -2684,25 +3809,30 @@ func_extract_archives ()
         func_extract_an_archive "$my_xdir" "$my_xabs"
 	;;
       esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
     done
 
     func_extract_archives_result="$my_oldobjs"
 }
 
 
-
-# func_emit_wrapper_part1 [arg=no]
+# func_emit_wrapper [arg=no]
 #
-# Emit the first part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part1 ()
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
 {
-	func_emit_wrapper_part1_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_part1_arg1=$1
-	fi
+	func_emit_wrapper_arg1=${1-no}
 
 	$ECHO "\
 #! $SHELL
@@ -2718,7 +3848,6 @@ func_emit_wrapper_part1 ()
 
 # Sed substitution that helps us do robust quoting.  It backslashifies
 # metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
 # Be Bourne compatible
@@ -2749,31 +3878,132 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then
 else
   # When we are sourced in execute mode, \$file and \$ECHO are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    ECHO=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$ECHO works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$ECHO will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
 "
-	$ECHO "\
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  for lt_wr_arg
+  do
+    case \$lt_wr_arg in
+    --lt-*) ;;
+    *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+    esac
+    shift
+  done
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
 
   # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 
   # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
   while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
 
     # If there was a directory component, then change thisdir.
     if test \"x\$destdir\" != \"x\$file\"; then
@@ -2783,30 +4013,13 @@ else
       esac
     fi
 
-    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
   done
-"
-}
-# end: func_emit_wrapper_part1
-
-# func_emit_wrapper_part2 [arg=no]
-#
-# Emit the second part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part2 ()
-{
-	func_emit_wrapper_part2_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_part2_arg1=$1
-	fi
-
-	$ECHO "\
 
   # Usually 'no', except on cygwin/mingw when embedded into
   # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -2814,7 +4027,7 @@ func_emit_wrapper_part2 ()
     fi
     # remove .libs from thisdir
     case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
     $objdir )   thisdir=. ;;
     esac
   fi
@@ -2869,6 +4082,18 @@ func_emit_wrapper_part2 ()
 
   if test -f \"\$progdir/\$program\"; then"
 
+	# fixup the dll searchpath if we need to.
+	#
+	# Fix the DLL searchpath if we need to.  Do this before prepending
+	# to shlibpath, because on Windows, both are PATH and uninstalled
+	# libraries must come first.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
 	# Export our shlibpath_var if we have one.
 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 	  $ECHO "\
@@ -2877,253 +4102,28 @@ func_emit_wrapper_part2 ()
 
     # Some systems cannot cope with colon-terminated $shlibpath_var
     # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
 
     export $shlibpath_var
 "
 	fi
 
-	# fixup the dll searchpath if we need to.
-	if test -n "$dllsearchpath"; then
-	  $ECHO "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
 	$ECHO "\
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
       # Run the actual program with our arguments.
-"
-	case $host in
-	# Backslashes separate directories on plain windows
-	*-*-mingw | *-*-os2* | *-cegcc*)
-	  $ECHO "\
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-	  ;;
-
-	*)
-	  $ECHO "\
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-	  ;;
-	esac
-	$ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
+      func_exec_program \${1+\"\$@\"}
     fi
   else
     # The program doesn't exist.
     \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
   fi
 fi\
 "
 }
-# end: func_emit_wrapper_part2
-
-
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
-	func_emit_wrapper_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_arg1=$1
-	fi
-
-	# split this up so that func_emit_cwrapperexe_src
-	# can call each part independently.
-	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
-	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
-}
-
-
-# func_to_host_path arg
-#
-# Convert paths to host format when used with build tools.
-# Intended for use with "native" mingw (where libtool itself
-# is running under the msys shell), or in the following cross-
-# build environments:
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-# where wine is equipped with the `winepath' executable.
-# In the native mingw case, the (msys) shell automatically
-# converts paths for any non-msys applications it launches,
-# but that facility isn't available from inside the cwrapper.
-# Similar accommodations are necessary for $host mingw and
-# $build cygwin.  Calling this function does no harm for other
-# $host/$build combinations not listed above.
-#
-# ARG is the path (on $build) that should be converted to
-# the proper representation for $host. The result is stored
-# in $func_to_host_path_result.
-func_to_host_path ()
-{
-  func_to_host_path_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        case $build in
-          *mingw* ) # actually, msys
-            # awkward: cmd appends spaces to result
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_path_tmp1=`cygpath -w "$1"`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # Unfortunately, winepath does not exit with a non-zero
-            # error code, so we are forced to check the contents of
-            # stdout. On the other hand, if the command is not
-            # found, the shell will set an exit code of 127 and print
-            # *an error message* to stdout. So we must check for both
-            # error code of zero AND non-empty stdout, which explains
-            # the odd construction:
-            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
-            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
-              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-                $SED -e "$lt_sed_naive_backslashify"`
-            else
-              # Allow warning below.
-              func_to_host_path_result=""
-            fi
-            ;;
-        esac
-        if test -z "$func_to_host_path_result" ; then
-          func_error "Could not determine host path corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback:
-          func_to_host_path_result="$1"
-        fi
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_path
 
-# func_to_host_pathlist arg
-#
-# Convert pathlists to host format when used with build tools.
-# See func_to_host_path(), above. This function supports the
-# following $build/$host combinations (but does no harm for
-# combinations not listed here):
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-#
-# Path separators are also converted from $build format to
-# $host format. If ARG begins or ends with a path separator
-# character, it is preserved (but converted to $host format)
-# on output.
-#
-# ARG is a pathlist (on $build) that should be converted to
-# the proper representation on $host. The result is stored
-# in $func_to_host_pathlist_result.
-func_to_host_pathlist ()
-{
-  func_to_host_pathlist_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        # Remove leading and trailing path separator characters from
-        # ARG. msys behavior is inconsistent here, cygpath turns them
-        # into '.;' and ';.', and winepath ignores them completely.
-        func_to_host_pathlist_tmp2="$1"
-        # Once set for this call, this variable should not be
-        # reassigned. It is used in tha fallback case.
-        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
-          $SED -e 's|^:*||' -e 's|:*$||'`
-        case $build in
-          *mingw* ) # Actually, msys.
-            # Awkward: cmd appends spaces to result.
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # unfortunately, winepath doesn't convert pathlists
-            func_to_host_pathlist_result=""
-            func_to_host_pathlist_oldIFS=$IFS
-            IFS=:
-            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
-              IFS=$func_to_host_pathlist_oldIFS
-              if test -n "$func_to_host_pathlist_f" ; then
-                func_to_host_path "$func_to_host_pathlist_f"
-                if test -n "$func_to_host_path_result" ; then
-                  if test -z "$func_to_host_pathlist_result" ; then
-                    func_to_host_pathlist_result="$func_to_host_path_result"
-                  else
-                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
-                  fi
-                fi
-              fi
-              IFS=:
-            done
-            IFS=$func_to_host_pathlist_oldIFS
-            ;;
-        esac
-        if test -z "$func_to_host_pathlist_result" ; then
-          func_error "Could not determine the host path(s) corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback. This may break if $1 contains DOS-style drive
-          # specifications. The fix is not to complicate the expression
-          # below, but for the user to provide a working wine installation
-          # with winepath so that path translation in the cross-to-mingw
-          # case works properly.
-          lt_replace_pathsep_nix_to_dos="s|:|;|g"
-          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
-            $SED -e "$lt_replace_pathsep_nix_to_dos"`
-        fi
-        # Now, add the leading and trailing path separators back
-        case "$1" in
-          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
-            ;;
-        esac
-        case "$1" in
-          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
-            ;;
-        esac
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_pathlist
 
 # func_emit_cwrapperexe_src
 # emit the source code for a wrapper executable on stdout
@@ -3141,31 +4141,23 @@ func_emit_cwrapperexe_src ()
 
    This wrapper executable should never be moved out of the build directory.
    If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "$SHELL $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
 */
 EOF
 	    cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
 # include <io.h>
-# define setmode _setmode
 #else
 # include <unistd.h>
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
-#  define HAVE_SETENV
-#  ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-#  endif
 # endif
 #endif
 #include <malloc.h>
@@ -3177,6 +4169,44 @@ int setenv (const char *, const char *, int);
 #include <fcntl.h>
 #include <sys/stat.h>
 
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
 #if defined(PATH_MAX)
 # define LT_PATHMAX PATH_MAX
 #elif defined(MAXPATHLEN)
@@ -3192,14 +4222,7 @@ int setenv (const char *, const char *, int);
 # define S_IXGRP 0
 #endif
 
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#endif
-
+/* path handling portability macros */
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -3230,10 +4253,6 @@ int setenv (const char *, const char *, int);
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
 #ifndef FOPEN_WB
 # define FOPEN_WB "w"
 #endif
@@ -3246,22 +4265,13 @@ int setenv (const char *, const char *, int);
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
-    va_list args;
-    va_start (args, fmt);
-    (void) vfprintf (stderr, fmt, args);
-    va_end (args);
-}
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
 #else
-# define LTWRAPPER_DEBUGPRINTF(args)
+static int lt_debug = 0;
 #endif
 
-const char *program_name = NULL;
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
 
 void *xmalloc (size_t num);
 char *xstrdup (const char *string);
@@ -3271,41 +4281,27 @@ char *chase_symlinks (const char *pathspec);
 int make_executable (const char *path);
 int check_executable (const char *path);
 char *strendzap (char *str, const char *pat);
-void lt_fatal (const char *message, ...);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
 void lt_setenv (const char *name, const char *value);
 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_opt_process_env_set (const char *arg);
-void lt_opt_process_env_prepend (const char *arg);
-void lt_opt_process_env_append (const char *arg);
-int lt_split_name_value (const char *arg, char** name, char** value);
 void lt_update_exe_path (const char *name, const char *value);
 void lt_update_lib_path (const char *name, const char *value);
-
-static const char *script_text_part1 =
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
 EOF
 
-	    func_emit_wrapper_part1 yes |
-	        $SED -e 's/\([\\"]\)/\\\1/g' \
-	             -e 's/^/  "/' -e 's/$/\\n"/'
-	    echo ";"
 	    cat <<EOF
-
-static const char *script_text_part2 =
-EOF
-	    func_emit_wrapper_part2 yes |
-	        $SED -e 's/\([\\"]\)/\\\1/g' \
-	             -e 's/^/  "/' -e 's/$/\\n"/'
-	    echo ";"
-
-	    cat <<EOF
-const char * MAGIC_EXE = "$magic_exe";
+volatile const char * MAGIC_EXE = "$magic_exe";
 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF
 
 	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-              func_to_host_pathlist "$temp_rpath"
+              func_to_host_path "$temp_rpath"
 	      cat <<EOF
-const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
+const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -3314,10 +4310,10 @@ EOF
 	    fi
 
 	    if test -n "$dllsearchpath"; then
-              func_to_host_pathlist "$dllsearchpath:"
+              func_to_host_path "$dllsearchpath:"
 	      cat <<EOF
 const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
+const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -3340,24 +4336,10 @@ EOF
 	    cat <<"EOF"
 
 #define LTWRAPPER_OPTION_PREFIX         "--lt-"
-#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
 
-static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-
 static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-
-static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
-static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
-  /* argument is putenv-style "foo=bar", value of foo is set to bar */
-
-static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
-static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
-  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
-
-static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
-static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
-  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 
 int
 main (int argc, char *argv[])
@@ -3374,10 +4356,13 @@ main (int argc, char *argv[])
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+  newargz = XMALLOC (char *, argc + 1);
 
-  /* very simple arg parsing; don't want to rely on getopt */
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
   for (i = 1; i < argc; i++)
     {
       if (strcmp (argv[i], dumpscript_opt) == 0)
@@ -3391,25 +4376,57 @@ EOF
 	      esac
 
 	    cat <<"EOF"
-	  printf ("%s", script_text_part1);
-	  printf ("%s", script_text_part2);
+	  lt_dump_script (stdout);
 	  return 0;
 	}
+      if (strcmp (argv[i], debug_opt) == 0)
+	{
+          lt_debug = 1;
+          continue;
+	}
+      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+		    "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
     }
+  newargz[++newargc] = NULL;
+
+EOF
+	    cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+	    cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 
-  newargz = XMALLOC (char *, argc + 1);
   tmp_pathspec = find_executable (argv[0]);
   if (tmp_pathspec == NULL)
-    lt_fatal ("Couldn't find %s", argv[0]);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
-			  tmp_pathspec));
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+		  tmp_pathspec);
 
   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
-			  actual_cwrapper_path));
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+		  actual_cwrapper_path);
   XFREE (tmp_pathspec);
 
-  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
   strendzap (actual_cwrapper_path, actual_cwrapper_name);
 
   /* wrapper name transforms */
@@ -3427,8 +4444,9 @@ EOF
   target_name = tmp_pathspec;
   tmp_pathspec = 0;
 
-  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
-			  target_name));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(main) libtool target name: %s\n",
+		  target_name);
 EOF
 
 	    cat <<EOF
@@ -3478,80 +4496,19 @@ EOF
 
   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
-  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
+     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+     because on Windows, both *_VARNAMEs are PATH but uninstalled
+     libraries must come first. */
   lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
 
-  newargc=0;
-  for (i = 1; i < argc; i++)
-    {
-      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
-        {
-          if (argv[i][env_set_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_set_opt_len + 1;
-              lt_opt_process_env_set (p);
-            }
-          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_set (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_set_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
-        {
-          if (argv[i][env_prepend_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_prepend_opt_len + 1;
-              lt_opt_process_env_prepend (p);
-            }
-          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_prepend_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
-        {
-          if (argv[i][env_append_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_append_opt_len + 1;
-              lt_opt_process_env_append (p);
-            }
-          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_append (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_append_opt);
-          continue;
-        }
-      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal ("Unrecognized option in %s namespace: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
-    }
-  newargz[++newargc] = NULL;
-
-  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+		  nonnull (lt_argv_zero));
   for (i = 0; i < newargc; i++)
     {
-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+		      i, nonnull (newargz[i]));
     }
 
 EOF
@@ -3560,11 +4517,14 @@ EOF
 	      mingw*)
 		cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
   rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+      lt_debugprintf (__FILE__, __LINE__,
+		      "(main) failed to launch target \"%s\": %s\n",
+		      lt_argv_zero, nonnull (strerror (errno)));
       return 127;
     }
   return rval;
@@ -3586,7 +4546,7 @@ xmalloc (size_t num)
 {
   void *p = (void *) malloc (num);
   if (!p)
-    lt_fatal ("Memory exhausted");
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
 
   return p;
 }
@@ -3620,8 +4580,8 @@ check_executable (const char *path)
 {
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3638,8 +4598,8 @@ make_executable (const char *path)
   int rval = 0;
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3665,8 +4625,8 @@ find_executable (const char *wrapper)
   int tmp_len;
   char *concat_name;
 
-  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
-			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
 
   if ((wrapper == NULL) || (*wrapper == '\0'))
     return NULL;
@@ -3719,7 +4679,8 @@ find_executable (const char *wrapper)
 		{
 		  /* empty path: current directory */
 		  if (getcwd (tmp, LT_PATHMAX) == NULL)
-		    lt_fatal ("getcwd failed");
+		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
 		  tmp_len = strlen (tmp);
 		  concat_name =
 		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
@@ -3744,7 +4705,8 @@ find_executable (const char *wrapper)
     }
   /* Relative path | not found in path: prepend cwd */
   if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
   tmp_len = strlen (tmp);
   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   memcpy (concat_name, tmp, tmp_len);
@@ -3770,8 +4732,9 @@ chase_symlinks (const char *pathspec)
   int has_symlinks = 0;
   while (strlen (tmp_pathspec) && !has_symlinks)
     {
-      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
-			      tmp_pathspec));
+      lt_debugprintf (__FILE__, __LINE__,
+		      "checking path component for symlinks: %s\n",
+		      tmp_pathspec);
       if (lstat (tmp_pathspec, &s) == 0)
 	{
 	  if (S_ISLNK (s.st_mode) != 0)
@@ -3793,8 +4756,9 @@ chase_symlinks (const char *pathspec)
 	}
       else
 	{
-	  char *errstr = strerror (errno);
-	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+	  lt_fatal (__FILE__, __LINE__,
+		    "error accessing file \"%s\": %s",
+		    tmp_pathspec, nonnull (strerror (errno)));
 	}
     }
   XFREE (tmp_pathspec);
@@ -3807,7 +4771,8 @@ chase_symlinks (const char *pathspec)
   tmp_pathspec = realpath (pathspec, buf);
   if (tmp_pathspec == 0)
     {
-      lt_fatal ("Could not follow symlinks for %s", pathspec);
+      lt_fatal (__FILE__, __LINE__,
+		"could not follow symlinks for %s", pathspec);
     }
   return xstrdup (tmp_pathspec);
 #endif
@@ -3833,11 +4798,25 @@ strendzap (char *str, const char *pat)
   return str;
 }
 
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
 static void
-lt_error_core (int exit_status, const char *mode,
+lt_error_core (int exit_status, const char *file,
+	       int line, const char *mode,
 	       const char *message, va_list ap)
 {
-  fprintf (stderr, "%s: %s: ", program_name, mode);
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
   vfprintf (stderr, message, ap);
   fprintf (stderr, ".\n");
 
@@ -3846,20 +4825,32 @@ lt_error_core (int exit_status, const char *mode,
 }
 
 void
-lt_fatal (const char *message, ...)
+lt_fatal (const char *file, int line, const char *message, ...)
 {
   va_list ap;
   va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
   va_end (ap);
 }
 
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
 void
 lt_setenv (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
   {
 #ifdef HAVE_SETENV
     /* always make a copy, for consistency with !HAVE_SETENV */
@@ -3904,95 +4895,12 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
   return new_value;
 }
 
-int
-lt_split_name_value (const char *arg, char** name, char** value)
-{
-  const char *p;
-  int len;
-  if (!arg || !*arg)
-    return 1;
-
-  p = strchr (arg, (int)'=');
-
-  if (!p)
-    return 1;
-
-  *value = xstrdup (++p);
-
-  len = strlen (arg) - strlen (*value);
-  *name = XMALLOC (char, len);
-  strncpy (*name, arg, len-1);
-  (*name)[len - 1] = '\0';
-
-  return 0;
-}
-
-void
-lt_opt_process_env_set (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
-    }
-
-  lt_setenv (name, value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_prepend (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 0);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_append (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 1);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
 void
 lt_update_exe_path (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
 
   if (name && *name && value && *value)
     {
@@ -4011,9 +4919,9 @@ lt_update_exe_path (const char *name, const char *value)
 void
 lt_update_lib_path (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
 
   if (name && *name && value && *value)
     {
@@ -4023,11 +4931,152 @@ lt_update_lib_path (const char *name, const char *value)
     }
 }
 
+EOF
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+	new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+	{
+	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+	  size_t length;
+	  unsigned int backslashes;
+	  const char *s;
+	  char *quoted_string;
+	  char *p;
+
+	  length = 0;
+	  backslashes = 0;
+	  if (quote_around)
+	    length++;
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		length += backslashes + 1;
+	      length++;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    length += backslashes + 1;
 
+	  quoted_string = XMALLOC (char, length + 1);
+
+	  p = quoted_string;
+	  backslashes = 0;
+	  if (quote_around)
+	    *p++ = '"';
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		{
+		  unsigned int j;
+		  for (j = backslashes + 1; j > 0; j--)
+		    *p++ = '\\';
+		}
+	      *p++ = c;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    {
+	      unsigned int j;
+	      for (j = backslashes; j > 0; j--)
+		*p++ = '\\';
+	      *p++ = '"';
+	    }
+	  *p = '\0';
+
+	  new_argv[i] = quoted_string;
+	}
+      else
+	new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+		;;
+	    esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+	    func_emit_wrapper yes |
+              $SED -e 's/\([\\"]\)/\\\1/g' \
+	           -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
+
+            cat <<"EOF"
+}
 EOF
 }
 # end: func_emit_cwrapperexe_src
 
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
@@ -4072,6 +5121,7 @@ func_mode_link ()
     new_inherited_linker_flags=
 
     avoid_version=no
+    bindir=
     dlfiles=
     dlprefiles=
     dlself=no
@@ -4164,6 +5214,11 @@ func_mode_link ()
 	esac
 
 	case $prev in
+	bindir)
+	  bindir="$arg"
+	  prev=
+	  continue
+	  ;;
 	dlfiles|dlprefiles)
 	  if test "$preload" = no; then
 	    # Add the symbol object into the linking commands.
@@ -4195,9 +5250,9 @@ func_mode_link ()
 	    ;;
 	  *)
 	    if test "$prev" = dlfiles; then
-	      dlfiles="$dlfiles $arg"
+	      func_append dlfiles " $arg"
 	    else
-	      dlprefiles="$dlprefiles $arg"
+	      func_append dlprefiles " $arg"
 	    fi
 	    prev=
 	    continue
@@ -4221,7 +5276,7 @@ func_mode_link ()
 	    *-*-darwin*)
 	      case "$deplibs " in
 		*" $qarg.ltframework "*) ;;
-		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+		*) func_append deplibs " $qarg.ltframework" # this is fixed later
 		   ;;
 	      esac
 	      ;;
@@ -4240,7 +5295,7 @@ func_mode_link ()
 	    moreargs=
 	    for fil in `cat "$save_arg"`
 	    do
-#	      moreargs="$moreargs $fil"
+#	      func_append moreargs " $fil"
 	      arg=$fil
 	      # A libtool-controlled object.
 
@@ -4269,7 +5324,7 @@ func_mode_link ()
 
 		  if test "$prev" = dlfiles; then
 		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      dlfiles="$dlfiles $pic_object"
+		      func_append dlfiles " $pic_object"
 		      prev=
 		      continue
 		    else
@@ -4281,7 +5336,7 @@ func_mode_link ()
 		  # CHECK ME:  I think I busted this.  -Ossama
 		  if test "$prev" = dlprefiles; then
 		    # Preload the old-style object.
-		    dlprefiles="$dlprefiles $pic_object"
+		    func_append dlprefiles " $pic_object"
 		    prev=
 		  fi
 
@@ -4351,12 +5406,12 @@ func_mode_link ()
 	  if test "$prev" = rpath; then
 	    case "$rpath " in
 	    *" $arg "*) ;;
-	    *) rpath="$rpath $arg" ;;
+	    *) func_append rpath " $arg" ;;
 	    esac
 	  else
 	    case "$xrpath " in
 	    *" $arg "*) ;;
-	    *) xrpath="$xrpath $arg" ;;
+	    *) func_append xrpath " $arg" ;;
 	    esac
 	  fi
 	  prev=
@@ -4368,28 +5423,28 @@ func_mode_link ()
 	  continue
 	  ;;
 	weak)
-	  weak_libs="$weak_libs $arg"
+	  func_append weak_libs " $arg"
 	  prev=
 	  continue
 	  ;;
 	xcclinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $qarg"
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xcompiler)
-	  compiler_flags="$compiler_flags $qarg"
+	  func_append compiler_flags " $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xlinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $wl$qarg"
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $wl$qarg"
 	  prev=
 	  func_append compile_command " $wl$qarg"
 	  func_append finalize_command " $wl$qarg"
@@ -4425,6 +5480,11 @@ func_mode_link ()
 	continue
 	;;
 
+      -bindir)
+	prev=bindir
+	continue
+	;;
+
       -dlopen)
 	prev=dlfiles
 	continue
@@ -4475,15 +5535,16 @@ func_mode_link ()
 	;;
 
       -L*)
-	func_stripname '-L' '' "$arg"
-	dir=$func_stripname_result
-	if test -z "$dir"; then
+	func_stripname "-L" '' "$arg"
+	if test -z "$func_stripname_result"; then
 	  if test "$#" -gt 0; then
 	    func_fatal_error "require no space between \`-L' and \`$1'"
 	  else
 	    func_fatal_error "need path for \`-L' option"
 	  fi
 	fi
+	func_resolve_sysroot "$func_stripname_result"
+	dir=$func_resolve_sysroot_result
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -4495,24 +5556,30 @@ func_mode_link ()
 	  ;;
 	esac
 	case "$deplibs " in
-	*" -L$dir "*) ;;
+	*" -L$dir "* | *" $arg "*)
+	  # Will only happen for absolute or sysroot arguments
+	  ;;
 	*)
-	  deplibs="$deplibs -L$dir"
-	  lib_search_path="$lib_search_path $dir"
+	  # Preserve sysroot, but never include relative directories
+	  case $dir in
+	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+	    *) func_append deplibs " -L$dir" ;;
+	  esac
+	  func_append lib_search_path " $dir"
 	  ;;
 	esac
 	case $host in
 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
 	  case :$dllsearchpath: in
 	  *":$dir:"*) ;;
 	  ::) dllsearchpath=$dir;;
-	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  *) func_append dllsearchpath ":$dir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  *) func_append dllsearchpath ":$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -4522,7 +5589,7 @@ func_mode_link ()
       -l*)
 	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
 	    # These systems don't actually have a C or math library (as such)
 	    continue
 	    ;;
@@ -4536,7 +5603,7 @@ func_mode_link ()
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C and math libraries are in the System framework
-	    deplibs="$deplibs System.ltframework"
+	    func_append deplibs " System.ltframework"
 	    continue
 	    ;;
 	  *-*-sco3.2v5* | *-*-sco5v6*)
@@ -4556,7 +5623,7 @@ func_mode_link ()
 	   ;;
 	 esac
 	fi
-	deplibs="$deplibs $arg"
+	func_append deplibs " $arg"
 	continue
 	;;
 
@@ -4568,8 +5635,8 @@ func_mode_link ()
       # Tru64 UNIX uses -model [arg] to determine the layout of C++
       # classes, name mangling, and exception handling.
       # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot)
-	compiler_flags="$compiler_flags $arg"
+      -model|-arch|-isysroot|--sysroot)
+	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	prev=xcompiler
@@ -4577,12 +5644,12 @@ func_mode_link ()
 	;;
 
       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-	compiler_flags="$compiler_flags $arg"
+	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	case "$new_inherited_linker_flags " in
 	    *" $arg "*) ;;
-	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+	    * ) func_append new_inherited_linker_flags " $arg" ;;
 	esac
 	continue
 	;;
@@ -4649,13 +5716,17 @@ func_mode_link ()
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	=*)
+	  func_stripname '=' '' "$dir"
+	  dir=$lt_sysroot$func_stripname_result
+	  ;;
 	*)
 	  func_fatal_error "only absolute run-paths are allowed"
 	  ;;
 	esac
 	case "$xrpath " in
 	*" $dir "*) ;;
-	*) xrpath="$xrpath $dir" ;;
+	*) func_append xrpath " $dir" ;;
 	esac
 	continue
 	;;
@@ -4708,8 +5779,8 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
+	  func_append arg " $func_quote_for_eval_result"
+	  func_append compiler_flags " $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -4724,9 +5795,9 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
-	  linker_flags="$linker_flags $func_quote_for_eval_result"
+	  func_append arg " $wl$func_quote_for_eval_result"
+	  func_append compiler_flags " $wl$func_quote_for_eval_result"
+	  func_append linker_flags " $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -4754,23 +5825,27 @@ func_mode_link ()
 	arg="$func_quote_for_eval_result"
 	;;
 
-      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
-      # -r[0-9][0-9]* specifies the processor on the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
-      # +DA*, +DD* enable 64-bit mode on the HP compiler
-      # -q* pass through compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* pass through architecture-specific
-      # compiler args for GCC
-      # -F/path gives path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
-      # @file GCC response files
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
-        compiler_flags="$compiler_flags $arg"
+        func_append compiler_flags " $arg"
         continue
         ;;
 
@@ -4782,7 +5857,7 @@ func_mode_link ()
 
       *.$objext)
 	# A standard object.
-	objs="$objs $arg"
+	func_append objs " $arg"
 	;;
 
       *.lo)
@@ -4813,7 +5888,7 @@ func_mode_link ()
 
 	    if test "$prev" = dlfiles; then
 	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		dlfiles="$dlfiles $pic_object"
+		func_append dlfiles " $pic_object"
 		prev=
 		continue
 	      else
@@ -4825,7 +5900,7 @@ func_mode_link ()
 	    # CHECK ME:  I think I busted this.  -Ossama
 	    if test "$prev" = dlprefiles; then
 	      # Preload the old-style object.
-	      dlprefiles="$dlprefiles $pic_object"
+	      func_append dlprefiles " $pic_object"
 	      prev=
 	    fi
 
@@ -4870,24 +5945,25 @@ func_mode_link ()
 
       *.$libext)
 	# An archive.
-	deplibs="$deplibs $arg"
-	old_deplibs="$old_deplibs $arg"
+	func_append deplibs " $arg"
+	func_append old_deplibs " $arg"
 	continue
 	;;
 
       *.la)
 	# A libtool-controlled library.
 
+	func_resolve_sysroot "$arg"
 	if test "$prev" = dlfiles; then
 	  # This library was specified with -dlopen.
-	  dlfiles="$dlfiles $arg"
+	  func_append dlfiles " $func_resolve_sysroot_result"
 	  prev=
 	elif test "$prev" = dlprefiles; then
 	  # The library was specified with -dlpreopen.
-	  dlprefiles="$dlprefiles $arg"
+	  func_append dlprefiles " $func_resolve_sysroot_result"
 	  prev=
 	else
-	  deplibs="$deplibs $arg"
+	  func_append deplibs " $func_resolve_sysroot_result"
 	fi
 	continue
 	;;
@@ -4925,7 +6001,7 @@ func_mode_link ()
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
@@ -4934,6 +6010,8 @@ func_mode_link ()
 
     func_dirname "$output" "/" ""
     output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
     func_mkdir_p "$output_objdir"
 
@@ -4954,12 +6032,12 @@ func_mode_link ()
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
     for deplib in $deplibs; do
-      if $opt_duplicate_deps ; then
+      if $opt_preserve_dup_deps ; then
 	case "$libs " in
-	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	esac
       fi
-      libs="$libs $deplib"
+      func_append libs " $deplib"
     done
 
     if test "$linkmode" = lib; then
@@ -4972,9 +6050,9 @@ func_mode_link ()
       if $opt_duplicate_compiler_generated_deps; then
 	for pre_post_dep in $predeps $postdeps; do
 	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
 	  esac
-	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	  func_append pre_post_deps " $pre_post_dep"
 	done
       fi
       pre_post_deps=
@@ -5044,17 +6122,19 @@ func_mode_link ()
 	for lib in $dlprefiles; do
 	  # Ignore non-libtool-libs
 	  dependency_libs=
+	  func_resolve_sysroot "$lib"
 	  case $lib in
-	  *.la)	func_source "$lib" ;;
+	  *.la)	func_source "$func_resolve_sysroot_result" ;;
 	  esac
 
 	  # Collect preopened libtool deplibs, except any this library
 	  # has declared as weak libs
 	  for deplib in $dependency_libs; do
-            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+	    func_basename "$deplib"
+            deplib_base=$func_basename_result
 	    case " $weak_libs " in
 	    *" $deplib_base "*) ;;
-	    *) deplibs="$deplibs $deplib" ;;
+	    *) func_append deplibs " $deplib" ;;
 	    esac
 	  done
 	done
@@ -5075,11 +6155,11 @@ func_mode_link ()
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
-	    compiler_flags="$compiler_flags $deplib"
+	    func_append compiler_flags " $deplib"
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -5164,7 +6244,7 @@ func_mode_link ()
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -5177,7 +6257,8 @@ func_mode_link ()
 	    test "$pass" = conv && continue
 	    newdependency_libs="$deplib $newdependency_libs"
 	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  prog)
 	    if test "$pass" = conv; then
@@ -5191,7 +6272,8 @@ func_mode_link ()
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    fi
 	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  *)
 	    func_warning "\`-L' is ignored for archives/objects"
@@ -5202,17 +6284,21 @@ func_mode_link ()
 	-R*)
 	  if test "$pass" = link; then
 	    func_stripname '-R' '' "$deplib"
-	    dir=$func_stripname_result
+	    func_resolve_sysroot "$func_stripname_result"
+	    dir=$func_resolve_sysroot_result
 	    # Make sure the xrpath contains only unique directories.
 	    case "$xrpath " in
 	    *" $dir "*) ;;
-	    *) xrpath="$xrpath $dir" ;;
+	    *) func_append xrpath " $dir" ;;
 	    esac
 	  fi
 	  deplibs="$deplib $deplibs"
 	  continue
 	  ;;
-	*.la) lib="$deplib" ;;
+	*.la)
+	  func_resolve_sysroot "$deplib"
+	  lib=$func_resolve_sysroot_result
+	  ;;
 	*.$libext)
 	  if test "$pass" = conv; then
 	    deplibs="$deplib $deplibs"
@@ -5230,7 +6316,7 @@ func_mode_link ()
 		match_pattern*)
 		  set dummy $deplibs_check_method; shift
 		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
+		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
 		    | $EGREP "$match_pattern_regex" > /dev/null; then
 		    valid_a_lib=yes
 		  fi
@@ -5240,15 +6326,15 @@ func_mode_link ()
 		;;
 	      esac
 	      if test "$valid_a_lib" != yes; then
-		$ECHO
+		echo
 		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
-		$ECHO "*** that it is just a static archive that I should not use here."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because the file extensions .$libext of this argument makes me believe"
+		echo "*** that it is just a static archive that I should not use here."
 	      else
-		$ECHO
+		echo
 		$ECHO "*** Warning: Linking the shared library $output against the"
 		$ECHO "*** static library $deplib is not portable!"
 		deplibs="$deplib $deplibs"
@@ -5275,11 +6361,11 @@ func_mode_link ()
 	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 	      # If there is no dlopen support or we're linking statically,
 	      # we need to preload.
-	      newdlprefiles="$newdlprefiles $deplib"
+	      func_append newdlprefiles " $deplib"
 	      compile_deplibs="$deplib $compile_deplibs"
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    else
-	      newdlfiles="$newdlfiles $deplib"
+	      func_append newdlfiles " $deplib"
 	    fi
 	  fi
 	  continue
@@ -5321,20 +6407,20 @@ func_mode_link ()
 
 	# Convert "-framework foo" to "foo.ltframework"
 	if test -n "$inherited_linker_flags"; then
-	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
 	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 	    case " $new_inherited_linker_flags " in
 	      *" $tmp_inherited_linker_flag "*) ;;
-	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
 	    esac
 	  done
 	fi
-	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	if test "$linkmode,$pass" = "lib,link" ||
 	   test "$linkmode,$pass" = "prog,scan" ||
 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
-	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	  test -n "$dlopen" && func_append dlfiles " $dlopen"
+	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
 	fi
 
 	if test "$pass" = conv; then
@@ -5345,17 +6431,17 @@ func_mode_link ()
 	      func_fatal_error "cannot find name of link library for \`$lib'"
 	    fi
 	    # It is a libtool convenience library, so add in its objects.
-	    convenience="$convenience $ladir/$objdir/$old_library"
-	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    func_append convenience " $ladir/$objdir/$old_library"
+	    func_append old_convenience " $ladir/$objdir/$old_library"
 	    tmp_libs=
 	    for deplib in $dependency_libs; do
 	      deplibs="$deplib $deplibs"
-	      if $opt_duplicate_deps ; then
+	      if $opt_preserve_dup_deps ; then
 		case "$tmp_libs " in
-		*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
 		esac
 	      fi
-	      tmp_libs="$tmp_libs $deplib"
+	      func_append tmp_libs " $deplib"
 	    done
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
@@ -5366,9 +6452,15 @@ func_mode_link ()
 
 	# Get the name of the library we link against.
 	linklib=
-	for l in $old_library $library_names; do
-	  linklib="$l"
-	done
+	if test -n "$old_library" &&
+	   { test "$prefer_static_libs" = yes ||
+	     test "$prefer_static_libs,$installed" = "built,no"; }; then
+	  linklib=$old_library
+	else
+	  for l in $old_library $library_names; do
+	    linklib="$l"
+	  done
+	fi
 	if test -z "$linklib"; then
 	  func_fatal_error "cannot find name of link library for \`$lib'"
 	fi
@@ -5385,9 +6477,9 @@ func_mode_link ()
 	    # statically, we need to preload.  We also need to preload any
 	    # dependent libraries so libltdl's deplib preloader doesn't
 	    # bomb out in the load deplibs phase.
-	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	    func_append dlprefiles " $lib $dependency_libs"
 	  else
-	    newdlfiles="$newdlfiles $lib"
+	    func_append newdlfiles " $lib"
 	  fi
 	  continue
 	fi # $pass = dlopen
@@ -5409,14 +6501,14 @@ func_mode_link ()
 
 	# Find the relevant object directory and library name.
 	if test "X$installed" = Xyes; then
-	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 	    func_warning "library \`$lib' was moved."
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    libdir="$abs_ladir"
 	  else
-	    dir="$libdir"
-	    absdir="$libdir"
+	    dir="$lt_sysroot$libdir"
+	    absdir="$lt_sysroot$libdir"
 	  fi
 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
 	else
@@ -5424,12 +6516,12 @@ func_mode_link ()
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
+	    func_append notinst_path " $abs_ladir"
 	  else
 	    dir="$ladir/$objdir"
 	    absdir="$abs_ladir/$objdir"
 	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
+	    func_append notinst_path " $abs_ladir"
 	  fi
 	fi # $installed = yes
 	func_stripname 'lib' '.la' "$laname"
@@ -5440,20 +6532,46 @@ func_mode_link ()
 	  if test -z "$libdir" && test "$linkmode" = prog; then
 	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
 	  fi
-	  # Prefer using a static library (so that no silly _DYNAMIC symbols
-	  # are required to link).
-	  if test -n "$old_library"; then
-	    newdlprefiles="$newdlprefiles $dir/$old_library"
-	    # Keep a list of preopened convenience libraries to check
-	    # that they are being used correctly in the link pass.
-	    test -z "$libdir" && \
-		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
-	  # Otherwise, use the dlname, so that lt_dlopen finds it.
-	  elif test -n "$dlname"; then
-	    newdlprefiles="$newdlprefiles $dir/$dlname"
-	  else
-	    newdlprefiles="$newdlprefiles $dir/$linklib"
-	  fi
+	  case "$host" in
+	    # special handling for platforms with PE-DLLs.
+	    *cygwin* | *mingw* | *cegcc* )
+	      # Linker will automatically link against shared library if both
+	      # static and shared are present.  Therefore, ensure we extract
+	      # symbols from the import library if a shared library is present
+	      # (otherwise, the dlopen module name will be incorrect).  We do
+	      # this by putting the import library name into $newdlprefiles.
+	      # We recover the dlopen module name by 'saving' the la file
+	      # name in a special purpose variable, and (later) extracting the
+	      # dlname from the la file.
+	      if test -n "$dlname"; then
+	        func_tr_sh "$dir/$linklib"
+	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+	        func_append newdlprefiles " $dir/$linklib"
+	      else
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      fi
+	    ;;
+	    * )
+	      # Prefer using a static library (so that no silly _DYNAMIC symbols
+	      # are required to link).
+	      if test -n "$old_library"; then
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      # Otherwise, use the dlname, so that lt_dlopen finds it.
+	      elif test -n "$dlname"; then
+	        func_append newdlprefiles " $dir/$dlname"
+	      else
+	        func_append newdlprefiles " $dir/$linklib"
+	      fi
+	    ;;
+	  esac
 	fi # $pass = dlpreopen
 
 	if test -z "$libdir"; then
@@ -5471,7 +6589,7 @@ func_mode_link ()
 
 
 	if test "$linkmode" = prog && test "$pass" != link; then
-	  newlib_search_path="$newlib_search_path $ladir"
+	  func_append newlib_search_path " $ladir"
 	  deplibs="$lib $deplibs"
 
 	  linkalldeplibs=no
@@ -5484,7 +6602,8 @@ func_mode_link ()
 	  for deplib in $dependency_libs; do
 	    case $deplib in
 	    -L*) func_stripname '-L' '' "$deplib"
-	         newlib_search_path="$newlib_search_path $func_stripname_result"
+	         func_resolve_sysroot "$func_stripname_result"
+	         func_append newlib_search_path " $func_resolve_sysroot_result"
 		 ;;
 	    esac
 	    # Need to link against all dependency_libs?
@@ -5495,12 +6614,12 @@ func_mode_link ()
 	      # or/and link against static libraries
 	      newdependency_libs="$deplib $newdependency_libs"
 	    fi
-	    if $opt_duplicate_deps ; then
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $deplib"
 	  done # for deplib
 	  continue
 	fi # $linkmode = prog...
@@ -5515,7 +6634,7 @@ func_mode_link ()
 	      # Make sure the rpath contains only unique directories.
 	      case "$temp_rpath:" in
 	      *"$absdir:"*) ;;
-	      *) temp_rpath="$temp_rpath$absdir:" ;;
+	      *) func_append temp_rpath "$absdir:" ;;
 	      esac
 	    fi
 
@@ -5527,7 +6646,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
+	      *) func_append compile_rpath " $absdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5536,7 +6655,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
+	      *) func_append finalize_rpath " $libdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5561,12 +6680,12 @@ func_mode_link ()
 	  case $host in
 	  *cygwin* | *mingw* | *cegcc*)
 	      # No point in relinking DLLs because paths are not encoded
-	      notinst_deplibs="$notinst_deplibs $lib"
+	      func_append notinst_deplibs " $lib"
 	      need_relink=no
 	    ;;
 	  *)
 	    if test "$installed" = no; then
-	      notinst_deplibs="$notinst_deplibs $lib"
+	      func_append notinst_deplibs " $lib"
 	      need_relink=yes
 	    fi
 	    ;;
@@ -5583,7 +6702,7 @@ func_mode_link ()
 	    fi
 	  done
 	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-	    $ECHO
+	    echo
 	    if test "$linkmode" = prog; then
 	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
 	    else
@@ -5601,7 +6720,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
+	      *) func_append compile_rpath " $absdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5610,7 +6729,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
+	      *) func_append finalize_rpath " $libdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5664,7 +6783,7 @@ func_mode_link ()
 	    linklib=$newlib
 	  fi # test -n "$old_archive_from_expsyms_cmds"
 
-	  if test "$linkmode" = prog || test "$mode" != relink; then
+	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -5686,9 +6805,9 @@ func_mode_link ()
 		      if test "X$dlopenmodule" != "X$lib"; then
 			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
 			if test -z "$old_library" ; then
-			  $ECHO
-			  $ECHO "*** And there doesn't seem to be a static archive available"
-			  $ECHO "*** The link will probably fail, sorry"
+			  echo
+			  echo "*** And there doesn't seem to be a static archive available"
+			  echo "*** The link will probably fail, sorry"
 			else
 			  add="$dir/$old_library"
 			fi
@@ -5720,7 +6839,7 @@ func_mode_link ()
 		if test -n "$inst_prefix_dir"; then
 		  case $libdir in
 		    [\\/]*)
-		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      func_append add_dir " -L$inst_prefix_dir$libdir"
 		      ;;
 		  esac
 		fi
@@ -5742,7 +6861,7 @@ func_mode_link ()
 	    if test -n "$add_shlibpath"; then
 	      case :$compile_shlibpath: in
 	      *":$add_shlibpath:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
 	      esac
 	    fi
 	    if test "$linkmode" = prog; then
@@ -5756,13 +6875,13 @@ func_mode_link ()
 		 test "$hardcode_shlibpath_var" = yes; then
 		case :$finalize_shlibpath: in
 		*":$libdir:"*) ;;
-		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		*) func_append finalize_shlibpath "$libdir:" ;;
 		esac
 	      fi
 	    fi
 	  fi
 
-	  if test "$linkmode" = prog || test "$mode" = relink; then
+	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -5776,7 +6895,7 @@ func_mode_link ()
 	    elif test "$hardcode_shlibpath_var" = yes; then
 	      case :$finalize_shlibpath: in
 	      *":$libdir:"*) ;;
-	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      *) func_append finalize_shlibpath "$libdir:" ;;
 	      esac
 	      add="-l$name"
 	    elif test "$hardcode_automatic" = yes; then
@@ -5793,7 +6912,7 @@ func_mode_link ()
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
 		  [\\/]*)
-		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    func_append add_dir " -L$inst_prefix_dir$libdir"
 		    ;;
 		esac
 	      fi
@@ -5828,21 +6947,21 @@ func_mode_link ()
 
 	    # Just print a warning and add the library to dependency_libs so
 	    # that the program can be linked against the static library.
-	    $ECHO
+	    echo
 	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
-	    $ECHO "*** I have the capability to make that library automatically link in when"
-	    $ECHO "*** you link to this library.  But I can only do this if you have a"
-	    $ECHO "*** shared version of the library, which you do not appear to have."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
 	    if test "$module" = yes; then
-	      $ECHO "*** But as you try to build a module library, libtool will still create "
-	      $ECHO "*** a static module, that should work as long as the dlopening application"
-	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 	      if test -z "$global_symbol_pipe"; then
-		$ECHO
-		$ECHO "*** However, this would only work if libtool was able to extract symbol"
-		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		$ECHO "*** not find such a program.  So, this module is probably useless."
-		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
 	      fi
 	      if test "$build_old_libs" = no; then
 		build_libtool_libs=module
@@ -5870,27 +6989,33 @@ func_mode_link ()
 	           temp_xrpath=$func_stripname_result
 		   case " $xrpath " in
 		   *" $temp_xrpath "*) ;;
-		   *) xrpath="$xrpath $temp_xrpath";;
+		   *) func_append xrpath " $temp_xrpath";;
 		   esac;;
-	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      *) func_append temp_deplibs " $libdir";;
 	      esac
 	    done
 	    dependency_libs="$temp_deplibs"
 	  fi
 
-	  newlib_search_path="$newlib_search_path $absdir"
+	  func_append newlib_search_path " $absdir"
 	  # Link against this library
 	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 	  # ... and its dependency_libs
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
 	    newdependency_libs="$deplib $newdependency_libs"
-	    if $opt_duplicate_deps ; then
+	    case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $func_resolve_sysroot_result"
 	  done
 
 	  if test "$link_all_deplibs" != no; then
@@ -5900,8 +7025,10 @@ func_mode_link ()
 	      case $deplib in
 	      -L*) path="$deplib" ;;
 	      *.la)
+	        func_resolve_sysroot "$deplib"
+	        deplib=$func_resolve_sysroot_result
 	        func_dirname "$deplib" "" "."
-		dir="$func_dirname_result"
+		dir=$func_dirname_result
 		# We need an absolute path.
 		case $dir in
 		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
@@ -5928,8 +7055,8 @@ func_mode_link ()
                       if test -z "$darwin_install_name"; then
                           darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
                       fi
-		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
 		      path=
 		    fi
 		  fi
@@ -5962,7 +7089,7 @@ func_mode_link ()
 	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
 	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
 	else
-	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	fi
       fi
       dependency_libs="$newdependency_libs"
@@ -5979,7 +7106,7 @@ func_mode_link ()
 	  for dir in $newlib_search_path; do
 	    case "$lib_search_path " in
 	    *" $dir "*) ;;
-	    *) lib_search_path="$lib_search_path $dir" ;;
+	    *) func_append lib_search_path " $dir" ;;
 	    esac
 	  done
 	  newlib_search_path=
@@ -6037,10 +7164,10 @@ func_mode_link ()
 	    -L*)
 	      case " $tmp_libs " in
 	      *" $deplib "*) ;;
-	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      *) func_append tmp_libs " $deplib" ;;
 	      esac
 	      ;;
-	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    *) func_append tmp_libs " $deplib" ;;
 	    esac
 	  done
 	  eval $var=\"$tmp_libs\"
@@ -6056,7 +7183,7 @@ func_mode_link ()
 	  ;;
 	esac
 	if test -n "$i" ; then
-	  tmp_libs="$tmp_libs $i"
+	  func_append tmp_libs " $i"
 	fi
       done
       dependency_libs=$tmp_libs
@@ -6097,7 +7224,7 @@ func_mode_link ()
       # Now set the variables for building old libraries.
       build_libtool_libs=no
       oldlibs="$output"
-      objs="$objs$old_deplibs"
+      func_append objs "$old_deplibs"
       ;;
 
     lib)
@@ -6130,10 +7257,10 @@ func_mode_link ()
 	if test "$deplibs_check_method" != pass_all; then
 	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
 	else
-	  $ECHO
+	  echo
 	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
 	  $ECHO "*** objects $objs is not portable!"
-	  libobjs="$libobjs $objs"
+	  func_append libobjs " $objs"
 	fi
       fi
 
@@ -6198,7 +7325,7 @@ func_mode_link ()
 	    age="$number_minor"
 	    revision="$number_revision"
 	    ;;
-	  freebsd-aout|freebsd-elf|sunos)
+	  freebsd-aout|freebsd-elf|qnx|sunos)
 	    current="$number_major"
 	    revision="$number_minor"
 	    age="0"
@@ -6334,7 +7461,7 @@ func_mode_link ()
 	  done
 
 	  # Make executables depend on our current version.
-	  verstring="$verstring:${current}.0"
+	  func_append verstring ":${current}.0"
 	  ;;
 
 	qnx)
@@ -6402,10 +7529,10 @@ func_mode_link ()
       fi
 
       func_generate_dlsyms "$libname" "$libname" "yes"
-      libobjs="$libobjs $symfileobj"
+      func_append libobjs " $symfileobj"
       test "X$libobjs" = "X " && libobjs=
 
-      if test "$mode" != relink; then
+      if test "$opt_mode" != relink; then
 	# Remove our outputs, but don't remove object files since they
 	# may have been created when compiling PIC objects.
 	removelist=
@@ -6421,7 +7548,7 @@ func_mode_link ()
 		   continue
 		 fi
 	       fi
-	       removelist="$removelist $p"
+	       func_append removelist " $p"
 	       ;;
 	    *) ;;
 	  esac
@@ -6432,27 +7559,28 @@ func_mode_link ()
 
       # Now set the variables for building old libraries.
       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+	func_append oldlibs " $output_objdir/$libname.$libext"
 
 	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
       fi
 
       # Eliminate all temporary directories.
       #for path in $notinst_path; do
-      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
-      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
-      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
+      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
       #done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
 	temp_xrpath=
 	for libdir in $xrpath; do
-	  temp_xrpath="$temp_xrpath -R$libdir"
+	  func_replace_sysroot "$libdir"
+	  func_append temp_xrpath " -R$func_replace_sysroot_result"
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  *) func_append finalize_rpath " $libdir" ;;
 	  esac
 	done
 	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
@@ -6466,7 +7594,7 @@ func_mode_link ()
       for lib in $old_dlfiles; do
 	case " $dlprefiles $dlfiles " in
 	*" $lib "*) ;;
-	*) dlfiles="$dlfiles $lib" ;;
+	*) func_append dlfiles " $lib" ;;
 	esac
       done
 
@@ -6476,19 +7604,19 @@ func_mode_link ()
       for lib in $old_dlprefiles; do
 	case "$dlprefiles " in
 	*" $lib "*) ;;
-	*) dlprefiles="$dlprefiles $lib" ;;
+	*) func_append dlprefiles " $lib" ;;
 	esac
       done
 
       if test "$build_libtool_libs" = yes; then
 	if test -n "$rpath"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
 	    # these systems don't actually have a c library (as such)!
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C library is in the System framework
-	    deplibs="$deplibs System.ltframework"
+	    func_append deplibs " System.ltframework"
 	    ;;
 	  *-*-netbsd*)
 	    # Don't link with libc until the a.out ld.so is fixed.
@@ -6505,7 +7633,7 @@ func_mode_link ()
 	  *)
 	    # Add libc to deplibs on all other systems if necessary.
 	    if test "$build_libtool_need_lc" = "yes"; then
-	      deplibs="$deplibs -lc"
+	      func_append deplibs " -lc"
 	    fi
 	    ;;
 	  esac
@@ -6554,7 +7682,7 @@ EOF
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
-		    newdeplibs="$newdeplibs $i"
+		    func_append newdeplibs " $i"
 		    i=""
 		    ;;
 		  esac
@@ -6565,21 +7693,21 @@ EOF
 		  set dummy $deplib_matches; shift
 		  deplib_match=$1
 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    newdeplibs="$newdeplibs $i"
+		    func_append newdeplibs " $i"
 		  else
 		    droppeddeps=yes
-		    $ECHO
+		    echo
 		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		    $ECHO "*** I have the capability to make that library automatically link in when"
-		    $ECHO "*** you link to this library.  But I can only do this if you have a"
-		    $ECHO "*** shared version of the library, which I believe you do not have"
-		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
-		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which I believe you do not have"
+		    echo "*** because a test_compile did reveal that the linker did not use it for"
+		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
 		  fi
 		fi
 		;;
 	      *)
-		newdeplibs="$newdeplibs $i"
+		func_append newdeplibs " $i"
 		;;
 	      esac
 	    done
@@ -6597,7 +7725,7 @@ EOF
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
 		    *" $i "*)
-		      newdeplibs="$newdeplibs $i"
+		      func_append newdeplibs " $i"
 		      i=""
 		      ;;
 		    esac
@@ -6608,29 +7736,29 @@ EOF
 		    set dummy $deplib_matches; shift
 		    deplib_match=$1
 		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      newdeplibs="$newdeplibs $i"
+		      func_append newdeplibs " $i"
 		    else
 		      droppeddeps=yes
-		      $ECHO
+		      echo
 		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		      $ECHO "*** I have the capability to make that library automatically link in when"
-		      $ECHO "*** you link to this library.  But I can only do this if you have a"
-		      $ECHO "*** shared version of the library, which you do not appear to have"
-		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
-		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
+		      echo "*** I have the capability to make that library automatically link in when"
+		      echo "*** you link to this library.  But I can only do this if you have a"
+		      echo "*** shared version of the library, which you do not appear to have"
+		      echo "*** because a test_compile did reveal that the linker did not use this one"
+		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 		    fi
 		  fi
 		else
 		  droppeddeps=yes
-		  $ECHO
+		  echo
 		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $ECHO "*** make it link in!  You will probably need to install it or some"
-		  $ECHO "*** library that it depends on before this library will be fully"
-		  $ECHO "*** functional.  Installing it before continuing would be even better."
+		  echo "*** make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
 		fi
 		;;
 	      *)
-		newdeplibs="$newdeplibs $i"
+		func_append newdeplibs " $i"
 		;;
 	      esac
 	    done
@@ -6647,15 +7775,27 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
+		  func_append newdeplibs " $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
 	      fi
 	      if test -n "$a_deplib" ; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
+		if test -n "$file_magic_glob"; then
+		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+		else
+		  libnameglob=$libname
+		fi
+		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  if test "$want_nocaseglob" = yes; then
+		    shopt -s nocaseglob
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		    $nocaseglob
+		  else
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		  fi
 		  for potent_lib in $potential_libs; do
 		      # Follow soft links.
 		      if ls -lLd "$potent_lib" 2>/dev/null |
@@ -6672,13 +7812,13 @@ EOF
 			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 			case $potliblink in
 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
 			esac
 		      done
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 			 $SED -e 10q |
 			 $EGREP "$file_magic_regex" > /dev/null; then
-			newdeplibs="$newdeplibs $a_deplib"
+			func_append newdeplibs " $a_deplib"
 			a_deplib=""
 			break 2
 		      fi
@@ -6687,12 +7827,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		$ECHO
+		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
 		else
@@ -6703,7 +7843,7 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
+	      func_append newdeplibs " $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
@@ -6719,7 +7859,7 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
+		  func_append newdeplibs " $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
@@ -6730,9 +7870,9 @@ EOF
 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
 		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
 		       $EGREP "$match_pattern_regex" > /dev/null; then
-		      newdeplibs="$newdeplibs $a_deplib"
+		      func_append newdeplibs " $a_deplib"
 		      a_deplib=""
 		      break 2
 		    fi
@@ -6741,12 +7881,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		$ECHO
+		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
 		else
@@ -6757,32 +7897,32 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
+	      func_append newdeplibs " $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
 	  ;;
 	none | unknown | *)
 	  newdeplibs=""
-	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
-	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
+	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
 	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 	    for i in $predeps $postdeps ; do
 	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
 	    done
 	  fi
-	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
-	     $GREP . >/dev/null; then
-	    $ECHO
+	  case $tmp_deplibs in
+	  *[!\	\ ]*)
+	    echo
 	    if test "X$deplibs_check_method" = "Xnone"; then
-	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
 	    else
-	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
 	    fi
-	    $ECHO "*** All declared inter-library dependencies are being dropped."
+	    echo "*** All declared inter-library dependencies are being dropped."
 	    droppeddeps=yes
-	  fi
+	    ;;
+	  esac
 	  ;;
 	esac
 	versuffix=$versuffix_save
@@ -6794,23 +7934,23 @@ EOF
 	case $host in
 	*-*-rhapsody* | *-*-darwin1.[012])
 	  # On Rhapsody replace the C library with the System framework
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
 	  ;;
 	esac
 
 	if test "$droppeddeps" = yes; then
 	  if test "$module" = yes; then
-	    $ECHO
-	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
 	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-	    $ECHO "*** a static module, that should work as long as the dlopening"
-	    $ECHO "*** application is linked with the -dlopen flag."
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
 	    if test -z "$global_symbol_pipe"; then
-	      $ECHO
-	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
-	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      $ECHO "*** not find such a program.  So, this module is probably useless."
-	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
 	    fi
 	    if test "$build_old_libs" = no; then
 	      oldlibs="$output_objdir/$libname.$libext"
@@ -6820,16 +7960,16 @@ EOF
 	      build_libtool_libs=no
 	    fi
 	  else
-	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
-	    $ECHO "*** automatically added whenever a program is linked with this library"
-	    $ECHO "*** or is declared to -dlopen it."
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
 
 	    if test "$allow_undefined" = no; then
-	      $ECHO
-	      $ECHO "*** Since this library must not contain undefined symbols,"
-	      $ECHO "*** because either the platform does not support them or"
-	      $ECHO "*** it was explicitly requested with -no-undefined,"
-	      $ECHO "*** libtool will only create a static version of it."
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
 	      if test "$build_old_libs" = no; then
 		oldlibs="$output_objdir/$libname.$libext"
 		build_libtool_libs=module
@@ -6846,9 +7986,9 @@ EOF
       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
       case $host in
 	*-*-darwin*)
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	  ;;
       esac
 
@@ -6861,7 +8001,7 @@ EOF
 	*)
 	  case " $deplibs " in
 	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
+	    func_append new_libs " -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -6871,10 +8011,10 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
+	  *) func_append new_libs " $deplib" ;;
 	  esac
 	  ;;
-	*) new_libs="$new_libs $deplib" ;;
+	*) func_append new_libs " $deplib" ;;
 	esac
       done
       deplibs="$new_libs"
@@ -6891,10 +8031,12 @@ EOF
 	  hardcode_libdirs=
 	  dep_rpath=
 	  rpath="$finalize_rpath"
-	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
 	  for libdir in $rpath; do
 	    if test -n "$hardcode_libdir_flag_spec"; then
 	      if test -n "$hardcode_libdir_separator"; then
+		func_replace_sysroot "$libdir"
+		libdir=$func_replace_sysroot_result
 		if test -z "$hardcode_libdirs"; then
 		  hardcode_libdirs="$libdir"
 		else
@@ -6903,18 +8045,18 @@ EOF
 		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		    ;;
 		  *)
-		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		    ;;
 		  esac
 		fi
 	      else
 		eval flag=\"$hardcode_libdir_flag_spec\"
-		dep_rpath="$dep_rpath $flag"
+		func_append dep_rpath " $flag"
 	      fi
 	    elif test -n "$runpath_var"; then
 	      case "$perm_rpath " in
 	      *" $libdir "*) ;;
-	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      *) func_apped perm_rpath " $libdir" ;;
 	      esac
 	    fi
 	  done
@@ -6932,7 +8074,7 @@ EOF
 	    # We should set the runpath_var.
 	    rpath=
 	    for dir in $perm_rpath; do
-	      rpath="$rpath$dir:"
+	      func_append rpath "$dir:"
 	    done
 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 	  fi
@@ -6940,7 +8082,7 @@ EOF
 	fi
 
 	shlibpath="$finalize_shlibpath"
-	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 	if test -n "$shlibpath"; then
 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 	fi
@@ -6966,18 +8108,18 @@ EOF
 	linknames=
 	for link
 	do
-	  linknames="$linknames $link"
+	  func_append linknames " $link"
 	done
 
 	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	test "X$libobjs" = "X " && libobjs=
 
 	delfiles=
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
 	  export_symbols="$output_objdir/$libname.uexp"
-	  delfiles="$delfiles $export_symbols"
+	  func_append delfiles " $export_symbols"
 	fi
 
 	orig_export_symbols=
@@ -7008,13 +8150,45 @@ EOF
 	    $opt_dry_run || $RM $export_symbols
 	    cmds=$export_symbols_cmds
 	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
+	    for cmd1 in $cmds; do
 	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
-	      func_len " $cmd"
-	      len=$func_len_result
-	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	      # Take the normal branch if the nm_file_list_spec branch
+	      # doesn't work or if tool conversion is not needed.
+	      case $nm_file_list_spec~$to_tool_file_cmd in
+		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+		  try_normal_branch=yes
+		  eval cmd=\"$cmd1\"
+		  func_len " $cmd"
+		  len=$func_len_result
+		  ;;
+		*)
+		  try_normal_branch=no
+		  ;;
+	      esac
+	      if test "$try_normal_branch" = yes \
+		 && { test "$len" -lt "$max_cmd_len" \
+		      || test "$max_cmd_len" -le -1; }
+	      then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      elif test -n "$nm_file_list_spec"; then
+		func_basename "$output"
+		output_la=$func_basename_result
+		save_libobjs=$libobjs
+		save_output=$output
+		output=${output_objdir}/${output_la}.nm
+		func_to_tool_file "$output"
+		libobjs=$nm_file_list_spec$func_to_tool_file_result
+		func_append delfiles " $output"
+		func_verbose "creating $NM input file list: $output"
+		for obj in $save_libobjs; do
+		  func_to_tool_file "$obj"
+		  $ECHO "$func_to_tool_file_result"
+		done > "$output"
+		eval cmd=\"$cmd1\"
 		func_show_eval "$cmd" 'exit $?'
+		output=$save_output
+		libobjs=$save_libobjs
 		skipped_export=false
 	      else
 		# The command line is too long to execute in one step.
@@ -7036,7 +8210,7 @@ EOF
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  tmp_export_symbols="$export_symbols"
 	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	fi
 
 	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
@@ -7048,7 +8222,7 @@ EOF
 	  # global variables. join(1) would be nice here, but unfortunately
 	  # isn't a blessed tool.
 	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 	  export_symbols=$output_objdir/$libname.def
 	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	fi
@@ -7058,7 +8232,7 @@ EOF
 	  case " $convenience " in
 	  *" $test_deplib "*) ;;
 	  *)
-	    tmp_deplibs="$tmp_deplibs $test_deplib"
+	    func_append tmp_deplibs " $test_deplib"
 	    ;;
 	  esac
 	done
@@ -7078,21 +8252,21 @@ EOF
 	    test "X$libobjs" = "X " && libobjs=
 	  else
 	    gentop="$output_objdir/${outputname}x"
-	    generated="$generated $gentop"
+	    func_append generated " $gentop"
 
 	    func_extract_archives $gentop $convenience
-	    libobjs="$libobjs $func_extract_archives_result"
+	    func_append libobjs " $func_extract_archives_result"
 	    test "X$libobjs" = "X " && libobjs=
 	  fi
 	fi
 
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
-	  linker_flags="$linker_flags $flag"
+	  func_append linker_flags " $flag"
 	fi
 
 	# Make a backup of the uninstalled library when relinking
-	if test "$mode" = relink; then
+	if test "$opt_mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
 	fi
 
@@ -7137,7 +8311,8 @@ EOF
 	    save_libobjs=$libobjs
 	  fi
 	  save_output=$output
-	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+	  func_basename "$output"
+	  output_la=$func_basename_result
 
 	  # Clear the reloadable object creation command queue and
 	  # initialize k to one.
@@ -7150,13 +8325,16 @@ EOF
 	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
 	    output=${output_objdir}/${output_la}.lnkscript
 	    func_verbose "creating GNU ld script: $output"
-	    $ECHO 'INPUT (' > $output
+	    echo 'INPUT (' > $output
 	    for obj in $save_libobjs
 	    do
-	      $ECHO "$obj" >> $output
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
 	    done
-	    $ECHO ')' >> $output
-	    delfiles="$delfiles $output"
+	    echo ')' >> $output
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$func_to_tool_file_result
 	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
 	    output=${output_objdir}/${output_la}.lnk
 	    func_verbose "creating linker input file list: $output"
@@ -7170,10 +8348,12 @@ EOF
 	    fi
 	    for obj
 	    do
-	      $ECHO "$obj" >> $output
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
 	    done
-	    delfiles="$delfiles $output"
-	    output=$firstobj\"$file_list_spec$output\"
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
 	  else
 	    if test -n "$save_libobjs"; then
 	      func_verbose "creating reloadable object files..."
@@ -7197,17 +8377,19 @@ EOF
 		  # command to the queue.
 		  if test "$k" -eq 1 ; then
 		    # The first file doesn't have a previous command to add.
-		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+		    reload_objs=$objlist
+		    eval concat_cmds=\"$reload_cmds\"
 		  else
 		    # All subsequent reloadable object files will link in
 		    # the last one created.
-		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
+		    reload_objs="$objlist $last_robj"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
 		  fi
 		  last_robj=$output_objdir/$output_la-${k}.$objext
 		  func_arith $k + 1
 		  k=$func_arith_result
 		  output=$output_objdir/$output_la-${k}.$objext
-		  objlist=$obj
+		  objlist=" $obj"
 		  func_len " $last_robj"
 		  func_arith $len0 + $func_len_result
 		  len=$func_arith_result
@@ -7217,11 +8399,12 @@ EOF
 	      # reloadable object file.  All subsequent reloadable object
 	      # files will link in the last one created.
 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+	      reload_objs="$objlist $last_robj"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
 	      if test -n "$last_robj"; then
 	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
 	      fi
-	      delfiles="$delfiles $output"
+	      func_append delfiles " $output"
 
 	    else
 	      output=
@@ -7255,7 +8438,7 @@ EOF
 		lt_exit=$?
 
 		# Restore the uninstalled library and exit
-		if test "$mode" = relink; then
+		if test "$opt_mode" = relink; then
 		  ( cd "$output_objdir" && \
 		    $RM "${realname}T" && \
 		    $MV "${realname}U" "$realname" )
@@ -7276,7 +8459,7 @@ EOF
 	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	      tmp_export_symbols="$export_symbols"
 	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	    fi
 
 	    if test -n "$orig_export_symbols"; then
@@ -7288,7 +8471,7 @@ EOF
 	      # global variables. join(1) would be nice here, but unfortunately
 	      # isn't a blessed tool.
 	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 	      export_symbols=$output_objdir/$libname.def
 	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	    fi
@@ -7329,10 +8512,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  libobjs="$libobjs $func_extract_archives_result"
+	  func_append libobjs " $func_extract_archives_result"
 	  test "X$libobjs" = "X " && libobjs=
 	fi
 
@@ -7348,7 +8531,7 @@ EOF
 	    lt_exit=$?
 
 	    # Restore the uninstalled library and exit
-	    if test "$mode" = relink; then
+	    if test "$opt_mode" = relink; then
 	      ( cd "$output_objdir" && \
 	        $RM "${realname}T" && \
 		$MV "${realname}U" "$realname" )
@@ -7360,7 +8543,7 @@ EOF
 	IFS="$save_ifs"
 
 	# Restore the uninstalled library and exit
-	if test "$mode" = relink; then
+	if test "$opt_mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
 	  if test -n "$convenience"; then
@@ -7441,18 +8624,21 @@ EOF
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
 	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $convenience
 	  reload_conv_objs="$reload_objs $func_extract_archives_result"
 	fi
       fi
 
+      # If we're not building shared, we need to use non_pic_objs
+      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
       output="$obj"
       func_execute_cmds "$reload_cmds" 'exit $?'
@@ -7512,8 +8698,8 @@ EOF
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
 	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
 	;;
       esac
 
@@ -7524,14 +8710,14 @@ EOF
 	if test "$tagname" = CXX ; then
 	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
 	    10.[0123])
-	      compile_command="$compile_command ${wl}-bind_at_load"
-	      finalize_command="$finalize_command ${wl}-bind_at_load"
+	      func_append compile_command " ${wl}-bind_at_load"
+	      func_append finalize_command " ${wl}-bind_at_load"
 	    ;;
 	  esac
 	fi
 	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	;;
       esac
 
@@ -7545,7 +8731,7 @@ EOF
 	*)
 	  case " $compile_deplibs " in
 	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
+	    func_append new_libs " -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -7555,17 +8741,17 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
+	  *) func_append new_libs " $deplib" ;;
 	  esac
 	  ;;
-	*) new_libs="$new_libs $deplib" ;;
+	*) func_append new_libs " $deplib" ;;
 	esac
       done
       compile_deplibs="$new_libs"
 
 
-      compile_command="$compile_command $compile_deplibs"
-      finalize_command="$finalize_command $finalize_deplibs"
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
 
       if test -n "$rpath$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -7573,7 +8759,7 @@ EOF
 	  # This is the magic to use -rpath.
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  *) func_append finalize_rpath " $libdir" ;;
 	  esac
 	done
       fi
@@ -7592,18 +8778,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
+	    func_append rpath " $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  *) func_append perm_rpath " $libdir" ;;
 	  esac
 	fi
 	case $host in
@@ -7612,12 +8798,12 @@ EOF
 	  case :$dllsearchpath: in
 	  *":$libdir:"*) ;;
 	  ::) dllsearchpath=$libdir;;
-	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  *) func_append dllsearchpath ":$libdir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  *) func_append dllsearchpath ":$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -7643,18 +8829,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
+	    func_append rpath " $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$finalize_perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  *) func_append finalize_perm_rpath " $libdir" ;;
 	  esac
 	fi
       done
@@ -7668,8 +8854,8 @@ EOF
 
       if test -n "$libobjs" && test "$build_old_libs" = yes; then
 	# Transform all the library objects into standard objects.
-	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
       fi
 
       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
@@ -7681,15 +8867,15 @@ EOF
 
       wrappers_required=yes
       case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *cygwin* | *mingw* )
         if test "$build_libtool_libs" != yes; then
           wrappers_required=no
         fi
         ;;
-      *cegcc)
-        # Disable wrappers for cegcc, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
       *)
         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
           wrappers_required=no
@@ -7698,13 +8884,19 @@ EOF
       esac
       if test "$wrappers_required" = no; then
 	# Replace the output file specification.
-	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
 	exit_status=0
 	func_show_eval "$link_command" 'exit_status=$?'
 
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
 	# Delete the generated files.
 	if test -f "$output_objdir/${outputname}S.${objext}"; then
 	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
@@ -7727,7 +8919,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $perm_rpath; do
-	    rpath="$rpath$dir:"
+	    func_append rpath "$dir:"
 	  done
 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -7735,7 +8927,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $finalize_perm_rpath; do
-	    rpath="$rpath$dir:"
+	    func_append rpath "$dir:"
 	  done
 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -7745,11 +8937,18 @@ EOF
 	# We don't need to create a wrapper script.
 	link_command="$compile_var$compile_command$compile_rpath"
 	# Replace the output file specification.
-	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
 	# Delete the old output file.
 	$opt_dry_run || $RM $output
 	# Link the executable and exit
 	func_show_eval "$link_command" 'exit $?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
 	exit $EXIT_SUCCESS
       fi
 
@@ -7764,7 +8963,7 @@ EOF
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
 	  else
 	    # fast_install is set to needless
 	    relink_command=
@@ -7776,13 +8975,19 @@ EOF
       fi
 
       # Replace the output file specification.
-      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
       # Delete the old output files.
       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
       func_show_eval "$link_command" 'exit $?'
 
+      if test -n "$postlink_cmds"; then
+	func_to_tool_file "$output_objdir/$outputname"
+	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
       # Now create the wrapper script.
       func_verbose "creating $output"
 
@@ -7800,18 +9005,7 @@ EOF
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Quote $ECHO for shipping.
-      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
-	case $progpath in
-	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-	esac
-	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
+	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       fi
 
       # Only actually do things if not in dry run mode.
@@ -7891,7 +9085,7 @@ EOF
 	else
 	  oldobjs="$old_deplibs $non_pic_objects"
 	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    oldobjs="$oldobjs $symfileobj"
+	    func_append oldobjs " $symfileobj"
 	  fi
 	fi
 	addlibs="$old_convenience"
@@ -7899,10 +9093,10 @@ EOF
 
       if test -n "$addlibs"; then
 	gentop="$output_objdir/${outputname}x"
-	generated="$generated $gentop"
+	func_append generated " $gentop"
 
 	func_extract_archives $gentop $addlibs
-	oldobjs="$oldobjs $func_extract_archives_result"
+	func_append oldobjs " $func_extract_archives_result"
       fi
 
       # Do each command in the archive commands.
@@ -7913,10 +9107,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  oldobjs="$oldobjs $func_extract_archives_result"
+	  func_append oldobjs " $func_extract_archives_result"
 	fi
 
 	# POSIX demands no paths to be encoded in archives.  We have
@@ -7932,9 +9126,9 @@ EOF
 	    done | sort | sort -uc >/dev/null 2>&1); then
 	  :
 	else
-	  $ECHO "copying selected object files to avoid basename conflicts..."
+	  echo "copying selected object files to avoid basename conflicts..."
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 	  func_mkdir_p "$gentop"
 	  save_oldobjs=$oldobjs
 	  oldobjs=
@@ -7958,9 +9152,9 @@ EOF
 		esac
 	      done
 	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      oldobjs="$oldobjs $gentop/$newobj"
+	      func_append oldobjs " $gentop/$newobj"
 	      ;;
-	    *) oldobjs="$oldobjs $obj" ;;
+	    *) func_append oldobjs " $obj" ;;
 	    esac
 	  done
 	fi
@@ -7970,6 +9164,16 @@ EOF
 	len=$func_len_result
 	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 	  cmds=$old_archive_cmds
+	elif test -n "$archiver_list_spec"; then
+	  func_verbose "using command file archive linking..."
+	  for obj in $oldobjs
+	  do
+	    func_to_tool_file "$obj"
+	    $ECHO "$func_to_tool_file_result"
+	  done > $output_objdir/$libname.libcmd
+	  func_to_tool_file "$output_objdir/$libname.libcmd"
+	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+	  cmds=$old_archive_cmds
 	else
 	  # the command line is too long to link in one step, link in parts
 	  func_verbose "using piecewise archive linking..."
@@ -8043,7 +9247,7 @@ EOF
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -8066,9 +9270,19 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$deplib' is not a valid libtool archive"
-		newdependency_libs="$newdependency_libs $libdir/$name"
+		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      -L*)
+		func_stripname -L '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -L$func_replace_sysroot_result"
+		;;
+	      -R*)
+		func_stripname -R '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -R$func_replace_sysroot_result"
 		;;
-	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      *) func_append newdependency_libs " $deplib" ;;
 	      esac
 	    done
 	    dependency_libs="$newdependency_libs"
@@ -8082,9 +9296,9 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlfiles="$newdlfiles $libdir/$name"
+		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
-	      *) newdlfiles="$newdlfiles $lib" ;;
+	      *) func_append newdlfiles " $lib" ;;
 	      esac
 	    done
 	    dlfiles="$newdlfiles"
@@ -8101,7 +9315,7 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlprefiles="$newdlprefiles $libdir/$name"
+		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
 	      esac
 	    done
@@ -8113,7 +9327,7 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      newdlfiles="$newdlfiles $abs"
+	      func_append newdlfiles " $abs"
 	    done
 	    dlfiles="$newdlfiles"
 	    newdlprefiles=
@@ -8122,15 +9336,33 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      newdlprefiles="$newdlprefiles $abs"
+	      func_append newdlprefiles " $abs"
 	    done
 	    dlprefiles="$newdlprefiles"
 	  fi
 	  $RM $output
 	  # place dlname in correct position for cygwin
+	  # In fact, it would be nice if we could use this code for all target
+	  # systems that can't hard-code library paths into their executables
+	  # and that have no shared library path variable independent of PATH,
+	  # but it turns out we can't easily determine that from inspecting
+	  # libtool variables, so we have to hard-code the OSs to which it
+	  # applies here; at the moment, that means platforms that use the PE
+	  # object format with DLL files.  See the long comment at the top of
+	  # tests/bindir.at for full details.
 	  tdlname=$dlname
 	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+	      # If a -bindir argument was supplied, place the dll there.
+	      if test "x$bindir" != x ;
+	      then
+		func_relative_path "$install_libdir" "$bindir"
+		tdlname=$func_relative_path_result$dlname
+	      else
+		# Otherwise fall back on heuristic.
+		tdlname=../bin/$dlname
+	      fi
+	      ;;
 	  esac
 	  $ECHO > $output "\
 # $outputname - a libtool library file
@@ -8189,7 +9421,7 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
-{ test "$mode" = link || test "$mode" = relink; } &&
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
     func_mode_link ${1+"$@"}
 
 
@@ -8209,9 +9441,9 @@ func_mode_uninstall ()
     for arg
     do
       case $arg in
-      -f) RM="$RM $arg"; rmforce=yes ;;
-      -*) RM="$RM $arg" ;;
-      *) files="$files $arg" ;;
+      -f) func_append RM " $arg"; rmforce=yes ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
       esac
     done
 
@@ -8220,24 +9452,23 @@ func_mode_uninstall ()
 
     rmdirs=
 
-    origobjdir="$objdir"
     for file in $files; do
       func_dirname "$file" "" "."
       dir="$func_dirname_result"
       if test "X$dir" = X.; then
-	objdir="$origobjdir"
+	odir="$objdir"
       else
-	objdir="$dir/$origobjdir"
+	odir="$dir/$objdir"
       fi
       func_basename "$file"
       name="$func_basename_result"
-      test "$mode" = uninstall && objdir="$dir"
+      test "$opt_mode" = uninstall && odir="$dir"
 
-      # Remember objdir for removal later, being careful to avoid duplicates
-      if test "$mode" = clean; then
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test "$opt_mode" = clean; then
 	case " $rmdirs " in
-	  *" $objdir "*) ;;
-	  *) rmdirs="$rmdirs $objdir" ;;
+	  *" $odir "*) ;;
+	  *) func_append rmdirs " $odir" ;;
 	esac
       fi
 
@@ -8263,18 +9494,17 @@ func_mode_uninstall ()
 
 	  # Delete the libtool libraries and symlinks.
 	  for n in $library_names; do
-	    rmfiles="$rmfiles $objdir/$n"
+	    func_append rmfiles " $odir/$n"
 	  done
-	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
 
-	  case "$mode" in
+	  case "$opt_mode" in
 	  clean)
-	    case "  $library_names " in
-	    # "  " in the beginning catches empty $dlname
+	    case " $library_names " in
 	    *" $dlname "*) ;;
-	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
 	    esac
-	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
 	    ;;
 	  uninstall)
 	    if test -n "$library_names"; then
@@ -8302,19 +9532,19 @@ func_mode_uninstall ()
 	  # Add PIC object to the list of files to remove.
 	  if test -n "$pic_object" &&
 	     test "$pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$pic_object"
+	    func_append rmfiles " $dir/$pic_object"
 	  fi
 
 	  # Add non-PIC object to the list of files to remove.
 	  if test -n "$non_pic_object" &&
 	     test "$non_pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$non_pic_object"
+	    func_append rmfiles " $dir/$non_pic_object"
 	  fi
 	fi
 	;;
 
       *)
-	if test "$mode" = clean ; then
+	if test "$opt_mode" = clean ; then
 	  noexename=$name
 	  case $file in
 	  *.exe)
@@ -8324,7 +9554,7 @@ func_mode_uninstall ()
 	    noexename=$func_stripname_result
 	    # $file with .exe has already been added to rmfiles,
 	    # add $file without .exe
-	    rmfiles="$rmfiles $file"
+	    func_append rmfiles " $file"
 	    ;;
 	  esac
 	  # Do a test to see if this is a libtool program.
@@ -8333,7 +9563,7 @@ func_mode_uninstall ()
 	      func_ltwrapper_scriptname "$file"
 	      relink_command=
 	      func_source $func_ltwrapper_scriptname_result
-	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+	      func_append rmfiles " $func_ltwrapper_scriptname_result"
 	    else
 	      relink_command=
 	      func_source $dir/$noexename
@@ -8341,12 +9571,12 @@ func_mode_uninstall ()
 
 	    # note $name still contains .exe if it was in $file originally
 	    # as does the version of $file that was added into $rmfiles
-	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
 	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      rmfiles="$rmfiles $objdir/lt-$name"
+	      func_append rmfiles " $odir/lt-$name"
 	    fi
 	    if test "X$noexename" != "X$name" ; then
-	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	      func_append rmfiles " $odir/lt-${noexename}.c"
 	    fi
 	  fi
 	fi
@@ -8354,7 +9584,6 @@ func_mode_uninstall ()
       esac
       func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
-    objdir="$origobjdir"
 
     # Try to remove the ${objdir}s in the directories where we deleted files
     for dir in $rmdirs; do
@@ -8366,16 +9595,16 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
-{ test "$mode" = uninstall || test "$mode" = clean; } &&
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
     func_mode_uninstall ${1+"$@"}
 
-test -z "$mode" && {
+test -z "$opt_mode" && {
   help="$generic_help"
   func_fatal_help "you must specify a MODE"
 }
 
 test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$mode'"
+  func_fatal_help "invalid operation mode \`$opt_mode'"
 
 if test -n "$exec_cmd"; then
   eval exec "$exec_cmd"
diff --git a/libass/m4/libtool.m4 b/libass/m4/libtool.m4
index a3fee53..8ff3c76 100644
--- a/libass/m4/libtool.m4
+++ b/libass/m4/libtool.m4
@@ -1,7 +1,8 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -10,7 +11,8 @@
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -37,7 +39,7 @@ m4_define([_LT_COPYING], [dnl
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ])
 
-# serial 56 LT_INIT
+# serial 57 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -66,6 +68,7 @@ esac
 # ------------------
 AC_DEFUN([LT_INIT],
 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
 AC_BEFORE([$0], [LTDL_INIT])dnl
@@ -82,6 +85,8 @@ AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
 dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
@@ -118,7 +123,7 @@ m4_defun([_LT_CC_BASENAME],
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 ])
 
 
@@ -138,6 +143,9 @@ m4_defun([_LT_FILEUTILS_DEFAULTS],
 m4_defun([_LT_SETUP],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -160,10 +168,13 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
 dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
 m4_require([_LT_CMD_RELOAD])dnl
 m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
 
 _LT_CONFIG_LIBTOOL_INIT([
 # See if we are running on zsh, and set the options which allow our
@@ -179,7 +190,6 @@ fi
 _LT_CHECK_OBJDIR
 
 m4_require([_LT_TAG_COMPILER])dnl
-_LT_PROG_ECHO_BACKSLASH
 
 case $host_os in
 aix3*)
@@ -193,23 +203,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -250,6 +243,28 @@ _LT_CONFIG_COMMANDS
 ])# _LT_SETUP
 
 
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
 # _LT_PROG_LTMAIN
 # ---------------
 # Note that this code is called both from `configure', and `config.status'
@@ -408,7 +423,7 @@ m4_define([_lt_decl_all_varnames],
 # declaration there will have the same value as in `configure'.  VARNAME
 # must have a single quote delimited value for this to work.
 m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
 
 
 # _LT_CONFIG_STATUS_DECLARATIONS
@@ -418,7 +433,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE],
 # embedded single quotes properly.  In configure, this macro expands
 # each variable declared with _LT_DECL (and _LT_TAGDECL) into:
 #
-#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
     [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
@@ -517,12 +532,20 @@ LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -533,9 +556,9 @@ done
 # Double-quote double-evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -543,16 +566,38 @@ for var in lt_decl_all_varnames([[ \
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\[$]0 --fallback-echo"')dnl "
-  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
-  ;;
-esac
-
 _LT_OUTPUT_LIBTOOL_INIT
 ])
 
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
 # ---------
@@ -562,20 +607,11 @@ _LT_OUTPUT_LIBTOOL_INIT
 AC_DEFUN([LT_OUTPUT],
 [: ${CONFIG_LT=./config.lt}
 AC_MSG_NOTICE([creating $CONFIG_LT])
-cat >"$CONFIG_LT" <<_LTEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate a libtool stub with the current configuration.
-
-lt_cl_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_LTEOF
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
 
 cat >>"$CONFIG_LT" <<\_LTEOF
-AS_SHELL_SANITIZE
-_AS_PREPARE
-
-exec AS_MESSAGE_FD>&1
+lt_cl_silent=false
 exec AS_MESSAGE_LOG_FD>>config.log
 {
   echo
@@ -601,7 +637,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -646,15 +682,13 @@ chmod +x "$CONFIG_LT"
 # appending to config.log, which fails on DOS, as config.log is still kept
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
-if test "$no_create" != yes; then
-  lt_cl_success=:
-  test "$silent" = yes &&
-    lt_config_lt_args="$lt_config_lt_args --quiet"
-  exec AS_MESSAGE_LOG_FD>/dev/null
-  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-  exec AS_MESSAGE_LOG_FD>>config.log
-  $lt_cl_success || AS_EXIT(1)
-fi
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
 ])# LT_OUTPUT
 
 
@@ -717,15 +751,12 @@ _LT_EOF
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
 
-  _LT_PROG_XSI_SHELLFNS
+  _LT_PROG_REPLACE_SHELLFNS
 
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 ],
@@ -831,11 +862,13 @@ AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
 AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
 AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
 AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
 dnl AC_DEFUN([AC_LIBTOOL_F77], [])
 dnl AC_DEFUN([AC_LIBTOOL_FC], [])
 dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
 
 
 # _LT_TAG_COMPILER
@@ -940,6 +973,31 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	[lt_cv_ld_exported_symbols_list=no])
 	LDFLAGS="$save_LDFLAGS"
     ])
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
     case $host_os in
     rhapsody* | darwin1.[[012]])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -967,7 +1025,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -987,7 +1045,11 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -995,7 +1057,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -1011,203 +1073,142 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   fi
 ])
 
-# _LT_SYS_MODULE_PATH_AIX
-# -----------------------
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
 # Links a minimal program and checks the executable
 # for the system default hardcoded library path. In most cases,
 # this is /usr/lib:/lib, but when the MPI compilers are used
 # the location of the communication and MPI libs are included too.
 # If we don't find anything, use the default library path according
 # to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
 m4_defun([_LT_SYS_MODULE_PATH_AIX],
 [m4_require([_LT_DECL_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
 ])# _LT_SYS_MODULE_PATH_AIX
 
 
 # _LT_SHELL_INIT(ARG)
 # -------------------
 m4_define([_LT_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
-	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
-	 [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_SHELL_INIT
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
 
 
 # _LT_PROG_ECHO_BACKSLASH
 # -----------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
 m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[_LT_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X[$]1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
 else
-  # Restart under the correct shell.
-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-[$]*
-_LT_EOF
-  exit 0
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
 fi
 
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
 
-	  if test "$prev" != 'sed 50q "[$]0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
 
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
 
-AC_SUBST(lt_ECHO)
-])
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1],
-    [An echo program that does not interpret backslashes])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
 ])# _LT_PROG_ECHO_BACKSLASH
 
 
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
 # _LT_ENABLE_LOCK
 # ---------------
 m4_defun([_LT_ENABLE_LOCK],
@@ -1236,7 +1237,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
@@ -1354,14 +1355,47 @@ need_locks="$enable_libtool_lock"
 ])# _LT_ENABLE_LOCK
 
 
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
 # _LT_CMD_OLD_ARCHIVE
 # -------------------
 m4_defun([_LT_CMD_OLD_ARCHIVE],
-[AC_CHECK_TOOL(AR, ar, false)
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1])
+[_LT_PROG_AR
 
 AC_CHECK_TOOL(STRIP, strip, :)
 test -z "$STRIP" && STRIP=:
@@ -1388,10 +1422,19 @@ if test -n "$RANLIB"; then
   esac
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
 _LT_DECL([], [old_postinstall_cmds], [2])
 _LT_DECL([], [old_postuninstall_cmds], [2])
 _LT_TAGDECL([], [old_archive_cmds], [2],
     [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
 ])# _LT_CMD_OLD_ARCHIVE
 
 
@@ -1416,15 +1459,15 @@ AC_CACHE_CHECK([$1], [$2],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        $2=yes
@@ -1464,7 +1507,7 @@ AC_CACHE_CHECK([$1], [$2],
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
@@ -1527,6 +1570,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -1591,8 +1639,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -1643,7 +1691,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-[#line __oline__ "configure"
+[#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -1684,7 +1732,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -1693,7 +1747,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
@@ -1869,16 +1927,16 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
@@ -2037,6 +2095,7 @@ m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
 	[], [
@@ -2045,16 +2104,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -2067,7 +2133,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -2087,7 +2153,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[[lt_foo]]++; }
   if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi])
@@ -2175,7 +2247,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -2206,8 +2278,9 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -2228,36 +2301,83 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -2341,6 +2461,20 @@ gnu*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -2386,8 +2520,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[[3-9]]*)
@@ -2454,16 +2590,21 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-       [shlibpath_overrides_runpath=yes])])
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -2472,7 +2613,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -2717,6 +2858,8 @@ _LT_DECL([], [library_names_spec], [1],
     The last name is the one that the linker finds with -lNAME]])
 _LT_DECL([], [soname_spec], [1],
     [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
 _LT_DECL([], [postinstall_cmds], [2],
     [Command to use after installation of a shared archive])
 _LT_DECL([], [postuninstall_cmds], [2],
@@ -2829,6 +2972,7 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
@@ -2950,6 +3094,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -2958,8 +3107,8 @@ case $host_os in
     fi
     ;;
 esac
-_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_DECL([], [reload_cmds], [2])dnl
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
 ])# _LT_CMD_RELOAD
 
 
@@ -3011,16 +3160,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -3050,6 +3201,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -3058,11 +3213,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -3162,6 +3317,21 @@ tpf*)
   ;;
 esac
 ])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -3169,7 +3339,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 _LT_DECL([], [deplibs_check_method], [1],
     [Method to check whether dependent libraries are shared objects])
 _LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method == "file_magic"])
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
 ])# _LT_CHECK_MAGIC_METHOD
 
 
@@ -3226,7 +3400,19 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   AC_SUBST([DUMPBIN])
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -3239,13 +3425,13 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
   [lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
   cat conftest.out >&AS_MESSAGE_LOG_FD
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -3260,6 +3446,67 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AM_PROG_NM], [])
 dnl AC_DEFUN([AC_PROG_NM], [])
 
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
 
 # LT_LIB_M
 # --------
@@ -3268,7 +3515,7 @@ AC_DEFUN([LT_LIB_M],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
@@ -3296,7 +3543,12 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
 if test "$GCC" = yes; then
-  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
 
   _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
     lt_cv_prog_compiler_rtti_exceptions,
@@ -3313,6 +3565,7 @@ _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
 AC_REQUIRE([LT_PATH_LD])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -3380,8 +3633,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -3417,6 +3670,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -3438,7 +3692,7 @@ _LT_EOF
   if AC_TRY_EVAL(ac_compile); then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
 	mv -f "$nlist"T "$nlist"
@@ -3450,6 +3704,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -3461,7 +3727,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT@&t at _DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -3487,15 +3753,15 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
 	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
 	fi
@@ -3528,6 +3794,13 @@ else
   AC_MSG_RESULT(ok)
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
     [Take the output of nm and produce a listing of raw symbols and C names])
 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
@@ -3538,6 +3811,8 @@ _LT_DECL([global_symbol_to_c_name_address],
 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
     [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
     [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
 ]) # _LT_CMD_GLOBAL_SYMBOLS
 
 
@@ -3549,7 +3824,6 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)=
 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 _LT_TAGVAR(lt_prog_compiler_static, $1)=
 
-AC_MSG_CHECKING([for $compiler option to produce PIC])
 m4_if([$1], [CXX], [
   # C++ specific cases for pic, static, wl, etc.
   if test "$GXX" = yes; then
@@ -3600,6 +3874,11 @@ m4_if([$1], [CXX], [
       # DJGPP does not support shared libraries at all
       _LT_TAGVAR(lt_prog_compiler_pic, $1)=
       ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
     interix[[3-9]]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
@@ -3649,6 +3928,12 @@ m4_if([$1], [CXX], [
 	  ;;
 	esac
 	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
       dgux*)
 	case $cc_basename in
 	  ec++*)
@@ -3738,8 +4023,8 @@ m4_if([$1], [CXX], [
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
 	    ;;
-	  xlc* | xlC*)
-	    # IBM XL 8.0 on PPC
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
@@ -3801,7 +4086,7 @@ m4_if([$1], [CXX], [
 	;;
       solaris*)
 	case $cc_basename in
-	  CC*)
+	  CC* | sunCC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -3905,6 +4190,12 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -3947,6 +4238,13 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -4010,7 +4308,13 @@ m4_if([$1], [CXX], [
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
 	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -4022,25 +4326,25 @@ m4_if([$1], [CXX], [
         # All Alpha code is PIC.
         _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	*Sun\ C*)
+	  # Sun C 5.9
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	  ;;
 	esac
 	;;
@@ -4072,7 +4376,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
       *)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
@@ -4129,9 +4433,11 @@ case $host_os in
     _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
     ;;
 esac
-AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
 
 #
 # Check to make sure the PIC flag actually works.
@@ -4150,6 +4456,8 @@ fi
 _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
 	[Additional compiler flags for building library objects])
 
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
 #
 # Check to make sure the static flag actually works.
 #
@@ -4170,6 +4478,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
 m4_defun([_LT_LINKER_SHLIBS],
 [AC_REQUIRE([LT_PATH_LD])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -4178,30 +4487,38 @@ m4_require([_LT_TAG_COMPILER])dnl
 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 m4_if([$1], [CXX], [
   _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   case $host_os in
   aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     else
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     fi
     ;;
   pw32*)
     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-  ;;
+    ;;
   cygwin* | mingw* | cegcc*)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
-  linux* | k*bsd*-gnu)
+    case $cc_basename in
+    cl*) ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
     _LT_TAGVAR(link_all_deplibs, $1)=no
-  ;;
+    ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
+    ;;
   esac
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ], [
   runpath_var=
   _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -4261,13 +4578,39 @@ dnl Note also adjust exclude_expsyms for C++ above.
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu)
+  linux* | k*bsd*-gnu | gnu*)
     _LT_TAGVAR(link_all_deplibs, $1)=no
     ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -4301,11 +4644,12 @@ dnl Note also adjust exclude_expsyms for C++ above.
 	_LT_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -4341,10 +4685,12 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -4362,6 +4708,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
     interix[[3-9]]*)
       _LT_TAGVAR(hardcode_direct, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -4387,15 +4738,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -4406,13 +4758,17 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
 	  tmp_sharedflag='--shared' ;;
-	xl[[cC]]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  _LT_TAGVAR(compiler_needs_object, $1)=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -4428,17 +4784,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
 	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
 	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -4452,8 +4808,8 @@ _LT_EOF
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -4471,8 +4827,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4518,8 +4874,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4559,8 +4915,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -4648,9 +5006,9 @@ _LT_EOF
 	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        _LT_SYS_MODULE_PATH_AIX
+        _LT_SYS_MODULE_PATH_AIX([$1])
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -4659,14 +5017,19 @@ _LT_EOF
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 _LT_SYS_MODULE_PATH_AIX
+	 _LT_SYS_MODULE_PATH_AIX([$1])
 	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
 	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -4698,20 +5061,63 @@ _LT_EOF
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-      # FIXME: Should let the user specify the lib program.
-      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
-      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -4749,7 +5155,7 @@ _LT_EOF
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -4757,7 +5163,7 @@ _LT_EOF
 
     hpux9*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -4772,8 +5178,8 @@ _LT_EOF
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -4791,16 +5197,16 @@ _LT_EOF
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -4812,7 +5218,14 @@ _LT_EOF
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
 	  ;;
 	esac
       fi
@@ -4840,19 +5253,34 @@ _LT_EOF
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        AC_LINK_IFELSE(int foo(void) {},
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-        )
-        LDFLAGS="$save_LDFLAGS"
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -4914,17 +5342,17 @@ _LT_EOF
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -4934,13 +5362,13 @@ _LT_EOF
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -4953,9 +5381,9 @@ _LT_EOF
       _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -5131,36 +5559,38 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-	pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-        _LT_TAGVAR(allow_undefined_flag, $1)=
-        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-        then
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        else
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-        fi
-        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
       ;;
     esac
   fi
@@ -5225,8 +5655,6 @@ _LT_TAGDECL([], [inherit_rpath], [0],
     to runtime path list])
 _LT_TAGDECL([], [link_all_deplibs], [0],
     [Whether libtool must link a program against all its dependency libraries])
-_LT_TAGDECL([], [fix_srcfile_path], [1],
-    [Fix the shell variable $srcfile for the compiler])
 _LT_TAGDECL([], [always_export_symbols], [0],
     [Set to "yes" if exported symbols are required])
 _LT_TAGDECL([], [export_symbols_cmds], [2],
@@ -5237,6 +5665,8 @@ _LT_TAGDECL([], [include_expsyms], [1],
     [Symbols that must always be exported])
 _LT_TAGDECL([], [prelink_cmds], [2],
     [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
 _LT_TAGDECL([], [file_list_spec], [1],
     [Specify filename containing input files])
 dnl FIXME: Not yet implemented
@@ -5330,37 +5760,22 @@ CC="$lt_save_CC"
 ])# _LT_LANG_C_CONFIG
 
 
-# _LT_PROG_CXX
-# ------------
-# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
-# compiler, we have our own version here.
-m4_defun([_LT_PROG_CXX],
-[
-pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
-AC_PROG_CXX
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-else
-  _lt_caught_CXX_error=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_CXX
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_CXX], [])
-
-
 # _LT_LANG_CXX_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a C++ compiler are suitably
 # defined.  These variables are subsequently used by _LT_CONFIG to write
 # the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_CXX_CONFIG],
-[AC_REQUIRE([_LT_PROG_CXX])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
 
 AC_LANG_PUSH(C++)
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -5382,6 +5797,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -5413,6 +5830,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
   # Allow CC to be a program name with arguments.
   lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
   lt_save_LD=$LD
   lt_save_GCC=$GCC
   GCC=$GXX
@@ -5430,6 +5848,7 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi
   test -z "${LDCXX+set}" || LD=$LDCXX
   CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -5451,8 +5870,8 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
       if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5484,7 +5903,7 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
       # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 
     else
       GXX=no
@@ -5593,10 +6012,10 @@ if test "$_lt_caught_CXX_error" != yes; then
           _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
           # Determine the default libpath from the value encoded in an empty
           # executable.
-          _LT_SYS_MODULE_PATH_AIX
+          _LT_SYS_MODULE_PATH_AIX([$1])
           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
         else
           if test "$host_cpu" = ia64; then
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -5605,14 +6024,19 @@ if test "$_lt_caught_CXX_error" != yes; then
           else
 	    # Determine the default libpath from the value encoded in an
 	    # empty executable.
-	    _LT_SYS_MODULE_PATH_AIX
+	    _LT_SYS_MODULE_PATH_AIX([$1])
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	    # Warning - without using the other run time loading flags,
 	    # -berok will link without error, but may produce a broken library.
 	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
 	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	    # This is similar to how AIX traditionally builds its shared
 	    # libraries.
@@ -5642,28 +6066,75 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       cygwin* | mingw* | pw32* | cegcc*)
-        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-        # as there is no search path for DLLs.
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-        _LT_TAGVAR(always_export_symbols, $1)=no
-        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-          # If the export-symbols file already is a .def file (1st line
-          # is EXPORTS), use it as is; otherwise, prepend...
-          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    cp $export_symbols $output_objdir/$soname.def;
-          else
-	    echo EXPORTS > $output_objdir/$soname.def;
-	    cat $export_symbols >> $output_objdir/$soname.def;
-          fi~
-          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-        else
-          _LT_TAGVAR(ld_shlibs, $1)=no
-        fi
-        ;;
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
       darwin* | rhapsody*)
         _LT_DARWIN_LINKER_FEATURES($1)
 	;;
@@ -5705,6 +6176,11 @@ if test "$_lt_caught_CXX_error" != yes; then
       gnu*)
         ;;
 
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
       hpux9*)
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -5729,11 +6205,11 @@ if test "$_lt_caught_CXX_error" != yes; then
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
             ;;
           *)
             if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               _LT_TAGVAR(ld_shlibs, $1)=no
@@ -5794,7 +6270,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 	    ;;
           *)
 	    if test "$GXX" = yes; then
@@ -5804,10 +6280,10 @@ if test "$_lt_caught_CXX_error" != yes; then
 	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	        esac
 	      fi
@@ -5837,7 +6313,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         case $cc_basename in
           CC*)
 	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -5848,9 +6324,9 @@ if test "$_lt_caught_CXX_error" != yes; then
           *)
 	    if test "$GXX" = yes; then
 	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
 	      fi
 	    fi
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -5879,7 +6355,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5916,26 +6392,26 @@ if test "$_lt_caught_CXX_error" != yes; then
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
 	    case `$CC -V` in
-	    *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
 		$RANLIB $oldlib'
 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
-	    *) # Version 6 will use weak symbols
+	    *) # Version 6 and above use weak symbols
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
@@ -5943,7 +6419,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
             ;;
 	  cxx*)
 	    # Compaq C++
@@ -5962,9 +6438,9 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
 	    ;;
-	  xl*)
+	  xl* | mpixl* | bgxl*)
 	    # IBM XL 8.0 on PPC, with GNU ld
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5984,13 +6460,13 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	      _LT_TAGVAR(compiler_needs_object, $1)=yes
 
 	      # Not sure whether something based on
 	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
 	      # would be better.
-	      output_verbose_link_cmd='echo'
+	      output_verbose_link_cmd='func_echo_all'
 
 	      # Archives containing C++ object files must be created using
 	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6059,7 +6535,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
 	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
 	  fi
-	  output_verbose_link_cmd=echo
+	  output_verbose_link_cmd=func_echo_all
 	else
 	  _LT_TAGVAR(ld_shlibs, $1)=no
 	fi
@@ -6094,15 +6570,15 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    case $host in
 	      osf3*)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 		;;
 	      *)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
 	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
 	          $RM $lib.exp'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
 		;;
@@ -6118,17 +6594,17 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 	    ;;
 	  *)
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
 	      case $host in
 	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	      esac
 
@@ -6138,7 +6614,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      # Commands to make compiler produce verbose output that lists
 	      # what "hidden" libraries, object files and flags are used when
 	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 
 	    else
 	      # FIXME: insert proper C++ library support
@@ -6174,7 +6650,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
       solaris*)
         case $cc_basename in
-          CC*)
+          CC* | sunCC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
             _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
 	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
@@ -6195,7 +6671,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    esac
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
 
-	    output_verbose_link_cmd='echo'
+	    output_verbose_link_cmd='func_echo_all'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6215,14 +6691,14 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
 	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 	      else
 	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
 	        # platform.
@@ -6233,7 +6709,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 	      fi
 
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
@@ -6287,6 +6763,10 @@ if test "$_lt_caught_CXX_error" != yes; then
           CC*)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
 	    ;;
 	  *)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
@@ -6342,6 +6822,7 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi # test -n "$compiler"
 
   CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
   LDCXX=$LD
   LD=$lt_save_LD
   GCC=$lt_save_GCC
@@ -6356,6 +6837,29 @@ AC_LANG_POP
 ])# _LT_LANG_CXX_CONFIG
 
 
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -6364,6 +6868,7 @@ AC_LANG_POP
 # objects, libraries and library flags.
 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
 # Dependencies to place before and after the object being linked:
 _LT_TAGVAR(predep_objects, $1)=
 _LT_TAGVAR(postdep_objects, $1)=
@@ -6414,6 +6919,13 @@ public class foo {
 };
 _LT_EOF
 ])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
+
 dnl Parse the compiler output and extract the necessary
 dnl objects, libraries and library flags.
 if AC_TRY_EVAL(ac_compile); then
@@ -6425,7 +6937,7 @@ if AC_TRY_EVAL(ac_compile); then
   pre_test_object_deps_done=no
 
   for p in `eval "$output_verbose_link_cmd"`; do
-    case $p in
+    case ${prev}${p} in
 
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
@@ -6434,13 +6946,22 @@ if AC_TRY_EVAL(ac_compile); then
           test $p = "-R"; then
 	 prev=$p
 	 continue
-       else
-	 prev=
        fi
 
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
        if test "$pre_test_object_deps_done" = no; then
-	 case $p in
-	 -L* | -R*)
+	 case ${prev} in
+	 -L | -R)
 	   # Internal compiler library paths should come after those
 	   # provided the user.  The postdeps already come after the
 	   # user supplied libs so there is no need to process them.
@@ -6460,8 +6981,10 @@ if AC_TRY_EVAL(ac_compile); then
 	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
 	 fi
        fi
+       prev=
        ;;
 
+    *.lto.$objext) ;; # Ignore GCC LTO objects
     *.$objext)
        # This assumes that the test object file only shows up
        # once in the compiler output.
@@ -6497,6 +7020,7 @@ else
 fi
 
 $RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
 
 # PORTME: override above test on systems where it is broken
 m4_if([$1], [CXX],
@@ -6533,7 +7057,7 @@ linux*)
 
 solaris*)
   case $cc_basename in
-  CC*)
+  CC* | sunCC*)
     # The more standards-conforming stlport4 library is
     # incompatible with the Cstd library. Avoid specifying
     # it if it's in CXXFLAGS. Ignore libCrun as
@@ -6577,32 +7101,16 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
 ])# _LT_SYS_HIDDEN_LIBDEPS
 
 
-# _LT_PROG_F77
-# ------------
-# Since AC_PROG_F77 is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_F77],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
-AC_PROG_F77
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_F77
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_F77], [])
-
-
 # _LT_LANG_F77_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
-[AC_REQUIRE([_LT_PROG_F77])dnl
-AC_LANG_PUSH(Fortran 77)
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -6621,6 +7129,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -6660,7 +7170,9 @@ if test "$_lt_disable_F77" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
   CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -6714,38 +7226,24 @@ if test "$_lt_disable_F77" != yes; then
 
   GCC=$lt_save_GCC
   CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
 fi # test "$_lt_disable_F77" != yes
 
 AC_LANG_POP
 ])# _LT_LANG_F77_CONFIG
 
 
-# _LT_PROG_FC
-# -----------
-# Since AC_PROG_FC is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_FC],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
-AC_PROG_FC
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_FC
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_FC], [])
-
-
 # _LT_LANG_FC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for a Fortran compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_FC_CONFIG],
-[AC_REQUIRE([_LT_PROG_FC])dnl
-AC_LANG_PUSH(Fortran)
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -6764,6 +7262,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -6803,7 +7303,9 @@ if test "$_lt_disable_FC" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
   CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
   compiler=$CC
   GCC=$ac_cv_fc_compiler_gnu
 
@@ -6859,7 +7361,8 @@ if test "$_lt_disable_FC" != yes; then
   fi # test -n "$compiler"
 
   GCC=$lt_save_GCC
-  CC="$lt_save_CC"
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
 fi # test "$_lt_disable_FC" != yes
 
 AC_LANG_POP
@@ -6896,10 +7399,12 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
 lt_save_GCC=$GCC
 GCC=yes
 CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
 _LT_TAGVAR(LD, $1)="$LD"
@@ -6909,6 +7414,8 @@ _LT_CC_BASENAME([$compiler])
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 
 ## CAVEAT EMPTOR:
 ## There is no encapsulation within the following macros, do not change
@@ -6928,7 +7435,8 @@ fi
 AC_LANG_RESTORE
 
 GCC=$lt_save_GCC
-CC="$lt_save_CC"
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
 ])# _LT_LANG_GCJ_CONFIG
 
 
@@ -6963,9 +7471,11 @@ _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
 lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
 lt_save_GCC=$GCC
 GCC=
 CC=${RC-"windres"}
+CFLAGS=
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
 _LT_CC_BASENAME([$compiler])
@@ -6978,7 +7488,8 @@ fi
 
 GCC=$lt_save_GCC
 AC_LANG_RESTORE
-CC="$lt_save_CC"
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
 ])# _LT_LANG_RC_CONFIG
 
 
@@ -7037,6 +7548,15 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
 AC_SUBST([OBJDUMP])
 ])
 
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
 
 # _LT_DECL_SED
 # ------------
@@ -7130,8 +7650,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES],
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -7170,208 +7690,162 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
 ])# _LT_CHECK_SHELL_FEATURES
 
 
-# _LT_PROG_XSI_SHELLFNS
-# ---------------------
-# Bourne and XSI compatible variants of some useful shell functions.
-m4_defun([_LT_PROG_XSI_SHELLFNS],
-[case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $[*] ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
 
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
 
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
 
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
 
-dnl func_dirname_and_basename
-dnl A portable version of this function is already defined in general.m4sh
-dnl so there is no need for it here.
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
 
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
 
-# sed scripts:
-my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[[^=]]*=//'
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
 
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
 
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
 
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
 
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$[@]"`
-}
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
 
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
 
-_LT_EOF
-esac
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
 
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
 
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$[1]+=\$[2]"
-}
-_LT_EOF
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
     ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$[1]=\$$[1]\$[2]"
-}
-
-_LT_EOF
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
     ;;
-  esac
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
 ])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/libass/m4/ltoptions.m4 b/libass/m4/ltoptions.m4
index 34151a3..17cfd51 100644
--- a/libass/m4/ltoptions.m4
+++ b/libass/m4/ltoptions.m4
@@ -1,13 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 6 ltoptions.m4
+# serial 7 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -125,7 +126,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
 [enable_win32_dll=yes
 
 case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
@@ -133,13 +134,13 @@ case $host in
 esac
 
 test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [0], [Assembler program])dnl
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
 
 test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
 
 test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
 ])# win32-dll
 
 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
diff --git a/libass/m4/ltversion.m4 b/libass/m4/ltversion.m4
index f3c5309..9c7b5d4 100644
--- a/libass/m4/ltversion.m4
+++ b/libass/m4/ltversion.m4
@@ -7,17 +7,17 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# Generated from ltversion.in.
+# @configure_input@
 
-# serial 3017 ltversion.m4
+# serial 3293 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.6b])
-m4_define([LT_PACKAGE_REVISION], [1.3017])
+m4_define([LT_PACKAGE_VERSION], [2.4])
+m4_define([LT_PACKAGE_REVISION], [1.3293])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6b'
-macro_revision='1.3017'
+[macro_version='2.4'
+macro_revision='1.3293'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
diff --git a/libass/m4/lt~obsolete.m4 b/libass/m4/lt~obsolete.m4
index 637bb20..c573da9 100644
--- a/libass/m4/lt~obsolete.m4
+++ b/libass/m4/lt~obsolete.m4
@@ -1,13 +1,13 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 4 lt~obsolete.m4
+# serial 5 lt~obsolete.m4
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
@@ -77,7 +77,6 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
 m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
 m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
 m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
 m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
 m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
 m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
@@ -90,3 +89,10 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
 m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
 m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
 m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
diff --git a/libass/test/Makefile.in b/libass/test/Makefile.in
index aeae5fa..9d900ec 100644
--- a/libass/test/Makefile.in
+++ b/libass/test/Makefile.in
@@ -105,6 +105,7 @@ CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -136,6 +137,7 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -165,6 +167,7 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -197,7 +200,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff --git a/mplayer/Copyright b/mplayer/Copyright
index def4bf6..491ddea 100644
--- a/mplayer/Copyright
+++ b/mplayer/Copyright
@@ -21,16 +21,6 @@ Copyright:  Many, see individual files for copyright notices.
 License:    GNU Lesser General Public License
 
 
-Name:       mpg123
-Version:    0.59s + significant changes
-URL:        http://www.mpg123.de/
-Directory:  mp3lib
-Copyright:  1995-1999 by Michael Hipp
-            2004 Romain Dolbeau <romain at dolbeau.org>
-            2006 Zuxy Meng <zuxy.meng at gmail.com
-License:    GNU General Public License
-
-
 Name:       avifile DLL loader
 Version:    0.47 + patches + CVS updates
 URL:        http://avifile.sourceforge.net/
diff --git a/mplayer/DOCS/man/en/mplayer.1 b/mplayer/DOCS/man/en/mplayer.1
index 91ae431..081171a 100644
--- a/mplayer/DOCS/man/en/mplayer.1
+++ b/mplayer/DOCS/man/en/mplayer.1
@@ -1177,9 +1177,7 @@ Plays a Matroska file in Japanese.
 Force audio demuxer type for \-audiofile.
 Use a '+' before the name to force it, this will skip some checks!
 Give the demuxer name as printed by \-audio\-demuxer help.
-For backward compatibility it also accepts the demuxer ID as defined in
-libmpdemux/\:demuxer.h.
-\-audio\-demuxer audio or \-audio\-demuxer 17 forces MP3.
+\-audio\-demuxer audio forces MP3.
 .
 .TP
 .B \-audiofile <filename>
@@ -1356,8 +1354,6 @@ This nullifies stream delays.
 Force demuxer type.
 Use a '+' before the name to force it, this will skip some checks!
 Give the demuxer name as printed by \-demuxer help.
-For backward compatibility it also accepts the demuxer ID as defined in
-libmpdemux/\:demuxer.h.
 .
 .TP
 .B \-dumpaudio
@@ -1503,6 +1499,43 @@ Skip the proxy for IPv6 addresses.
 It will still be used for IPv4 connections.
 .
 .TP
+.B \-lavfdopts <option1:option2:...>
+Specify parameters for libavformat demuxers (\-demuxer lavf).
+Separate multiple options with a colon.
+.sp
+.RS
+Available suboptions are:
+.RE
+.RSs
+.IPs analyzeduration=<value>
+Maximum length in seconds to analyze the stream properties.
+.IPs format=<value>
+Force a specific libavformat demuxer.
+.IPs o=<key>=<value>[,<key>=<value>[,...]]
+Pass AVOptions to libavformat demuxer.
+Note, a patch to make the o= unneeded and pass all unknown options through
+the AVOption system is welcome.
+A full list of AVOptions can be found in the FFmpeg manual.
+Note that some options may conflict with MPlayer options.
+.sp 1
+.RS
+.I EXAMPLE:
+.RE
+.RSs
+.PD 0
+.IPs o=fflags=+ignidx
+.PD 1
+.RE
+.IPs probesize=<value>
+Maximum amount of data to probe during the detection phase.
+In the case of MPEG-TS this value identifies the maximum number
+of TS packets to scan.
+.IPs cryptokey=<hexstring>
+Encryption key the demuxer should use.
+This is the raw binary data of the key converted to a hexadecimal string.
+.RE
+.
+.TP
 .B \-loadidx <index file>
 The file from which to read the video index data saved by \-saveidx.
 This index will be used for seeking, overriding any index data
@@ -2416,8 +2449,6 @@ intensity of the color.
 Force subtitle demuxer type for \-subfile.
 Use a '+' before the name to force it, this will skip some checks!
 Give the demuxer name as printed by \-sub\-demuxer help.
-For backward compatibility it also accepts the demuxer ID as defined in
-subreader.h.
 .
 .TP
 .B \-sub\-fuzziness <mode>
@@ -2429,7 +2460,7 @@ exact match
 .IPs 1
 Load all subs containing movie name.
 .IPs 2
-Load all subs in the current directory.
+Load all subs in the current and \-sub\-paths directories.
 .RE
 .PD 1
 .
@@ -2496,6 +2527,31 @@ Guess the encoding for Polish, fall back on cp1250.
 .PD 1
 .
 .TP
+.B \-sub\-paths <path1:path2:...>
+Specify extra directories where to search for subtitles matching the video.
+Multiple directories can be separated by ":" (";" on Windows).
+Paths can be relative or absolute.
+Relative paths are interpreted relative to video file directory.
+
+.sp 1
+.I EXAMPLE:
+Assuming that /path/\:to/\:movie/\:movie.avi is played and \-sub\-paths
+sub:subtitles:/tmp/subs is specified, MPlayer searches for subtitle files in
+these directories:
+.RSs
+/path/\:to/\:movie/
+.br
+/path/\:to/\:movie/\:sub/
+.br
+/path/\:to/\:movie/\:subtitles/
+.br
+/tmp/\:subs/
+.br
+~/.mplayer/\:sub/
+.RE
+.PD 1
+.
+.TP
 .B \-subdelay <sec>
 Delays subtitles by <sec> seconds.
 Can be negative.
@@ -7638,14 +7694,6 @@ font directory (There must be a font.desc file and files with .RAW extension.)
 .TP
 ~/.mplayer/\:DVDkeys/
 cached CSS keys
-.
-.TP
-Assuming that /path/\:to/\:movie.avi is played, MPlayer searches for sub files
-in this order:
-.RS
-/path/\:to/\:movie.sub
-.br
-~/.mplayer/\:sub/\:movie.sub
 .RE
 .PD 1
 .
diff --git a/mplayer/Makefile b/mplayer/Makefile
index b38590c..46fdeee 100644
--- a/mplayer/Makefile
+++ b/mplayer/Makefile
@@ -122,21 +122,6 @@ SRCS_COMMON-$(MACOSX_FINDER)         += osdep/macosx_finder_args.c
 SRCS_COMMON-$(MNG)                   += libmpdemux/demux_mng.c
 SRCS_COMMON-$(MPG123)                += libmpcodecs/ad_mpg123.c
 
-SRCS_MP3LIB-X86-$(HAVE_AMD3DNOW)     += mp3lib/dct36_3dnow.c \
-                                        mp3lib/dct64_3dnow.c
-SRCS_MP3LIB-X86-$(HAVE_AMD3DNOWEXT)  += mp3lib/dct36_k7.c \
-                                        mp3lib/dct64_k7.c
-SRCS_MP3LIB-X86-$(HAVE_MMX)          += mp3lib/dct64_mmx.c
-SRCS_MP3LIB-$(ARCH_X86_32)           += mp3lib/decode_i586.c \
-                                        $(SRCS_MP3LIB-X86-yes)
-SRCS_MP3LIB-$(HAVE_ALTIVEC)          += mp3lib/dct64_altivec.c
-SRCS_MP3LIB-$(HAVE_MMX)              += mp3lib/decode_mmx.c
-SRCS_MP3LIB-$(HAVE_SSE)              += mp3lib/dct64_sse.c
-SRCS_MP3LIB                          += mp3lib/sr1.c \
-                                        $(SRCS_MP3LIB-yes)
-SRCS_COMMON-$(MP3LIB)                += libmpcodecs/ad_mp3lib.c \
-                                        $(SRCS_MP3LIB)
-
 SRCS_COMMON-$(MUSEPACK)              += libmpcodecs/ad_mpc.c \
                                         libmpdemux/demux_mpc.c
 SRCS_COMMON-$(NATIVE_RTSP)           += stream/stream_rtsp.c \
@@ -389,6 +374,7 @@ SRCS_COMMON = asxparser.c \
               libmpdemux/demux_audio.c \
               libmpdemux/demux_avi.c \
               libmpdemux/demux_demuxers.c \
+              libmpdemux/demux_edl.c \
               libmpdemux/demux_film.c \
               libmpdemux/demux_fli.c \
               libmpdemux/demux_lmlm4.c \
@@ -422,7 +408,6 @@ SRCS_COMMON = asxparser.c \
               libmpdemux/yuv4mpeg.c \
               libmpdemux/yuv4mpeg_ratio.c \
               libvo/osd.c \
-              osdep/findfiles.c \
               osdep/numcores.c \
               osdep/$(GETCH) \
               osdep/$(TIMER) \
@@ -437,10 +422,13 @@ SRCS_COMMON = asxparser.c \
               sub/sub_cc.c \
               sub/dec_sub.c \
               sub/find_sub.c \
+              sub/find_subfiles.c \
               sub/spudec.c \
               sub/subassconvert.c \
               sub/subreader.c \
               sub/vobsub.c \
+              timeline/tl_edl.c \
+              timeline/tl_matroska.c \
               $(SRCS_COMMON-yes)
 
 
@@ -578,13 +566,13 @@ DIRS =  . \
         loader/dshow \
         loader/dmo \
         loader/wine \
-        mp3lib \
         osdep \
         stream \
         stream/freesdp \
         stream/librtsp \
         stream/realrtsp \
         sub \
+        timeline \
         TOOLS \
 
 MOFILES := $(MSG_LANGS:%=locale/%/LC_MESSAGES/mplayer.mo)
@@ -675,8 +663,6 @@ loader/%: CFLAGS += -fno-omit-frame-pointer $(CFLAGS_NO_OMIT_LEAF_FRAME_POINTER)
 #loader/%: CFLAGS += -Ddbg_printf=__vprintf -DTRACE=__vprintf -DDETAILED_OUT
 loader/win32%: CFLAGS += $(CFLAGS_STACKREALIGN)
 
-mp3lib/decode_i586%: CFLAGS += -fomit-frame-pointer
-
 stream/stream_dvdnav%: CFLAGS := $(CFLAGS_LIBDVDNAV) $(CFLAGS)
 
 
@@ -767,9 +753,7 @@ LOADER_TEST_OBJS = $(SRCS_WIN32_EMULATION:.c=.o) $(SRCS_QTX_EMULATION:.S=.o) lib
 loader/qtx/list$(EXESUF) loader/qtx/qtxload$(EXESUF): CFLAGS += -g
 loader/qtx/list$(EXESUF) loader/qtx/qtxload$(EXESUF): $(LOADER_TEST_OBJS)
 
-mp3lib/test$(EXESUF) mp3lib/test2$(EXESUF): $(SRCS_MP3LIB:.c=.o) libvo/aclib.o cpudetect.o $(TEST_OBJS)
-
-TESTS = codecs2html codec-cfg-test libvo/aspecttest mp3lib/test mp3lib/test2
+TESTS = codecs2html codec-cfg-test libvo/aspecttest
 
 ifdef ARCH_X86
 TESTS += loader/qtx/list loader/qtx/qtxload
diff --git a/mplayer/TOOLS/matroska.py b/mplayer/TOOLS/matroska.py
index fb17f48..375fb8b 100755
--- a/mplayer/TOOLS/matroska.py
+++ b/mplayer/TOOLS/matroska.py
@@ -88,6 +88,7 @@ elements_matroska = (
                 'Language, 22b59c, str',
                 'CodecID, 86, str',
                 'CodecPrivate, 63a2, binary',
+                'CodecName, 258688, str',
                 'CodecDecodeAll, aa, uint',
                 'Video, e0, sub', (
                     'FlagInterlaced, 9a, uint',
diff --git a/mplayer/access_mpcontext.h b/mplayer/access_mpcontext.h
index 23bfcfb..c6c8bfe 100644
--- a/mplayer/access_mpcontext.h
+++ b/mplayer/access_mpcontext.h
@@ -21,7 +21,6 @@
 
 struct MPContext;
 const void *mpctx_get_video_out(struct MPContext *mpctx);
-const void *mpctx_get_audio_out(struct MPContext *mpctx);
 void *mpctx_get_demuxer(struct MPContext *mpctx);
 void *mpctx_get_playtree_iter(struct MPContext *mpctx);
 void *mpctx_get_mixer(struct MPContext *mpctx);
diff --git a/mplayer/av_log.c b/mplayer/av_log.c
index e3bb9e8..bcf1a14 100644
--- a/mplayer/av_log.c
+++ b/mplayer/av_log.c
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 
+#include "av_log.h"
 #include "config.h"
 #include "mp_msg.h"
 #include <libavutil/log.h>
@@ -56,10 +57,10 @@ static int extract_msg_type_from_ctx(void *ptr)
     if (!strcmp(avc->class_name, "AVCodecContext")) {
         AVCodecContext *s = ptr;
         if (s->codec) {
-            if (s->codec->type == CODEC_TYPE_AUDIO) {
+            if (s->codec->type == AVMEDIA_TYPE_AUDIO) {
                 if (s->codec->decode)
                     return MSGT_DECAUDIO;
-            } else if (s->codec->type == CODEC_TYPE_VIDEO) {
+            } else if (s->codec->type == AVMEDIA_TYPE_VIDEO) {
                 if (s->codec->decode)
                     return MSGT_DECVIDEO;
             }
diff --git a/mplayer/av_opts.c b/mplayer/av_opts.c
index 452253b..59f47ed 100644
--- a/mplayer/av_opts.c
+++ b/mplayer/av_opts.c
@@ -37,7 +37,7 @@ int parse_avopts(void *v, char *str){
         arg     = strchr(str, '=');
         if(arg)      *arg++= 0;
 
-        if(!av_set_string(v, str, arg)){
+        if (av_set_string3(v, str, arg, 0, NULL) < 0) {
             free(start);
             return -1;
         }
diff --git a/mplayer/bstr.c b/mplayer/bstr.c
index 3cc3928..68342fa 100644
--- a/mplayer/bstr.c
+++ b/mplayer/bstr.c
@@ -18,6 +18,11 @@
 
 #include <string.h>
 #include <libavutil/avutil.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include "talloc.h"
+
 #include "bstr.h"
 
 int bstrcmp(struct bstr str1, struct bstr str2)
@@ -49,3 +54,112 @@ int bstrcasecmp(struct bstr str1, struct bstr str2)
     }
     return ret;
 }
+
+int bstrchr(struct bstr str, int c)
+{
+    for (int i = 0; i < str.len; i++)
+        if (str.start[i] == c)
+            return i;
+    return -1;
+}
+
+int bstrrchr(struct bstr str, int c)
+{
+    for (int i = str.len - 1; i >= 0; i--)
+        if (str.start[i] == c)
+            return i;
+    return -1;
+}
+
+int bstr_find(struct bstr haystack, struct bstr needle)
+{
+    for (int i = 0; i < haystack.len; i++)
+        if (bstr_startswith(bstr_splice(haystack, i, haystack.len), needle))
+            return i;
+    return -1;
+}
+
+struct bstr bstr_strip(struct bstr str)
+{
+    while (str.len && isspace(*str.start)) {
+        str.start++;
+        str.len--;
+    }
+    while (str.len && isspace(str.start[str.len - 1]))
+        str.len--;
+    return str;
+}
+
+struct bstr bstr_split(struct bstr str, char *sep, struct bstr *rest)
+{
+    int start, end;
+    for (start = 0; start < str.len; start++)
+        if (!strchr(sep, str.start[start]))
+            break;
+    for (end = start; end < str.len; end++)
+        if (strchr(sep, str.start[end]))
+            break;
+    if (rest) {
+        *rest = bstr_cut(str, end);
+    }
+    str.start += start;
+    str.len = end - start;
+    return str;
+}
+
+
+struct bstr bstr_splice(struct bstr str, int start, int end)
+{
+    if (start < 0)
+        start += str.len;
+    if (end < 0)
+        end += str.len;
+    end = FFMIN(end, str.len);
+    start = FFMAX(start, 0);
+    if (start >= end)
+        return (struct bstr){NULL, 0};
+    str.start += start;
+    str.len = end - start;
+    return str;
+}
+
+long long bstrtoll(struct bstr str, struct bstr *rest, int base)
+{
+    char buf[51];
+    int len = FFMIN(str.len, 50);
+    memcpy(buf, str.start, len);
+    buf[len] = 0;
+    char *endptr;
+    long long r = strtoll(buf, &endptr, base);
+    if (rest)
+        *rest = bstr_cut(str, endptr - buf);
+    return r;
+}
+
+struct bstr *bstr_splitlines(void *talloc_ctx, struct bstr str)
+{
+    if (str.len == 0)
+        return NULL;
+    int count = 0;
+    for (int i = 0; i < str.len; i++)
+        if (str.start[i] == '\n')
+            count++;
+    if (str.start[str.len - 1] != '\n')
+        count++;
+    struct bstr *r = talloc_array_ptrtype(talloc_ctx, r, count);
+    unsigned char *p = str.start;
+    for (int i = 0; i < count - 1; i++) {
+        r[i].start = p;
+        while (*p++ != '\n');
+        r[i].len = p - r[i].start;
+    }
+    r[count - 1].start = p;
+    r[count - 1].len = str.start + str.len - p;
+    return r;
+}
+
+void bstr_lower(struct bstr str)
+{
+    for (int i = 0; i < str.len; i++)
+        str.start[i] = tolower(str.start[i]);
+}
diff --git a/mplayer/bstr.h b/mplayer/bstr.h
index 459bf70..47bde14 100644
--- a/mplayer/bstr.h
+++ b/mplayer/bstr.h
@@ -22,18 +22,61 @@
 #include <stdint.h>
 #include <stddef.h>
 #include <string.h>
+#include <stdbool.h>
 
+#include "talloc.h"
+
+/* NOTE: 'len' is size_t, but most string-handling functions below assume
+ * that input size has been sanity checked and len fits in an int.
+ */
 struct bstr {
-    const uint8_t *start;
+    unsigned char *start;
     size_t len;
 };
 
 int bstrcmp(struct bstr str1, struct bstr str2);
 int bstrcasecmp(struct bstr str1, struct bstr str2);
+int bstrchr(struct bstr str, int c);
+int bstrrchr(struct bstr str, int c);
+int bstr_find(struct bstr haystack, struct bstr needle);
+struct bstr *bstr_splitlines(void *talloc_ctx, struct bstr str);
+struct bstr bstr_strip(struct bstr str);
+struct bstr bstr_split(struct bstr str, char *sep, struct bstr *rest);
+struct bstr bstr_splice(struct bstr str, int start, int end);
+long long bstrtoll(struct bstr str, struct bstr *rest, int base);
+void bstr_lower(struct bstr str);
+
+static inline struct bstr bstr_cut(struct bstr str, int n)
+{
+    return (struct bstr){str.start + n, str.len - n};
+}
+
+static inline bool bstr_startswith(struct bstr str, struct bstr prefix)
+{
+    if (str.len < prefix.len)
+        return false;
+    return !memcmp(str.start, prefix.start, prefix.len);
+}
+
+// demux_rtp.cpp (live555) C++ compilation workaround
+#ifndef __cplusplus
+static inline char *bstrdup0(void *talloc_ctx, struct bstr str)
+{
+    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
+}
+
+static inline struct bstr bstrdup(void *talloc_ctx, struct bstr str)
+{
+    struct bstr r = { talloc_strndup(talloc_ctx, str.start, str.len), str.len };
+    return r;
+}
+#endif
 
 // Create bstr compound literal from null-terminated string
-#define BSTR(s) (struct bstr){(s), (s) ? strlen(s) : 0}
+#define BSTR(s) (struct bstr){(char *)(s), (s) ? strlen(s) : 0}
 // create a pair (not single value!) for "%.*s" printf syntax
 #define BSTR_P(bstr) (int)((bstr).len), (bstr).start
 
+#define WHITESPACE " \f\n\r\t\v"
+
 #endif /* MPLAYER_BSTR_H */
diff --git a/mplayer/cfg-common.h b/mplayer/cfg-common.h
deleted file mode 100644
index e56d87b..0000000
--- a/mplayer/cfg-common.h
+++ /dev/null
@@ -1,711 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_CFG_COMMON_H
-#define MPLAYER_CFG_COMMON_H
-
-#include <sys/types.h>
-#include "config.h"
-#include "m_config.h"
-#include "m_option.h"
-
-#include "libmpdemux/demux_ts.h"
-
-extern char *mp_msg_charset;
-extern int mp_msg_color;
-extern int mp_msg_module;
-
-/* defined in codec-cfg.c */
-extern char * codecs_file;
-
-/* defined in dec_video.c */
-extern int field_dominance;
-
-/* from dec_audio, currently used for ac3surround decoder only */
-extern int fakemono;
-
-/* defined in network.c */
-extern char *network_username;
-extern char *network_password;
-extern int   network_bandwidth;
-extern char *network_useragent;
-extern char *network_referrer;
-extern int   network_cookies_enabled;
-extern char *cookies_file;
-
-extern int network_prefer_ipv4;
-extern int network_ipv4_only_proxy;
-extern int reuse_socket;
-
-extern int dvd_speed; /* stream/stream_dvd.c */
-
-/* defined in libmpdemux: */
-extern const m_option_t demux_rawaudio_opts[];
-extern const m_option_t demux_rawvideo_opts[];
-extern const m_option_t cdda_opts[];
-
-extern int demuxer_type, audio_demuxer_type, sub_demuxer_type;
-extern int ts_prog;
-extern int ts_keep_broken;
-extern off_t ts_probe;
-extern int audio_substream_id;
-extern off_t ps_probe;
-
-extern int sws_flags;
-extern char* pp_help;
-
-
-#include "stream/tv.h"
-#include "stream/stream_radio.h"
-
-
-
-#ifdef CONFIG_RADIO
-const m_option_t radioopts_conf[]={
-    {"device", &stream_radio_defaults.device, CONF_TYPE_STRING, 0, 0 ,0, NULL},
-    {"driver", &stream_radio_defaults.driver, CONF_TYPE_STRING, 0, 0 ,0, NULL},
-#ifdef RADIO_BSDBT848_HDR
-    {"freq_min", &stream_radio_defaults.freq_min, CONF_TYPE_FLOAT, 0, 0 ,0, NULL},
-    {"freq_max", &stream_radio_defaults.freq_max, CONF_TYPE_FLOAT, 0, 0 ,0, NULL},
-#endif
-    {"channels", &stream_radio_defaults.channels, CONF_TYPE_STRING_LIST, 0, 0 ,0, NULL},
-    {"volume", &stream_radio_defaults.volume, CONF_TYPE_INT, CONF_RANGE, 0 ,100, NULL},
-    {"adevice", &stream_radio_defaults.adevice, CONF_TYPE_STRING, 0, 0 ,0, NULL},
-    {"arate", &stream_radio_defaults.arate, CONF_TYPE_INT, CONF_MIN, 0 ,0, NULL},
-    {"achannels", &stream_radio_defaults.achannels, CONF_TYPE_INT, CONF_MIN, 0 ,0, NULL},
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-#endif /* CONFIG_RADIO */
-
-#ifdef CONFIG_TV
-const m_option_t tvopts_conf[]={
-    {"on", "-tv on has been removed, use tv:// instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"immediatemode", &stream_tv_defaults.immediate, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
-    {"noaudio", &stream_tv_defaults.noaudio, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"audiorate", &stream_tv_defaults.audiorate, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"driver", &stream_tv_defaults.driver, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"device", &stream_tv_defaults.device, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"freq", &stream_tv_defaults.freq, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"channel", &stream_tv_defaults.channel, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"chanlist", &stream_tv_defaults.chanlist, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"norm", &stream_tv_defaults.norm, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"automute", &stream_tv_defaults.automute, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
-#if defined(CONFIG_TV_V4L2) || defined(CONFIG_TV_DSHOW)
-    {"normid", &stream_tv_defaults.normid, CONF_TYPE_INT, 0, 0, 0, NULL},
-#endif
-    {"width", &stream_tv_defaults.width, CONF_TYPE_INT, 0, 0, 4096, NULL},
-    {"height", &stream_tv_defaults.height, CONF_TYPE_INT, 0, 0, 4096, NULL},
-    {"input", &stream_tv_defaults.input, CONF_TYPE_INT, 0, 0, 20, NULL},
-    {"outfmt", &stream_tv_defaults.outfmt, CONF_TYPE_IMGFMT, 0, 0, 0, NULL},
-    {"fps", &stream_tv_defaults.fps, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
-    {"channels", &stream_tv_defaults.channels, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-    {"brightness", &stream_tv_defaults.brightness, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
-    {"contrast", &stream_tv_defaults.contrast, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
-    {"hue", &stream_tv_defaults.hue, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
-    {"saturation", &stream_tv_defaults.saturation, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
-    {"gain", &stream_tv_defaults.gain, CONF_TYPE_INT, CONF_RANGE, -1, 100, NULL},
-#if defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2) || defined(CONFIG_TV_DSHOW)
-    {"buffersize", &stream_tv_defaults.buffer_size, CONF_TYPE_INT, CONF_RANGE, 16, 1024, NULL},
-    {"amode", &stream_tv_defaults.amode, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
-    {"volume", &stream_tv_defaults.volume, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
-#endif
-#if defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2)
-    {"bass", &stream_tv_defaults.bass, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
-    {"treble", &stream_tv_defaults.treble, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
-    {"balance", &stream_tv_defaults.balance, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
-    {"forcechan", &stream_tv_defaults.forcechan, CONF_TYPE_INT, CONF_RANGE, 1, 2, NULL},
-    {"forceaudio", &stream_tv_defaults.force_audio, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"buffersize", &stream_tv_defaults.buffer_size, CONF_TYPE_INT, CONF_RANGE, 16, 1024, NULL},
-    {"mjpeg", &stream_tv_defaults.mjpeg, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"decimation", &stream_tv_defaults.decimation, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
-    {"quality", &stream_tv_defaults.quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
-#ifdef CONFIG_ALSA
-    {"alsa", &stream_tv_defaults.alsa, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#endif /* CONFIG_ALSA */
-#endif /* defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2) */
-    {"adevice", &stream_tv_defaults.adevice, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"tdevice", &stream_tv_defaults.teletext.device, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"tpage", &stream_tv_defaults.teletext.page, CONF_TYPE_INT, CONF_RANGE, 100, 899, NULL},
-    {"tformat", &stream_tv_defaults.teletext.format, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
-    {"tlang", &stream_tv_defaults.teletext.lang, CONF_TYPE_INT, CONF_RANGE, -1, 0x7f, NULL},
-    {"audioid", &stream_tv_defaults.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL},
-#ifdef CONFIG_TV_DSHOW
-    {"hidden_video_renderer", &stream_tv_defaults.hidden_video_renderer, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"nohidden_video_renderer", &stream_tv_defaults.hidden_video_renderer, CONF_TYPE_FLAG, 0, 0, 0, NULL},
-    {"hidden_vp_renderer", &stream_tv_defaults.hidden_vp_renderer, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"nohidden_vp_renderer", &stream_tv_defaults.hidden_vp_renderer, CONF_TYPE_FLAG, 0, 0, 0, NULL},
-    {"system_clock", &stream_tv_defaults.system_clock, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"nosystem_clock", &stream_tv_defaults.system_clock, CONF_TYPE_FLAG, 0, 0, 0, NULL},
-    {"normalize_audio_chunks", &stream_tv_defaults.normalize_audio_chunks, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"nonormalize_audio_chunks", &stream_tv_defaults.normalize_audio_chunks, CONF_TYPE_FLAG, 0, 0, 0, NULL},
-#endif
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-#endif /* CONFIG_TV */
-
-extern int pvr_param_aspect_ratio;
-extern int pvr_param_sample_rate;
-extern int pvr_param_audio_layer;
-extern int pvr_param_audio_bitrate;
-extern char *pvr_param_audio_mode;
-extern int pvr_param_bitrate;
-extern char *pvr_param_bitrate_mode;
-extern int pvr_param_bitrate_peak;
-extern char *pvr_param_stream_type;
-
-#ifdef CONFIG_PVR
-const m_option_t pvropts_conf[]={
-    {"aspect", &pvr_param_aspect_ratio, CONF_TYPE_INT, 0, 1, 4, NULL},
-    {"arate", &pvr_param_sample_rate, CONF_TYPE_INT, 0, 32000, 48000, NULL},
-    {"alayer", &pvr_param_audio_layer, CONF_TYPE_INT, 0, 1, 2, NULL},
-    {"abitrate", &pvr_param_audio_bitrate, CONF_TYPE_INT, 0, 32, 448, NULL},
-    {"amode", &pvr_param_audio_mode, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"vbitrate", &pvr_param_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"vmode", &pvr_param_bitrate_mode, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"vpeak", &pvr_param_bitrate_peak, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"fmt", &pvr_param_stream_type, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-#endif /* CONFIG_PVR */
-
-extern const m_option_t dvbin_opts_conf[];
-extern const m_option_t lavfdopts_conf[];
-
-extern int rtsp_transport_tcp;
-extern int rtsp_transport_http;
-extern int rtsp_transport_sctp;
-extern int rtsp_port;
-extern char *rtsp_destination;
-
-
-extern int sws_chr_vshift;
-extern int sws_chr_hshift;
-extern float sws_chr_gblur;
-extern float sws_lum_gblur;
-extern float sws_chr_sharpen;
-extern float sws_lum_sharpen;
-
-const m_option_t scaler_filter_conf[]={
-    {"lgb", &sws_lum_gblur, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
-    {"cgb", &sws_chr_gblur, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
-    {"cvs", &sws_chr_vshift, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"chs", &sws_chr_hshift, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"ls", &sws_lum_sharpen, CONF_TYPE_FLOAT, 0, -100.0, 100.0, NULL},
-    {"cs", &sws_chr_sharpen, CONF_TYPE_FLOAT, 0, -100.0, 100.0, NULL},
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-
-/* VIVO demuxer options: */
-extern int vivo_param_version;
-extern char *vivo_param_acodec;
-extern int vivo_param_abitrate;
-extern int vivo_param_samplerate;
-extern int vivo_param_bytesperblock;
-extern int vivo_param_width;
-extern int vivo_param_height;
-extern int vivo_param_vformat;
-extern char *dvd_device, *cdrom_device;
-
-const m_option_t vivoopts_conf[]={
-    {"version", &vivo_param_version, CONF_TYPE_INT, 0, 0, 0, NULL},
-    /* audio options */
-    {"acodec", &vivo_param_acodec, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"abitrate", &vivo_param_abitrate, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"samplerate", &vivo_param_samplerate, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"bytesperblock", &vivo_param_bytesperblock, CONF_TYPE_INT, 0, 0, 0, NULL},
-    /* video options */
-    {"width", &vivo_param_width, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"height", &vivo_param_height, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"vformat", &vivo_param_vformat, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-
-extern int    mf_w;
-extern int    mf_h;
-extern double mf_fps;
-extern char * mf_type;
-extern m_obj_list_t vf_obj_list;
-
-const m_option_t mfopts_conf[]={
-    {"on", "-mf on has been removed, use mf:// instead.\n", CONF_TYPE_PRINT, 0, 0, 1, NULL},
-    {"w", &mf_w, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"h", &mf_h, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"fps", &mf_fps, CONF_TYPE_DOUBLE, 0, 0, 0, NULL},
-    {"type", &mf_type, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-
-#include "libaf/af.h"
-extern af_cfg_t af_cfg; // Audio filter configuration, defined in libmpcodecs/dec_audio.c
-const m_option_t audio_filter_conf[]={
-    {"list", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-    {"force", &af_cfg.force, CONF_TYPE_INT, CONF_RANGE, 0, 7, NULL},
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-
-extern int mp_msg_levels[MSGT_MAX];
-extern int mp_msg_level_all;
-
-const m_option_t msgl_config[]={
-    { "all", &mp_msg_level_all, CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL},
-
-    { "global", &mp_msg_levels[MSGT_GLOBAL], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "cplayer", &mp_msg_levels[MSGT_CPLAYER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "vo", &mp_msg_levels[MSGT_VO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "ao", &mp_msg_levels[MSGT_AO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "demuxer", &mp_msg_levels[MSGT_DEMUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "ds", &mp_msg_levels[MSGT_DS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "demux", &mp_msg_levels[MSGT_DEMUX], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "header", &mp_msg_levels[MSGT_HEADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "avsync", &mp_msg_levels[MSGT_AVSYNC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "autoq", &mp_msg_levels[MSGT_AUTOQ], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "cfgparser", &mp_msg_levels[MSGT_CFGPARSER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "decaudio", &mp_msg_levels[MSGT_DECAUDIO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "decvideo", &mp_msg_levels[MSGT_DECVIDEO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "seek", &mp_msg_levels[MSGT_SEEK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "win32", &mp_msg_levels[MSGT_WIN32], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "open", &mp_msg_levels[MSGT_OPEN], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "dvd", &mp_msg_levels[MSGT_DVD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "parsees", &mp_msg_levels[MSGT_PARSEES], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "lirc", &mp_msg_levels[MSGT_LIRC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "stream", &mp_msg_levels[MSGT_STREAM], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "cache", &mp_msg_levels[MSGT_CACHE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "xacodec", &mp_msg_levels[MSGT_XACODEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "tv", &mp_msg_levels[MSGT_TV], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "radio", &mp_msg_levels[MSGT_RADIO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "osdep", &mp_msg_levels[MSGT_OSDEP], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "spudec", &mp_msg_levels[MSGT_SPUDEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "playtree", &mp_msg_levels[MSGT_PLAYTREE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "input", &mp_msg_levels[MSGT_INPUT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "vfilter", &mp_msg_levels[MSGT_VFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "osd", &mp_msg_levels[MSGT_OSD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "network", &mp_msg_levels[MSGT_NETWORK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "cpudetect", &mp_msg_levels[MSGT_CPUDETECT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "codeccfg", &mp_msg_levels[MSGT_CODECCFG], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "sws", &mp_msg_levels[MSGT_SWS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "vobsub", &mp_msg_levels[MSGT_VOBSUB], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "subreader", &mp_msg_levels[MSGT_SUBREADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "afilter", &mp_msg_levels[MSGT_AFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "netst", &mp_msg_levels[MSGT_NETST], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "muxer", &mp_msg_levels[MSGT_MUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "osd-menu", &mp_msg_levels[MSGT_OSD_MENU], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "identify", &mp_msg_levels[MSGT_IDENTIFY], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "ass", &mp_msg_levels[MSGT_ASS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "statusline", &mp_msg_levels[MSGT_STATUSLINE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    { "fixme", &mp_msg_levels[MSGT_FIXME], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
-    {"help", "Available msg modules:\n"
-    "   global     - common player errors/information\n"
-    "   cplayer    - console player (mplayer.c)\n"
-    "   vo         - libvo\n"
-    "   ao         - libao\n"
-    "   demuxer    - demuxer.c (general stuff)\n"
-    "   ds         - demux stream (add/read packet etc)\n"
-    "   demux      - fileformat-specific stuff (demux_*.c)\n"
-    "   header     - fileformat-specific header (*header.c)\n"
-    "   avsync     - mplayer.c timer stuff\n"
-    "   autoq      - mplayer.c auto-quality stuff\n"
-    "   cfgparser  - cfgparser.c\n"
-    "   decaudio   - av decoder\n"
-    "   decvideo\n"
-    "   seek       - seeking code\n"
-    "   win32      - win32 dll stuff\n"
-    "   open       - open.c (stream opening)\n"
-    "   dvd        - open.c (DVD init/read/seek)\n"
-    "   parsees    - parse_es.c (mpeg stream parser)\n"
-    "   lirc       - lirc_mp.c and input lirc driver\n"
-    "   stream     - stream.c\n"
-    "   cache      - cache2.c\n"
-    "   xacodec    - XAnim codecs\n"
-    "   tv         - TV input subsystem\n"
-    "   osdep      - OS-dependent parts\n"
-    "   spudec     - spudec.c\n"
-    "   playtree   - Playtree handling (playtree.c, playtreeparser.c)\n"
-    "   input\n"
-    "   vfilter\n"
-    "   osd\n"
-    "   network\n"
-    "   cpudetect\n"
-    "   codeccfg\n"
-    "   sws\n"
-    "   vobsub\n"
-    "   subreader\n"
-    "   osd-menu   - OSD menu messages\n"
-    "   afilter    - Audio filter messages\n"
-    "   netst      - Netstream\n"
-    "   muxer      - muxer layer\n"
-    "   identify   - identify output\n"
-    "   ass        - libass messages\n"
-    "   statusline - playback/encoding status line\n"
-    "   fixme      - messages not yet fixed to map to module\n"
-    "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-
-};
-
-extern const m_option_t noconfig_opts[];
-
-extern const m_option_t lavc_decode_opts_conf[];
-extern const m_option_t xvid_dec_opts[];
-
-const m_option_t common_opts[] = {
-// ------------------------- common options --------------------
-    OPT_MAKE_FLAGS("quiet", quiet, CONF_GLOBAL),
-    {"really-quiet", &verbose, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL},
-    {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
-        {"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
-    {"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
-    {"nomsgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
-    {"msgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
-    {"nomsgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
-#ifdef CONFIG_ICONV
-    {"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
-#endif
-#ifdef CONFIG_PRIORITY
-    {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
-#endif
-    {"codecpath", &codec_path, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    OPT_CHOICE("noconfig", noconfig, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE,
-               ({"off", 0}, {"user", 1}, {"system", 2}, {"all", 3})),
-
-// ------------------------- stream options --------------------
-
-#ifdef CONFIG_STREAM_CACHE
-    {"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 32, 1048576, NULL},
-    {"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    OPT_FLOATRANGE("cache-min", stream_cache_min_percent, 0, 0, 99),
-    OPT_FLOATRANGE("cache-seek-min", stream_cache_seek_min_percent, 0, 0, 99),
-#else
-    {"cache", "MPlayer was compiled without cache2 support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_STREAM_CACHE */
-    {"vcd", "-vcd N has been removed, use vcd://N instead.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL},
-    {"cuefile", "-cuefile has been removed, use cue://filename:N where N is the track number.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"cdrom-device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
-#ifdef CONFIG_DVDREAD
-    {"dvd-device", &dvd_device,  CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"dvd-speed", &dvd_speed, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"dvd", "-dvd N has been removed, use dvd://N instead.\n" , CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
-#else
-    {"dvd-device", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"dvd-speed", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"dvd", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_DVDREAD */
-    OPT_INTPAIR("chapter", chapterrange, 0),
-    OPT_INTRANGE("edition", edition_id, 0, -1, 8190),
-#ifdef CONFIG_LIBBLURAY
-    {"bluray-device",  &bluray_device,  CONF_TYPE_STRING, 0,          0,  0, NULL},
-    {"bluray-angle",   &bluray_angle,   CONF_TYPE_INT,    CONF_RANGE, 0, 999, NULL},
-    {"bluray-chapter", &bluray_chapter, CONF_TYPE_INT,    CONF_RANGE, 0, 999, NULL},
-#else
-    {"bluray-device",  "MPlayer was compiled without libbluray support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"bluray-angle",   "MPlayer was compiled without libbluray support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"bluray-chapter", "MPlayer was compiled without libbluray support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_LIBBLURAY */
-
-    {"dvdauth", "libcss is obsolete. Try libdvdread instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"dvdkey", "libcss is obsolete. Try libdvdread instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"csslib", "libcss is obsolete. Try libdvdread instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-
-#ifdef CONFIG_NETWORKING
-    {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
-    {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"referrer", &network_referrer, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"nocookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"cookies-file", &cookies_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"prefer-ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"reuse-socket", &reuse_socket, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
-    {"noreuse-socket", &reuse_socket, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
-#ifdef HAVE_AF_INET6
-    {"prefer-ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-#else
-    {"prefer-ipv6", "MPlayer was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-#endif /* HAVE_AF_INET6 */
-
-#else
-    {"user", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"passwd", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"bandwidth", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"user-agent", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_NETWORKING */
-
-#ifdef CONFIG_LIVE555
-    {"sdp", "-sdp has been removed, use sdp://file instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-    {"rtsp-stream-over-http", &rtsp_transport_http, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#else
-    {"rtsp-stream-over-http", "-rtsp-stream-over-http requires the \"LIVE555 Streaming Media\" library.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_LIVE555 */
-#if defined(CONFIG_LIBNEMESI) || defined(CONFIG_LIVE555)
-    // -rtsp-stream-over-tcp option, specifying TCP streaming of RTP/RTCP
-    {"rtsp-stream-over-tcp", &rtsp_transport_tcp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#else
-    {"rtsp-stream-over-tcp", "-rtsp-stream-over-tcp requires the \"LIVE555 Streaming Media\" or \"libnemesi\" libraries.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* defined(CONFIG_LIBNEMESI) || defined(CONFIG_LIVE555) */
-#ifdef CONFIG_LIBNEMESI
-    {"rtsp-stream-over-sctp", &rtsp_transport_sctp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#else
-    {"rtsp-stream-over-sctp", "-rtsp-stream-over-sctp requires the \"libnemesi\" library\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_LIBNEMESI */
-#ifdef CONFIG_NETWORKING
-    {"rtsp-port", &rtsp_port, CONF_TYPE_INT, CONF_RANGE, -1, 65535, NULL},
-    {"rtsp-destination", &rtsp_destination, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL},
-#else
-    {"rtsp-port", "MPlayer was compiled without networking support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"rtsp-destination", "MPlayer was compiled without networking support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_NETWORKING */
-
-// ------------------------- demuxer options --------------------
-
-    // number of frames to play/convert
-    {"frames", &play_n_frames_mf, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
-
-    // seek to byte/seconds position
-    {"sb", &seek_to_byte, CONF_TYPE_POSITION, CONF_MIN, 0, 0, NULL},
-    {"ss", &seek_to_sec, CONF_TYPE_TIME, 0, 0, 0, NULL},
-
-    // stop at given position
-    {"endpos", &end_at, CONF_TYPE_TIME_SIZE, 0, 0, 0, NULL},
-
-    {"edl", &edl_filename,  CONF_TYPE_STRING, 0, 0, 0, NULL},
-
-    // AVI specific: force non-interleaved mode
-    {"ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"noni", &force_ni, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-
-    // AVI and Ogg only: (re)build index at startup
-    {"noidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 0, NULL},
-    {"idx", &index_mode, CONF_TYPE_FLAG, 0, -1, 1, NULL},
-    {"forceidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 2, NULL},
-    {"saveidx", &index_file_save, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"loadidx", &index_file_load, CONF_TYPE_STRING, 0, 0, 0, NULL},
-
-    // select audio/video/subtitle stream
-    OPT_INTRANGE("aid", audio_id, 0, -2, 8190),
-    {"ausid", &audio_substream_id, CONF_TYPE_INT, 0, 0, 0, NULL},
-    OPT_INTRANGE("vid", video_id, 0, -2, 8190),
-    OPT_INTRANGE("sid", sub_id, 0, -2, 8190),
-    OPT_FLAG_CONSTANTS("nosub", sub_id, 0, -1, -2),
-    OPT_FLAG_CONSTANTS("novideo", video_id, 0, -1, -2),
-    OPT_FLAG_CONSTANTS("sound", audio_id, 0, -2, -1),
-    OPT_FLAG_CONSTANTS("nosound", audio_id, 0, -1, -2),
-    OPT_STRING("alang", audio_lang, 0),
-    OPT_STRING("slang", sub_lang, 0),
-
-    OPT_MAKE_FLAGS("hr-mp3-seek", hr_mp3_seek, 0),
-
-    { "rawaudio", &demux_rawaudio_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-    { "rawvideo", &demux_rawvideo_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-
-#ifdef CONFIG_CDDA
-    { "cdda", &cdda_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-#endif
-
-    // demuxer.c - select audio/sub file/demuxer
-    OPT_STRING("audiofile", audio_stream, 0),
-    OPT_INTRANGE("audiofile-cache", audio_stream_cache, 0, 50, 65536),
-    OPT_STRING("subfile", sub_stream, 0),
-    OPT_STRING("demuxer", demuxer_name, 0),
-    OPT_STRING("audio-demuxer", audio_demuxer_name, 0),
-    OPT_STRING("sub-demuxer", sub_demuxer_name, 0),
-    OPT_MAKE_FLAGS("extbased", extension_parsing, 0),
-
-    {"mf", (void *) mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL},
-#ifdef CONFIG_RADIO
-    {"radio", radioopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-#else
-    {"radio", "MPlayer was compiled without Radio interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-#endif /* CONFIG_RADIO */
-#ifdef CONFIG_TV
-    {"tv", (void *) tvopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-#else
-    {"tv", "MPlayer was compiled without TV interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-#endif /* CONFIG_TV */
-#ifdef CONFIG_PVR
-    {"pvr", (void *) pvropts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-#else
-    {"pvr", "MPlayer was compiled without V4L2/PVR interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-#endif /* CONFIG_PVR */
-    {"vivo", (void *) vivoopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-#ifdef CONFIG_DVBIN
-    {"dvbin", (void *) dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-#endif
-
-// ------------------------- a-v sync options --------------------
-
-    // AVI specific: A-V sync mode (bps vs. interleaving)
-    {"bps", &pts_from_bps, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"nobps", &pts_from_bps, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-
-    // set A-V sync correction speed (0=disables it):
-    {"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
-
-    // force video/audio rate:
-    {"fps", &force_fps, CONF_TYPE_DOUBLE, CONF_MIN, 0, 0, NULL},
-    {"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL},
-    OPT_INTRANGE("channels", audio_output_channels, 0, 1, 8),
-    OPT_AUDIOFORMAT("format", audio_output_format, 0),
-    OPT_FLOATRANGE("speed", playback_speed, 0, 0.01, 100.0),
-
-    // set a-v distance
-    {"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
-
-    // ignore header-specified delay (dwStart)
-    {"ignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"noignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-
-    OPT_FLOATRANGE("a52drc", drc_level, 0, 0, 2),
-
-// ------------------------- codec/vfilter options --------------------
-
-    // MP3-only: select stereo/left/right
-#ifdef CONFIG_FAKE_MONO
-    {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
-#endif
-
-    {"af*", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-    {"af-adv", (void *) audio_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-
-    {"vop", "-vop has been removed, use -vf instead.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL},
-        OPT_SETTINGSLIST("vf*", vf_settings, 0, &vf_obj_list),
-    // select audio/video codec (by name) or codec family (by number):
-    {"afm", &audio_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-    {"vfm", &video_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-    {"ac", &audio_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-    {"vc", &video_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-
-    // postprocessing:
-#ifdef CONFIG_FFMPEG
-    {"pp", &divx_quality, CONF_TYPE_INT, 0, 0, 0, NULL},
-    {"pphelp", &pp_help, CONF_TYPE_PRINT_INDIRECT, CONF_NOCFG, 0, 0, NULL},
-#endif
-
-    // scaling:
-    {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL},
-    {"ssf", (void *) scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-    OPT_MAKE_FLAGS("zoom", softzoom, 0),
-    OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.2, 3.0),
-    OPT_FLAG_CONSTANTS("noaspect", movie_aspect, 0, 0, 0),
-    OPT_FLOATRANGE("xy", screen_size_xy, 0, 0.001, 4096),
-
-    OPT_FLAG_CONSTANTS("flip", flip, 0, -1, 1),
-    OPT_FLAG_CONSTANTS("noflip", flip, 0, -1, 0),
-    {"tsfastparse", "-tsfastparse is no longer a valid option.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL
-},
-    {"tsprog", &ts_prog, CONF_TYPE_INT, CONF_RANGE, 0, 65534, NULL},
-    {"tsprobe", &ts_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
-    {"psprobe", &ps_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
-    {"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-
-    // draw by slices or whole frame (useful with libmpeg2/libavcodec)
-    OPT_MAKE_FLAGS("slices", vd_use_slices, 0),
-    {"field-dominance", &field_dominance, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL},
-
-#ifdef CONFIG_FFMPEG
-    {"lavdopts", (void *) lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-    {"lavfdopts", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
-#endif
-#ifdef CONFIG_XVID4
-    {"xvidopts", xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-#endif
-    {"codecs-file", &codecs_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
-// ------------------------- subtitles options --------------------
-
-    {"sub", &sub_name, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-#ifdef CONFIG_FRIBIDI
-    {"fribidi-charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"flip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"noflip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"flip-hebrew-commas", &fribidi_flip_commas, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"noflip-hebrew-commas", &fribidi_flip_commas, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#else
-    {"fribidi-charset", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"flip-hebrew", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"noflip-hebrew", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"flip-hebrew-commas", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"noflip-hebrew-commas", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_FRIBIDI */
-#ifdef CONFIG_ICONV
-    {"subcp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL},
-#endif
-    {"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
-    {"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
-    {"autosub", &sub_auto, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"noutf8", &sub_utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"forcedsubsonly", &forced_subs_only, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    // specify IFO file for VOBSUB subtitle
-    {"ifo", &spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    // enable Closed Captioning display
-    {"subcc", &subcc_enabled, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL},
-    {"nosubcc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"overlapsub", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 2, NULL},
-    {"nooverlapsub", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 0, NULL},
-    {"sub-bg-color", &sub_bg_color, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
-    {"sub-bg-alpha", &sub_bg_alpha, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
-    {"sub-no-text-pp", &sub_no_text_pp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"sub-fuzziness", &sub_match_fuzziness, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
-    {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"subfont", &sub_font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
-    {"subpos", &sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
-    {"subalign", &sub_alignment, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
-    {"subwidth", &sub_width_p, CONF_TYPE_INT, CONF_RANGE, 10, 100, NULL},
-    {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL},
-    {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
-    {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, NULL},
-#ifdef CONFIG_FREETYPE
-    {"subfont-encoding", &subtitle_font_encoding, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"subfont-text-scale", &text_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
-    {"subfont-osd-scale", &osd_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
-    {"subfont-blur", &subtitle_font_radius, CONF_TYPE_FLOAT, CONF_RANGE, 0, 8, NULL},
-    {"subfont-outline", &subtitle_font_thickness, CONF_TYPE_FLOAT, CONF_RANGE, 0, 8, NULL},
-    {"subfont-autoscale", &subtitle_autoscale, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
-#endif
-#ifdef CONFIG_ASS
-    OPT_MAKE_FLAGS("ass", ass_enabled, 0),
-    {"ass-font-scale", &ass_font_scale, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
-    {"ass-line-spacing", &ass_line_spacing, CONF_TYPE_FLOAT, CONF_RANGE, -1000, 1000, NULL},
-    {"ass-top-margin", &ass_top_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL},
-    {"ass-bottom-margin", &ass_bottom_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL},
-    {"ass-use-margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"noass-use-margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"embeddedfonts", &use_embedded_fonts, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-    {"noembeddedfonts", &use_embedded_fonts, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-    {"ass-force-style", &ass_force_style_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
-    {"ass-color", &ass_color, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"ass-border-color", &ass_border_color, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"ass-styles", &ass_styles_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
-    {"ass-hinting", &ass_hinting, CONF_TYPE_INT, CONF_RANGE, 0, 7, NULL},
-#endif
-#ifdef CONFIG_FONTCONFIG
-    {"fontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, -1, 1, NULL},
-    {"nofontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, 1, -1, NULL},
-#else
-    {"fontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-    {"nofontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_FONTCONFIG */
-    {NULL, NULL, 0, 0, 0, 0, NULL}
-};
-
-#endif /* MPLAYER_CFG_COMMON_H */
diff --git a/mplayer/cfg-mplayer-def.h b/mplayer/cfg-mplayer-def.h
deleted file mode 100644
index 720b800..0000000
--- a/mplayer/cfg-mplayer-def.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_CFG_MPLAYER_DEF_H
-#define MPLAYER_CFG_MPLAYER_DEF_H
-
-static char* default_config=
-"# Write your default config options here!\n"
-"\n"
-//"nosound=nem"
-"\n";
-
-#endif /* MPLAYER_CFG_MPLAYER_DEF_H */
diff --git a/mplayer/cfg-mplayer.h b/mplayer/cfg-mplayer.h
index e2a52ee..a4dd498 100644
--- a/mplayer/cfg-mplayer.h
+++ b/mplayer/cfg-mplayer.h
@@ -24,9 +24,15 @@
  */
 
 #include <stddef.h>
+#include <sys/types.h>
 
-#include "cfg-common.h"
 #include "options.h"
+#include "config.h"
+#include "m_config.h"
+#include "m_option.h"
+#include "libmpdemux/demux_ts.h"
+#include "stream/tv.h"
+#include "stream/stream_radio.h"
 
 extern char *fb_mode_cfgfile;
 extern char *fb_mode_name;
@@ -46,6 +52,679 @@ extern int menu_fribidi_flip_commas;
 
 extern char *unrar_executable;
 
+extern char *mp_msg_charset;
+extern int mp_msg_color;
+extern int mp_msg_module;
+
+/* defined in codec-cfg.c */
+extern char *codecs_file;
+
+/* defined in dec_video.c */
+extern int field_dominance;
+
+/* from dec_audio, currently used for ac3surround decoder only */
+extern int fakemono;
+
+/* defined in network.c */
+extern char *network_username;
+extern char *network_password;
+extern int   network_bandwidth;
+extern char *network_useragent;
+extern char *network_referrer;
+extern int   network_cookies_enabled;
+extern char *cookies_file;
+
+extern int network_prefer_ipv4;
+extern int network_ipv4_only_proxy;
+extern int reuse_socket;
+
+extern int dvd_speed; /* stream/stream_dvd.c */
+
+/* defined in libmpdemux: */
+extern const m_option_t demux_rawaudio_opts[];
+extern const m_option_t demux_rawvideo_opts[];
+extern const m_option_t cdda_opts[];
+
+extern int ts_prog;
+extern int ts_keep_broken;
+extern off_t ts_probe;
+extern int audio_substream_id;
+extern off_t ps_probe;
+
+extern int sws_flags;
+extern char* pp_help;
+
+#ifdef CONFIG_RADIO
+const m_option_t radioopts_conf[]={
+    {"device", &stream_radio_defaults.device, CONF_TYPE_STRING, 0, 0 ,0, NULL},
+    {"driver", &stream_radio_defaults.driver, CONF_TYPE_STRING, 0, 0 ,0, NULL},
+#ifdef RADIO_BSDBT848_HDR
+    {"freq_min", &stream_radio_defaults.freq_min, CONF_TYPE_FLOAT, 0, 0 ,0, NULL},
+    {"freq_max", &stream_radio_defaults.freq_max, CONF_TYPE_FLOAT, 0, 0 ,0, NULL},
+#endif
+    {"channels", &stream_radio_defaults.channels, CONF_TYPE_STRING_LIST, 0, 0 ,0, NULL},
+    {"volume", &stream_radio_defaults.volume, CONF_TYPE_INT, CONF_RANGE, 0 ,100, NULL},
+    {"adevice", &stream_radio_defaults.adevice, CONF_TYPE_STRING, 0, 0 ,0, NULL},
+    {"arate", &stream_radio_defaults.arate, CONF_TYPE_INT, CONF_MIN, 0 ,0, NULL},
+    {"achannels", &stream_radio_defaults.achannels, CONF_TYPE_INT, CONF_MIN, 0 ,0, NULL},
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+#endif /* CONFIG_RADIO */
+
+#ifdef CONFIG_TV
+const m_option_t tvopts_conf[]={
+    {"on", "-tv on has been removed, use tv:// instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"immediatemode", &stream_tv_defaults.immediate, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
+    {"noaudio", &stream_tv_defaults.noaudio, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"audiorate", &stream_tv_defaults.audiorate, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"driver", &stream_tv_defaults.driver, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"device", &stream_tv_defaults.device, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"freq", &stream_tv_defaults.freq, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"channel", &stream_tv_defaults.channel, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"chanlist", &stream_tv_defaults.chanlist, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"norm", &stream_tv_defaults.norm, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"automute", &stream_tv_defaults.automute, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
+#if defined(CONFIG_TV_V4L2) || defined(CONFIG_TV_DSHOW)
+    {"normid", &stream_tv_defaults.normid, CONF_TYPE_INT, 0, 0, 0, NULL},
+#endif
+    {"width", &stream_tv_defaults.width, CONF_TYPE_INT, 0, 0, 4096, NULL},
+    {"height", &stream_tv_defaults.height, CONF_TYPE_INT, 0, 0, 4096, NULL},
+    {"input", &stream_tv_defaults.input, CONF_TYPE_INT, 0, 0, 20, NULL},
+    {"outfmt", &stream_tv_defaults.outfmt, CONF_TYPE_IMGFMT, 0, 0, 0, NULL},
+    {"fps", &stream_tv_defaults.fps, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
+    {"channels", &stream_tv_defaults.channels, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+    {"brightness", &stream_tv_defaults.brightness, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
+    {"contrast", &stream_tv_defaults.contrast, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
+    {"hue", &stream_tv_defaults.hue, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
+    {"saturation", &stream_tv_defaults.saturation, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
+    {"gain", &stream_tv_defaults.gain, CONF_TYPE_INT, CONF_RANGE, -1, 100, NULL},
+#if defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2) || defined(CONFIG_TV_DSHOW)
+    {"buffersize", &stream_tv_defaults.buffer_size, CONF_TYPE_INT, CONF_RANGE, 16, 1024, NULL},
+    {"amode", &stream_tv_defaults.amode, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
+    {"volume", &stream_tv_defaults.volume, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
+#endif
+#if defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2)
+    {"bass", &stream_tv_defaults.bass, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
+    {"treble", &stream_tv_defaults.treble, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
+    {"balance", &stream_tv_defaults.balance, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
+    {"forcechan", &stream_tv_defaults.forcechan, CONF_TYPE_INT, CONF_RANGE, 1, 2, NULL},
+    {"forceaudio", &stream_tv_defaults.force_audio, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"buffersize", &stream_tv_defaults.buffer_size, CONF_TYPE_INT, CONF_RANGE, 16, 1024, NULL},
+    {"mjpeg", &stream_tv_defaults.mjpeg, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"decimation", &stream_tv_defaults.decimation, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
+    {"quality", &stream_tv_defaults.quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
+#ifdef CONFIG_ALSA
+    {"alsa", &stream_tv_defaults.alsa, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+#endif /* CONFIG_ALSA */
+#endif /* defined(CONFIG_TV_V4L) || defined(CONFIG_TV_V4L2) */
+    {"adevice", &stream_tv_defaults.adevice, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"tdevice", &stream_tv_defaults.teletext.device, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"tpage", &stream_tv_defaults.teletext.page, CONF_TYPE_INT, CONF_RANGE, 100, 899, NULL},
+    {"tformat", &stream_tv_defaults.teletext.format, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
+    {"tlang", &stream_tv_defaults.teletext.lang, CONF_TYPE_INT, CONF_RANGE, -1, 0x7f, NULL},
+    {"audioid", &stream_tv_defaults.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL},
+#ifdef CONFIG_TV_DSHOW
+    {"hidden_video_renderer", &stream_tv_defaults.hidden_video_renderer, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nohidden_video_renderer", &stream_tv_defaults.hidden_video_renderer, CONF_TYPE_FLAG, 0, 0, 0, NULL},
+    {"hidden_vp_renderer", &stream_tv_defaults.hidden_vp_renderer, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nohidden_vp_renderer", &stream_tv_defaults.hidden_vp_renderer, CONF_TYPE_FLAG, 0, 0, 0, NULL},
+    {"system_clock", &stream_tv_defaults.system_clock, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nosystem_clock", &stream_tv_defaults.system_clock, CONF_TYPE_FLAG, 0, 0, 0, NULL},
+    {"normalize_audio_chunks", &stream_tv_defaults.normalize_audio_chunks, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nonormalize_audio_chunks", &stream_tv_defaults.normalize_audio_chunks, CONF_TYPE_FLAG, 0, 0, 0, NULL},
+#endif
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+#endif /* CONFIG_TV */
+
+extern int pvr_param_aspect_ratio;
+extern int pvr_param_sample_rate;
+extern int pvr_param_audio_layer;
+extern int pvr_param_audio_bitrate;
+extern char *pvr_param_audio_mode;
+extern int pvr_param_bitrate;
+extern char *pvr_param_bitrate_mode;
+extern int pvr_param_bitrate_peak;
+extern char *pvr_param_stream_type;
+
+#ifdef CONFIG_PVR
+const m_option_t pvropts_conf[]={
+    {"aspect", &pvr_param_aspect_ratio, CONF_TYPE_INT, 0, 1, 4, NULL},
+    {"arate", &pvr_param_sample_rate, CONF_TYPE_INT, 0, 32000, 48000, NULL},
+    {"alayer", &pvr_param_audio_layer, CONF_TYPE_INT, 0, 1, 2, NULL},
+    {"abitrate", &pvr_param_audio_bitrate, CONF_TYPE_INT, 0, 32, 448, NULL},
+    {"amode", &pvr_param_audio_mode, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"vbitrate", &pvr_param_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"vmode", &pvr_param_bitrate_mode, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"vpeak", &pvr_param_bitrate_peak, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"fmt", &pvr_param_stream_type, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+#endif /* CONFIG_PVR */
+
+extern const m_option_t dvbin_opts_conf[];
+extern const m_option_t lavfdopts_conf[];
+
+extern int rtsp_transport_tcp;
+extern int rtsp_transport_http;
+extern int rtsp_transport_sctp;
+extern int rtsp_port;
+extern char *rtsp_destination;
+
+
+extern int sws_chr_vshift;
+extern int sws_chr_hshift;
+extern float sws_chr_gblur;
+extern float sws_lum_gblur;
+extern float sws_chr_sharpen;
+extern float sws_lum_sharpen;
+
+const m_option_t scaler_filter_conf[]={
+    {"lgb", &sws_lum_gblur, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
+    {"cgb", &sws_chr_gblur, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
+    {"cvs", &sws_chr_vshift, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"chs", &sws_chr_hshift, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"ls", &sws_lum_sharpen, CONF_TYPE_FLOAT, 0, -100.0, 100.0, NULL},
+    {"cs", &sws_chr_sharpen, CONF_TYPE_FLOAT, 0, -100.0, 100.0, NULL},
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
+/* VIVO demuxer options: */
+extern int vivo_param_version;
+extern char *vivo_param_acodec;
+extern int vivo_param_abitrate;
+extern int vivo_param_samplerate;
+extern int vivo_param_bytesperblock;
+extern int vivo_param_width;
+extern int vivo_param_height;
+extern int vivo_param_vformat;
+extern char *dvd_device, *cdrom_device;
+
+const m_option_t vivoopts_conf[]={
+    {"version", &vivo_param_version, CONF_TYPE_INT, 0, 0, 0, NULL},
+    /* audio options */
+    {"acodec", &vivo_param_acodec, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"abitrate", &vivo_param_abitrate, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"samplerate", &vivo_param_samplerate, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"bytesperblock", &vivo_param_bytesperblock, CONF_TYPE_INT, 0, 0, 0, NULL},
+    /* video options */
+    {"width", &vivo_param_width, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"height", &vivo_param_height, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"vformat", &vivo_param_vformat, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
+extern int    mf_w;
+extern int    mf_h;
+extern double mf_fps;
+extern char * mf_type;
+extern m_obj_list_t vf_obj_list;
+
+const m_option_t mfopts_conf[]={
+    {"on", "-mf on has been removed, use mf:// instead.\n", CONF_TYPE_PRINT, 0, 0, 1, NULL},
+    {"w", &mf_w, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"h", &mf_h, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"fps", &mf_fps, CONF_TYPE_DOUBLE, 0, 0, 0, NULL},
+    {"type", &mf_type, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
+#include "libaf/af.h"
+extern af_cfg_t af_cfg; // Audio filter configuration, defined in libmpcodecs/dec_audio.c
+const m_option_t audio_filter_conf[]={
+    {"list", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+    {"force", &af_cfg.force, CONF_TYPE_INT, CONF_RANGE, 0, 7, NULL},
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
+extern int mp_msg_levels[MSGT_MAX];
+extern int mp_msg_level_all;
+
+const m_option_t msgl_config[]={
+    { "all", &mp_msg_level_all, CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL},
+
+    { "global", &mp_msg_levels[MSGT_GLOBAL], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "cplayer", &mp_msg_levels[MSGT_CPLAYER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "vo", &mp_msg_levels[MSGT_VO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "ao", &mp_msg_levels[MSGT_AO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "demuxer", &mp_msg_levels[MSGT_DEMUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "ds", &mp_msg_levels[MSGT_DS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "demux", &mp_msg_levels[MSGT_DEMUX], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "header", &mp_msg_levels[MSGT_HEADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "avsync", &mp_msg_levels[MSGT_AVSYNC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "autoq", &mp_msg_levels[MSGT_AUTOQ], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "cfgparser", &mp_msg_levels[MSGT_CFGPARSER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "decaudio", &mp_msg_levels[MSGT_DECAUDIO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "decvideo", &mp_msg_levels[MSGT_DECVIDEO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "seek", &mp_msg_levels[MSGT_SEEK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "win32", &mp_msg_levels[MSGT_WIN32], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "open", &mp_msg_levels[MSGT_OPEN], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "dvd", &mp_msg_levels[MSGT_DVD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "parsees", &mp_msg_levels[MSGT_PARSEES], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "lirc", &mp_msg_levels[MSGT_LIRC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "stream", &mp_msg_levels[MSGT_STREAM], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "cache", &mp_msg_levels[MSGT_CACHE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "xacodec", &mp_msg_levels[MSGT_XACODEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "tv", &mp_msg_levels[MSGT_TV], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "radio", &mp_msg_levels[MSGT_RADIO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "osdep", &mp_msg_levels[MSGT_OSDEP], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "spudec", &mp_msg_levels[MSGT_SPUDEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "playtree", &mp_msg_levels[MSGT_PLAYTREE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "input", &mp_msg_levels[MSGT_INPUT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "vfilter", &mp_msg_levels[MSGT_VFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "osd", &mp_msg_levels[MSGT_OSD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "network", &mp_msg_levels[MSGT_NETWORK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "cpudetect", &mp_msg_levels[MSGT_CPUDETECT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "codeccfg", &mp_msg_levels[MSGT_CODECCFG], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "sws", &mp_msg_levels[MSGT_SWS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "vobsub", &mp_msg_levels[MSGT_VOBSUB], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "subreader", &mp_msg_levels[MSGT_SUBREADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "afilter", &mp_msg_levels[MSGT_AFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "netst", &mp_msg_levels[MSGT_NETST], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "muxer", &mp_msg_levels[MSGT_MUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "osd-menu", &mp_msg_levels[MSGT_OSD_MENU], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "identify", &mp_msg_levels[MSGT_IDENTIFY], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "ass", &mp_msg_levels[MSGT_ASS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "statusline", &mp_msg_levels[MSGT_STATUSLINE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    { "fixme", &mp_msg_levels[MSGT_FIXME], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
+    {"help", "Available msg modules:\n"
+    "   global     - common player errors/information\n"
+    "   cplayer    - console player (mplayer.c)\n"
+    "   vo         - libvo\n"
+    "   ao         - libao\n"
+    "   demuxer    - demuxer.c (general stuff)\n"
+    "   ds         - demux stream (add/read packet etc)\n"
+    "   demux      - fileformat-specific stuff (demux_*.c)\n"
+    "   header     - fileformat-specific header (*header.c)\n"
+    "   avsync     - mplayer.c timer stuff\n"
+    "   autoq      - mplayer.c auto-quality stuff\n"
+    "   cfgparser  - cfgparser.c\n"
+    "   decaudio   - av decoder\n"
+    "   decvideo\n"
+    "   seek       - seeking code\n"
+    "   win32      - win32 dll stuff\n"
+    "   open       - open.c (stream opening)\n"
+    "   dvd        - open.c (DVD init/read/seek)\n"
+    "   parsees    - parse_es.c (mpeg stream parser)\n"
+    "   lirc       - lirc_mp.c and input lirc driver\n"
+    "   stream     - stream.c\n"
+    "   cache      - cache2.c\n"
+    "   xacodec    - XAnim codecs\n"
+    "   tv         - TV input subsystem\n"
+    "   osdep      - OS-dependent parts\n"
+    "   spudec     - spudec.c\n"
+    "   playtree   - Playtree handling (playtree.c, playtreeparser.c)\n"
+    "   input\n"
+    "   vfilter\n"
+    "   osd\n"
+    "   network\n"
+    "   cpudetect\n"
+    "   codeccfg\n"
+    "   sws\n"
+    "   vobsub\n"
+    "   subreader\n"
+    "   osd-menu   - OSD menu messages\n"
+    "   afilter    - Audio filter messages\n"
+    "   netst      - Netstream\n"
+    "   muxer      - muxer layer\n"
+    "   identify   - identify output\n"
+    "   ass        - libass messages\n"
+    "   statusline - playback/encoding status line\n"
+    "   fixme      - messages not yet fixed to map to module\n"
+    "\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+
+};
+
+extern const m_option_t lavc_decode_opts_conf[];
+extern const m_option_t xvid_dec_opts[];
+
+const m_option_t common_opts[] = {
+// ------------------------- common options --------------------
+    OPT_MAKE_FLAGS("quiet", quiet, CONF_GLOBAL),
+    {"really-quiet", &verbose, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL},
+    {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
+        {"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+    {"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
+    {"nomsgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
+    {"msgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
+    {"nomsgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
+#ifdef CONFIG_ICONV
+    {"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
+#endif
+#ifdef CONFIG_PRIORITY
+    {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#endif
+    {"codecpath", &codec_path, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    OPT_CHOICE("noconfig", noconfig, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE,
+               ({"off", 0}, {"user", 1}, {"system", 2}, {"all", 3})),
+
+// ------------------------- stream options --------------------
+
+#ifdef CONFIG_STREAM_CACHE
+    {"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 32, 1048576, NULL},
+    {"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    OPT_FLOATRANGE("cache-min", stream_cache_min_percent, 0, 0, 99),
+    OPT_FLOATRANGE("cache-seek-min", stream_cache_seek_min_percent, 0, 0, 99),
+#else
+    {"cache", "MPlayer was compiled without cache2 support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_STREAM_CACHE */
+    {"vcd", "-vcd N has been removed, use vcd://N instead.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL},
+    {"cuefile", "-cuefile has been removed, use cue://filename:N where N is the track number.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"cdrom-device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#ifdef CONFIG_DVDREAD
+    {"dvd-device", &dvd_device,  CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"dvd-speed", &dvd_speed, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"dvd", "-dvd N has been removed, use dvd://N instead.\n" , CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
+#else
+    {"dvd-device", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"dvd-speed", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"dvd", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_DVDREAD */
+    OPT_INTPAIR("chapter", chapterrange, 0),
+    OPT_INTRANGE("edition", edition_id, 0, -1, 8190),
+#ifdef CONFIG_LIBBLURAY
+    {"bluray-device",  &bluray_device,  CONF_TYPE_STRING, 0,          0,  0, NULL},
+    {"bluray-angle",   &bluray_angle,   CONF_TYPE_INT,    CONF_RANGE, 0, 999, NULL},
+    {"bluray-chapter", &bluray_chapter, CONF_TYPE_INT,    CONF_RANGE, 0, 999, NULL},
+#else
+    {"bluray-device",  "MPlayer was compiled without libbluray support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"bluray-angle",   "MPlayer was compiled without libbluray support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"bluray-chapter", "MPlayer was compiled without libbluray support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_LIBBLURAY */
+
+    {"dvdauth", "libcss is obsolete. Try libdvdread instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"dvdkey", "libcss is obsolete. Try libdvdread instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"csslib", "libcss is obsolete. Try libdvdread instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+
+#ifdef CONFIG_NETWORKING
+    {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
+    {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"referrer", &network_referrer, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nocookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"cookies-file", &cookies_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"prefer-ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"reuse-socket", &reuse_socket, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
+    {"noreuse-socket", &reuse_socket, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
+#ifdef HAVE_AF_INET6
+    {"prefer-ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+#else
+    {"prefer-ipv6", "MPlayer was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+#endif /* HAVE_AF_INET6 */
+
+#else
+    {"user", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"passwd", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"bandwidth", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"user-agent", "MPlayer was compiled without streaming (network) support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_NETWORKING */
+
+#ifdef CONFIG_LIVE555
+    {"sdp", "-sdp has been removed, use sdp://file instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+    {"rtsp-stream-over-http", &rtsp_transport_http, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+#else
+    {"rtsp-stream-over-http", "-rtsp-stream-over-http requires the \"LIVE555 Streaming Media\" library.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_LIVE555 */
+#if defined(CONFIG_LIBNEMESI) || defined(CONFIG_LIVE555)
+    // -rtsp-stream-over-tcp option, specifying TCP streaming of RTP/RTCP
+    {"rtsp-stream-over-tcp", &rtsp_transport_tcp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+#else
+    {"rtsp-stream-over-tcp", "-rtsp-stream-over-tcp requires the \"LIVE555 Streaming Media\" or \"libnemesi\" libraries.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* defined(CONFIG_LIBNEMESI) || defined(CONFIG_LIVE555) */
+#ifdef CONFIG_LIBNEMESI
+    {"rtsp-stream-over-sctp", &rtsp_transport_sctp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+#else
+    {"rtsp-stream-over-sctp", "-rtsp-stream-over-sctp requires the \"libnemesi\" library\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_LIBNEMESI */
+#ifdef CONFIG_NETWORKING
+    {"rtsp-port", &rtsp_port, CONF_TYPE_INT, CONF_RANGE, -1, 65535, NULL},
+    {"rtsp-destination", &rtsp_destination, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL},
+#else
+    {"rtsp-port", "MPlayer was compiled without networking support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"rtsp-destination", "MPlayer was compiled without networking support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_NETWORKING */
+
+// ------------------------- demuxer options --------------------
+
+    // number of frames to play/convert
+    {"frames", &play_n_frames_mf, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
+
+    // seek to byte/seconds position
+    {"sb", &seek_to_byte, CONF_TYPE_POSITION, CONF_MIN, 0, 0, NULL},
+    {"ss", &seek_to_sec, CONF_TYPE_TIME, 0, 0, 0, NULL},
+
+    // stop at given position
+    {"endpos", &end_at, CONF_TYPE_TIME_SIZE, 0, 0, 0, NULL},
+
+    {"edl", &edl_filename,  CONF_TYPE_STRING, 0, 0, 0, NULL},
+
+    // AVI specific: force non-interleaved mode
+    {"ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"noni", &force_ni, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+
+    // AVI and Ogg only: (re)build index at startup
+    {"noidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 0, NULL},
+    {"idx", &index_mode, CONF_TYPE_FLAG, 0, -1, 1, NULL},
+    {"forceidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 2, NULL},
+    {"saveidx", &index_file_save, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"loadidx", &index_file_load, CONF_TYPE_STRING, 0, 0, 0, NULL},
+
+    // select audio/video/subtitle stream
+    OPT_INTRANGE("aid", audio_id, 0, -2, 8190),
+    {"ausid", &audio_substream_id, CONF_TYPE_INT, 0, 0, 0, NULL},
+    OPT_INTRANGE("vid", video_id, 0, -2, 8190),
+    OPT_INTRANGE("sid", sub_id, 0, -2, 8190),
+    OPT_FLAG_CONSTANTS("nosub", sub_id, 0, -1, -2),
+    OPT_FLAG_CONSTANTS("novideo", video_id, 0, -1, -2),
+    OPT_FLAG_CONSTANTS("sound", audio_id, 0, -2, -1),
+    OPT_FLAG_CONSTANTS("nosound", audio_id, 0, -1, -2),
+    OPT_STRINGLIST("alang", audio_lang, 0),
+    OPT_STRINGLIST("slang", sub_lang, 0),
+
+    OPT_MAKE_FLAGS("hr-mp3-seek", hr_mp3_seek, 0),
+
+    { "rawaudio", &demux_rawaudio_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+    { "rawvideo", &demux_rawvideo_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+
+#ifdef CONFIG_CDDA
+    { "cdda", &cdda_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+#endif
+
+    // demuxer.c - select audio/sub file/demuxer
+    OPT_STRING("audiofile", audio_stream, 0),
+    OPT_INTRANGE("audiofile-cache", audio_stream_cache, 0, 50, 65536),
+    OPT_STRING("subfile", sub_stream, 0),
+    OPT_STRING("demuxer", demuxer_name, 0),
+    OPT_STRING("audio-demuxer", audio_demuxer_name, 0),
+    OPT_STRING("sub-demuxer", sub_demuxer_name, 0),
+    OPT_MAKE_FLAGS("extbased", extension_parsing, 0),
+
+    {"mf", (void *) mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL},
+#ifdef CONFIG_RADIO
+    {"radio", radioopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+#else
+    {"radio", "MPlayer was compiled without Radio interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+#endif /* CONFIG_RADIO */
+#ifdef CONFIG_TV
+    {"tv", (void *) tvopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+#else
+    {"tv", "MPlayer was compiled without TV interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+#endif /* CONFIG_TV */
+#ifdef CONFIG_PVR
+    {"pvr", (void *) pvropts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+#else
+    {"pvr", "MPlayer was compiled without V4L2/PVR interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+#endif /* CONFIG_PVR */
+    {"vivo", (void *) vivoopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+#ifdef CONFIG_DVBIN
+    {"dvbin", (void *) dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+#endif
+
+// ------------------------- a-v sync options --------------------
+
+    // AVI specific: A-V sync mode (bps vs. interleaving)
+    {"bps", &pts_from_bps, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nobps", &pts_from_bps, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+
+    // set A-V sync correction speed (0=disables it):
+    {"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
+
+    // force video/audio rate:
+    {"fps", &force_fps, CONF_TYPE_DOUBLE, CONF_MIN, 0, 0, NULL},
+    {"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL},
+    OPT_INTRANGE("channels", audio_output_channels, 0, 1, 8),
+    OPT_AUDIOFORMAT("format", audio_output_format, 0),
+    OPT_FLOATRANGE("speed", playback_speed, 0, 0.01, 100.0),
+
+    // set a-v distance
+    {"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
+
+    // ignore header-specified delay (dwStart)
+    {"ignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"noignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+
+    OPT_FLOATRANGE("a52drc", drc_level, 0, 0, 2),
+
+// ------------------------- codec/vfilter options --------------------
+
+    // MP3-only: select stereo/left/right
+#ifdef CONFIG_FAKE_MONO
+    {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
+#endif
+
+    {"af*", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+    {"af-adv", (void *) audio_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+
+    {"vop", "-vop has been removed, use -vf instead.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL},
+        OPT_SETTINGSLIST("vf*", vf_settings, 0, &vf_obj_list),
+    // select audio/video codec (by name) or codec family (by number):
+    {"afm", &audio_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+    {"vfm", &video_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+    {"ac", &audio_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+    {"vc", &video_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+
+    // postprocessing:
+#ifdef CONFIG_FFMPEG
+    {"pp", &divx_quality, CONF_TYPE_INT, 0, 0, 0, NULL},
+    {"pphelp", &pp_help, CONF_TYPE_PRINT_INDIRECT, CONF_NOCFG, 0, 0, NULL},
+#endif
+
+    // scaling:
+    {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL},
+    {"ssf", (void *) scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+    OPT_MAKE_FLAGS("zoom", softzoom, 0),
+    OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.2, 3.0),
+    OPT_FLAG_CONSTANTS("noaspect", movie_aspect, 0, 0, 0),
+    OPT_FLOATRANGE("xy", screen_size_xy, 0, 0.001, 4096),
+
+    OPT_FLAG_CONSTANTS("flip", flip, 0, -1, 1),
+    OPT_FLAG_CONSTANTS("noflip", flip, 0, -1, 0),
+    {"tsfastparse", "-tsfastparse is no longer a valid option.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL
+},
+    {"tsprog", &ts_prog, CONF_TYPE_INT, CONF_RANGE, 0, 65534, NULL},
+    {"tsprobe", &ts_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
+    {"psprobe", &ps_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
+    {"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+
+    // draw by slices or whole frame (useful with libmpeg2/libavcodec)
+    OPT_MAKE_FLAGS("slices", vd_use_slices, 0),
+    {"field-dominance", &field_dominance, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL},
+
+#ifdef CONFIG_FFMPEG
+    {"lavdopts", (void *) lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+    {"lavfdopts", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+#endif
+#ifdef CONFIG_XVID4
+    {"xvidopts", (void *)xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+#endif
+    {"codecs-file", &codecs_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
+// ------------------------- subtitles options --------------------
+
+    OPT_STRINGLIST("sub", sub_name, 0),
+    OPT_PATHLIST("sub-paths", sub_paths, 0),
+#ifdef CONFIG_FRIBIDI
+    {"fribidi-charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"flip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"noflip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"flip-hebrew-commas", &fribidi_flip_commas, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"noflip-hebrew-commas", &fribidi_flip_commas, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+#else
+    {"fribidi-charset", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"flip-hebrew", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"noflip-hebrew", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"flip-hebrew-commas", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"noflip-hebrew-commas", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_FRIBIDI */
+#ifdef CONFIG_ICONV
+    {"subcp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#endif
+    {"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
+    {"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
+    OPT_MAKE_FLAGS("autosub", sub_auto, 0),
+    {"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"noutf8", &sub_utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"forcedsubsonly", &forced_subs_only, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    // specify IFO file for VOBSUB subtitle
+    {"ifo", &spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    // enable Closed Captioning display
+    {"subcc", &subcc_enabled, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL},
+    {"nosubcc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"overlapsub", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 2, NULL},
+    {"nooverlapsub", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 0, NULL},
+    {"sub-bg-color", &sub_bg_color, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
+    {"sub-bg-alpha", &sub_bg_alpha, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
+    {"sub-no-text-pp", &sub_no_text_pp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"sub-fuzziness", &sub_match_fuzziness, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
+    {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"subfont", &sub_font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
+    {"subpos", &sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
+    {"subalign", &sub_alignment, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
+    {"subwidth", &sub_width_p, CONF_TYPE_INT, CONF_RANGE, 10, 100, NULL},
+    {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL},
+    {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
+    {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, NULL},
+#ifdef CONFIG_FREETYPE
+    {"subfont-encoding", &subtitle_font_encoding, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"subfont-text-scale", &text_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
+    {"subfont-osd-scale", &osd_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
+    {"subfont-blur", &subtitle_font_radius, CONF_TYPE_FLOAT, CONF_RANGE, 0, 8, NULL},
+    {"subfont-outline", &subtitle_font_thickness, CONF_TYPE_FLOAT, CONF_RANGE, 0, 8, NULL},
+    {"subfont-autoscale", &subtitle_autoscale, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
+#endif
+#ifdef CONFIG_ASS
+    OPT_MAKE_FLAGS("ass", ass_enabled, 0),
+    {"ass-font-scale", &ass_font_scale, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
+    {"ass-line-spacing", &ass_line_spacing, CONF_TYPE_FLOAT, CONF_RANGE, -1000, 1000, NULL},
+    {"ass-top-margin", &ass_top_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL},
+    {"ass-bottom-margin", &ass_bottom_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL},
+    {"ass-use-margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"noass-use-margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"embeddedfonts", &use_embedded_fonts, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"noembeddedfonts", &use_embedded_fonts, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+    {"ass-force-style", &ass_force_style_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+    {"ass-color", &ass_color, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"ass-border-color", &ass_border_color, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"ass-styles", &ass_styles_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    {"ass-hinting", &ass_hinting, CONF_TYPE_INT, CONF_RANGE, 0, 7, NULL},
+#endif
+#ifdef CONFIG_FONTCONFIG
+    {"fontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, -1, 1, NULL},
+    {"nofontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, 1, -1, NULL},
+#else
+    {"fontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+    {"nofontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+#endif /* CONFIG_FONTCONFIG */
+    {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
 const m_option_t vd_conf[]={
     {"help", "Use MPlayer with an appropriate video file instead of live partners to avoid vd.\n", CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
     {NULL, NULL, 0, 0, 0, 0, NULL}
@@ -235,7 +914,7 @@ const m_option_t mplayer_opts[]={
     {"menu", "OSD menu support was not compiled in.\n", CONF_TYPE_PRINT,0, 0, 0, NULL},
 #endif /* CONFIG_MENU */
 
-    {"vobsub", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
+    OPT_STRING("vobsub", vobsub_name, 0),
     {"vobsubid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
 #ifdef CONFIG_UNRAR_EXEC
     {"unrarexec", &unrar_executable, CONF_TYPE_STRING, 0, 0, 0, NULL},
diff --git a/mplayer/command.c b/mplayer/command.c
index bc6aa3c..8aeff84 100644
--- a/mplayer/command.c
+++ b/mplayer/command.c
@@ -459,7 +459,7 @@ static int mp_property_percent_pos(m_option_t *prop, int action,
 /// Current position in seconds (RW)
 static int mp_property_time_pos(m_option_t *prop, int action,
                                 void *arg, MPContext *mpctx) {
-    if (!(mpctx->sh_video || (mpctx->sh_audio && mpctx->audio_out)))
+    if (!(mpctx->sh_video || mpctx->sh_audio))
         return M_PROPERTY_UNAVAILABLE;
 
     switch(action) {
@@ -991,8 +991,8 @@ static int mp_property_audio(m_option_t *prop, int action, void *arg,
             uninit_player(mpctx, INITIALIZED_AO | INITIALIZED_ACODEC);
         if (new_id != current_id && new_id >= 0) {
             sh_audio_t *sh2;
-            sh2 = mpctx->d_audio->demuxer->a_streams[mpctx->demuxer->audio->id];
-            sh2->ds = mpctx->demuxer->audio;
+            sh2 = mpctx->d_audio->demuxer->a_streams[mpctx->d_audio->id];
+            sh2->ds = mpctx->d_audio;
             mpctx->sh_audio = sh2;
             reinit_audio_chain(mpctx);
         }
@@ -1012,7 +1012,7 @@ static int mp_property_video(m_option_t *prop, int action, void *arg,
     int current_id, tmp;
     if (!mpctx->demuxer || !mpctx->d_video)
         return M_PROPERTY_UNAVAILABLE;
-    current_id = mpctx->d_video->id;
+    current_id = mpctx->sh_video ? mpctx->sh_video->vid : -2;
 
     switch (action) {
     case M_PROPERTY_GET:
@@ -1040,22 +1040,18 @@ static int mp_property_video(m_option_t *prop, int action, void *arg,
             tmp = *((int *) arg);
         else
             tmp = -1;
-        opts->video_id = demuxer_switch_video(mpctx->d_video->demuxer, tmp);
-        if (opts->video_id == -2
-            || (opts->video_id > -1 && mpctx->d_video->id != current_id
-                && current_id != -2))
+        int new_id = demuxer_switch_video(mpctx->d_video->demuxer, tmp);
+        if (new_id != current_id)
             uninit_player(mpctx, INITIALIZED_VCODEC |
-                          (mpctx->opts.fixed_vo && opts->video_id != -2 ? 0 : INITIALIZED_VO));
-        if (opts->video_id > -1 && mpctx->d_video->id != current_id) {
+                          (opts->fixed_vo && new_id >= 0 ? 0 : INITIALIZED_VO));
+        if (new_id != current_id && new_id >= 0) {
             sh_video_t *sh2;
             sh2 = mpctx->d_video->demuxer->v_streams[mpctx->d_video->id];
-            if (sh2) {
-                sh2->ds = mpctx->d_video;
-                mpctx->sh_video = sh2;
-                reinit_video_chain(mpctx);
-            }
+            sh2->ds = mpctx->d_video;
+            mpctx->sh_video = sh2;
+            reinit_video_chain(mpctx);
         }
-        mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_TRACK=%d\n", opts->video_id);
+        mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_TRACK=%d\n", new_id);
         return M_PROPERTY_OK;
 
     default:
diff --git a/mplayer/configure b/mplayer/configure
index 21360b3..53b58f3 100755
--- a/mplayer/configure
+++ b/mplayer/configure
@@ -376,7 +376,6 @@ Codecs:
   --disable-mad             disable libmad (MPEG audio) support [autodetect]
   --enable-xmms             enable XMMS input plugin support [disabled]
   --enable-libdca           enable libdca support [autodetect]
-  --disable-mp3lib          disable builtin mp3lib [autodetect]
   --disable-liba52          disable liba52 [autodetect]
   --enable-musepack         enable libmpcdec support (deprecated, libavcodec
                             Musepack decoder is preferred) [disabled]
@@ -508,8 +507,6 @@ Use these options if autodetection fails:
   --with-xvmclib=NAME         adapter-specific library name (e.g. XvMCNVIDIA)
 
   --with-freetype-config=PATH path to freetype-config
-  --with-glib-config=PATH     path to glib*-config
-  --with-gtk-config=PATH      path to gtk*-config
   --with-sdl-config=PATH      path to sdl*-config
   --with-dvdnav-config=PATH   path to dvdnav-config
   --with-dvdread-config=PATH  path to dvdread-config
@@ -610,7 +607,6 @@ _libvorbis=auto
 _speex=auto
 _theora=auto
 _mpg123=auto
-_mp3lib=auto
 _liba52=auto
 _libdca=auto
 _faad=auto
@@ -663,8 +659,6 @@ _lirc=auto
 _lircc=auto
 _apple_remote=auto
 _apple_ir=auto
-_gui=no
-_gtk1=no
 _termcap=auto
 _termios=auto
 _3dfx=no
@@ -763,12 +757,6 @@ for ac_option do
   --with-freetype-config=*)
     _freetypeconfig=$(echo $ac_option | cut -d '=' -f 2)
     ;;
-  --with-gtk-config=*)
-    _gtkconfig=$(echo $ac_option | cut -d '=' -f 2)
-    ;;
-  --with-glib-config=*)
-    _glibconfig=$(echo $ac_option | cut -d '=' -f 2)
-    ;;
   --with-dvdnav-config=*)
     _dvdnavconfig=$(echo $ac_option | cut -d '=' -f 2)
     ;;
@@ -965,8 +953,6 @@ for ac_option do
   --disable-theora)     _theora=no      ;;
   --enable-mpg123)      _mpg123=yes     ;;
   --disable-mpg123)     _mpg123=no      ;;
-  --enable-mp3lib)      _mp3lib=yes     ;;
-  --disable-mp3lib)     _mp3lib=no      ;;
   --enable-liba52)      _liba52=yes     ;;
   --disable-liba52)     _liba52=no      ;;
   --enable-libdca)      _libdca=yes     ;;
@@ -1066,10 +1052,6 @@ for ac_option do
   --disable-apple-remote) _apple_remote=no  ;;
   --enable-apple-ir)    _apple_ir=yes   ;;
   --disable-apple-ir)   _apple_ir=no    ;;
-  --enable-gui)         _gui=yes        ;;
-  --disable-gui)        _gui=no         ;;
-  --enable-gtk1)        _gtk1=yes       ;;
-  --disable-gtk1)       _gtk1=no        ;;
   --enable-termcap)     _termcap=yes    ;;
   --disable-termcap)    _termcap=no     ;;
   --enable-termios)     _termios=yes    ;;
@@ -1215,11 +1197,6 @@ for ac_option do
   esac
 done
 
-if test "$_gui" = yes ; then
-    die "Internal GUI was removed from MPlayer. Please use one of many available\n frontends\
- (http://www.mplayerhq.hu/design7/projects.html#mplayer_frontends)."
-fi
-
 # Atmos: moved this here, to be correct, if --prefix is specified
 test -z "$_bindir"  && _bindir="$_prefix/bin"
 test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
@@ -3186,7 +3163,14 @@ if test "$_pthreads" = auto ; then
 cat > $TMPC << EOF
 #include <pthread.h>
 static void *func(void *arg) { return arg; }
-int main(void) { pthread_t tid; return pthread_create(&tid, 0, func, 0) == 0 ? 0 : 1; }
+int main(void) {
+ pthread_t tid;
+#ifdef PTW32_STATIC_LIB
+ pthread_win32_process_attach_np();
+ pthread_win32_thread_attach_np();
+#endif
+ return pthread_create (&tid, 0, func, 0) != 0;
+}
 EOF
 _pthreads=no
 if ! hpux ; then
@@ -3194,6 +3178,10 @@ if ! hpux ; then
     # for crosscompilation, we cannot execute the program, be happy if we can link statically
     cc_check $THREAD_CFLAGS $_ld_tmp && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && break
   done
+  if test "$_pthreads" = no && mingw32 ; then
+    _ld_tmp="-lpthreadGC2 -lws2_32"
+    cc_check $_ld_tmp -DPTW32_STATIC_LIB && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && CFLAGS="$CFLAGS -DPTW32_STATIC_LIB"
+  fi
 fi
 fi
 if test "$_pthreads" = yes ; then
@@ -3278,6 +3266,9 @@ EOF
     cc_check $_ld_lm $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" &&
       _iconv=yes && break
   done
+  if test "$_iconv" != yes ; then
+    die "Unable to find iconv which should be part of standard compilation environment. Aborting. If you really mean to compile without iconv support use --disable-iconv."
+  fi
 fi
 if test "$_iconv" = yes ; then
   def_iconv='#define CONFIG_ICONV 1'
@@ -4048,11 +4039,11 @@ echores "$_xf86keysym"
 echocheck "DGA"
 if test "$_dga2" = auto && test "$_x11" = yes ; then
   _dga2=no
-  statement_check_broken X11/Xlib.h X11/extensions/xf86dga.h 'XDGASetViewport(0, 0, 0, 0, 0)' -lXxf86dga && _dga2=yes
+  statement_check_broken X11/Xlib.h X11/extensions/Xxf86dga.h 'XDGASetViewport(0, 0, 0, 0, 0)' -lXxf86dga && _dga2=yes
 fi
 if test "$_dga1" = auto && test "$_dga2" = no && test "$_vm" = yes ; then
   _dga1=no
-  statement_check_broken X11/Xlib.h X11/extensions/xf86dga.h 'XF86DGASetViewPort(0, 0, 0, 0)' -lXxf86dga -lXxf86vm && _dga1=yes
+  statement_check_broken X11/Xlib.h X11/extensions/Xxf86dga.h 'XF86DGASetViewPort(0, 0, 0, 0)' -lXxf86dga -lXxf86vm && _dga1=yes
 fi
 
 _dga=no
@@ -4083,6 +4074,7 @@ if test "$_3dfx" = yes && test "$_dga" = yes ; then
   def_3dfx='#define CONFIG_3DFX 1'
   vomodules="3dfx $vomodules"
 else
+  _3dfx=no
   def_3dfx='#undef CONFIG_3DFX'
   novomodules="3dfx $novomodules"
 fi
@@ -5455,6 +5447,9 @@ EOF
     else
         _freetype=no
     fi
+    if test "$_freetype" != yes ; then
+      die "Unable to find development files for libfreetype. Aborting. If you really mean to compile without FreeType support use --disable-freetype."
+    fi
 fi
 if test "$_freetype" = yes ; then
     def_freetype='#define CONFIG_FREETYPE 1'
@@ -5498,6 +5493,9 @@ EOF
     cc_check $_inc_tmp $_ld_tmp && _fontconfig=yes &&
       extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_tmp"
   fi
+  if test "$_fontconfig" != yes ; then
+    die "Unable to find development files for libfontconfig. Aborting. If you really mean to compile without fontconfig support use --disable-fontconfig."
+  fi
 fi
 if test "$_fontconfig" = yes ; then
     def_fontconfig='#define CONFIG_FONTCONFIG 1'
@@ -5515,8 +5513,7 @@ if test "$_ass" = auto -o "$_ass" = yes ; then
                 extra_ldflags="$extra_ldflags $($_pkg_config --libs libass)"
                 extra_cflags="$extra_cflags $($_pkg_config --cflags libass)"
         else
-                _ass=no
-                def_ass='#undef CONFIG_ASS'
+            die "Unable to find development files for libass. Aborting. If you really mean to compile without libass support use --disable-ass."
         fi
 else
     def_ass='#undef CONFIG_ASS'
@@ -5731,19 +5728,6 @@ else
 fi
 echores "$_theora"
 
-echocheck "mp3lib support"
-if test "$_mp3lib" = auto ; then
-  test "$cc_vendor" = intel && test "$_cc_major" -le 10 -o "$_cc_major" -eq 11 -a "$_cc_minor" -eq 0 && _mp3lib=no || _mp3lib=yes
-fi
-if test "$_mp3lib" = yes ; then
-  def_mp3lib='#define CONFIG_MP3LIB 1'
-  codecmodules="mp3lib(internal) $codecmodules"
-else
-  def_mp3lib='#undef CONFIG_MP3LIB'
-  nocodecmodules="mp3lib(internal) $nocodecmodules"
-fi
-echores "$_mp3lib"
-
 # Any version of libmpg123 shall be fine.
 echocheck "mpg123 support"
 def_mpg123='#undef CONFIG_MPG123'
@@ -6823,7 +6807,6 @@ MACOSX_FINDER = $_macosx_finder
 MD5SUM = $_md5sum
 MGA = $_mga
 MNG = $_mng
-MP3LIB = $_mp3lib
 MPG123 = $_mpg123
 MUSEPACK = $_musepack
 NAS = $_nas
@@ -7084,7 +7067,6 @@ $def_liba52
 $def_libdca
 $def_libdv
 $def_mad
-$def_mp3lib
 $def_mpg123
 $def_musepack
 $def_speex
diff --git a/mplayer/defaultopts.c b/mplayer/defaultopts.c
index d49841a..8bb927b 100644
--- a/mplayer/defaultopts.c
+++ b/mplayer/defaultopts.c
@@ -46,6 +46,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
         .movie_aspect = -1.,
         .flip = -1,
         .vd_use_slices = 1,
+        .sub_auto = 1,
 #ifdef CONFIG_ASS
         .ass_enabled = 1,
 #endif
diff --git a/mplayer/etc/codecs.conf b/mplayer/etc/codecs.conf
index 5226c37..3f624e5 100644
--- a/mplayer/etc/codecs.conf
+++ b/mplayer/etc/codecs.conf
@@ -4220,23 +4220,6 @@ audiocodec ffsonic
   driver ffmpeg
   dll "sonic"
 
-audiocodec mp3
-  ; this is preferred over ffmp2/ffmp3 since it is faster due to using
-  ; floating point and there are even broken mkv files where the audio
-  ; needs to be parsed, making this codec work more reliably
-  info "mp3lib MPEG layer-2, layer-3"
-  status working
-  comment "Optimized to MMX/SSE/3Dnow!"
-  format 0x50        ; layer-1 && layer-2
-  format 0x55        ; layer-3
-  format 0x5500736d  ; "ms\0\x55" older mp3 fcc (MOV files)
-  format 0x5000736d  ; "ms\0\x50" older mp2 fcc (MOV files)
-  format 0x55005354  ;  broken file
-  fourcc ".mp3"      ; CBR/VBR MP3 (MOV files)
-  fourcc "MP3 "      ; used in .nsv files
-  fourcc "LAME"      ; used in mythtv .nuv files
-  driver mp3lib
-
 audiocodec mpg123
   ; this is preferred over ffmp2/ffmp3 since it is faster, generally
   info "MPEG 1.0/2.0/2.5 layers I, II, III"
diff --git a/mplayer/libaf/af_ladspa.c b/mplayer/libaf/af_ladspa.c
index 8ab2648..30693f0 100644
--- a/mplayer/libaf/af_ladspa.c
+++ b/mplayer/libaf/af_ladspa.c
@@ -510,6 +510,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
         return af_test_output(af, (af_data_t*)arg);
     case AF_CONTROL_COMMAND_LINE: {
         char *buf;
+        char *line = arg;
 
         mp_msg(MSGT_AFILTER, MSGL_V, "%s: parse suboptions\n", setup->myname);
 
@@ -517,46 +518,46 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
          * format is (ladspa=)file:label:controls....
          */
 
-        if (!arg) {
+        if (!line) {
             mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
                                             _("No suboptions specified."));
             return AF_ERROR;
         }
 
-        buf = malloc(strlen(arg)+1);
+        buf = malloc(strlen(line)+1);
         if (!buf) return af_ladspa_malloc_failed(setup->myname);
 
         /* file... */
         buf[0] = '\0';
-        sscanf(arg, "%[^:]", buf);
+        sscanf(line, "%[^:]", buf);
         if (buf[0] == '\0') {
             mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
                                                 _("No library file specified."));
             free(buf);
             return AF_ERROR;
         }
-        arg += strlen(buf);
+        line += strlen(buf);
         setup->file = strdup(buf);
         if (!setup->file) return af_ladspa_malloc_failed(setup->myname);
         mp_msg(MSGT_AFILTER, MSGL_V, "%s: file --> %s\n", setup->myname,
                                                         setup->file);
-        if (*(char*)arg != '\0') arg++; /* read ':' */
+        if (*line != '\0') line++; /* read ':' */
 
         /* label... */
         buf[0] = '\0';
-        sscanf(arg, "%[^:]", buf);
+        sscanf(line, "%[^:]", buf);
         if (buf[0] == '\0') {
             mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
                                                 _("No filter label specified."));
             free(buf);
             return AF_ERROR;
         }
-        arg += strlen(buf);
+        line += strlen(buf);
         setup->label = strdup(buf);
         if (!setup->label) return af_ladspa_malloc_failed(setup->myname);
         mp_msg(MSGT_AFILTER, MSGL_V, "%s: label --> %s\n", setup->myname,
                                                                 setup->label);
-/*        if (*(char*)arg != '0') arg++; */ /* read ':' */
+/*        if (*line != '0') line++; */ /* read ':' */
 
         free(buf); /* no longer needed */
 
@@ -581,20 +582,20 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
         /* ninputcontrols is set by now, read control values from arg */
 
         for(i=0; i<setup->ninputcontrols; i++) {
-            if (!arg || (*(char*)arg != ':') ) {
+            if (!line || *line != ':') {
                 mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
                                         _("Not enough controls specified on the command line."));
                 return AF_ERROR;
             }
-            arg++;
-            r = sscanf(arg, "%f", &val);
+            line++;
+            r = sscanf(line, "%f", &val);
             if (r!=1) {
                 mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
                                         _("Not enough controls specified on the command line."));
                 return AF_ERROR;
             }
             setup->inputcontrols[setup->inputcontrolsmap[i]] = val;
-            arg = strchr(arg, ':');
+            line = strchr(line, ':');
         }
 
         mp_msg(MSGT_AFILTER, MSGL_V, "%s: input controls: ", setup->myname);
diff --git a/mplayer/libaf/af_lavcac3enc.c b/mplayer/libaf/af_lavcac3enc.c
index 819f3f7..1042f36 100644
--- a/mplayer/libaf/af_lavcac3enc.c
+++ b/mplayer/libaf/af_lavcac3enc.c
@@ -180,6 +180,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
     char *buf, *src, *dest;
     int max_output_len;
     int frame_num = (data->len + s->pending_len) / s->expect_len;
+    int samplesize = af_fmt2bits(s->in_sampleformat) / 8;
 
     if (s->add_iec61937_header)
         max_output_len = AC3_FRAME_SIZE * 2 * 2 * frame_num;
@@ -230,7 +231,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
                                     AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
                                     AF_CHANNEL_LAYOUT_LAVC_DEFAULT,
                                     c->nch,
-                                    s->expect_len / 2, 2);
+                                    s->expect_len / samplesize, samplesize);
 
             len = avcodec_encode_audio(s->lavc_actx, dest, destsize,
                                        (void *)s->pending_data);
@@ -242,7 +243,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
                                     AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
                                     AF_CHANNEL_LAYOUT_LAVC_DEFAULT,
                                     c->nch,
-                                    s->expect_len / 2, 2);
+                                    s->expect_len / samplesize, samplesize);
             len = avcodec_encode_audio(s->lavc_actx,dest,destsize,(void *)src);
             src += s->expect_len;
             left -= s->expect_len;
diff --git a/mplayer/libaf/af_lavcresample.c b/mplayer/libaf/af_lavcresample.c
index 48fcd75..f1483ac 100644
--- a/mplayer/libaf/af_lavcresample.c
+++ b/mplayer/libaf/af_lavcresample.c
@@ -119,7 +119,7 @@ static void uninit(struct af_instance_s* af)
 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
 {
   af_resample_t *s = af->setup;
-  int i, j, consumed, ret;
+  int i, j, consumed, ret = 0;
   int16_t *in = (int16_t*)data->audio;
   int16_t *out;
   int chans   = data->nch;
diff --git a/mplayer/libao2/ao_alsa.c b/mplayer/libao2/ao_alsa.c
index 80537c3..1806a36 100644
--- a/mplayer/libao2/ao_alsa.c
+++ b/mplayer/libao2/ao_alsa.c
@@ -310,11 +310,11 @@ static int try_open_device(const char *device, int open_mode, int try_ac3)
     err = snd_pcm_open(&alsa_handler, ac3_device, SND_PCM_STREAM_PLAYBACK,
 		       open_mode);
     free(ac3_device);
+    if (!err)
+      return 0;
   }
-  if (!try_ac3 || err < 0)
-    err = snd_pcm_open(&alsa_handler, device, SND_PCM_STREAM_PLAYBACK,
-		       open_mode);
-  return err;
+  return snd_pcm_open(&alsa_handler, device, SND_PCM_STREAM_PLAYBACK,
+                      open_mode);
 }
 
 /*
diff --git a/mplayer/libao2/ao_esd.c b/mplayer/libao2/ao_esd.c
index 1097d4d..d542399 100644
--- a/mplayer/libao2/ao_esd.c
+++ b/mplayer/libao2/ao_esd.c
@@ -161,7 +161,7 @@ static int init(int rate_hz, int channels, int format, int flags)
     int bytes_per_sample;
     int fl;
     char *server = ao_subdevice;  /* NULL for localhost */
-    float lag_seconds, lag_net, lag_serv;
+    float lag_seconds, lag_net = 0., lag_serv;
     struct timeval proto_start, proto_end;
 
     if (esd_fd < 0) {
diff --git a/mplayer/libao2/audio_out.c b/mplayer/libao2/audio_out.c
index 64b3981..d1887c2 100644
--- a/mplayer/libao2/audio_out.c
+++ b/mplayer/libao2/audio_out.c
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <assert.h>
 
 #include "config.h"
 #include "audio_out.h"
@@ -26,7 +27,7 @@
 #include "mp_msg.h"
 
 // there are some globals:
-ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0};
+struct ao ao_data;
 char *ao_subdevice = NULL;
 
 extern const ao_functions_t audio_out_oss;
@@ -132,54 +133,119 @@ void list_audio_out(void){
     mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
 }
 
-const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){
-    int i;
+struct ao *ao_create(void)
+{
+    ao_data = (struct ao){.outburst = OUTBURST, .buffersize = -1};
+    return &ao_data;
+}
+
+void ao_init(struct ao *ao, char **ao_list)
+{
+    struct ao backup = *ao;
+
+    if (!ao_list)
+        goto try_defaults;
+
     // first try the preferred drivers, with their optional subdevice param:
-    if(ao_list && ao_list[0])
-      while(ao_list[0][0]){
-        char* ao=ao_list[0];
+    while (*ao_list) {
+        char *ao_name = *ao_list;
+        if (!*ao_name)
+            goto try_defaults; // empty entry means try defaults
         int ao_len;
-        free(ao_subdevice);
-        ao_subdevice = NULL;
-        ao_subdevice=strchr(ao,':');
-        if(ao_subdevice){
-            ao_len = ao_subdevice - ao;
-            ao_subdevice = strdup(&ao[ao_len + 1]);
-        }
-        else
-            ao_len = strlen(ao);
-
-        mp_tmsg(MSGT_AO, MSGL_V, "Trying preferred audio driver '%.*s', options '%s'\n",
-               ao_len, ao, ao_subdevice ? ao_subdevice : "[none]");
-
-        for(i=0;audio_out_drivers[i];i++){
-            const ao_functions_t* audio_out=audio_out_drivers[i];
-            if(!strncmp(audio_out->info->short_name,ao,ao_len)){
-                // name matches, try it
-                if(audio_out->init(rate,channels,format,flags))
-                    return audio_out; // success!
-                else
-                    mp_tmsg(MSGT_AO, MSGL_WARN, "Failed to initialize audio driver '%s'\n", ao);
+        assert(!ao_subdevice);
+        ao_subdevice = strchr(ao_name, ':');
+        if (ao_subdevice) {
+            ao_len = ao_subdevice - ao_name;
+            ao_subdevice = strdup(ao_subdevice + 1);
+        } else
+            ao_len = strlen(ao_name);
+
+        mp_tmsg(MSGT_AO, MSGL_V,
+                "Trying preferred audio driver '%.*s', options '%s'\n",
+               ao_len, ao_name, ao_subdevice ? ao_subdevice : "[none]");
+
+        const ao_functions_t *audio_out = NULL;
+        for (int i = 0; audio_out_drivers[i]; i++) {
+            audio_out = audio_out_drivers[i];
+            if (!strncmp(audio_out->info->short_name, ao_name, ao_len))
                 break;
-            }
+            audio_out = NULL;
         }
-	if (!audio_out_drivers[i]) // we searched through the entire list
-            mp_tmsg(MSGT_AO, MSGL_WARN, "No such audio driver '%.*s'\n", ao_len, ao);
-        // continue...
+        if (audio_out) {
+            // name matches, try it
+            if (audio_out->init(ao->samplerate, ao->channels, ao->format, 0)) {
+                ao->driver = audio_out;
+                ao->initialized = true;
+                return;
+            }
+            mp_tmsg(MSGT_AO, MSGL_WARN,
+                    "Failed to initialize audio driver '%s'\n", ao_name);
+            *ao = backup;
+        } else
+            mp_tmsg(MSGT_AO, MSGL_WARN, "No such audio driver '%.*s'\n",
+                    ao_len, ao_name);
+        free(ao_subdevice);
+        ao_subdevice = NULL;
         ++ao_list;
-        if(!(ao_list[0])) return NULL; // do NOT fallback to others
-      }
-    free(ao_subdevice);
-    ao_subdevice = NULL;
+    }
+    return;
 
+ try_defaults:
     mp_tmsg(MSGT_AO, MSGL_V, "Trying every known audio driver...\n");
 
     // now try the rest...
-    for(i=0;audio_out_drivers[i];i++){
-        const ao_functions_t* audio_out=audio_out_drivers[i];
-//        if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
-        if(audio_out->init(rate,channels,format,flags))
-            return audio_out; // success!
+    for (int i = 0; audio_out_drivers[i]; i++) {
+        const ao_functions_t *audio_out = audio_out_drivers[i];
+        if (audio_out->init(ao->samplerate, ao->channels, ao->format, 0)) {
+            ao->initialized = true;
+            ao->driver = audio_out;
+            return;
+        }
+        *ao = backup;
     }
-    return NULL;
+    return;
+}
+
+void ao_uninit(struct ao *ao, bool drain_audio)
+{
+    if (ao->initialized)
+        ao->driver->uninit(drain_audio);
+    ao->initialized = false;
+    free(ao_subdevice);
+    ao_subdevice = NULL;
+}
+
+int ao_play(struct ao *ao, void *data, int len, int flags)
+{
+    return ao->driver->play(data, len, flags);
+}
+
+int ao_control(struct ao *ao, int cmd, void *arg)
+{
+    return ao->driver->control(cmd, arg);
+}
+
+double ao_get_delay(struct ao *ao)
+{
+    return ao->driver->get_delay();
+}
+
+int ao_get_space(struct ao *ao)
+{
+    return ao->driver->get_space();
+}
+
+void ao_reset(struct ao *ao)
+{
+    ao->driver->reset();
+}
+
+void ao_pause(struct ao *ao)
+{
+    ao->driver->pause();
+}
+
+void ao_resume(struct ao *ao)
+{
+    ao->driver->resume();
 }
diff --git a/mplayer/libao2/audio_out.h b/mplayer/libao2/audio_out.h
index e483a88..8c10a47 100644
--- a/mplayer/libao2/audio_out.h
+++ b/mplayer/libao2/audio_out.h
@@ -19,6 +19,8 @@
 #ifndef MPLAYER_AUDIO_OUT_H
 #define MPLAYER_AUDIO_OUT_H
 
+#include <stdbool.h>
+
 typedef struct ao_info_s
 {
         /* driver name ("Matrox Millennium G200/G400" */
@@ -32,7 +34,7 @@ typedef struct ao_info_s
 } ao_info_t;
 
 /* interface towards mplayer and */
-typedef struct ao_functions_s
+typedef struct ao_functions
 {
 	const ao_info_t *info;
         int (*control)(int cmd,void *arg);
@@ -47,7 +49,7 @@ typedef struct ao_functions_s
 } ao_functions_t;
 
 /* global data used by mplayer and plugins */
-typedef struct ao_data {
+struct ao {
   int samplerate;
   int channels;
   int format;
@@ -55,13 +57,13 @@ typedef struct ao_data {
   int outburst;
   int buffersize;
   int pts;
-} ao_data_t;
+    bool initialized;
+    const struct ao_functions *driver;
+};
 
 extern char *ao_subdevice;
-extern ao_data_t ao_data;
 
 void list_audio_out(void);
-const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags);
 
 // NULL terminated array of all drivers
 extern const ao_functions_t* const audio_out_drivers[];
@@ -88,4 +90,15 @@ typedef struct ao_control_vol_s {
 	float right;
 } ao_control_vol_t;
 
+struct ao *ao_create(void);
+void ao_init(struct ao *ao, char **ao_list);
+void ao_uninit(struct ao *ao, bool drain_audio);
+int ao_play(struct ao *ao, void *data, int len, int flags);
+int ao_control(struct ao *ao, int cmd, void *arg);
+double ao_get_delay(struct ao *ao);
+int ao_get_space(struct ao *ao);
+void ao_reset(struct ao *ao);
+void ao_pause(struct ao *ao);
+void ao_resume(struct ao *ao);
+
 #endif /* MPLAYER_AUDIO_OUT_H */
diff --git a/mplayer/libao2/audio_out_internal.h b/mplayer/libao2/audio_out_internal.h
index 504923b..c093be6 100644
--- a/mplayer/libao2/audio_out_internal.h
+++ b/mplayer/libao2/audio_out_internal.h
@@ -31,6 +31,8 @@ static float get_delay(void);
 static void audio_pause(void);
 static void audio_resume(void);
 
+extern struct ao ao_data;
+
 #define LIBAO_EXTERN(x) const ao_functions_t audio_out_##x =\
 {\
 	&info,\
diff --git a/mplayer/libmpcodecs/ad.c b/mplayer/libmpcodecs/ad.c
index 2e431e6..68d2c44 100644
--- a/mplayer/libmpcodecs/ad.c
+++ b/mplayer/libmpcodecs/ad.c
@@ -32,7 +32,6 @@
 /* Missed vorbis, mad, dshow */
 
 extern const ad_functions_t mpcodecs_ad_mpg123;
-extern const ad_functions_t mpcodecs_ad_mp3lib;
 extern const ad_functions_t mpcodecs_ad_ffmpeg;
 extern const ad_functions_t mpcodecs_ad_liba52;
 extern const ad_functions_t mpcodecs_ad_hwac3;
@@ -63,9 +62,6 @@ const ad_functions_t * const mpcodecs_ad_drivers[] =
 #ifdef CONFIG_MPG123
   &mpcodecs_ad_mpg123,
 #endif
-#ifdef CONFIG_MP3LIB
-  &mpcodecs_ad_mp3lib,
-#endif
 #ifdef CONFIG_LIBA52
   &mpcodecs_ad_liba52,
 #endif
diff --git a/mplayer/libmpcodecs/ad_ffmpeg.c b/mplayer/libmpcodecs/ad_ffmpeg.c
index ec6a2f7..8f56e71 100644
--- a/mplayer/libmpcodecs/ad_ffmpeg.c
+++ b/mplayer/libmpcodecs/ad_ffmpeg.c
@@ -127,7 +127,7 @@ static int init(sh_audio_t *sh_audio)
     }
     lavc_context->request_channels = opts->audio_output_channels;
     lavc_context->codec_tag = sh_audio->format; //FOURCC
-    lavc_context->codec_type = CODEC_TYPE_AUDIO;
+    lavc_context->codec_type = AVMEDIA_TYPE_AUDIO;
     lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi
 
     /* alloc extra data */
diff --git a/mplayer/libmpcodecs/ad_mp3lib.c b/mplayer/libmpcodecs/ad_mp3lib.c
deleted file mode 100644
index f262757..0000000
--- a/mplayer/libmpcodecs/ad_mp3lib.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "config.h"
-
-#include "ad_internal.h"
-#include "ad_mp3lib.h"
-
-static const ad_info_t info =
-{
-	"MPEG layer-2, layer-3",
-	"mp3lib",
-	"Nick Kurshev",
-	"mpg123",
-	"Optimized to MMX/SSE/3Dnow!"
-};
-
-LIBAD_EXTERN(mp3lib)
-
-#include "mp3lib/mp3.h"
-
-extern int fakemono;
-
-static sh_audio_t* dec_audio_sh=NULL;
-
-// MP3 decoder buffer callback:
-int mplayer_audio_read(char *buf,int size){
-  return demux_read_data(dec_audio_sh->ds,buf,size);
-}
-
-static int preinit(sh_audio_t *sh)
-{
-  sh->audio_out_minsize=32*36*2*2; //4608;
-  return 1;
-}
-
-static int init(sh_audio_t *sh)
-{
-  // MPEG Audio:
-  dec_audio_sh=sh; // save sh_audio for the callback:
-//  MP3_Init(fakemono,mplayer_accel,&mplayer_audio_read); // TODO!!!
-#ifdef CONFIG_FAKE_MONO
-  MP3_Init(fakemono);
-#else
-  MP3_Init();
-#endif
-  MP3_samplerate=MP3_channels=0;
-  sh->a_buffer_len=MP3_DecodeFrame(sh->a_buffer,-1);
-  if(!sh->a_buffer_len) return 0; // unsupported layer/format
-  sh->channels=2; // hack
-  sh->samplesize=2;
-  sh->samplerate=MP3_samplerate;
-  sh->i_bps=MP3_bitrate*(1000/8);
-  MP3_PrintHeader();
-  return 1;
-}
-
-static void uninit(sh_audio_t *sh)
-{
-}
-
-static int control(sh_audio_t *sh,int cmd,void* arg, ...)
-{
-    switch(cmd)
-    {
-      case ADCTRL_RESYNC_STREAM:
-          MP3_DecodeFrame(NULL,-2); // resync
-          MP3_DecodeFrame(NULL,-2); // resync
-          MP3_DecodeFrame(NULL,-2); // resync
-	  return CONTROL_TRUE;
-      case ADCTRL_SKIP_FRAME:
-	  MP3_DecodeFrame(NULL,-2); // skip MPEG frame
-	  return CONTROL_TRUE;
-    }
-  return CONTROL_UNKNOWN;
-}
-
-static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
-{
-   return MP3_DecodeFrame(buf,-1);
-}
diff --git a/mplayer/libmpcodecs/ad_mp3lib.h b/mplayer/libmpcodecs/ad_mp3lib.h
deleted file mode 100644
index aeb78b4..0000000
--- a/mplayer/libmpcodecs/ad_mp3lib.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_AD_MP3LIB_H
-#define MPLAYER_AD_MP3LIB_H
-
-int mplayer_audio_read(char *buf, int size);
-
-#endif /* MPLAYER_AD_MP3LIB_H */
diff --git a/mplayer/libmpcodecs/vd_ffmpeg.c b/mplayer/libmpcodecs/vd_ffmpeg.c
index d56a63e..431b5cd 100644
--- a/mplayer/libmpcodecs/vd_ffmpeg.c
+++ b/mplayer/libmpcodecs/vd_ffmpeg.c
@@ -208,7 +208,7 @@ static int init(sh_video_t *sh){
     ctx->avctx = avcodec_alloc_context();
     avctx = ctx->avctx;
     avctx->opaque = sh;
-    avctx->codec_type = CODEC_TYPE_VIDEO;
+    avctx->codec_type = AVMEDIA_TYPE_VIDEO;
     avctx->codec_id = lavc_codec->id;
 
     if (lavc_codec->capabilities & CODEC_CAP_HWACCEL   // XvMC
@@ -379,8 +379,10 @@ static int init(sh_video_t *sh){
     if(sh->bih)
         avctx->bits_per_coded_sample= sh->bih->biBitCount;
 
-    if(lavc_param->threads > 1)
+    if(lavc_param->threads > 1) {
+        avctx->thread_count = lavc_param->threads;
         avcodec_thread_init(avctx, lavc_param->threads);
+    }
     /* open it */
     if (avcodec_open(avctx, lavc_codec) < 0) {
         mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");
@@ -539,14 +541,12 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
             type = MP_IMGTYPE_STATIC;
             flags |= MP_IMGFLAG_PRESERVE;
         }
-        flags|=(!avctx->hurry_up && ctx->do_slices) ?
-                 MP_IMGFLAG_DRAW_CALLBACK:0;
+        flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0;
         mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type == MP_IMGTYPE_STATIC ? "using STATIC\n" : "using TEMP\n");
     } else {
         if(!pic->reference){
             ctx->b_count++;
-            flags|=(!avctx->hurry_up && ctx->do_slices) ?
-                     MP_IMGFLAG_DRAW_CALLBACK:0;
+            flags |= ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK:0;
         }else{
             ctx->ip_count++;
             flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE
@@ -785,7 +785,7 @@ static struct mp_image *decode(struct sh_video *sh, void *data, int len,
     pkt.data = data;
     pkt.size = len;
     // HACK: make PNGs decode normally instead of as CorePNG delta frames
-    pkt.flags = PKT_FLAG_KEY;
+    pkt.flags = AV_PKT_FLAG_KEY;
     // The avcodec opaque field stupidly supports only int64_t type
     *(double *)&avctx->reordered_opaque = *reordered_pts;
     ret = avcodec_decode_video2(avctx, pic, &got_picture, &pkt);
diff --git a/mplayer/libmpcodecs/vf_geq.c b/mplayer/libmpcodecs/vf_geq.c
index ed855d1..68a9cf7 100644
--- a/mplayer/libmpcodecs/vf_geq.c
+++ b/mplayer/libmpcodecs/vf_geq.c
@@ -116,7 +116,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
             const_values[3]=y;
             for(x=0; x<w; x++){
                 const_values[2]=x;
-                dst[x + y * dst_stride] = av_eval_expr(vf->priv->e[plane],
+                dst[x + y * dst_stride] = av_expr_eval(vf->priv->e[plane],
                                                        const_values, vf);
             }
         }
@@ -176,7 +176,7 @@ static int vf_open(vf_instance_t *vf, char *args){
             plane==0 ? lum : (plane==1 ? cb : cr),
             NULL
         };
-        res = av_parse_expr(&vf->priv->e[plane], eq[plane], const_names, NULL, NULL, func2_names, func2, 0, NULL);
+        res = av_expr_parse(&vf->priv->e[plane], eq[plane], const_names, NULL, NULL, func2_names, func2, 0, NULL);
 
         if (res < 0) {
             mp_msg(MSGT_VFILTER, MSGL_ERR, "geq: error loading equation `%s'\n", eq[plane]);
diff --git a/mplayer/libmpcodecs/vf_pp.c b/mplayer/libmpcodecs/vf_pp.c
index f3dc4d9..10c4edf 100644
--- a/mplayer/libmpcodecs/vf_pp.c
+++ b/mplayer/libmpcodecs/vf_pp.c
@@ -37,7 +37,7 @@
 
 struct vf_priv_s {
     int pp;
-    pp_mode_t *ppMode[PP_QUALITY_MAX+1];
+    pp_mode *ppMode[PP_QUALITY_MAX+1];
     void *context;
     unsigned int outfmt;
 };
diff --git a/mplayer/libmpcodecs/vf_pp7.c b/mplayer/libmpcodecs/vf_pp7.c
index 58f3e3e..1c0274d 100644
--- a/mplayer/libmpcodecs/vf_pp7.c
+++ b/mplayer/libmpcodecs/vf_pp7.c
@@ -288,8 +288,8 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
     int x, y;
     const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15));
     uint8_t  *p_src= p->src + 8*stride;
-    DCTELEM *block= p->src;
-    DCTELEM *temp= p->src + 32;
+    DCTELEM *block= (DCTELEM *)p->src;
+    DCTELEM *temp= (DCTELEM *)(p->src + 32);
 
     if (!src || !dst) return; // HACK avoid crash for Y8 colourspace
     for(y=0; y<height; y++){
diff --git a/mplayer/libmpcodecs/vf_yadif.c b/mplayer/libmpcodecs/vf_yadif.c
index 2b2c180..a5bd542 100644
--- a/mplayer/libmpcodecs/vf_yadif.c
+++ b/mplayer/libmpcodecs/vf_yadif.c
@@ -376,7 +376,7 @@ static int config(struct vf_instance *vf,
 
             vf->priv->stride[i]= w;
             for(j=0; j<3; j++)
-                vf->priv->ref[j][i]= malloc(w*h*sizeof(uint8_t))+3*w;
+                vf->priv->ref[j][i]= (char *)malloc(w*h*sizeof(uint8_t))+3*w;
         }
 
 	return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
diff --git a/mplayer/libmpdemux/demux_edl.c b/mplayer/libmpdemux/demux_edl.c
new file mode 100644
index 0000000..4c864cf
--- /dev/null
+++ b/mplayer/libmpdemux/demux_edl.c
@@ -0,0 +1,58 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include "demuxer.h"
+#include "stream/stream.h"
+
+static int try_open_file(struct demuxer *demuxer)
+{
+    struct stream *s = demuxer->stream;
+    const char header[] = "mplayer EDL file";
+    const int len = sizeof(header) - 1;
+    char buf[len];
+    if (stream_read(s, buf, len) < len)
+        return 0;
+    if (strncmp(buf, header, len))
+        return 0;
+    stream_seek(s, 0);
+    demuxer->file_contents = stream_read_complete(s, demuxer, 1000000, 0);
+    if (demuxer->file_contents.start == NULL)
+        return 0;
+    return DEMUXER_TYPE_EDL;
+}
+
+static int dummy_fill_buffer(struct demuxer *demuxer, struct demux_stream *ds)
+{
+    return 0;
+}
+
+const struct demuxer_desc demuxer_desc_edl = {
+    .info = "EDL file demuxer",
+    .name = "edl",
+    .shortdesc = "EDL",
+    .author = "Uoti Urpala",
+    .comment = "",
+    .type = DEMUXER_TYPE_EDL,
+    .safe_check = true,
+    .check_file = try_open_file,       // no separate .open
+    .fill_buffer = dummy_fill_buffer,
+};
diff --git a/mplayer/libmpdemux/demux_lavf.c b/mplayer/libmpdemux/demux_lavf.c
index 6a32240..0c5b6da 100644
--- a/mplayer/libmpdemux/demux_lavf.c
+++ b/mplayer/libmpdemux/demux_lavf.c
@@ -289,7 +289,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
         codec->codec_tag = override_tag;
 
     switch(codec->codec_type){
-        case CODEC_TYPE_AUDIO:{
+        case AVMEDIA_TYPE_AUDIO:{
             WAVEFORMATEX *wf;
             sh_audio_t* sh_audio;
             sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams);
@@ -357,16 +357,11 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
             if (st->disposition & AV_DISPOSITION_DEFAULT)
               sh_audio->default_track = 1;
             if(mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf, MSGL_V);
-            // select the first audio stream
-            if (!demuxer->audio->sh) {
-                demuxer->audio->id = i;
-                demuxer->audio->sh= demuxer->a_streams[i];
-            } else
-                st->discard= AVDISCARD_ALL;
+            st->discard= AVDISCARD_ALL;
             stream_id = priv->audio_streams++;
             break;
         }
-        case CODEC_TYPE_VIDEO:{
+        case AVMEDIA_TYPE_VIDEO:{
             sh_video_t* sh_video;
             BITMAPINFOHEADER *bih;
             sh_video=new_sh_video_vid(demuxer, i, priv->video_streams);
@@ -428,7 +423,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
                 int biClrUsed;
                 int biClrImportant;
             */
-            if(demuxer->video->id != i && demuxer->video->id != -1)
+            if(demuxer->video->id != priv->video_streams
+               && demuxer->video->id != -1)
                 st->discard= AVDISCARD_ALL;
             else{
                 demuxer->video->id = i;
@@ -437,7 +433,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
             stream_id = priv->video_streams++;
             break;
         }
-        case CODEC_TYPE_SUBTITLE:{
+        case AVMEDIA_TYPE_SUBTITLE:{
             sh_sub_t* sh_sub;
             char type;
             /* only support text subtitles for now */
@@ -480,9 +476,12 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
             stream_id = priv->sub_streams++;
             break;
         }
-        case CODEC_TYPE_ATTACHMENT:{
+        case AVMEDIA_TYPE_ATTACHMENT:{
+            AVMetadataTag *ftag = av_metadata_get(st->metadata, "filename",
+                                                   NULL, 0);
+            char *filename = ftag ? ftag->value : NULL;
             if (st->codec->codec_id == CODEC_ID_TTF)
-                demuxer_add_attachment(demuxer, BSTR(st->filename),
+                demuxer_add_attachment(demuxer, BSTR(filename),
                                        BSTR("application/x-truetype-font"),
                                        (struct bstr){codec->extradata,
                                                      codec->extradata_size});
@@ -610,8 +609,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
 
     mp_msg(MSGT_HEADER,MSGL_V,"LAVF: %d audio and %d video streams found\n",priv->audio_streams,priv->video_streams);
     mp_msg(MSGT_HEADER,MSGL_V,"LAVF: build %d\n", LIBAVFORMAT_BUILD);
-    if(!priv->audio_streams) demuxer->audio->id=-2;  // nosound
-//    else if(best_audio > 0 && demuxer->audio->id == -1) demuxer->audio->id=best_audio;
+    demuxer->audio->id = -2;  // wait for higher-level code to select track
     if(!priv->video_streams){
         if(!priv->audio_streams){
 	    mp_msg(MSGT_HEADER,MSGL_ERR,"LAVF: no audio or video headers found - broken file?\n");
@@ -620,6 +618,9 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
         demuxer->video->id=-2; // audio-only
     } //else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video;
 
+    // disabled because unreliable per-stream bitrate values returned
+    // by libavformat trigger this heuristic incorrectly and break things
+#if 0
     /* libavformat sets bitrate for mpeg based on pts at start and end
      * of file, which fails for files with pts resets. So calculate our
      * own bitrate estimate. */
@@ -635,6 +636,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
         if (!priv->bitrate)
             priv->bitrate = 1440000;
     }
+#endif
     demuxer->accurate_seek = !priv->seek_by_bytes;
 
     return demuxer;
@@ -756,14 +758,14 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
     if(ts != AV_NOPTS_VALUE){
         dp->pts = ts * av_q2d(priv->avfc->streams[id]->time_base);
         priv->last_pts= dp->pts * AV_TIME_BASE;
-        // always set duration for subtitles, even if PKT_FLAG_KEY is not set,
+        // always set duration for subtitles, even if AV_PKT_FLAG_KEY isn't set,
         // otherwise they will stay on screen to long if e.g. ASS is demuxed from mkv
-        if((ds == demux->sub || (pkt.flags & PKT_FLAG_KEY)) &&
+        if ((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) &&
            pkt.convergence_duration > 0)
             dp->duration = pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base);
     }
     dp->pos=demux->filepos;
-    dp->flags= !!(pkt.flags&PKT_FLAG_KEY);
+    dp->flags = !!(pkt.flags & AV_PKT_FLAG_KEY);
     // append packet to DS stream:
     ds_add_packet(ds,dp);
     return 1;
@@ -865,22 +867,18 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
 	        }
 	    }
 
-            if(id == -2) { // no sound
-                i = -1;
-            } else if(id == -1) { // next track
+            if (id == -1) {   // next track
                 i = (curridx + 2) % (nstreams + 1) - 1;
                 if (i >= 0)
                     newid = pstreams[i];
-	    }
-	    else // select track by id
-	    {
-	        if (id >= 0 && id < nstreams) {
-	            i = id;
-	            newid = pstreams[i];
-	        }
-	    }
+	    } else if (id >= 0 && id < nstreams) {   // select track by id
+                i = id;
+                newid = pstreams[i];
+	    } else   // no sound
+                i = -1;
+
 	    if (i == curridx) {
-                *(int *) arg = curridx;
+                *(int *) arg = curridx < 0 ? -2 : curridx;
                 return DEMUXER_CTRL_OK;
             } else {
 	        ds_free_packs(ds);
@@ -927,15 +925,15 @@ redo:
             {
                 switch(priv->avfc->streams[program->stream_index[i]]->codec->codec_type)
                 {
-                    case CODEC_TYPE_VIDEO:
+                    case AVMEDIA_TYPE_VIDEO:
                         if(prog->vid == -2)
                             prog->vid = program->stream_index[i];
                         break;
-                    case CODEC_TYPE_AUDIO:
+                    case AVMEDIA_TYPE_AUDIO:
                         if(prog->aid == -2)
                             prog->aid = program->stream_index[i];
                         break;
-                    case CODEC_TYPE_SUBTITLE:
+                    case AVMEDIA_TYPE_SUBTITLE:
                         if(prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == CODEC_ID_TEXT)
                             prog->sid = program->stream_index[i];
                         break;
diff --git a/mplayer/libmpdemux/demux_mkv.c b/mplayer/libmpdemux/demux_mkv.c
index 7432b59..ba0eaf4 100644
--- a/mplayer/libmpdemux/demux_mkv.c
+++ b/mplayer/libmpdemux/demux_mkv.c
@@ -184,6 +184,7 @@ typedef struct mkv_demuxer {
     int v_skip_to_keyframe, a_skip_to_keyframe;
 
     int num_audio_tracks;
+    int num_video_tracks;
 } mkv_demuxer_t;
 
 #define REALHEADER_SIZE    16
@@ -604,17 +605,17 @@ static void parse_trackentry(struct demuxer *demuxer,
             || !strcmp(track->codec_id, MKV_A_ACM))
             track->ms_compat = 1;
         else if (!strcmp(track->codec_id, MKV_S_VOBSUB))
-            track->subtitle_type = MATROSKA_SUBTYPE_VOBSUB;
+            track->subtitle_type = 'v';
         else if (!strcmp(track->codec_id, MKV_S_TEXTSSA)
                  || !strcmp(track->codec_id, MKV_S_TEXTASS)
                  || !strcmp(track->codec_id, MKV_S_SSA)
-                 || !strcmp(track->codec_id, MKV_S_ASS)) {
-            track->subtitle_type = MATROSKA_SUBTYPE_SSA;
-        } else if (!strcmp(track->codec_id, MKV_S_TEXTASCII))
-            track->subtitle_type = MATROSKA_SUBTYPE_TEXT;
-        if (!strcmp(track->codec_id, MKV_S_TEXTUTF8)) {
-            track->subtitle_type = MATROSKA_SUBTYPE_TEXT;
-        }
+                 || !strcmp(track->codec_id, MKV_S_ASS))
+            track->subtitle_type = 'a';
+        else if (!strcmp(track->codec_id, MKV_S_TEXTASCII)
+                   || !strcmp(track->codec_id, MKV_S_TEXTUTF8))
+            track->subtitle_type = 't';
+        else if (!strcmp(track->codec_id, MKV_S_PGS))
+            track->subtitle_type = 'p';
         mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] |  + Codec ID: %s\n",
                track->codec_id);
     } else
@@ -867,7 +868,7 @@ static int demux_mkv_read_tags(demuxer_t *demuxer)
             tag.targets.target_chapter_uid || tag.targets.target_attachment_uid)
             continue;
 
-        for (int j; j < tag.n_simple_tag; j++)
+        for (int j = 0; j < tag.n_simple_tag; j++)
             demux_info_add_bstr(demuxer, tag.simple_tag[j].tag_name, tag.simple_tag[j].tag_string);
     }
 
@@ -1112,6 +1113,7 @@ static void display_create_tracks(demuxer_t *demuxer)
                     str);
     }
     mkv_d->num_audio_tracks = aid;
+    mkv_d->num_video_tracks = vid;
 }
 
 typedef struct {
@@ -1317,6 +1319,8 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track,
             track->a_formattag = 0x0055;
         else if (!strncmp(track->codec_id, MKV_A_AC3, strlen(MKV_A_AC3)))
             track->a_formattag = 0x2000;
+        else if (!strncmp(track->codec_id, MKV_A_EAC3, strlen(MKV_A_EAC3)))
+            track->a_formattag = mmioFOURCC('E', 'A', 'C', '3');
         else if (!strcmp(track->codec_id, MKV_A_DTS))
             track->a_formattag = 0x2001;
         else if (!strcmp(track->codec_id, MKV_A_PCM)
@@ -1390,6 +1394,7 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track,
         sh_a->wf->nAvgBytesPerSec = 16000;
         sh_a->wf->nBlockAlign = 1152;
     } else if ((track->a_formattag == 0x2000)           /* AC3 */
+               || track->a_formattag == mmioFOURCC('E', 'A', 'C', '3')
                || (track->a_formattag == 0x2001)) {        /* DTS */
         free(sh_a->wf);
         sh_a->wf = NULL;
@@ -1564,16 +1569,12 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track,
 static int demux_mkv_open_sub(demuxer_t *demuxer, mkv_track_t *track,
                               int sid)
 {
-    if (track->subtitle_type != MATROSKA_SUBTYPE_UNKNOWN) {
+    if (track->subtitle_type) {
         int size;
         uint8_t *buffer;
         sh_sub_t *sh = new_sh_sub(demuxer, sid);
         track->sh_sub = sh;
-        sh->type = 't';
-        if (track->subtitle_type == MATROSKA_SUBTYPE_VOBSUB)
-            sh->type = 'v';
-        if (track->subtitle_type == MATROSKA_SUBTYPE_SSA)
-            sh->type = 'a';
+        sh->type = track->subtitle_type;
         size = track->private_size;
         demux_mkv_decode(track, track->private_data, &buffer, &size, 2);
         if (buffer && buffer != track->private_data) {
@@ -1712,34 +1713,7 @@ static int demux_mkv_open(demuxer_t *demuxer)
         demuxer->video->id = -2;
     }
 
-    /* select audio track */
-    track = NULL;
-    if (track == NULL)
-        /* search for an audio track that has the 'default' flag set */
-        for (i = 0; i < mkv_d->num_tracks; i++)
-            if (mkv_d->tracks[i]->type == MATROSKA_TRACK_AUDIO
-                && mkv_d->tracks[i]->default_track) {
-                track = mkv_d->tracks[i];
-                break;
-            }
-
-    if (track == NULL)
-        /* no track has the 'default' flag set */
-        /* let's take the first audio track */
-        for (i = 0; i < mkv_d->num_tracks; i++)
-            if (mkv_d->tracks[i]->type == MATROSKA_TRACK_AUDIO
-                && mkv_d->tracks[i]->id >= 0) {
-                track = mkv_d->tracks[i];
-                break;
-            }
-
-    if (track && demuxer->a_streams[track->id]) {
-        demuxer->audio->id = track->id;
-        demuxer->audio->sh = demuxer->a_streams[track->id];
-    } else {
-        mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[mkv] No audio track found/wanted.\n");
-        demuxer->audio->id = -2;
-    }
+    demuxer->audio->id = -2;  // wait for higher-level code to select track
 
     if (s->end_pos == 0)
         demuxer->seekable = 0;
@@ -1864,26 +1838,6 @@ static int demux_mkv_read_block_lacing(uint8_t *buffer, uint64_t *size,
     return 1;
 }
 
-static void handle_subtitles(demuxer_t *demuxer, mkv_track_t *track,
-                             char *block, int64_t size,
-                             uint64_t block_duration, uint64_t timecode)
-{
-    demux_packet_t *dp;
-
-    if (block_duration == 0) {
-        mp_msg(MSGT_DEMUX, MSGL_WARN,
-               "[mkv] Warning: No BlockDuration for subtitle track found.\n");
-        return;
-    }
-
-    sub_utf8 = 1;
-    dp = new_demux_packet(size);
-    memcpy(dp->buffer, block, size);
-    dp->pts = timecode / 1e9;
-    dp->duration = block_duration / 1e9;
-    ds_add_packet(demuxer->sub, dp);
-}
-
 static void handle_realvideo(demuxer_t *demuxer, mkv_track_t *track,
                              uint8_t *buffer, uint32_t size, int64_t block_bref)
 {
@@ -2098,15 +2052,12 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
     } else if (track->type == MATROSKA_TRACK_SUBTITLE
                && track->id == demuxer->sub->id) {
         ds = demuxer->sub;
-        if (track->subtitle_type != MATROSKA_SUBTYPE_VOBSUB) {
-            uint8_t *buffer;
-            int size = length;
-            demux_mkv_decode(track, block, &buffer, &size, 1);
-            handle_subtitles(demuxer, track, buffer, size, block_duration, tc);
-            if (buffer != block)
-                talloc_free(buffer);
+        if (laces > 1) {
+            mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Subtitles use Matroska "
+                   "lacing. This is abnormal and not supported.\n");
             use_this_block = 0;
         }
+        sub_utf8 = 1; // XXX this variable should be eventually removed
     } else
         use_this_block = 0;
 
@@ -2139,6 +2090,7 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
                     if (i == 0 || track->default_duration)
                         dp->pts =
                             mkv_d->last_pts + i * track->default_duration;
+                    dp->duration = block_duration / 1e9;
                     ds_add_packet(ds, dp);
                 }
             }
@@ -2532,6 +2484,21 @@ static int demux_mkv_control(demuxer_t *demuxer, int cmd, void *arg)
         demuxer->audio->id = new_aid;
         return DEMUXER_CTRL_OK;
 
+    case DEMUXER_CTRL_SWITCH_VIDEO:;
+        int new_vid = *(int *) arg;
+        int current_vid = demuxer->video->id;
+        if (current_vid < 0)
+            current_vid = -1;
+        if (new_vid == -1)  // cycle to next
+            new_vid = (current_vid + 2) % (mkv_d->num_video_tracks + 1) - 1;
+        if (new_vid < 0 || new_vid >= mkv_d->num_video_tracks)
+            new_vid = -2;
+        *(int *) arg = new_vid;
+        if (current_vid != new_vid)
+            ds_free_packs(demuxer->video);
+        demuxer->video->id = new_vid;
+        return DEMUXER_CTRL_OK;
+
     default:
         return DEMUXER_CTRL_NOTIMPL;
     }
diff --git a/mplayer/libmpdemux/demux_ogg.c b/mplayer/libmpdemux/demux_ogg.c
index 3ba2627..f2a5aa7 100644
--- a/mplayer/libmpdemux/demux_ogg.c
+++ b/mplayer/libmpdemux/demux_ogg.c
@@ -1412,7 +1412,7 @@ static void demux_ogg_seek(demuxer_t *demuxer, float rel_seek_secs,
     demux_stream_t *ds;
     ogg_packet op;
     float rate;
-    int i, sp, first, precision = 1, do_seek = 1;
+    int i, sp, first = 1, precision = 1, do_seek = 1;
     vorbis_info *vi = NULL;
     int64_t gp = 0, old_gp;
     off_t pos, old_pos;
diff --git a/mplayer/libmpdemux/demux_ts.c b/mplayer/libmpdemux/demux_ts.c
index 237a524..0085f28 100644
--- a/mplayer/libmpdemux/demux_ts.c
+++ b/mplayer/libmpdemux/demux_ts.c
@@ -1029,7 +1029,7 @@ static demuxer_t *demux_open_ts(demuxer_t * demuxer)
 
 	if(demuxer->opts->audio_lang != NULL)
 	{
-		strncpy(params.alang, demuxer->opts->audio_lang, 3);
+		strncpy(params.alang, demuxer->opts->audio_lang[0], 3);
 		params.alang[3] = 0;
 	}
 	else
diff --git a/mplayer/libmpdemux/demuxer.c b/mplayer/libmpdemux/demuxer.c
index 6607f23..a4cee9b 100644
--- a/mplayer/libmpdemux/demuxer.c
+++ b/mplayer/libmpdemux/demuxer.c
@@ -53,6 +53,7 @@
 static void clear_parser(sh_common_t *sh);
 
 // Demuxer list
+extern const struct demuxer_desc demuxer_desc_edl;
 extern const demuxer_desc_t demuxer_desc_rawaudio;
 extern const demuxer_desc_t demuxer_desc_rawvideo;
 extern const demuxer_desc_t demuxer_desc_tv;
@@ -101,6 +102,7 @@ extern const demuxer_desc_t demuxer_desc_mng;
  * libraries and demuxers requiring binary support. */
 
 const demuxer_desc_t *const demuxer_list[] = {
+    &demuxer_desc_edl,
     &demuxer_desc_rawaudio,
     &demuxer_desc_rawvideo,
 #ifdef CONFIG_TV
@@ -253,13 +255,13 @@ void free_demux_packet(struct demux_packet *dp)
     free(dp);
 }
 
-void free_demuxer_stream(demux_stream_t *ds)
+static void free_demuxer_stream(struct demux_stream *ds)
 {
     ds_free_packs(ds);
     free(ds);
 }
 
-demux_stream_t *new_demuxer_stream(struct demuxer *demuxer, int id)
+static struct demux_stream *new_demuxer_stream(struct demuxer *demuxer, int id)
 {
     demux_stream_t *ds = malloc(sizeof(demux_stream_t));
     *ds = (demux_stream_t){
@@ -881,19 +883,18 @@ void demuxer_help(void)
     int i;
 
     mp_msg(MSGT_DEMUXER, MSGL_INFO, "Available demuxers:\n");
-    mp_msg(MSGT_DEMUXER, MSGL_INFO, " demuxer:  type  info:  (comment)\n");
+    mp_msg(MSGT_DEMUXER, MSGL_INFO, " demuxer:   info:  (comment)\n");
     mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_DEMUXERS\n");
     for (i = 0; demuxer_list[i]; i++) {
-        if (demuxer_list[i]->type > DEMUXER_TYPE_MAX)   // Don't display special demuxers
+        if (demuxer_list[i]->type >= DEMUXER_TYPE_END)  // internal type
             continue;
         if (demuxer_list[i]->comment && strlen(demuxer_list[i]->comment))
-            mp_msg(MSGT_DEMUXER, MSGL_INFO, "%10s  %2d   %s (%s)\n",
-                   demuxer_list[i]->name, demuxer_list[i]->type,
-                   demuxer_list[i]->info, demuxer_list[i]->comment);
+            mp_msg(MSGT_DEMUXER, MSGL_INFO, "%10s  %s (%s)\n",
+                   demuxer_list[i]->name, demuxer_list[i]->info,
+                   demuxer_list[i]->comment);
         else
-            mp_msg(MSGT_DEMUXER, MSGL_INFO, "%10s  %2d   %s\n",
-                   demuxer_list[i]->name, demuxer_list[i]->type,
-                   demuxer_list[i]->info);
+            mp_msg(MSGT_DEMUXER, MSGL_INFO, "%10s  %s\n",
+                   demuxer_list[i]->name, demuxer_list[i]->info);
     }
 }
 
@@ -906,32 +907,22 @@ void demuxer_help(void)
  *                        May be NULL.
  * @return                DEMUXER_TYPE_xxx, -1 if error or not found
  */
-int get_demuxer_type_from_name(char *demuxer_name, int *force)
+static int get_demuxer_type_from_name(char *demuxer_name, int *force)
 {
-    int i;
-    long type_int;
-    char *endptr;
-
     if (!demuxer_name || !demuxer_name[0])
         return DEMUXER_TYPE_UNKNOWN;
     if (force)
         *force = demuxer_name[0] == '+';
     if (demuxer_name[0] == '+')
         demuxer_name = &demuxer_name[1];
-    for (i = 0; demuxer_list[i]; i++) {
-        if (demuxer_list[i]->type > DEMUXER_TYPE_MAX)   // Can't select special demuxers from commandline
+    for (int i = 0; demuxer_list[i]; i++) {
+        if (demuxer_list[i]->type >= DEMUXER_TYPE_END)
+            // Can't select special demuxers from commandline
             continue;
         if (strcmp(demuxer_name, demuxer_list[i]->name) == 0)
             return demuxer_list[i]->type;
     }
 
-    // No match found, try to parse name as an integer (demuxer number)
-    type_int = strtol(demuxer_name, &endptr, 0);
-    if (*endptr)  // Conversion failed
-        return -1;
-    if ((type_int > 0) && (type_int <= DEMUXER_TYPE_MAX))
-        return (int) type_int;
-
     return -1;
 }
 
@@ -1351,11 +1342,15 @@ int demuxer_switch_audio(demuxer_t *demuxer, int index)
 int demuxer_switch_video(demuxer_t *demuxer, int index)
 {
     int res = demux_control(demuxer, DEMUXER_CTRL_SWITCH_VIDEO, &index);
-    if (res == DEMUXER_CTRL_NOTIMPL)
-        index = demuxer->video->id;
-    if (demuxer->video->id >= 0)
-        demuxer->video->sh = demuxer->v_streams[demuxer->video->id];
-    else
+    if (res == DEMUXER_CTRL_NOTIMPL) {
+        struct sh_video *sh_video = demuxer->video->sh;
+        return sh_video ? sh_video->vid : -2;
+    }
+    if (demuxer->video->id >= 0) {
+        struct sh_video *sh_video = demuxer->v_streams[demuxer->video->id];
+        demuxer->video->sh = sh_video;
+        index = sh_video->vid; // internal MPEG demuxers don't set it right
+    } else
         demuxer->video->sh = NULL;
     return index;
 }
@@ -1566,18 +1561,15 @@ int demuxer_set_angle(demuxer_t *demuxer, int angle)
     return angle;
 }
 
-int demuxer_audio_track_by_lang_and_default(struct demuxer *d, char *lang)
+int demuxer_audio_track_by_lang_and_default(struct demuxer *d, char **langt)
 {
-    if (!lang)
-        lang = "";
+    int n = 0;
     while (1) {
-        lang += strspn(lang, ",");
-        int len = strcspn(lang, ",");
+        char *lang = langt ? langt[n++] : NULL;
         int id = -1;
         for (int i = 0; i < MAX_A_STREAMS; i++) {
             struct sh_audio *sh = d->a_streams[i];
-            if (sh && (!len || sh->lang && strlen(sh->lang) == len &&
-                       !memcmp(lang, sh->lang, len))) {
+            if (sh && (!lang || sh->lang && !strcmp(lang, sh->lang))) {
                 if (sh->default_track)
                     return sh->aid;
                 if (id < 0)
@@ -1586,34 +1578,29 @@ int demuxer_audio_track_by_lang_and_default(struct demuxer *d, char *lang)
         }
         if (id >= 0)
             return id;
-        if (!len)
+        if (!lang)
             return -1;
-        lang += len;
     }
 }
 
-int demuxer_sub_track_by_lang_and_default(struct demuxer *d, char *lang)
+int demuxer_sub_track_by_lang_and_default(struct demuxer *d, char **langt)
 {
-    if (!lang)
-        lang = "";
+    int n = 0;
     while (1) {
-        lang += strspn(lang, ",");
-        int len = strcspn(lang, ",");
+        char *lang = langt ? langt[n++] : NULL;
         int id = -1;
         for (int i = 0; i < MAX_S_STREAMS; i++) {
             struct sh_sub *sh = d->s_streams[i];
-            if (sh && (!len || sh->lang && strlen(sh->lang) == len &&
-                       !memcmp(lang, sh->lang, len))) {
+            if (sh && (!lang || sh->lang && !strcmp(lang, sh->lang))) {
                 if (sh->default_track)
                     return sh->sid;
                 if (id < 0)
                     id = sh->sid;
             }
         }
-        if (!len)
+        if (!lang)
             return -1;
         if (id >= 0)
             return id;
-        lang += len;
     }
 }
diff --git a/mplayer/libmpdemux/demuxer.h b/mplayer/libmpdemux/demuxer.h
index e66b8f8..ed2d651 100644
--- a/mplayer/libmpdemux/demuxer.h
+++ b/mplayer/libmpdemux/demuxer.h
@@ -32,8 +32,8 @@
 struct MPOpts;
 
 #ifdef HAVE_BUILTIN_EXPECT
-#define likely(x) __builtin_expect ((x) != 0, 1)
-#define unlikely(x) __builtin_expect ((x) != 0, 0)
+#define likely(x) __builtin_expect((x) != 0, 1)
+#define unlikely(x) __builtin_expect((x) != 0, 0)
 #else
 #define likely(x) (x)
 #define unlikely(x) (x)
@@ -42,60 +42,61 @@ struct MPOpts;
 #define MAX_PACKS 4096
 #define MAX_PACK_BYTES 0x8000000  // 128 MiB
 
-#define DEMUXER_TYPE_UNKNOWN 0
-#define DEMUXER_TYPE_MPEG_ES 1
-#define DEMUXER_TYPE_MPEG_PS 2
-#define DEMUXER_TYPE_AVI 3
-#define DEMUXER_TYPE_AVI_NI 4
-#define DEMUXER_TYPE_AVI_NINI 5
-#define DEMUXER_TYPE_ASF 6
-#define DEMUXER_TYPE_MOV 7
-#define DEMUXER_TYPE_VIVO 8
-#define DEMUXER_TYPE_TV 9
-#define DEMUXER_TYPE_FLI 10
-#define DEMUXER_TYPE_REAL 11
-#define DEMUXER_TYPE_Y4M 12
-#define DEMUXER_TYPE_FILM 14
-#define DEMUXER_TYPE_ROQ 15
-#define DEMUXER_TYPE_MF 16
-#define DEMUXER_TYPE_AUDIO 17
-#define DEMUXER_TYPE_OGG 18
-#define DEMUXER_TYPE_RAWAUDIO 20
-#define DEMUXER_TYPE_RTP 21
-#define DEMUXER_TYPE_RAWDV 22
-#define DEMUXER_TYPE_PVA 23
-#define DEMUXER_TYPE_SMJPEG 24
-#define DEMUXER_TYPE_XMMS 25
-#define DEMUXER_TYPE_RAWVIDEO 26
-#define DEMUXER_TYPE_MPEG4_ES 27
-#define DEMUXER_TYPE_GIF 28
-#define DEMUXER_TYPE_MPEG_TS 29
-#define DEMUXER_TYPE_H264_ES 30
-#define DEMUXER_TYPE_MATROSKA 31
-#define DEMUXER_TYPE_REALAUDIO 32
-#define DEMUXER_TYPE_MPEG_TY 33
-#define DEMUXER_TYPE_LMLM4 34
-#define DEMUXER_TYPE_LAVF 35
-#define DEMUXER_TYPE_NSV 36
-#define DEMUXER_TYPE_VQF 37
-#define DEMUXER_TYPE_AVS 38
-#define DEMUXER_TYPE_AAC 39
-#define DEMUXER_TYPE_MPC 40
-#define DEMUXER_TYPE_MPEG_PES 41
-#define DEMUXER_TYPE_MPEG_GXF 42
-#define DEMUXER_TYPE_NUT 43
-#define DEMUXER_TYPE_LAVF_PREFERRED 44
-#define DEMUXER_TYPE_RTP_NEMESI 45
-#define DEMUXER_TYPE_MNG 46
-
-// This should always match the higest demuxer type number.
-// Unless you want to disallow users to force the demuxer to some types
-#define DEMUXER_TYPE_MIN 0
-#define DEMUXER_TYPE_MAX 46
-
-#define DEMUXER_TYPE_DEMUXERS (1<<16)
-// A virtual demuxer type for the network code
-#define DEMUXER_TYPE_PLAYLIST (2<<16)
+enum demuxer_type {
+    DEMUXER_TYPE_UNKNOWN = 0,
+    DEMUXER_TYPE_MPEG_ES,
+    DEMUXER_TYPE_MPEG_PS,
+    DEMUXER_TYPE_AVI,
+    DEMUXER_TYPE_AVI_NI,
+    DEMUXER_TYPE_AVI_NINI,
+    DEMUXER_TYPE_ASF,
+    DEMUXER_TYPE_MOV,
+    DEMUXER_TYPE_VIVO,
+    DEMUXER_TYPE_TV,
+    DEMUXER_TYPE_FLI,
+    DEMUXER_TYPE_REAL,
+    DEMUXER_TYPE_Y4M,
+    DEMUXER_TYPE_FILM,
+    DEMUXER_TYPE_ROQ,
+    DEMUXER_TYPE_MF,
+    DEMUXER_TYPE_AUDIO,
+    DEMUXER_TYPE_OGG,
+    DEMUXER_TYPE_RAWAUDIO,
+    DEMUXER_TYPE_RTP,
+    DEMUXER_TYPE_RAWDV,
+    DEMUXER_TYPE_PVA,
+    DEMUXER_TYPE_SMJPEG,
+    DEMUXER_TYPE_XMMS,
+    DEMUXER_TYPE_RAWVIDEO,
+    DEMUXER_TYPE_MPEG4_ES,
+    DEMUXER_TYPE_GIF,
+    DEMUXER_TYPE_MPEG_TS,
+    DEMUXER_TYPE_H264_ES,
+    DEMUXER_TYPE_MATROSKA,
+    DEMUXER_TYPE_REALAUDIO,
+    DEMUXER_TYPE_MPEG_TY,
+    DEMUXER_TYPE_LMLM4,
+    DEMUXER_TYPE_LAVF,
+    DEMUXER_TYPE_NSV,
+    DEMUXER_TYPE_VQF,
+    DEMUXER_TYPE_AVS,
+    DEMUXER_TYPE_AAC,
+    DEMUXER_TYPE_MPC,
+    DEMUXER_TYPE_MPEG_PES,
+    DEMUXER_TYPE_MPEG_GXF,
+    DEMUXER_TYPE_NUT,
+    DEMUXER_TYPE_LAVF_PREFERRED,
+    DEMUXER_TYPE_RTP_NEMESI,
+    DEMUXER_TYPE_MNG,
+    DEMUXER_TYPE_EDL,
+
+    /* Values after this are for internal use and can not be selected
+     * as demuxer type by the user (-demuxer option). */
+    DEMUXER_TYPE_END,
+
+    DEMUXER_TYPE_DEMUXERS,
+    DEMUXER_TYPE_PLAYLIST,
+};
 
 enum timestamp_type {
     TIMESTAMP_TYPE_PTS,
@@ -125,54 +126,54 @@ enum timestamp_type {
 
 // Holds one packet/frame/whatever
 typedef struct demux_packet {
-  int len;
-  double pts;
-  double duration;
-  double stream_pts;
-  off_t pos;  // position in index (AVI) or file (MPG)
-  unsigned char* buffer;
-  int flags; // keyframe, etc
-  int refcount;   //refcounter for the master packet, if 0, buffer can be free()d
-  struct demux_packet *master; //pointer to the master packet if this one is a cloned one
-  struct demux_packet *next;
+    int len;
+    double pts;
+    double duration;
+    double stream_pts;
+    off_t pos; // position in index (AVI) or file (MPG)
+    unsigned char *buffer;
+    int flags; // keyframe, etc
+    int refcount; // counter for the master packet, if 0, buffer can be free()d
+    struct demux_packet *master; //in clones, pointer to the master packet
+    struct demux_packet *next;
 } demux_packet_t;
 
 typedef struct demux_stream {
-  int buffer_pos;          // current buffer position
-  int buffer_size;         // current buffer size
-  unsigned char* buffer;   // current buffer, never free() it, always use free_demux_packet(buffer_ref);
-  double pts;              // current buffer's pts
-  int pts_bytes;           // number of bytes read after last pts stamp
-  int eof;                 // end of demuxed stream? (true if all buffer empty)
-  off_t pos;                 // position in the input stream (file)
-  off_t dpos;                // position in the demuxed stream
-  int pack_no;		   // serial number of packet
-  int flags;               // flags of current packet (keyframe etc)
-  int non_interleaved;     // 1 if this stream is not properly interleaved,
+    int buffer_pos;        // current buffer position
+    int buffer_size;       // current buffer size
+    unsigned char *buffer; // current buffer, never free() it, always use free_demux_packet(buffer_ref);
+    double pts;            // current buffer's pts
+    int pts_bytes;         // number of bytes read after last pts stamp
+    int eof;               // end of demuxed stream? (true if all buffer empty)
+    off_t pos;               // position in the input stream (file)
+    off_t dpos;              // position in the demuxed stream
+    int pack_no;           // serial number of packet
+    int flags;             // flags of current packet (keyframe etc)
+    int non_interleaved;   // 1 if this stream is not properly interleaved,
                            // so e.g. subtitle handling must do explicit reads.
 //---------------
-  int packs;              // number of packets in buffer
-  int bytes;              // total bytes of packets in buffer
-  demux_packet_t *first;  // read to current buffer from here
-  demux_packet_t *last;   // append new packets from input stream to here
-  demux_packet_t *current;// needed for refcounting of the buffer
-  int id;                 // stream ID  (for multiple audio/video streams)
-  struct demuxer *demuxer; // parent demuxer structure (stream handler)
+    int packs;            // number of packets in buffer
+    int bytes;            // total bytes of packets in buffer
+    demux_packet_t *first; // read to current buffer from here
+    demux_packet_t *last; // append new packets from input stream to here
+    demux_packet_t *current; // needed for refcounting of the buffer
+    int id;               // stream ID  (for multiple audio/video streams)
+    struct demuxer *demuxer; // parent demuxer structure (stream handler)
 // ---- asf -----
-  demux_packet_t *asf_packet;  // read asf fragments here
-  int asf_seq;
+    struct demux_packet *asf_packet; // read asf fragments here
+    int asf_seq;
 // ---- mov -----
-  unsigned int ss_mul,ss_div;
+    unsigned int ss_mul, ss_div;
 // ---- stream header ----
-  void* sh;
+    void *sh;
 } demux_stream_t;
 
 typedef struct demuxer_info {
-  char *name;
-  char *author;
-  char *encoder;
-  char *comments;
-  char *copyright;
+    char *name;
+    char *author;
+    char *encoder;
+    char *comments;
+    char *copyright;
 } demuxer_info_t;
 
 #define MAX_A_STREAMS 256
@@ -185,33 +186,36 @@ struct demuxer;
  * Demuxer description structure
  */
 typedef struct demuxer_desc {
-  const char *info; ///< What is it (long name and/or description)
-  const char *name; ///< Demuxer name, used with -demuxer switch
-  const char *shortdesc; ///< Description printed at demuxer detection
-  const char *author; ///< Demuxer author(s)
-  const char *comment; ///< Comment, printed with -demuxer help
-
-  int type; ///< DEMUXER_TYPE_xxx
-  int safe_check; ///< If 1 detection is safe and fast, do it before file extension check
-
-  /// Check if can demux the file, return DEMUXER_TYPE_xxx on success
-  int (*check_file)(struct demuxer *demuxer); ///< Mandatory if safe_check == 1, else optional
-  /// Get packets from file, return 0 on eof
-  int (*fill_buffer)(struct demuxer *demuxer, demux_stream_t *ds); ///< Mandatory
-  /// Open the demuxer, return demuxer on success, NULL on failure
-  struct demuxer* (*open)(struct demuxer *demuxer); ///< Optional
-  /// Close the demuxer
-  void (*close)(struct demuxer *demuxer); ///< Optional
-  // Seek
-  void (*seek)(struct demuxer *demuxer, float rel_seek_secs, float audio_delay, int flags); ///< Optional
-  // Control
-  int (*control)(struct demuxer *demuxer, int cmd, void *arg); ///< Optional
+    const char *info;      // What is it (long name and/or description)
+    const char *name;      // Demuxer name, used with -demuxer switch
+    const char *shortdesc; // Description printed at demuxer detection
+    const char *author;    // Demuxer author(s)
+    const char *comment;   // Comment, printed with -demuxer help
+
+    enum demuxer_type type;
+    // If 1 detection is safe and fast, do it before file extension check
+    int safe_check;
+
+    // Check if can demux the file, return DEMUXER_TYPE_xxx on success
+    // Mandatory if safe_check == 1, else optional
+    int (*check_file)(struct demuxer *demuxer);
+    /// Get packets from file, return 0 on eof. Mandatory
+    int (*fill_buffer)(struct demuxer *demuxer, struct demux_stream *ds);
+    /// Open the demuxer, return demuxer on success, NULL on failure
+    struct demuxer *(*open)(struct demuxer *demuxer); // Optional
+    /// Close the demuxer
+    void (*close)(struct demuxer *demuxer); // Optional
+    // Seek. Optional
+    void (*seek)(struct demuxer *demuxer, float rel_seek_secs,
+                 float audio_delay, int flags);
+    // Various control functions. Optional
+    int (*control)(struct demuxer *demuxer, int cmd, void *arg);
 } demuxer_desc_t;
 
 typedef struct demux_chapter
 {
-  uint64_t start, end;
-  char* name;
+    uint64_t start, end;
+    char *name;
 } demux_chapter_t;
 
 struct matroska_data {
@@ -229,59 +233,67 @@ struct matroska_data {
 
 typedef struct demux_attachment
 {
-  char* name;
-  char* type;
-  void* data;
-  unsigned int data_size;
+    char *name;
+    char *type;
+    void *data;
+    unsigned int data_size;
 } demux_attachment_t;
 
 typedef struct demuxer {
-  const demuxer_desc_t *desc;  ///< Demuxer description structure
-  char *filetype; // format name when not identified by demuxer (libavformat)
-  off_t filepos; // input stream current pos.
-  off_t movi_start;
-  off_t movi_end;
-  stream_t *stream;
-  double stream_pts;       // current stream pts, if applicable (e.g. dvd)
-  double reference_clock;
-  char *filename; ///< Needed by avs_check_file
-  int synced;  // stream synced (used by mpeg)
-  int type;    // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf
-  int file_format;  // file format: mpeg/avi/asf
-  int seekable;  // flag
+    const demuxer_desc_t *desc; ///< Demuxer description structure
+    char *filetype; // format name when not identified by demuxer (libavformat)
+    off_t filepos;  // input stream current pos.
+    off_t movi_start;
+    off_t movi_end;
+    struct stream *stream;
+    double stream_pts;     // current stream pts, if applicable (e.g. dvd)
+    double reference_clock;
+    char *filename;  // Needed by avs_check_file
+    int synced;      // stream synced (used by mpeg)
+    enum demuxer_type type;
+    /* Normally the file_format field is just a copy of the type field above.
+     * There are 2 exceptions I noticed. Internal demux_avi may force
+     * ->type to DEMUXER_TYPE_AVI_[NI|NINI] while leaving ->file_format at
+     * DEMUXER_TYPE_AVI. Internal demux_mov may set ->type to
+     * DEMUXER_TYPE_PLAYLIST and also return that from the check function
+     * or not (looks potentially buggy). */
+    enum demuxer_type file_format;
+    int seekable; // flag
     /* Set if using absolute seeks for small movements is OK (no pts resets
      * that would make pts ambigious, preferably supports back/forward flags */
     bool accurate_seek;
     enum timestamp_type timestamp_type;
-  //
-  demux_stream_t *audio; // audio buffer/demuxer
-  demux_stream_t *video; // video buffer/demuxer
-  demux_stream_t *sub;   // dvd subtitle buffer/demuxer
 
-  // stream headers:
-  struct sh_audio *a_streams[MAX_A_STREAMS];
-  struct sh_video *v_streams[MAX_V_STREAMS];
-  struct sh_sub   *s_streams[MAX_S_STREAMS];
+    struct demux_stream *audio; // audio buffer/demuxer
+    struct demux_stream *video; // video buffer/demuxer
+    struct demux_stream *sub;   // dvd subtitle buffer/demuxer
+
+    // stream headers:
+    struct sh_audio *a_streams[MAX_A_STREAMS];
+    struct sh_video *v_streams[MAX_V_STREAMS];
+    struct sh_sub   *s_streams[MAX_S_STREAMS];
 
-  // pointer to teletext decoder private data, if demuxer stream contains teletext
-  void *teletext;
+    // teletext decoder private data, if demuxer stream contains teletext
+    void *teletext;
 
-  demux_chapter_t* chapters;
-  int num_chapters;
+    struct demux_chapter *chapters;
+    int num_chapters;
 
-  demux_attachment_t* attachments;
-  int num_attachments;
+    struct demux_attachment *attachments;
+    int num_attachments;
 
     struct matroska_data matroska_data;
+    // for trivial demuxers which just read the whole file for codec to use
+    struct bstr file_contents;
 
-  void* priv;  // fileformat-dependent data
-  char** info;
-  struct MPOpts *opts;
+    void *priv;   // demuxer-specific internal data
+    char **info;  // metadata
+    struct MPOpts *opts;
 } demuxer_t;
 
 typedef struct {
-  int progid;        //program id
-  int aid, vid, sid; //audio, video and subtitle id
+    int progid;      //program id
+    int aid, vid, sid; //audio, video and subtitle id
 } demux_program_t;
 
 struct demux_packet *new_demux_packet(size_t len);
@@ -293,80 +305,76 @@ void free_demux_packet(struct demux_packet *dp);
 #define SIZE_MAX ((size_t)-1)
 #endif
 
-static inline void *realloc_struct(void *ptr, size_t nmemb, size_t size) {
-  if (nmemb > SIZE_MAX / size) {
-    free(ptr);
-    return NULL;
-  }
-  return realloc(ptr, nmemb * size);
+static inline void *realloc_struct(void *ptr, size_t nmemb, size_t size)
+{
+    if (nmemb > SIZE_MAX / size) {
+        free(ptr);
+        return NULL;
+    }
+    return realloc(ptr, nmemb * size);
 }
 
-demux_stream_t* new_demuxer_stream(struct demuxer *demuxer,int id);
-demuxer_t* new_demuxer(struct MPOpts *opts, stream_t *stream,int type,int a_id,int v_id,int s_id,char *filename);
-void free_demuxer_stream(demux_stream_t *ds);
-void free_demuxer(demuxer_t *demuxer);
+struct demuxer *new_demuxer(struct MPOpts *opts, struct stream *stream,
+                            int type, int a_id, int v_id, int s_id,
+                            char *filename);
+void free_demuxer(struct demuxer *demuxer);
 
-void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp);
-void ds_read_packet(demux_stream_t *ds, stream_t *stream, int len, double pts, off_t pos, int flags);
+void ds_add_packet(struct demux_stream *ds, struct demux_packet *dp);
+void ds_read_packet(struct demux_stream *ds, struct stream *stream, int len,
+                    double pts, off_t pos, int flags);
 
-int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds);
-int ds_fill_buffer(demux_stream_t *ds);
+int demux_fill_buffer(struct demuxer *demux, struct demux_stream *ds);
+int ds_fill_buffer(struct demux_stream *ds);
 
-static inline off_t ds_tell(demux_stream_t *ds){
-  return (ds->dpos-ds->buffer_size)+ds->buffer_pos;
+static inline off_t ds_tell(struct demux_stream *ds)
+{
+    return (ds->dpos - ds->buffer_size) + ds->buffer_pos;
 }
 
-static inline int ds_tell_pts(demux_stream_t *ds){
-  return (ds->pts_bytes-ds->buffer_size)+ds->buffer_pos;
+static inline int ds_tell_pts(struct demux_stream *ds)
+{
+    return (ds->pts_bytes - ds->buffer_size) + ds->buffer_pos;
 }
 
-int demux_read_data(demux_stream_t *ds,unsigned char* mem,int len);
-int demux_pattern_3(demux_stream_t *ds, unsigned char *mem, int maxlen,
+int demux_read_data(struct demux_stream *ds, unsigned char *mem, int len);
+int demux_pattern_3(struct demux_stream *ds, unsigned char *mem, int maxlen,
                     int *read, uint32_t pattern);
 
-#define demux_peekc(ds) (\
-     (likely(ds->buffer_pos<ds->buffer_size)) ? ds->buffer[ds->buffer_pos] \
-     :((unlikely(!ds_fill_buffer(ds)))? (-1) : ds->buffer[ds->buffer_pos] ) )
-#if 1
-#define demux_getc(ds) (\
-     (likely(ds->buffer_pos<ds->buffer_size)) ? ds->buffer[ds->buffer_pos++] \
-     :((unlikely(!ds_fill_buffer(ds)))? (-1) : ds->buffer[ds->buffer_pos++] ) )
-#else
-static inline int demux_getc(demux_stream_t *ds){
-  if(ds->buffer_pos>=ds->buffer_size){
-    if(!ds_fill_buffer(ds)){
-//      printf("DEMUX_GETC: EOF reached!\n");
-      return -1; // EOF
-    }
-  }
-//  printf("[%02X]",ds->buffer[ds->buffer_pos]);
-  return ds->buffer[ds->buffer_pos++];
-}
-#endif
-
-void ds_free_packs(demux_stream_t *ds);
-int ds_get_packet(demux_stream_t *ds,unsigned char **start);
-int ds_get_packet_pts(demux_stream_t *ds, unsigned char **start, double *pts);
-int ds_get_packet_sub(demux_stream_t *ds,unsigned char **start);
-double ds_get_next_pts(demux_stream_t *ds);
-int ds_parse(demux_stream_t *sh, uint8_t **buffer, int *len, double pts, off_t pos);
-void ds_clear_parser(demux_stream_t *sh);
-
-// This is defined here because demux_stream_t ins't defined in stream.h
-stream_t* new_ds_stream(demux_stream_t *ds);
-
-static inline int avi_stream_id(unsigned int id){
-  unsigned char a,b;
-  a = id - '0';
-  b = (id >> 8) - '0';
-  if(a>9 || b>9) return 100; // invalid ID
-  return a*10+b;
+#define demux_peekc(ds) ( \
+        (likely(ds->buffer_pos<ds->buffer_size)) ? ds->buffer[ds->buffer_pos] \
+        : ((unlikely(!ds_fill_buffer(ds))) ? (-1) : ds->buffer[ds->buffer_pos]))
+#define demux_getc(ds) ( \
+        (likely(ds->buffer_pos<ds->buffer_size)) ? ds->buffer[ds->buffer_pos++] \
+        : ((unlikely(!ds_fill_buffer(ds))) ? (-1) : ds->buffer[ds->buffer_pos++]))
+
+void ds_free_packs(struct demux_stream *ds);
+int ds_get_packet(struct demux_stream *ds, unsigned char **start);
+int ds_get_packet_pts(struct demux_stream *ds, unsigned char **start,
+                      double *pts);
+int ds_get_packet_sub(struct demux_stream *ds, unsigned char **start);
+double ds_get_next_pts(struct demux_stream *ds);
+int ds_parse(struct demux_stream *sh, uint8_t **buffer, int *len, double pts,
+             off_t pos);
+void ds_clear_parser(struct demux_stream *sh);
+
+static inline int avi_stream_id(unsigned int id)
+{
+    unsigned char a, b;
+    a = id - '0';
+    b = (id >> 8) - '0';
+    if (a>9 || b>9)
+        return 100;          // invalid ID
+    return a * 10 + b;
 }
 
-demuxer_t* demux_open(struct MPOpts *opts, stream_t *stream,int file_format,int aid,int vid,int sid,char* filename);
-void demux_flush(demuxer_t *demuxer);
-int demux_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags);
-demuxer_t*  new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd);
+struct demuxer *demux_open(struct MPOpts *opts, struct stream *stream,
+                           int file_format, int aid, int vid, int sid,
+                           char *filename);
+void demux_flush(struct demuxer *demuxer);
+int demux_seek(struct demuxer *demuxer, float rel_seek_secs, float audio_delay,
+               int flags);
+struct demuxer *new_demuxers_demuxer(struct demuxer *vd, struct demuxer *ad,
+                                     struct demuxer *sd);
 
 // AVI demuxer params:
 extern int index_mode;  // -1=untouched  0=don't use index  1=use (geneate) index
@@ -374,48 +382,46 @@ extern char *index_file_save, *index_file_load;
 extern int force_ni;
 extern int pts_from_bps;
 
-extern int extension_parsing;
-
-int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param);
-int demux_info_add_bstr(demuxer_t *demuxer, struct bstr opt, struct bstr param);
-char* demux_info_get(demuxer_t *demuxer, const char *opt);
-int demux_info_print(demuxer_t *demuxer);
-int demux_control(demuxer_t *demuxer, int cmd, void *arg);
+int demux_info_add(struct demuxer *demuxer, const char *opt, const char *param);
+int demux_info_add_bstr(struct demuxer *demuxer, struct bstr opt,
+                        struct bstr param);
+char *demux_info_get(struct demuxer *demuxer, const char *opt);
+int demux_info_print(struct demuxer *demuxer);
+int demux_control(struct demuxer *demuxer, int cmd, void *arg);
 
-int demuxer_switch_audio(demuxer_t *demuxer, int index);
-int demuxer_switch_video(demuxer_t *demuxer, int index);
+int demuxer_switch_audio(struct demuxer *demuxer, int index);
+int demuxer_switch_video(struct demuxer *demuxer, int index);
 
-int demuxer_type_by_filename(char* filename);
+int demuxer_type_by_filename(char *filename);
 
 void demuxer_help(void);
-int get_demuxer_type_from_name(char *demuxer_name, int *force);
 
-int demuxer_add_attachment(demuxer_t *demuxer, struct bstr name,
+int demuxer_add_attachment(struct demuxer *demuxer, struct bstr name,
                            struct bstr type, struct bstr data);
-int demuxer_add_chapter(demuxer_t *demuxer, struct bstr name,
+int demuxer_add_chapter(struct demuxer *demuxer, struct bstr name,
                         uint64_t start, uint64_t end);
-int demuxer_seek_chapter(demuxer_t *demuxer, int chapter, double *seek_pts,
+int demuxer_seek_chapter(struct demuxer *demuxer, int chapter, double *seek_pts,
                          char **chapter_name);
 
 /// Get current chapter index if available.
-int demuxer_get_current_chapter(demuxer_t *demuxer, double time_now);
+int demuxer_get_current_chapter(struct demuxer *demuxer, double time_now);
 /// Get chapter name by index if available.
-char *demuxer_chapter_name(demuxer_t *demuxer, int chapter);
+char *demuxer_chapter_name(struct demuxer *demuxer, int chapter);
 /// Get chapter display name by index.
-char *demuxer_chapter_display_name(demuxer_t *demuxer, int chapter);
+char *demuxer_chapter_display_name(struct demuxer *demuxer, int chapter);
 /// Get chapter start time and end time by index if available.
-float demuxer_chapter_time(demuxer_t *demuxer, int chapter, float *end);
+float demuxer_chapter_time(struct demuxer *demuxer, int chapter, float *end);
 /// Get total chapter number.
-int demuxer_chapter_count(demuxer_t *demuxer);
+int demuxer_chapter_count(struct demuxer *demuxer);
 /// Get current angle index.
-int demuxer_get_current_angle(demuxer_t *demuxer);
+int demuxer_get_current_angle(struct demuxer *demuxer);
 /// Set angle.
-int demuxer_set_angle(demuxer_t *demuxer, int angle);
+int demuxer_set_angle(struct demuxer *demuxer, int angle);
 /// Get number of angles.
-int demuxer_angles_count(demuxer_t *demuxer);
+int demuxer_angles_count(struct demuxer *demuxer);
 
 /* Get the index of a track.
- * lang is a comma-separated list, NULL is same as empty list
+ * lang is a string list, NULL is same as empty list
  * Sort tracks based on the following criteria:
  * 1) earlier match in lang list, or last no match
  * 2) track is marked default (default wins)
@@ -425,7 +431,7 @@ int demuxer_angles_count(demuxer_t *demuxer);
  * For subs, select best track according to the same criteria, but return -1
  * if all tracks are no-lang-match, not-default.
  */
-int demuxer_audio_track_by_lang_and_default(struct demuxer *d, char *lang);
-int demuxer_sub_track_by_lang_and_default(struct demuxer *d, char *lang);
+int demuxer_audio_track_by_lang_and_default(struct demuxer *d, char **langt);
+int demuxer_sub_track_by_lang_and_default(struct demuxer *d, char **langt);
 
 #endif /* MPLAYER_DEMUXER_H */
diff --git a/mplayer/libmpdemux/ebml.h b/mplayer/libmpdemux/ebml.h
index 395ffc4..866e620 100644
--- a/mplayer/libmpdemux/ebml.h
+++ b/mplayer/libmpdemux/ebml.h
@@ -76,12 +76,6 @@ struct ebml_parse_ctx {
 #define MATROSKA_TRACK_SUBTITLE 0x11 /* text-subtitles */
 #define MATROSKA_TRACK_CONTROL  0x20 /* control-codes for menu or other stuff*/
 
-/* matroska subtitle types */
-#define MATROSKA_SUBTYPE_UNKNOWN   0
-#define MATROSKA_SUBTYPE_TEXT      1
-#define MATROSKA_SUBTYPE_SSA       2
-#define MATROSKA_SUBTYPE_VOBSUB    3
-
 #ifndef UINT64_MAX
 #define UINT64_MAX 18446744073709551615ULL
 #endif
diff --git a/mplayer/libmpdemux/matroska.h b/mplayer/libmpdemux/matroska.h
index 332f934..c233cd1 100644
--- a/mplayer/libmpdemux/matroska.h
+++ b/mplayer/libmpdemux/matroska.h
@@ -35,6 +35,7 @@
 #define MKV_A_AAC        "A_AAC"
 #define MKV_A_AC3        "A_AC3"
 #define MKV_A_DTS        "A_DTS"
+#define MKV_A_EAC3       "A_EAC3"
 #define MKV_A_MP2        "A_MPEG/L2"
 #define MKV_A_MP3        "A_MPEG/L3"
 #define MKV_A_PCM        "A_PCM/INT/LIT"
@@ -77,6 +78,7 @@
 #define MKV_S_TEXTSSA    "S_TEXT/SSA"
 #define MKV_S_TEXTASS    "S_TEXT/ASS"
 #define MKV_S_VOBSUB     "S_VOBSUB"
+#define MKV_S_PGS        "S_HDMV/PGS"
 #define MKV_S_SSA        "S_SSA" // Deprecated
 #define MKV_S_ASS        "S_ASS" // Deprecated
 
diff --git a/mplayer/libvo/mga_template.c b/mplayer/libvo/mga_template.c
index f42cf07..bd71694 100644
--- a/mplayer/libvo/mga_template.c
+++ b/mplayer/libvo/mga_template.c
@@ -19,7 +19,7 @@
 #include "fastmemcpy.h"
 #include "cpudetect.h"
 #include "libswscale/swscale.h"
-#include "libavcore/imgutils.h"
+#include <libavutil/imgutils.h>
 #include "libmpcodecs/vf_scale.h"
 #include "mp_msg.h"
 #include "old_vo_wrapper.h"
diff --git a/mplayer/libvo/vo_3dfx.c b/mplayer/libvo/vo_3dfx.c
index 2595b41..4f7e41e 100644
--- a/mplayer/libvo/vo_3dfx.c
+++ b/mplayer/libvo/vo_3dfx.c
@@ -40,7 +40,7 @@
 #include <signal.h>
 
 #include <X11/Xlib.h>
-#include <X11/extensions/xf86dga.h>
+#include <X11/extensions/Xxf86dga.h>
 #include <X11/Xutil.h>
 
 //#define LOG(x) syslog(LOG_USER | LOG_DEBUG,x)
diff --git a/mplayer/libvo/vo_dga.c b/mplayer/libvo/vo_dga.c
index 94d4277..001d112 100644
--- a/mplayer/libvo/vo_dga.c
+++ b/mplayer/libvo/vo_dga.c
@@ -35,7 +35,7 @@
 #include "mp_msg.h"
 
 #include <X11/Xlib.h>
-#include <X11/extensions/xf86dga.h>
+#include <X11/extensions/Xxf86dga.h>
 
 #ifdef CONFIG_XF86VM
 #include <X11/extensions/xf86vmode.h>
diff --git a/mplayer/libvo/vo_fbdev.c b/mplayer/libvo/vo_fbdev.c
index 0937c00..7d2e9fb 100644
--- a/mplayer/libvo/vo_fbdev.c
+++ b/mplayer/libvo/vo_fbdev.c
@@ -746,7 +746,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
 {
     struct fb_cmap *cmap;
     int vm   = flags & VOFLAG_MODESWITCHING;
-    int zoom = flags & VOFLAG_SWSCALE;
 
     fs = flags & VOFLAG_FULLSCREEN;
 
diff --git a/mplayer/libvo/x11_common.c b/mplayer/libvo/x11_common.c
index fa65e19..df35932 100644
--- a/mplayer/libvo/x11_common.c
+++ b/mplayer/libvo/x11_common.c
@@ -711,7 +711,7 @@ void vo_x11_classhint(struct vo *vo, Window window, const char *name)
     XClassHint wmClass;
     pid_t pid = getpid();
 
-    wmClass.res_name = opts->vo_winname ? opts->vo_winname : name;
+    wmClass.res_name = opts->vo_winname ? opts->vo_winname : (char *)name;
     wmClass.res_class = "MPlayer";
     XSetClassHint(x11->display, window, &wmClass);
     XChangeProperty(x11->display, window, x11->XA_NET_WM_PID, XA_CARDINAL,
@@ -1088,7 +1088,6 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
     goto final;
   if (x11->window_state & VOFLAG_HIDDEN) {
     XSizeHints hint;
-    XEvent xev;
     x11->window_state &= ~VOFLAG_HIDDEN;
     vo_x11_classhint(vo, x11->window, classname);
     XStoreName(mDisplay, x11->window, title);
@@ -1104,10 +1103,6 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
     // map window
     XMapWindow(mDisplay, x11->window);
     vo_x11_clearwindow(vo, x11->window);
-    // wait for map
-    do {
-      XNextEvent(mDisplay, &xev);
-    } while (xev.type != MapNotify || xev.xmap.event != x11->window);
     XSelectInput(mDisplay, x11->window, NoEventMask);
     XSync(mDisplay, False);
     vo_x11_selectinput_witherr(mDisplay, x11->window,
@@ -1836,7 +1831,7 @@ static int transform_color(float val,
     return (unsigned short) (s * 65535);
 }
 
-uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value)
+uint32_t vo_x11_set_equalizer(struct vo *vo, const char *name, int value)
 {
     float gamma, brightness, contrast;
     float rf, gf, bf;
@@ -1887,7 +1882,7 @@ uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value)
     return VO_TRUE;
 }
 
-uint32_t vo_x11_get_equalizer(char *name, int *value)
+uint32_t vo_x11_get_equalizer(const char *name, int *value)
 {
     if (cmap == None)
         return VO_NOTAVAIL;
@@ -1903,7 +1898,7 @@ uint32_t vo_x11_get_equalizer(char *name, int *value)
 }
 
 #ifdef CONFIG_XV
-int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char *name, int value)
+int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, const char *name, int value)
 {
     XvAttribute *attributes;
     int i, howmany, xv_atom;
@@ -1977,7 +1972,7 @@ int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char *name, int value)
     return VO_FALSE;
 }
 
-int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, char *name, int *value)
+int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, const char *name, int *value)
 {
 
     XvAttribute *attributes;
diff --git a/mplayer/libvo/x11_common.h b/mplayer/libvo/x11_common.h
index 32cffbb..ba3d0e2 100644
--- a/mplayer/libvo/x11_common.h
+++ b/mplayer/libvo/x11_common.h
@@ -130,8 +130,8 @@ int vo_x11_update_geometry(struct vo *vo, bool update_pos);
 void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer);
 void vo_x11_uninit(struct vo *vo);
 Colormap vo_x11_create_colormap(struct vo *vo, XVisualInfo *vinfo);
-uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value);
-uint32_t vo_x11_get_equalizer(char *name, int *value);
+uint32_t vo_x11_set_equalizer(struct vo *vo, const char *name, int value);
+uint32_t vo_x11_get_equalizer(const char *name, int *value);
 void fstype_help(void);
 void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis,
         int x, int y, unsigned int width, unsigned int height, int flags,
@@ -145,8 +145,8 @@ void vo_x11_ewmh_fullscreen(struct vo_x11_state *x11, int action);
 
 #endif
 
-int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char * name, int value);
-int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, char * name, int *value);
+int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, const char *name, int value);
+int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, const char *name, int *value);
 
 int vo_xv_enable_vsync(struct vo *vo);
 
diff --git a/mplayer/m_option.c b/mplayer/m_option.c
index 1530cc3..2501048 100644
--- a/mplayer/m_option.c
+++ b/mplayer/m_option.c
@@ -535,7 +535,6 @@ const m_option_type_t m_option_type_string = {
 
 //////////// String list
 
-#define LIST_SEPARATOR ','
 #undef VAL
 #define VAL(x) (*(char***)(x))
 
@@ -683,9 +682,9 @@ static int parse_str_list(const m_option_t* opt,const char *name, const char *pa
   if (param == NULL || strlen(param) == 0)
       return M_OPT_MISSING_PARAM;
 
-
+  char separator = opt->priv ? *(char *)opt->priv : OPTION_LIST_SEPARATOR;
   while(ptr[0] != '\0') {
-    ptr = get_nextsep(ptr, LIST_SEPARATOR, 0);
+    ptr = get_nextsep(ptr, separator, 0);
     if(!ptr) {
       n++;
       break;
@@ -707,7 +706,7 @@ static int parse_str_list(const m_option_t* opt,const char *name, const char *pa
 
   while(1) {
     last_ptr = ptr;
-    ptr = get_nextsep(ptr, LIST_SEPARATOR, 1);
+    ptr = get_nextsep(ptr, separator, 1);
     if(!ptr) {
       res[n] = strdup(last_ptr);
       n++;
@@ -1857,7 +1856,7 @@ static int parse_obj_settings_list(const m_option_t* opt,const char *name,
 
   while(ptr[0] != '\0') {
     last_ptr = ptr;
-    ptr = get_nextsep(ptr, LIST_SEPARATOR, 1);
+    ptr = get_nextsep(ptr, OPTION_LIST_SEPARATOR, 1);
 
     if(!ptr) {
       r = parse_obj_settings(name,last_ptr,opt->priv,dst ? &res : NULL,n);
diff --git a/mplayer/m_option.h b/mplayer/m_option.h
index 58deb9b..9486dd1 100644
--- a/mplayer/m_option.h
+++ b/mplayer/m_option.h
@@ -22,6 +22,8 @@
 #include <string.h>
 #include <stddef.h>
 
+#include "config.h"
+
 /// \defgroup Options
 /// m_option allows to parse, print and copy data of various types.
 /// It is the base of the \ref OptionsStruct, \ref Config and
@@ -536,11 +538,20 @@ m_option_free(const m_option_t* opt,void* dst) {
  */
 int parse_timestring(const char *str, double *time, char endchar);
 
+#define OPTION_LIST_SEPARATOR ','
+
+#if HAVE_DOS_PATHS
+#define OPTION_PATH_SEPARATOR ';'
+#else
+#define OPTION_PATH_SEPARATOR ':'
+#endif
+
 #define OPT_FLAG_ON(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 0, 1, NULL, 1, offsetof(struct MPOpts, varname)}
 #define OPT_FLAG_OFF(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 1, 0, NULL, 1, offsetof(struct MPOpts, varname)}
 #define OPT_MAKE_FLAGS(optname, varname, flags) OPT_FLAG_ON(optname, varname, flags), OPT_FLAG_OFF("no" optname, varname, flags)
 #define OPT_FLAG_CONSTANTS(optname, varname, flags, offvalue, value) {optname, NULL, &m_option_type_flag, flags, offvalue, value, NULL, 1, offsetof(struct MPOpts, varname)}
 #define OPT_STRINGLIST(optname, varname, flags) {optname, NULL, &m_option_type_string_list, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_PATHLIST(optname, varname, flags) {optname, NULL, &m_option_type_string_list, flags, 0, 0, (void *)&(const char){OPTION_PATH_SEPARATOR}, 1, offsetof(struct MPOpts, varname)}
 #define OPT_INT(optname, varname, flags) {optname, NULL, &m_option_type_int, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
 #define OPT_INTRANGE(optname, varname, flags, min, max) {optname, NULL, &m_option_type_int, (flags)|CONF_RANGE, min, max, NULL, 1, offsetof(struct MPOpts, varname)}
 #define OPT_INTPAIR(optname, varname, flags) {optname, NULL, &m_option_type_intpair, (flags), 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
diff --git a/mplayer/mixer.c b/mplayer/mixer.c
index 4b9d8db..d4e794d 100644
--- a/mplayer/mixer.c
+++ b/mplayer/mixer.c
@@ -39,9 +39,9 @@ void mixer_getvolume(mixer_t *mixer, float *l, float *r)
 {
   ao_control_vol_t vol;
   *l=0; *r=0;
-  if(mixer->audio_out){
+  if (mixer->ao) {
     if(soft_vol ||
-        CONTROL_OK != mixer->audio_out->control(AOCONTROL_GET_VOLUME,&vol)) {
+       CONTROL_OK != ao_control(mixer->ao, AOCONTROL_GET_VOLUME, &vol)) {
       if (!mixer->afilter)
         return;
       else {
@@ -64,9 +64,9 @@ void mixer_setvolume(mixer_t *mixer, float l, float r)
 {
   ao_control_vol_t vol;
   vol.right=r; vol.left=l;
-  if(mixer->audio_out){
+  if (mixer->ao) {
     if(soft_vol ||
-        CONTROL_OK != mixer->audio_out->control(AOCONTROL_SET_VOLUME,&vol)) {
+       CONTROL_OK != ao_control(mixer->ao, AOCONTROL_SET_VOLUME, &vol)) {
       if (!mixer->afilter)
         return;
       else {
diff --git a/mplayer/mixer.h b/mplayer/mixer.h
index 5a2d0e5..a524c02 100644
--- a/mplayer/mixer.h
+++ b/mplayer/mixer.h
@@ -28,7 +28,7 @@ extern int soft_vol;
 extern float soft_vol_max;
 
 typedef struct mixer_s {
-    const ao_functions_t *audio_out;
+    struct ao *ao;
     af_stream_t *afilter;
     int volstep;
     int muted;
diff --git a/mplayer/mp3lib/dct12.c b/mplayer/mp3lib/dct12.c
deleted file mode 100644
index 5ba45af..0000000
--- a/mplayer/mp3lib/dct12.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * new DCT12
- */
-static void dct12(real *in,real *rawout1,real *rawout2,register real *wi,register real *ts)
-{
-#define DCT12_PART1 \
-             in5 = in[5*3];  \
-     in5 += (in4 = in[4*3]); \
-     in4 += (in3 = in[3*3]); \
-     in3 += (in2 = in[2*3]); \
-     in2 += (in1 = in[1*3]); \
-     in1 += (in0 = in[0*3]); \
-                             \
-     in5 += in3; in3 += in1; \
-                             \
-     in2 *= COS6_1; \
-     in3 *= COS6_1; \
-
-#define DCT12_PART2 \
-     in0 += in4 * COS6_2; \
-                          \
-     in4 = in0 + in2;     \
-     in0 -= in2;          \
-                          \
-     in1 += in5 * COS6_2; \
-                          \
-     in5 = (in1 + in3) * tfcos12[0]; \
-     in1 = (in1 - in3) * tfcos12[2]; \
-                         \
-     in3 = in4 + in5;    \
-     in4 -= in5;         \
-                         \
-     in2 = in0 + in1;    \
-     in0 -= in1;
-
-
-   {
-     real in0,in1,in2,in3,in4,in5;
-     register real *out1 = rawout1;
-     ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2];
-     ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5];
-
-     DCT12_PART1
-
-     {
-       real tmp0,tmp1 = (in0 - in4);
-       {
-         real tmp2 = (in1 - in5) * tfcos12[1];
-         tmp0 = tmp1 + tmp2;
-         tmp1 -= tmp2;
-       }
-       ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1];
-       ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1];
-       ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1];
-       ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1];
-     }
-
-     DCT12_PART2
-
-     ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0];
-     ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0];
-     ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2];
-     ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2];
-
-     ts[(6+0)*SBLIMIT]  = out1[6+0] + in0 * wi[0];
-     ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0];
-     ts[(6+2)*SBLIMIT]  = out1[6+2] + in4 * wi[2];
-     ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2];
-  }
-
-  in++;
-
-  {
-     real in0,in1,in2,in3,in4,in5;
-     register real *out2 = rawout2;
-
-     DCT12_PART1
-
-     {
-       real tmp0,tmp1 = (in0 - in4);
-       {
-         real tmp2 = (in1 - in5) * tfcos12[1];
-         tmp0 = tmp1 + tmp2;
-         tmp1 -= tmp2;
-       }
-       out2[5-1] = tmp0 * wi[11-1];
-       out2[0+1] = tmp0 * wi[6+1];
-       ts[(12+1)*SBLIMIT] += tmp1 * wi[1];
-       ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1];
-     }
-
-     DCT12_PART2
-
-     out2[5-0] = in2 * wi[11-0];
-     out2[0+0] = in2 * wi[6+0];
-     out2[0+2] = in3 * wi[6+2];
-     out2[5-2] = in3 * wi[11-2];
-
-     ts[(12+0)*SBLIMIT] += in0 * wi[0];
-     ts[(17-0)*SBLIMIT] += in0 * wi[5-0];
-     ts[(12+2)*SBLIMIT] += in4 * wi[2];
-     ts[(17-2)*SBLIMIT] += in4 * wi[5-2];
-  }
-
-  in++;
-
-  {
-     real in0,in1,in2,in3,in4,in5;
-     register real *out2 = rawout2;
-     out2[12]=out2[13]=out2[14]=out2[15]=out2[16]=out2[17]=0.0;
-
-     DCT12_PART1
-
-     {
-       real tmp0,tmp1 = (in0 - in4);
-       {
-         real tmp2 = (in1 - in5) * tfcos12[1];
-         tmp0 = tmp1 + tmp2;
-         tmp1 -= tmp2;
-       }
-       out2[11-1] = tmp0 * wi[11-1];
-       out2[6 +1] = tmp0 * wi[6+1];
-       out2[0+1] += tmp1 * wi[1];
-       out2[5-1] += tmp1 * wi[5-1];
-     }
-
-     DCT12_PART2
-
-     out2[11-0] = in2 * wi[11-0];
-     out2[6 +0] = in2 * wi[6+0];
-     out2[6 +2] = in3 * wi[6+2];
-     out2[11-2] = in3 * wi[11-2];
-
-     out2[0+0] += in0 * wi[0];
-     out2[5-0] += in0 * wi[5-0];
-     out2[0+2] += in4 * wi[2];
-     out2[5-2] += in4 * wi[5-2];
-  }
-}
diff --git a/mplayer/mp3lib/dct36.c b/mplayer/mp3lib/dct36.c
deleted file mode 100644
index 22ec273..0000000
--- a/mplayer/mp3lib/dct36.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
-// This is an optimized DCT from Jeff Tsay's maplay 1.2+ package.
-// Saved one multiplication by doing the 'twiddle factor' stuff
-// together with the window mul. (MH)
-//
-// This uses Byeong Gi Lee's Fast Cosine Transform algorithm, but the
-// 9 point IDCT needs to be reduced further. Unfortunately, I don't
-// know how to do that, because 9 is not an even number. - Jeff.
-//
-//////////////////////////////////////////////////////////////////
-//
-// 9 Point Inverse Discrete Cosine Transform
-//
-// This piece of code is Copyright 1997 Mikko Tommila and is freely usable
-// by anybody. The algorithm itself is of course in the public domain.
-//
-// Again derived heuristically from the 9-point WFTA.
-//
-// The algorithm is optimized (?) for speed, not for small rounding errors or
-// good readability.
-//
-// 36 additions, 11 multiplications
-//
-// Again this is very likely sub-optimal.
-//
-// The code is optimized to use a minimum number of temporary variables,
-// so it should compile quite well even on 8-register Intel x86 processors.
-// This makes the code quite obfuscated and very difficult to understand.
-//
-// References:
-// [1] S. Winograd: "On Computing the Discrete Fourier Transform",
-//     Mathematics of Computation, Volume 32, Number 141, January 1978,
-//     Pages 175-199
-*/
-
-/*------------------------------------------------------------------*/
-/*                                                                  */
-/*    Function: Calculation of the inverse MDCT                     */
-/*                                                                  */
-/*------------------------------------------------------------------*/
-
-static void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf)
-{
-#ifdef NEW_DCT9
-  real tmp[18];
-#endif
-
-  {
-    register real *in = inbuf;
-
-    in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14];
-    in[14]+=in[13]; in[13]+=in[12]; in[12]+=in[11];
-    in[11]+=in[10]; in[10]+=in[9];  in[9] +=in[8];
-    in[8] +=in[7];  in[7] +=in[6];  in[6] +=in[5];
-    in[5] +=in[4];  in[4] +=in[3];  in[3] +=in[2];
-    in[2] +=in[1];  in[1] +=in[0];
-
-    in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9];
-    in[9] +=in[7];  in[7] +=in[5];  in[5] +=in[3];  in[3] +=in[1];
-
-
-#ifdef NEW_DCT9
-    {
-      real t0, t1, t2, t3, t4, t5, t6, t7;
-
-      t1 = COS6_2 * in[12];
-      t2 = COS6_2 * (in[8] + in[16] - in[4]);
-
-      t3 = in[0] + t1;
-      t4 = in[0] - t1 - t1;
-      t5 = t4 - t2;
-
-      t0 = cos9[0] * (in[4] + in[8]);
-      t1 = cos9[1] * (in[8] - in[16]);
-
-      tmp[4] = t4 + t2 + t2;
-      t2 = cos9[2] * (in[4] + in[16]);
-
-      t6 = t3 - t0 - t2;
-      t0 += t3 + t1;
-      t3 += t2 - t1;
-
-      t2 = cos18[0] * (in[2]  + in[10]);
-      t4 = cos18[1] * (in[10] - in[14]);
-      t7 = COS6_1 * in[6];
-
-      t1 = t2 + t4 + t7;
-      tmp[0] = t0 + t1;
-      tmp[8] = t0 - t1;
-      t1 = cos18[2] * (in[2] + in[14]);
-      t2 += t1 - t7;
-
-      tmp[3] = t3 + t2;
-      t0 = COS6_1 * (in[10] + in[14] - in[2]);
-      tmp[5] = t3 - t2;
-
-      t4 -= t1 + t7;
-
-      tmp[1] = t5 - t0;
-      tmp[7] = t5 + t0;
-      tmp[2] = t6 + t4;
-      tmp[6] = t6 - t4;
-    }
-
-    {
-      real t0, t1, t2, t3, t4, t5, t6, t7;
-
-      t1 = COS6_2 * in[13];
-      t2 = COS6_2 * (in[9] + in[17] - in[5]);
-
-      t3 = in[1] + t1;
-      t4 = in[1] - t1 - t1;
-      t5 = t4 - t2;
-
-      t0 = cos9[0] * (in[5] + in[9]);
-      t1 = cos9[1] * (in[9] - in[17]);
-
-      tmp[13] = (t4 + t2 + t2) * tfcos36[17-13];
-      t2 = cos9[2] * (in[5] + in[17]);
-
-      t6 = t3 - t0 - t2;
-      t0 += t3 + t1;
-      t3 += t2 - t1;
-
-      t2 = cos18[0] * (in[3]  + in[11]);
-      t4 = cos18[1] * (in[11] - in[15]);
-      t7 = COS6_1 * in[7];
-
-      t1 = t2 + t4 + t7;
-      tmp[17] = (t0 + t1) * tfcos36[17-17];
-      tmp[9]  = (t0 - t1) * tfcos36[17-9];
-      t1 = cos18[2] * (in[3] + in[15]);
-      t2 += t1 - t7;
-
-      tmp[14] = (t3 + t2) * tfcos36[17-14];
-      t0 = COS6_1 * (in[11] + in[15] - in[3]);
-      tmp[12] = (t3 - t2) * tfcos36[17-12];
-
-      t4 -= t1 + t7;
-
-      tmp[16] = (t5 - t0) * tfcos36[17-16];
-      tmp[10] = (t5 + t0) * tfcos36[17-10];
-      tmp[15] = (t6 + t4) * tfcos36[17-15];
-      tmp[11] = (t6 - t4) * tfcos36[17-11];
-   }
-
-#define MACRO(v) { \
-    real tmpval; \
-    real sum0 = tmp[(v)]; \
-    real sum1 = tmp[17-(v)]; \
-    out2[9+(v)] = (tmpval = sum0 + sum1) * w[27+(v)]; \
-    out2[8-(v)] = tmpval * w[26-(v)]; \
-    sum0 -= sum1; \
-    ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \
-    ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)]; }
-
-{
-   register real *out2 = o2;
-   register real *w = wintab;
-   register real *out1 = o1;
-   register real *ts = tsbuf;
-
-   MACRO(0);
-   MACRO(1);
-   MACRO(2);
-   MACRO(3);
-   MACRO(4);
-   MACRO(5);
-   MACRO(6);
-   MACRO(7);
-   MACRO(8);
-}
-
-#else
-
-  {
-
-#define MACRO0(v) { \
-    real tmp; \
-    out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \
-    out2[8-(v)] = tmp * w[26-(v)];  } \
-    sum0 -= sum1; \
-    ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \
-    ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)];
-#define MACRO1(v) { \
-    real sum0, sum1; \
-    sum0 = tmp1a + tmp2a; \
-    sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \
-    MACRO0(v); }
-#define MACRO2(v) { \
-    real sum0, sum1; \
-    sum0 = tmp2a - tmp1a; \
-    sum1 = (tmp2b - tmp1b) * tfcos36[(v)]; \
-    MACRO0(v); }
-
-    register const real *c = COS9;
-    register real *out2 = o2;
-    register real *w    = wintab;
-    register real *out1 = o1;
-    register real *ts   = tsbuf;
-
-    real ta33,ta66,tb33,tb66;
-
-    ta33 = in[2*3+0] * c[3];
-    ta66 = in[2*6+0] * c[6];
-    tb33 = in[2*3+1] * c[3];
-    tb66 = in[2*6+1] * c[6];
-
-    {
-      real tmp1a,tmp2a,tmp1b,tmp2b;
-      tmp1a =             in[2*1+0] * c[1] + ta33 + in[2*5+0] * c[5] + in[2*7+0] * c[7];
-      tmp1b =             in[2*1+1] * c[1] + tb33 + in[2*5+1] * c[5] + in[2*7+1] * c[7];
-      tmp2a = in[2*0+0] + in[2*2+0] * c[2] + in[2*4+0] * c[4] + ta66 + in[2*8+0] * c[8];
-      tmp2b = in[2*0+1] + in[2*2+1] * c[2] + in[2*4+1] * c[4] + tb66 + in[2*8+1] * c[8];
-
-      MACRO1(0);
-      MACRO2(8);
-    }
-
-    {
-      real tmp1a,tmp2a,tmp1b,tmp2b;
-      tmp1a = ( in[2*1+0] - in[2*5+0] - in[2*7+0] ) * c[3];
-      tmp1b = ( in[2*1+1] - in[2*5+1] - in[2*7+1] ) * c[3];
-      tmp2a = ( in[2*2+0] - in[2*4+0] - in[2*8+0] ) * c[6] - in[2*6+0] + in[2*0+0];
-      tmp2b = ( in[2*2+1] - in[2*4+1] - in[2*8+1] ) * c[6] - in[2*6+1] + in[2*0+1];
-
-      MACRO1(1);
-      MACRO2(7);
-    }
-
-    {
-      real tmp1a,tmp2a,tmp1b,tmp2b;
-      tmp1a =             in[2*1+0] * c[5] - ta33 - in[2*5+0] * c[7] + in[2*7+0] * c[1];
-      tmp1b =             in[2*1+1] * c[5] - tb33 - in[2*5+1] * c[7] + in[2*7+1] * c[1];
-      tmp2a = in[2*0+0] - in[2*2+0] * c[8] - in[2*4+0] * c[2] + ta66 + in[2*8+0] * c[4];
-      tmp2b = in[2*0+1] - in[2*2+1] * c[8] - in[2*4+1] * c[2] + tb66 + in[2*8+1] * c[4];
-
-      MACRO1(2);
-      MACRO2(6);
-    }
-
-    {
-      real tmp1a,tmp2a,tmp1b,tmp2b;
-      tmp1a =             in[2*1+0] * c[7] - ta33 + in[2*5+0] * c[1] - in[2*7+0] * c[5];
-      tmp1b =             in[2*1+1] * c[7] - tb33 + in[2*5+1] * c[1] - in[2*7+1] * c[5];
-      tmp2a = in[2*0+0] - in[2*2+0] * c[4] + in[2*4+0] * c[8] + ta66 - in[2*8+0] * c[2];
-      tmp2b = in[2*0+1] - in[2*2+1] * c[4] + in[2*4+1] * c[8] + tb66 - in[2*8+1] * c[2];
-
-      MACRO1(3);
-      MACRO2(5);
-    }
-
-    {
-      real sum0,sum1;
-      sum0 =  in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0];
-      sum1 = (in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ) * tfcos36[4];
-      MACRO0(4);
-    }
-  }
-#endif
-
-  }
-}
diff --git a/mplayer/mp3lib/dct36_3dnow.c b/mplayer/mp3lib/dct36_3dnow.c
deleted file mode 100644
index 4362d05..0000000
--- a/mplayer/mp3lib/dct36_3dnow.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * dct36_3dnow.c - 3DNow! optimized dct36()
- *
- * This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
- * <squash at mb.kcom.ne.jp>, only two types of changes have been made:
- *
- * - removed PREFETCH instruction for speedup
- * - changed function name for support 3DNow! automatic detection
- *
- * You can find Kashiyama's original 3dnow! support patch
- * (for mpg123-0.59o) at
- * http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese).
- *
- * by KIMURA Takuhiro <kim at hannah.ipc.miyakyo-u.ac.jp> - until 31.Mar.1999
- *                    <kim at comtec.co.jp>               - after  1.Apr.1999
- *
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- *
- * Original disclaimer:
- *  The author of this program disclaim whole expressed or implied
- *  warranties with regard to this program, and in no event shall the
- *  author of this program liable to whatever resulted from the use of
- *  this program. Use it at your own risk.
- *
- * 2003/06/21: Moved to GCC inline assembly - Alex Beregszaszi
- */
-
-#include "config.h"
-#include "mangle.h"
-#include "mpg123.h"
-#include "ffmpeg_files/x86_cpu.h"
-
-#ifdef DCT36_OPTIMIZE_FOR_K7
-void dct36_3dnowex(real *inbuf, real *o1,
-    real *o2, real *wintab, real *tsbuf)
-#else
-void dct36_3dnow(real *inbuf, real *o1,
-    real *o2, real *wintab, real *tsbuf)
-#endif
-{
-    __asm__ volatile(
-        "movq (%%"REG_a"),%%mm0\n\t"
-        "movq 4(%%"REG_a"),%%mm1\n\t"
-        "pfadd %%mm1,%%mm0\n\t"
-        "movq %%mm0,4(%%"REG_a")\n\t"
-        "psrlq $32,%%mm1\n\t"
-        "movq 12(%%"REG_a"),%%mm2\n\t"
-        "punpckldq %%mm2,%%mm1\n\t"
-        "pfadd %%mm2,%%mm1\n\t"
-        "movq %%mm1,12(%%"REG_a")\n\t"
-        "psrlq $32,%%mm2\n\t"
-        "movq 20(%%"REG_a"),%%mm3\n\t"
-        "punpckldq %%mm3,%%mm2\n\t"
-        "pfadd %%mm3,%%mm2\n\t"
-        "movq %%mm2,20(%%"REG_a")\n\t"
-        "psrlq $32,%%mm3\n\t"
-        "movq 28(%%"REG_a"),%%mm4\n\t"
-        "punpckldq %%mm4,%%mm3\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "movq %%mm3,28(%%"REG_a")\n\t"
-        "psrlq $32,%%mm4\n\t"
-        "movq 36(%%"REG_a"),%%mm5\n\t"
-        "punpckldq %%mm5,%%mm4\n\t"
-        "pfadd %%mm5,%%mm4\n\t"
-        "movq %%mm4,36(%%"REG_a")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movq 44(%%"REG_a"),%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movq %%mm5,44(%%"REG_a")\n\t"
-        "psrlq $32,%%mm6\n\t"
-        "movq 52(%%"REG_a"),%%mm7\n\t"
-        "punpckldq %%mm7,%%mm6\n\t"
-        "pfadd %%mm7,%%mm6\n\t"
-        "movq %%mm6,52(%%"REG_a")\n\t"
-        "psrlq $32,%%mm7\n\t"
-        "movq 60(%%"REG_a"),%%mm0\n\t"
-        "punpckldq %%mm0,%%mm7\n\t"
-        "pfadd %%mm0,%%mm7\n\t"
-        "movq %%mm7,60(%%"REG_a")\n\t"
-        "psrlq $32,%%mm0\n\t"
-        "movd 68(%%"REG_a"),%%mm1\n\t"
-        "pfadd %%mm1,%%mm0\n\t"
-        "movd %%mm0,68(%%"REG_a")\n\t"
-        "movd 4(%%"REG_a"),%%mm0\n\t"
-        "movd 12(%%"REG_a"),%%mm1\n\t"
-        "punpckldq %%mm1,%%mm0\n\t"
-        "punpckldq 20(%%"REG_a"),%%mm1\n\t"
-        "pfadd %%mm1,%%mm0\n\t"
-        "movd %%mm0,12(%%"REG_a")\n\t"
-        "psrlq $32,%%mm0\n\t"
-        "movd %%mm0,20(%%"REG_a")\n\t"
-        "psrlq $32,%%mm1\n\t"
-        "movd 28(%%"REG_a"),%%mm2\n\t"
-        "punpckldq %%mm2,%%mm1\n\t"
-        "punpckldq 36(%%"REG_a"),%%mm2\n\t"
-        "pfadd %%mm2,%%mm1\n\t"
-        "movd %%mm1,28(%%"REG_a")\n\t"
-        "psrlq $32,%%mm1\n\t"
-        "movd %%mm1,36(%%"REG_a")\n\t"
-        "psrlq $32,%%mm2\n\t"
-        "movd 44(%%"REG_a"),%%mm3\n\t"
-        "punpckldq %%mm3,%%mm2\n\t"
-        "punpckldq 52(%%"REG_a"),%%mm3\n\t"
-        "pfadd %%mm3,%%mm2\n\t"
-        "movd %%mm2,44(%%"REG_a")\n\t"
-        "psrlq $32,%%mm2\n\t"
-        "movd %%mm2,52(%%"REG_a")\n\t"
-        "psrlq $32,%%mm3\n\t"
-        "movd 60(%%"REG_a"),%%mm4\n\t"
-        "punpckldq %%mm4,%%mm3\n\t"
-        "punpckldq 68(%%"REG_a"),%%mm4\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "movd %%mm3,60(%%"REG_a")\n\t"
-        "psrlq $32,%%mm3\n\t"
-        "movd %%mm3,68(%%"REG_a")\n\t"
-
-        "movq 24(%%"REG_a"),%%mm0\n\t"
-        "movq 48(%%"REG_a"),%%mm1\n\t"
-        "movd "MANGLE(COS9)"+12,%%mm2\n\t"
-        "punpckldq %%mm2,%%mm2\n\t"
-        "movd "MANGLE(COS9)"+24,%%mm3\n\t"
-        "punpckldq %%mm3,%%mm3\n\t"
-        "pfmul %%mm2,%%mm0\n\t"
-        "pfmul %%mm3,%%mm1\n\t"
-        "push %%"REG_a"\n\t"
-        "movl $1,%%eax\n\t"
-        "movd %%eax,%%mm7\n\t"
-        "pi2fd %%mm7,%%mm7\n\t"
-        "pop %%"REG_a"\n\t"
-        "movq 8(%%"REG_a"),%%mm2\n\t"
-        "movd "MANGLE(COS9)"+4,%%mm3\n\t"
-        "punpckldq %%mm3,%%mm3\n\t"
-        "pfmul %%mm3,%%mm2\n\t"
-        "pfadd %%mm0,%%mm2\n\t"
-        "movq 40(%%"REG_a"),%%mm3\n\t"
-        "movd "MANGLE(COS9)"+20,%%mm4\n\t"
-        "punpckldq %%mm4,%%mm4\n\t"
-        "pfmul %%mm4,%%mm3\n\t"
-        "pfadd %%mm3,%%mm2\n\t"
-        "movq 56(%%"REG_a"),%%mm3\n\t"
-        "movd "MANGLE(COS9)"+28,%%mm4\n\t"
-        "punpckldq %%mm4,%%mm4\n\t"
-        "pfmul %%mm4,%%mm3\n\t"
-        "pfadd %%mm3,%%mm2\n\t"
-        "movq (%%"REG_a"),%%mm3\n\t"
-        "movq 16(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+8,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "movq 32(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+16,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "pfadd %%mm1,%%mm3\n\t"
-        "movq 64(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+32,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "movq %%mm2,%%mm4\n\t"
-        "pfadd %%mm3,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+0,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 108(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 104(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-#ifdef DCT36_OPTIMIZE_FOR_K7
-        "pswapd %%mm5,%%mm5\n\t"
-        "movq %%mm5,32(%%"REG_c")\n\t"
-#else
-        "movd %%mm5,36(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,32(%%"REG_c")\n\t"
-#endif
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 32(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 36(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 32(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 36(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,1024(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,1152(%%"REG_D")\n\t"
-        "movq %%mm3,%%mm4\n\t"
-        "pfsub %%mm2,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+32,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 140(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 72(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,68(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,0(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 0(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 68(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 0(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 68(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,0(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,2176(%%"REG_D")\n\t"
-        "movq 8(%%"REG_a"),%%mm2\n\t"
-        "movq 40(%%"REG_a"),%%mm3\n\t"
-        "pfsub %%mm3,%%mm2\n\t"
-        "movq 56(%%"REG_a"),%%mm3\n\t"
-        "pfsub %%mm3,%%mm2\n\t"
-        "movd "MANGLE(COS9)"+12,%%mm3\n\t"
-        "punpckldq %%mm3,%%mm3\n\t"
-        "pfmul %%mm3,%%mm2\n\t"
-        "movq 16(%%"REG_a"),%%mm3\n\t"
-        "movq 32(%%"REG_a"),%%mm4\n\t"
-        "pfsub %%mm4,%%mm3\n\t"
-        "movq 64(%%"REG_a"),%%mm4\n\t"
-        "pfsub %%mm4,%%mm3\n\t"
-        "movd "MANGLE(COS9)"+24,%%mm4\n\t"
-        "punpckldq %%mm4,%%mm4\n\t"
-        "pfmul %%mm4,%%mm3\n\t"
-        "movq 48(%%"REG_a"),%%mm4\n\t"
-        "pfsub %%mm4,%%mm3\n\t"
-        "movq (%%"REG_a"),%%mm4\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "movq %%mm2,%%mm4\n\t"
-        "pfadd %%mm3,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+4,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 112(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 100(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,40(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,28(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 28(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 40(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 28(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 40(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,896(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,1280(%%"REG_D")\n\t"
-        "movq %%mm3,%%mm4\n\t"
-        "pfsub %%mm2,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+28,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 136(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 76(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,64(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,4(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 4(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 64(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 4(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 64(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,128(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,2048(%%"REG_D")\n\t"
-
-        "movq 8(%%"REG_a"),%%mm2\n\t"
-        "movd "MANGLE(COS9)"+20,%%mm3\n\t"
-        "punpckldq %%mm3,%%mm3\n\t"
-        "pfmul %%mm3,%%mm2\n\t"
-        "pfsub %%mm0,%%mm2\n\t"
-        "movq 40(%%"REG_a"),%%mm3\n\t"
-        "movd "MANGLE(COS9)"+28,%%mm4\n\t"
-        "punpckldq %%mm4,%%mm4\n\t"
-        "pfmul %%mm4,%%mm3\n\t"
-        "pfsub %%mm3,%%mm2\n\t"
-        "movq 56(%%"REG_a"),%%mm3\n\t"
-        "movd "MANGLE(COS9)"+4,%%mm4\n\t"
-        "punpckldq %%mm4,%%mm4\n\t"
-        "pfmul %%mm4,%%mm3\n\t"
-        "pfadd %%mm3,%%mm2\n\t"
-        "movq (%%"REG_a"),%%mm3\n\t"
-        "movq 16(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+32,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfsub %%mm4,%%mm3\n\t"
-        "movq 32(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+8,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfsub %%mm4,%%mm3\n\t"
-        "pfadd %%mm1,%%mm3\n\t"
-        "movq 64(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+16,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "movq %%mm2,%%mm4\n\t"
-        "pfadd %%mm3,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+8,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 116(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 96(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,44(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,24(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 24(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 44(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 24(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 44(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,768(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,1408(%%"REG_D")\n\t"
-        "movq %%mm3,%%mm4\n\t"
-        "pfsub %%mm2,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+24,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 132(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 80(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,60(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,8(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 8(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 60(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 8(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 60(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,256(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,1920(%%"REG_D")\n\t"
-        "movq 8(%%"REG_a"),%%mm2\n\t"
-        "movd "MANGLE(COS9)"+28,%%mm3\n\t"
-        "punpckldq %%mm3,%%mm3\n\t"
-        "pfmul %%mm3,%%mm2\n\t"
-        "pfsub %%mm0,%%mm2\n\t"
-        "movq 40(%%"REG_a"),%%mm3\n\t"
-        "movd "MANGLE(COS9)"+4,%%mm4\n\t"
-        "punpckldq %%mm4,%%mm4\n\t"
-        "pfmul %%mm4,%%mm3\n\t"
-        "pfadd %%mm3,%%mm2\n\t"
-        "movq 56(%%"REG_a"),%%mm3\n\t"
-        "movd "MANGLE(COS9)"+20,%%mm4\n\t"
-        "punpckldq %%mm4,%%mm4\n\t"
-        "pfmul %%mm4,%%mm3\n\t"
-        "pfsub %%mm3,%%mm2\n\t"
-        "movq (%%"REG_a"),%%mm3\n\t"
-        "movq 16(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+16,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfsub %%mm4,%%mm3\n\t"
-        "movq 32(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+32,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfadd %%mm4,%%mm3\n\t"
-        "pfadd %%mm1,%%mm3\n\t"
-        "movq 64(%%"REG_a"),%%mm4\n\t"
-        "movd "MANGLE(COS9)"+8,%%mm5\n\t"
-        "punpckldq %%mm5,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "pfsub %%mm4,%%mm3\n\t"
-        "movq %%mm2,%%mm4\n\t"
-        "pfadd %%mm3,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+12,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 120(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 92(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,48(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,20(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 20(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 48(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 20(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 48(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,640(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,1536(%%"REG_D")\n\t"
-        "movq %%mm3,%%mm4\n\t"
-        "pfsub %%mm2,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+20,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 128(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 84(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,56(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,12(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 12(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 56(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 12(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 56(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,384(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,1792(%%"REG_D")\n\t"
-
-        "movq (%%"REG_a"),%%mm4\n\t"
-        "movq 16(%%"REG_a"),%%mm3\n\t"
-        "pfsub %%mm3,%%mm4\n\t"
-        "movq 32(%%"REG_a"),%%mm3\n\t"
-        "pfadd %%mm3,%%mm4\n\t"
-        "movq 48(%%"REG_a"),%%mm3\n\t"
-        "pfsub %%mm3,%%mm4\n\t"
-        "movq 64(%%"REG_a"),%%mm3\n\t"
-        "pfadd %%mm3,%%mm4\n\t"
-        "movq %%mm7,%%mm5\n\t"
-        "punpckldq "MANGLE(tfcos36)"+16,%%mm5\n\t"
-        "pfmul %%mm5,%%mm4\n\t"
-        "movq %%mm4,%%mm5\n\t"
-        "pfacc %%mm5,%%mm5\n\t"
-        "movd 124(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 88(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd %%mm5,52(%%"REG_c")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,16(%%"REG_c")\n\t"
-        "movq %%mm4,%%mm6\n\t"
-        "punpckldq %%mm6,%%mm5\n\t"
-        "pfsub %%mm6,%%mm5\n\t"
-        "punpckhdq %%mm5,%%mm5\n\t"
-        "movd 16(%%"REG_d"),%%mm6\n\t"
-        "punpckldq 52(%%"REG_d"),%%mm6\n\t"
-        "pfmul %%mm6,%%mm5\n\t"
-        "movd 16(%%"REG_S"),%%mm6\n\t"
-        "punpckldq 52(%%"REG_S"),%%mm6\n\t"
-        "pfadd %%mm6,%%mm5\n\t"
-        "movd %%mm5,512(%%"REG_D")\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "movd %%mm5,1664(%%"REG_D")\n\t"
-
-        "femms\n\t"
-        :
-        : "a" (inbuf), "S" (o1), "c" (o2), "d" (wintab), "D" (tsbuf)
-        : "memory");
-}
diff --git a/mplayer/mp3lib/dct36_k7.c b/mplayer/mp3lib/dct36_k7.c
deleted file mode 100644
index f9da0f2..0000000
--- a/mplayer/mp3lib/dct36_k7.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * dct36_k7.c - 3DNowEx(DSP)! optimized dct36()
- *
- * This code based 'dct36_3dnow.s' by Syuuhei Kashiyama
- * <squash at mb.kcom.ne.jp>, only two types of changes have been made:
- *
- * - added new opcode PSWAPD
- * - removed PREFETCH instruction for speedup
- * - changed function name for support 3DNowEx! automatic detection
- *
- * note: because K7 processors are an aggresive out-of-order three-way
- *       superscalar ones instruction order is not significand for them.
- *
- * You can find Kashiyama's original 3dnow! support patch
- * (for mpg123-0.59o) at
- * http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese).
- *
- * by KIMURA Takuhiro <kim at hannah.ipc.miyakyo-u.ac.jp> - until 31.Mar.1999
- *                    <kim at comtec.co.jp>               - after  1.Apr.1999
- *
- * Original disclaimer:
- *  The author of this program disclaim whole expressed or implied
- *  warranties with regard to this program, and in no event shall the
- *  author of this program liable to whatever resulted from the use of
- *  this program. Use it at your own risk.
- *
- * Modified by Nick Kurshev <nickols_k at mail.ru>
- *
- * 2003/06/21: Moved to GCC inline assembly - Alex Beregszaszi
- */
-
-#define DCT36_OPTIMIZE_FOR_K7
-
-#include "dct36_3dnow.c"
diff --git a/mplayer/mp3lib/dct64.c b/mplayer/mp3lib/dct64.c
deleted file mode 100644
index 514aa4f..0000000
--- a/mplayer/mp3lib/dct64.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
- * Discrete Cosine Tansform (DCT) for subband synthesis
- * optimized for machines with no auto-increment.
- * The performance is highly compiler dependend. Maybe
- * the dct64.c version for 'normal' processor may be faster
- * even for Intel processors.
- */
-
-static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples)
-{
-
- {
-  register real *costab = mp3lib_pnts[0];
-
-  b1[0x00] = samples[0x00] + samples[0x1F];
-  b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0];
-
-  b1[0x01] = samples[0x01] + samples[0x1E];
-  b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1];
-
-  b1[0x02] = samples[0x02] + samples[0x1D];
-  b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2];
-
-  b1[0x03] = samples[0x03] + samples[0x1C];
-  b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3];
-
-  b1[0x04] = samples[0x04] + samples[0x1B];
-  b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4];
-
-  b1[0x05] = samples[0x05] + samples[0x1A];
-  b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5];
-
-  b1[0x06] = samples[0x06] + samples[0x19];
-  b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6];
-
-  b1[0x07] = samples[0x07] + samples[0x18];
-  b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7];
-
-  b1[0x08] = samples[0x08] + samples[0x17];
-  b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8];
-
-  b1[0x09] = samples[0x09] + samples[0x16];
-  b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9];
-
-  b1[0x0A] = samples[0x0A] + samples[0x15];
-  b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA];
-
-  b1[0x0B] = samples[0x0B] + samples[0x14];
-  b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB];
-
-  b1[0x0C] = samples[0x0C] + samples[0x13];
-  b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC];
-
-  b1[0x0D] = samples[0x0D] + samples[0x12];
-  b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD];
-
-  b1[0x0E] = samples[0x0E] + samples[0x11];
-  b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE];
-
-  b1[0x0F] = samples[0x0F] + samples[0x10];
-  b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF];
- }
-
-
- {
-  register real *costab = mp3lib_pnts[1];
-
-  b2[0x00] = b1[0x00] + b1[0x0F];
-  b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0];
-  b2[0x01] = b1[0x01] + b1[0x0E];
-  b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1];
-  b2[0x02] = b1[0x02] + b1[0x0D];
-  b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2];
-  b2[0x03] = b1[0x03] + b1[0x0C];
-  b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3];
-  b2[0x04] = b1[0x04] + b1[0x0B];
-  b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4];
-  b2[0x05] = b1[0x05] + b1[0x0A];
-  b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5];
-  b2[0x06] = b1[0x06] + b1[0x09];
-  b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6];
-  b2[0x07] = b1[0x07] + b1[0x08];
-  b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7];
-
-  b2[0x10] = b1[0x10] + b1[0x1F];
-  b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0];
-  b2[0x11] = b1[0x11] + b1[0x1E];
-  b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1];
-  b2[0x12] = b1[0x12] + b1[0x1D];
-  b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2];
-  b2[0x13] = b1[0x13] + b1[0x1C];
-  b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3];
-  b2[0x14] = b1[0x14] + b1[0x1B];
-  b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4];
-  b2[0x15] = b1[0x15] + b1[0x1A];
-  b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5];
-  b2[0x16] = b1[0x16] + b1[0x19];
-  b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6];
-  b2[0x17] = b1[0x17] + b1[0x18];
-  b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7];
- }
-
- {
-  register real *costab = mp3lib_pnts[2];
-
-  b1[0x00] = b2[0x00] + b2[0x07];
-  b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0];
-  b1[0x01] = b2[0x01] + b2[0x06];
-  b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1];
-  b1[0x02] = b2[0x02] + b2[0x05];
-  b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2];
-  b1[0x03] = b2[0x03] + b2[0x04];
-  b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3];
-
-  b1[0x08] = b2[0x08] + b2[0x0F];
-  b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0];
-  b1[0x09] = b2[0x09] + b2[0x0E];
-  b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1];
-  b1[0x0A] = b2[0x0A] + b2[0x0D];
-  b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2];
-  b1[0x0B] = b2[0x0B] + b2[0x0C];
-  b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3];
-
-  b1[0x10] = b2[0x10] + b2[0x17];
-  b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0];
-  b1[0x11] = b2[0x11] + b2[0x16];
-  b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1];
-  b1[0x12] = b2[0x12] + b2[0x15];
-  b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2];
-  b1[0x13] = b2[0x13] + b2[0x14];
-  b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3];
-
-  b1[0x18] = b2[0x18] + b2[0x1F];
-  b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0];
-  b1[0x19] = b2[0x19] + b2[0x1E];
-  b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1];
-  b1[0x1A] = b2[0x1A] + b2[0x1D];
-  b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2];
-  b1[0x1B] = b2[0x1B] + b2[0x1C];
-  b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3];
- }
-
- {
-  register real const cos0 = mp3lib_pnts[3][0];
-  register real const cos1 = mp3lib_pnts[3][1];
-
-  b2[0x00] = b1[0x00] + b1[0x03];
-  b2[0x03] = (b1[0x00] - b1[0x03]) * cos0;
-  b2[0x01] = b1[0x01] + b1[0x02];
-  b2[0x02] = (b1[0x01] - b1[0x02]) * cos1;
-
-  b2[0x04] = b1[0x04] + b1[0x07];
-  b2[0x07] = (b1[0x07] - b1[0x04]) * cos0;
-  b2[0x05] = b1[0x05] + b1[0x06];
-  b2[0x06] = (b1[0x06] - b1[0x05]) * cos1;
-
-  b2[0x08] = b1[0x08] + b1[0x0B];
-  b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0;
-  b2[0x09] = b1[0x09] + b1[0x0A];
-  b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1;
-
-  b2[0x0C] = b1[0x0C] + b1[0x0F];
-  b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0;
-  b2[0x0D] = b1[0x0D] + b1[0x0E];
-  b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1;
-
-  b2[0x10] = b1[0x10] + b1[0x13];
-  b2[0x13] = (b1[0x10] - b1[0x13]) * cos0;
-  b2[0x11] = b1[0x11] + b1[0x12];
-  b2[0x12] = (b1[0x11] - b1[0x12]) * cos1;
-
-  b2[0x14] = b1[0x14] + b1[0x17];
-  b2[0x17] = (b1[0x17] - b1[0x14]) * cos0;
-  b2[0x15] = b1[0x15] + b1[0x16];
-  b2[0x16] = (b1[0x16] - b1[0x15]) * cos1;
-
-  b2[0x18] = b1[0x18] + b1[0x1B];
-  b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0;
-  b2[0x19] = b1[0x19] + b1[0x1A];
-  b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1;
-
-  b2[0x1C] = b1[0x1C] + b1[0x1F];
-  b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0;
-  b2[0x1D] = b1[0x1D] + b1[0x1E];
-  b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1;
- }
-
- {
-  register real const cos0 = mp3lib_pnts[4][0];
-
-  b1[0x00] = b2[0x00] + b2[0x01];
-  b1[0x01] = (b2[0x00] - b2[0x01]) * cos0;
-  b1[0x02] = b2[0x02] + b2[0x03];
-  b1[0x03] = (b2[0x03] - b2[0x02]) * cos0;
-  b1[0x02] += b1[0x03];
-
-  b1[0x04] = b2[0x04] + b2[0x05];
-  b1[0x05] = (b2[0x04] - b2[0x05]) * cos0;
-  b1[0x06] = b2[0x06] + b2[0x07];
-  b1[0x07] = (b2[0x07] - b2[0x06]) * cos0;
-  b1[0x06] += b1[0x07];
-  b1[0x04] += b1[0x06];
-  b1[0x06] += b1[0x05];
-  b1[0x05] += b1[0x07];
-
-  b1[0x08] = b2[0x08] + b2[0x09];
-  b1[0x09] = (b2[0x08] - b2[0x09]) * cos0;
-  b1[0x0A] = b2[0x0A] + b2[0x0B];
-  b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0;
-  b1[0x0A] += b1[0x0B];
-
-  b1[0x0C] = b2[0x0C] + b2[0x0D];
-  b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0;
-  b1[0x0E] = b2[0x0E] + b2[0x0F];
-  b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0;
-  b1[0x0E] += b1[0x0F];
-  b1[0x0C] += b1[0x0E];
-  b1[0x0E] += b1[0x0D];
-  b1[0x0D] += b1[0x0F];
-
-  b1[0x10] = b2[0x10] + b2[0x11];
-  b1[0x11] = (b2[0x10] - b2[0x11]) * cos0;
-  b1[0x12] = b2[0x12] + b2[0x13];
-  b1[0x13] = (b2[0x13] - b2[0x12]) * cos0;
-  b1[0x12] += b1[0x13];
-
-  b1[0x14] = b2[0x14] + b2[0x15];
-  b1[0x15] = (b2[0x14] - b2[0x15]) * cos0;
-  b1[0x16] = b2[0x16] + b2[0x17];
-  b1[0x17] = (b2[0x17] - b2[0x16]) * cos0;
-  b1[0x16] += b1[0x17];
-  b1[0x14] += b1[0x16];
-  b1[0x16] += b1[0x15];
-  b1[0x15] += b1[0x17];
-
-  b1[0x18] = b2[0x18] + b2[0x19];
-  b1[0x19] = (b2[0x18] - b2[0x19]) * cos0;
-  b1[0x1A] = b2[0x1A] + b2[0x1B];
-  b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0;
-  b1[0x1A] += b1[0x1B];
-
-  b1[0x1C] = b2[0x1C] + b2[0x1D];
-  b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0;
-  b1[0x1E] = b2[0x1E] + b2[0x1F];
-  b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0;
-  b1[0x1E] += b1[0x1F];
-  b1[0x1C] += b1[0x1E];
-  b1[0x1E] += b1[0x1D];
-  b1[0x1D] += b1[0x1F];
- }
-
- out0[0x10*16] = b1[0x00];
- out0[0x10*12] = b1[0x04];
- out0[0x10* 8] = b1[0x02];
- out0[0x10* 4] = b1[0x06];
- out0[0x10* 0] = b1[0x01];
- out1[0x10* 0] = b1[0x01];
- out1[0x10* 4] = b1[0x05];
- out1[0x10* 8] = b1[0x03];
- out1[0x10*12] = b1[0x07];
-
- b1[0x08] += b1[0x0C];
- out0[0x10*14] = b1[0x08];
- b1[0x0C] += b1[0x0a];
- out0[0x10*10] = b1[0x0C];
- b1[0x0A] += b1[0x0E];
- out0[0x10* 6] = b1[0x0A];
- b1[0x0E] += b1[0x09];
- out0[0x10* 2] = b1[0x0E];
- b1[0x09] += b1[0x0D];
- out1[0x10* 2] = b1[0x09];
- b1[0x0D] += b1[0x0B];
- out1[0x10* 6] = b1[0x0D];
- b1[0x0B] += b1[0x0F];
- out1[0x10*10] = b1[0x0B];
- out1[0x10*14] = b1[0x0F];
-
- b1[0x18] += b1[0x1C];
- out0[0x10*15] = b1[0x10] + b1[0x18];
- out0[0x10*13] = b1[0x18] + b1[0x14];
- b1[0x1C] += b1[0x1a];
- out0[0x10*11] = b1[0x14] + b1[0x1C];
- out0[0x10* 9] = b1[0x1C] + b1[0x12];
- b1[0x1A] += b1[0x1E];
- out0[0x10* 7] = b1[0x12] + b1[0x1A];
- out0[0x10* 5] = b1[0x1A] + b1[0x16];
- b1[0x1E] += b1[0x19];
- out0[0x10* 3] = b1[0x16] + b1[0x1E];
- out0[0x10* 1] = b1[0x1E] + b1[0x11];
- b1[0x19] += b1[0x1D];
- out1[0x10* 1] = b1[0x11] + b1[0x19];
- out1[0x10* 3] = b1[0x19] + b1[0x15];
- b1[0x1D] += b1[0x1B];
- out1[0x10* 5] = b1[0x15] + b1[0x1D];
- out1[0x10* 7] = b1[0x1D] + b1[0x13];
- b1[0x1B] += b1[0x1F];
- out1[0x10* 9] = b1[0x13] + b1[0x1B];
- out1[0x10*11] = b1[0x1B] + b1[0x17];
- out1[0x10*13] = b1[0x17] + b1[0x1F];
- out1[0x10*15] = b1[0x1F];
-}
-
-/*
- * the call via dct64 is a trick to force GCC to use
- * (new) registers for the b1,b2 pointer to the bufs[xx] field
- */
-static void dct64(real *a,real *b,real *c)
-{
-  real bufs[0x40];
-  dct64_1(a,b,bufs,bufs+0x20,c);
-}
-
-void mp3lib_dct64(real *a,real *b,real *c)
-{
-  real bufs[0x40];
-  dct64_1(a,b,bufs,bufs+0x20,c);
-}
diff --git a/mplayer/mp3lib/dct64_3dnow.c b/mplayer/mp3lib/dct64_3dnow.c
deleted file mode 100644
index 7cd8603..0000000
--- a/mplayer/mp3lib/dct64_3dnow.c
+++ /dev/null
@@ -1,929 +0,0 @@
-/*
-* This code was taken from http://www.mpg123.org
-* See ChangeLog of mpg123-0.59s-pre.1 for detail
-* Applied to mplayer by Nick Kurshev <nickols_k at mail.ru>
-* Partial 3dnow! optimization by Nick Kurshev
-*
-* TODO: optimize scalar 3dnow! code
-* Warning: Phases 7 & 8 are not tested
-*/
-
-#include "config.h"
-#include "mangle.h"
-#include "mpg123.h"
-#include "ffmpeg_files/x86_cpu.h"
-
-static unsigned long long int attribute_used __attribute__((aligned(8))) x_plus_minus_3dnow = 0x8000000000000000ULL;
-static float attribute_used plus_1f = 1.0;
-
-void dct64_MMX_3dnow(short *a,short *b,real *c)
-{
-  char tmp[256];
-    __asm__ volatile(
-"       mov %2,%%"REG_a"\n\t"
-
-"       lea 128+%3,%%"REG_d"\n\t"
-"       mov %0,%%"REG_S"\n\t"
-"       mov %1,%%"REG_D"\n\t"
-"       mov $"MANGLE(costab_mmx)",%%"REG_b"\n\t"
-"       lea %3,%%"REG_c"\n\t"
-
-/* Phase 1*/
-"       movq    (%%"REG_a"), %%mm0\n\t"
-"       movq    8(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    120(%%"REG_a"), %%mm1\n\t"
-"       movq    112(%%"REG_a"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_d")\n\t"
-"       movq    %%mm4, 8(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   (%%"REG_b"), %%mm3\n\t"
-"       pfmul   8(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 124(%%"REG_d")\n\t"
-"       movd    %%mm7, 116(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 120(%%"REG_d")\n\t"
-"       movd    %%mm7, 112(%%"REG_d")\n\t"
-
-"       movq    16(%%"REG_a"), %%mm0\n\t"
-"       movq    24(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    104(%%"REG_a"), %%mm1\n\t"
-"       movq    96(%%"REG_a"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 16(%%"REG_d")\n\t"
-"       movq    %%mm4, 24(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   16(%%"REG_b"), %%mm3\n\t"
-"       pfmul   24(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 108(%%"REG_d")\n\t"
-"       movd    %%mm7, 100(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 104(%%"REG_d")\n\t"
-"       movd    %%mm7, 96(%%"REG_d")\n\t"
-
-"       movq    32(%%"REG_a"), %%mm0\n\t"
-"       movq    40(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    88(%%"REG_a"), %%mm1\n\t"
-"       movq    80(%%"REG_a"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 32(%%"REG_d")\n\t"
-"       movq    %%mm4, 40(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   32(%%"REG_b"), %%mm3\n\t"
-"       pfmul   40(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 92(%%"REG_d")\n\t"
-"       movd    %%mm7, 84(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 88(%%"REG_d")\n\t"
-"       movd    %%mm7, 80(%%"REG_d")\n\t"
-
-"       movq    48(%%"REG_a"), %%mm0\n\t"
-"       movq    56(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    72(%%"REG_a"), %%mm1\n\t"
-"       movq    64(%%"REG_a"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 48(%%"REG_d")\n\t"
-"       movq    %%mm4, 56(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   48(%%"REG_b"), %%mm3\n\t"
-"       pfmul   56(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 76(%%"REG_d")\n\t"
-"       movd    %%mm7, 68(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 72(%%"REG_d")\n\t"
-"       movd    %%mm7, 64(%%"REG_d")\n\t"
-
-/* Phase 2*/
-
-"       movq    (%%"REG_d"), %%mm0\n\t"
-"       movq    8(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    56(%%"REG_d"), %%mm1\n\t"
-"       movq    48(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_c")\n\t"
-"       movq    %%mm4, 8(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   64(%%"REG_b"), %%mm3\n\t"
-"       pfmul   72(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 60(%%"REG_c")\n\t"
-"       movd    %%mm7, 52(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 56(%%"REG_c")\n\t"
-"       movd    %%mm7, 48(%%"REG_c")\n\t"
-
-"       movq    16(%%"REG_d"), %%mm0\n\t"
-"       movq    24(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    40(%%"REG_d"), %%mm1\n\t"
-"       movq    32(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 16(%%"REG_c")\n\t"
-"       movq    %%mm4, 24(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   80(%%"REG_b"), %%mm3\n\t"
-"       pfmul   88(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 44(%%"REG_c")\n\t"
-"       movd    %%mm7, 36(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 40(%%"REG_c")\n\t"
-"       movd    %%mm7, 32(%%"REG_c")\n\t"
-
-/* Phase 3*/
-
-"       movq    64(%%"REG_d"), %%mm0\n\t"
-"       movq    72(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    120(%%"REG_d"), %%mm1\n\t"
-"       movq    112(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 64(%%"REG_c")\n\t"
-"       movq    %%mm4, 72(%%"REG_c")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   64(%%"REG_b"), %%mm3\n\t"
-"       pfmul   72(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 124(%%"REG_c")\n\t"
-"       movd    %%mm7, 116(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 120(%%"REG_c")\n\t"
-"       movd    %%mm7, 112(%%"REG_c")\n\t"
-
-"       movq    80(%%"REG_d"), %%mm0\n\t"
-"       movq    88(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    104(%%"REG_d"), %%mm1\n\t"
-"       movq    96(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 80(%%"REG_c")\n\t"
-"       movq    %%mm4, 88(%%"REG_c")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   80(%%"REG_b"), %%mm3\n\t"
-"       pfmul   88(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 108(%%"REG_c")\n\t"
-"       movd    %%mm7, 100(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 104(%%"REG_c")\n\t"
-"       movd    %%mm7, 96(%%"REG_c")\n\t"
-
-/* Phase 4*/
-
-"       movq    (%%"REG_c"), %%mm0\n\t"
-"       movq    8(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    24(%%"REG_c"), %%mm1\n\t"
-"       movq    16(%%"REG_c"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_d")\n\t"
-"       movq    %%mm4, 8(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   96(%%"REG_b"), %%mm3\n\t"
-"       pfmul   104(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 28(%%"REG_d")\n\t"
-"       movd    %%mm7, 20(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 24(%%"REG_d")\n\t"
-"       movd    %%mm7, 16(%%"REG_d")\n\t"
-
-"       movq    32(%%"REG_c"), %%mm0\n\t"
-"       movq    40(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    56(%%"REG_c"), %%mm1\n\t"
-"       movq    48(%%"REG_c"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 32(%%"REG_d")\n\t"
-"       movq    %%mm4, 40(%%"REG_d")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   96(%%"REG_b"), %%mm3\n\t"
-"       pfmul   104(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 60(%%"REG_d")\n\t"
-"       movd    %%mm7, 52(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 56(%%"REG_d")\n\t"
-"       movd    %%mm7, 48(%%"REG_d")\n\t"
-
-"       movq    64(%%"REG_c"), %%mm0\n\t"
-"       movq    72(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    88(%%"REG_c"), %%mm1\n\t"
-"       movq    80(%%"REG_c"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 64(%%"REG_d")\n\t"
-"       movq    %%mm4, 72(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   96(%%"REG_b"), %%mm3\n\t"
-"       pfmul   104(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 92(%%"REG_d")\n\t"
-"       movd    %%mm7, 84(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 88(%%"REG_d")\n\t"
-"       movd    %%mm7, 80(%%"REG_d")\n\t"
-
-"       movq    96(%%"REG_c"), %%mm0\n\t"
-"       movq    104(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    120(%%"REG_c"), %%mm1\n\t"
-"       movq    112(%%"REG_c"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 96(%%"REG_d")\n\t"
-"       movq    %%mm4, 104(%%"REG_d")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   96(%%"REG_b"), %%mm3\n\t"
-"       pfmul   104(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 124(%%"REG_d")\n\t"
-"       movd    %%mm7, 116(%%"REG_d")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 120(%%"REG_d")\n\t"
-"       movd    %%mm7, 112(%%"REG_d")\n\t"
-
-/* Phase 5 */
-
-"       movq    (%%"REG_d"), %%mm0\n\t"
-"       movq    16(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    8(%%"REG_d"), %%mm1\n\t"
-"       movq    24(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_c")\n\t"
-"       movq    %%mm4, 16(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   112(%%"REG_b"), %%mm3\n\t"
-"       pfmul   112(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 12(%%"REG_c")\n\t"
-"       movd    %%mm7, 28(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 8(%%"REG_c")\n\t"
-"       movd    %%mm7, 24(%%"REG_c")\n\t"
-
-"       movq    32(%%"REG_d"), %%mm0\n\t"
-"       movq    48(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    40(%%"REG_d"), %%mm1\n\t"
-"       movq    56(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 32(%%"REG_c")\n\t"
-"       movq    %%mm4, 48(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   112(%%"REG_b"), %%mm3\n\t"
-"       pfmul   112(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 44(%%"REG_c")\n\t"
-"       movd    %%mm7, 60(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 40(%%"REG_c")\n\t"
-"       movd    %%mm7, 56(%%"REG_c")\n\t"
-
-"       movq    64(%%"REG_d"), %%mm0\n\t"
-"       movq    80(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    72(%%"REG_d"), %%mm1\n\t"
-"       movq    88(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 64(%%"REG_c")\n\t"
-"       movq    %%mm4, 80(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   112(%%"REG_b"), %%mm3\n\t"
-"       pfmul   112(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 76(%%"REG_c")\n\t"
-"       movd    %%mm7, 92(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 72(%%"REG_c")\n\t"
-"       movd    %%mm7, 88(%%"REG_c")\n\t"
-
-"       movq    96(%%"REG_d"), %%mm0\n\t"
-"       movq    112(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       movq    104(%%"REG_d"), %%mm1\n\t"
-"       movq    120(%%"REG_d"), %%mm5\n\t"
-/* n.b.: pswapd*/
-"       movq    %%mm1, %%mm2\n\t"
-"       movq    %%mm5, %%mm6\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       psrlq   $32, %%mm5\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       punpckldq %%mm6, %%mm5\n\t"
-/**/
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 96(%%"REG_c")\n\t"
-"       movq    %%mm4, 112(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   112(%%"REG_b"), %%mm3\n\t"
-"       pfmul   112(%%"REG_b"), %%mm7\n\t"
-"       movd    %%mm3, 108(%%"REG_c")\n\t"
-"       movd    %%mm7, 124(%%"REG_c")\n\t"
-"       psrlq   $32, %%mm3\n\t"
-"       psrlq   $32, %%mm7\n\t"
-"       movd    %%mm3, 104(%%"REG_c")\n\t"
-"       movd    %%mm7, 120(%%"REG_c")\n\t"
-
-/* Phase 6. This is the end of easy road. */
-/* Code below is coded in scalar mode. Should be optimized */
-
-"       movd    "MANGLE(plus_1f)", %%mm6\n\t"
-"       punpckldq 120(%%"REG_b"), %%mm6\n\t"      /* mm6 = 1.0 | 120(%%"REG_b")*/
-"       movq    "MANGLE(x_plus_minus_3dnow)", %%mm7\n\t" /* mm7 = +1 | -1 */
-
-"       movq    32(%%"REG_c"), %%mm0\n\t"
-"       movq    64(%%"REG_c"), %%mm2\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       movq    %%mm2, %%mm3\n\t"
-"       pxor    %%mm7, %%mm1\n\t"
-"       pxor    %%mm7, %%mm3\n\t"
-"       pfacc   %%mm1, %%mm0\n\t"
-"       pfacc   %%mm3, %%mm2\n\t"
-"       pfmul   %%mm6, %%mm0\n\t"
-"       pfmul   %%mm6, %%mm2\n\t"
-"       movq    %%mm0, 32(%%"REG_d")\n\t"
-"       movq    %%mm2, 64(%%"REG_d")\n\t"
-
-"       movd    44(%%"REG_c"), %%mm0\n\t"
-"       movd    40(%%"REG_c"), %%mm2\n\t"
-"       movd    120(%%"REG_b"), %%mm3\n\t"
-"       punpckldq 76(%%"REG_c"), %%mm0\n\t"
-"       punpckldq 72(%%"REG_c"), %%mm2\n\t"
-"       punpckldq %%mm3, %%mm3\n\t"
-"       movq    %%mm0, %%mm4\n\t"
-"       movq    %%mm2, %%mm5\n\t"
-"       pfsub   %%mm2, %%mm0\n\t"
-"       pfmul   %%mm3, %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       pfadd   %%mm5, %%mm0\n\t"
-"       pfadd   %%mm4, %%mm0\n\t"
-"       movq    %%mm0, %%mm2\n\t"
-"       punpckldq %%mm1, %%mm0\n\t"
-"       punpckhdq %%mm1, %%mm2\n\t"
-"       movq    %%mm0, 40(%%"REG_d")\n\t"
-"       movq    %%mm2, 72(%%"REG_d")\n\t"
-
-"       movd   48(%%"REG_c"), %%mm3\n\t"
-"       movd   60(%%"REG_c"), %%mm2\n\t"
-"       pfsub  52(%%"REG_c"), %%mm3\n\t"
-"       pfsub  56(%%"REG_c"), %%mm2\n\t"
-"       pfmul 120(%%"REG_b"), %%mm3\n\t"
-"       pfmul 120(%%"REG_b"), %%mm2\n\t"
-"       movq    %%mm2, %%mm1\n\t"
-
-"       pfadd  56(%%"REG_c"), %%mm1\n\t"
-"       pfadd  60(%%"REG_c"), %%mm1\n\t"
-"       movq    %%mm1, %%mm0\n\t"
-
-"       pfadd  48(%%"REG_c"), %%mm0\n\t"
-"       pfadd  52(%%"REG_c"), %%mm0\n\t"
-"       pfadd   %%mm3, %%mm1\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       pfadd   %%mm3, %%mm2\n\t"
-"       punpckldq %%mm2, %%mm0\n\t"
-"       movq    %%mm1, 56(%%"REG_d")\n\t"
-"       movq    %%mm0, 48(%%"REG_d")\n\t"
-
-/*---*/
-
-"       movd   92(%%"REG_c"), %%mm1\n\t"
-"       pfsub  88(%%"REG_c"), %%mm1\n\t"
-"       pfmul 120(%%"REG_b"), %%mm1\n\t"
-"       movd   %%mm1, 92(%%"REG_d")\n\t"
-"       pfadd  92(%%"REG_c"), %%mm1\n\t"
-"       pfadd  88(%%"REG_c"), %%mm1\n\t"
-"       movq   %%mm1, %%mm0\n\t"
-
-"       pfadd  80(%%"REG_c"), %%mm0\n\t"
-"       pfadd  84(%%"REG_c"), %%mm0\n\t"
-"       movd   %%mm0, 80(%%"REG_d")\n\t"
-
-"       movd   80(%%"REG_c"), %%mm0\n\t"
-"       pfsub  84(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       pfadd  %%mm0, %%mm1\n\t"
-"       pfadd  92(%%"REG_d"), %%mm0\n\t"
-"       punpckldq %%mm1, %%mm0\n\t"
-"       movq   %%mm0, 84(%%"REG_d")\n\t"
-
-"       movq    96(%%"REG_c"), %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       pxor    %%mm7, %%mm1\n\t"
-"       pfacc   %%mm1, %%mm0\n\t"
-"       pfmul   %%mm6, %%mm0\n\t"
-"       movq    %%mm0, 96(%%"REG_d")\n\t"
-
-"       movd  108(%%"REG_c"), %%mm0\n\t"
-"       pfsub 104(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movd  %%mm0, 108(%%"REG_d")\n\t"
-"       pfadd 104(%%"REG_c"), %%mm0\n\t"
-"       pfadd 108(%%"REG_c"), %%mm0\n\t"
-"       movd  %%mm0, 104(%%"REG_d")\n\t"
-
-"       movd  124(%%"REG_c"), %%mm1\n\t"
-"       pfsub 120(%%"REG_c"), %%mm1\n\t"
-"       pfmul 120(%%"REG_b"), %%mm1\n\t"
-"       movd  %%mm1, 124(%%"REG_d")\n\t"
-"       pfadd 120(%%"REG_c"), %%mm1\n\t"
-"       pfadd 124(%%"REG_c"), %%mm1\n\t"
-"       movq  %%mm1, %%mm0\n\t"
-
-"       pfadd 112(%%"REG_c"), %%mm0\n\t"
-"       pfadd 116(%%"REG_c"), %%mm0\n\t"
-"       movd  %%mm0, 112(%%"REG_d")\n\t"
-
-"       movd  112(%%"REG_c"), %%mm0\n\t"
-"       pfsub 116(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       pfadd %%mm0,%%mm1\n\t"
-"       pfadd 124(%%"REG_d"), %%mm0\n\t"
-"       punpckldq %%mm1, %%mm0\n\t"
-"       movq  %%mm0, 116(%%"REG_d")\n\t"
-
-// this code is broken, there is nothing modifying the z flag above.
-#if 0
-"       jnz .L01\n\t"
-
-/* Phase 7*/
-/* Code below is coded in scalar mode. Should be optimized */
-
-"       movd      (%%"REG_c"), %%mm0\n\t"
-"       pfadd    4(%%"REG_c"), %%mm0\n\t"
-"       movd     %%mm0, 1024(%%"REG_S")\n\t"
-
-"       movd      (%%"REG_c"), %%mm0\n\t"
-"       pfsub    4(%%"REG_c"), %%mm0\n\t"
-"       pfmul  120(%%"REG_b"), %%mm0\n\t"
-"       movd      %%mm0, (%%"REG_S")\n\t"
-"       movd      %%mm0, (%%"REG_D")\n\t"
-
-"       movd   12(%%"REG_c"), %%mm0\n\t"
-"       pfsub   8(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movd    %%mm0, 512(%%"REG_D")\n\t"
-"       pfadd   12(%%"REG_c"), %%mm0\n\t"
-"       pfadd   8(%%"REG_c"), %%mm0\n\t"
-"       movd    %%mm0, 512(%%"REG_S")\n\t"
-
-"       movd   16(%%"REG_c"), %%mm0\n\t"
-"       pfsub  20(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-
-"       movd   28(%%"REG_c"), %%mm0\n\t"
-"       pfsub  24(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movd    %%mm0, 768(%%"REG_D")\n\t"
-"       movq    %%mm0, %%mm2\n\t"
-
-"       pfadd  24(%%"REG_c"), %%mm0\n\t"
-"       pfadd  28(%%"REG_c"), %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-
-"       pfadd  16(%%"REG_c"), %%mm0\n\t"
-"       pfadd  20(%%"REG_c"), %%mm0\n\t"
-"       movd   %%mm0, 768(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm1\n\t"
-"       movd   %%mm1, 256(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm2\n\t"
-"       movd   %%mm2, 256(%%"REG_D")\n\t"
-
-/* Phase 8*/
-
-"       movq   32(%%"REG_d"), %%mm0\n\t"
-"       movq   48(%%"REG_d"), %%mm1\n\t"
-"       pfadd  48(%%"REG_d"), %%mm0\n\t"
-"       pfadd  40(%%"REG_d"), %%mm1\n\t"
-"       movd   %%mm0, 896(%%"REG_S")\n\t"
-"       movd   %%mm1, 640(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm0\n\t"
-"       psrlq  $32, %%mm1\n\t"
-"       movd   %%mm0, 128(%%"REG_D")\n\t"
-"       movd   %%mm1, 384(%%"REG_D")\n\t"
-
-"       movd   40(%%"REG_d"), %%mm0\n\t"
-"       pfadd  56(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 384(%%"REG_S")\n\t"
-
-"       movd   56(%%"REG_d"), %%mm0\n\t"
-"       pfadd  36(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 128(%%"REG_S")\n\t"
-
-"       movd   60(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 896(%%"REG_D")\n\t"
-"       pfadd  44(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 640(%%"REG_D")\n\t"
-
-"       movq   96(%%"REG_d"), %%mm0\n\t"
-"       movq   112(%%"REG_d"), %%mm2\n\t"
-"       movq   104(%%"REG_d"), %%mm4\n\t"
-"       pfadd  112(%%"REG_d"), %%mm0\n\t"
-"       pfadd  104(%%"REG_d"), %%mm2\n\t"
-"       pfadd  120(%%"REG_d"), %%mm4\n\t"
-"       movq   %%mm0, %%mm1\n\t"
-"       movq   %%mm2, %%mm3\n\t"
-"       movq   %%mm4, %%mm5\n\t"
-"       pfadd  64(%%"REG_d"), %%mm0\n\t"
-"       pfadd  80(%%"REG_d"), %%mm2\n\t"
-"       pfadd  72(%%"REG_d"), %%mm4\n\t"
-"       movd   %%mm0, 960(%%"REG_S")\n\t"
-"       movd   %%mm2, 704(%%"REG_S")\n\t"
-"       movd   %%mm4, 448(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm0\n\t"
-"       psrlq  $32, %%mm2\n\t"
-"       psrlq  $32, %%mm4\n\t"
-"       movd   %%mm0, 64(%%"REG_D")\n\t"
-"       movd   %%mm2, 320(%%"REG_D")\n\t"
-"       movd   %%mm4, 576(%%"REG_D")\n\t"
-"       pfadd  80(%%"REG_d"), %%mm1\n\t"
-"       pfadd  72(%%"REG_d"), %%mm3\n\t"
-"       pfadd  88(%%"REG_d"), %%mm5\n\t"
-"       movd   %%mm1, 832(%%"REG_S")\n\t"
-"       movd   %%mm3, 576(%%"REG_S")\n\t"
-"       movd   %%mm5, 320(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm1\n\t"
-"       psrlq  $32, %%mm3\n\t"
-"       psrlq  $32, %%mm5\n\t"
-"       movd   %%mm1, 192(%%"REG_D")\n\t"
-"       movd   %%mm3, 448(%%"REG_D")\n\t"
-"       movd   %%mm5, 704(%%"REG_D")\n\t"
-
-"       movd   120(%%"REG_d"), %%mm0\n\t"
-"       pfadd  100(%%"REG_d"), %%mm0\n\t"
-"       movq   %%mm0, %%mm1\n\t"
-"       pfadd  88(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 192(%%"REG_S")\n\t"
-"       pfadd  68(%%"REG_d"), %%mm1\n\t"
-"       movd   %%mm1, 64(%%"REG_S")\n\t"
-
-"       movd  124(%%"REG_d"), %%mm0\n\t"
-"       movd  %%mm0, 960(%%"REG_D")\n\t"
-"       pfadd  92(%%"REG_d"), %%mm0\n\t"
-"       movd  %%mm0, 832(%%"REG_D")\n\t"
-
-"       jmp     .L_bye\n\t"
-".L01:\n\t"
-#endif
-/* Phase 9*/
-
-"       movq    (%%"REG_c"), %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       pxor    %%mm7, %%mm1\n\t"
-"       pfacc   %%mm1, %%mm0\n\t"
-"       pfmul   %%mm6, %%mm0\n\t"
-"       pf2id   %%mm0, %%mm0\n\t"
-"       packssdw %%mm0, %%mm0\n\t"
-"       movd    %%mm0, %%"REG_a"\n\t"
-"       movw    %%ax, 512(%%"REG_S")\n\t"
-"       shr    $16, %%"REG_a"\n\t"
-"       movw    %%ax, (%%"REG_S")\n\t"
-
-"       movd    12(%%"REG_c"), %%mm0\n\t"
-"       pfsub    8(%%"REG_c"), %%mm0\n\t"
-"       pfmul  120(%%"REG_b"), %%mm0\n\t"
-"       pf2id    %%mm0, %%mm7\n\t"
-"       packssdw %%mm7, %%mm7\n\t"
-"       movd     %%mm7, %%"REG_a"\n\t"
-"       movw     %%ax, 256(%%"REG_D")\n\t"
-"       pfadd   12(%%"REG_c"), %%mm0\n\t"
-"       pfadd    8(%%"REG_c"), %%mm0\n\t"
-"       pf2id    %%mm0, %%mm0\n\t"
-"       packssdw %%mm0, %%mm0\n\t"
-"       movd     %%mm0, %%"REG_a"\n\t"
-"       movw     %%ax, 256(%%"REG_S")\n\t"
-
-"       movd   16(%%"REG_c"), %%mm3\n\t"
-"       pfsub  20(%%"REG_c"), %%mm3\n\t"
-"       pfmul  120(%%"REG_b"), %%mm3\n\t"
-"       movq   %%mm3, %%mm2\n\t"
-
-"       movd   28(%%"REG_c"), %%mm2\n\t"
-"       pfsub  24(%%"REG_c"), %%mm2\n\t"
-"       pfmul 120(%%"REG_b"), %%mm2\n\t"
-"       movq   %%mm2, %%mm1\n\t"
-
-"       pf2id  %%mm2, %%mm7\n\t"
-"       packssdw %%mm7, %%mm7\n\t"
-"       movd   %%mm7, %%"REG_a"\n\t"
-"       movw   %%ax, 384(%%"REG_D")\n\t"
-
-"       pfadd  24(%%"REG_c"), %%mm1\n\t"
-"       pfadd  28(%%"REG_c"), %%mm1\n\t"
-"       movq   %%mm1, %%mm0\n\t"
-
-"       pfadd  16(%%"REG_c"), %%mm0\n\t"
-"       pfadd  20(%%"REG_c"), %%mm0\n\t"
-"       pf2id  %%mm0, %%mm0\n\t"
-"       packssdw %%mm0, %%mm0\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       movw   %%ax, 384(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm1\n\t"
-"       pf2id  %%mm1, %%mm1\n\t"
-"       packssdw %%mm1, %%mm1\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movw   %%ax, 128(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm2\n\t"
-"       pf2id  %%mm2, %%mm2\n\t"
-"       packssdw %%mm2, %%mm2\n\t"
-"       movd   %%mm2, %%"REG_a"\n\t"
-"       movw   %%ax, 128(%%"REG_D")\n\t"
-
-/* Phase 10*/
-
-"       movq    32(%%"REG_d"), %%mm0\n\t"
-"       movq    48(%%"REG_d"), %%mm1\n\t"
-"       pfadd   48(%%"REG_d"), %%mm0\n\t"
-"       pfadd   40(%%"REG_d"), %%mm1\n\t"
-"       pf2id   %%mm0, %%mm0\n\t"
-"       pf2id   %%mm1, %%mm1\n\t"
-"       packssdw %%mm0, %%mm0\n\t"
-"       packssdw %%mm1, %%mm1\n\t"
-"       movd    %%mm0, %%"REG_a"\n\t"
-"       movd    %%mm1, %%"REG_c"\n\t"
-"       movw    %%ax, 448(%%"REG_S")\n\t"
-"       movw    %%cx, 320(%%"REG_S")\n\t"
-"       shr    $16, %%"REG_a"\n\t"
-"       shr    $16, %%"REG_c"\n\t"
-"       movw    %%ax, 64(%%"REG_D")\n\t"
-"       movw    %%cx, 192(%%"REG_D")\n\t"
-
-"       movd   40(%%"REG_d"), %%mm3\n\t"
-"       movd   56(%%"REG_d"), %%mm4\n\t"
-"       movd   60(%%"REG_d"), %%mm0\n\t"
-"       movd   44(%%"REG_d"), %%mm2\n\t"
-"       movd  120(%%"REG_d"), %%mm5\n\t"
-"       punpckldq %%mm4, %%mm3\n\t"
-"       punpckldq 124(%%"REG_d"), %%mm0\n\t"
-"       pfadd 100(%%"REG_d"), %%mm5\n\t"
-"       punpckldq 36(%%"REG_d"), %%mm4\n\t"
-"       punpckldq 92(%%"REG_d"), %%mm2\n\t"
-"       movq  %%mm5, %%mm6\n\t"
-"       pfadd  %%mm4, %%mm3\n\t"
-"       pf2id  %%mm0, %%mm1\n\t"
-"       pf2id  %%mm3, %%mm3\n\t"
-"       packssdw %%mm1, %%mm1\n\t"
-"       packssdw %%mm3, %%mm3\n\t"
-"       pfadd  88(%%"REG_d"), %%mm5\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movd   %%mm3, %%"REG_c"\n\t"
-"       movw   %%ax, 448(%%"REG_D")\n\t"
-"       movw   %%cx, 192(%%"REG_S")\n\t"
-"       pf2id  %%mm5, %%mm5\n\t"
-"       packssdw %%mm5, %%mm5\n\t"
-"       shr   $16, %%"REG_a"\n\t"
-"       shr   $16, %%"REG_c"\n\t"
-"       movd   %%mm5, %%"REG_b"\n\t"
-"       movw   %%bx, 96(%%"REG_S")\n\t"
-"       movw   %%ax, 480(%%"REG_D")\n\t"
-"       movw   %%cx, 64(%%"REG_S")\n\t"
-"       pfadd  %%mm2, %%mm0\n\t"
-"       pf2id  %%mm0, %%mm0\n\t"
-"       packssdw %%mm0, %%mm0\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       pfadd  68(%%"REG_d"), %%mm6\n\t"
-"       movw   %%ax, 320(%%"REG_D")\n\t"
-"       shr    $16, %%"REG_a"\n\t"
-"       pf2id  %%mm6, %%mm6\n\t"
-"       packssdw %%mm6, %%mm6\n\t"
-"       movd   %%mm6, %%"REG_b"\n\t"
-"       movw   %%ax, 416(%%"REG_D")\n\t"
-"       movw   %%bx, 32(%%"REG_S")\n\t"
-
-"       movq   96(%%"REG_d"), %%mm0\n\t"
-"       movq  112(%%"REG_d"), %%mm2\n\t"
-"       movq  104(%%"REG_d"), %%mm4\n\t"
-"       pfadd %%mm2, %%mm0\n\t"
-"       pfadd %%mm4, %%mm2\n\t"
-"       pfadd 120(%%"REG_d"), %%mm4\n\t"
-"       movq  %%mm0, %%mm1\n\t"
-"       movq  %%mm2, %%mm3\n\t"
-"       movq  %%mm4, %%mm5\n\t"
-"       pfadd  64(%%"REG_d"), %%mm0\n\t"
-"       pfadd  80(%%"REG_d"), %%mm2\n\t"
-"       pfadd  72(%%"REG_d"), %%mm4\n\t"
-"       pf2id  %%mm0, %%mm0\n\t"
-"       pf2id  %%mm2, %%mm2\n\t"
-"       pf2id  %%mm4, %%mm4\n\t"
-"       packssdw %%mm0, %%mm0\n\t"
-"       packssdw %%mm2, %%mm2\n\t"
-"       packssdw %%mm4, %%mm4\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       movd   %%mm2, %%"REG_c"\n\t"
-"       movd   %%mm4, %%"REG_b"\n\t"
-"       movw   %%ax, 480(%%"REG_S")\n\t"
-"       movw   %%cx, 352(%%"REG_S")\n\t"
-"       movw   %%bx, 224(%%"REG_S")\n\t"
-"       shr   $16, %%"REG_a"\n\t"
-"       shr   $16, %%"REG_c"\n\t"
-"       shr   $16, %%"REG_b"\n\t"
-"       movw   %%ax, 32(%%"REG_D")\n\t"
-"       movw   %%cx, 160(%%"REG_D")\n\t"
-"       movw   %%bx, 288(%%"REG_D")\n\t"
-"       pfadd  80(%%"REG_d"), %%mm1\n\t"
-"       pfadd  72(%%"REG_d"), %%mm3\n\t"
-"       pfadd  88(%%"REG_d"), %%mm5\n\t"
-"       pf2id  %%mm1, %%mm1\n\t"
-"       pf2id  %%mm3, %%mm3\n\t"
-"       pf2id  %%mm5, %%mm5\n\t"
-"       packssdw %%mm1, %%mm1\n\t"
-"       packssdw %%mm3, %%mm3\n\t"
-"       packssdw %%mm5, %%mm5\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movd   %%mm3, %%"REG_c"\n\t"
-"       movd   %%mm5, %%"REG_b"\n\t"
-"       movw   %%ax, 416(%%"REG_S")\n\t"
-"       movw   %%cx, 288(%%"REG_S")\n\t"
-"       movw   %%bx, 160(%%"REG_S")\n\t"
-"       shr   $16, %%"REG_a"\n\t"
-"       shr   $16, %%"REG_c"\n\t"
-"       shr   $16, %%"REG_b"\n\t"
-"       movw   %%ax, 96(%%"REG_D")\n\t"
-"       movw   %%cx, 224(%%"REG_D")\n\t"
-"       movw   %%bx, 352(%%"REG_D")\n\t"
-
-"       movsw\n\t"
-
-".L_bye:\n\t"
-"       femms\n\t"
-        :
-        :"m"(a),"m"(b),"m"(c),"m"(tmp[0])
-        :"memory","%eax","%ebx","%ecx","%edx","%esi","%edi");
-}
diff --git a/mplayer/mp3lib/dct64_altivec.c b/mplayer/mp3lib/dct64_altivec.c
deleted file mode 100644
index c29e1c4..0000000
--- a/mplayer/mp3lib/dct64_altivec.c
+++ /dev/null
@@ -1,524 +0,0 @@
-
-/*
- * Discrete Cosine Tansform (DCT) for Altivec
- * Copyright (c) 2004 Romain Dolbeau <romain at dolbeau.org>
- * based upon code from "mp3lib/dct64.c"
- * This file is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- */
-
-#include <stdio.h>
-#include "mpg123.h"
-
-#ifdef HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-// used to build registers permutation vectors (vcprm)
-// the 's' are for words in the _s_econd vector
-#define WORD_0 0x00,0x01,0x02,0x03
-#define WORD_1 0x04,0x05,0x06,0x07
-#define WORD_2 0x08,0x09,0x0a,0x0b
-#define WORD_3 0x0c,0x0d,0x0e,0x0f
-#define WORD_s0 0x10,0x11,0x12,0x13
-#define WORD_s1 0x14,0x15,0x16,0x17
-#define WORD_s2 0x18,0x19,0x1a,0x1b
-#define WORD_s3 0x1c,0x1d,0x1e,0x1f
-
-#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d}
-#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d}
-
-#define FOUROF(a) {a,a,a,a}
-
-// vcprmle is used to keep the same index as in the SSE version.
-// it's the same as vcprm, with the index inversed
-// ('le' is Little Endian)
-#define vcprmle(a,b,c,d) vcprm(d,c,b,a)
-
-// used to build inverse/identity vectors (vcii)
-// n is _n_egative, p is _p_ositive
-#define FLOAT_n -1.
-#define FLOAT_p 1.
-
-void dct64_altivec(real *a,real *b,real *c)
-{
-  real __attribute__ ((aligned(16))) b1[0x20];
-  real __attribute__ ((aligned(16))) b2[0x20];
-
-  real *out0 = a;
-  real *out1 = b;
-  real *samples = c;
-
-  const vector float vczero = (const vector float)FOUROF(0.);
-  const vector unsigned char reverse = (const vector unsigned char)vcprm(3,2,1,0);
-
-
-  if (((unsigned long)b1 & 0x0000000F) ||
-      ((unsigned long)b2 & 0x0000000F))
-
-  {
-    printf("MISALIGNED:\t%p\t%p\t%p\t%p\t%p\n",
-           b1, b2, a, b, samples);
-  }
-
-
-#ifdef ALTIVEC_USE_REFERENCE_C_CODE
-
-  {
-    register real *costab = mp3lib_pnts[0];
-
-    b1[0x00] = samples[0x00] + samples[0x1F];
-    b1[0x01] = samples[0x01] + samples[0x1E];
-    b1[0x02] = samples[0x02] + samples[0x1D];
-    b1[0x03] = samples[0x03] + samples[0x1C];
-    b1[0x04] = samples[0x04] + samples[0x1B];
-    b1[0x05] = samples[0x05] + samples[0x1A];
-    b1[0x06] = samples[0x06] + samples[0x19];
-    b1[0x07] = samples[0x07] + samples[0x18];
-    b1[0x08] = samples[0x08] + samples[0x17];
-    b1[0x09] = samples[0x09] + samples[0x16];
-    b1[0x0A] = samples[0x0A] + samples[0x15];
-    b1[0x0B] = samples[0x0B] + samples[0x14];
-    b1[0x0C] = samples[0x0C] + samples[0x13];
-    b1[0x0D] = samples[0x0D] + samples[0x12];
-    b1[0x0E] = samples[0x0E] + samples[0x11];
-    b1[0x0F] = samples[0x0F] + samples[0x10];
-    b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF];
-    b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE];
-    b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD];
-    b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC];
-    b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB];
-    b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA];
-    b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9];
-    b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8];
-    b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7];
-    b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6];
-    b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5];
-    b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4];
-    b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3];
-    b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2];
-    b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1];
-    b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0];
-
-  }
-  {
-    register real *costab = mp3lib_pnts[1];
-
-    b2[0x00] = b1[0x00] + b1[0x0F];
-    b2[0x01] = b1[0x01] + b1[0x0E];
-    b2[0x02] = b1[0x02] + b1[0x0D];
-    b2[0x03] = b1[0x03] + b1[0x0C];
-    b2[0x04] = b1[0x04] + b1[0x0B];
-    b2[0x05] = b1[0x05] + b1[0x0A];
-    b2[0x06] = b1[0x06] + b1[0x09];
-    b2[0x07] = b1[0x07] + b1[0x08];
-    b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7];
-    b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6];
-    b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5];
-    b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4];
-    b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3];
-    b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2];
-    b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1];
-    b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0];
-    b2[0x10] = b1[0x10] + b1[0x1F];
-    b2[0x11] = b1[0x11] + b1[0x1E];
-    b2[0x12] = b1[0x12] + b1[0x1D];
-    b2[0x13] = b1[0x13] + b1[0x1C];
-    b2[0x14] = b1[0x14] + b1[0x1B];
-    b2[0x15] = b1[0x15] + b1[0x1A];
-    b2[0x16] = b1[0x16] + b1[0x19];
-    b2[0x17] = b1[0x17] + b1[0x18];
-    b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7];
-    b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6];
-    b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5];
-    b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4];
-    b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3];
-    b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2];
-    b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1];
-    b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0];
-
-  }
-
-  {
-    register real *costab = mp3lib_pnts[2];
-
-    b1[0x00] = b2[0x00] + b2[0x07];
-    b1[0x01] = b2[0x01] + b2[0x06];
-    b1[0x02] = b2[0x02] + b2[0x05];
-    b1[0x03] = b2[0x03] + b2[0x04];
-    b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3];
-    b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2];
-    b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1];
-    b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0];
-    b1[0x08] = b2[0x08] + b2[0x0F];
-    b1[0x09] = b2[0x09] + b2[0x0E];
-    b1[0x0A] = b2[0x0A] + b2[0x0D];
-    b1[0x0B] = b2[0x0B] + b2[0x0C];
-    b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3];
-    b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2];
-    b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1];
-    b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0];
-    b1[0x10] = b2[0x10] + b2[0x17];
-    b1[0x11] = b2[0x11] + b2[0x16];
-    b1[0x12] = b2[0x12] + b2[0x15];
-    b1[0x13] = b2[0x13] + b2[0x14];
-    b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3];
-    b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2];
-    b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1];
-    b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0];
-    b1[0x18] = b2[0x18] + b2[0x1F];
-    b1[0x19] = b2[0x19] + b2[0x1E];
-    b1[0x1A] = b2[0x1A] + b2[0x1D];
-    b1[0x1B] = b2[0x1B] + b2[0x1C];
-    b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3];
-    b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2];
-    b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1];
-    b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0];
-  }
-
-#else /* ALTIVEC_USE_REFERENCE_C_CODE */
-
-  // How does it work ?
-  // the first three passes are reproducted in the three block below
-  // all computations are done on a 4 elements vector
-  // 'reverse' is a special perumtation vector used to reverse
-  // the order of the elements inside a vector.
-  // note that all loads/stores to b1 (b2) between passes 1 and 2 (2 and 3)
-  // have been removed, all elements are stored inside b1vX (b2vX)
-  {
-    register vector float
-      b1v0, b1v1, b1v2, b1v3,
-      b1v4, b1v5, b1v6, b1v7;
-    register vector float
-      temp1, temp2;
-
-    {
-      register real *costab = mp3lib_pnts[0];
-
-      register vector float
-        samplesv1, samplesv2, samplesv3, samplesv4,
-        samplesv5, samplesv6, samplesv7, samplesv8,
-        samplesv9;
-      register vector unsigned char samples_perm = vec_lvsl(0, samples);
-      register vector float costabv1, costabv2, costabv3, costabv4, costabv5;
-      register vector unsigned char costab_perm = vec_lvsl(0, costab);
-
-      samplesv1 = vec_ld(0, samples);
-      samplesv2 = vec_ld(16, samples);
-      samplesv1 = vec_perm(samplesv1, samplesv2, samples_perm);
-      samplesv3 = vec_ld(32, samples);
-      samplesv2 = vec_perm(samplesv2, samplesv3, samples_perm);
-      samplesv4 = vec_ld(48, samples);
-      samplesv3 = vec_perm(samplesv3, samplesv4, samples_perm);
-      samplesv5 = vec_ld(64, samples);
-      samplesv4 = vec_perm(samplesv4, samplesv5, samples_perm);
-      samplesv6 = vec_ld(80, samples);
-      samplesv5 = vec_perm(samplesv5, samplesv6, samples_perm);
-      samplesv7 = vec_ld(96, samples);
-      samplesv6 = vec_perm(samplesv6, samplesv7, samples_perm);
-      samplesv8 = vec_ld(112, samples);
-      samplesv7 = vec_perm(samplesv7, samplesv8, samples_perm);
-      samplesv9 = vec_ld(128, samples);
-      samplesv8 = vec_perm(samplesv8, samplesv9, samples_perm);
-
-      temp1 = vec_add(samplesv1,
-                      vec_perm(samplesv8, samplesv8, reverse));
-      //vec_st(temp1, 0, b1);
-      b1v0 = temp1;
-      temp1 = vec_add(samplesv2,
-                      vec_perm(samplesv7, samplesv7, reverse));
-      //vec_st(temp1, 16, b1);
-      b1v1 = temp1;
-      temp1 = vec_add(samplesv3,
-                      vec_perm(samplesv6, samplesv6, reverse));
-      //vec_st(temp1, 32, b1);
-      b1v2 = temp1;
-      temp1 = vec_add(samplesv4,
-                      vec_perm(samplesv5, samplesv5, reverse));
-      //vec_st(temp1, 48, b1);
-      b1v3 = temp1;
-
-      costabv1 = vec_ld(0, costab);
-      costabv2 = vec_ld(16, costab);
-      costabv1 = vec_perm(costabv1, costabv2, costab_perm);
-      costabv3 = vec_ld(32, costab);
-      costabv2 = vec_perm(costabv2, costabv3, costab_perm);
-      costabv4 = vec_ld(48, costab);
-      costabv3 = vec_perm(costabv3, costabv4, costab_perm);
-      costabv5 = vec_ld(64, costab);
-      costabv4 = vec_perm(costabv4, costabv5, costab_perm);
-
-      temp1 = vec_sub(vec_perm(samplesv4, samplesv4, reverse),
-                      samplesv5);
-      temp2 = vec_madd(temp1,
-                       vec_perm(costabv4, costabv4, reverse),
-                       vczero);
-      //vec_st(temp2, 64, b1);
-      b1v4 = temp2;
-
-      temp1 = vec_sub(vec_perm(samplesv3, samplesv3, reverse),
-                      samplesv6);
-      temp2 = vec_madd(temp1,
-                       vec_perm(costabv3, costabv3, reverse),
-                       vczero);
-      //vec_st(temp2, 80, b1);
-      b1v5 = temp2;
-      temp1 = vec_sub(vec_perm(samplesv2, samplesv2, reverse),
-                      samplesv7);
-      temp2 = vec_madd(temp1,
-                       vec_perm(costabv2, costabv2, reverse),
-                       vczero);
-      //vec_st(temp2, 96, b1);
-      b1v6 = temp2;
-
-      temp1 = vec_sub(vec_perm(samplesv1, samplesv1, reverse),
-                      samplesv8);
-      temp2 = vec_madd(temp1,
-                       vec_perm(costabv1, costabv1, reverse),
-                       vczero);
-      //vec_st(temp2, 112, b1);
-      b1v7 = temp2;
-
-    }
-
-    {
-      register vector float
-        b2v0, b2v1, b2v2, b2v3,
-        b2v4, b2v5, b2v6, b2v7;
-      {
-        register real *costab = mp3lib_pnts[1];
-        register vector float costabv1r, costabv2r, costabv1, costabv2, costabv3;
-        register vector unsigned char costab_perm = vec_lvsl(0, costab);
-
-        costabv1 = vec_ld(0, costab);
-        costabv2 = vec_ld(16, costab);
-        costabv1 = vec_perm(costabv1, costabv2, costab_perm);
-        costabv3  = vec_ld(32, costab);
-        costabv2 = vec_perm(costabv2, costabv3 , costab_perm);
-        costabv1r = vec_perm(costabv1, costabv1, reverse);
-        costabv2r = vec_perm(costabv2, costabv2, reverse);
-
-        temp1 = vec_add(b1v0, vec_perm(b1v3, b1v3, reverse));
-        //vec_st(temp1, 0, b2);
-        b2v0 = temp1;
-        temp1 = vec_add(b1v1, vec_perm(b1v2, b1v2, reverse));
-        //vec_st(temp1, 16, b2);
-        b2v1 = temp1;
-        temp2 = vec_sub(vec_perm(b1v1, b1v1, reverse), b1v2);
-        temp1 = vec_madd(temp2, costabv2r, vczero);
-        //vec_st(temp1, 32, b2);
-        b2v2 = temp1;
-        temp2 = vec_sub(vec_perm(b1v0, b1v0, reverse), b1v3);
-        temp1 = vec_madd(temp2, costabv1r, vczero);
-        //vec_st(temp1, 48, b2);
-        b2v3 = temp1;
-        temp1 = vec_add(b1v4, vec_perm(b1v7, b1v7, reverse));
-        //vec_st(temp1, 64, b2);
-        b2v4 = temp1;
-        temp1 = vec_add(b1v5, vec_perm(b1v6, b1v6, reverse));
-        //vec_st(temp1, 80, b2);
-        b2v5 = temp1;
-        temp2 = vec_sub(b1v6, vec_perm(b1v5, b1v5, reverse));
-        temp1 = vec_madd(temp2, costabv2r, vczero);
-        //vec_st(temp1, 96, b2);
-        b2v6 = temp1;
-        temp2 = vec_sub(b1v7, vec_perm(b1v4, b1v4, reverse));
-        temp1 = vec_madd(temp2, costabv1r, vczero);
-        //vec_st(temp1, 112, b2);
-        b2v7 = temp1;
-      }
-
-      {
-        register real *costab = mp3lib_pnts[2];
-
-
-        vector float costabv1r, costabv1, costabv2;
-        vector unsigned char costab_perm = vec_lvsl(0, costab);
-
-        costabv1 = vec_ld(0, costab);
-        costabv2 = vec_ld(16, costab);
-        costabv1 = vec_perm(costabv1, costabv2, costab_perm);
-        costabv1r = vec_perm(costabv1, costabv1, reverse);
-
-        temp1 = vec_add(b2v0, vec_perm(b2v1, b2v1, reverse));
-        vec_st(temp1, 0, b1);
-        temp2 = vec_sub(vec_perm(b2v0, b2v0, reverse), b2v1);
-        temp1 = vec_madd(temp2, costabv1r, vczero);
-        vec_st(temp1, 16, b1);
-
-        temp1 = vec_add(b2v2, vec_perm(b2v3, b2v3, reverse));
-        vec_st(temp1, 32, b1);
-        temp2 = vec_sub(b2v3, vec_perm(b2v2, b2v2, reverse));
-        temp1 = vec_madd(temp2, costabv1r, vczero);
-        vec_st(temp1, 48, b1);
-
-        temp1 = vec_add(b2v4, vec_perm(b2v5, b2v5, reverse));
-        vec_st(temp1, 64, b1);
-        temp2 = vec_sub(vec_perm(b2v4, b2v4, reverse), b2v5);
-        temp1 = vec_madd(temp2, costabv1r, vczero);
-        vec_st(temp1, 80, b1);
-
-        temp1 = vec_add(b2v6, vec_perm(b2v7, b2v7, reverse));
-        vec_st(temp1, 96, b1);
-        temp2 = vec_sub(b2v7, vec_perm(b2v6, b2v6, reverse));
-        temp1 = vec_madd(temp2, costabv1r, vczero);
-        vec_st(temp1, 112, b1);
-
-      }
-    }
-  }
-
-#endif /* ALTIVEC_USE_REFERENCE_C_CODE */
-
-  {
-    register real const cos0 = mp3lib_pnts[3][0];
-    register real const cos1 = mp3lib_pnts[3][1];
-
-    b2[0x00] = b1[0x00] + b1[0x03];
-    b2[0x01] = b1[0x01] + b1[0x02];
-    b2[0x02] = (b1[0x01] - b1[0x02]) * cos1;
-    b2[0x03] = (b1[0x00] - b1[0x03]) * cos0;
-    b2[0x04] = b1[0x04] + b1[0x07];
-    b2[0x05] = b1[0x05] + b1[0x06];
-    b2[0x06] = (b1[0x06] - b1[0x05]) * cos1;
-    b2[0x07] = (b1[0x07] - b1[0x04]) * cos0;
-    b2[0x08] = b1[0x08] + b1[0x0B];
-    b2[0x09] = b1[0x09] + b1[0x0A];
-    b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1;
-    b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0;
-    b2[0x0C] = b1[0x0C] + b1[0x0F];
-    b2[0x0D] = b1[0x0D] + b1[0x0E];
-    b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1;
-    b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0;
-    b2[0x10] = b1[0x10] + b1[0x13];
-    b2[0x11] = b1[0x11] + b1[0x12];
-    b2[0x12] = (b1[0x11] - b1[0x12]) * cos1;
-    b2[0x13] = (b1[0x10] - b1[0x13]) * cos0;
-    b2[0x14] = b1[0x14] + b1[0x17];
-    b2[0x15] = b1[0x15] + b1[0x16];
-    b2[0x16] = (b1[0x16] - b1[0x15]) * cos1;
-    b2[0x17] = (b1[0x17] - b1[0x14]) * cos0;
-    b2[0x18] = b1[0x18] + b1[0x1B];
-    b2[0x19] = b1[0x19] + b1[0x1A];
-    b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1;
-    b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0;
-    b2[0x1C] = b1[0x1C] + b1[0x1F];
-    b2[0x1D] = b1[0x1D] + b1[0x1E];
-    b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1;
-    b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0;
-  }
-
-  {
-    register real const cos0 = mp3lib_pnts[4][0];
-
-    b1[0x00] = b2[0x00] + b2[0x01];
-    b1[0x01] = (b2[0x00] - b2[0x01]) * cos0;
-    b1[0x02] = b2[0x02] + b2[0x03];
-    b1[0x03] = (b2[0x03] - b2[0x02]) * cos0;
-    b1[0x02] += b1[0x03];
-
-    b1[0x04] = b2[0x04] + b2[0x05];
-    b1[0x05] = (b2[0x04] - b2[0x05]) * cos0;
-    b1[0x06] = b2[0x06] + b2[0x07];
-    b1[0x07] = (b2[0x07] - b2[0x06]) * cos0;
-    b1[0x06] += b1[0x07];
-    b1[0x04] += b1[0x06];
-    b1[0x06] += b1[0x05];
-    b1[0x05] += b1[0x07];
-
-    b1[0x08] = b2[0x08] + b2[0x09];
-    b1[0x09] = (b2[0x08] - b2[0x09]) * cos0;
-    b1[0x0A] = b2[0x0A] + b2[0x0B];
-    b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0;
-    b1[0x0A] += b1[0x0B];
-
-    b1[0x0C] = b2[0x0C] + b2[0x0D];
-    b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0;
-    b1[0x0E] = b2[0x0E] + b2[0x0F];
-    b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0;
-    b1[0x0E] += b1[0x0F];
-    b1[0x0C] += b1[0x0E];
-    b1[0x0E] += b1[0x0D];
-    b1[0x0D] += b1[0x0F];
-
-    b1[0x10] = b2[0x10] + b2[0x11];
-    b1[0x11] = (b2[0x10] - b2[0x11]) * cos0;
-    b1[0x12] = b2[0x12] + b2[0x13];
-    b1[0x13] = (b2[0x13] - b2[0x12]) * cos0;
-    b1[0x12] += b1[0x13];
-
-    b1[0x14] = b2[0x14] + b2[0x15];
-    b1[0x15] = (b2[0x14] - b2[0x15]) * cos0;
-    b1[0x16] = b2[0x16] + b2[0x17];
-    b1[0x17] = (b2[0x17] - b2[0x16]) * cos0;
-    b1[0x16] += b1[0x17];
-    b1[0x14] += b1[0x16];
-    b1[0x16] += b1[0x15];
-    b1[0x15] += b1[0x17];
-
-    b1[0x18] = b2[0x18] + b2[0x19];
-    b1[0x19] = (b2[0x18] - b2[0x19]) * cos0;
-    b1[0x1A] = b2[0x1A] + b2[0x1B];
-    b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0;
-    b1[0x1A] += b1[0x1B];
-
-    b1[0x1C] = b2[0x1C] + b2[0x1D];
-    b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0;
-    b1[0x1E] = b2[0x1E] + b2[0x1F];
-    b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0;
-    b1[0x1E] += b1[0x1F];
-    b1[0x1C] += b1[0x1E];
-    b1[0x1E] += b1[0x1D];
-    b1[0x1D] += b1[0x1F];
-  }
-
-  out0[0x10*16] = b1[0x00];
-  out0[0x10*12] = b1[0x04];
-  out0[0x10* 8] = b1[0x02];
-  out0[0x10* 4] = b1[0x06];
-  out0[0x10* 0] = b1[0x01];
-  out1[0x10* 0] = b1[0x01];
-  out1[0x10* 4] = b1[0x05];
-  out1[0x10* 8] = b1[0x03];
-  out1[0x10*12] = b1[0x07];
-
-  b1[0x08] += b1[0x0C];
-  out0[0x10*14] = b1[0x08];
-  b1[0x0C] += b1[0x0a];
-  out0[0x10*10] = b1[0x0C];
-  b1[0x0A] += b1[0x0E];
-  out0[0x10* 6] = b1[0x0A];
-  b1[0x0E] += b1[0x09];
-  out0[0x10* 2] = b1[0x0E];
-  b1[0x09] += b1[0x0D];
-  out1[0x10* 2] = b1[0x09];
-  b1[0x0D] += b1[0x0B];
-  out1[0x10* 6] = b1[0x0D];
-  b1[0x0B] += b1[0x0F];
-  out1[0x10*10] = b1[0x0B];
-  out1[0x10*14] = b1[0x0F];
-
-  b1[0x18] += b1[0x1C];
-  out0[0x10*15] = b1[0x10] + b1[0x18];
-  out0[0x10*13] = b1[0x18] + b1[0x14];
-  b1[0x1C] += b1[0x1a];
-  out0[0x10*11] = b1[0x14] + b1[0x1C];
-  out0[0x10* 9] = b1[0x1C] + b1[0x12];
-  b1[0x1A] += b1[0x1E];
-  out0[0x10* 7] = b1[0x12] + b1[0x1A];
-  out0[0x10* 5] = b1[0x1A] + b1[0x16];
-  b1[0x1E] += b1[0x19];
-  out0[0x10* 3] = b1[0x16] + b1[0x1E];
-  out0[0x10* 1] = b1[0x1E] + b1[0x11];
-  b1[0x19] += b1[0x1D];
-  out1[0x10* 1] = b1[0x11] + b1[0x19];
-  out1[0x10* 3] = b1[0x19] + b1[0x15];
-  b1[0x1D] += b1[0x1B];
-  out1[0x10* 5] = b1[0x15] + b1[0x1D];
-  out1[0x10* 7] = b1[0x1D] + b1[0x13];
-  b1[0x1B] += b1[0x1F];
-  out1[0x10* 9] = b1[0x13] + b1[0x1B];
-  out1[0x10*11] = b1[0x1B] + b1[0x17];
-  out1[0x10*13] = b1[0x17] + b1[0x1F];
-  out1[0x10*15] = b1[0x1F];
-}
diff --git a/mplayer/mp3lib/dct64_i386.c b/mplayer/mp3lib/dct64_i386.c
deleted file mode 100644
index 6d8e283..0000000
--- a/mplayer/mp3lib/dct64_i386.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
- * Discrete Cosine Tansform (DCT) for subband synthesis
- * optimized for machines with no auto-increment.
- * The performance is highly compiler dependend. Maybe
- * the mpg123_dct64.c version for 'normal' processor may be faster
- * even for Intel processors.
- */
-
-#include "mpg123.h"
-
-static void mpg123_dct64_1(real * out0, real * out1, real * b1, real * b2, real * samples)
-{
-
-        {
-                register real *costab = mp3lib_pnts[0];
-
-                b1[0x00] = samples[0x00] + samples[0x1F];
-                b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0];
-
-                b1[0x01] = samples[0x01] + samples[0x1E];
-                b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1];
-
-                b1[0x02] = samples[0x02] + samples[0x1D];
-                b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2];
-
-                b1[0x03] = samples[0x03] + samples[0x1C];
-                b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3];
-
-                b1[0x04] = samples[0x04] + samples[0x1B];
-                b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4];
-
-                b1[0x05] = samples[0x05] + samples[0x1A];
-                b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5];
-
-                b1[0x06] = samples[0x06] + samples[0x19];
-                b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6];
-
-                b1[0x07] = samples[0x07] + samples[0x18];
-                b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7];
-
-                b1[0x08] = samples[0x08] + samples[0x17];
-                b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8];
-
-                b1[0x09] = samples[0x09] + samples[0x16];
-                b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9];
-
-                b1[0x0A] = samples[0x0A] + samples[0x15];
-                b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA];
-
-                b1[0x0B] = samples[0x0B] + samples[0x14];
-                b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB];
-
-                b1[0x0C] = samples[0x0C] + samples[0x13];
-                b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC];
-
-                b1[0x0D] = samples[0x0D] + samples[0x12];
-                b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD];
-
-                b1[0x0E] = samples[0x0E] + samples[0x11];
-                b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE];
-
-                b1[0x0F] = samples[0x0F] + samples[0x10];
-                b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF];
-        }
-
-        {
-                register real *costab = mp3lib_pnts[1];
-
-                b2[0x00] = b1[0x00] + b1[0x0F];
-                b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0];
-                b2[0x01] = b1[0x01] + b1[0x0E];
-                b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1];
-                b2[0x02] = b1[0x02] + b1[0x0D];
-                b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2];
-                b2[0x03] = b1[0x03] + b1[0x0C];
-                b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3];
-                b2[0x04] = b1[0x04] + b1[0x0B];
-                b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4];
-                b2[0x05] = b1[0x05] + b1[0x0A];
-                b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5];
-                b2[0x06] = b1[0x06] + b1[0x09];
-                b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6];
-                b2[0x07] = b1[0x07] + b1[0x08];
-                b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7];
-
-                b2[0x10] = b1[0x10] + b1[0x1F];
-                b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0];
-                b2[0x11] = b1[0x11] + b1[0x1E];
-                b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1];
-                b2[0x12] = b1[0x12] + b1[0x1D];
-                b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2];
-                b2[0x13] = b1[0x13] + b1[0x1C];
-                b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3];
-                b2[0x14] = b1[0x14] + b1[0x1B];
-                b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4];
-                b2[0x15] = b1[0x15] + b1[0x1A];
-                b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5];
-                b2[0x16] = b1[0x16] + b1[0x19];
-                b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6];
-                b2[0x17] = b1[0x17] + b1[0x18];
-                b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7];
-        }
-
-        {
-                register real *costab = mp3lib_pnts[2];
-
-                b1[0x00] = b2[0x00] + b2[0x07];
-                b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0];
-                b1[0x01] = b2[0x01] + b2[0x06];
-                b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1];
-                b1[0x02] = b2[0x02] + b2[0x05];
-                b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2];
-                b1[0x03] = b2[0x03] + b2[0x04];
-                b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3];
-
-                b1[0x08] = b2[0x08] + b2[0x0F];
-                b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0];
-                b1[0x09] = b2[0x09] + b2[0x0E];
-                b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1];
-                b1[0x0A] = b2[0x0A] + b2[0x0D];
-                b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2];
-                b1[0x0B] = b2[0x0B] + b2[0x0C];
-                b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3];
-
-                b1[0x10] = b2[0x10] + b2[0x17];
-                b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0];
-                b1[0x11] = b2[0x11] + b2[0x16];
-                b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1];
-                b1[0x12] = b2[0x12] + b2[0x15];
-                b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2];
-                b1[0x13] = b2[0x13] + b2[0x14];
-                b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3];
-
-                b1[0x18] = b2[0x18] + b2[0x1F];
-                b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0];
-                b1[0x19] = b2[0x19] + b2[0x1E];
-                b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1];
-                b1[0x1A] = b2[0x1A] + b2[0x1D];
-                b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2];
-                b1[0x1B] = b2[0x1B] + b2[0x1C];
-                b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3];
-        }
-
-        {
-                register real const cos0 = mp3lib_pnts[3][0];
-                register real const cos1 = mp3lib_pnts[3][1];
-
-                b2[0x00] = b1[0x00] + b1[0x03];
-                b2[0x03] = (b1[0x00] - b1[0x03]) * cos0;
-                b2[0x01] = b1[0x01] + b1[0x02];
-                b2[0x02] = (b1[0x01] - b1[0x02]) * cos1;
-
-                b2[0x04] = b1[0x04] + b1[0x07];
-                b2[0x07] = (b1[0x07] - b1[0x04]) * cos0;
-                b2[0x05] = b1[0x05] + b1[0x06];
-                b2[0x06] = (b1[0x06] - b1[0x05]) * cos1;
-
-                b2[0x08] = b1[0x08] + b1[0x0B];
-                b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0;
-                b2[0x09] = b1[0x09] + b1[0x0A];
-                b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1;
-
-                b2[0x0C] = b1[0x0C] + b1[0x0F];
-                b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0;
-                b2[0x0D] = b1[0x0D] + b1[0x0E];
-                b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1;
-
-                b2[0x10] = b1[0x10] + b1[0x13];
-                b2[0x13] = (b1[0x10] - b1[0x13]) * cos0;
-                b2[0x11] = b1[0x11] + b1[0x12];
-                b2[0x12] = (b1[0x11] - b1[0x12]) * cos1;
-
-                b2[0x14] = b1[0x14] + b1[0x17];
-                b2[0x17] = (b1[0x17] - b1[0x14]) * cos0;
-                b2[0x15] = b1[0x15] + b1[0x16];
-                b2[0x16] = (b1[0x16] - b1[0x15]) * cos1;
-
-                b2[0x18] = b1[0x18] + b1[0x1B];
-                b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0;
-                b2[0x19] = b1[0x19] + b1[0x1A];
-                b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1;
-
-                b2[0x1C] = b1[0x1C] + b1[0x1F];
-                b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0;
-                b2[0x1D] = b1[0x1D] + b1[0x1E];
-                b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1;
-        }
-
-        {
-                register real const cos0 = mp3lib_pnts[4][0];
-
-                b1[0x00] = b2[0x00] + b2[0x01];
-                b1[0x01] = (b2[0x00] - b2[0x01]) * cos0;
-                b1[0x02] = b2[0x02] + b2[0x03];
-                b1[0x03] = (b2[0x03] - b2[0x02]) * cos0;
-                b1[0x02] += b1[0x03];
-
-                b1[0x04] = b2[0x04] + b2[0x05];
-                b1[0x05] = (b2[0x04] - b2[0x05]) * cos0;
-                b1[0x06] = b2[0x06] + b2[0x07];
-                b1[0x07] = (b2[0x07] - b2[0x06]) * cos0;
-                b1[0x06] += b1[0x07];
-                b1[0x04] += b1[0x06];
-                b1[0x06] += b1[0x05];
-                b1[0x05] += b1[0x07];
-
-                b1[0x08] = b2[0x08] + b2[0x09];
-                b1[0x09] = (b2[0x08] - b2[0x09]) * cos0;
-                b1[0x0A] = b2[0x0A] + b2[0x0B];
-                b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0;
-                b1[0x0A] += b1[0x0B];
-
-                b1[0x0C] = b2[0x0C] + b2[0x0D];
-                b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0;
-                b1[0x0E] = b2[0x0E] + b2[0x0F];
-                b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0;
-                b1[0x0E] += b1[0x0F];
-                b1[0x0C] += b1[0x0E];
-                b1[0x0E] += b1[0x0D];
-                b1[0x0D] += b1[0x0F];
-
-                b1[0x10] = b2[0x10] + b2[0x11];
-                b1[0x11] = (b2[0x10] - b2[0x11]) * cos0;
-                b1[0x12] = b2[0x12] + b2[0x13];
-                b1[0x13] = (b2[0x13] - b2[0x12]) * cos0;
-                b1[0x12] += b1[0x13];
-
-                b1[0x14] = b2[0x14] + b2[0x15];
-                b1[0x15] = (b2[0x14] - b2[0x15]) * cos0;
-                b1[0x16] = b2[0x16] + b2[0x17];
-                b1[0x17] = (b2[0x17] - b2[0x16]) * cos0;
-                b1[0x16] += b1[0x17];
-                b1[0x14] += b1[0x16];
-                b1[0x16] += b1[0x15];
-                b1[0x15] += b1[0x17];
-
-                b1[0x18] = b2[0x18] + b2[0x19];
-                b1[0x19] = (b2[0x18] - b2[0x19]) * cos0;
-                b1[0x1A] = b2[0x1A] + b2[0x1B];
-                b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0;
-                b1[0x1A] += b1[0x1B];
-
-                b1[0x1C] = b2[0x1C] + b2[0x1D];
-                b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0;
-                b1[0x1E] = b2[0x1E] + b2[0x1F];
-                b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0;
-                b1[0x1E] += b1[0x1F];
-                b1[0x1C] += b1[0x1E];
-                b1[0x1E] += b1[0x1D];
-                b1[0x1D] += b1[0x1F];
-        }
-
-        out0[0x10 * 16] = b1[0x00];
-        out0[0x10 * 12] = b1[0x04];
-        out0[0x10 * 8] = b1[0x02];
-        out0[0x10 * 4] = b1[0x06];
-        out0[0x10 * 0] = b1[0x01];
-        out1[0x10 * 0] = b1[0x01];
-        out1[0x10 * 4] = b1[0x05];
-        out1[0x10 * 8] = b1[0x03];
-        out1[0x10 * 12] = b1[0x07];
-
-        b1[0x08] += b1[0x0C];
-        out0[0x10 * 14] = b1[0x08];
-        b1[0x0C] += b1[0x0a];
-        out0[0x10 * 10] = b1[0x0C];
-        b1[0x0A] += b1[0x0E];
-        out0[0x10 * 6] = b1[0x0A];
-        b1[0x0E] += b1[0x09];
-        out0[0x10 * 2] = b1[0x0E];
-        b1[0x09] += b1[0x0D];
-        out1[0x10 * 2] = b1[0x09];
-        b1[0x0D] += b1[0x0B];
-        out1[0x10 * 6] = b1[0x0D];
-        b1[0x0B] += b1[0x0F];
-        out1[0x10 * 10] = b1[0x0B];
-        out1[0x10 * 14] = b1[0x0F];
-
-        b1[0x18] += b1[0x1C];
-        out0[0x10 * 15] = b1[0x10] + b1[0x18];
-        out0[0x10 * 13] = b1[0x18] + b1[0x14];
-        b1[0x1C] += b1[0x1a];
-        out0[0x10 * 11] = b1[0x14] + b1[0x1C];
-        out0[0x10 * 9] = b1[0x1C] + b1[0x12];
-        b1[0x1A] += b1[0x1E];
-        out0[0x10 * 7] = b1[0x12] + b1[0x1A];
-        out0[0x10 * 5] = b1[0x1A] + b1[0x16];
-        b1[0x1E] += b1[0x19];
-        out0[0x10 * 3] = b1[0x16] + b1[0x1E];
-        out0[0x10 * 1] = b1[0x1E] + b1[0x11];
-        b1[0x19] += b1[0x1D];
-        out1[0x10 * 1] = b1[0x11] + b1[0x19];
-        out1[0x10 * 3] = b1[0x19] + b1[0x15];
-        b1[0x1D] += b1[0x1B];
-        out1[0x10 * 5] = b1[0x15] + b1[0x1D];
-        out1[0x10 * 7] = b1[0x1D] + b1[0x13];
-        b1[0x1B] += b1[0x1F];
-        out1[0x10 * 9] = b1[0x13] + b1[0x1B];
-        out1[0x10 * 11] = b1[0x1B] + b1[0x17];
-        out1[0x10 * 13] = b1[0x17] + b1[0x1F];
-        out1[0x10 * 15] = b1[0x1F];
-}
-
-/*
- * the call via mpg123_dct64 is a trick to force GCC to use
- * (new) registers for the b1,b2 pointer to the bufs[xx] field
- */
-void mpg123_dct64(real * a, real * b, real * c)
-{
-        real bufs[0x40];
-
-        mpg123_dct64_1(a, b, bufs, bufs + 0x20, c);
-}
diff --git a/mplayer/mp3lib/dct64_k7.c b/mplayer/mp3lib/dct64_k7.c
deleted file mode 100644
index 3e55c0d..0000000
--- a/mplayer/mp3lib/dct64_k7.c
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
-* This code was taken from http://www.mpg123.org
-* See ChangeLog of mpg123-0.59s-pre.1 for detail
-* Applied to mplayer by Nick Kurshev <nickols_k at mail.ru>
-* Partial 3dnowex-DSP! optimization by Nick Kurshev
-*
-* TODO: optimize scalar 3dnow! code
-* Warning: Phases 7 & 8 are not tested
-*/
-
-#include "config.h"
-#include "mangle.h"
-#include "mpg123.h"
-#include "ffmpeg_files/x86_cpu.h"
-
-static unsigned long long int attribute_used __attribute__((aligned(8))) x_plus_minus_3dnow = 0x8000000000000000ULL;
-static float attribute_used plus_1f = 1.0;
-
-void dct64_MMX_3dnowex(short *a,short *b,real *c)
-{
-  char tmp[256];
-    __asm__ volatile(
-"       mov %2,%%"REG_a"\n\t"
-
-"       lea 128+%3,%%"REG_d"\n\t"
-"       mov %0,%%"REG_S"\n\t"
-"       mov %1,%%"REG_D"\n\t"
-"       mov $"MANGLE(costab_mmx)",%%"REG_b"\n\t"
-"       lea %3,%%"REG_c"\n\t"
-
-/* Phase 1*/
-"       movq    (%%"REG_a"), %%mm0\n\t"
-"       movq    8(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  120(%%"REG_a"), %%mm1\n\t"
-"       pswapd  112(%%"REG_a"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_d")\n\t"
-"       movq    %%mm4, 8(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   (%%"REG_b"), %%mm3\n\t"
-"       pfmul   8(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 120(%%"REG_d")\n\t"
-"       movq    %%mm7, 112(%%"REG_d")\n\t"
-
-"       movq    16(%%"REG_a"), %%mm0\n\t"
-"       movq    24(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  104(%%"REG_a"), %%mm1\n\t"
-"       pswapd  96(%%"REG_a"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 16(%%"REG_d")\n\t"
-"       movq    %%mm4, 24(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   16(%%"REG_b"), %%mm3\n\t"
-"       pfmul   24(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 104(%%"REG_d")\n\t"
-"       movq    %%mm7, 96(%%"REG_d")\n\t"
-
-"       movq    32(%%"REG_a"), %%mm0\n\t"
-"       movq    40(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  88(%%"REG_a"), %%mm1\n\t"
-"       pswapd  80(%%"REG_a"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 32(%%"REG_d")\n\t"
-"       movq    %%mm4, 40(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   32(%%"REG_b"), %%mm3\n\t"
-"       pfmul   40(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 88(%%"REG_d")\n\t"
-"       movq    %%mm7, 80(%%"REG_d")\n\t"
-
-"       movq    48(%%"REG_a"), %%mm0\n\t"
-"       movq    56(%%"REG_a"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  72(%%"REG_a"), %%mm1\n\t"
-"       pswapd  64(%%"REG_a"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 48(%%"REG_d")\n\t"
-"       movq    %%mm4, 56(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   48(%%"REG_b"), %%mm3\n\t"
-"       pfmul   56(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 72(%%"REG_d")\n\t"
-"       movq    %%mm7, 64(%%"REG_d")\n\t"
-
-/* Phase 2*/
-
-"       movq    (%%"REG_d"), %%mm0\n\t"
-"       movq    8(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  56(%%"REG_d"), %%mm1\n\t"
-"       pswapd  48(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_c")\n\t"
-"       movq    %%mm4, 8(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   64(%%"REG_b"), %%mm3\n\t"
-"       pfmul   72(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 56(%%"REG_c")\n\t"
-"       movq    %%mm7, 48(%%"REG_c")\n\t"
-
-"       movq    16(%%"REG_d"), %%mm0\n\t"
-"       movq    24(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  40(%%"REG_d"), %%mm1\n\t"
-"       pswapd  32(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 16(%%"REG_c")\n\t"
-"       movq    %%mm4, 24(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   80(%%"REG_b"), %%mm3\n\t"
-"       pfmul   88(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 40(%%"REG_c")\n\t"
-"       movq    %%mm7, 32(%%"REG_c")\n\t"
-
-/* Phase 3*/
-
-"       movq    64(%%"REG_d"), %%mm0\n\t"
-"       movq    72(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  120(%%"REG_d"), %%mm1\n\t"
-"       pswapd  112(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 64(%%"REG_c")\n\t"
-"       movq    %%mm4, 72(%%"REG_c")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   64(%%"REG_b"), %%mm3\n\t"
-"       pfmul   72(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 120(%%"REG_c")\n\t"
-"       movq    %%mm7, 112(%%"REG_c")\n\t"
-
-"       movq    80(%%"REG_d"), %%mm0\n\t"
-"       movq    88(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  104(%%"REG_d"), %%mm1\n\t"
-"       pswapd  96(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 80(%%"REG_c")\n\t"
-"       movq    %%mm4, 88(%%"REG_c")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   80(%%"REG_b"), %%mm3\n\t"
-"       pfmul   88(%%"REG_b"), %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 104(%%"REG_c")\n\t"
-"       movq    %%mm7, 96(%%"REG_c")\n\t"
-
-/* Phase 4*/
-
-"       movq    96(%%"REG_b"), %%mm2\n\t"
-"       movq    104(%%"REG_b"), %%mm6\n\t"
-
-"       movq    (%%"REG_c"), %%mm0\n\t"
-"       movq    8(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  24(%%"REG_c"), %%mm1\n\t"
-"       pswapd  16(%%"REG_c"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_d")\n\t"
-"       movq    %%mm4, 8(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm6, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 24(%%"REG_d")\n\t"
-"       movq    %%mm7, 16(%%"REG_d")\n\t"
-
-"       movq    32(%%"REG_c"), %%mm0\n\t"
-"       movq    40(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  56(%%"REG_c"), %%mm1\n\t"
-"       pswapd  48(%%"REG_c"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 32(%%"REG_d")\n\t"
-"       movq    %%mm4, 40(%%"REG_d")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm6, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 56(%%"REG_d")\n\t"
-"       movq    %%mm7, 48(%%"REG_d")\n\t"
-
-"       movq    64(%%"REG_c"), %%mm0\n\t"
-"       movq    72(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  88(%%"REG_c"), %%mm1\n\t"
-"       pswapd  80(%%"REG_c"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 64(%%"REG_d")\n\t"
-"       movq    %%mm4, 72(%%"REG_d")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsub   %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm6, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 88(%%"REG_d")\n\t"
-"       movq    %%mm7, 80(%%"REG_d")\n\t"
-
-"       movq    96(%%"REG_c"), %%mm0\n\t"
-"       movq    104(%%"REG_c"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  120(%%"REG_c"), %%mm1\n\t"
-"       pswapd  112(%%"REG_c"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 96(%%"REG_d")\n\t"
-"       movq    %%mm4, 104(%%"REG_d")\n\t"
-"       pfsubr  %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm6, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 120(%%"REG_d")\n\t"
-"       movq    %%mm7, 112(%%"REG_d")\n\t"
-
-/* Phase 5 */
-
-"       movq    112(%%"REG_b"), %%mm2\n\t"
-
-"       movq    (%%"REG_d"), %%mm0\n\t"
-"       movq    16(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  8(%%"REG_d"), %%mm1\n\t"
-"       pswapd  24(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, (%%"REG_c")\n\t"
-"       movq    %%mm4, 16(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm2, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 8(%%"REG_c")\n\t"
-"       movq    %%mm7, 24(%%"REG_c")\n\t"
-
-"       movq    32(%%"REG_d"), %%mm0\n\t"
-"       movq    48(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  40(%%"REG_d"), %%mm1\n\t"
-"       pswapd  56(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 32(%%"REG_c")\n\t"
-"       movq    %%mm4, 48(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm2, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 40(%%"REG_c")\n\t"
-"       movq    %%mm7, 56(%%"REG_c")\n\t"
-
-"       movq    64(%%"REG_d"), %%mm0\n\t"
-"       movq    80(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  72(%%"REG_d"), %%mm1\n\t"
-"       pswapd  88(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 64(%%"REG_c")\n\t"
-"       movq    %%mm4, 80(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm2, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 72(%%"REG_c")\n\t"
-"       movq    %%mm7, 88(%%"REG_c")\n\t"
-
-"       movq    96(%%"REG_d"), %%mm0\n\t"
-"       movq    112(%%"REG_d"), %%mm4\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-"       movq    %%mm4, %%mm7\n\t"
-"       pswapd  104(%%"REG_d"), %%mm1\n\t"
-"       pswapd  120(%%"REG_d"), %%mm5\n\t"
-"       pfadd   %%mm1, %%mm0\n\t"
-"       pfadd   %%mm5, %%mm4\n\t"
-"       movq    %%mm0, 96(%%"REG_c")\n\t"
-"       movq    %%mm4, 112(%%"REG_c")\n\t"
-"       pfsub   %%mm1, %%mm3\n\t"
-"       pfsubr  %%mm5, %%mm7\n\t"
-"       pfmul   %%mm2, %%mm3\n\t"
-"       pfmul   %%mm2, %%mm7\n\t"
-"       pswapd  %%mm3, %%mm3\n\t"
-"       pswapd  %%mm7, %%mm7\n\t"
-"       movq    %%mm3, 104(%%"REG_c")\n\t"
-"       movq    %%mm7, 120(%%"REG_c")\n\t"
-
-
-/* Phase 6. This is the end of easy road. */
-/* Code below is coded in scalar mode. Should be optimized */
-
-"       movd    "MANGLE(plus_1f)", %%mm6\n\t"
-"       punpckldq 120(%%"REG_b"), %%mm6\n\t"      /* mm6 = 1.0 | 120(%%"REG_b")*/
-"       movq    "MANGLE(x_plus_minus_3dnow)", %%mm7\n\t" /* mm7 = +1 | -1 */
-
-"       movq    32(%%"REG_c"), %%mm0\n\t"
-"       movq    64(%%"REG_c"), %%mm2\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       movq    %%mm2, %%mm3\n\t"
-"       pxor    %%mm7, %%mm1\n\t"
-"       pxor    %%mm7, %%mm3\n\t"
-"       pfacc   %%mm1, %%mm0\n\t"
-"       pfacc   %%mm3, %%mm2\n\t"
-"       pfmul   %%mm6, %%mm0\n\t"
-"       pfmul   %%mm6, %%mm2\n\t"
-"       movq    %%mm0, 32(%%"REG_d")\n\t"
-"       movq    %%mm2, 64(%%"REG_d")\n\t"
-
-"       movd    44(%%"REG_c"), %%mm0\n\t"
-"       movd    40(%%"REG_c"), %%mm2\n\t"
-"       movd    120(%%"REG_b"), %%mm3\n\t"
-"       punpckldq 76(%%"REG_c"), %%mm0\n\t"
-"       punpckldq 72(%%"REG_c"), %%mm2\n\t"
-"       punpckldq %%mm3, %%mm3\n\t"
-"       movq    %%mm0, %%mm4\n\t"
-"       movq    %%mm2, %%mm5\n\t"
-"       pfsub   %%mm2, %%mm0\n\t"
-"       pfmul   %%mm3, %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       pfadd   %%mm5, %%mm0\n\t"
-"       pfadd   %%mm4, %%mm0\n\t"
-"       movq    %%mm0, %%mm2\n\t"
-"       punpckldq %%mm1, %%mm0\n\t"
-"       punpckhdq %%mm1, %%mm2\n\t"
-"       movq    %%mm0, 40(%%"REG_d")\n\t"
-"       movq    %%mm2, 72(%%"REG_d")\n\t"
-
-"       movd   48(%%"REG_c"), %%mm3\n\t"
-"       movd   60(%%"REG_c"), %%mm2\n\t"
-"       pfsub  52(%%"REG_c"), %%mm3\n\t"
-"       pfsub  56(%%"REG_c"), %%mm2\n\t"
-"       pfmul 120(%%"REG_b"), %%mm3\n\t"
-"       pfmul 120(%%"REG_b"), %%mm2\n\t"
-"       movq    %%mm2, %%mm1\n\t"
-
-"       pfadd  56(%%"REG_c"), %%mm1\n\t"
-"       pfadd  60(%%"REG_c"), %%mm1\n\t"
-"       movq    %%mm1, %%mm0\n\t"
-
-"       pfadd  48(%%"REG_c"), %%mm0\n\t"
-"       pfadd  52(%%"REG_c"), %%mm0\n\t"
-"       pfadd   %%mm3, %%mm1\n\t"
-"       punpckldq %%mm2, %%mm1\n\t"
-"       pfadd   %%mm3, %%mm2\n\t"
-"       punpckldq %%mm2, %%mm0\n\t"
-"       movq    %%mm1, 56(%%"REG_d")\n\t"
-"       movq    %%mm0, 48(%%"REG_d")\n\t"
-
-/*---*/
-
-"       movd   92(%%"REG_c"), %%mm1\n\t"
-"       pfsub  88(%%"REG_c"), %%mm1\n\t"
-"       pfmul 120(%%"REG_b"), %%mm1\n\t"
-"       movd   %%mm1, 92(%%"REG_d")\n\t"
-"       pfadd  92(%%"REG_c"), %%mm1\n\t"
-"       pfadd  88(%%"REG_c"), %%mm1\n\t"
-"       movq   %%mm1, %%mm0\n\t"
-
-"       pfadd  80(%%"REG_c"), %%mm0\n\t"
-"       pfadd  84(%%"REG_c"), %%mm0\n\t"
-"       movd   %%mm0, 80(%%"REG_d")\n\t"
-
-"       movd   80(%%"REG_c"), %%mm0\n\t"
-"       pfsub  84(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       pfadd  %%mm0, %%mm1\n\t"
-"       pfadd  92(%%"REG_d"), %%mm0\n\t"
-"       punpckldq %%mm1, %%mm0\n\t"
-"       movq   %%mm0, 84(%%"REG_d")\n\t"
-
-"       movq    96(%%"REG_c"), %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       pxor    %%mm7, %%mm1\n\t"
-"       pfacc   %%mm1, %%mm0\n\t"
-"       pfmul   %%mm6, %%mm0\n\t"
-"       movq    %%mm0, 96(%%"REG_d")\n\t"
-
-"       movd  108(%%"REG_c"), %%mm0\n\t"
-"       pfsub 104(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movd  %%mm0, 108(%%"REG_d")\n\t"
-"       pfadd 104(%%"REG_c"), %%mm0\n\t"
-"       pfadd 108(%%"REG_c"), %%mm0\n\t"
-"       movd  %%mm0, 104(%%"REG_d")\n\t"
-
-"       movd  124(%%"REG_c"), %%mm1\n\t"
-"       pfsub 120(%%"REG_c"), %%mm1\n\t"
-"       pfmul 120(%%"REG_b"), %%mm1\n\t"
-"       movd  %%mm1, 124(%%"REG_d")\n\t"
-"       pfadd 120(%%"REG_c"), %%mm1\n\t"
-"       pfadd 124(%%"REG_c"), %%mm1\n\t"
-"       movq  %%mm1, %%mm0\n\t"
-
-"       pfadd 112(%%"REG_c"), %%mm0\n\t"
-"       pfadd 116(%%"REG_c"), %%mm0\n\t"
-"       movd  %%mm0, 112(%%"REG_d")\n\t"
-
-"       movd  112(%%"REG_c"), %%mm0\n\t"
-"       pfsub 116(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       pfadd %%mm0,%%mm1\n\t"
-"       pfadd 124(%%"REG_d"), %%mm0\n\t"
-"       punpckldq %%mm1, %%mm0\n\t"
-"       movq  %%mm0, 116(%%"REG_d")\n\t"
-
-// this code is broken, there is nothing modifying the z flag above.
-#if 0
-"       jnz .L01\n\t"
-
-/* Phase 7*/
-/* Code below is coded in scalar mode. Should be optimized */
-
-"       movd      (%%"REG_c"), %%mm0\n\t"
-"       pfadd    4(%%"REG_c"), %%mm0\n\t"
-"       movd     %%mm0, 1024(%%"REG_S")\n\t"
-
-"       movd      (%%"REG_c"), %%mm0\n\t"
-"       pfsub    4(%%"REG_c"), %%mm0\n\t"
-"       pfmul  120(%%"REG_b"), %%mm0\n\t"
-"       movd      %%mm0, (%%"REG_S")\n\t"
-"       movd      %%mm0, (%%"REG_D")\n\t"
-
-"       movd   12(%%"REG_c"), %%mm0\n\t"
-"       pfsub   8(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movd    %%mm0, 512(%%"REG_D")\n\t"
-"       pfadd   12(%%"REG_c"), %%mm0\n\t"
-"       pfadd   8(%%"REG_c"), %%mm0\n\t"
-"       movd    %%mm0, 512(%%"REG_S")\n\t"
-
-"       movd   16(%%"REG_c"), %%mm0\n\t"
-"       pfsub  20(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movq    %%mm0, %%mm3\n\t"
-
-"       movd   28(%%"REG_c"), %%mm0\n\t"
-"       pfsub  24(%%"REG_c"), %%mm0\n\t"
-"       pfmul 120(%%"REG_b"), %%mm0\n\t"
-"       movd    %%mm0, 768(%%"REG_D")\n\t"
-"       movq    %%mm0, %%mm2\n\t"
-
-"       pfadd  24(%%"REG_c"), %%mm0\n\t"
-"       pfadd  28(%%"REG_c"), %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-
-"       pfadd  16(%%"REG_c"), %%mm0\n\t"
-"       pfadd  20(%%"REG_c"), %%mm0\n\t"
-"       movd   %%mm0, 768(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm1\n\t"
-"       movd   %%mm1, 256(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm2\n\t"
-"       movd   %%mm2, 256(%%"REG_D")\n\t"
-
-/* Phase 8*/
-
-"       movq   32(%%"REG_d"), %%mm0\n\t"
-"       movq   48(%%"REG_d"), %%mm1\n\t"
-"       pfadd  48(%%"REG_d"), %%mm0\n\t"
-"       pfadd  40(%%"REG_d"), %%mm1\n\t"
-"       movd   %%mm0, 896(%%"REG_S")\n\t"
-"       movd   %%mm1, 640(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm0\n\t"
-"       psrlq  $32, %%mm1\n\t"
-"       movd   %%mm0, 128(%%"REG_D")\n\t"
-"       movd   %%mm1, 384(%%"REG_D")\n\t"
-
-"       movd   40(%%"REG_d"), %%mm0\n\t"
-"       pfadd  56(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 384(%%"REG_S")\n\t"
-
-"       movd   56(%%"REG_d"), %%mm0\n\t"
-"       pfadd  36(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 128(%%"REG_S")\n\t"
-
-"       movd   60(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 896(%%"REG_D")\n\t"
-"       pfadd  44(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 640(%%"REG_D")\n\t"
-
-"       movq   96(%%"REG_d"), %%mm0\n\t"
-"       movq   112(%%"REG_d"), %%mm2\n\t"
-"       movq   104(%%"REG_d"), %%mm4\n\t"
-"       pfadd  112(%%"REG_d"), %%mm0\n\t"
-"       pfadd  104(%%"REG_d"), %%mm2\n\t"
-"       pfadd  120(%%"REG_d"), %%mm4\n\t"
-"       movq   %%mm0, %%mm1\n\t"
-"       movq   %%mm2, %%mm3\n\t"
-"       movq   %%mm4, %%mm5\n\t"
-"       pfadd  64(%%"REG_d"), %%mm0\n\t"
-"       pfadd  80(%%"REG_d"), %%mm2\n\t"
-"       pfadd  72(%%"REG_d"), %%mm4\n\t"
-"       movd   %%mm0, 960(%%"REG_S")\n\t"
-"       movd   %%mm2, 704(%%"REG_S")\n\t"
-"       movd   %%mm4, 448(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm0\n\t"
-"       psrlq  $32, %%mm2\n\t"
-"       psrlq  $32, %%mm4\n\t"
-"       movd   %%mm0, 64(%%"REG_D")\n\t"
-"       movd   %%mm2, 320(%%"REG_D")\n\t"
-"       movd   %%mm4, 576(%%"REG_D")\n\t"
-"       pfadd  80(%%"REG_d"), %%mm1\n\t"
-"       pfadd  72(%%"REG_d"), %%mm3\n\t"
-"       pfadd  88(%%"REG_d"), %%mm5\n\t"
-"       movd   %%mm1, 832(%%"REG_S")\n\t"
-"       movd   %%mm3, 576(%%"REG_S")\n\t"
-"       movd   %%mm5, 320(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm1\n\t"
-"       psrlq  $32, %%mm3\n\t"
-"       psrlq  $32, %%mm5\n\t"
-"       movd   %%mm1, 192(%%"REG_D")\n\t"
-"       movd   %%mm3, 448(%%"REG_D")\n\t"
-"       movd   %%mm5, 704(%%"REG_D")\n\t"
-
-"       movd   120(%%"REG_d"), %%mm0\n\t"
-"       pfadd  100(%%"REG_d"), %%mm0\n\t"
-"       movq   %%mm0, %%mm1\n\t"
-"       pfadd  88(%%"REG_d"), %%mm0\n\t"
-"       movd   %%mm0, 192(%%"REG_S")\n\t"
-"       pfadd  68(%%"REG_d"), %%mm1\n\t"
-"       movd   %%mm1, 64(%%"REG_S")\n\t"
-
-"       movd  124(%%"REG_d"), %%mm0\n\t"
-"       movd  %%mm0, 960(%%"REG_D")\n\t"
-"       pfadd  92(%%"REG_d"), %%mm0\n\t"
-"       movd  %%mm0, 832(%%"REG_D")\n\t"
-
-"       jmp     .L_bye\n\t"
-".L01:  \n\t"
-#endif
-/* Phase 9*/
-
-"       movq    (%%"REG_c"), %%mm0\n\t"
-"       movq    %%mm0, %%mm1\n\t"
-"       pxor    %%mm7, %%mm1\n\t"
-"       pfacc   %%mm1, %%mm0\n\t"
-"       pfmul   %%mm6, %%mm0\n\t"
-"       pf2iw   %%mm0, %%mm0\n\t"
-"       movd    %%mm0, %%"REG_a"\n\t"
-"       movw    %%ax, 512(%%"REG_S")\n\t"
-"       psrlq   $32, %%mm0\n\t"
-"       movd    %%mm0, %%"REG_a"\n\t"
-"       movw    %%ax, (%%"REG_S")\n\t"
-
-"       movd    12(%%"REG_c"), %%mm0\n\t"
-"       pfsub    8(%%"REG_c"), %%mm0\n\t"
-"       pfmul  120(%%"REG_b"), %%mm0\n\t"
-"       pf2iw    %%mm0, %%mm7\n\t"
-"       movd     %%mm7, %%"REG_a"\n\t"
-"       movw     %%ax, 256(%%"REG_D")\n\t"
-"       pfadd   12(%%"REG_c"), %%mm0\n\t"
-"       pfadd    8(%%"REG_c"), %%mm0\n\t"
-"       pf2iw    %%mm0, %%mm0\n\t"
-"       movd     %%mm0, %%"REG_a"\n\t"
-"       movw     %%ax, 256(%%"REG_S")\n\t"
-
-"       movd   16(%%"REG_c"), %%mm3\n\t"
-"       pfsub  20(%%"REG_c"), %%mm3\n\t"
-"       pfmul  120(%%"REG_b"), %%mm3\n\t"
-"       movq   %%mm3, %%mm2\n\t"
-
-"       movd   28(%%"REG_c"), %%mm2\n\t"
-"       pfsub  24(%%"REG_c"), %%mm2\n\t"
-"       pfmul 120(%%"REG_b"), %%mm2\n\t"
-"       movq   %%mm2, %%mm1\n\t"
-
-"       pf2iw  %%mm2, %%mm7\n\t"
-"       movd   %%mm7, %%"REG_a"\n\t"
-"       movw   %%ax, 384(%%"REG_D")\n\t"
-
-"       pfadd  24(%%"REG_c"), %%mm1\n\t"
-"       pfadd  28(%%"REG_c"), %%mm1\n\t"
-"       movq   %%mm1, %%mm0\n\t"
-
-"       pfadd  16(%%"REG_c"), %%mm0\n\t"
-"       pfadd  20(%%"REG_c"), %%mm0\n\t"
-"       pf2iw  %%mm0, %%mm0\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       movw   %%ax, 384(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm1\n\t"
-"       pf2iw  %%mm1, %%mm1\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movw   %%ax, 128(%%"REG_S")\n\t"
-"       pfadd  %%mm3, %%mm2\n\t"
-"       pf2iw  %%mm2, %%mm2\n\t"
-"       movd   %%mm2, %%"REG_a"\n\t"
-"       movw   %%ax, 128(%%"REG_D")\n\t"
-
-/* Phase 10*/
-
-"       movq    32(%%"REG_d"), %%mm0\n\t"
-"       movq    48(%%"REG_d"), %%mm1\n\t"
-"       pfadd   48(%%"REG_d"), %%mm0\n\t"
-"       pfadd   40(%%"REG_d"), %%mm1\n\t"
-"       pf2iw   %%mm0, %%mm0\n\t"
-"       pf2iw   %%mm1, %%mm1\n\t"
-"       movd    %%mm0, %%"REG_a"\n\t"
-"       movd    %%mm1, %%"REG_c"\n\t"
-"       movw    %%ax, 448(%%"REG_S")\n\t"
-"       movw    %%cx, 320(%%"REG_S")\n\t"
-"       psrlq   $32, %%mm0\n\t"
-"       psrlq   $32, %%mm1\n\t"
-"       movd    %%mm0, %%"REG_a"\n\t"
-"       movd    %%mm1, %%"REG_c"\n\t"
-"       movw    %%ax, 64(%%"REG_D")\n\t"
-"       movw    %%cx, 192(%%"REG_D")\n\t"
-
-"       movd   40(%%"REG_d"), %%mm3\n\t"
-"       movd   56(%%"REG_d"), %%mm4\n\t"
-"       movd   60(%%"REG_d"), %%mm0\n\t"
-"       movd   44(%%"REG_d"), %%mm2\n\t"
-"       movd  120(%%"REG_d"), %%mm5\n\t"
-"       punpckldq %%mm4, %%mm3\n\t"
-"       punpckldq 124(%%"REG_d"), %%mm0\n\t"
-"       pfadd 100(%%"REG_d"), %%mm5\n\t"
-"       punpckldq 36(%%"REG_d"), %%mm4\n\t"
-"       punpckldq 92(%%"REG_d"), %%mm2\n\t"
-"       movq  %%mm5, %%mm6\n\t"
-"       pfadd  %%mm4, %%mm3\n\t"
-"       pf2iw  %%mm0, %%mm1\n\t"
-"       pf2iw  %%mm3, %%mm3\n\t"
-"       pfadd  88(%%"REG_d"), %%mm5\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movd   %%mm3, %%"REG_c"\n\t"
-"       movw   %%ax, 448(%%"REG_D")\n\t"
-"       movw   %%cx, 192(%%"REG_S")\n\t"
-"       pf2iw  %%mm5, %%mm5\n\t"
-"       psrlq  $32, %%mm1\n\t"
-"       psrlq  $32, %%mm3\n\t"
-"       movd   %%mm5, %%"REG_b"\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movd   %%mm3, %%"REG_c"\n\t"
-"       movw   %%bx, 96(%%"REG_S")\n\t"
-"       movw   %%ax, 480(%%"REG_D")\n\t"
-"       movw   %%cx, 64(%%"REG_S")\n\t"
-"       pfadd  %%mm2, %%mm0\n\t"
-"       pf2iw  %%mm0, %%mm0\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       pfadd  68(%%"REG_d"), %%mm6\n\t"
-"       movw   %%ax, 320(%%"REG_D")\n\t"
-"       psrlq  $32, %%mm0\n\t"
-"       pf2iw  %%mm6, %%mm6\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       movd   %%mm6, %%"REG_b"\n\t"
-"       movw   %%ax, 416(%%"REG_D")\n\t"
-"       movw   %%bx, 32(%%"REG_S")\n\t"
-
-"       movq   96(%%"REG_d"), %%mm0\n\t"
-"       movq  112(%%"REG_d"), %%mm2\n\t"
-"       movq  104(%%"REG_d"), %%mm4\n\t"
-"       pfadd %%mm2, %%mm0\n\t"
-"       pfadd %%mm4, %%mm2\n\t"
-"       pfadd 120(%%"REG_d"), %%mm4\n\t"
-"       movq  %%mm0, %%mm1\n\t"
-"       movq  %%mm2, %%mm3\n\t"
-"       movq  %%mm4, %%mm5\n\t"
-"       pfadd  64(%%"REG_d"), %%mm0\n\t"
-"       pfadd  80(%%"REG_d"), %%mm2\n\t"
-"       pfadd  72(%%"REG_d"), %%mm4\n\t"
-"       pf2iw  %%mm0, %%mm0\n\t"
-"       pf2iw  %%mm2, %%mm2\n\t"
-"       pf2iw  %%mm4, %%mm4\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       movd   %%mm2, %%"REG_c"\n\t"
-"       movd   %%mm4, %%"REG_b"\n\t"
-"       movw   %%ax, 480(%%"REG_S")\n\t"
-"       movw   %%cx, 352(%%"REG_S")\n\t"
-"       movw   %%bx, 224(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm0\n\t"
-"       psrlq  $32, %%mm2\n\t"
-"       psrlq  $32, %%mm4\n\t"
-"       movd   %%mm0, %%"REG_a"\n\t"
-"       movd   %%mm2, %%"REG_c"\n\t"
-"       movd   %%mm4, %%"REG_b"\n\t"
-"       movw   %%ax, 32(%%"REG_D")\n\t"
-"       movw   %%cx, 160(%%"REG_D")\n\t"
-"       movw   %%bx, 288(%%"REG_D")\n\t"
-"       pfadd  80(%%"REG_d"), %%mm1\n\t"
-"       pfadd  72(%%"REG_d"), %%mm3\n\t"
-"       pfadd  88(%%"REG_d"), %%mm5\n\t"
-"       pf2iw  %%mm1, %%mm1\n\t"
-"       pf2iw  %%mm3, %%mm3\n\t"
-"       pf2iw  %%mm5, %%mm5\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movd   %%mm3, %%"REG_c"\n\t"
-"       movd   %%mm5, %%"REG_b"\n\t"
-"       movw   %%ax, 416(%%"REG_S")\n\t"
-"       movw   %%cx, 288(%%"REG_S")\n\t"
-"       movw   %%bx, 160(%%"REG_S")\n\t"
-"       psrlq  $32, %%mm1\n\t"
-"       psrlq  $32, %%mm3\n\t"
-"       psrlq  $32, %%mm5\n\t"
-"       movd   %%mm1, %%"REG_a"\n\t"
-"       movd   %%mm3, %%"REG_c"\n\t"
-"       movd   %%mm5, %%"REG_b"\n\t"
-"       movw   %%ax, 96(%%"REG_D")\n\t"
-"       movw   %%cx, 224(%%"REG_D")\n\t"
-"       movw   %%bx, 352(%%"REG_D")\n\t"
-
-"       movsw\n\t"
-
-".L_bye:\n\t"
-"       femms\n\t"
-        :
-        :"m"(a),"m"(b),"m"(c),"m"(tmp[0])
-        :"memory","%eax","%ebx","%ecx","%edx","%esi","%edi");
-}
diff --git a/mplayer/mp3lib/dct64_mmx.c b/mplayer/mp3lib/dct64_mmx.c
deleted file mode 100644
index f70562b..0000000
--- a/mplayer/mp3lib/dct64_mmx.c
+++ /dev/null
@@ -1,987 +0,0 @@
-/*
-* This code was taken from http://www.mpg123.org
-* See ChangeLog of mpg123-0.59s-pre.1 for detail
-* Applied to mplayer by Nick Kurshev <nickols_k at mail.ru>
-*/
-#include "config.h"
-#include "mangle.h"
-#include "mpg123.h"
-#include "ffmpeg_files/x86_cpu.h"
-
-void dct64_MMX(short *a,short *b,real *c)
-{
-    char tmp[256];
-    __asm__ volatile(
-"       mov %2,%%"REG_a"\n\t"
-/* Phase 1*/
-"       flds     (%%"REG_a")\n\t"
-"       lea 128+%3,%%"REG_d"\n\t"
-"       fadds 124(%%"REG_a")\n\t"
-"       mov %0,%%"REG_S"\n\t"
-"       fstps    (%%"REG_d")\n\t"
-"       mov %1,%%"REG_D"\n\t"
-
-"       flds    4(%%"REG_a")\n\t"
-"       mov $"MANGLE(costab_mmx)",%%"REG_b"\n\t"
-"       fadds 120(%%"REG_a")\n\t"
-"       or %%"REG_c",%%"REG_c"\n\t"
-"       fstps   4(%%"REG_d")\n\t"
-
-"       flds     (%%"REG_a")\n\t"
-"       lea %3,%%"REG_c"\n\t"
-"       fsubs 124(%%"REG_a")\n\t"
-"       fmuls    (%%"REG_b")\n\t"
-"       fstps 124(%%"REG_d")\n\t"
-
-"       flds    4(%%"REG_a")\n\t"
-"       fsubs 120(%%"REG_a")\n\t"
-"       fmuls   4(%%"REG_b")\n\t"
-"       fstps 120(%%"REG_d")\n\t"
-
-"       flds    8(%%"REG_a")\n\t"
-"       fadds 116(%%"REG_a")\n\t"
-"       fstps   8(%%"REG_d")\n\t"
-
-"       flds   12(%%"REG_a")\n\t"
-"       fadds 112(%%"REG_a")\n\t"
-"       fstps  12(%%"REG_d")\n\t"
-
-"       flds    8(%%"REG_a")\n\t"
-"       fsubs 116(%%"REG_a")\n\t"
-"       fmuls   8(%%"REG_b")\n\t"
-"       fstps 116(%%"REG_d")\n\t"
-
-"       flds   12(%%"REG_a")\n\t"
-"       fsubs 112(%%"REG_a")\n\t"
-"       fmuls  12(%%"REG_b")\n\t"
-"       fstps 112(%%"REG_d")\n\t"
-
-"       flds   16(%%"REG_a")\n\t"
-"       fadds 108(%%"REG_a")\n\t"
-"       fstps  16(%%"REG_d")\n\t"
-
-"       flds   20(%%"REG_a")\n\t"
-"       fadds 104(%%"REG_a")\n\t"
-"       fstps  20(%%"REG_d")\n\t"
-
-"       flds   16(%%"REG_a")\n\t"
-"       fsubs 108(%%"REG_a")\n\t"
-"       fmuls  16(%%"REG_b")\n\t"
-"       fstps 108(%%"REG_d")\n\t"
-
-"       flds   20(%%"REG_a")\n\t"
-"       fsubs 104(%%"REG_a")\n\t"
-"       fmuls  20(%%"REG_b")\n\t"
-"       fstps 104(%%"REG_d")\n\t"
-
-"       flds   24(%%"REG_a")\n\t"
-"       fadds 100(%%"REG_a")\n\t"
-"       fstps  24(%%"REG_d")\n\t"
-
-"       flds   28(%%"REG_a")\n\t"
-"       fadds  96(%%"REG_a")\n\t"
-"       fstps  28(%%"REG_d")\n\t"
-
-"       flds   24(%%"REG_a")\n\t"
-"       fsubs 100(%%"REG_a")\n\t"
-"       fmuls  24(%%"REG_b")\n\t"
-"       fstps 100(%%"REG_d")\n\t"
-
-"       flds   28(%%"REG_a")\n\t"
-"       fsubs  96(%%"REG_a")\n\t"
-"       fmuls  28(%%"REG_b")\n\t"
-"       fstps  96(%%"REG_d")\n\t"
-
-"       flds   32(%%"REG_a")\n\t"
-"       fadds  92(%%"REG_a")\n\t"
-"       fstps  32(%%"REG_d")\n\t"
-
-"       flds   36(%%"REG_a")\n\t"
-"       fadds  88(%%"REG_a")\n\t"
-"       fstps  36(%%"REG_d")\n\t"
-
-"       flds   32(%%"REG_a")\n\t"
-"       fsubs  92(%%"REG_a")\n\t"
-"       fmuls  32(%%"REG_b")\n\t"
-"       fstps  92(%%"REG_d")\n\t"
-
-"       flds   36(%%"REG_a")\n\t"
-"       fsubs  88(%%"REG_a")\n\t"
-"       fmuls  36(%%"REG_b")\n\t"
-"       fstps  88(%%"REG_d")\n\t"
-
-"       flds   40(%%"REG_a")\n\t"
-"       fadds  84(%%"REG_a")\n\t"
-"       fstps  40(%%"REG_d")\n\t"
-
-"       flds   44(%%"REG_a")\n\t"
-"       fadds  80(%%"REG_a")\n\t"
-"       fstps  44(%%"REG_d")\n\t"
-
-"       flds   40(%%"REG_a")\n\t"
-"       fsubs  84(%%"REG_a")\n\t"
-"       fmuls  40(%%"REG_b")\n\t"
-"       fstps  84(%%"REG_d")\n\t"
-
-"       flds   44(%%"REG_a")\n\t"
-"       fsubs  80(%%"REG_a")\n\t"
-"       fmuls  44(%%"REG_b")\n\t"
-"       fstps  80(%%"REG_d")\n\t"
-
-"       flds   48(%%"REG_a")\n\t"
-"       fadds  76(%%"REG_a")\n\t"
-"       fstps  48(%%"REG_d")\n\t"
-
-"       flds   52(%%"REG_a")\n\t"
-"       fadds  72(%%"REG_a")\n\t"
-"       fstps  52(%%"REG_d")\n\t"
-
-"       flds   48(%%"REG_a")\n\t"
-"       fsubs  76(%%"REG_a")\n\t"
-"       fmuls  48(%%"REG_b")\n\t"
-"       fstps  76(%%"REG_d")\n\t"
-
-"       flds   52(%%"REG_a")\n\t"
-"       fsubs  72(%%"REG_a")\n\t"
-"       fmuls  52(%%"REG_b")\n\t"
-"       fstps  72(%%"REG_d")\n\t"
-
-"       flds   56(%%"REG_a")\n\t"
-"       fadds  68(%%"REG_a")\n\t"
-"       fstps  56(%%"REG_d")\n\t"
-
-"       flds   60(%%"REG_a")\n\t"
-"       fadds  64(%%"REG_a")\n\t"
-"       fstps  60(%%"REG_d")\n\t"
-
-"       flds   56(%%"REG_a")\n\t"
-"       fsubs  68(%%"REG_a")\n\t"
-"       fmuls  56(%%"REG_b")\n\t"
-"       fstps  68(%%"REG_d")\n\t"
-
-"       flds   60(%%"REG_a")\n\t"
-"       fsubs  64(%%"REG_a")\n\t"
-"       fmuls  60(%%"REG_b")\n\t"
-"       fstps  64(%%"REG_d")\n\t"
-
-/* Phase 2*/
-
-"       flds     (%%"REG_d")\n\t"
-"       fadds  60(%%"REG_d")\n\t"
-"       fstps    (%%"REG_c")\n\t"
-
-"       flds    4(%%"REG_d")\n\t"
-"       fadds  56(%%"REG_d")\n\t"
-"       fstps   4(%%"REG_c")\n\t"
-
-"       flds     (%%"REG_d")\n\t"
-"       fsubs  60(%%"REG_d")\n\t"
-"       fmuls  64(%%"REG_b")\n\t"
-"       fstps  60(%%"REG_c")\n\t"
-
-"       flds    4(%%"REG_d")\n\t"
-"       fsubs  56(%%"REG_d")\n\t"
-"       fmuls  68(%%"REG_b")\n\t"
-"       fstps  56(%%"REG_c")\n\t"
-
-"       flds    8(%%"REG_d")\n\t"
-"       fadds  52(%%"REG_d")\n\t"
-"       fstps   8(%%"REG_c")\n\t"
-
-"       flds   12(%%"REG_d")\n\t"
-"       fadds  48(%%"REG_d")\n\t"
-"       fstps  12(%%"REG_c")\n\t"
-
-"       flds    8(%%"REG_d")\n\t"
-"       fsubs  52(%%"REG_d")\n\t"
-"       fmuls  72(%%"REG_b")\n\t"
-"       fstps  52(%%"REG_c")\n\t"
-
-"       flds   12(%%"REG_d")\n\t"
-"       fsubs  48(%%"REG_d")\n\t"
-"       fmuls  76(%%"REG_b")\n\t"
-"       fstps  48(%%"REG_c")\n\t"
-
-"       flds   16(%%"REG_d")\n\t"
-"       fadds  44(%%"REG_d")\n\t"
-"       fstps  16(%%"REG_c")\n\t"
-
-"       flds   20(%%"REG_d")\n\t"
-"       fadds  40(%%"REG_d")\n\t"
-"       fstps  20(%%"REG_c")\n\t"
-
-"       flds   16(%%"REG_d")\n\t"
-"       fsubs  44(%%"REG_d")\n\t"
-"       fmuls  80(%%"REG_b")\n\t"
-"       fstps  44(%%"REG_c")\n\t"
-
-"       flds   20(%%"REG_d")\n\t"
-"       fsubs  40(%%"REG_d")\n\t"
-"       fmuls  84(%%"REG_b")\n\t"
-"       fstps  40(%%"REG_c")\n\t"
-
-"       flds   24(%%"REG_d")\n\t"
-"       fadds  36(%%"REG_d")\n\t"
-"       fstps  24(%%"REG_c")\n\t"
-
-"       flds   28(%%"REG_d")\n\t"
-"       fadds  32(%%"REG_d")\n\t"
-"       fstps  28(%%"REG_c")\n\t"
-
-"       flds   24(%%"REG_d")\n\t"
-"       fsubs  36(%%"REG_d")\n\t"
-"       fmuls  88(%%"REG_b")\n\t"
-"       fstps  36(%%"REG_c")\n\t"
-
-"       flds   28(%%"REG_d")\n\t"
-"       fsubs  32(%%"REG_d")\n\t"
-"       fmuls  92(%%"REG_b")\n\t"
-"       fstps  32(%%"REG_c")\n\t"
-
-/* Phase 3*/
-
-"       flds   64(%%"REG_d")\n\t"
-"       fadds 124(%%"REG_d")\n\t"
-"       fstps  64(%%"REG_c")\n\t"
-
-"       flds   68(%%"REG_d")\n\t"
-"       fadds 120(%%"REG_d")\n\t"
-"       fstps  68(%%"REG_c")\n\t"
-
-"       flds  124(%%"REG_d")\n\t"
-"       fsubs  64(%%"REG_d")\n\t"
-"       fmuls  64(%%"REG_b")\n\t"
-"       fstps 124(%%"REG_c")\n\t"
-
-"       flds  120(%%"REG_d")\n\t"
-"       fsubs  68(%%"REG_d")\n\t"
-"       fmuls  68(%%"REG_b")\n\t"
-"       fstps 120(%%"REG_c")\n\t"
-
-"       flds   72(%%"REG_d")\n\t"
-"       fadds 116(%%"REG_d")\n\t"
-"       fstps  72(%%"REG_c")\n\t"
-
-"       flds   76(%%"REG_d")\n\t"
-"       fadds 112(%%"REG_d")\n\t"
-"       fstps  76(%%"REG_c")\n\t"
-
-"       flds  116(%%"REG_d")\n\t"
-"       fsubs  72(%%"REG_d")\n\t"
-"       fmuls  72(%%"REG_b")\n\t"
-"       fstps 116(%%"REG_c")\n\t"
-
-"       flds  112(%%"REG_d")\n\t"
-"       fsubs  76(%%"REG_d")\n\t"
-"       fmuls  76(%%"REG_b")\n\t"
-"       fstps 112(%%"REG_c")\n\t"
-
-"       flds   80(%%"REG_d")\n\t"
-"       fadds 108(%%"REG_d")\n\t"
-"       fstps  80(%%"REG_c")\n\t"
-
-"       flds   84(%%"REG_d")\n\t"
-"       fadds 104(%%"REG_d")\n\t"
-"       fstps  84(%%"REG_c")\n\t"
-
-"       flds  108(%%"REG_d")\n\t"
-"       fsubs  80(%%"REG_d")\n\t"
-"       fmuls  80(%%"REG_b")\n\t"
-"       fstps 108(%%"REG_c")\n\t"
-
-"       flds  104(%%"REG_d")\n\t"
-"       fsubs  84(%%"REG_d")\n\t"
-"       fmuls  84(%%"REG_b")\n\t"
-"       fstps 104(%%"REG_c")\n\t"
-
-"       flds   88(%%"REG_d")\n\t"
-"       fadds 100(%%"REG_d")\n\t"
-"       fstps  88(%%"REG_c")\n\t"
-
-"       flds   92(%%"REG_d")\n\t"
-"       fadds  96(%%"REG_d")\n\t"
-"       fstps  92(%%"REG_c")\n\t"
-
-"       flds  100(%%"REG_d")\n\t"
-"       fsubs  88(%%"REG_d")\n\t"
-"       fmuls  88(%%"REG_b")\n\t"
-"       fstps 100(%%"REG_c")\n\t"
-
-"       flds   96(%%"REG_d")\n\t"
-"       fsubs  92(%%"REG_d")\n\t"
-"       fmuls  92(%%"REG_b")\n\t"
-"       fstps  96(%%"REG_c")\n\t"
-
-/* Phase 4*/
-
-"       flds     (%%"REG_c")\n\t"
-"       fadds  28(%%"REG_c")\n\t"
-"       fstps    (%%"REG_d")\n\t"
-
-"       flds     (%%"REG_c")\n\t"
-"       fsubs  28(%%"REG_c")\n\t"
-"       fmuls  96(%%"REG_b")\n\t"
-"       fstps  28(%%"REG_d")\n\t"
-
-"       flds    4(%%"REG_c")\n\t"
-"       fadds  24(%%"REG_c")\n\t"
-"       fstps   4(%%"REG_d")\n\t"
-
-"       flds    4(%%"REG_c")\n\t"
-"       fsubs  24(%%"REG_c")\n\t"
-"       fmuls 100(%%"REG_b")\n\t"
-"       fstps  24(%%"REG_d")\n\t"
-
-"       flds    8(%%"REG_c")\n\t"
-"       fadds  20(%%"REG_c")\n\t"
-"       fstps   8(%%"REG_d")\n\t"
-
-"       flds    8(%%"REG_c")\n\t"
-"       fsubs  20(%%"REG_c")\n\t"
-"       fmuls 104(%%"REG_b")\n\t"
-"       fstps  20(%%"REG_d")\n\t"
-
-"       flds   12(%%"REG_c")\n\t"
-"       fadds  16(%%"REG_c")\n\t"
-"       fstps  12(%%"REG_d")\n\t"
-
-"       flds   12(%%"REG_c")\n\t"
-"       fsubs  16(%%"REG_c")\n\t"
-"       fmuls 108(%%"REG_b")\n\t"
-"       fstps  16(%%"REG_d")\n\t"
-
-"       flds   32(%%"REG_c")\n\t"
-"       fadds  60(%%"REG_c")\n\t"
-"       fstps  32(%%"REG_d")\n\t"
-
-"       flds   60(%%"REG_c")\n\t"
-"       fsubs  32(%%"REG_c")\n\t"
-"       fmuls  96(%%"REG_b")\n\t"
-"       fstps  60(%%"REG_d")\n\t"
-
-"       flds   36(%%"REG_c")\n\t"
-"       fadds  56(%%"REG_c")\n\t"
-"       fstps  36(%%"REG_d")\n\t"
-
-"       flds   56(%%"REG_c")\n\t"
-"       fsubs  36(%%"REG_c")\n\t"
-"       fmuls 100(%%"REG_b")\n\t"
-"       fstps  56(%%"REG_d")\n\t"
-
-"       flds   40(%%"REG_c")\n\t"
-"       fadds  52(%%"REG_c")\n\t"
-"       fstps  40(%%"REG_d")\n\t"
-
-"       flds   52(%%"REG_c")\n\t"
-"       fsubs  40(%%"REG_c")\n\t"
-"       fmuls 104(%%"REG_b")\n\t"
-"       fstps  52(%%"REG_d")\n\t"
-
-"       flds   44(%%"REG_c")\n\t"
-"       fadds  48(%%"REG_c")\n\t"
-"       fstps  44(%%"REG_d")\n\t"
-
-"       flds   48(%%"REG_c")\n\t"
-"       fsubs  44(%%"REG_c")\n\t"
-"       fmuls 108(%%"REG_b")\n\t"
-"       fstps  48(%%"REG_d")\n\t"
-
-"       flds   64(%%"REG_c")\n\t"
-"       fadds  92(%%"REG_c")\n\t"
-"       fstps  64(%%"REG_d")\n\t"
-
-"       flds   64(%%"REG_c")\n\t"
-"       fsubs  92(%%"REG_c")\n\t"
-"       fmuls  96(%%"REG_b")\n\t"
-"       fstps  92(%%"REG_d")\n\t"
-
-"       flds   68(%%"REG_c")\n\t"
-"       fadds  88(%%"REG_c")\n\t"
-"       fstps  68(%%"REG_d")\n\t"
-
-"       flds   68(%%"REG_c")\n\t"
-"       fsubs  88(%%"REG_c")\n\t"
-"       fmuls 100(%%"REG_b")\n\t"
-"       fstps  88(%%"REG_d")\n\t"
-
-"       flds   72(%%"REG_c")\n\t"
-"       fadds  84(%%"REG_c")\n\t"
-"       fstps  72(%%"REG_d")\n\t"
-
-"       flds   72(%%"REG_c")\n\t"
-"       fsubs  84(%%"REG_c")\n\t"
-"       fmuls 104(%%"REG_b")\n\t"
-"       fstps  84(%%"REG_d")\n\t"
-
-"       flds   76(%%"REG_c")\n\t"
-"       fadds  80(%%"REG_c")\n\t"
-"       fstps  76(%%"REG_d")\n\t"
-
-"       flds   76(%%"REG_c")\n\t"
-"       fsubs  80(%%"REG_c")\n\t"
-"       fmuls 108(%%"REG_b")\n\t"
-"       fstps  80(%%"REG_d")\n\t"
-
-"       flds   96(%%"REG_c")\n\t"
-"       fadds 124(%%"REG_c")\n\t"
-"       fstps  96(%%"REG_d")\n\t"
-
-"       flds  124(%%"REG_c")\n\t"
-"       fsubs  96(%%"REG_c")\n\t"
-"       fmuls  96(%%"REG_b")\n\t"
-"       fstps 124(%%"REG_d")\n\t"
-
-"       flds  100(%%"REG_c")\n\t"
-"       fadds 120(%%"REG_c")\n\t"
-"       fstps 100(%%"REG_d")\n\t"
-
-"       flds  120(%%"REG_c")\n\t"
-"       fsubs 100(%%"REG_c")\n\t"
-"       fmuls 100(%%"REG_b")\n\t"
-"       fstps 120(%%"REG_d")\n\t"
-
-"       flds  104(%%"REG_c")\n\t"
-"       fadds 116(%%"REG_c")\n\t"
-"       fstps 104(%%"REG_d")\n\t"
-
-"       flds  116(%%"REG_c")\n\t"
-"       fsubs 104(%%"REG_c")\n\t"
-"       fmuls 104(%%"REG_b")\n\t"
-"       fstps 116(%%"REG_d")\n\t"
-
-"       flds  108(%%"REG_c")\n\t"
-"       fadds 112(%%"REG_c")\n\t"
-"       fstps 108(%%"REG_d")\n\t"
-
-"       flds  112(%%"REG_c")\n\t"
-"       fsubs 108(%%"REG_c")\n\t"
-"       fmuls 108(%%"REG_b")\n\t"
-"       fstps 112(%%"REG_d")\n\t"
-
-"       flds     (%%"REG_d")\n\t"
-"       fadds  12(%%"REG_d")\n\t"
-"       fstps    (%%"REG_c")\n\t"
-
-"       flds     (%%"REG_d")\n\t"
-"       fsubs  12(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps  12(%%"REG_c")\n\t"
-
-"       flds    4(%%"REG_d")\n\t"
-"       fadds   8(%%"REG_d")\n\t"
-"       fstps   4(%%"REG_c")\n\t"
-
-"       flds    4(%%"REG_d")\n\t"
-"       fsubs   8(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps   8(%%"REG_c")\n\t"
-
-"       flds   16(%%"REG_d")\n\t"
-"       fadds  28(%%"REG_d")\n\t"
-"       fstps  16(%%"REG_c")\n\t"
-
-"       flds   28(%%"REG_d")\n\t"
-"       fsubs  16(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps  28(%%"REG_c")\n\t"
-
-"       flds   20(%%"REG_d")\n\t"
-"       fadds  24(%%"REG_d")\n\t"
-"       fstps  20(%%"REG_c")\n\t"
-
-"       flds   24(%%"REG_d")\n\t"
-"       fsubs  20(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps  24(%%"REG_c")\n\t"
-
-"       flds   32(%%"REG_d")\n\t"
-"       fadds  44(%%"REG_d")\n\t"
-"       fstps  32(%%"REG_c")\n\t"
-
-"       flds   32(%%"REG_d")\n\t"
-"       fsubs  44(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps  44(%%"REG_c")\n\t"
-
-"       flds   36(%%"REG_d")\n\t"
-"       fadds  40(%%"REG_d")\n\t"
-"       fstps  36(%%"REG_c")\n\t"
-
-"       flds   36(%%"REG_d")\n\t"
-"       fsubs  40(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps  40(%%"REG_c")\n\t"
-
-"       flds   48(%%"REG_d")\n\t"
-"       fadds  60(%%"REG_d")\n\t"
-"       fstps  48(%%"REG_c")\n\t"
-
-"       flds   60(%%"REG_d")\n\t"
-"       fsubs  48(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps  60(%%"REG_c")\n\t"
-
-"       flds   52(%%"REG_d")\n\t"
-"       fadds  56(%%"REG_d")\n\t"
-"       fstps  52(%%"REG_c")\n\t"
-
-"       flds   56(%%"REG_d")\n\t"
-"       fsubs  52(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps  56(%%"REG_c")\n\t"
-
-"       flds   64(%%"REG_d")\n\t"
-"       fadds  76(%%"REG_d")\n\t"
-"       fstps  64(%%"REG_c")\n\t"
-
-"       flds   64(%%"REG_d")\n\t"
-"       fsubs  76(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps  76(%%"REG_c")\n\t"
-
-"       flds   68(%%"REG_d")\n\t"
-"       fadds  72(%%"REG_d")\n\t"
-"       fstps  68(%%"REG_c")\n\t"
-
-"       flds   68(%%"REG_d")\n\t"
-"       fsubs  72(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps  72(%%"REG_c")\n\t"
-
-"       flds   80(%%"REG_d")\n\t"
-"       fadds  92(%%"REG_d")\n\t"
-"       fstps  80(%%"REG_c")\n\t"
-
-"       flds   92(%%"REG_d")\n\t"
-"       fsubs  80(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps  92(%%"REG_c")\n\t"
-
-"       flds   84(%%"REG_d")\n\t"
-"       fadds  88(%%"REG_d")\n\t"
-"       fstps  84(%%"REG_c")\n\t"
-
-"       flds   88(%%"REG_d")\n\t"
-"       fsubs  84(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps  88(%%"REG_c")\n\t"
-
-"       flds   96(%%"REG_d")\n\t"
-"       fadds 108(%%"REG_d")\n\t"
-"       fstps  96(%%"REG_c")\n\t"
-
-"       flds   96(%%"REG_d")\n\t"
-"       fsubs 108(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps 108(%%"REG_c")\n\t"
-
-"       flds  100(%%"REG_d")\n\t"
-"       fadds 104(%%"REG_d")\n\t"
-"       fstps 100(%%"REG_c")\n\t"
-
-"       flds  100(%%"REG_d")\n\t"
-"       fsubs 104(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps 104(%%"REG_c")\n\t"
-
-"       flds  112(%%"REG_d")\n\t"
-"       fadds 124(%%"REG_d")\n\t"
-"       fstps 112(%%"REG_c")\n\t"
-
-"       flds  124(%%"REG_d")\n\t"
-"       fsubs 112(%%"REG_d")\n\t"
-"       fmuls 112(%%"REG_b")\n\t"
-"       fstps 124(%%"REG_c")\n\t"
-
-"       flds  116(%%"REG_d")\n\t"
-"       fadds 120(%%"REG_d")\n\t"
-"       fstps 116(%%"REG_c")\n\t"
-
-"       flds  120(%%"REG_d")\n\t"
-"       fsubs 116(%%"REG_d")\n\t"
-"       fmuls 116(%%"REG_b")\n\t"
-"       fstps 120(%%"REG_c")\n\t"
-
-/* Phase 5*/
-
-"       flds   32(%%"REG_c")\n\t"
-"       fadds  36(%%"REG_c")\n\t"
-"       fstps  32(%%"REG_d")\n\t"
-
-"       flds   32(%%"REG_c")\n\t"
-"       fsubs  36(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fstps  36(%%"REG_d")\n\t"
-
-"       flds   44(%%"REG_c")\n\t"
-"       fsubs  40(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fsts   44(%%"REG_d")\n\t"
-"       fadds  40(%%"REG_c")\n\t"
-"       fadds  44(%%"REG_c")\n\t"
-"       fstps  40(%%"REG_d")\n\t"
-
-"       flds   48(%%"REG_c")\n\t"
-"       fsubs  52(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-
-"       flds   60(%%"REG_c")\n\t"
-"       fsubs  56(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  56(%%"REG_c")\n\t"
-"       fadds  60(%%"REG_c")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  48(%%"REG_c")\n\t"
-"       fadds  52(%%"REG_c")\n\t"
-"       fstps  48(%%"REG_d")\n\t"
-"       fadd     %%st(2)\n\t"
-"       fstps  56(%%"REG_d")\n\t"
-"       fsts   60(%%"REG_d")\n\t"
-"       faddp    %%st(1)\n\t"
-"       fstps  52(%%"REG_d")\n\t"
-
-"       flds   64(%%"REG_c")\n\t"
-"       fadds  68(%%"REG_c")\n\t"
-"       fstps  64(%%"REG_d")\n\t"
-
-"       flds   64(%%"REG_c")\n\t"
-"       fsubs  68(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fstps  68(%%"REG_d")\n\t"
-
-"       flds   76(%%"REG_c")\n\t"
-"       fsubs  72(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fsts   76(%%"REG_d")\n\t"
-"       fadds  72(%%"REG_c")\n\t"
-"       fadds  76(%%"REG_c")\n\t"
-"       fstps  72(%%"REG_d")\n\t"
-
-"       flds   92(%%"REG_c")\n\t"
-"       fsubs  88(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fsts   92(%%"REG_d")\n\t"
-"       fadds  92(%%"REG_c")\n\t"
-"       fadds  88(%%"REG_c")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  80(%%"REG_c")\n\t"
-"       fadds  84(%%"REG_c")\n\t"
-"       fstps  80(%%"REG_d")\n\t"
-
-"       flds   80(%%"REG_c")\n\t"
-"       fsubs  84(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fadd  %%st(0), %%st(1)\n\t"
-"       fadds 92(%%"REG_d")\n\t"
-"       fstps 84(%%"REG_d")\n\t"
-"       fstps 88(%%"REG_d")\n\t"
-
-"       flds   96(%%"REG_c")\n\t"
-"       fadds 100(%%"REG_c")\n\t"
-"       fstps  96(%%"REG_d")\n\t"
-
-"       flds   96(%%"REG_c")\n\t"
-"       fsubs 100(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fstps 100(%%"REG_d")\n\t"
-
-"       flds  108(%%"REG_c")\n\t"
-"       fsubs 104(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fsts  108(%%"REG_d")\n\t"
-"       fadds 104(%%"REG_c")\n\t"
-"       fadds 108(%%"REG_c")\n\t"
-"       fstps 104(%%"REG_d")\n\t"
-
-"       flds  124(%%"REG_c")\n\t"
-"       fsubs 120(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fsts  124(%%"REG_d")\n\t"
-"       fadds 120(%%"REG_c")\n\t"
-"       fadds 124(%%"REG_c")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds 112(%%"REG_c")\n\t"
-"       fadds 116(%%"REG_c")\n\t"
-"       fstps 112(%%"REG_d")\n\t"
-
-"       flds  112(%%"REG_c")\n\t"
-"       fsubs 116(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fadd  %%st(0),%%st(1)\n\t"
-"       fadds 124(%%"REG_d")\n\t"
-"       fstps 116(%%"REG_d")\n\t"
-"       fstps 120(%%"REG_d")\n\t"
-"       jnz .L01\n\t"
-
-/* Phase 6*/
-
-"       flds      (%%"REG_c")\n\t"
-"       fadds    4(%%"REG_c")\n\t"
-"       fstps 1024(%%"REG_S")\n\t"
-
-"       flds      (%%"REG_c")\n\t"
-"       fsubs    4(%%"REG_c")\n\t"
-"       fmuls  120(%%"REG_b")\n\t"
-"       fsts      (%%"REG_S")\n\t"
-"       fstps     (%%"REG_D")\n\t"
-
-"       flds   12(%%"REG_c")\n\t"
-"       fsubs   8(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fsts  512(%%"REG_D")\n\t"
-"       fadds  12(%%"REG_c")\n\t"
-"       fadds   8(%%"REG_c")\n\t"
-"       fstps 512(%%"REG_S")\n\t"
-
-"       flds   16(%%"REG_c")\n\t"
-"       fsubs  20(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-
-"       flds   28(%%"REG_c")\n\t"
-"       fsubs  24(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fsts  768(%%"REG_D")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  24(%%"REG_c")\n\t"
-"       fadds  28(%%"REG_c")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  16(%%"REG_c")\n\t"
-"       fadds  20(%%"REG_c")\n\t"
-"       fstps 768(%%"REG_S")\n\t"
-"       fadd     %%st(2)\n\t"
-"       fstps 256(%%"REG_S")\n\t"
-"       faddp    %%st(1)\n\t"
-"       fstps 256(%%"REG_D")\n\t"
-
-/* Phase 7*/
-
-"       flds   32(%%"REG_d")\n\t"
-"       fadds  48(%%"REG_d")\n\t"
-"       fstps 896(%%"REG_S")\n\t"
-
-"       flds   48(%%"REG_d")\n\t"
-"       fadds  40(%%"REG_d")\n\t"
-"       fstps 640(%%"REG_S")\n\t"
-
-"       flds   40(%%"REG_d")\n\t"
-"       fadds  56(%%"REG_d")\n\t"
-"       fstps 384(%%"REG_S")\n\t"
-
-"       flds   56(%%"REG_d")\n\t"
-"       fadds  36(%%"REG_d")\n\t"
-"       fstps 128(%%"REG_S")\n\t"
-
-"       flds   36(%%"REG_d")\n\t"
-"       fadds  52(%%"REG_d")\n\t"
-"       fstps 128(%%"REG_D")\n\t"
-
-"       flds   52(%%"REG_d")\n\t"
-"       fadds  44(%%"REG_d")\n\t"
-"       fstps 384(%%"REG_D")\n\t"
-
-"       flds   60(%%"REG_d")\n\t"
-"       fsts  896(%%"REG_D")\n\t"
-"       fadds  44(%%"REG_d")\n\t"
-"       fstps 640(%%"REG_D")\n\t"
-
-"       flds   96(%%"REG_d")\n\t"
-"       fadds 112(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  64(%%"REG_d")\n\t"
-"       fstps 960(%%"REG_S")\n\t"
-"       fadds  80(%%"REG_d")\n\t"
-"       fstps 832(%%"REG_S")\n\t"
-
-"       flds  112(%%"REG_d")\n\t"
-"       fadds 104(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  80(%%"REG_d")\n\t"
-"       fstps 704(%%"REG_S")\n\t"
-"       fadds  72(%%"REG_d")\n\t"
-"       fstps 576(%%"REG_S")\n\t"
-
-"       flds  104(%%"REG_d")\n\t"
-"       fadds 120(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  72(%%"REG_d")\n\t"
-"       fstps 448(%%"REG_S")\n\t"
-"       fadds  88(%%"REG_d")\n\t"
-"       fstps 320(%%"REG_S")\n\t"
-
-"       flds  120(%%"REG_d")\n\t"
-"       fadds 100(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  88(%%"REG_d")\n\t"
-"       fstps 192(%%"REG_S")\n\t"
-"       fadds  68(%%"REG_d")\n\t"
-"       fstps  64(%%"REG_S")\n\t"
-
-"       flds  100(%%"REG_d")\n\t"
-"       fadds 116(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  68(%%"REG_d")\n\t"
-"       fstps  64(%%"REG_D")\n\t"
-"       fadds  84(%%"REG_d")\n\t"
-"       fstps 192(%%"REG_D")\n\t"
-
-"       flds  116(%%"REG_d")\n\t"
-"       fadds 108(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  84(%%"REG_d")\n\t"
-"       fstps 320(%%"REG_D")\n\t"
-"       fadds  76(%%"REG_d")\n\t"
-"       fstps 448(%%"REG_D")\n\t"
-
-"       flds  108(%%"REG_d")\n\t"
-"       fadds 124(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  76(%%"REG_d")\n\t"
-"       fstps 576(%%"REG_D")\n\t"
-"       fadds  92(%%"REG_d")\n\t"
-"       fstps 704(%%"REG_D")\n\t"
-
-"       flds  124(%%"REG_d")\n\t"
-"       fsts  960(%%"REG_D")\n\t"
-"       fadds  92(%%"REG_d")\n\t"
-"       fstps 832(%%"REG_D")\n\t"
-"       jmp     .L_bye\n\t"
-".L01:\n\t"
-/* Phase 8*/
-
-"       flds      (%%"REG_c")\n\t"
-"       fadds    4(%%"REG_c")\n\t"
-"       fistp  512(%%"REG_S")\n\t"
-
-"       flds      (%%"REG_c")\n\t"
-"       fsubs    4(%%"REG_c")\n\t"
-"       fmuls  120(%%"REG_b")\n\t"
-
-"       fistp     (%%"REG_S")\n\t"
-
-
-"       flds    12(%%"REG_c")\n\t"
-"       fsubs    8(%%"REG_c")\n\t"
-"       fmuls  120(%%"REG_b")\n\t"
-"       fist   256(%%"REG_D")\n\t"
-"       fadds   12(%%"REG_c")\n\t"
-"       fadds    8(%%"REG_c")\n\t"
-"       fistp  256(%%"REG_S")\n\t"
-
-"       flds   16(%%"REG_c")\n\t"
-"       fsubs  20(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-
-"       flds   28(%%"REG_c")\n\t"
-"       fsubs  24(%%"REG_c")\n\t"
-"       fmuls 120(%%"REG_b")\n\t"
-"       fist  384(%%"REG_D")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  24(%%"REG_c")\n\t"
-"       fadds  28(%%"REG_c")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  16(%%"REG_c")\n\t"
-"       fadds  20(%%"REG_c")\n\t"
-"       fistp  384(%%"REG_S")\n\t"
-"       fadd     %%st(2)\n\t"
-"       fistp  128(%%"REG_S")\n\t"
-"       faddp    %%st(1)\n\t"
-"       fistp  128(%%"REG_D")\n\t"
-
-/* Phase 9*/
-
-"       flds    32(%%"REG_d")\n\t"
-"       fadds   48(%%"REG_d")\n\t"
-"       fistp  448(%%"REG_S")\n\t"
-
-"       flds   48(%%"REG_d")\n\t"
-"       fadds  40(%%"REG_d")\n\t"
-"       fistp 320(%%"REG_S")\n\t"
-
-"       flds   40(%%"REG_d")\n\t"
-"       fadds  56(%%"REG_d")\n\t"
-"       fistp 192(%%"REG_S")\n\t"
-
-"       flds   56(%%"REG_d")\n\t"
-"       fadds  36(%%"REG_d")\n\t"
-"       fistp  64(%%"REG_S")\n\t"
-
-"       flds   36(%%"REG_d")\n\t"
-"       fadds  52(%%"REG_d")\n\t"
-"       fistp  64(%%"REG_D")\n\t"
-
-"       flds   52(%%"REG_d")\n\t"
-"       fadds  44(%%"REG_d")\n\t"
-"       fistp 192(%%"REG_D")\n\t"
-
-"       flds   60(%%"REG_d")\n\t"
-"       fist   448(%%"REG_D")\n\t"
-"       fadds  44(%%"REG_d")\n\t"
-"       fistp 320(%%"REG_D")\n\t"
-
-"       flds   96(%%"REG_d")\n\t"
-"       fadds 112(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  64(%%"REG_d")\n\t"
-"       fistp 480(%%"REG_S")\n\t"
-"       fadds  80(%%"REG_d")\n\t"
-"       fistp 416(%%"REG_S")\n\t"
-
-"       flds  112(%%"REG_d")\n\t"
-"       fadds 104(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  80(%%"REG_d")\n\t"
-"       fistp 352(%%"REG_S")\n\t"
-"       fadds  72(%%"REG_d")\n\t"
-"       fistp 288(%%"REG_S")\n\t"
-
-"       flds  104(%%"REG_d")\n\t"
-"       fadds 120(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  72(%%"REG_d")\n\t"
-"       fistp 224(%%"REG_S")\n\t"
-"       fadds  88(%%"REG_d")\n\t"
-"       fistp 160(%%"REG_S")\n\t"
-
-"       flds  120(%%"REG_d")\n\t"
-"       fadds 100(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  88(%%"REG_d")\n\t"
-"       fistp  96(%%"REG_S")\n\t"
-"       fadds  68(%%"REG_d")\n\t"
-"       fistp  32(%%"REG_S")\n\t"
-
-"       flds  100(%%"REG_d")\n\t"
-"       fadds 116(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  68(%%"REG_d")\n\t"
-"       fistp  32(%%"REG_D")\n\t"
-"       fadds  84(%%"REG_d")\n\t"
-"       fistp  96(%%"REG_D")\n\t"
-
-"       flds  116(%%"REG_d")\n\t"
-"       fadds 108(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  84(%%"REG_d")\n\t"
-"       fistp 160(%%"REG_D")\n\t"
-"       fadds  76(%%"REG_d")\n\t"
-"       fistp 224(%%"REG_D")\n\t"
-
-"       flds  108(%%"REG_d")\n\t"
-"       fadds 124(%%"REG_d")\n\t"
-"       fld      %%st(0)\n\t"
-"       fadds  76(%%"REG_d")\n\t"
-"       fistp 288(%%"REG_D")\n\t"
-"       fadds  92(%%"REG_d")\n\t"
-"       fistp 352(%%"REG_D")\n\t"
-
-"       flds  124(%%"REG_d")\n\t"
-"       fist  480(%%"REG_D")\n\t"
-"       fadds  92(%%"REG_d")\n\t"
-"       fistp 416(%%"REG_D")\n\t"
-"       movsw\n\t"
-".L_bye:"
-        :
-        :"m"(a),"m"(b),"m"(c),"m"(tmp[0])
-        :"memory","%eax","%ebx","%ecx","%edx","%esi","%edi");
-}
diff --git a/mplayer/mp3lib/dct64_sse.c b/mplayer/mp3lib/dct64_sse.c
deleted file mode 100644
index bcf3b97..0000000
--- a/mplayer/mp3lib/dct64_sse.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Discrete Cosine Tansform (DCT) for SSE
- * Copyright (c) 2006 Zuxy MENG <zuxy.meng at gmail.com>
- * based upon code from mp3lib/dct64.c, mp3lib/dct64_altivec.c
- * and mp3lib/dct64_mmx.c
- */
-
-#include "libavutil/mem.h"
-
-#include "mpg123.h"
-
-extern float __attribute__((aligned(16))) costab_mmx[];
-
-static const int ppnn[4] __attribute__((aligned(16))) =
-{ 0, 0, 1 << 31, 1 << 31 };
-
-static const int pnpn[4] __attribute__((aligned(16))) =
-{ 0, 1 << 31, 0, 1 << 31 };
-
-static const int nnnn[4] __attribute__((aligned(16))) =
-{ 1 << 31, 1 << 31, 1 << 31, 1 << 31 };
-
-void dct64_sse(short *out0,short *out1,real *c)
-{
-    DECLARE_ALIGNED(16, real, b1[0x20]);
-    DECLARE_ALIGNED(16, real, b2[0x20]);
-    static real const one = 1.f;
-
-    {
-        real *costab = costab_mmx;
-        int i;
-
-        for (i = 0; i < 0x20 / 2; i += 4)
-        {
-            __asm__(
-                "movaps    %2, %%xmm3\n\t"
-                "shufps    $27, %%xmm3, %%xmm3\n\t"
-                "movaps    %3, %%xmm1\n\t"
-                "movaps    %%xmm1, %%xmm4\n\t"
-                "movaps    %4, %%xmm2\n\t"
-                "shufps    $27, %%xmm4, %%xmm4\n\t"
-                "movaps    %%xmm2, %%xmm0\n\t"
-                "shufps    $27, %%xmm0, %%xmm0\n\t"
-                "addps     %%xmm0, %%xmm1\n\t"
-                "movaps    %%xmm1, %0\n\t"
-                "subps     %%xmm2, %%xmm4\n\t"
-                "mulps     %%xmm3, %%xmm4\n\t"
-                "movaps    %%xmm4, %1\n\t"
-                :"=m"(*(b1 + i)), "=m"(*(b1 + 0x1c - i))
-                :"m"(*(costab + i)), "m"(*(c + i)), "m"(*(c + 0x1c - i))
-               );
-        }
-    }
-
-    {
-        int i;
-
-        for (i = 0; i < 0x20; i += 0x10)
-        {
-            __asm__(
-                "movaps    %4, %%xmm1\n\t"
-                "movaps    %5, %%xmm3\n\t"
-                "movaps    %6, %%xmm4\n\t"
-                "movaps    %7, %%xmm6\n\t"
-                "movaps    %%xmm1, %%xmm7\n\t"
-                "shufps    $27, %%xmm7, %%xmm7\n\t"
-                "movaps    %%xmm3, %%xmm5\n\t"
-                "shufps    $27, %%xmm5, %%xmm5\n\t"
-                "movaps    %%xmm4, %%xmm2\n\t"
-                "shufps    $27, %%xmm2, %%xmm2\n\t"
-                "movaps    %%xmm6, %%xmm0\n\t"
-                "shufps    $27, %%xmm0, %%xmm0\n\t"
-                "addps     %%xmm0, %%xmm1\n\t"
-                "movaps    %%xmm1, %0\n\t"
-                "addps     %%xmm2, %%xmm3\n\t"
-                "movaps    %%xmm3, %1\n\t"
-                "subps     %%xmm4, %%xmm5\n\t"
-                "movaps    %%xmm5, %2\n\t"
-                "subps     %%xmm6, %%xmm7\n\t"
-                "movaps    %%xmm7, %3\n\t"
-                :"=m"(*(b2 + i)), "=m"(*(b2 + i + 4)), "=m"(*(b2 + i + 8)), "=m"(*(b2 + i + 12))
-                :"m"(*(b1 + i)), "m"(*(b1 + i + 4)), "m"(*(b1 + i + 8)), "m"(*(b1 + i + 12))
-                );
-        }
-    }
-
-    {
-        real *costab = costab_mmx + 16;
-        __asm__(
-            "movaps    %4, %%xmm0\n\t"
-            "movaps    %5, %%xmm1\n\t"
-            "movaps    %8, %%xmm4\n\t"
-            "xorps     %%xmm6, %%xmm6\n\t"
-            "shufps    $27, %%xmm4, %%xmm4\n\t"
-            "mulps     %%xmm4, %%xmm1\n\t"
-            "movaps    %9, %%xmm2\n\t"
-            "xorps     %%xmm7, %%xmm7\n\t"
-            "shufps    $27, %%xmm2, %%xmm2\n\t"
-            "mulps     %%xmm2, %%xmm0\n\t"
-            "movaps    %%xmm0, %0\n\t"
-            "movaps    %%xmm1, %1\n\t"
-            "movaps    %6, %%xmm3\n\t"
-            "mulps     %%xmm2, %%xmm3\n\t"
-            "subps     %%xmm3, %%xmm6\n\t"
-            "movaps    %%xmm6, %2\n\t"
-            "movaps    %7, %%xmm5\n\t"
-            "mulps     %%xmm4, %%xmm5\n\t"
-            "subps     %%xmm5, %%xmm7\n\t"
-            "movaps    %%xmm7, %3\n\t"
-            :"=m"(*(b2 + 8)), "=m"(*(b2 + 0xc)), "=m"(*(b2 + 0x18)), "=m"(*(b2 + 0x1c))
-            :"m"(*(b2 + 8)), "m"(*(b2 + 0xc)), "m"(*(b2 + 0x18)), "m"(*(b2 + 0x1c)), "m"(*costab), "m"(*(costab + 4))
-            );
-    }
-
-    {
-        real *costab = costab_mmx + 24;
-        int i;
-
-        __asm__(
-            "movaps    %0, %%xmm0\n\t"
-            "shufps    $27, %%xmm0, %%xmm0\n\t"
-            "movaps    %1, %%xmm5\n\t"
-            "movaps    %%xmm5, %%xmm6\n\t"
-            :
-            :"m"(*costab), "m"(*nnnn)
-           );
-
-        for (i = 0; i < 0x20; i += 8)
-        {
-            __asm__(
-                "movaps    %2, %%xmm2\n\t"
-                "movaps    %3, %%xmm3\n\t"
-                "movaps    %%xmm2, %%xmm4\n\t"
-                "xorps     %%xmm5, %%xmm6\n\t"
-                "shufps    $27, %%xmm4, %%xmm4\n\t"
-                "movaps    %%xmm3, %%xmm1\n\t"
-                "shufps    $27, %%xmm1, %%xmm1\n\t"
-                "addps     %%xmm1, %%xmm2\n\t"
-                "movaps    %%xmm2, %0\n\t"
-                "subps     %%xmm3, %%xmm4\n\t"
-                "xorps     %%xmm6, %%xmm4\n\t"
-                "mulps     %%xmm0, %%xmm4\n\t"
-                "movaps    %%xmm4, %1\n\t"
-                :"=m"(*(b1 + i)), "=m"(*(b1 + i + 4))
-                :"m"(*(b2 + i)), "m"(*(b2 + i + 4))
-               );
-        }
-    }
-
-    {
-        int i;
-
-        __asm__(
-            "movss     %0, %%xmm1\n\t"
-            "movss     %1, %%xmm0\n\t"
-            "movaps    %%xmm1, %%xmm3\n\t"
-            "unpcklps  %%xmm0, %%xmm3\n\t"
-            "movss     %2, %%xmm2\n\t"
-            "movaps    %%xmm1, %%xmm0\n\t"
-            "unpcklps  %%xmm2, %%xmm0\n\t"
-            "unpcklps  %%xmm3, %%xmm0\n\t"
-            "movaps    %3, %%xmm2\n\t"
-            :
-            :"m"(one), "m"(costab_mmx[28]), "m"(costab_mmx[29]), "m"(*ppnn)
-           );
-
-        for (i = 0; i < 0x20; i += 8)
-        {
-            __asm__(
-                "movaps    %2, %%xmm3\n\t"
-                "movaps    %%xmm3, %%xmm4\n\t"
-                "shufps    $20, %%xmm4, %%xmm4\n\t"
-                "shufps    $235, %%xmm3, %%xmm3\n\t"
-                "xorps     %%xmm2, %%xmm3\n\t"
-                "addps     %%xmm3, %%xmm4\n\t"
-                "mulps     %%xmm0, %%xmm4\n\t"
-                "movaps    %%xmm4, %0\n\t"
-                "movaps    %3, %%xmm6\n\t"
-                "movaps    %%xmm6, %%xmm5\n\t"
-                "shufps    $27, %%xmm5, %%xmm5\n\t"
-                "xorps     %%xmm2, %%xmm5\n\t"
-                "addps     %%xmm5, %%xmm6\n\t"
-                "mulps     %%xmm0, %%xmm6\n\t"
-                "movaps    %%xmm6, %1\n\t"
-                :"=m"(*(b2 + i)), "=m"(*(b2 + i + 4))
-                :"m"(*(b1 + i)), "m"(*(b1 + i + 4))
-               );
-        }
-    }
-
-    {
-        int i;
-        __asm__(
-            "movss     %0, %%xmm0\n\t"
-            "movaps    %%xmm1, %%xmm2\n\t"
-            "movaps    %%xmm0, %%xmm7\n\t"
-            "unpcklps  %%xmm1, %%xmm2\n\t"
-            "unpcklps  %%xmm0, %%xmm7\n\t"
-            "movaps    %1, %%xmm0\n\t"
-            "unpcklps  %%xmm7, %%xmm2\n\t"
-            :
-            :"m"(costab_mmx[30]), "m"(*pnpn)
-           );
-
-        for (i = 0x8; i < 0x20; i += 8)
-        {
-            __asm__ volatile (
-                          "movaps    %2, %%xmm1\n\t"
-                          "movaps    %%xmm1, %%xmm3\n\t"
-                          "shufps    $224, %%xmm3, %%xmm3\n\t"
-                          "shufps    $181, %%xmm1, %%xmm1\n\t"
-                          "xorps     %%xmm0, %%xmm1\n\t"
-                          "addps     %%xmm1, %%xmm3\n\t"
-                          "mulps     %%xmm2, %%xmm3\n\t"
-                          "movaps    %%xmm3, %0\n\t"
-                          "movaps    %3, %%xmm4\n\t"
-                          "movaps    %%xmm4, %%xmm5\n\t"
-                          "shufps    $224, %%xmm5, %%xmm5\n\t"
-                          "shufps    $181, %%xmm4, %%xmm4\n\t"
-                          "xorps     %%xmm0, %%xmm4\n\t"
-                          "addps     %%xmm4, %%xmm5\n\t"
-                          "mulps     %%xmm2, %%xmm5\n\t"
-                          "movaps    %%xmm5, %1\n\t"
-                          :"=m"(*(b1 + i)), "=m"(*(b1 + i + 4))
-                          :"m"(*(b2 + i)), "m"(*(b2 + i + 4))
-                          :"memory"
-                         );
-        }
-        for (i = 0x8; i < 0x20; i += 8)
-        {
-            b1[i + 2] += b1[i + 3];
-            b1[i + 6] += b1[i + 7];
-            b1[i + 4] += b1[i + 6];
-            b1[i + 6] += b1[i + 5];
-            b1[i + 5] += b1[i + 7];
-        }
-    }
-
-#if 0
-    /* Reference C code */
-
-    /*
-       Should run faster than x87 asm, given that the compiler is sane.
-       However, the C code dosen't round with saturation (0x7fff for too
-       large positive float, 0x8000 for too small negative float). You
-       can hear the difference if you listen carefully.
-    */
-
-    out0[256] = (short)(b2[0] + b2[1]);
-    out0[0] = (short)((b2[0] - b2[1]) * costab_mmx[30]);
-    out1[128] = (short)((b2[3] - b2[2]) * costab_mmx[30]);
-    out0[128] = (short)((b2[3] - b2[2]) * costab_mmx[30] + b2[3] + b2[2]);
-    out1[192] = (short)((b2[7] - b2[6]) * costab_mmx[30]);
-    out0[192] = (short)((b2[7] - b2[6]) * costab_mmx[30] + b2[6] + b2[7] + b2[4] + b2[5]);
-    out0[64] = (short)((b2[7] - b2[6]) * costab_mmx[30] + b2[6] + b2[7] + (b2[4] - b2[5]) * costab_mmx[30]);
-    out1[64] = (short)((b2[7] - b2[6]) * costab_mmx[30] + (b2[4] - b2[5]) * costab_mmx[30]);
-
-    out0[224] = (short)(b1[8] + b1[12]);
-    out0[160] = (short)(b1[12] + b1[10]);
-    out0[96] = (short)(b1[10] + b1[14]);
-    out0[32] = (short)(b1[14] + b1[9]);
-    out1[32] = (short)(b1[9] + b1[13]);
-    out1[96] = (short)(b1[13] + b1[11]);
-    out1[224] = (short)b1[15];
-    out1[160] = (short)(b1[15] + b1[11]);
-    out0[240] = (short)(b1[24] + b1[28] + b1[16]);
-    out0[208] = (short)(b1[24] + b1[28] + b1[20]);
-    out0[176] = (short)(b1[28] + b1[26] + b1[20]);
-    out0[144] = (short)(b1[28] + b1[26] + b1[18]);
-    out0[112] = (short)(b1[26] + b1[30] + b1[18]);
-    out0[80] = (short)(b1[26] + b1[30] + b1[22]);
-    out0[48] = (short)(b1[30] + b1[25] + b1[22]);
-    out0[16] = (short)(b1[30] + b1[25] + b1[17]);
-    out1[16] = (short)(b1[25] + b1[29] + b1[17]);
-    out1[48] = (short)(b1[25] + b1[29] + b1[21]);
-    out1[80] = (short)(b1[29] + b1[27] + b1[21]);
-    out1[112] = (short)(b1[29] + b1[27] + b1[19]);
-    out1[144] = (short)(b1[27] + b1[31] + b1[19]);
-    out1[176] = (short)(b1[27] + b1[31] + b1[23]);
-    out1[240] = (short)(b1[31]);
-    out1[208] = (short)(b1[31] + b1[23]);
-
-#else
-    /*
-       To do saturation efficiently in x86 we can use fist(p)s,
-       pf2iw, or packssdw. We use fist(p)s here.
-    */
-    __asm__(
-        "flds       %0\n\t"
-        "flds     (%2)\n\t"
-        "fadds   4(%2)\n\t"
-        "fistps 512(%3)\n\t"
-
-        "flds     (%2)\n\t"
-        "fsubs   4(%2)\n\t"
-        "fmul  %%st(1)\n\t"
-        "fistps    (%3)\n\t"
-
-        "flds   12(%2)\n\t"
-        "fsubs   8(%2)\n\t"
-        "fmul  %%st(1)\n\t"
-        "fists  256(%4)\n\t"
-        "fadds  12(%2)\n\t"
-        "fadds   8(%2)\n\t"
-        "fistps 256(%3)\n\t"
-
-        "flds   16(%2)\n\t"
-        "fsubs  20(%2)\n\t"
-        "fmul  %%st(1)\n\t"
-
-        "flds   28(%2)\n\t"
-        "fsubs  24(%2)\n\t"
-        "fmul  %%st(2)\n\t"
-        "fists  384(%4)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  24(%2)\n\t"
-        "fadds  28(%2)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  16(%2)\n\t"
-        "fadds  20(%2)\n\t"
-        "fistps 384(%3)\n\t"
-        "fadd  %%st(2)\n\t"
-        "fistps 128(%3)\n\t"
-        "faddp %%st(1)\n\t"
-        "fistps 128(%4)\n\t"
-
-        "flds   32(%1)\n\t"
-        "fadds  48(%1)\n\t"
-        "fistps 448(%3)\n\t"
-
-        "flds   48(%1)\n\t"
-        "fadds  40(%1)\n\t"
-        "fistps 320(%3)\n\t"
-
-        "flds   40(%1)\n\t"
-        "fadds  56(%1)\n\t"
-        "fistps 192(%3)\n\t"
-
-        "flds   56(%1)\n\t"
-        "fadds  36(%1)\n\t"
-        "fistps  64(%3)\n\t"
-
-        "flds   36(%1)\n\t"
-        "fadds  52(%1)\n\t"
-        "fistps  64(%4)\n\t"
-
-        "flds   52(%1)\n\t"
-        "fadds  44(%1)\n\t"
-        "fistps 192(%4)\n\t"
-
-        "flds   60(%1)\n\t"
-        "fists  448(%4)\n\t"
-        "fadds  44(%1)\n\t"
-        "fistps 320(%4)\n\t"
-
-        "flds   96(%1)\n\t"
-        "fadds 112(%1)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  64(%1)\n\t"
-        "fistps 480(%3)\n\t"
-        "fadds  80(%1)\n\t"
-        "fistps 416(%3)\n\t"
-
-        "flds  112(%1)\n\t"
-        "fadds 104(%1)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  80(%1)\n\t"
-        "fistps 352(%3)\n\t"
-        "fadds  72(%1)\n\t"
-        "fistps 288(%3)\n\t"
-
-        "flds  104(%1)\n\t"
-        "fadds 120(%1)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  72(%1)\n\t"
-        "fistps 224(%3)\n\t"
-        "fadds  88(%1)\n\t"
-        "fistps 160(%3)\n\t"
-
-        "flds  120(%1)\n\t"
-        "fadds 100(%1)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  88(%1)\n\t"
-        "fistps  96(%3)\n\t"
-        "fadds  68(%1)\n\t"
-        "fistps  32(%3)\n\t"
-
-        "flds  100(%1)\n\t"
-        "fadds 116(%1)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  68(%1)\n\t"
-        "fistps  32(%4)\n\t"
-        "fadds  84(%1)\n\t"
-        "fistps  96(%4)\n\t"
-
-        "flds  116(%1)\n\t"
-        "fadds 108(%1)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  84(%1)\n\t"
-        "fistps 160(%4)\n\t"
-        "fadds  76(%1)\n\t"
-        "fistps 224(%4)\n\t"
-
-        "flds  108(%1)\n\t"
-        "fadds 124(%1)\n\t"
-        "fld   %%st(0)\n\t"
-        "fadds  76(%1)\n\t"
-        "fistps 288(%4)\n\t"
-        "fadds  92(%1)\n\t"
-        "fistps 352(%4)\n\t"
-
-        "flds  124(%1)\n\t"
-        "fists  480(%4)\n\t"
-        "fadds  92(%1)\n\t"
-        "fistps 416(%4)\n\t"
-        ".byte 0xdf, 0xc0\n\t" // ffreep %%st(0)
-        :
-        :"m"(costab_mmx[30]), "r"(b1), "r"(b2), "r"(out0), "r"(out1)
-        :"memory"
-        );
-#endif
-    out1[0] = out0[0];
-}
diff --git a/mplayer/mp3lib/decod386.c b/mplayer/mp3lib/decod386.c
deleted file mode 100644
index 82657ae..0000000
--- a/mplayer/mp3lib/decod386.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
- * Mpeg Layer-1,2,3 audio decoder
- * ------------------------------
- * copyright (c) 1995,1996,1997 by Michael Hipp, All rights reserved.
- * See also 'README'
- *
- * slighlty optimized for machines without autoincrement/decrement.
- * The performance is highly compiler dependend. Maybe
- * the decode.c version for 'normal' processor may be faster
- * even for Intel processors.
- */
-
-
-#include "config.h"
-
-#if 0
- /* old WRITE_SAMPLE */
-   /* is portable */
-#define WRITE_SAMPLE(samples,sum,clip) {                        \
-  if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; }       \
-  else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; }\
-  else { *(samples) = sum;  }                                   \
-}
-#else
- /* new WRITE_SAMPLE */
-
-/*
- * should be the same as the "old WRITE_SAMPLE" macro above, but uses
- * some tricks to avoid double->int conversions and floating point compares.
- *
- * Here's how it works:
- * ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) is
- * 0x0010000080000000LL in hex.  It computes 0x0010000080000000LL + sum
- * as a double IEEE fp value and extracts the low-order 32-bits from the
- * IEEE fp representation stored in memory.  The 2^56 bit in the constant
- * is intended to force the bits of "sum" into the least significant bits
- * of the double mantissa.  After an integer substraction of 0x80000000
- * we have the original double value "sum" converted to an 32-bit int value.
- *
- * (Is that really faster than the clean and simple old version of the macro?)
- */
-
-/*
- * On a SPARC cpu, we fetch the low-order 32-bit from the second 32-bit
- * word of the double fp value stored in memory.  On an x86 cpu, we fetch it
- * from the first 32-bit word.
- * I'm not sure if the HAVE_BIGENDIAN feature test covers all possible memory
- * layouts of double floating point values an all cpu architectures.  If
- * it doesn't work for you, just enable the "old WRITE_SAMPLE" macro.
- */
-#if HAVE_BIGENDIAN
-#define MANTISSA_OFFSET 1
-#else
-#define MANTISSA_OFFSET 0
-#endif
-
-   /* sizeof(int) == 4 */
-#define WRITE_SAMPLE(samples,sum,clip) { \
-  union { double dtemp; int itemp[2]; } u; int v; \
-  u.dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
-  v = u.itemp[MANTISSA_OFFSET] - 0x80000000; \
-  if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \
-  else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \
-  else { *(samples) = v; } \
-}
-#endif
-
-
-/*
-#define WRITE_SAMPLE(samples,sum,clip) { \
-  double dtemp; int v;                    \
-  dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
-  v = ((*(int *)&dtemp) - 0x80000000); \
-  if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \
-  else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \
-  else { *(samples) = v; } \
-}
-*/
-
-static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt);
-
-static int synth_1to1_mono2stereo(real *bandPtr,unsigned char *samples,int *pnt)
-{
-  int i,ret;
-
-  ret = synth_1to1(bandPtr,0,samples,pnt);
-  samples = samples + *pnt - 128;
-
-  for(i=0;i<32;i++) {
-    ((short *)samples)[1] = ((short *)samples)[0];
-    samples+=4;
-  }
-
-  return ret;
-}
-
-static synth_func_t synth_func;
-
-#if HAVE_ALTIVEC
-#define dct64_base(a,b,c) if(gCpuCaps.hasAltiVec) dct64_altivec(a,b,c); else dct64(a,b,c)
-#else /* HAVE_ALTIVEC */
-#define dct64_base(a,b,c) dct64(a,b,c)
-#endif /* HAVE_ALTIVEC */
-
-static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
-{
-  static real buffs[2][2][0x110];
-  static const int step = 2;
-  static int bo = 1;
-  short *samples = (short *) (out + *pnt);
-  real *b0,(*buf)[0x110];
-  int clip = 0;
-  int bo1;
-
-  *pnt += 128;
-
-/* optimized for x86 */
-#if ARCH_X86
-  if ( synth_func )
-   {
-//    printf("Calling %p, bandPtr=%p channel=%d samples=%p\n",synth_func,bandPtr,channel,samples);
-    // FIXME: synth_func() may destroy EBP, don't rely on stack contents!!!
-    return (*synth_func)( bandPtr,channel,samples);
-   }
-#endif
-  if(!channel) {     /* channel=0 */
-    bo--;
-    bo &= 0xf;
-    buf = buffs[0];
-  }
-  else {
-    samples++;
-    buf = buffs[1];
-  }
-
-  if(bo & 0x1) {
-    b0 = buf[0];
-    bo1 = bo;
-    dct64_base(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr);
-  }
-  else {
-    b0 = buf[1];
-    bo1 = bo+1;
-    dct64_base(buf[0]+bo,buf[1]+bo+1,bandPtr);
-  }
-
-  {
-    register int j;
-    real *window = mp3lib_decwin + 16 - bo1;
-
-    for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step)
-    {
-      real sum;
-      sum  = window[0x0] * b0[0x0];
-      sum -= window[0x1] * b0[0x1];
-      sum += window[0x2] * b0[0x2];
-      sum -= window[0x3] * b0[0x3];
-      sum += window[0x4] * b0[0x4];
-      sum -= window[0x5] * b0[0x5];
-      sum += window[0x6] * b0[0x6];
-      sum -= window[0x7] * b0[0x7];
-      sum += window[0x8] * b0[0x8];
-      sum -= window[0x9] * b0[0x9];
-      sum += window[0xA] * b0[0xA];
-      sum -= window[0xB] * b0[0xB];
-      sum += window[0xC] * b0[0xC];
-      sum -= window[0xD] * b0[0xD];
-      sum += window[0xE] * b0[0xE];
-      sum -= window[0xF] * b0[0xF];
-
-      WRITE_SAMPLE(samples,sum,clip);
-    }
-
-    {
-      real sum;
-      sum  = window[0x0] * b0[0x0];
-      sum += window[0x2] * b0[0x2];
-      sum += window[0x4] * b0[0x4];
-      sum += window[0x6] * b0[0x6];
-      sum += window[0x8] * b0[0x8];
-      sum += window[0xA] * b0[0xA];
-      sum += window[0xC] * b0[0xC];
-      sum += window[0xE] * b0[0xE];
-      WRITE_SAMPLE(samples,sum,clip);
-      b0-=0x10,window-=0x20,samples+=step;
-    }
-    window += bo1<<1;
-
-    for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step)
-    {
-      real sum;
-      sum = -window[-0x1] * b0[0x0];
-      sum -= window[-0x2] * b0[0x1];
-      sum -= window[-0x3] * b0[0x2];
-      sum -= window[-0x4] * b0[0x3];
-      sum -= window[-0x5] * b0[0x4];
-      sum -= window[-0x6] * b0[0x5];
-      sum -= window[-0x7] * b0[0x6];
-      sum -= window[-0x8] * b0[0x7];
-      sum -= window[-0x9] * b0[0x8];
-      sum -= window[-0xA] * b0[0x9];
-      sum -= window[-0xB] * b0[0xA];
-      sum -= window[-0xC] * b0[0xB];
-      sum -= window[-0xD] * b0[0xC];
-      sum -= window[-0xE] * b0[0xD];
-      sum -= window[-0xF] * b0[0xE];
-      sum -= window[-0x0] * b0[0xF];
-
-      WRITE_SAMPLE(samples,sum,clip);
-    }
-  }
-
-  return clip;
-
-}
-
-#ifdef CONFIG_FAKE_MONO
-static int synth_1to1_l(real *bandPtr,int channel,unsigned char *out,int *pnt)
-{
-  int i,ret;
-
-  ret = synth_1to1(bandPtr,channel,out,pnt);
-  out = out + *pnt - 128;
-
-  for(i=0;i<32;i++) {
-    ((short *)out)[1] = ((short *)out)[0];
-    out+=4;
-  }
-
-  return ret;
-}
-
-static int synth_1to1_r(real *bandPtr,int channel,unsigned char *out,int *pnt)
-{
-  int i,ret;
-
-  ret = synth_1to1(bandPtr,channel,out,pnt);
-  out = out + *pnt - 128;
-
-  for(i=0;i<32;i++) {
-    ((short *)out)[0] = ((short *)out)[1];
-    out+=4;
-  }
-
-  return ret;
-}
-#endif
diff --git a/mplayer/mp3lib/decode_i586.c b/mplayer/mp3lib/decode_i586.c
deleted file mode 100644
index 83933d7..0000000
--- a/mplayer/mp3lib/decode_i586.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
-* mpg123_synth_1to1 works the same way as the c version of this
-* file.  only two types of changes have been made:
-* - reordered floating point instructions to
-*   prevent pipline stalls
-* - made WRITE_SAMPLE use integer instead of
-*   (slower) floating point
-* all kinds of x86 processors should benefit from these
-* modifications.
-*
-* useful sources of information on optimizing x86 code include:
-*
-*     Intel Architecture Optimization Manual
-*     http://www.intel.com/design/pentium/manuals/242816.htm
-*
-*     Cyrix 6x86 Instruction Set Summary
-*     ftp://ftp.cyrix.com/6x86/6x-dbch6.pdf
-*
-*     AMD-K5 Processor Software Development
-*     http://www.amd.com/products/cpg/techdocs/appnotes/20007e.pdf
-*
-* Stefan Bieschewski <stb at acm.org>
-*
-* $Id$
-*/
-#include "config.h"
-#include "mangle.h"
-#include "mpg123.h"
-
-static int attribute_used buffs[1088]={0};
-static int attribute_used bo=1;
-static int attribute_used saved_ebp=0;
-
-int synth_1to1_pent(real *bandPtr, int channel, short *samples)
-{
-  real tmp[3];
-  register int retval;
-    __asm__ volatile(
-"        movl %%ebp,"MANGLE(saved_ebp)"\n\t"
-"        movl %1,%%eax\n\t"/*bandPtr*/
-"        movl %3,%%esi\n\t"
-"        xorl %%edi,%%edi\n\t"
-"        movl "MANGLE(bo)",%%ebp\n\t"
-"        cmpl %%edi,%2\n\t"
-"        jne .L48\n\t"
-"        decl %%ebp\n\t"
-"        andl $15,%%ebp\n\t"
-"        movl %%ebp,"MANGLE(bo)"\n\t"
-"        movl $"MANGLE(buffs)",%%ecx\n\t"
-"        jmp .L49\n\t"
-".L48:\n\t"
-"        addl $2,%%esi\n\t"
-"        movl $"MANGLE(buffs)"+2176,%%ecx\n\t"
-".L49:\n\t"
-"        testl $1,%%ebp\n\t"
-"        je .L50\n\t"
-"        movl %%ecx,%%ebx\n\t"
-"        movl %%ebp,%4\n\t"
-"        pushl %%eax\n\t"
-"        movl 4+%4,%%edx\n\t"
-"        leal (%%ebx,%%edx,4),%%eax\n\t"
-"        pushl %%eax\n\t"
-"        movl 8+%4,%%eax\n\t"
-"        incl %%eax\n\t"
-"        andl $15,%%eax\n\t"
-"        leal 1088(,%%eax,4),%%eax\n\t"
-"        addl %%ebx,%%eax\n\t"
-"        jmp .L74\n\t"
-".L50:\n\t"
-"        leal 1088(%%ecx),%%ebx\n\t"
-"        leal 1(%%ebp),%%edx\n\t"
-"        movl %%edx,%4\n\t"
-"        pushl %%eax\n\t"
-"        leal 1092(%%ecx,%%ebp,4),%%eax\n\t"
-"        pushl %%eax\n\t"
-"        leal (%%ecx,%%ebp,4),%%eax\n\t"
-".L74:\n\t"
-"        pushl %%eax\n\t"
-"        call "MANGLE(mp3lib_dct64)"\n\t"
-"        addl $12,%%esp\n\t"
-"        movl %4,%%edx\n\t"
-"        leal 0(,%%edx,4),%%edx\n\t"
-"        movl $"MANGLE(mp3lib_decwin)"+64,%%eax\n\t"
-"        movl %%eax,%%ecx\n\t"
-"        subl %%edx,%%ecx\n\t"
-"        movl $16,%%ebp\n\t"
-".L55:\n\t"
-"        flds (%%ecx)\n\t"
-"        fmuls (%%ebx)\n\t"
-"        flds 4(%%ecx)\n\t"
-"        fmuls 4(%%ebx)\n\t"
-"        fxch %%st(1)\n\t"
-"        flds 8(%%ecx)\n\t"
-"        fmuls 8(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds 12(%%ecx)\n\t"
-"        fmuls 12(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 16(%%ecx)\n\t"
-"        fmuls 16(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds 20(%%ecx)\n\t"
-"        fmuls 20(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 24(%%ecx)\n\t"
-"        fmuls 24(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds 28(%%ecx)\n\t"
-"        fmuls 28(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 32(%%ecx)\n\t"
-"        fmuls 32(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds 36(%%ecx)\n\t"
-"        fmuls 36(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 40(%%ecx)\n\t"
-"        fmuls 40(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds 44(%%ecx)\n\t"
-"        fmuls 44(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 48(%%ecx)\n\t"
-"        fmuls 48(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds 52(%%ecx)\n\t"
-"        fmuls 52(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 56(%%ecx)\n\t"
-"        fmuls 56(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds 60(%%ecx)\n\t"
-"        fmuls 60(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        subl $4,%%esp\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        fxch %%st(1)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        fistpl (%%esp)\n\t"
-"        popl %%eax\n\t"
-"        cmpl $32767,%%eax\n\t"
-"        jg 1f\n\t"
-"        cmpl $-32768,%%eax\n\t"
-"        jl 2f\n\t"
-"        movw %%ax,(%%esi)\n\t"
-"        jmp 4f\n\t"
-"1:      movw $32767,(%%esi)\n\t"
-"        jmp 3f\n\t"
-"2:      movw $-32768,(%%esi)\n\t"
-"3:      incl %%edi\n\t"
-"4:\n\t"
-".L54:\n\t"
-"        addl $64,%%ebx\n\t"
-"        subl $-128,%%ecx\n\t"
-"        addl $4,%%esi\n\t"
-"        decl %%ebp\n\t"
-"        jnz .L55\n\t"
-"        flds (%%ecx)\n\t"
-"        fmuls (%%ebx)\n\t"
-"        flds 8(%%ecx)\n\t"
-"        fmuls 8(%%ebx)\n\t"
-"        flds 16(%%ecx)\n\t"
-"        fmuls 16(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 24(%%ecx)\n\t"
-"        fmuls 24(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 32(%%ecx)\n\t"
-"        fmuls 32(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 40(%%ecx)\n\t"
-"        fmuls 40(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 48(%%ecx)\n\t"
-"        fmuls 48(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        flds 56(%%ecx)\n\t"
-"        fmuls 56(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        subl $4,%%esp\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        fxch %%st(1)\n\t"
-"        faddp %%st,%%st(1)\n\t"
-"        fistpl (%%esp)\n\t"
-"        popl %%eax\n\t"
-"        cmpl $32767,%%eax\n\t"
-"        jg 1f\n\t"
-"        cmpl $-32768,%%eax\n\t"
-"        jl 2f\n\t"
-"        movw %%ax,(%%esi)\n\t"
-"        jmp 4f\n\t"
-"1:      movw $32767,(%%esi)\n\t"
-"        jmp 3f\n\t"
-"2:      movw $-32768,(%%esi)\n\t"
-"3:      incl %%edi\n\t"
-"4:\n\t"
-".L62:\n\t"
-"        addl $-64,%%ebx\n\t"
-"        addl $4,%%esi\n\t"
-"        movl %4,%%edx\n\t"
-"        leal -128(%%ecx,%%edx,8),%%ecx\n\t"
-"        movl $15,%%ebp\n\t"
-".L68:\n\t"
-"        flds -4(%%ecx)\n\t"
-"        fchs\n\t"
-"        fmuls (%%ebx)\n\t"
-"        flds -8(%%ecx)\n\t"
-"        fmuls 4(%%ebx)\n\t"
-"        fxch %%st(1)\n\t"
-"        flds -12(%%ecx)\n\t"
-"        fmuls 8(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -16(%%ecx)\n\t"
-"        fmuls 12(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -20(%%ecx)\n\t"
-"        fmuls 16(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -24(%%ecx)\n\t"
-"        fmuls 20(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -28(%%ecx)\n\t"
-"        fmuls 24(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -32(%%ecx)\n\t"
-"        fmuls 28(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -36(%%ecx)\n\t"
-"        fmuls 32(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -40(%%ecx)\n\t"
-"        fmuls 36(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -44(%%ecx)\n\t"
-"        fmuls 40(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -48(%%ecx)\n\t"
-"        fmuls 44(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -52(%%ecx)\n\t"
-"        fmuls 48(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -56(%%ecx)\n\t"
-"        fmuls 52(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds -60(%%ecx)\n\t"
-"        fmuls 56(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        flds (%%ecx)\n\t"
-"        fmuls 60(%%ebx)\n\t"
-"        fxch %%st(2)\n\t"
-"        subl $4,%%esp\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        fxch %%st(1)\n\t"
-"        fsubrp %%st,%%st(1)\n\t"
-"        fistpl (%%esp)\n\t"
-"        popl %%eax\n\t"
-"        cmpl $32767,%%eax\n\t"
-"        jg 1f\n\t"
-"        cmpl $-32768,%%eax\n\t"
-"        jl 2f\n\t"
-"        movw %%ax,(%%esi)\n\t"
-"        jmp 4f\n\t"
-"1:      movw $32767,(%%esi)\n\t"
-"        jmp 3f\n\t"
-"2:      movw $-32768,(%%esi)\n\t"
-"3:      incl %%edi\n\t"
-"4:\n\t"
-".L67:\n\t"
-"        addl $-64,%%ebx\n\t"
-"        addl $-128,%%ecx\n\t"
-"        addl $4,%%esi\n\t"
-"        decl %%ebp\n\t"
-"        jnz .L68\n\t"
-"        movl %%edi,%%eax\n\t"
-"        movl "MANGLE(saved_ebp)",%%ebp\n\t"
-        :"=a"(retval)
-        :"m"(bandPtr),"m"(channel),"m"(samples),"m"(tmp[0])
-        :"memory","%edi","%esi","%ebx","%ecx","%edx");
-  return retval;
-}
diff --git a/mplayer/mp3lib/decode_mmx.c b/mplayer/mp3lib/decode_mmx.c
deleted file mode 100644
index 3027657..0000000
--- a/mplayer/mp3lib/decode_mmx.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * this code comes under GPL
- * This code was taken from http://www.mpg123.org
- * See ChangeLog of mpg123-0.59s-pre.1 for detail
- * Applied to mplayer by Nick Kurshev <nickols_k at mail.ru>
- *
- * Local ChangeLog:
- * - Partial loops unrolling and removing MOVW insn from loops
-*/
-#include "config.h"
-#include "mangle.h"
-#include "mpg123.h"
-
-static const unsigned long long attribute_used __attribute__((aligned(8))) null_one = 0x0000ffff0000ffffULL;
-static const unsigned long long attribute_used __attribute__((aligned(8))) one_null = 0xffff0000ffff0000ULL;
-const unsigned int __attribute__((aligned(16))) costab_mmx[] =
-{
-    1056974725,
-    1057056395,
-    1057223771,
-    1057485416,
-    1057855544,
-    1058356026,
-    1059019886,
-    1059897405,
-    1061067246,
-    1062657950,
-    1064892987,
-    1066774581,
-    1069414683,
-    1073984175,
-    1079645762,
-    1092815430,
-    1057005197,
-    1057342072,
-    1058087743,
-    1059427869,
-    1061799040,
-    1065862217,
-    1071413542,
-    1084439708,
-    1057128951,
-    1058664893,
-    1063675095,
-    1076102863,
-    1057655764,
-    1067924853,
-    1060439283,
-};
-
-/**
-  This array of magic numbers were calculated by the pure function
-  make_decode_tables_MMX(32768), which had been implemented in (deleted since
-  r23383) tabinit_MMX.c.
-  */
-static const short __attribute__((aligned(8))) mp3lib_decwins[] =
-{
-        0,      7,     54,    114,    510,   1288,   1644,   9372,
-    18760,  -9373,   1644,  -1289,    510,   -115,     54,     -8,
-        0,      7,     54,    114,    510,   1288,   1644,   9372,
-    18760,  -9373,   1644,  -1289,    510,   -115,     54,     -8,
-        0,      7,     55,    129,    500,   1379,   1490,   9834,
-    18748,  -8910,   1784,  -1197,    516,   -101,     52,     -7,
-        0,      7,     55,    129,    500,   1379,   1490,   9834,
-    18748,  -8910,   1784,  -1197,    516,   -101,     52,     -7,
-        0,      8,     56,    145,    488,   1469,   1322,  10294,
-    18714,  -8448,   1910,  -1107,    520,    -87,     51,     -6,
-        0,      8,     56,    145,    488,   1469,   1322,  10294,
-    18714,  -8448,   1910,  -1107,    520,    -87,     51,     -6,
-        0,      9,     57,    161,    474,   1559,   1141,  10751,
-    18658,  -7987,   2023,  -1016,    522,    -74,     49,     -6,
-        0,      9,     57,    161,    474,   1559,   1141,  10751,
-    18658,  -7987,   2023,  -1016,    522,    -74,     49,     -6,
-        0,     10,     57,    177,    456,   1647,    944,  11205,
-    18579,  -7528,   2123,   -927,    522,    -61,     48,     -5,
-        0,     10,     57,    177,    456,   1647,    944,  11205,
-    18579,  -7528,   2123,   -927,    522,    -61,     48,     -5,
-        0,     11,     57,    194,    435,   1733,    734,  11654,
-    18477,  -7073,   2210,   -838,    519,    -50,     46,     -5,
-        0,     11,     57,    194,    435,   1733,    734,  11654,
-    18477,  -7073,   2210,   -838,    519,    -50,     46,     -5,
-        0,     12,     57,    212,    411,   1817,    510,  12097,
-    18354,  -6621,   2285,   -751,    515,    -39,     44,     -4,
-        0,     12,     57,    212,    411,   1817,    510,  12097,
-    18354,  -6621,   2285,   -751,    515,    -39,     44,     -4,
-        0,     13,     57,    229,    384,   1899,    271,  12534,
-    18209,  -6174,   2348,   -666,    508,    -28,     43,     -4,
-        0,     13,     57,    229,    384,   1899,    271,  12534,
-    18209,  -6174,   2348,   -666,    508,    -28,     43,     -4,
-        0,     14,     56,    247,    354,   1977,     18,  12963,
-    18043,  -5733,   2398,   -583,    501,    -18,     41,     -4,
-        0,     14,     56,    247,    354,   1977,     18,  12963,
-    18043,  -5733,   2398,   -583,    501,    -18,     41,     -4,
-        0,     15,     56,    266,    320,   2052,   -249,  13383,
-    17855,  -5298,   2438,   -502,    491,     -9,     39,     -3,
-        0,     15,     56,    266,    320,   2052,   -249,  13383,
-    17855,  -5298,   2438,   -502,    491,     -9,     39,     -3,
-        0,     17,     54,    284,    283,   2122,   -530,  13794,
-    17648,  -4870,   2466,   -423,    480,     -1,     37,     -3,
-        0,     17,     54,    284,    283,   2122,   -530,  13794,
-    17648,  -4870,   2466,   -423,    480,     -1,     37,     -3,
-        0,     18,     52,    302,    243,   2188,   -825,  14194,
-    17420,  -4450,   2484,   -347,    468,      7,     35,     -3,
-        0,     18,     52,    302,    243,   2188,   -825,  14194,
-    17420,  -4450,   2484,   -347,    468,      7,     35,     -3,
-        0,     19,     50,    320,    199,   2249,  -1133,  14583,
-    17173,  -4039,   2492,   -274,    455,     14,     33,     -2,
-        0,     19,     50,    320,    199,   2249,  -1133,  14583,
-    17173,  -4039,   2492,   -274,    455,     14,     33,     -2,
-       -1,     21,     48,    339,    152,   2304,  -1454,  14959,
-    16908,  -3637,   2490,   -204,    440,     20,     32,     -2,
-       -1,     21,     48,    339,    152,   2304,  -1454,  14959,
-    16908,  -3637,   2490,   -204,    440,     20,     32,     -2,
-       -1,     22,     45,    357,    101,   2354,  -1788,  15322,
-    16624,  -3245,   2479,   -137,    425,     26,     30,     -2,
-       -1,     22,     45,    357,    101,   2354,  -1788,  15322,
-    16624,  -3245,   2479,   -137,    425,     26,     30,     -2,
-       -1,     24,     41,    374,     47,   2396,  -2135,  15671,
-    16323,  -2864,   2460,    -72,    409,     31,     28,     -2,
-       -1,     24,     41,    374,     47,   2396,  -2135,  15671,
-    16323,  -2864,   2460,    -72,    409,     31,     28,     -2,
-       -1,     26,     37,    391,    -11,   2431,  -2493,  16004,
-    16005,  -2494,   2432,    -12,    392,     36,     26,     -2,
-       -1,     26,     37,    391,    -11,   2431,  -2493,  16004,
-    16005,  -2494,   2432,    -12,    392,     36,     26,     -2,
-       -2,    -28,     31,   -409,    -72,  -2460,  -2864, -16323,
-    15671,   2135,   2396,    -47,    374,    -41,     24,      1,
-       -2,    -28,     31,   -409,    -72,  -2460,  -2864, -16323,
-    15671,   2135,   2396,    -47,    374,    -41,     24,      1,
-       -2,    -30,     26,   -425,   -137,  -2479,  -3245, -16624,
-    15322,   1788,   2354,   -101,    357,    -45,     22,      1,
-       -2,    -30,     26,   -425,   -137,  -2479,  -3245, -16624,
-    15322,   1788,   2354,   -101,    357,    -45,     22,      1,
-       -2,    -32,     20,   -440,   -204,  -2490,  -3637, -16908,
-    14959,   1454,   2304,   -152,    339,    -48,     21,      1,
-       -2,    -32,     20,   -440,   -204,  -2490,  -3637, -16908,
-    14959,   1454,   2304,   -152,    339,    -48,     21,      1,
-       -2,    -33,     14,   -455,   -274,  -2492,  -4039, -17173,
-    14583,   1133,   2249,   -199,    320,    -50,     19,      0,
-       -2,    -33,     14,   -455,   -274,  -2492,  -4039, -17173,
-    14583,   1133,   2249,   -199,    320,    -50,     19,      0,
-       -3,    -35,      7,   -468,   -347,  -2484,  -4450, -17420,
-    14194,    825,   2188,   -243,    302,    -52,     18,      0,
-       -3,    -35,      7,   -468,   -347,  -2484,  -4450, -17420,
-    14194,    825,   2188,   -243,    302,    -52,     18,      0,
-       -3,    -37,     -1,   -480,   -423,  -2466,  -4870, -17648,
-    13794,    530,   2122,   -283,    284,    -54,     17,      0,
-       -3,    -37,     -1,   -480,   -423,  -2466,  -4870, -17648,
-    13794,    530,   2122,   -283,    284,    -54,     17,      0,
-       -3,    -39,     -9,   -491,   -502,  -2438,  -5298, -17855,
-    13383,    249,   2052,   -320,    266,    -56,     15,      0,
-       -3,    -39,     -9,   -491,   -502,  -2438,  -5298, -17855,
-    13383,    249,   2052,   -320,    266,    -56,     15,      0,
-       -4,    -41,    -18,   -501,   -583,  -2398,  -5733, -18043,
-    12963,    -18,   1977,   -354,    247,    -56,     14,      0,
-       -4,    -41,    -18,   -501,   -583,  -2398,  -5733, -18043,
-    12963,    -18,   1977,   -354,    247,    -56,     14,      0,
-       -4,    -43,    -28,   -508,   -666,  -2348,  -6174, -18209,
-    12534,   -271,   1899,   -384,    229,    -57,     13,      0,
-       -4,    -43,    -28,   -508,   -666,  -2348,  -6174, -18209,
-    12534,   -271,   1899,   -384,    229,    -57,     13,      0,
-       -4,    -44,    -39,   -515,   -751,  -2285,  -6621, -18354,
-    12097,   -510,   1817,   -411,    212,    -57,     12,      0,
-       -4,    -44,    -39,   -515,   -751,  -2285,  -6621, -18354,
-    12097,   -510,   1817,   -411,    212,    -57,     12,      0,
-       -5,    -46,    -50,   -519,   -838,  -2210,  -7073, -18477,
-    11654,   -734,   1733,   -435,    194,    -57,     11,      0,
-       -5,    -46,    -50,   -519,   -838,  -2210,  -7073, -18477,
-    11654,   -734,   1733,   -435,    194,    -57,     11,      0,
-       -5,    -48,    -61,   -522,   -927,  -2123,  -7528, -18579,
-    11205,   -944,   1647,   -456,    177,    -57,     10,      0,
-       -5,    -48,    -61,   -522,   -927,  -2123,  -7528, -18579,
-    11205,   -944,   1647,   -456,    177,    -57,     10,      0,
-       -6,    -49,    -74,   -522,  -1016,  -2023,  -7987, -18658,
-    10751,  -1141,   1559,   -474,    161,    -57,      9,      0,
-       -6,    -49,    -74,   -522,  -1016,  -2023,  -7987, -18658,
-    10751,  -1141,   1559,   -474,    161,    -57,      9,      0,
-       -6,    -51,    -87,   -520,  -1107,  -1910,  -8448, -18714,
-    10294,  -1322,   1469,   -488,    145,    -56,      8,      0,
-       -6,    -51,    -87,   -520,  -1107,  -1910,  -8448, -18714,
-    10294,  -1322,   1469,   -488,    145,    -56,      8,      0,
-       -7,    -52,   -101,   -516,  -1197,  -1784,  -8910, -18748,
-     9834,  -1490,   1379,   -500,    129,    -55,      7,      0,
-       -7,    -52,   -101,   -516,  -1197,  -1784,  -8910, -18748,
-     9834,  -1490,   1379,   -500,    129,    -55,      7,      0,
-};
-
-int synth_1to1_MMX(real *bandPtr, int channel, short *samples)
-{
-    static short buffs[2][2][0x110] __attribute__((aligned(8)));
-    static int bo = 1;
-    short *b0, (*buf)[0x110], *a, *b;
-    const short* window;
-    int bo1, i = 8;
-
-    if (channel == 0) {
-        bo = (bo - 1) & 0xf;
-        buf = buffs[1];
-    } else {
-        samples++;
-        buf = buffs[0];
-    }
-
-    if (bo & 1) {
-        b0 = buf[1];
-        bo1 = bo + 1;
-        a = buf[0] + bo;
-        b = buf[1] + ((bo + 1) & 0xf);
-    } else {
-        b0 = buf[0];
-        bo1 = bo;
-        b = buf[0] + bo;
-        a = buf[1] + ((bo + 1) & 0xf);
-    }
-
-    dct64_MMX_func(a, b, bandPtr);
-    window = mp3lib_decwins + 16 - bo1;
-    //printf("DEBUG: channel %d, bo %d, off %d\n", channel, bo, 16 - bo1);
-__asm__ volatile(
-ASMALIGN(4)
-"0:\n\t"
-        "movq  (%1),%%mm0\n\t"
-        "movq  64(%1),%%mm4\n\t"
-        "pmaddwd (%2),%%mm0\n\t"
-        "pmaddwd 32(%2),%%mm4\n\t"
-        "movq  8(%1),%%mm1\n\t"
-        "movq  72(%1),%%mm5\n\t"
-        "pmaddwd 8(%2),%%mm1\n\t"
-        "pmaddwd 40(%2),%%mm5\n\t"
-        "movq  16(%1),%%mm2\n\t"
-        "movq  80(%1),%%mm6\n\t"
-        "pmaddwd 16(%2),%%mm2\n\t"
-        "pmaddwd 48(%2),%%mm6\n\t"
-        "movq  24(%1),%%mm3\n\t"
-        "movq  88(%1),%%mm7\n\t"
-        "pmaddwd 24(%2),%%mm3\n\t"
-        "pmaddwd 56(%2),%%mm7\n\t"
-        "paddd %%mm1,%%mm0\n\t"
-        "paddd %%mm5,%%mm4\n\t"
-        "paddd %%mm2,%%mm0\n\t"
-        "paddd %%mm6,%%mm4\n\t"
-        "paddd %%mm3,%%mm0\n\t"
-        "paddd %%mm7,%%mm4\n\t"
-        "movq  %%mm0,%%mm1\n\t"
-        "movq  %%mm4,%%mm5\n\t"
-        "psrlq $32,%%mm1\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "paddd %%mm1,%%mm0\n\t"
-        "paddd %%mm5,%%mm4\n\t"
-        "psrad $13,%%mm0\n\t"
-        "psrad $13,%%mm4\n\t"
-        "packssdw %%mm0,%%mm0\n\t"
-        "packssdw %%mm4,%%mm4\n\t"
-
-        "movq   (%3), %%mm1\n\t"
-        "punpckldq %%mm4, %%mm0\n\t"
-        "pand   "MANGLE(one_null)", %%mm1\n\t"
-        "pand   "MANGLE(null_one)", %%mm0\n\t"
-        "por    %%mm0, %%mm1\n\t"
-        "movq   %%mm1,(%3)\n\t"
-
-        "add $64,%2\n\t"
-        "add $128,%1\n\t"
-        "add $8,%3\n\t"
-
-        "decl %0\n\t"
-        "jnz  0b\n\t"
-
-        "movq  (%1),%%mm0\n\t"
-        "pmaddwd (%2),%%mm0\n\t"
-        "movq  8(%1),%%mm1\n\t"
-        "pmaddwd 8(%2),%%mm1\n\t"
-        "movq  16(%1),%%mm2\n\t"
-        "pmaddwd 16(%2),%%mm2\n\t"
-        "movq  24(%1),%%mm3\n\t"
-        "pmaddwd 24(%2),%%mm3\n\t"
-        "paddd %%mm1,%%mm0\n\t"
-        "paddd %%mm2,%%mm0\n\t"
-        "paddd %%mm3,%%mm0\n\t"
-        "movq  %%mm0,%%mm1\n\t"
-        "psrlq $32,%%mm1\n\t"
-        "paddd %%mm1,%%mm0\n\t"
-        "psrad $13,%%mm0\n\t"
-        "packssdw %%mm0,%%mm0\n\t"
-        "movd %%mm0,%%eax\n\t"
-        "movw %%ax, (%3)\n\t"
-        "sub $32,%2\n\t"
-        "add $64,%1\n\t"
-        "add $4,%3\n\t"
-
-        "movl $7,%0\n\t"
-ASMALIGN(4)
-"1:\n\t"
-        "movq  (%1),%%mm0\n\t"
-        "movq  64(%1),%%mm4\n\t"
-        "pmaddwd (%2),%%mm0\n\t"
-        "pmaddwd -32(%2),%%mm4\n\t"
-        "movq  8(%1),%%mm1\n\t"
-        "movq  72(%1),%%mm5\n\t"
-        "pmaddwd 8(%2),%%mm1\n\t"
-        "pmaddwd -24(%2),%%mm5\n\t"
-        "movq  16(%1),%%mm2\n\t"
-        "movq  80(%1),%%mm6\n\t"
-        "pmaddwd 16(%2),%%mm2\n\t"
-        "pmaddwd -16(%2),%%mm6\n\t"
-        "movq  24(%1),%%mm3\n\t"
-        "movq  88(%1),%%mm7\n\t"
-        "pmaddwd 24(%2),%%mm3\n\t"
-        "pmaddwd -8(%2),%%mm7\n\t"
-        "paddd %%mm1,%%mm0\n\t"
-        "paddd %%mm5,%%mm4\n\t"
-        "paddd %%mm2,%%mm0\n\t"
-        "paddd %%mm6,%%mm4\n\t"
-        "paddd %%mm3,%%mm0\n\t"
-        "paddd %%mm7,%%mm4\n\t"
-        "movq  %%mm0,%%mm1\n\t"
-        "movq  %%mm4,%%mm5\n\t"
-        "psrlq $32,%%mm1\n\t"
-        "psrlq $32,%%mm5\n\t"
-        "paddd %%mm0,%%mm1\n\t"
-        "paddd %%mm4,%%mm5\n\t"
-        "psrad $13,%%mm1\n\t"
-        "psrad $13,%%mm5\n\t"
-        "packssdw %%mm1,%%mm1\n\t"
-        "packssdw %%mm5,%%mm5\n\t"
-        "psubd %%mm0,%%mm0\n\t"
-        "psubd %%mm4,%%mm4\n\t"
-        "psubsw %%mm1,%%mm0\n\t"
-        "psubsw %%mm5,%%mm4\n\t"
-
-        "movq   (%3), %%mm1\n\t"
-        "punpckldq %%mm4, %%mm0\n\t"
-        "pand   "MANGLE(one_null)", %%mm1\n\t"
-        "pand   "MANGLE(null_one)", %%mm0\n\t"
-        "por    %%mm0, %%mm1\n\t"
-        "movq   %%mm1,(%3)\n\t"
-
-        "sub $64,%2\n\t"
-        "add $128,%1\n\t"
-        "add $8,%3\n\t"
-        "decl %0\n\t"
-        "jnz  1b\n\t"
-
-        "movq  (%1),%%mm0\n\t"
-        "pmaddwd (%2),%%mm0\n\t"
-        "movq  8(%1),%%mm1\n\t"
-        "pmaddwd 8(%2),%%mm1\n\t"
-        "movq  16(%1),%%mm2\n\t"
-        "pmaddwd 16(%2),%%mm2\n\t"
-        "movq  24(%1),%%mm3\n\t"
-        "pmaddwd 24(%2),%%mm3\n\t"
-        "paddd %%mm1,%%mm0\n\t"
-        "paddd %%mm2,%%mm0\n\t"
-        "paddd %%mm3,%%mm0\n\t"
-        "movq  %%mm0,%%mm1\n\t"
-        "psrlq $32,%%mm1\n\t"
-        "paddd %%mm0,%%mm1\n\t"
-        "psrad $13,%%mm1\n\t"
-        "packssdw %%mm1,%%mm1\n\t"
-        "psubd %%mm0,%%mm0\n\t"
-        "psubsw %%mm1,%%mm0\n\t"
-        "movd %%mm0,%%eax\n\t"
-        "movw %%ax,(%3)\n\t"
-        "emms\n\t"
-        :"+r"(i), "+r"(window), "+r"(b0), "+r"(samples)
-        :
-        :"memory", "%eax");
-    return 0;
-}
diff --git a/mplayer/mp3lib/equalizer.c b/mplayer/mp3lib/equalizer.c
deleted file mode 100644
index 1c1a3f3..0000000
--- a/mplayer/mp3lib/equalizer.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "mpg123.h"
-
-void init_spline(float *x, float *y, int n, float *y2)
-{
-    int i, k;
-    float p, qn, sig, un, *u;
-    u = malloc(n * sizeof (float));
-
-    y2[0] = u[0] = 0.0;
-
-    for (i = 1; i < n - 1; i++)
-    {
-        sig = ((float) x[i] - x[i - 1]) / ((float) x[i + 1] - x[i - 1]);
-        p = sig * y2[i - 1] + 2.0;
-        y2[i] = (sig - 1.0) / p;
-        u[i] = (((float) y[i + 1] - y[i]) / (x[i + 1] - x[i])) -
-               (((float) y[i] - y[i - 1]) / (x[i] - x[i - 1]));
-        u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
-    }
-    qn = un = 0.0;
-
-    y2[n - 1] = (un - qn * u[n - 2]) / (qn * y2[n - 2] + 1.0);
-    for (k = n - 2; k >= 0; k--)
-        y2[k] = y2[k] * y2[k + 1] + u[k];
-    free(u);
-}
-
-float eval_spline(float xa[], float ya[], float y2a[], int n, float x)
-{
-    int klo, khi, k;
-    float h, b, a;
-
-    klo = 0;
-    khi = n - 1;
-    while (khi - klo > 1)
-    {
-        k = (khi + klo) >> 1;
-        if (xa[k] > x)
-            khi = k;
-        else
-            klo = k;
-    }
-    h = xa[khi] - xa[klo];
-    a = (xa[khi] - x) / h;
-    b = (x - xa[klo]) / h;
-    return (a * ya[klo] + b * ya[khi] + ((a * a * a - a) * y2a[klo] + (b * b * b - b) * y2a[khi])
-            * (h * h) / 6.0);
-}
-
-void mpg123_set_eq(int on, float preamp, float *b)
-{
-    float x[] =
-    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, yf[10], val, band[10];
-    int bands[] =
-    {0, 4, 8, 16, 26, 78, 157, 313, 366, 418};
-    int i, j;
-
-    mpg123_info->eq_active = on;
-    if (mpg123_info->eq_active)
-    {
-        for (i = 0; i < 10; i++)
-        {
-            band[i] = b[i] + preamp;
-        }
-
-        init_spline(x, band, 10, yf);
-        for (i = 0; i < 9; i++)
-        {
-            for (j = bands[i]; j < bands[i + 1]; j++)
-            {
-                val = eval_spline(x, band, yf, 10, i + ((float) (j - bands[i]) * (1.0 / (bands[i + 1] - bands[i]))));
-                mpg123_info->eq_mul[j] = pow(2, val / 10.0);
-            }
-        }
-        for (i = bands[9]; i < 576; i++)
-            mpg123_info->eq_mul[i] = mpg123_info->eq_mul[bands[9] - 1];
-    }
-}
diff --git a/mplayer/mp3lib/huffman.h b/mplayer/mp3lib/huffman.h
deleted file mode 100644
index 190775d..0000000
--- a/mplayer/mp3lib/huffman.h
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * huffman tables ... recalcualted to work with my optimzed
- * decoder scheme (MH)
- *
- * probably we could save a few bytes of memory, because the
- * smaller tables are often the part of a bigger table
- */
-
-#ifndef MPLAYER_MP3LIB_HUFFMAN_H
-#define MPLAYER_MP3LIB_HUFFMAN_H
-
-struct newhuff
-{
-  unsigned int linbits;
-  short *table;
-};
-
-static short tab0[] =
-{
-   0
-};
-
-static short tab1[] =
-{
-  -5,  -3,  -1,  17,   1,  16,   0
-};
-
-static short tab2[] =
-{
- -15, -11,  -9,  -5,  -3,  -1,  34,   2,  18,  -1,  33,  32,  17,  -1,   1,
-  16,   0
-};
-
-static short tab3[] =
-{
- -13, -11,  -9,  -5,  -3,  -1,  34,   2,  18,  -1,  33,  32,  16,  17,  -1,
-   1,   0
-};
-
-static short tab5[] =
-{
- -29, -25, -23, -15,  -7,  -5,  -3,  -1,  51,  35,  50,  49,  -3,  -1,  19,
-   3,  -1,  48,  34,  -3,  -1,  18,  33,  -1,   2,  32,  17,  -1,   1,  16,
-   0
-};
-
-static short tab6[] =
-{
- -25, -19, -13,  -9,  -5,  -3,  -1,  51,   3,  35,  -1,  50,  48,  -1,  19,
-  49,  -3,  -1,  34,   2,  18,  -3,  -1,  33,  32,   1,  -1,  17,  -1,  16,
-   0
-};
-
-static short tab7[] =
-{
- -69, -65, -57, -39, -29, -17, -11,  -7,  -3,  -1,  85,  69,  -1,  84,  83,
-  -1,  53,  68,  -3,  -1,  37,  82,  21,  -5,  -1,  81,  -1,   5,  52,  -1,
-  80,  -1,  67,  51,  -5,  -3,  -1,  36,  66,  20,  -1,  65,  64, -11,  -7,
-  -3,  -1,   4,  35,  -1,  50,   3,  -1,  19,  49,  -3,  -1,  48,  34,  18,
-  -5,  -1,  33,  -1,   2,  32,  17,  -1,   1,  16,   0
-};
-
-static short tab8[] =
-{
- -65, -63, -59, -45, -31, -19, -13,  -7,  -5,  -3,  -1,  85,  84,  69,  83,
-  -3,  -1,  53,  68,  37,  -3,  -1,  82,   5,  21,  -5,  -1,  81,  -1,  52,
-  67,  -3,  -1,  80,  51,  36,  -5,  -3,  -1,  66,  20,  65,  -3,  -1,   4,
-  64,  -1,  35,  50,  -9,  -7,  -3,  -1,  19,  49,  -1,   3,  48,  34,  -1,
-   2,  32,  -1,  18,  33,  17,  -3,  -1,   1,  16,   0
-};
-
-static short tab9[] =
-{
- -63, -53, -41, -29, -19, -11,  -5,  -3,  -1,  85,  69,  53,  -1,  83,  -1,
-  84,   5,  -3,  -1,  68,  37,  -1,  82,  21,  -3,  -1,  81,  52,  -1,  67,
-  -1,  80,   4,  -7,  -3,  -1,  36,  66,  -1,  51,  64,  -1,  20,  65,  -5,
-  -3,  -1,  35,  50,  19,  -1,  49,  -1,   3,  48,  -5,  -3,  -1,  34,   2,
-  18,  -1,  33,  32,  -3,  -1,  17,   1,  -1,  16,   0
-};
-
-static short tab10[] =
-{
--125,-121,-111, -83, -55, -35, -21, -13,  -7,  -3,  -1, 119, 103,  -1, 118,
-  87,  -3,  -1, 117, 102,  71,  -3,  -1, 116,  86,  -1, 101,  55,  -9,  -3,
-  -1, 115,  70,  -3,  -1,  85,  84,  99,  -1,  39, 114, -11,  -5,  -3,  -1,
- 100,   7, 112,  -1,  98,  -1,  69,  53,  -5,  -1,   6,  -1,  83,  68,  23,
- -17,  -5,  -1, 113,  -1,  54,  38,  -5,  -3,  -1,  37,  82,  21,  -1,  81,
-  -1,  52,  67,  -3,  -1,  22,  97,  -1,  96,  -1,   5,  80, -19, -11,  -7,
-  -3,  -1,  36,  66,  -1,  51,   4,  -1,  20,  65,  -3,  -1,  64,  35,  -1,
-  50,   3,  -3,  -1,  19,  49,  -1,  48,  34,  -7,  -3,  -1,  18,  33,  -1,
-   2,  32,  17,  -1,   1,  16,   0
-};
-
-static short tab11[] =
-{
--121,-113, -89, -59, -43, -27, -17,  -7,  -3,  -1, 119, 103,  -1, 118, 117,
-  -3,  -1, 102,  71,  -1, 116,  -1,  87,  85,  -5,  -3,  -1,  86, 101,  55,
-  -1, 115,  70,  -9,  -7,  -3,  -1,  69,  84,  -1,  53,  83,  39,  -1, 114,
-  -1, 100,   7,  -5,  -1, 113,  -1,  23, 112,  -3,  -1,  54,  99,  -1,  96,
-  -1,  68,  37, -13,  -7,  -5,  -3,  -1,  82,   5,  21,  98,  -3,  -1,  38,
-   6,  22,  -5,  -1,  97,  -1,  81,  52,  -5,  -1,  80,  -1,  67,  51,  -1,
-  36,  66, -15, -11,  -7,  -3,  -1,  20,  65,  -1,   4,  64,  -1,  35,  50,
-  -1,  19,  49,  -5,  -3,  -1,   3,  48,  34,  33,  -5,  -1,  18,  -1,   2,
-  32,  17,  -3,  -1,   1,  16,   0
-};
-
-static short tab12[] =
-{
--115, -99, -73, -45, -27, -17,  -9,  -5,  -3,  -1, 119, 103, 118,  -1,  87,
- 117,  -3,  -1, 102,  71,  -1, 116, 101,  -3,  -1,  86,  55,  -3,  -1, 115,
-  85,  39,  -7,  -3,  -1, 114,  70,  -1, 100,  23,  -5,  -1, 113,  -1,   7,
- 112,  -1,  54,  99, -13,  -9,  -3,  -1,  69,  84,  -1,  68,  -1,   6,   5,
-  -1,  38,  98,  -5,  -1,  97,  -1,  22,  96,  -3,  -1,  53,  83,  -1,  37,
-  82, -17,  -7,  -3,  -1,  21,  81,  -1,  52,  67,  -5,  -3,  -1,  80,   4,
-  36,  -1,  66,  20,  -3,  -1,  51,  65,  -1,  35,  50, -11,  -7,  -5,  -3,
-  -1,  64,   3,  48,  19,  -1,  49,  34,  -1,  18,  33,  -7,  -5,  -3,  -1,
-   2,  32,   0,  17,  -1,   1,  16
-};
-
-static short tab13[] =
-{
--509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13,  -9,
-  -7,  -5,  -3,  -1, 254, 252, 253, 237, 255,  -1, 239, 223,  -3,  -1, 238,
- 207,  -1, 222, 191,  -9,  -3,  -1, 251, 206,  -1, 220,  -1, 175, 233,  -1,
- 236, 221,  -9,  -5,  -3,  -1, 250, 205, 190,  -1, 235, 159,  -3,  -1, 249,
- 234,  -1, 189, 219, -17,  -9,  -3,  -1, 143, 248,  -1, 204,  -1, 174, 158,
-  -5,  -1, 142,  -1, 127, 126, 247,  -5,  -1, 218,  -1, 173, 188,  -3,  -1,
- 203, 246, 111, -15,  -7,  -3,  -1, 232,  95,  -1, 157, 217,  -3,  -1, 245,
- 231,  -1, 172, 187,  -9,  -3,  -1,  79, 244,  -3,  -1, 202, 230, 243,  -1,
-  63,  -1, 141, 216, -21,  -9,  -3,  -1,  47, 242,  -3,  -1, 110, 156,  15,
-  -5,  -3,  -1, 201,  94, 171,  -3,  -1, 125, 215,  78, -11,  -5,  -3,  -1,
- 200, 214,  62,  -1, 185,  -1, 155, 170,  -1,  31, 241, -23, -13,  -5,  -1,
- 240,  -1, 186, 229,  -3,  -1, 228, 140,  -1, 109, 227,  -5,  -1, 226,  -1,
-  46,  14,  -1,  30, 225, -15,  -7,  -3,  -1, 224,  93,  -1, 213, 124,  -3,
-  -1, 199,  77,  -1, 139, 184,  -7,  -3,  -1, 212, 154,  -1, 169, 108,  -1,
- 198,  61, -37, -21,  -9,  -5,  -3,  -1, 211, 123,  45,  -1, 210,  29,  -5,
-  -1, 183,  -1,  92, 197,  -3,  -1, 153, 122, 195,  -7,  -5,  -3,  -1, 167,
- 151,  75, 209,  -3,  -1,  13, 208,  -1, 138, 168, -11,  -7,  -3,  -1,  76,
- 196,  -1, 107, 182,  -1,  60,  44,  -3,  -1, 194,  91,  -3,  -1, 181, 137,
-  28, -43, -23, -11,  -5,  -1, 193,  -1, 152,  12,  -1, 192,  -1, 180, 106,
-  -5,  -3,  -1, 166, 121,  59,  -1, 179,  -1, 136,  90, -11,  -5,  -1,  43,
-  -1, 165, 105,  -1, 164,  -1, 120, 135,  -5,  -1, 148,  -1, 119, 118, 178,
- -11,  -3,  -1,  27, 177,  -3,  -1,  11, 176,  -1, 150,  74,  -7,  -3,  -1,
-  58, 163,  -1,  89, 149,  -1,  42, 162, -47, -23,  -9,  -3,  -1,  26, 161,
-  -3,  -1,  10, 104, 160,  -5,  -3,  -1, 134,  73, 147,  -3,  -1,  57,  88,
-  -1, 133, 103,  -9,  -3,  -1,  41, 146,  -3,  -1,  87, 117,  56,  -5,  -1,
- 131,  -1, 102,  71,  -3,  -1, 116,  86,  -1, 101, 115, -11,  -3,  -1,  25,
- 145,  -3,  -1,   9, 144,  -1,  72, 132,  -7,  -5,  -1, 114,  -1,  70, 100,
-  40,  -1, 130,  24, -41, -27, -11,  -5,  -3,  -1,  55,  39,  23,  -1, 113,
-  -1,  85,   7,  -7,  -3,  -1, 112,  54,  -1,  99,  69,  -3,  -1,  84,  38,
-  -1,  98,  53,  -5,  -1, 129,  -1,   8, 128,  -3,  -1,  22,  97,  -1,   6,
-  96, -13,  -9,  -5,  -3,  -1,  83,  68,  37,  -1,  82,   5,  -1,  21,  81,
-  -7,  -3,  -1,  52,  67,  -1,  80,  36,  -3,  -1,  66,  51,  20, -19, -11,
-  -5,  -1,  65,  -1,   4,  64,  -3,  -1,  35,  50,  19,  -3,  -1,  49,   3,
-  -1,  48,  34,  -3,  -1,  18,  33,  -1,   2,  32,  -3,  -1,  17,   1,  16,
-   0
-};
-
-static short tab15[] =
-{
--495,-445,-355,-263,-183,-115, -77, -43, -27, -13,  -7,  -3,  -1, 255, 239,
-  -1, 254, 223,  -1, 238,  -1, 253, 207,  -7,  -3,  -1, 252, 222,  -1, 237,
- 191,  -1, 251,  -1, 206, 236,  -7,  -3,  -1, 221, 175,  -1, 250, 190,  -3,
-  -1, 235, 205,  -1, 220, 159, -15,  -7,  -3,  -1, 249, 234,  -1, 189, 219,
-  -3,  -1, 143, 248,  -1, 204, 158,  -7,  -3,  -1, 233, 127,  -1, 247, 173,
-  -3,  -1, 218, 188,  -1, 111,  -1, 174,  15, -19, -11,  -3,  -1, 203, 246,
-  -3,  -1, 142, 232,  -1,  95, 157,  -3,  -1, 245, 126,  -1, 231, 172,  -9,
-  -3,  -1, 202, 187,  -3,  -1, 217, 141,  79,  -3,  -1, 244,  63,  -1, 243,
- 216, -33, -17,  -9,  -3,  -1, 230,  47,  -1, 242,  -1, 110, 240,  -3,  -1,
-  31, 241,  -1, 156, 201,  -7,  -3,  -1,  94, 171,  -1, 186, 229,  -3,  -1,
- 125, 215,  -1,  78, 228, -15,  -7,  -3,  -1, 140, 200,  -1,  62, 109,  -3,
-  -1, 214, 227,  -1, 155, 185,  -7,  -3,  -1,  46, 170,  -1, 226,  30,  -5,
-  -1, 225,  -1,  14, 224,  -1,  93, 213, -45, -25, -13,  -7,  -3,  -1, 124,
- 199,  -1,  77, 139,  -1, 212,  -1, 184, 154,  -7,  -3,  -1, 169, 108,  -1,
- 198,  61,  -1, 211, 210,  -9,  -5,  -3,  -1,  45,  13,  29,  -1, 123, 183,
-  -5,  -1, 209,  -1,  92, 208,  -1, 197, 138, -17,  -7,  -3,  -1, 168,  76,
-  -1, 196, 107,  -5,  -1, 182,  -1, 153,  12,  -1,  60, 195,  -9,  -3,  -1,
- 122, 167,  -1, 166,  -1, 192,  11,  -1, 194,  -1,  44,  91, -55, -29, -15,
-  -7,  -3,  -1, 181,  28,  -1, 137, 152,  -3,  -1, 193,  75,  -1, 180, 106,
-  -5,  -3,  -1,  59, 121, 179,  -3,  -1, 151, 136,  -1,  43,  90, -11,  -5,
-  -1, 178,  -1, 165,  27,  -1, 177,  -1, 176, 105,  -7,  -3,  -1, 150,  74,
-  -1, 164, 120,  -3,  -1, 135,  58, 163, -17,  -7,  -3,  -1,  89, 149,  -1,
-  42, 162,  -3,  -1,  26, 161,  -3,  -1,  10, 160, 104,  -7,  -3,  -1, 134,
-  73,  -1, 148,  57,  -5,  -1, 147,  -1, 119,   9,  -1,  88, 133, -53, -29,
- -13,  -7,  -3,  -1,  41, 103,  -1, 118, 146,  -1, 145,  -1,  25, 144,  -7,
-  -3,  -1,  72, 132,  -1,  87, 117,  -3,  -1,  56, 131,  -1, 102,  71,  -7,
-  -3,  -1,  40, 130,  -1,  24, 129,  -7,  -3,  -1, 116,   8,  -1, 128,  86,
-  -3,  -1, 101,  55,  -1, 115,  70, -17,  -7,  -3,  -1,  39, 114,  -1, 100,
-  23,  -3,  -1,  85, 113,  -3,  -1,   7, 112,  54,  -7,  -3,  -1,  99,  69,
-  -1,  84,  38,  -3,  -1,  98,  22,  -3,  -1,   6,  96,  53, -33, -19,  -9,
-  -5,  -1,  97,  -1,  83,  68,  -1,  37,  82,  -3,  -1,  21,  81,  -3,  -1,
-   5,  80,  52,  -7,  -3,  -1,  67,  36,  -1,  66,  51,  -1,  65,  -1,  20,
-   4,  -9,  -3,  -1,  35,  50,  -3,  -1,  64,   3,  19,  -3,  -1,  49,  48,
-  34,  -9,  -7,  -3,  -1,  18,  33,  -1,   2,  32,  17,  -3,  -1,   1,  16,
-   0
-};
-
-static short tab16[] =
-{
--509,-503,-461,-323,-103, -37, -27, -15,  -7,  -3,  -1, 239, 254,  -1, 223,
- 253,  -3,  -1, 207, 252,  -1, 191, 251,  -5,  -1, 175,  -1, 250, 159,  -3,
-  -1, 249, 248, 143,  -7,  -3,  -1, 127, 247,  -1, 111, 246, 255,  -9,  -5,
-  -3,  -1,  95, 245,  79,  -1, 244, 243, -53,  -1, 240,  -1,  63, -29, -19,
- -13,  -7,  -5,  -1, 206,  -1, 236, 221, 222,  -1, 233,  -1, 234, 217,  -1,
- 238,  -1, 237, 235,  -3,  -1, 190, 205,  -3,  -1, 220, 219, 174, -11,  -5,
-  -1, 204,  -1, 173, 218,  -3,  -1, 126, 172, 202,  -5,  -3,  -1, 201, 125,
-  94, 189, 242, -93,  -5,  -3,  -1,  47,  15,  31,  -1, 241, -49, -25, -13,
-  -5,  -1, 158,  -1, 188, 203,  -3,  -1, 142, 232,  -1, 157, 231,  -7,  -3,
-  -1, 187, 141,  -1, 216, 110,  -1, 230, 156, -13,  -7,  -3,  -1, 171, 186,
-  -1, 229, 215,  -1,  78,  -1, 228, 140,  -3,  -1, 200,  62,  -1, 109,  -1,
- 214, 155, -19, -11,  -5,  -3,  -1, 185, 170, 225,  -1, 212,  -1, 184, 169,
-  -5,  -1, 123,  -1, 183, 208, 227,  -7,  -3,  -1,  14, 224,  -1,  93, 213,
-  -3,  -1, 124, 199,  -1,  77, 139, -75, -45, -27, -13,  -7,  -3,  -1, 154,
- 108,  -1, 198,  61,  -3,  -1,  92, 197,  13,  -7,  -3,  -1, 138, 168,  -1,
- 153,  76,  -3,  -1, 182, 122,  60, -11,  -5,  -3,  -1,  91, 137,  28,  -1,
- 192,  -1, 152, 121,  -1, 226,  -1,  46,  30, -15,  -7,  -3,  -1, 211,  45,
-  -1, 210, 209,  -5,  -1,  59,  -1, 151, 136,  29,  -7,  -3,  -1, 196, 107,
-  -1, 195, 167,  -1,  44,  -1, 194, 181, -23, -13,  -7,  -3,  -1, 193,  12,
-  -1,  75, 180,  -3,  -1, 106, 166, 179,  -5,  -3,  -1,  90, 165,  43,  -1,
- 178,  27, -13,  -5,  -1, 177,  -1,  11, 176,  -3,  -1, 105, 150,  -1,  74,
- 164,  -5,  -3,  -1, 120, 135, 163,  -3,  -1,  58,  89,  42, -97, -57, -33,
- -19, -11,  -5,  -3,  -1, 149, 104, 161,  -3,  -1, 134, 119, 148,  -5,  -3,
-  -1,  73,  87, 103, 162,  -5,  -1,  26,  -1,  10, 160,  -3,  -1,  57, 147,
-  -1,  88, 133,  -9,  -3,  -1,  41, 146,  -3,  -1, 118,   9,  25,  -5,  -1,
- 145,  -1, 144,  72,  -3,  -1, 132, 117,  -1,  56, 131, -21, -11,  -5,  -3,
-  -1, 102,  40, 130,  -3,  -1,  71, 116,  24,  -3,  -1, 129, 128,  -3,  -1,
-   8,  86,  55,  -9,  -5,  -1, 115,  -1, 101,  70,  -1,  39, 114,  -5,  -3,
-  -1, 100,  85,   7,  23, -23, -13,  -5,  -1, 113,  -1, 112,  54,  -3,  -1,
-  99,  69,  -1,  84,  38,  -3,  -1,  98,  22,  -1,  97,  -1,   6,  96,  -9,
-  -5,  -1,  83,  -1,  53,  68,  -1,  37,  82,  -1,  81,  -1,  21,   5, -33,
- -23, -13,  -7,  -3,  -1,  52,  67,  -1,  80,  36,  -3,  -1,  66,  51,  20,
-  -5,  -1,  65,  -1,   4,  64,  -1,  35,  50,  -3,  -1,  19,  49,  -3,  -1,
-   3,  48,  34,  -3,  -1,  18,  33,  -1,   2,  32,  -3,  -1,  17,   1,  16,
-   0
-};
-
-static short tab24[] =
-{
--451,-117, -43, -25, -15,  -7,  -3,  -1, 239, 254,  -1, 223, 253,  -3,  -1,
- 207, 252,  -1, 191, 251,  -5,  -1, 250,  -1, 175, 159,  -1, 249, 248,  -9,
-  -5,  -3,  -1, 143, 127, 247,  -1, 111, 246,  -3,  -1,  95, 245,  -1,  79,
- 244, -71,  -7,  -3,  -1,  63, 243,  -1,  47, 242,  -5,  -1, 241,  -1,  31,
- 240, -25,  -9,  -1,  15,  -3,  -1, 238, 222,  -1, 237, 206,  -7,  -3,  -1,
- 236, 221,  -1, 190, 235,  -3,  -1, 205, 220,  -1, 174, 234, -15,  -7,  -3,
-  -1, 189, 219,  -1, 204, 158,  -3,  -1, 233, 173,  -1, 218, 188,  -7,  -3,
-  -1, 203, 142,  -1, 232, 157,  -3,  -1, 217, 126,  -1, 231, 172, 255,-235,
--143, -77, -45, -25, -15,  -7,  -3,  -1, 202, 187,  -1, 141, 216,  -5,  -3,
-  -1,  14, 224,  13, 230,  -5,  -3,  -1, 110, 156, 201,  -1,  94, 186,  -9,
-  -5,  -1, 229,  -1, 171, 125,  -1, 215, 228,  -3,  -1, 140, 200,  -3,  -1,
-  78,  46,  62, -15,  -7,  -3,  -1, 109, 214,  -1, 227, 155,  -3,  -1, 185,
- 170,  -1, 226,  30,  -7,  -3,  -1, 225,  93,  -1, 213, 124,  -3,  -1, 199,
-  77,  -1, 139, 184, -31, -15,  -7,  -3,  -1, 212, 154,  -1, 169, 108,  -3,
-  -1, 198,  61,  -1, 211,  45,  -7,  -3,  -1, 210,  29,  -1, 123, 183,  -3,
-  -1, 209,  92,  -1, 197, 138, -17,  -7,  -3,  -1, 168, 153,  -1,  76, 196,
-  -3,  -1, 107, 182,  -3,  -1, 208,  12,  60,  -7,  -3,  -1, 195, 122,  -1,
- 167,  44,  -3,  -1, 194,  91,  -1, 181,  28, -57, -35, -19,  -7,  -3,  -1,
- 137, 152,  -1, 193,  75,  -5,  -3,  -1, 192,  11,  59,  -3,  -1, 176,  10,
-  26,  -5,  -1, 180,  -1, 106, 166,  -3,  -1, 121, 151,  -3,  -1, 160,   9,
- 144,  -9,  -3,  -1, 179, 136,  -3,  -1,  43,  90, 178,  -7,  -3,  -1, 165,
-  27,  -1, 177, 105,  -1, 150, 164, -17,  -9,  -5,  -3,  -1,  74, 120, 135,
-  -1,  58, 163,  -3,  -1,  89, 149,  -1,  42, 162,  -7,  -3,  -1, 161, 104,
-  -1, 134, 119,  -3,  -1,  73, 148,  -1,  57, 147, -63, -31, -15,  -7,  -3,
-  -1,  88, 133,  -1,  41, 103,  -3,  -1, 118, 146,  -1,  25, 145,  -7,  -3,
-  -1,  72, 132,  -1,  87, 117,  -3,  -1,  56, 131,  -1, 102,  40, -17,  -7,
-  -3,  -1, 130,  24,  -1,  71, 116,  -5,  -1, 129,  -1,   8, 128,  -1,  86,
- 101,  -7,  -5,  -1,  23,  -1,   7, 112, 115,  -3,  -1,  55,  39, 114, -15,
-  -7,  -3,  -1,  70, 100,  -1,  85, 113,  -3,  -1,  54,  99,  -1,  69,  84,
-  -7,  -3,  -1,  38,  98,  -1,  22,  97,  -5,  -3,  -1,   6,  96,  53,  -1,
-  83,  68, -51, -37, -23, -15,  -9,  -3,  -1,  37,  82,  -1,  21,  -1,   5,
-  80,  -1,  81,  -1,  52,  67,  -3,  -1,  36,  66,  -1,  51,  20,  -9,  -5,
-  -1,  65,  -1,   4,  64,  -1,  35,  50,  -1,  19,  49,  -7,  -5,  -3,  -1,
-   3,  48,  34,  18,  -1,  33,  -1,   2,  32,  -3,  -1,  17,   1,  -1,  16,
-   0
-};
-
-static short tab_c0[] =
-{
- -29, -21, -13,  -7,  -3,  -1,  11,  15,  -1,  13,  14,  -3,  -1,   7,   5,
-   9,  -3,  -1,   6,   3,  -1,  10,  12,  -3,  -1,   2,   1,  -1,   4,   8,
-   0
-};
-
-static short tab_c1[] =
-{
- -15,  -7,  -3,  -1,  15,  14,  -1,  13,  12,  -3,  -1,  11,  10,  -1,   9,
-   8,  -7,  -3,  -1,   7,   6,  -1,   5,   4,  -3,  -1,   3,   2,  -1,   1,
-   0
-};
-
-
-
-static struct newhuff ht[] =
-{
- { /* 0 */ 0 , tab0  } ,
- { /* 2 */ 0 , tab1  } ,
- { /* 3 */ 0 , tab2  } ,
- { /* 3 */ 0 , tab3  } ,
- { /* 0 */ 0 , tab0  } ,
- { /* 4 */ 0 , tab5  } ,
- { /* 4 */ 0 , tab6  } ,
- { /* 6 */ 0 , tab7  } ,
- { /* 6 */ 0 , tab8  } ,
- { /* 6 */ 0 , tab9  } ,
- { /* 8 */ 0 , tab10 } ,
- { /* 8 */ 0 , tab11 } ,
- { /* 8 */ 0 , tab12 } ,
- { /* 16 */ 0 , tab13 } ,
- { /* 0  */ 0 , tab0  } ,
- { /* 16 */ 0 , tab15 } ,
-
- { /* 16 */ 1 , tab16 } ,
- { /* 16 */ 2 , tab16 } ,
- { /* 16 */ 3 , tab16 } ,
- { /* 16 */ 4 , tab16 } ,
- { /* 16 */ 6 , tab16 } ,
- { /* 16 */ 8 , tab16 } ,
- { /* 16 */ 10, tab16 } ,
- { /* 16 */ 13, tab16 } ,
- { /* 16 */ 4 , tab24 } ,
- { /* 16 */ 5 , tab24 } ,
- { /* 16 */ 6 , tab24 } ,
- { /* 16 */ 7 , tab24 } ,
- { /* 16 */ 8 , tab24 } ,
- { /* 16 */ 9 , tab24 } ,
- { /* 16 */ 11, tab24 } ,
- { /* 16 */ 13, tab24 }
-};
-
-static struct newhuff htc[] =
-{
- { /* 1 , 1 , */ 0 , tab_c0 } ,
- { /* 1 , 1 , */ 0 , tab_c1 }
-};
-
-#endif /* MPLAYER_MP3LIB_HUFFMAN_H */
diff --git a/mplayer/mp3lib/l2tables.h b/mplayer/mp3lib/l2tables.h
deleted file mode 100644
index feef3d1..0000000
--- a/mplayer/mp3lib/l2tables.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-#ifndef MPLAYER_MP3LIB_L2TABLES_H
-#define MPLAYER_MP3LIB_L2TABLES_H
-
-#include "mpg123.h"
-
-/*
- * Layer 2 Alloc tables ..
- * most other tables are calculated on program start (which is (of course)
- * not ISO-conform) ..
- * Layer-3 huffman table is in huffman.h
- */
-
-static struct al_table alloc_0[] = {
-    {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
-    {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
-    {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
-    {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
-    {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
-    {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767} };
-
-static struct al_table alloc_1[] = {
-    {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
-    {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
-    {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
-    {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
-    {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
-    {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-    {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767},
-    {2,0},{5,3},{7,5},{16,-32767} };
-
-static struct al_table alloc_2[] = {
-    {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
-    {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
-    {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
-    {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
-
-static struct al_table alloc_3[] = {
-    {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
-    {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
-    {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
-    {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
-
-static struct al_table alloc_4[] = {
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-        {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-        {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-        {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
-    {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
-        {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9},
-    {2,0},{5,3},{7,5},{10,9}  };
-
-#endif /* MPLAYER_MP3LIB_L2TABLES_H */
diff --git a/mplayer/mp3lib/layer1.c b/mplayer/mp3lib/layer1.c
deleted file mode 100644
index a4be246..0000000
--- a/mplayer/mp3lib/layer1.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Mpeg Layer-1 audio decoder
- * --------------------------
- * copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README'
- * near unoptimzed ...
- *
- * may have a few bugs after last optimization ...
- *
- */
-
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- *
- * The above-mentioned README file has the following to say about licensing:
- *
- *   COPYING: you may use this source under LGPL terms!
- */
-
-#include "mpg123.h"
-
-static void I_step_one(unsigned int balloc[], unsigned int scale_index[2][SBLIMIT],struct frame *fr)
-{
-  unsigned int *ba=balloc;
-  unsigned int *sca = (unsigned int *) scale_index;
-
-  if(fr->stereo == 2) {
-    int i;
-    int jsbound = fr->jsbound;
-    for (i=0;i<jsbound;i++) {
-      *ba++ = getbits(4);
-      *ba++ = getbits(4);
-    }
-    for (i=jsbound;i<SBLIMIT;i++)
-      *ba++ = getbits(4);
-
-    ba = balloc;
-
-    for (i=0;i<jsbound;i++) {
-      if ((*ba++))
-        *sca++ = getbits(6);
-      if ((*ba++))
-        *sca++ = getbits(6);
-    }
-    for (i=jsbound;i<SBLIMIT;i++)
-      if ((*ba++)) {
-        *sca++ =  getbits(6);
-        *sca++ =  getbits(6);
-      }
-  }
-  else {
-    int i;
-    for (i=0;i<SBLIMIT;i++)
-      *ba++ = getbits(4);
-    ba = balloc;
-    for (i=0;i<SBLIMIT;i++)
-      if ((*ba++))
-        *sca++ = getbits(6);
-  }
-}
-
-static void I_step_two(real fraction[2][SBLIMIT],unsigned int balloc[2*SBLIMIT],
-                       unsigned int scale_index[2][SBLIMIT],struct frame *fr)
-{
-  int i,n;
-  int smpb[2*SBLIMIT]; /* values: 0-65535 */
-  int *sample;
-  register unsigned int *ba;
-  register unsigned int *sca = (unsigned int *) scale_index;
-
-  if(fr->stereo == 2) {
-    int jsbound = fr->jsbound;
-    register real *f0 = fraction[0];
-    register real *f1 = fraction[1];
-    ba = balloc;
-    for (sample=smpb,i=0;i<jsbound;i++)  {
-      if ((n = *ba++))
-        *sample++ = getbits(n+1);
-      if ((n = *ba++))
-        *sample++ = getbits(n+1);
-    }
-    for (i=jsbound;i<SBLIMIT;i++)
-      if ((n = *ba++))
-        *sample++ = getbits(n+1);
-
-    ba = balloc;
-    for (sample=smpb,i=0;i<jsbound;i++) {
-      if((n=*ba++))
-        *f0++ = (real) ( ((-1)<<n) + (*sample++) + 1) * muls[n+1][*sca++];
-      else
-        *f0++ = 0.0;
-      if((n=*ba++))
-        *f1++ = (real) ( ((-1)<<n) + (*sample++) + 1) * muls[n+1][*sca++];
-      else
-        *f1++ = 0.0;
-    }
-    for (i=jsbound;i<SBLIMIT;i++) {
-      if ((n=*ba++)) {
-        real samp = ( ((-1)<<n) + (*sample++) + 1);
-        *f0++ = samp * muls[n+1][*sca++];
-        *f1++ = samp * muls[n+1][*sca++];
-      }
-      else
-        *f0++ = *f1++ = 0.0;
-    }
-    for(i=fr->down_sample_sblimit;i<32;i++)
-      fraction[0][i] = fraction[1][i] = 0.0;
-  }
-  else {
-    register real *f0 = fraction[0];
-    ba = balloc;
-    for (sample=smpb,i=0;i<SBLIMIT;i++)
-      if ((n = *ba++))
-        *sample++ = getbits(n+1);
-    ba = balloc;
-    for (sample=smpb,i=0;i<SBLIMIT;i++) {
-      if((n=*ba++))
-        *f0++ = (real) ( ((-1)<<n) + (*sample++) + 1) * muls[n+1][*sca++];
-      else
-        *f0++ = 0.0;
-    }
-    for(i=fr->down_sample_sblimit;i<32;i++)
-      fraction[0][i] = 0.0;
-  }
-}
-
-static int do_layer1(struct frame *fr,int single)
-{
-  int clip=0;
-  int i,stereo = fr->stereo;
-  unsigned int balloc[2*SBLIMIT];
-  unsigned int scale_index[2][SBLIMIT];
-  DECLARE_ALIGNED(16, real, fraction[2][SBLIMIT]);
-//  int single = fr->single;
-
-//  printf("do_layer1(0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X )\n",
-//    wordpointer[0],wordpointer[1],wordpointer[2],wordpointer[3],wordpointer[4],wordpointer[5],wordpointer[6],wordpointer[7]);
-
-  fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
-                         (fr->mode_ext<<2)+4 : 32;
-
-  if(stereo == 1 || single == 3)
-    single = 0;
-
-  I_step_one(balloc,scale_index,fr);
-
-  for (i=0;i<SCALE_BLOCK;i++)
-  {
-    I_step_two(fraction,balloc,scale_index,fr);
-
-    if(single >= 0)
-    {
-      clip += (fr->synth_mono)( (real *) fraction[single],pcm_sample,&pcm_point);
-    }
-    else {
-        int p1 = pcm_point;
-        clip += (fr->synth)( (real *) fraction[0],0,pcm_sample,&p1);
-        clip += (fr->synth)( (real *) fraction[1],1,pcm_sample,&pcm_point);
-    }
-
-  }
-
-  return clip;
-}
diff --git a/mplayer/mp3lib/layer2.c b/mplayer/mp3lib/layer2.c
deleted file mode 100644
index f86d716..0000000
--- a/mplayer/mp3lib/layer2.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
- * Mpeg Layer-2 audio decoder
- * --------------------------
- * copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README'
- *
- */
-
-#include "mpg123.h"
-#include "l2tables.h"
-
-static int grp_3tab[32 * 3] = { 0, };   /* used: 27 */
-static int grp_5tab[128 * 3] = { 0, };  /* used: 125 */
-static int grp_9tab[1024 * 3] = { 0, }; /* used: 729 */
-
-static real muls[27][64];       /* also used by layer 1 */
-
-static void init_layer2(void)
-{
-  static double mulmul[27] = {
-    0.0 , -2.0/3.0 , 2.0/3.0 ,
-    2.0/7.0 , 2.0/15.0 , 2.0/31.0, 2.0/63.0 , 2.0/127.0 , 2.0/255.0 ,
-    2.0/511.0 , 2.0/1023.0 , 2.0/2047.0 , 2.0/4095.0 , 2.0/8191.0 ,
-    2.0/16383.0 , 2.0/32767.0 , 2.0/65535.0 ,
-    -4.0/5.0 , -2.0/5.0 , 2.0/5.0, 4.0/5.0 ,
-    -8.0/9.0 , -4.0/9.0 , -2.0/9.0 , 2.0/9.0 , 4.0/9.0 , 8.0/9.0 };
-  static int base[3][9] = {
-     { 1 , 0, 2 , } ,
-     { 17, 18, 0 , 19, 20 , } ,
-     { 21, 1, 22, 23, 0, 24, 25, 2, 26 } };
-  int i,j,k,l,len;
-  real *table;
-  static int tablen[3] = { 3 , 5 , 9 };
-  static int *itable,*tables[3] = { grp_3tab , grp_5tab , grp_9tab };
-
-  for(i=0;i<3;i++)
-  {
-    itable = tables[i];
-    len = tablen[i];
-    for(j=0;j<len;j++)
-      for(k=0;k<len;k++)
-        for(l=0;l<len;l++)
-        {
-          *itable++ = base[i][l];
-          *itable++ = base[i][k];
-          *itable++ = base[i][j];
-        }
-  }
-
-  for(k=0;k<27;k++)
-  {
-    double m=mulmul[k];
-    table = muls[k];
-    if(_has_mmx)
-    {
-        for(j=3,i=0;i<63;i++,j--)
-          *table++ = 16384 * m * pow(2.0,(double) j / 3.0);
-    }
-    else
-    for(j=3,i=0;i<63;i++,j--)
-    {
-      *table++ = m * pow(2.0,(double) j / 3.0);
-    }
-    *table++ = 0.0;
-  }
-}
-
-
-static void II_step_one(unsigned int *bit_alloc,int *scale,struct frame *fr)
-{
-    int stereo = fr->stereo-1;
-    int sblimit = fr->II_sblimit;
-    int jsbound = fr->jsbound;
-    int sblimit2 = fr->II_sblimit<<stereo;
-    struct al_table *alloc1 = fr->alloc;
-    int i;
-    static unsigned int scfsi_buf[64];
-    unsigned int *scfsi,*bita;
-    int sc,step;
-
-    bita = bit_alloc;
-    if(stereo)
-    {
-      for (i=jsbound;i>0;i--,alloc1+=(1<<step))
-      {
-        *bita++ = (char) getbits(step=alloc1->bits);
-        *bita++ = (char) getbits(step);
-      }
-      for (i=sblimit-jsbound;i>0;i--,alloc1+=(1<<step))
-      {
-        bita[0] = (char) getbits(step=alloc1->bits);
-        bita[1] = bita[0];
-        bita+=2;
-      }
-      bita = bit_alloc;
-      scfsi=scfsi_buf;
-      for (i=sblimit2;i>0;i--)
-        if (*bita++)
-          *scfsi++ = (char) getbits_fast(2);
-    }
-    else /* mono */
-    {
-      for (i=sblimit;i>0;i--,alloc1+=(1<<step))
-        *bita++ = (char) getbits(step=alloc1->bits);
-      bita = bit_alloc;
-      scfsi=scfsi_buf;
-      for (i=sblimit;i>0;i--)
-        if (*bita++)
-          *scfsi++ = (char) getbits_fast(2);
-    }
-
-    bita = bit_alloc;
-    scfsi=scfsi_buf;
-    for (i=sblimit2;i>0;i--)
-      if (*bita++)
-        switch (*scfsi++)
-        {
-          case 0:
-                *scale++ = getbits_fast(6);
-                *scale++ = getbits_fast(6);
-                *scale++ = getbits_fast(6);
-                break;
-          case 1 :
-                *scale++ = sc = getbits_fast(6);
-                *scale++ = sc;
-                *scale++ = getbits_fast(6);
-                break;
-          case 2:
-                *scale++ = sc = getbits_fast(6);
-                *scale++ = sc;
-                *scale++ = sc;
-                break;
-          default:              /* case 3 */
-                *scale++ = getbits_fast(6);
-                *scale++ = sc = getbits_fast(6);
-                *scale++ = sc;
-                break;
-        }
-
-}
-
-static void II_step_two(unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale,struct frame *fr,int x1)
-{
-    int i,j,k,ba;
-    int stereo = fr->stereo;
-    int sblimit = fr->II_sblimit;
-    int jsbound = fr->jsbound;
-    struct al_table *alloc2,*alloc1 = fr->alloc;
-    unsigned int *bita=bit_alloc;
-    int d1,step;
-
-    for (i=0;i<jsbound;i++,alloc1+=(1<<step))
-    {
-      step = alloc1->bits;
-      for (j=0;j<stereo;j++)
-      {
-        if ( (ba=*bita++) )
-        {
-          k=(alloc2 = alloc1+ba)->bits;
-          if( (d1=alloc2->d) < 0)
-          {
-            real cm=muls[k][scale[x1]];
-            fraction[j][0][i] = ((real) ((int)getbits(k) + d1)) * cm;
-            fraction[j][1][i] = ((real) ((int)getbits(k) + d1)) * cm;
-            fraction[j][2][i] = ((real) ((int)getbits(k) + d1)) * cm;
-          }
-          else
-          {
-            static int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab };
-            unsigned int idx,*tab,m=scale[x1];
-            idx = (unsigned int) getbits(k);
-            tab = (unsigned int *) (table[d1] + idx + idx + idx);
-            fraction[j][0][i] = muls[*tab++][m];
-            fraction[j][1][i] = muls[*tab++][m];
-            fraction[j][2][i] = muls[*tab][m];
-          }
-          scale+=3;
-        }
-        else
-          fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
-      }
-    }
-
-    for (i=jsbound;i<sblimit;i++,alloc1+=(1<<step))
-    {
-      step = alloc1->bits;
-      bita++;   /* channel 1 and channel 2 bitalloc are the same */
-      if ( (ba=*bita++) )
-      {
-        k=(alloc2 = alloc1+ba)->bits;
-        if( (d1=alloc2->d) < 0)
-        {
-          real cm;
-          cm=muls[k][scale[x1+3]];
-          fraction[1][0][i] = (fraction[0][0][i] = (real) ((int)getbits(k) + d1) ) * cm;
-          fraction[1][1][i] = (fraction[0][1][i] = (real) ((int)getbits(k) + d1) ) * cm;
-          fraction[1][2][i] = (fraction[0][2][i] = (real) ((int)getbits(k) + d1) ) * cm;
-          cm=muls[k][scale[x1]];
-          fraction[0][0][i] *= cm; fraction[0][1][i] *= cm; fraction[0][2][i] *= cm;
-        }
-        else
-        {
-          static int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab };
-          unsigned int idx,*tab,m1,m2;
-          m1 = scale[x1]; m2 = scale[x1+3];
-          idx = (unsigned int) getbits(k);
-          tab = (unsigned int *) (table[d1] + idx + idx + idx);
-          fraction[0][0][i] = muls[*tab][m1]; fraction[1][0][i] = muls[*tab++][m2];
-          fraction[0][1][i] = muls[*tab][m1]; fraction[1][1][i] = muls[*tab++][m2];
-          fraction[0][2][i] = muls[*tab][m1]; fraction[1][2][i] = muls[*tab][m2];
-        }
-        scale+=6;
-      }
-      else {
-        fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] =
-        fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = 0.0;
-      }
-/*
-   should we use individual scalefac for channel 2 or
-   is the current way the right one , where we just copy channel 1 to
-   channel 2 ??
-   The current 'strange' thing is, that we throw away the scalefac
-   values for the second channel ...!!
--> changed .. now we use the scalefac values of channel one !!
-*/
-    }
-
-    if(sblimit > (fr->down_sample_sblimit) )
-      sblimit = fr->down_sample_sblimit;
-
-    for(i=sblimit;i<SBLIMIT;i++)
-      for (j=0;j<stereo;j++)
-        fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
-
-}
-
-static void II_select_table(struct frame *fr)
-{
-  static int translate[9][2][16] =
-   { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,   /*44.1 stereo*/
-       { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } , /*44.1 mono*/
-     { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,   /*48 stereo*/
-       { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } , /*48 mono*/
-     { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } ,   /*32 stereo*/
-       { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } , /*32 mono*/
-     { { 2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,0 } ,   /*22.05 stereo*/
-       { 2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,0 } } , /*22.05 mono*/
-     { { 2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,0 } ,   /*24 stereo*/
-       { 2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,0 } } , /*24 mono*/
-     { { 2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,0 } ,   /*16 stereo*/
-       { 2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,0 } } , /*16 mono*/
-     { { 2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,0 } ,   /*11.025 stereo*/
-       { 2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,0 } } , /*11.025 mono*/
-     { { 2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,0 } ,   /*12 stereo*/
-       { 2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,0 } } , /*12 mono*/
-     { { 2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,0 } ,   /*8 stereo*/
-       { 2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,0 } }   /*8 mono*/
-/*       0  48  64  96 128 192 256 384 */
-/*        32  56  80 112 160 224 320  XX*/
-       };
-
-  int table,sblim;
-  static struct al_table *tables[5] =
-       { alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 };
-  static int sblims[5] = { 27 , 30 , 8, 12 , 30 };
-
-  if(fr->lsf)
-    table = 4;
-  else
-    table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index];
-  sblim = sblims[table];
-
-  fr->alloc      = tables[table];
-  fr->II_sblimit = sblim;
-}
-
-
-static int do_layer2(struct frame *fr,int outmode)
-{
-  int clip=0;
-  int i,j;
-  int stereo = fr->stereo;
-  DECLARE_ALIGNED(16, real, fraction[2][4][SBLIMIT]); /* pick_table clears unused subbands */
-  unsigned int bit_alloc[64];
-  int scale[192];
-  int single = fr->single;
-
-  II_select_table(fr);
-  fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
-     (fr->mode_ext<<2)+4 : fr->II_sblimit;
-
-  if(stereo == 1 || single == 3)
-    single = 0;
-
-  II_step_one(bit_alloc, scale, fr);
-
-  for (i=0;i<SCALE_BLOCK;i++)
-  {
-    II_step_two(bit_alloc,fraction,scale,fr,i>>2);
-    for (j=0;j<3;j++)
-    {
-      if(single >= 0)
-      {
-        clip += (fr->synth_mono) (fraction[single][j],pcm_sample,&pcm_point);
-      }
-      else {
-          int p1 = pcm_point;
-          clip += (fr->synth) (fraction[0][j],0,pcm_sample,&p1);
-          clip += (fr->synth) (fraction[1][j],1,pcm_sample,&pcm_point);
-      }
-
-//      if(pcm_point >= audiobufsize) audio_flush(outmode,ai);
-    }
-  }
-
-  return clip;
-}
diff --git a/mplayer/mp3lib/layer3.c b/mplayer/mp3lib/layer3.c
deleted file mode 100644
index 91943a8..0000000
--- a/mplayer/mp3lib/layer3.c
+++ /dev/null
@@ -1,1349 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
- * Mpeg Layer-3 audio decoder
- * --------------------------
- * copyright (c) 1995-1999 by Michael Hipp.
- * All rights reserved. See also 'README'
- *
- * Optimize-TODO: put short bands into the band-field without the stride
- *                of 3 reals
- * Length-optimze: unify long and short band code where it is possible
- */
-
-#include "mpg123.h"
-
-#if 0
-#define L3_DEBUG 1
-#endif
-
-#if 0
-#define CUT_HF
-#endif
-
-#define REAL_MUL(x, y) ((x) * (y))
-
-static real ispow[8207];
-static real aa_ca[8],aa_cs[8];
-static real COS1[12][6];
-static real win[4][36];
-static real win1[4][36];
-static real gainpow2[256+118+4];
-
-/* non static for external 3dnow functions */
-real   COS9[9];
-static real COS6_1,COS6_2;
-real   tfcos36[9];
-
-static real tfcos12[3];
-#define NEW_DCT9
-#ifdef NEW_DCT9
-static real cos9[3],cos18[3];
-#endif
-
-struct bandInfoStruct {
-  uint16_t longIdx[23];
-  uint8_t  longDiff[22];
-  uint16_t shortIdx[14];
-  uint8_t  shortDiff[13];
-};
-
-static int longLimit[9][23];
-static int shortLimit[9][14];
-
-static const struct bandInfoStruct bandInfo[9] = {
-
-/* MPEG 1.0 */
- { {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576},
-   {4,4,4,4,4,4,6,6,8, 8,10,12,16,20,24,28,34,42,50,54, 76,158},
-   {0,4*3,8*3,12*3,16*3,22*3,30*3,40*3,52*3,66*3, 84*3,106*3,136*3,192*3},
-   {4,4,4,4,6,8,10,12,14,18,22,30,56} } ,
-
- { {0,4,8,12,16,20,24,30,36,42,50,60,72, 88,106,128,156,190,230,276,330,384,576},
-   {4,4,4,4,4,4,6,6,6, 8,10,12,16,18,22,28,34,40,46,54, 54,192},
-   {0,4*3,8*3,12*3,16*3,22*3,28*3,38*3,50*3,64*3, 80*3,100*3,126*3,192*3},
-   {4,4,4,4,6,6,10,12,14,16,20,26,66} } ,
-
- { {0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576} ,
-   {4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102, 26} ,
-   {0,4*3,8*3,12*3,16*3,22*3,30*3,42*3,58*3,78*3,104*3,138*3,180*3,192*3} ,
-   {4,4,4,4,6,8,12,16,20,26,34,42,12} }  ,
-
-/* MPEG 2.0 */
- { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
-   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 } ,
-   {0,4*3,8*3,12*3,18*3,24*3,32*3,42*3,56*3,74*3,100*3,132*3,174*3,192*3} ,
-   {4,4,4,6,6,8,10,14,18,26,32,42,18 } } ,
-/* changed 19th value fropm 330 to 332 */
- { {0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576},
-   {6,6,6,6,6,6,8,10,12,14,16,18,22,26,32,38,46,54,62,70,76,36 } ,
-   {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,136*3,180*3,192*3} ,
-   {4,4,4,6,8,10,12,14,18,24,32,44,12 } } ,
-
- { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
-   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 },
-   {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,134*3,174*3,192*3},
-   {4,4,4,6,8,10,12,14,18,24,30,40,18 } } ,
-/* MPEG 2.5 */
- { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576} ,
-   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54},
-   {0,12,24,36,54,78,108,144,186,240,312,402,522,576},
-   {4,4,4,6,8,10,12,14,18,24,30,40,18} },
- { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576} ,
-   {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54},
-   {0,12,24,36,54,78,108,144,186,240,312,402,522,576},
-   {4,4,4,6,8,10,12,14,18,24,30,40,18} },
- { {0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576},
-   {12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2},
-   {0, 24, 48, 72,108,156,216,288,372,480,486,492,498,576},
-   {8,8,8,12,16,20,24,28,36,2,2,2,26} } ,
-};
-
-static int mapbuf0[9][152];
-static int mapbuf1[9][156];
-static int mapbuf2[9][44];
-static int *map[9][3];
-static int *mapend[9][3];
-
-static unsigned int n_slen2[512]; /* MPEG 2.0 slen for 'normal' mode */
-static unsigned int i_slen2[256]; /* MPEG 2.0 slen for intensity stereo */
-
-static real tan1_1[16],tan2_1[16],tan1_2[16],tan2_2[16];
-static real pow1_1[2][16],pow2_1[2][16],pow1_2[2][16],pow2_2[2][16];
-
-/*
- * init tables for layer-3
- */
-static void init_layer3(int down_sample_sblimit)
-{
-  int i,j,k,l;
-
-  for(i=-256;i<118+4;i++)
-  {
-    if(_has_mmx)
-      gainpow2[i+256] = 16384.0 * pow((double)2.0,-0.25 * (double) (i+210) );
-    else
-      gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) );
-  }
-  for(i=0;i<8207;i++)
-    ispow[i] = pow((double)i,(double)4.0/3.0);
-
-  for (i=0;i<8;i++)
-  {
-    static const double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037};
-    double sq=sqrt(1.0+Ci[i]*Ci[i]);
-    aa_cs[i] = 1.0/sq;
-    aa_ca[i] = Ci[i]/sq;
-  }
-
-  for(i=0;i<18;i++)
-  {
-    win[0][i]    = win[1][i]    = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 );
-    win[0][i+18] = win[3][i+18] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 );
-  }
-  for(i=0;i<6;i++)
-  {
-    win[1][i+18] = 0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 );
-    win[3][i+12] = 0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 );
-    win[1][i+24] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 );
-    win[1][i+30] = win[3][i] = 0.0;
-    win[3][i+6 ] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) )  / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 );
-  }
-
-  for(i=0;i<9;i++)
-    COS9[i] = cos( M_PI / 18.0 * (double) i);
-
-  for(i=0;i<9;i++)
-    tfcos36[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 );
-  for(i=0;i<3;i++)
-    tfcos12[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 );
-
-  COS6_1 = cos( M_PI / 6.0 * (double) 1);
-  COS6_2 = cos( M_PI / 6.0 * (double) 2);
-
-#ifdef NEW_DCT9
-  cos9[0] = cos(1.0*M_PI/9.0);
-  cos9[1] = cos(5.0*M_PI/9.0);
-  cos9[2] = cos(7.0*M_PI/9.0);
-  cos18[0] = cos(1.0*M_PI/18.0);
-  cos18[1] = cos(11.0*M_PI/18.0);
-  cos18[2] = cos(13.0*M_PI/18.0);
-#endif
-
-  for(i=0;i<12;i++)
-  {
-    win[2][i]  = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 );
-    for(j=0;j<6;j++)
-      COS1[i][j] = cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) );
-  }
-
-  for(j=0;j<4;j++) {
-    static const int len[4] = { 36,36,12,36 };
-    for(i=0;i<len[j];i+=2)
-      win1[j][i] = + win[j][i];
-    for(i=1;i<len[j];i+=2)
-      win1[j][i] = - win[j][i];
-  }
-
-  for(i=0;i<16;i++)
-  {
-    double t = tan( (double) i * M_PI / 12.0 );
-    tan1_1[i] = t / (1.0+t);
-    tan2_1[i] = 1.0 / (1.0 + t);
-    tan1_2[i] = M_SQRT2 * t / (1.0+t);
-    tan2_2[i] = M_SQRT2 / (1.0 + t);
-
-    for(j=0;j<2;j++) {
-      double base = pow(2.0,-0.25*(j+1.0));
-      double p1=1.0,p2=1.0;
-      if(i > 0) {
-        if( i & 1 )
-          p1 = pow(base,(i+1.0)*0.5);
-        else
-          p2 = pow(base,i*0.5);
-      }
-      pow1_1[j][i] = p1;
-      pow2_1[j][i] = p2;
-      pow1_2[j][i] = M_SQRT2 * p1;
-      pow2_2[j][i] = M_SQRT2 * p2;
-    }
-  }
-
-  for(j=0;j<9;j++)
-  {
-   const struct bandInfoStruct *bi = &bandInfo[j];
-   int *mp;
-   int cb,lwin;
-   const uint8_t *bdf;
-
-   mp = map[j][0] = mapbuf0[j];
-   bdf = bi->longDiff;
-   for(i=0,cb = 0; cb < 8 ; cb++,i+=*bdf++) {
-     *mp++ = (*bdf) >> 1;
-     *mp++ = i;
-     *mp++ = 3;
-     *mp++ = cb;
-   }
-   bdf = bi->shortDiff+3;
-   for(cb=3;cb<13;cb++) {
-     int l = (*bdf++) >> 1;
-     for(lwin=0;lwin<3;lwin++) {
-       *mp++ = l;
-       *mp++ = i + lwin;
-       *mp++ = lwin;
-       *mp++ = cb;
-     }
-     i += 6*l;
-   }
-   mapend[j][0] = mp;
-
-   mp = map[j][1] = mapbuf1[j];
-   bdf = bi->shortDiff+0;
-   for(i=0,cb=0;cb<13;cb++) {
-     int l = (*bdf++) >> 1;
-     for(lwin=0;lwin<3;lwin++) {
-       *mp++ = l;
-       *mp++ = i + lwin;
-       *mp++ = lwin;
-       *mp++ = cb;
-     }
-     i += 6*l;
-   }
-   mapend[j][1] = mp;
-
-   mp = map[j][2] = mapbuf2[j];
-   bdf = bi->longDiff;
-   for(cb = 0; cb < 22 ; cb++) {
-     *mp++ = (*bdf++) >> 1;
-     *mp++ = cb;
-   }
-   mapend[j][2] = mp;
-
-  }
-
-  for(j=0;j<9;j++) {
-    for(i=0;i<23;i++) {
-      longLimit[j][i] = (bandInfo[j].longIdx[i] - 1 + 8) / 18 + 1;
-      if(longLimit[j][i] > (down_sample_sblimit) )
-        longLimit[j][i] = down_sample_sblimit;
-    }
-    for(i=0;i<14;i++) {
-      shortLimit[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1;
-      if(shortLimit[j][i] > (down_sample_sblimit) )
-        shortLimit[j][i] = down_sample_sblimit;
-    }
-  }
-
-  for(i=0;i<5;i++) {
-    for(j=0;j<6;j++) {
-      for(k=0;k<6;k++) {
-        int n = k + j * 6 + i * 36;
-        i_slen2[n] = i|(j<<3)|(k<<6)|(3<<12);
-      }
-    }
-  }
-  for(i=0;i<4;i++) {
-    for(j=0;j<4;j++) {
-      for(k=0;k<4;k++) {
-        int n = k + j * 4 + i * 16;
-        i_slen2[n+180] = i|(j<<3)|(k<<6)|(4<<12);
-      }
-    }
-  }
-  for(i=0;i<4;i++) {
-    for(j=0;j<3;j++) {
-      int n = j + i * 3;
-      i_slen2[n+244] = i|(j<<3) | (5<<12);
-      n_slen2[n+500] = i|(j<<3) | (2<<12) | (1<<15);
-    }
-  }
-
-  for(i=0;i<5;i++) {
-    for(j=0;j<5;j++) {
-      for(k=0;k<4;k++) {
-        for(l=0;l<4;l++) {
-          int n = l + k * 4 + j * 16 + i * 80;
-          n_slen2[n] = i|(j<<3)|(k<<6)|(l<<9)|(0<<12);
-        }
-      }
-    }
-  }
-  for(i=0;i<5;i++) {
-    for(j=0;j<5;j++) {
-      for(k=0;k<4;k++) {
-        int n = k + j * 4 + i * 20;
-        n_slen2[n+400] = i|(j<<3)|(k<<6)|(1<<12);
-      }
-    }
-  }
-}
-
-/*
- * read additional side information (for MPEG 1 and MPEG 2)
- */
-static int III_get_side_info(struct III_sideinfo *si,int stereo,
- int ms_stereo,int sfreq,int single,int lsf)
-{
-   int ch, gr;
-   int powdiff = (single == 3) ? 4 : 0;
-
-   static const int tabs[2][5] = { { 2,9,5,3,4 } , { 1,8,1,2,9 } };
-   const int *tab = tabs[lsf];
-
-   si->main_data_begin = getbits(tab[1]);
-   if (stereo == 1)
-     si->private_bits = getbits_fast(tab[2]);
-   else
-     si->private_bits = getbits_fast(tab[3]);
-
-   if(!lsf) {
-     for (ch=0; ch<stereo; ch++) {
-         si->ch[ch].gr[0].scfsi = -1;
-         si->ch[ch].gr[1].scfsi = getbits_fast(4);
-     }
-   }
-
-   for (gr=0; gr<tab[0]; gr++) {
-     for (ch=0; ch<stereo; ch++) {
-       register struct gr_info_s *gr_info = &(si->ch[ch].gr[gr]);
-
-       gr_info->part2_3_length = getbits(12);
-       gr_info->big_values = getbits(9);
-       if(gr_info->big_values > 288) {
-            fprintf(stderr,"big_values too large!\n");
-          gr_info->big_values = 288;
-       }
-       gr_info->pow2gain = gainpow2+256 - getbits_fast(8) + powdiff;
-       if(ms_stereo)
-         gr_info->pow2gain += 2;
-       gr_info->scalefac_compress = getbits(tab[4]);
-
-       if(get1bit()) { /* window switch flag  */
-         int i;
-#ifdef L3_DEBUG
-if(2*gr_info->big_values > bandInfo[sfreq].shortIdx[12])
-  fprintf(stderr,"L3: BigValues too large, doesn't make sense %d %d\n",2*gr_info->big_values,bandInfo[sfreq].shortIdx[12]);
-#endif
-
-         gr_info->block_type       = getbits_fast(2);
-         gr_info->mixed_block_flag = get1bit();
-         gr_info->table_select[0]  = getbits_fast(5);
-         gr_info->table_select[1]  = getbits_fast(5);
-         /*
-          * table_select[2] not needed, because there is no region2,
-          * but to satisfy some verifications tools we set it either.
-          */
-         gr_info->table_select[2] = 0;
-         for(i=0;i<3;i++)
-           gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(3)<<3);
-
-         if(gr_info->block_type == 0) {
-             fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n");
-           return 0;
-         }
-
-         /* region_count/start parameters are implicit in this case. */
-         if(!lsf || gr_info->block_type == 2)
-           gr_info->region1start = 36>>1;
-         else {
-/* check this again for 2.5 and sfreq=8 */
-           if(sfreq == 8)
-             gr_info->region1start = 108>>1;
-           else
-             gr_info->region1start = 54>>1;
-         }
-         gr_info->region2start = 576>>1;
-       }
-       else {
-         int i,r0c,r1c;
-#ifdef L3_DEBUG
-if(2*gr_info->big_values > bandInfo[sfreq].longIdx[21])
-  fprintf(stderr,"L3: BigValues too large, doesn't make sense %d %d\n",2*gr_info->big_values,bandInfo[sfreq].longIdx[21]);
-#endif
-         for (i=0; i<3; i++)
-           gr_info->table_select[i] = getbits_fast(5);
-         r0c = getbits_fast(4);
-         r1c = getbits_fast(3);
-         gr_info->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ;
-         if(r0c + r1c + 2 > 22)
-           gr_info->region2start = 576>>1;
-         else
-           gr_info->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1;
-         gr_info->block_type = 0;
-         gr_info->mixed_block_flag = 0;
-       }
-       if(!lsf)
-         gr_info->preflag = get1bit();
-       gr_info->scalefac_scale = get1bit();
-       gr_info->count1table_select = get1bit();
-     }
-   }
-
-   return !0;
-}
-
-/*
- * read scalefactors
- */
-static int III_get_scale_factors_1(int *scf,struct gr_info_s *gr_info)
-{
-   static const unsigned char slen[2][16] = {
-     {0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4},
-     {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3}
-   };
-   int numbits;
-   int num0 = slen[0][gr_info->scalefac_compress];
-   int num1 = slen[1][gr_info->scalefac_compress];
-
-    if (gr_info->block_type == 2) {
-      int i=18;
-      numbits = (num0 + num1) * 18;
-
-      if (gr_info->mixed_block_flag) {
-         for (i=8;i;i--)
-           *scf++ = getbits_fast(num0);
-         i = 9;
-         numbits -= num0; /* num0 * 17 + num1 * 18 */
-      }
-
-      for (;i;i--)
-        *scf++ = getbits_fast(num0);
-      for (i = 18; i; i--)
-        *scf++ = getbits_fast(num1);
-      *scf++ = 0; *scf++ = 0; *scf++ = 0; /* short[13][0..2] = 0 */
-    }
-    else {
-      int i;
-      int scfsi = gr_info->scfsi;
-
-      if(scfsi < 0) { /* scfsi < 0 => granule == 0 */
-         for(i=11;i;i--)
-           *scf++ = getbits_fast(num0);
-         for(i=10;i;i--)
-           *scf++ = getbits_fast(num1);
-         numbits = (num0 + num1) * 10 + num0;
-         *scf++ = 0;
-      }
-      else {
-        numbits = 0;
-        if(!(scfsi & 0x8)) {
-          for (i=0;i<6;i++)
-            *scf++ = getbits_fast(num0);
-          numbits += num0 * 6;
-        }
-        else {
-          scf += 6;
-        }
-
-        if(!(scfsi & 0x4)) {
-          for (i=0;i<5;i++)
-            *scf++ = getbits_fast(num0);
-          numbits += num0 * 5;
-        }
-        else {
-          scf += 5;
-        }
-
-        if(!(scfsi & 0x2)) {
-          for(i=0;i<5;i++)
-            *scf++ = getbits_fast(num1);
-          numbits += num1 * 5;
-        }
-        else {
-          scf += 5;
-        }
-
-        if(!(scfsi & 0x1)) {
-          for (i=0;i<5;i++)
-            *scf++ = getbits_fast(num1);
-          numbits += num1 * 5;
-        }
-        else {
-           scf += 5;
-        }
-        *scf++ = 0;  /* no l[21] in original sources */
-      }
-    }
-    return numbits;
-}
-
-static int III_get_scale_factors_2(int *scf,struct gr_info_s *gr_info,int i_stereo)
-{
-  unsigned char *pnt;
-  int i,j;
-  unsigned int slen;
-  int n = 0;
-  int numbits = 0;
-
-  static unsigned char stab[3][6][4] = {
-   { { 6, 5, 5,5 } , { 6, 5, 7,3 } , { 11,10,0,0} ,
-     { 7, 7, 7,0 } , { 6, 6, 6,3 } , {  8, 8,5,0} } ,
-   { { 9, 9, 9,9 } , { 9, 9,12,6 } , { 18,18,0,0} ,
-     {12,12,12,0 } , {12, 9, 9,6 } , { 15,12,9,0} } ,
-   { { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0} ,
-     { 6,15,12,0 } , { 6,12, 9,6 } , {  6,18,9,0} } };
-
-  if(i_stereo) /* i_stereo AND second channel -> do_layer3() checks this */
-    slen = i_slen2[gr_info->scalefac_compress>>1];
-  else
-    slen = n_slen2[gr_info->scalefac_compress];
-
-  gr_info->preflag = (slen>>15) & 0x1;
-
-  n = 0;
-  if( gr_info->block_type == 2 ) {
-    n++;
-    if(gr_info->mixed_block_flag) n++;
-  }
-
-  pnt = stab[n][(slen>>12)&0x7];
-
-  for(i=0;i<4;i++) {
-    int num = slen & 0x7;
-    slen >>= 3;
-    if(num) {
-      for(j=0;j<(int)(pnt[i]);j++) *scf++ = getbits_fast(num);
-      numbits += pnt[i] * num;
-    }
-    else {
-      for(j=0;j<(int)(pnt[i]);j++) *scf++ = 0;
-    }
-  }
-
-  n = (n << 1) + 1;
-  for(i=0;i<n;i++) *scf++ = 0;
-
-  return numbits;
-}
-
-static int pretab1[22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0};
-static int pretab2[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
-#define getbitoffset() ((-bitindex)&0x7)
-#define getbyte()      (*wordpointer++)
-
-/*
- * Dequantize samples (includes huffman decoding)
- */
-/* 24 is enough because tab13 has max. a 19 bit huffvector */
-#define BITSHIFT ((sizeof(long)-1)*8)
-#define REFRESH_MASK \
-  while(num < BITSHIFT) { \
-    mask |= ((unsigned long)getbyte())<<(BITSHIFT-num); \
-    num += 8; \
-    part2remain -= 8; }
-
-static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
-   struct gr_info_s *gr_info,int sfreq,int part2bits)
-{
-  int shift = 1 + gr_info->scalefac_scale;
-  real *xrpnt = (real *) xr;
-  int l[3],l3;
-  int part2remain = gr_info->part2_3_length - part2bits;
-  int *me;
-
-  int num=getbitoffset();
-  long mask;
-  /* we must split this, because for num==0 the shift is undefined if you do it in one step */
-  mask  = ((unsigned long) getbits(num))<<BITSHIFT;
-  mask <<= 8-num;
-  part2remain -= num;
-
-  {
-    int bv       = gr_info->big_values;
-    int region1  = gr_info->region1start;
-    int region2  = gr_info->region2start;
-
-    l3 = ((576>>1)-bv)>>1;
-/*
- * we may lose the 'odd' bit here !!
- * check this later again
- */
-    if(bv <= region1) {
-      l[0] = bv; l[1] = l[2] = 0;
-    }
-    else {
-      l[0] = region1;
-      if(bv <= region2) {
-        l[1] = bv - l[0];  l[2] = 0;
-      }
-      else {
-        l[1] = region2 - l[0]; l[2] = bv - region2;
-      }
-    }
-  }
-
-  if(gr_info->block_type == 2) {
-    /*
-     * decoding with short or mixed mode BandIndex table
-     */
-    int i,max[4];
-    int step=0,lwin=3,cb=0;
-    register real v = 0.0;
-    register int *m,mc;
-
-    if(gr_info->mixed_block_flag) {
-      max[3] = -1;
-      max[0] = max[1] = max[2] = 2;
-      m = map[sfreq][0];
-      me = mapend[sfreq][0];
-    }
-    else {
-      max[0] = max[1] = max[2] = max[3] = -1;
-      /* max[3] not really needed in this case */
-      m = map[sfreq][1];
-      me = mapend[sfreq][1];
-    }
-
-    mc = 0;
-    for(i=0;i<2;i++) {
-      int lp = l[i];
-      struct newhuff *h = ht+gr_info->table_select[i];
-      for(;lp;lp--,mc--) {
-        register int x,y;
-        if( (!mc) ) {
-          mc    = *m++;
-          xrpnt = ((real *) xr) + (*m++);
-          lwin  = *m++;
-          cb    = *m++;
-          if(lwin == 3) {
-            v = gr_info->pow2gain[(*scf++) << shift];
-            step = 1;
-          }
-          else {
-            v = gr_info->full_gain[lwin][(*scf++) << shift];
-            step = 3;
-          }
-        }
-        {
-          register short *val = h->table;
-          REFRESH_MASK;
-          while((y=*val++)<0) {
-            if (mask < 0)
-              val -= y;
-            num--;
-            mask <<= 1;
-          }
-          x = y >> 4;
-          y &= 0xf;
-        }
-        if(x == 15 && h->linbits) {
-          max[lwin] = cb;
-          REFRESH_MASK;
-          x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-          num -= h->linbits+1;
-          mask <<= h->linbits;
-          if(mask < 0)
-            *xrpnt = REAL_MUL(-ispow[x], v);
-          else
-            *xrpnt = REAL_MUL(ispow[x], v);
-          mask <<= 1;
-        }
-        else if(x) {
-          max[lwin] = cb;
-          if(mask < 0)
-            *xrpnt = REAL_MUL(-ispow[x], v);
-          else
-            *xrpnt = REAL_MUL(ispow[x], v);
-          num--;
-          mask <<= 1;
-        }
-        else
-          *xrpnt = 0.0;
-        xrpnt += step;
-        if(y == 15 && h->linbits) {
-          max[lwin] = cb;
-          REFRESH_MASK;
-          y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-          num -= h->linbits+1;
-          mask <<= h->linbits;
-          if(mask < 0)
-            *xrpnt = REAL_MUL(-ispow[y], v);
-          else
-            *xrpnt = REAL_MUL(ispow[y], v);
-          mask <<= 1;
-        }
-        else if(y) {
-          max[lwin] = cb;
-          if(mask < 0)
-            *xrpnt = REAL_MUL(-ispow[y], v);
-          else
-            *xrpnt = REAL_MUL(ispow[y], v);
-          num--;
-          mask <<= 1;
-        }
-        else
-          *xrpnt = 0.0;
-        xrpnt += step;
-      }
-    }
-
-    for(;l3 && (part2remain+num > 0);l3--) {
-      struct newhuff *h = htc+gr_info->count1table_select;
-      register short *val = h->table,a;
-
-      REFRESH_MASK;
-      while((a=*val++)<0) {
-        if (mask < 0)
-          val -= a;
-        num--;
-        mask <<= 1;
-      }
-      if(part2remain+num <= 0) {
-        num -= part2remain+num;
-        break;
-      }
-
-      for(i=0;i<4;i++) {
-        if(!(i & 1)) {
-          if(!mc) {
-            mc = *m++;
-            xrpnt = ((real *) xr) + (*m++);
-            lwin = *m++;
-            cb = *m++;
-            if(lwin == 3) {
-              v = gr_info->pow2gain[(*scf++) << shift];
-              step = 1;
-            }
-            else {
-              v = gr_info->full_gain[lwin][(*scf++) << shift];
-              step = 3;
-            }
-          }
-          mc--;
-        }
-        if( (a & (0x8>>i)) ) {
-          max[lwin] = cb;
-          if(part2remain+num <= 0) {
-            break;
-          }
-          if(mask < 0)
-            *xrpnt = -v;
-          else
-            *xrpnt = v;
-          num--;
-          mask <<= 1;
-        }
-        else
-          *xrpnt = 0.0;
-        xrpnt += step;
-      }
-    }
-
-    if(lwin < 3) { /* short band? */
-      while(1) {
-        for(;mc > 0;mc--) {
-          *xrpnt = 0.0; xrpnt += 3; /* short band -> step=3 */
-          *xrpnt = 0.0; xrpnt += 3;
-        }
-        if(m >= me)
-          break;
-        mc    = *m++;
-        xrpnt = ((real *) xr) + *m++;
-        if(*m++ == 0)
-          break; /* optimize: field will be set to zero at the end of the function */
-        m++; /* cb */
-      }
-    }
-
-    gr_info->maxband[0] = max[0]+1;
-    gr_info->maxband[1] = max[1]+1;
-    gr_info->maxband[2] = max[2]+1;
-    gr_info->maxbandl = max[3]+1;
-
-    {
-      int rmax = max[0] > max[1] ? max[0] : max[1];
-      rmax = (rmax > max[2] ? rmax : max[2]) + 1;
-      gr_info->maxb = rmax ? shortLimit[sfreq][rmax] : longLimit[sfreq][max[3]+1];
-    }
-
-  }
-  else {
-    /*
-     * decoding with 'long' BandIndex table (block_type != 2)
-     */
-    int *pretab = gr_info->preflag ? pretab1 : pretab2;
-    int i,max = -1;
-    int cb = 0;
-    int *m = map[sfreq][2];
-    register real v = 0.0;
-    int mc = 0;
-
-    /*
-     * long hash table values
-     */
-    for(i=0;i<3;i++) {
-      int lp = l[i];
-      struct newhuff *h = ht+gr_info->table_select[i];
-
-      for(;lp;lp--,mc--) {
-        int x,y;
-
-        if(!mc) {
-          mc = *m++;
-          cb = *m++;
-#ifdef CUT_HF
-          if(cb == 21) {
-            fprintf(stderr,"c");
-            v = 0.0;
-          }
-          else
-#endif
-            v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift];
-
-        }
-        {
-          register short *val = h->table;
-          REFRESH_MASK;
-          while((y=*val++)<0) {
-            if (mask < 0)
-              val -= y;
-            num--;
-            mask <<= 1;
-          }
-          x = y >> 4;
-          y &= 0xf;
-        }
-
-        if (x == 15 && h->linbits) {
-          max = cb;
-          REFRESH_MASK;
-          x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-          num -= h->linbits+1;
-          mask <<= h->linbits;
-          if(mask < 0)
-            *xrpnt++ = REAL_MUL(-ispow[x], v);
-          else
-            *xrpnt++ = REAL_MUL(ispow[x], v);
-          mask <<= 1;
-        }
-        else if(x) {
-          max = cb;
-          if(mask < 0)
-            *xrpnt++ = REAL_MUL(-ispow[x], v);
-          else
-            *xrpnt++ = REAL_MUL(ispow[x], v);
-          num--;
-          mask <<= 1;
-        }
-        else
-          *xrpnt++ = 0.0;
-
-        if (y == 15 && h->linbits) {
-          max = cb;
-          REFRESH_MASK;
-          y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-          num -= h->linbits+1;
-          mask <<= h->linbits;
-          if(mask < 0)
-            *xrpnt++ = REAL_MUL(-ispow[y], v);
-          else
-            *xrpnt++ = REAL_MUL(ispow[y], v);
-          mask <<= 1;
-        }
-        else if(y) {
-          max = cb;
-          if(mask < 0)
-            *xrpnt++ = REAL_MUL(-ispow[y], v);
-          else
-            *xrpnt++ = REAL_MUL(ispow[y], v);
-          num--;
-          mask <<= 1;
-        }
-        else
-          *xrpnt++ = 0.0;
-      }
-    }
-
-    /*
-     * short (count1table) values
-     */
-    for(;l3 && (part2remain+num > 0);l3--) {
-      struct newhuff *h = htc+gr_info->count1table_select;
-      register short *val = h->table,a;
-
-      REFRESH_MASK;
-      while((a=*val++)<0) {
-        if (mask < 0)
-          val -= a;
-        num--;
-        mask <<= 1;
-      }
-      if(part2remain+num <= 0) {
-        num -= part2remain+num;
-        break;
-      }
-
-      for(i=0;i<4;i++) {
-        if(!(i & 1)) {
-          if(!mc) {
-            mc = *m++;
-            cb = *m++;
-#ifdef CUT_HF
-            if(cb == 21) {
-              fprintf(stderr,"c");
-              v = 0.0;
-            }
-            else
-#endif
-              v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift];
-          }
-          mc--;
-        }
-        if ( (a & (0x8>>i)) ) {
-          max = cb;
-          if(part2remain+num <= 0) {
-            break;
-          }
-          if(mask < 0)
-            *xrpnt++ = -v;
-          else
-            *xrpnt++ = v;
-          num--;
-          mask <<= 1;
-        }
-        else
-          *xrpnt++ = 0.0;
-      }
-    }
-
-    gr_info->maxbandl = max+1;
-    gr_info->maxb = longLimit[sfreq][gr_info->maxbandl];
-  }
-
-  part2remain += num;
-//  backbits(num);
-  bitindex -= num; wordpointer += (bitindex>>3); bitindex &= 0x7;
-  num = 0;
-
-  while(xrpnt < &xr[SBLIMIT][0])
-    *xrpnt++ = 0.0;
-
-  while( part2remain > 16 ) {
-    getbits(16); /* Dismiss stuffing Bits */
-    part2remain -= 16;
-  }
-  if(part2remain > 0)
-    getbits(part2remain);
-  else if(part2remain < 0) {
-      fprintf(stderr,"mpg123: Can't rewind stream by %d bits!\n",-part2remain);
-    return 1; /* -> error */
-  }
-  return 0;
-}
-
-
-
-
-/*
- * III_stereo: calculate real channel values for Joint-I-Stereo-mode
- */
-static void III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT],int *scalefac,
-   struct gr_info_s *gr_info,int sfreq,int ms_stereo,int lsf)
-{
-      real (*xr)[SBLIMIT*SSLIMIT] = (real (*)[SBLIMIT*SSLIMIT] ) xr_buf;
-      const struct bandInfoStruct *bi = &bandInfo[sfreq];
-
-      const real *tab1,*tab2;
-
-      int tab;
-      static const real *tabs[3][2][2] = {
-         { { tan1_1,tan2_1 }     , { tan1_2,tan2_2 } },
-         { { pow1_1[0],pow2_1[0] } , { pow1_2[0],pow2_2[0] } } ,
-         { { pow1_1[1],pow2_1[1] } , { pow1_2[1],pow2_2[1] } }
-      };
-
-      tab = lsf + (gr_info->scalefac_compress & lsf);
-      tab1 = tabs[tab][ms_stereo][0];
-      tab2 = tabs[tab][ms_stereo][1];
-#if 0
-      if(lsf) {
-        int p = gr_info->scalefac_compress & 0x1;
-        if(ms_stereo) {
-          tab1 = pow1_2[p]; tab2 = pow2_2[p];
-        }
-        else {
-          tab1 = pow1_1[p]; tab2 = pow2_1[p];
-        }
-      }
-      else {
-        if(ms_stereo) {
-          tab1 = tan1_2; tab2 = tan2_2;
-        }
-        else {
-          tab1 = tan1_1; tab2 = tan2_1;
-        }
-      }
-#endif
-
-//      printf("III_i_st: tab1=%p tab2=%p tab=%d ms=%d  \n", tab1, tab2, tab, ms_stereo);
-
-      if (gr_info->block_type == 2) {
-         int lwin,do_l = 0;
-         if( gr_info->mixed_block_flag )
-           do_l = 1;
-
-         for (lwin=0;lwin<3;lwin++) { /* process each window */
-             /* get first band with zero values */
-           int is_p,sb,idx,sfb = gr_info->maxband[lwin];  /* sfb is minimal 3 for mixed mode */
-           if(sfb > 3)
-             do_l = 0;
-
-           for(;sfb<12;sfb++) {
-             is_p = scalefac[sfb*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */
-             if(is_p != 7) {
-               real t1,t2;
-               sb  = bi->shortDiff[sfb];
-               idx = bi->shortIdx[sfb] + lwin;
-               t1  = tab1[is_p]; t2 = tab2[is_p];
-               for (; sb > 0; sb--,idx+=3) {
-                 real v = xr[0][idx];
-                 xr[0][idx] = REAL_MUL(v, t1);
-                 xr[1][idx] = REAL_MUL(v, t2);
-               }
-             }
-           }
-
-#if 1
-/* in the original: copy 10 to 11 , here: copy 11 to 12
-maybe still wrong??? (copy 12 to 13?) */
-           is_p = scalefac[11*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */
-           sb   = bi->shortDiff[12];
-           idx  = bi->shortIdx[12] + lwin;
-#else
-           is_p = scalefac[10*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */
-           sb   = bi->shortDiff[11];
-           idx  = bi->shortIdx[11] + lwin;
-#endif
-           if(is_p != 7) {
-             real t1,t2;
-             t1 = tab1[is_p]; t2 = tab2[is_p];
-             for ( ; sb > 0; sb--,idx+=3 ) {
-               real v = xr[0][idx];
-               xr[0][idx] = REAL_MUL(v, t1);
-               xr[1][idx] = REAL_MUL(v, t2);
-             }
-           }
-         } /* end for(lwin; .. ; . ) */
-
-/* also check l-part, if ALL bands in the three windows are 'empty'
- * and mode = mixed_mode
- */
-         if (do_l) {
-           int sfb = gr_info->maxbandl;
-           int idx = bi->longIdx[sfb];
-
-           for ( ; sfb<8; sfb++ ) {
-             int sb = bi->longDiff[sfb];
-             int is_p = scalefac[sfb]; /* scale: 0-15 */
-             if(is_p != 7) {
-               real t1,t2;
-               t1 = tab1[is_p]; t2 = tab2[is_p];
-               for ( ; sb > 0; sb--,idx++) {
-                 real v = xr[0][idx];
-                 xr[0][idx] = REAL_MUL(v, t1);
-                 xr[1][idx] = REAL_MUL(v, t2);
-               }
-             }
-             else
-               idx += sb;
-           }
-         }
-      }
-      else { /* ((gr_info->block_type != 2)) */
-       int sfb = gr_info->maxbandl;
-       int is_p,idx = bi->longIdx[sfb];
-
-/* hmm ... maybe the maxbandl stuff for i-stereo is buggy? */
-       if(sfb <= 21) {
-        for ( ; sfb<21; sfb++) {
-          int sb = bi->longDiff[sfb];
-          is_p = scalefac[sfb]; /* scale: 0-15 */
-          if(is_p != 7) {
-            real t1,t2;
-            t1 = tab1[is_p]; t2 = tab2[is_p];
-            for ( ; sb > 0; sb--,idx++) {
-               real v = xr[0][idx];
-               xr[0][idx] = REAL_MUL(v, t1);
-               xr[1][idx] = REAL_MUL(v, t2);
-            }
-          }
-          else
-            idx += sb;
-        }
-
-        is_p = scalefac[20];
-        if(is_p != 7) {  /* copy l-band 20 to l-band 21 */
-          int sb;
-          real t1 = tab1[is_p],t2 = tab2[is_p];
-
-          for ( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) {
-            real v = xr[0][idx];
-            xr[0][idx] = REAL_MUL(v, t1);
-            xr[1][idx] = REAL_MUL(v, t2);
-          }
-        }
-       }        /* end: if(sfb <= 21) */
-      } /* ... */
-}
-
-static void III_antialias(real xr[SBLIMIT][SSLIMIT],struct gr_info_s *gr_info) {
-   int sblim;
-
-   if(gr_info->block_type == 2) {
-      if(!gr_info->mixed_block_flag)
-        return;
-      sblim = 1;
-   }
-   else {
-     sblim = gr_info->maxb-1;
-   }
-
-   /* 31 alias-reduction operations between each pair of sub-bands */
-   /* with 8 butterflies between each pair                         */
-
-   {
-     int sb;
-     real *xr1=(real *) xr[1];
-
-     for(sb=sblim;sb;sb--,xr1+=10) {
-       int ss;
-       real *cs=aa_cs,*ca=aa_ca;
-       real *xr2 = xr1;
-
-       for(ss=7;ss>=0;ss--) {    /* upper and lower butterfly inputs */
-         register real bu = *--xr2,bd = *xr1;
-         *xr2   = (bu * (*cs)   ) - (bd * (*ca)   );
-         *xr1++ = (bd * (*cs++) ) + (bu * (*ca++) );
-       }
-     }
-
-  }
-}
-
-#include "dct64.c"
-#include "dct36.c"
-#include "dct12.c"
-
-#include "decod386.c"
-
-/*
- * III_hybrid
- */
-
-static dct36_func_t dct36_func;
-
-static void III_hybrid(real fsIn[SBLIMIT][SSLIMIT],real tsOut[SSLIMIT][SBLIMIT],
-   int ch,struct gr_info_s *gr_info)
-{
-   real *tspnt = (real *) tsOut;
-   static real block[2][2][SBLIMIT*SSLIMIT] = { { { 0, } } };
-   static int blc[2]={0,0};
-   real *rawout1,*rawout2;
-   int bt;
-   int sb = 0;
-
-   {
-     int b = blc[ch];
-     rawout1=block[b][ch];
-     b=-b+1;
-     rawout2=block[b][ch];
-     blc[ch] = b;
-   }
-
-   if(gr_info->mixed_block_flag) {
-     sb = 2;
-     (*dct36_func)(fsIn[0],rawout1,rawout2,win[0],tspnt);
-     (*dct36_func)(fsIn[1],rawout1+18,rawout2+18,win1[0],tspnt+1);
-     rawout1 += 36; rawout2 += 36; tspnt += 2;
-   }
-
-   bt = gr_info->block_type;
-   if(bt == 2) {
-     for (; sb<gr_info->maxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) {
-       dct12(fsIn[sb],rawout1,rawout2,win[2],tspnt);
-       dct12(fsIn[sb+1],rawout1+18,rawout2+18,win1[2],tspnt+1);
-     }
-   }
-   else {
-     for (; sb<gr_info->maxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) {
-       (*dct36_func)(fsIn[sb],rawout1,rawout2,win[bt],tspnt);
-       (*dct36_func)(fsIn[sb+1],rawout1+18,rawout2+18,win1[bt],tspnt+1);
-     }
-   }
-
-   for(;sb<SBLIMIT;sb++,tspnt++) {
-     int i;
-     for(i=0;i<SSLIMIT;i++) {
-       tspnt[i*SBLIMIT] = *rawout1++;
-       *rawout2++ = 0.0;
-     }
-   }
-}
-
-/*
- * main layer3 handler
- */
-/* int do_layer3(struct frame *fr,int outmode,struct audio_info_struct *ai) */
-static int do_layer3(struct frame *fr,int single){
-  int gr, ch, ss,clip=0;
-  int scalefacs[2][39]; /* max 39 for short[13][3] mode, mixed: 38, long: 22 */
-  struct III_sideinfo sideinfo;
-  int stereo = fr->stereo;
-  int ms_stereo,i_stereo;
-  int sfreq = fr->sampling_frequency;
-  int stereo1,granules;
-
-//  if (fr->error_protection) getbits(16); /* skip crc */
-
-  if(stereo == 1) { /* stream is mono */
-    stereo1 = 1;
-    single = 0;
-  } else
-  if(single >= 0) /* stream is stereo, but force to mono */
-    stereo1 = 1;
-  else
-    stereo1 = 2;
-
-  if(fr->mode == MPG_MD_JOINT_STEREO) {
-    ms_stereo = (fr->mode_ext & 0x2)>>1;
-    i_stereo  = fr->mode_ext & 0x1;
-  } else
-    ms_stereo = i_stereo = 0;
-
-  if(!III_get_side_info(&sideinfo,stereo,ms_stereo,sfreq,single,fr->lsf))
-    return -1;
-
-  set_pointer(sideinfo.main_data_begin);
-
-  granules = (fr->lsf) ? 1 : 2;
-  for (gr=0;gr<granules;gr++){
-    DECLARE_ALIGNED(16, real, hybridIn[2][SBLIMIT][SSLIMIT]);
-    DECLARE_ALIGNED(16, real, hybridOut[2][SSLIMIT][SBLIMIT]);
-
-    { struct gr_info_s *gr_info = &(sideinfo.ch[0].gr[gr]);
-      int part2bits;
-      if(fr->lsf)
-        part2bits = III_get_scale_factors_2(scalefacs[0],gr_info,0);
-      else
-        part2bits = III_get_scale_factors_1(scalefacs[0],gr_info);
-      if(III_dequantize_sample(hybridIn[0], scalefacs[0],gr_info,sfreq,part2bits))
-        return clip;
-    }
-
-    if(stereo == 2) {
-      struct gr_info_s *gr_info = &(sideinfo.ch[1].gr[gr]);
-
-      int part2bits;
-      if(fr->lsf)
-        part2bits = III_get_scale_factors_2(scalefacs[1],gr_info,i_stereo);
-      else
-        part2bits = III_get_scale_factors_1(scalefacs[1],gr_info);
-
-      if(III_dequantize_sample(hybridIn[1],scalefacs[1],gr_info,sfreq,part2bits))
-          return clip;
-
-      if(ms_stereo) {
-        int i;
-        int maxb = sideinfo.ch[0].gr[gr].maxb;
-        if(sideinfo.ch[1].gr[gr].maxb > maxb)
-            maxb = sideinfo.ch[1].gr[gr].maxb;
-        for(i=0;i<SSLIMIT*maxb;i++) {
-          real tmp0 = ((real *)hybridIn[0])[i];
-          real tmp1 = ((real *)hybridIn[1])[i];
-          ((real *)hybridIn[0])[i] = tmp0 + tmp1;
-          ((real *)hybridIn[1])[i] = tmp0 - tmp1;
-        }
-      }
-
-      if(i_stereo)
-        III_i_stereo(hybridIn,scalefacs[1],gr_info,sfreq,ms_stereo,fr->lsf);
-
-      if(ms_stereo || i_stereo || (single == 3) ) {
-        if(gr_info->maxb > sideinfo.ch[0].gr[gr].maxb)
-          sideinfo.ch[0].gr[gr].maxb = gr_info->maxb;
-        else
-          gr_info->maxb = sideinfo.ch[0].gr[gr].maxb;
-      }
-
-      switch(single) {
-        case 3: {
-          register int i;
-          register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1];
-          for(i=0;i<SSLIMIT*gr_info->maxb;i++,in0++)
-            *in0 = (*in0 + *in1++); /* *0.5 done by pow-scale */
-          break; }
-        case 1: {
-          register int i;
-          register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1];
-          for(i=0;i<SSLIMIT*gr_info->maxb;i++)
-            *in0++ = *in1++;
-          break; }
-      }
-
-    }  // if(stereo == 2)
-
-    for(ch=0;ch<stereo1;ch++) {
-      struct gr_info_s *gr_info = &(sideinfo.ch[ch].gr[gr]);
-                  III_antialias(hybridIn[ch],gr_info);
-                  III_hybrid(hybridIn[ch], hybridOut[ch], ch,gr_info);
-    }
-
-    for(ss=0;ss<SSLIMIT;ss++) {
-      if(single >= 0) {
-                    clip += (fr->synth_mono)(hybridOut[0][ss],pcm_sample,&pcm_point);
-                } else {
-                  int p1 = pcm_point;
-                    clip += (fr->synth)(hybridOut[0][ss],0,pcm_sample,&p1);
-                    clip += (fr->synth)(hybridOut[1][ss],1,pcm_sample,&pcm_point);
-      }
-    }
-
-  }
-
-  return clip;
-}
diff --git a/mplayer/mp3lib/mp3.h b/mplayer/mp3lib/mp3.h
deleted file mode 100644
index 3877f01..0000000
--- a/mplayer/mp3lib/mp3.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* MP3 Player Library 2.0      (C) 1999 A'rpi/Astral&ESP-team  */
-
-#ifndef MPLAYER_MP3LIB_MP3_H
-#define MPLAYER_MP3LIB_MP3_H
-
-/* decoder level: */
-#ifdef CONFIG_FAKE_MONO
-void MP3_Init(int fakemono);
-#else
-void MP3_Init(void);
-#endif
-int MP3_Open(char *filename, int buffsize);
-void MP3_SeekFrame(int num, int dir);
-void MP3_SeekForward(int num);
-int MP3_PrintTAG(void);
-int MP3_DecodeFrame(unsigned char *hova, short single);
-int MP3_FillBuffers(void);
-void MP3_PrintHeader(void);
-void MP3_Close(void);
-/* public variables: */
-extern int MP3_eof;        // set if EOF reached
-extern int MP3_pause;      // lock playing
-/* informational: */
-extern int MP3_filesize;   // filesize
-extern int MP3_frames;     // current frame no
-extern int MP3_fpos;       // current file pos
-extern int MP3_framesize;  // current framesize in bytes (including header)
-extern int MP3_bitrate;    // current bitrate (kbits)
-extern int MP3_samplerate; // current sampling freq (Hz)
-extern int MP3_channels;
-extern int MP3_bps;
-
-/* player level: */
-int  MP3_OpenDevice(char *devname);  /* devname can be NULL for default) */
-void MP3_Play(void);
-void MP3_Stop(void);
-void MP3_CloseDevice(void);
-
-#endif /* MPLAYER_MP3LIB_MP3_H */
diff --git a/mplayer/mp3lib/mpg123.h b/mplayer/mp3lib/mpg123.h
deleted file mode 100644
index 0b9f781..0000000
--- a/mplayer/mp3lib/mpg123.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-/*
- * mpg123 defines
- * used source: musicout.h from mpegaudio package
- */
-
-#ifndef MPLAYER_MP3LIB_MPG123_H
-#define MPLAYER_MP3LIB_MPG123_H
-
-#include "config.h"
-
-#ifndef M_PI
-#define M_PI            3.141592653589793238462
-#endif
-#ifndef M_SQRT2
-#define M_SQRT2         1.414213562373095048802
-#endif
-#define REAL_IS_FLOAT
-#define NEW_DCT9
-
-#undef MPG123_REMOTE           /* Get rid of this stuff for Win32 */
-
-typedef float real;
-
-/*
-#  define real float
-#  define real long double
-#  define real double
-#include "audio.h"
-
-// #define              AUDIOBUFSIZE            4096
-*/
-
-#define         FALSE                   0
-#define         TRUE                    1
-
-#define         MAX_NAME_SIZE           81
-#define         SBLIMIT                 32
-#define         SCALE_BLOCK             12
-#define         SSLIMIT                 18
-
-#define         MPG_MD_STEREO           0
-#define         MPG_MD_JOINT_STEREO     1
-#define         MPG_MD_DUAL_CHANNEL     2
-#define         MPG_MD_MONO             3
-
-/* #define MAXOUTBURST 32768 */
-
-/* Pre Shift fo 16 to 8 bit converter table */
-#define AUSHIFT (3)
-
-struct al_table
-{
-  short bits;
-  short d;
-};
-
-struct frame {
-         struct al_table *alloc;
-         int (*synth)(real *,int,unsigned char *,int *);
-    int (*synth_mono)(real *,unsigned char *,int *);
-    int stereo;
-    int jsbound;
-    int single;
-    int II_sblimit;
-    int down_sample_sblimit;
-         int lsf;
-         int mpeg25;
-    int down_sample;
-         int header_change;
-    int lay;
-    int error_protection;
-    int bitrate_index;
-    int sampling_frequency;
-    int padding;
-    int extension;
-    int mode;
-         int mode_ext;
-    int copyright;
-         int original;
-         int emphasis;
-         int framesize; /* computed framesize */
-};
-
-
-struct gr_info_s {
-      int scfsi;
-      unsigned part2_3_length;
-      unsigned big_values;
-      unsigned scalefac_compress;
-      unsigned block_type;
-      unsigned mixed_block_flag;
-      unsigned table_select[3];
-      unsigned subblock_gain[3];
-      unsigned maxband[3];
-      unsigned maxbandl;
-      unsigned maxb;
-      unsigned region1start;
-      unsigned region2start;
-      unsigned preflag;
-      unsigned scalefac_scale;
-      unsigned count1table_select;
-      real *full_gain[3];
-      real *pow2gain;
-};
-
-struct III_sideinfo
-{
-  unsigned main_data_begin;
-  unsigned private_bits;
-  struct {
-         struct gr_info_s gr[2];
-  } ch[2];
-};
-
-extern real mp3lib_decwin[(512+32)];
-extern real *mp3lib_pnts[];
-
-int synth_1to1_pent( real *, int, short * );
-int synth_1to1_MMX( real *, int, short * );
-int synth_1to1_MMX_s(real *, int, short *, short *, int *);
-
-void dct36_3dnow(real *, real *, real *, real *, real *);
-void dct36_3dnowex(real *, real *, real *, real *, real *);
-void dct36_sse(real *, real *, real *, real *, real *);
-
-void dct64_MMX(short *, short *, real *);
-void dct64_MMX_3dnow(short *, short *, real *);
-void dct64_MMX_3dnowex(short *, short *, real *);
-void dct64_sse(short *, short *, real *);
-void dct64_altivec(real *, real *, real *);
-extern void (*dct64_MMX_func)(short *, short *, real *);
-
-void mp3lib_dct64(real *, real *, real *);
-
-typedef int (*synth_func_t)( real *,int,short * );
-typedef void (*dct36_func_t)(real *,real *,real *,real *,real *);
-
-#endif /* MPLAYER_MP3LIB_MPG123_H */
diff --git a/mplayer/mp3lib/sr1.c b/mplayer/mp3lib/sr1.c
deleted file mode 100644
index 57f0578..0000000
--- a/mplayer/mp3lib/sr1.c
+++ /dev/null
@@ -1,605 +0,0 @@
-// #define NEWBUFFERING
-//#define DEBUG_RESYNC
-
-/* 1 frame = 4608 byte PCM */
-
-#define LOCAL static inline
-
-//#undef LOCAL
-//#define LOCAL
-
-#include        <stdlib.h>
-#include        <stdio.h>
-#include        <string.h>
-#include        <math.h>
-
-#include "mpg123.h"
-#include "huffman.h"
-#include "mp3.h"
-#include "mpbswap.h"
-#include "cpudetect.h"
-#include "mp_msg.h"
-#include "libmpcodecs/ad_mp3lib.h"
-#include "libvo/fastmemcpy.h"
-
-#include "libavutil/common.h"
-
-#if ARCH_X86_64
-// 3DNow! and 3DNow!Ext routines don't compile under AMD64
-#undef HAVE_AMD3DNOW
-#undef HAVE_AMD3DNOWEXT
-#define HAVE_AMD3DNOW 0
-#define HAVE_AMD3DNOWEXT 0
-#endif
-
-//static FILE* mp3_file=NULL;
-
-int MP3_frames=0;
-int MP3_eof=0;
-int MP3_pause=0;
-int MP3_filesize=0;
-int MP3_fpos=0;      // current file position
-int MP3_framesize=0; // current framesize
-int MP3_bitrate=0;   // current bitrate
-int MP3_samplerate=0;  // current samplerate
-int MP3_resync=0;
-int MP3_channels=0;
-int MP3_bps=2;
-
-static long outscale = 32768;
-#include "tabinit.c"
-
-#if 1
-LOCAL int mp3_read(char *buf,int size){
-//  int len=fread(buf,1,size,mp3_file);
-  int len=mplayer_audio_read(buf,size);
-  if(len>0) MP3_fpos+=len;
-//  if(len!=size) MP3_eof=1;
-  return len;
-}
-#else
-int mp3_read(char *buf,int size);
-#endif
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-
-//void mp3_seek(int pos){
-//  fseek(mp3_file,pos,SEEK_SET);
-//  return MP3_fpos = ftell(mp3_file);
-//}
-
-/*       Frame reader           */
-
-#define MAXFRAMESIZE 1280
-#define MAXFRAMESIZE2 (512+MAXFRAMESIZE)
-
-static int fsizeold=0,ssize=0;
-static unsigned char bsspace[2][MAXFRAMESIZE2]; /* !!!!! */
-static unsigned char *bsbufold=bsspace[0]+512;
-static unsigned char *bsbuf=bsspace[1]+512;
-static int bsnum=0;
-
-static int bitindex;
-static unsigned char *wordpointer;
-static int bitsleft;
-
-static unsigned char *pcm_sample;   /* outbuffer address */
-static int pcm_point = 0;           /* outbuffer offset */
-
-static struct frame fr;
-
-static int tabsel_123[2][3][16] = {
-   { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,},
-     {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,},
-     {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} },
-
-   { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,},
-     {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,},
-     {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
-};
-
-static int freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 };
-
-LOCAL unsigned int getbits(short number_of_bits)
-{
-  unsigned rval;
-//  if(MP3_frames>=7741) printf("getbits: bits=%d  bitsleft=%d  wordptr=%x\n",number_of_bits,bitsleft,wordpointer);
-  if((bitsleft-=number_of_bits)<0) return 0;
-  if(!number_of_bits) return 0;
-         rval = wordpointer[0];
-         rval <<= 8;
-         rval |= wordpointer[1];
-         rval <<= 8;
-         rval |= wordpointer[2];
-         rval <<= bitindex;
-         rval &= 0xffffff;
-         bitindex += number_of_bits;
-         rval >>= (24-number_of_bits);
-         wordpointer += (bitindex>>3);
-         bitindex &= 7;
-  return rval;
-}
-
-
-LOCAL unsigned int getbits_fast(short number_of_bits)
-{
-  unsigned rval;
-//  if(MP3_frames>=7741) printf("getbits_fast: bits=%d  bitsleft=%d  wordptr=%x\n",number_of_bits,bitsleft,wordpointer);
-  if((bitsleft-=number_of_bits)<0) return 0;
-  if(!number_of_bits) return 0;
-#if ARCH_X86
-  rval = bswap_16(*((uint16_t *)wordpointer));
-#else
-  /*
-   * we may not be able to address unaligned 16-bit data on non-x86 cpus.
-   * Fall back to some portable code.
-   */
-  rval = wordpointer[0] << 8 | wordpointer[1];
-#endif
-         rval <<= bitindex;
-         rval &= 0xffff;
-         bitindex += number_of_bits;
-         rval >>= (16-number_of_bits);
-         wordpointer += (bitindex>>3);
-         bitindex &= 7;
-  return rval;
-}
-
-LOCAL unsigned int get1bit(void)
-{
-  unsigned char rval;
-//  if(MP3_frames>=7741) printf("get1bit: bitsleft=%d  wordptr=%x\n",bitsleft,wordpointer);
-  if((--bitsleft)<0) return 0;
-  rval = *wordpointer << bitindex;
-  bitindex++;
-  wordpointer += (bitindex>>3);
-  bitindex &= 7;
-  return (rval >> 7) & 1;
-}
-
-LOCAL void set_pointer(int backstep)
-{
-//  if(backstep!=512 && backstep>fsizeold)
-//    printf("\rWarning! backstep (%d>%d)                                         \n",backstep,fsizeold);
-  wordpointer = bsbuf + ssize - backstep;
-  if (backstep) fast_memcpy(wordpointer,bsbufold+fsizeold-backstep,backstep);
-  bitindex = 0;
-  bitsleft+=8*backstep;
-//  printf("Backstep %d  (bitsleft=%d)\n",backstep,bitsleft);
-}
-
-LOCAL int stream_head_read(unsigned char *hbuf,uint32_t *newhead){
-  if(mp3_read(hbuf,4) != 4) return FALSE;
-#if ARCH_X86
-  *newhead = bswap_32(*((uint32_t*)hbuf));
-#else
-  /*
-   * we may not be able to address unaligned 32-bit data on non-x86 cpus.
-   * Fall back to some portable code.
-   */
-  *newhead =
-      hbuf[0] << 24 |
-      hbuf[1] << 16 |
-      hbuf[2] <<  8 |
-      hbuf[3];
-#endif
-  return TRUE;
-}
-
-LOCAL int stream_head_shift(unsigned char *hbuf,uint32_t *head){
-  *((uint32_t*)hbuf) >>= 8;
-  if(mp3_read(hbuf+3,1) != 1) return 0;
-  *head <<= 8;
-  *head |= hbuf[3];
-  return 1;
-}
-
-/*
- * decode a header and write the information
- * into the frame structure
- */
-LOCAL int decode_header(struct frame *fr,uint32_t newhead){
-
-    // head_check:
-    if( (newhead & 0xffe00000) != 0xffe00000 ||
-        (newhead & 0x0000fc00) == 0x0000fc00) return FALSE;
-
-    fr->lay = 4-((newhead>>17)&3);
-//    if(fr->lay!=3) return FALSE;
-
-    if( newhead & (1<<20) ) {
-      fr->lsf = (newhead & (1<<19)) ? 0x0 : 0x1;
-      fr->mpeg25 = 0;
-    } else {
-      fr->lsf = 1;
-      fr->mpeg25 = 1;
-    }
-
-    if(fr->mpeg25)
-      fr->sampling_frequency = 6 + ((newhead>>10)&0x3);
-    else
-      fr->sampling_frequency = ((newhead>>10)&0x3) + (fr->lsf*3);
-
-    if(fr->sampling_frequency>8) return FALSE;  // valid: 0..8
-
-    fr->error_protection = ((newhead>>16)&0x1)^0x1;
-    fr->bitrate_index = ((newhead>>12)&0xf);
-    fr->padding   = ((newhead>>9)&0x1);
-    fr->extension = ((newhead>>8)&0x1);
-    fr->mode      = ((newhead>>6)&0x3);
-    fr->mode_ext  = ((newhead>>4)&0x3);
-    fr->copyright = ((newhead>>3)&0x1);
-    fr->original  = ((newhead>>2)&0x1);
-    fr->emphasis  = newhead & 0x3;
-
-    MP3_channels = fr->stereo    = (fr->mode == MPG_MD_MONO) ? 1 : 2;
-
-    if(!fr->bitrate_index){
-//      fprintf(stderr,"Free format not supported.\n");
-      return FALSE;
-    }
-
-switch(fr->lay){
-  case 2:
-    MP3_bitrate=tabsel_123[fr->lsf][1][fr->bitrate_index];
-    MP3_samplerate=freqs[fr->sampling_frequency];
-    fr->framesize = MP3_bitrate * 144000;
-    fr->framesize /= MP3_samplerate;
-    MP3_framesize=fr->framesize;
-    fr->framesize += fr->padding - 4;
-    break;
-  case 3:
-    if(fr->lsf)
-      ssize = (fr->stereo == 1) ? 9 : 17;
-    else
-      ssize = (fr->stereo == 1) ? 17 : 32;
-    if(fr->error_protection) ssize += 2;
-
-    MP3_bitrate=tabsel_123[fr->lsf][2][fr->bitrate_index];
-    MP3_samplerate=freqs[fr->sampling_frequency];
-    fr->framesize  = MP3_bitrate * 144000;
-    fr->framesize /= MP3_samplerate<<(fr->lsf);
-    MP3_framesize=fr->framesize;
-    fr->framesize += fr->padding - 4;
-    break;
-  case 1:
-//    fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32;
-    MP3_bitrate=tabsel_123[fr->lsf][0][fr->bitrate_index];
-    MP3_samplerate=freqs[fr->sampling_frequency];
-    fr->framesize  = MP3_bitrate * 12000;
-    fr->framesize /= MP3_samplerate;
-    MP3_framesize  = ((fr->framesize+fr->padding)<<2);
-    fr->framesize  = MP3_framesize-4;
-//    printf("framesize=%d\n",fr->framesize);
-    break;
-  default:
-    MP3_framesize=fr->framesize=0;
-//    fprintf(stderr,"Sorry, unsupported layer type.\n");
-    return 0;
-}
-    if(fr->framesize<=0 || fr->framesize>MAXFRAMESIZE) return FALSE;
-
-    return 1;
-}
-
-
-LOCAL int stream_read_frame_body(int size){
-
-  /* flip/init buffer for Layer 3 */
-  bsbufold = bsbuf;
-  bsbuf = bsspace[bsnum]+512;
-  bsnum = (bsnum + 1) & 1;
-
-  if( mp3_read(bsbuf,size) != size) return 0; // broken frame
-
-  bitindex = 0;
-  wordpointer = (unsigned char *) bsbuf;
-  bitsleft=8*size;
-
-  return 1;
-}
-
-
-/*****************************************************************
- * read next frame     return number of frames read.
- */
-LOCAL int read_frame(struct frame *fr){
-  uint32_t newhead;
-  union {
-    unsigned char buf[8];
-    unsigned long dummy; // for alignment
-  } hbuf;
-  int skipped,resyncpos;
-  int frames=0;
-
-resync:
-  skipped=MP3_fpos;
-  resyncpos=MP3_fpos;
-
-  set_pointer(512);
-  fsizeold=fr->framesize;       /* for Layer3 */
-  if(!stream_head_read(hbuf.buf,&newhead)) return 0;
-  if(!decode_header(fr,newhead)){
-    // invalid header! try to resync stream!
-#ifdef DEBUG_RESYNC
-    printf("ReSync: searching for a valid header...  (pos=%X)\n",MP3_fpos);
-#endif
-retry1:
-    while(!decode_header(fr,newhead)){
-      if(!stream_head_shift(hbuf.buf,&newhead)) return 0;
-    }
-    resyncpos=MP3_fpos-4;
-    // found valid header
-#ifdef DEBUG_RESYNC
-    printf("ReSync: found valid hdr at %X  fsize=%ld  ",resyncpos,fr->framesize);
-#endif
-    if(!stream_read_frame_body(fr->framesize)) return 0; // read body
-    set_pointer(512);
-    fsizeold=fr->framesize;       /* for Layer3 */
-    if(!stream_head_read(hbuf.buf,&newhead)) return 0;
-    if(!decode_header(fr,newhead)){
-      // invalid hdr! go back...
-#ifdef DEBUG_RESYNC
-      printf("INVALID\n");
-#endif
-//      mp3_seek(resyncpos+1);
-      if(!stream_head_read(hbuf.buf,&newhead)) return 0;
-      goto retry1;
-    }
-#ifdef DEBUG_RESYNC
-    printf("OK!\n");
-    ++frames;
-#endif
-  }
-
-  skipped=resyncpos-skipped;
-//  if(skipped && !MP3_resync) printf("\r%d bad bytes skipped  (resync at 0x%X)                          \n",skipped,resyncpos);
-
-//  printf("%8X [%08X] %d %d (%d)%s%s\n",MP3_fpos-4,newhead,fr->framesize,fr->mode,fr->mode_ext,fr->error_protection?" CRC":"",fr->padding?" PAD":"");
-
-  /* read main data into memory */
-  if(!stream_read_frame_body(fr->framesize)){
-    printf("\nBroken frame at 0x%X                                                  \n",resyncpos);
-    return 0;
-  }
-  ++frames;
-
-  if(MP3_resync){
-    MP3_resync=0;
-    if(frames==1) goto resync;
-  }
-
-  return frames;
-}
-
-static int _has_mmx = 0;  // used by layer2.c, layer3.c to pre-scale coeffs
-
-/******************************************************************************/
-/*           PUBLIC FUNCTIONS                  */
-/******************************************************************************/
-
-void (*dct64_MMX_func)(short *, short *, real *);
-
-#include "layer2.c"
-#include "layer3.c"
-#include "layer1.c"
-
-#include "cpudetect.h"
-
-// Init decoder tables.  Call first, once!
-#ifdef CONFIG_FAKE_MONO
-void MP3_Init(int fakemono){
-#else
-void MP3_Init(void){
-#endif
-
-//gCpuCaps.hasMMX=gCpuCaps.hasMMX2=gCpuCaps.hasSSE=0; // for testing!
-
-    _has_mmx = 0;
-    dct36_func = dct36;
-
-    make_decode_tables(outscale);
-
-#if HAVE_MMX
-    if (gCpuCaps.hasMMX)
-    {
-        _has_mmx = 1;
-        synth_func = synth_1to1_MMX;
-    }
-#endif
-
-#if HAVE_AMD3DNOWEXT
-    if (gCpuCaps.has3DNowExt)
-    {
-        dct36_func=dct36_3dnowex;
-        dct64_MMX_func= dct64_MMX_3dnowex;
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using 3DNow!Ex optimized decore!\n");
-    }
-    else
-#endif
-#if HAVE_AMD3DNOW
-    if (gCpuCaps.has3DNow)
-    {
-        dct36_func = dct36_3dnow;
-        dct64_MMX_func = dct64_MMX_3dnow;
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using 3DNow! optimized decore!\n");
-    }
-    else
-#endif
-#if HAVE_SSE
-    if (gCpuCaps.hasSSE)
-    {
-        dct64_MMX_func = dct64_sse;
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using SSE optimized decore!\n");
-    }
-    else
-#endif
-#if ARCH_X86_32
-#if HAVE_MMX
-    if (gCpuCaps.hasMMX)
-    {
-        dct64_MMX_func = dct64_MMX;
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using MMX optimized decore!\n");
-    }
-    else
-#endif
-    if (gCpuCaps.cpuType >= CPUTYPE_I586)
-    {
-        synth_func = synth_1to1_pent;
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using Pentium optimized decore!\n");
-    }
-    else
-#endif /* ARCH_X86_32 */
-#if HAVE_ALTIVEC
-    if (gCpuCaps.hasAltiVec)
-    {
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using AltiVec optimized decore!\n");
-    }
-    else
-#endif
-    {
-        synth_func = NULL; /* use default c version */
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"mp3lib: using generic C decore!\n");
-    }
-
-#ifdef CONFIG_FAKE_MONO
-    if (fakemono == 1)
-        fr.synth=synth_1to1_l;
-    else if (fakemono == 2)
-        fr.synth=synth_1to1_r;
-    else
-        fr.synth=synth_1to1;
-#else
-    fr.synth=synth_1to1;
-#endif
-    fr.synth_mono=synth_1to1_mono2stereo;
-    fr.down_sample=0;
-    fr.down_sample_sblimit = SBLIMIT>>(fr.down_sample);
-
-    init_layer2();
-    init_layer3(fr.down_sample_sblimit);
-    mp_msg(MSGT_DECAUDIO,MSGL_V,"MP3lib: init layer2&3 finished, tables done\n");
-}
-
-#if 0
-
-void MP3_Close(void){
-  MP3_eof=1;
-  if(mp3_file) fclose(mp3_file);
-  mp3_file=NULL;
-}
-
-// Open a file, init buffers. Call once per file!
-int MP3_Open(char *filename,int buffsize){
-  MP3_eof=1;   // lock decoding
-  MP3_pause=1; // lock playing
-  if(mp3_file) MP3_Close(); // close prev. file
-  MP3_frames=0;
-
-  mp3_file=fopen(filename,"rb");
-//  printf("MP3_Open: file='%s'",filename);
-//  if(!mp3_file){ printf(" not found!\n"); return 0;} else printf("Ok!\n");
-  if(!mp3_file) return 0;
-
-  MP3_filesize=MP3_PrintTAG();
-  fseek(mp3_file,0,SEEK_SET);
-
-  MP3_InitBuffers(buffsize);
-  if(!tables_done_flag) MP3_Init();
-  MP3_eof=0;  // allow decoding
-  MP3_pause=0; // allow playing
-  return MP3_filesize;
-}
-
-#endif
-
-// Read & decode a single frame. Called by sound driver.
-int MP3_DecodeFrame(unsigned char *hova,short single){
-   pcm_sample = hova;
-   pcm_point = 0;
-   if(!read_frame(&fr)) return 0;
-   if(single==-2){ set_pointer(512); return 1; }
-   if(fr.error_protection) getbits(16); /* skip crc */
-   fr.single=single;
-   switch(fr.lay){
-     case 2: do_layer2(&fr,single);break;
-     case 3: do_layer3(&fr,single);break;
-     case 1: do_layer1(&fr,single);break;
-     default:
-         return 0;      // unsupported
-   }
-//   ++MP3_frames;
-   return pcm_point ? pcm_point : 2;
-}
-
-// Prints last frame header in ascii.
-void MP3_PrintHeader(void){
-        static char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
-        static char *layers[4] = { "???" , "I", "II", "III" };
-
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"\rMPEG %s, Layer %s, %d Hz %d kbit %s, BPF: %d\n",
-                fr.mpeg25 ? "2.5" : (fr.lsf ? "2.0" : "1.0"),
-                layers[fr.lay],freqs[fr.sampling_frequency],
-    tabsel_123[fr.lsf][fr.lay-1][fr.bitrate_index],
-                modes[fr.mode],fr.framesize+4);
-        mp_msg(MSGT_DECAUDIO,MSGL_V,"Channels: %d, copyright: %s, original: %s, CRC: %s, emphasis: %d\n",
-                fr.stereo,fr.copyright?"Yes":"No",
-                fr.original?"Yes":"No",fr.error_protection?"Yes":"No",
-                fr.emphasis);
-}
-
-#if 0
-#include "genre.h"
-
-// Read & print ID3 TAG. Do not call when playing!!!  returns filesize.
-int MP3_PrintTAG(void){
-        struct id3tag {
-                char tag[3];
-                char title[30];
-                char artist[30];
-                char album[30];
-                char year[4];
-                char comment[30];
-                unsigned char genre;
-        };
-        struct id3tag tag;
-        char title[31]={0,};
-        char artist[31]={0,};
-        char album[31]={0,};
-        char year[5]={0,};
-        char comment[31]={0,};
-        char genre[31]={0,};
-  int fsize;
-  int ret;
-
-  fseek(mp3_file,0,SEEK_END);
-  fsize=ftell(mp3_file);
-  if(fseek(mp3_file,-128,SEEK_END)) return fsize;
-  ret=fread(&tag,128,1,mp3_file);
-  if(ret!=1 || tag.tag[0]!='T' || tag.tag[1]!='A' || tag.tag[2]!='G') return fsize;
-
-        strncpy(title,tag.title,30);
-        strncpy(artist,tag.artist,30);
-        strncpy(album,tag.album,30);
-        strncpy(year,tag.year,4);
-        strncpy(comment,tag.comment,30);
-
-        if ( tag.genre <= sizeof(genre_table)/sizeof(*genre_table) ) {
-                strncpy(genre, genre_table[tag.genre], 30);
-        } else {
-                strncpy(genre,"Unknown",30);
-        }
-
-//      printf("\n");
-        printf("Title  : %30s  Artist: %s\n",title,artist);
-        printf("Album  : %30s  Year  : %4s\n",album,year);
-        printf("Comment: %30s  Genre : %s\n",comment,genre);
-        printf("\n");
-  return fsize-128;
-}
-
-#endif
diff --git a/mplayer/mp3lib/tabinit.c b/mplayer/mp3lib/tabinit.c
deleted file mode 100644
index 79ac1c9..0000000
--- a/mplayer/mp3lib/tabinit.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Modified for use with MPlayer, for details see the changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-#include "mpg123.h"
-
-real mp3lib_decwin[(512+32)];
-static real cos64[32], cos32[16], cos16[8], cos8[4], cos4[2];
-real *mp3lib_pnts[]={ cos64,cos32,cos16,cos8,cos4 };
-
-static int intwinbase[] = {
-     0,    -1,    -1,    -1,    -1,    -1,    -1,    -2,    -2,    -2,
-    -2,    -3,    -3,    -4,    -4,    -5,    -5,    -6,    -7,    -7,
-    -8,    -9,   -10,   -11,   -13,   -14,   -16,   -17,   -19,   -21,
-   -24,   -26,   -29,   -31,   -35,   -38,   -41,   -45,   -49,   -53,
-   -58,   -63,   -68,   -73,   -79,   -85,   -91,   -97,  -104,  -111,
-  -117,  -125,  -132,  -139,  -147,  -154,  -161,  -169,  -176,  -183,
-  -190,  -196,  -202,  -208,  -213,  -218,  -222,  -225,  -227,  -228,
-  -228,  -227,  -224,  -221,  -215,  -208,  -200,  -189,  -177,  -163,
-  -146,  -127,  -106,   -83,   -57,   -29,     2,    36,    72,   111,
-   153,   197,   244,   294,   347,   401,   459,   519,   581,   645,
-   711,   779,   848,   919,   991,  1064,  1137,  1210,  1283,  1356,
-  1428,  1498,  1567,  1634,  1698,  1759,  1817,  1870,  1919,  1962,
-  2001,  2032,  2057,  2075,  2085,  2087,  2080,  2063,  2037,  2000,
-  1952,  1893,  1822,  1739,  1644,  1535,  1414,  1280,  1131,   970,
-   794,   605,   402,   185,   -45,  -288,  -545,  -814, -1095, -1388,
- -1692, -2006, -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788,
- -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, -7910, -8209,
- -8491, -8755, -8998, -9219, -9416, -9585, -9727, -9838, -9916, -9959,
- -9966, -9935, -9863, -9750, -9592, -9389, -9139, -8840, -8492, -8092,
- -7640, -7134, -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082,
-   -70,   998,  2122,  3300,  4533,  5818,  7154,  8540,  9975, 11455,
- 12980, 14548, 16155, 17799, 19478, 21189, 22929, 24694, 26482, 28289,
- 30112, 31947, 33791, 35640, 37489, 39336, 41176, 43006, 44821, 46617,
- 48390, 50137, 51853, 53534, 55178, 56778, 58333, 59838, 61289, 62684,
- 64019, 65290, 66494, 67629, 68692, 69679, 70590, 71420, 72169, 72835,
- 73415, 73908, 74313, 74630, 74856, 74992, 75038 };
-
-static void make_decode_tables(long scaleval)
-{
-  int i,j,k,kr,divv;
-  real *table,*costab;
-
-
-  for(i=0;i<5;i++)
-  {
-    kr=0x10>>i; divv=0x40>>i;
-    costab = mp3lib_pnts[i];
-    for(k=0;k<kr;k++) costab[k] = 1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv));
-  }
-
-  table = mp3lib_decwin;
-  scaleval = -scaleval;
-  for(i=0,j=0;i<256;i++,j++,table+=32)
-  {
-    if(table < mp3lib_decwin+512+16)
-      table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
-    if(i % 32 == 31)
-      table -= 1023;
-    if(i % 64 == 63)
-      scaleval = - scaleval;
-  }
-
-  for( /* i=256 */ ;i<512;i++,j--,table+=32)
-  {
-    if(table < mp3lib_decwin+512+16)
-      table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
-    if(i % 32 == 31)
-      table -= 1023;
-    if(i % 64 == 63)
-      scaleval = - scaleval;
-  }
-}
diff --git a/mplayer/mp3lib/test.c b/mplayer/mp3lib/test.c
deleted file mode 100644
index 446d454..0000000
--- a/mplayer/mp3lib/test.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define DUMP_PCM
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <unistd.h>
-#include <sys/time.h>
-
-#include "config.h"
-#include "mp3lib/mp3.h"
-#include "cpudetect.h"
-
-static inline unsigned int GetTimer(void){
-  struct timeval tv;
-  struct timezone tz;
-//  float s;
-  gettimeofday(&tv,&tz);
-//  s=tv.tv_usec;s*=0.000001;s+=tv.tv_sec;
-  return tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-static FILE* mp3file=NULL;
-
-int mplayer_audio_read(char *buf,int size){
-    return fread(buf,1,size,mp3file);
-}
-
-#define BUFFLEN 4608
-static unsigned char buffer[BUFFLEN];
-
-int main(int argc,char* argv[]){
-  int len;
-  int total=0;
-  unsigned int time1;
-  float length;
-#ifdef DUMP_PCM
-  FILE *f=NULL;
-  f=fopen("test.pcm","wb");
-#endif
-
-  mp3file=fopen((argc>1)?argv[1]:"test.mp3","rb");
-  if(!mp3file){  printf("file not found\n");  exit(1); }
-
-  GetCpuCaps(&gCpuCaps);
-
-  // MPEG Audio:
-#ifdef CONFIG_FAKE_MONO
-  MP3_Init(0);
-#else
-  MP3_Init();
-#endif
-  MP3_samplerate=MP3_channels=0;
-
-  time1=GetTimer();
-  while((len=MP3_DecodeFrame(buffer,-1))>0 && total<2000000){
-      total+=len;
-      // play it
-#ifdef DUMP_PCM
-      fwrite(buffer,len,1,f);
-#endif
-      //putchar('.');fflush(stdout);
-  }
-  time1=GetTimer()-time1;
-  length=(float)total/(float)(MP3_samplerate*MP3_channels*2);
-  printf("\nDecoding time: %8.6f\n",(float)time1*0.000001f);
-  printf("Uncompressed size: %d bytes  (%8.3f secs)\n",total,length);
-  printf("CPU usage at normal playback: %5.2f %%\n",time1*0.0001f/length);
-
-  fclose(mp3file);
-  return 0;
-}
diff --git a/mplayer/mp3lib/test2.c b/mplayer/mp3lib/test2.c
deleted file mode 100644
index ccedbec..0000000
--- a/mplayer/mp3lib/test2.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <sys/soundcard.h>
-
-#include "config.h"
-#include "mp3lib/mp3.h"
-#include "cpudetect.h"
-
-static FILE* mp3file=NULL;
-
-int mplayer_audio_read(char *buf,int size){
-    return fread(buf,1,size,mp3file);
-}
-
-#define BUFFLEN 4608
-static unsigned char buffer[BUFFLEN];
-
-
-int main(int argc,char* argv[]){
-  int len;
-  int total=0;
-  int r;
-  int audio_fd;
-
-  mp3file=fopen((argc>1)?argv[1]:"test.mp3","rb");
-  if(!mp3file){  printf("file not found\n");  exit(1); }
-
-  GetCpuCaps(&gCpuCaps);
-
-  // MPEG Audio:
-#ifdef CONFIG_FAKE_MONO
-  MP3_Init(0);
-#else
-  MP3_Init();
-#endif
-  MP3_samplerate=MP3_channels=0;
-  len=MP3_DecodeFrame(buffer,-1);
-
-  audio_fd=open("/dev/dsp", O_WRONLY);
-  if(audio_fd<0){  printf("Can't open audio device\n");exit(1); }
-  r=AFMT_S16_LE;ioctl (audio_fd, SNDCTL_DSP_SETFMT, &r);
-  r=MP3_channels-1;ioctl (audio_fd, SNDCTL_DSP_STEREO, &r);
-  r=MP3_samplerate;ioctl (audio_fd, SNDCTL_DSP_SPEED, &r);
-  printf("audio_setup: using %d Hz samplerate (requested: %d)\n",r,MP3_samplerate);
-
-  while(1){
-      int len2;
-      if(len==0) len=MP3_DecodeFrame(buffer,-1);
-      if(len<=0) break; // EOF
-
-      // play it
-      len2=write(audio_fd,buffer,len);
-      if(len2<0) break; // ERROR?
-      len-=len2; total+=len2;
-      if(len>0){
-          // this shouldn't happen...
-          memcpy(buffer,buffer+len2,len);
-          putchar('!');fflush(stdout);
-      }
-  }
-
-  fclose(mp3file);
-  return 0;
-}
diff --git a/mplayer/mp_core.h b/mplayer/mp_core.h
index 825718f..0e41b58 100644
--- a/mplayer/mp_core.h
+++ b/mplayer/mp_core.h
@@ -24,6 +24,7 @@
 #include "options.h"
 #include "mixer.h"
 #include "sub/subreader.h"
+#include "sub/find_subfiles.h"
 
 // definitions used internally by the core player code
 
@@ -99,7 +100,6 @@ typedef struct MPContext {
     unsigned int osd_visible;
 
     int osd_function;
-    const ao_functions_t *audio_out;
     struct play_tree *playtree;
     struct play_tree_iter *playtree_iter;
     char *filename; // currently playing file
@@ -124,6 +124,7 @@ typedef struct MPContext {
     struct demux_stream *d_video;
     struct demux_stream *d_sub;
     mixer_t mixer;
+    struct ao *ao;
     struct vo *video_out;
 
     /* We're starting playback from scratch or after a seek. Show first
@@ -228,7 +229,6 @@ extern int file_filter;
 // These appear in options list
 extern int forced_subs_only;
 
-struct ao_data;
 void uninit_player(struct MPContext *mpctx, unsigned int mask);
 void reinit_audio_chain(struct MPContext *mpctx);
 void init_vo_spudec(struct MPContext *mpctx);
@@ -251,4 +251,10 @@ char *chapter_display_name(struct MPContext *mpctx, int chapter);
 void update_subtitles(struct MPContext *mpctx, double refpts,
                       double sub_offset, bool reset);
 
+
+// timeline/tl_matroska.c
+void build_ordered_chapter_timeline(struct MPContext *mpctx);
+// timeline/tl_edl.c
+void build_edl_timeline(struct MPContext *mpctx);
+
 #endif /* MPLAYER_MP_CORE_H */
diff --git a/mplayer/mpcommon.h b/mplayer/mpcommon.h
index 8913312..fd520ea 100644
--- a/mplayer/mpcommon.h
+++ b/mplayer/mpcommon.h
@@ -24,6 +24,13 @@
 
 #define ROUND(x) ((int)((x) < 0 ? (x) - 0.5 : (x) + 0.5))
 
+#define MP_TALLOC_ELEMS(p) (talloc_get_size(p) / sizeof((p)[0]))
+#define MP_GROW_ARRAY(p, nextidx) do {          \
+    if ((nextidx) == MP_TALLOC_ELEMS(p))        \
+        p = talloc_realloc_size(NULL, p, talloc_get_size(p) * 2); } while (0)
+#define MP_RESIZE_ARRAY(ctx, p, count) do {     \
+        p = talloc_realloc_size((ctx), p, (count) * sizeof(p[0])); } while (0)
+
 extern const char *mplayer_version;
 
 #endif /* MPLAYER_MPCOMMON_H */
diff --git a/mplayer/mplayer.c b/mplayer/mplayer.c
index b9c7dcd..a922079 100644
--- a/mplayer/mplayer.c
+++ b/mplayer/mplayer.c
@@ -67,11 +67,10 @@
 #include "access_mpcontext.h"
 #include "m_property.h"
 
-#include "cfg-mplayer-def.h"
-
 #include "libavutil/avstring.h"
 
 #include "sub/subreader.h"
+#include "sub/find_subfiles.h"
 #include "sub/dec_sub.h"
 
 #include "mp_osd.h"
@@ -100,7 +99,6 @@
 
 #include "osdep/getch2.h"
 #include "osdep/timer.h"
-#include "osdep/findfiles.h"
 
 #include "input/input.h"
 
@@ -324,11 +322,8 @@ char *font_name=NULL;
 char *sub_font_name=NULL;
 extern int font_fontconfig;
 float font_factor=0.75;
-char **sub_name=NULL;
 float sub_delay=0;
 float sub_fps=0;
-int   sub_auto = 1;
-char *vobsub_name=NULL;
 int   subcc_enabled=0;
 int suboverlap_enabled = 1;
 
@@ -369,11 +364,6 @@ const void *mpctx_get_video_out(MPContext *mpctx)
     return mpctx->video_out;
 }
 
-const void *mpctx_get_audio_out(MPContext *mpctx)
-{
-    return mpctx->audio_out;
-}
-
 void *mpctx_get_demuxer(MPContext *mpctx)
 {
     return mpctx->demuxer;
@@ -711,9 +701,9 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask){
     mpctx->initialized_flags&=~INITIALIZED_AO;
     current_module="uninit_ao";
     if (mpctx->edl_muted) mixer_mute(&mpctx->mixer);
-    if (mpctx->audio_out)
-        mpctx->audio_out->uninit(mpctx->stop_play != AT_END_OF_FILE);
-    mpctx->audio_out=NULL;
+    if (mpctx->ao)
+        ao_uninit(mpctx->ao, mpctx->stop_play != AT_END_OF_FILE);
+    mpctx->ao = NULL;
   }
 
   current_module=NULL;
@@ -887,6 +877,8 @@ static int cfg_include(m_option_t *conf, char *filename)
     return m_config_parse_config_file(conf->priv, filename);
 }
 
+#define DEF_CONFIG "# Write your default config options here!\n\n\n"
+
 static void parse_cfgfiles(struct MPContext *mpctx, m_config_t* conf)
 {
     struct MPOpts *opts = &mpctx->opts;
@@ -909,7 +901,7 @@ if ((conffile = get_path("")) == NULL) {
   } else {
     if ((conffile_fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY, 0666)) != -1) {
       mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Creating config file: %s\n", conffile);
-      write(conffile_fd, default_config, strlen(default_config));
+      write(conffile_fd, DEF_CONFIG, sizeof(DEF_CONFIG) - 1);
       close(conffile_fd);
     }
     if (!(opts->noconfig & 1) &&
@@ -1345,12 +1337,13 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
 /**
  * \brief build a chain of audio filters that converts the input format
  * to the ao's format, taking into account the current playback_speed.
- * \param sh_audio describes the requested input format of the chain.
- * \param ao_data describes the requested output format of the chain.
+ * sh_audio describes the requested input format of the chain.
+ * ao describes the requested output format of the chain.
  */
-static int build_afilter_chain(struct MPContext *mpctx, sh_audio_t *sh_audio,
-                               ao_data_t *ao_data)
+static int build_afilter_chain(struct MPContext *mpctx)
 {
+    struct sh_audio *sh_audio = mpctx->sh_audio;
+    struct ao *ao = mpctx->ao;
     struct MPOpts *opts = &mpctx->opts;
   int new_srate;
   int result;
@@ -1365,7 +1358,7 @@ static int build_afilter_chain(struct MPContext *mpctx, sh_audio_t *sh_audio,
     new_srate = sh_audio->samplerate;
   } else {
     new_srate = sh_audio->samplerate * opts->playback_speed;
-    if (new_srate != ao_data->samplerate) {
+    if (new_srate != ao->samplerate) {
       // limits are taken from libaf/af_resample.c
       if (new_srate < 8000)
         new_srate = 8000;
@@ -1375,7 +1368,7 @@ static int build_afilter_chain(struct MPContext *mpctx, sh_audio_t *sh_audio,
     }
   }
   result =  init_audio_filters(sh_audio, new_srate,
-           &ao_data->samplerate, &ao_data->channels, &ao_data->format);
+           &ao->samplerate, &ao->channels, &ao->format);
   mpctx->mixer.afilter = sh_audio->afilter;
   return result;
 }
@@ -1682,6 +1675,7 @@ static void update_osd_msg(struct MPContext *mpctx)
 void reinit_audio_chain(struct MPContext *mpctx)
 {
     struct MPOpts *opts = &mpctx->opts;
+    struct ao *ao;
     if (!mpctx->sh_audio)
         return;
     if (!(mpctx->initialized_flags & INITIALIZED_ACODEC)) {
@@ -1697,51 +1691,50 @@ void reinit_audio_chain(struct MPContext *mpctx)
 
     current_module="af_preinit";
     if (!(mpctx->initialized_flags & INITIALIZED_AO)) {
-        ao_data.samplerate=force_srate;
-        ao_data.channels=0;
-        ao_data.format = opts->audio_output_format;
+        mpctx->initialized_flags |= INITIALIZED_AO;
+        mpctx->ao = ao_create();
+        mpctx->ao->samplerate = force_srate;
+        mpctx->ao->format = opts->audio_output_format;
     }
+    ao = mpctx->ao;
+
     // first init to detect best values
     if(!init_audio_filters(mpctx->sh_audio,   // preliminary init
                            // input:
                            mpctx->sh_audio->samplerate,
                            // output:
-                           &ao_data.samplerate, &ao_data.channels, &ao_data.format)){
+                           &ao->samplerate, &ao->channels, &ao->format)) {
         mp_tmsg(MSGT_CPLAYER,MSGL_ERR, "Error at audio filter chain "
                 "pre-init!\n");
         exit_player(mpctx, EXIT_ERROR);
     }
-    if (!(mpctx->initialized_flags & INITIALIZED_AO)) {
+    if (!ao->initialized) {
         current_module="ao2_init";
-        ao_data.buffersize = opts->ao_buffersize;
-        mpctx->audio_out = init_best_audio_out(opts->audio_driver_list,
-                                               0, // plugin flag
-                                               ao_data.samplerate,
-                                               ao_data.channels,
-                                               ao_data.format, 0);
-        if(!mpctx->audio_out){
+        ao->buffersize = opts->ao_buffersize;
+        ao_init(ao, opts->audio_driver_list);
+        if (!ao->initialized) {
             mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Could not open/initialize audio device -> no sound.\n");
             goto init_error;
         }
-        mpctx->initialized_flags|=INITIALIZED_AO;
         mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %dHz %dch %s (%d bytes per sample)\n",
-               mpctx->audio_out->info->short_name,
-               ao_data.samplerate, ao_data.channels,
-               af_fmt2str_short(ao_data.format),
-               af_fmt2bits(ao_data.format)/8 );
+               ao->driver->info->short_name,
+               ao->samplerate, ao->channels,
+               af_fmt2str_short(ao->format),
+               af_fmt2bits(ao->format)/8 );
         mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Description: %s\nAO: Author: %s\n",
-               mpctx->audio_out->info->name, mpctx->audio_out->info->author);
-        if(strlen(mpctx->audio_out->info->comment) > 0)
-            mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Comment: %s\n", mpctx->audio_out->info->comment);
+               ao->driver->info->name, ao->driver->info->author);
+        if (strlen(ao->driver->info->comment) > 0)
+            mp_msg(MSGT_CPLAYER, MSGL_V, "AO: Comment: %s\n",
+                   ao->driver->info->comment);
     }
 
     // init audio filters:
     current_module="af_init";
-    if(!build_afilter_chain(mpctx, mpctx->sh_audio, &ao_data)) {
+    if (!build_afilter_chain(mpctx)) {
         mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Couldn't find matching filter/ao format!\n");
         goto init_error;
     }
-    mpctx->mixer.audio_out = mpctx->audio_out;
+    mpctx->mixer.ao = ao;
     mpctx->mixer.volstep = volstep;
     mpctx->syncing_audio = true;
     return;
@@ -1805,7 +1798,7 @@ static double written_audio_pts(struct MPContext *mpctx)
 
     // Filters divide audio length by playback_speed, so multiply by it
     // to get the length in original units without speedup or slowdown
-    a_pts -= buffered_output * mpctx->opts.playback_speed / ao_data.bps;
+    a_pts -= buffered_output * mpctx->opts.playback_speed / mpctx->ao->bps;
 
     return a_pts + mpctx->video_offset;
 }
@@ -1814,7 +1807,7 @@ static double written_audio_pts(struct MPContext *mpctx)
 double playing_audio_pts(struct MPContext *mpctx)
 {
     return written_audio_pts(mpctx) - mpctx->opts.playback_speed *
-	mpctx->audio_out->get_delay();
+	ao_get_delay(mpctx->ao);
 }
 
 static bool is_av_sub(int type)
@@ -2029,7 +2022,7 @@ static int check_framedrop(struct MPContext *mpctx, double frame_time) {
 	current_module = "check_framedrop";
 	if (mpctx->sh_audio && !mpctx->d_audio->eof) {
 	    static int dropped_frames;
-	    float delay = opts->playback_speed*mpctx->audio_out->get_delay();
+	    float delay = opts->playback_speed * ao_get_delay(mpctx->ao);
 	    float d = delay-mpctx->delay;
 	    ++total_frame_cnt;
 	    // we should avoid dropping too many frames in sequence unless we
@@ -2176,7 +2169,7 @@ static void mp_dvdnav_reset_stream (MPContext *ctx) {
         ds_free_packs(ctx->d_audio);
         audio_delay -= ctx->sh_audio->stream_delay;
         ctx->delay =- audio_delay;
-        ctx->audio_out->reset();
+        ao_reset(ctx->ao);
         resync_audio_stream(ctx->sh_audio);
     }
 
@@ -2297,6 +2290,7 @@ static void adjust_sync(struct MPContext *mpctx, double frame_time)
 #define ASYNC_PLAY_DONE -3
 static int audio_start_sync(struct MPContext *mpctx, int playsize)
 {
+    struct ao *ao = mpctx->ao;
     struct MPOpts *opts = &mpctx->opts;
     sh_audio_t * const sh_audio = mpctx->sh_audio;
     int res;
@@ -2312,14 +2306,14 @@ static int audio_start_sync(struct MPContext *mpctx, int playsize)
         double written_pts = written_audio_pts(mpctx);
         double ptsdiff = written_pts - mpctx->video_pts - mpctx->delay
             - audio_delay;
-        bytes = ptsdiff * ao_data.bps / mpctx->opts.playback_speed;
-        bytes -= bytes % (ao_data.channels * af_fmt2bits(ao_data.format) / 8);
+        bytes = ptsdiff * ao->bps / mpctx->opts.playback_speed;
+        bytes -= bytes % (ao->channels * af_fmt2bits(ao->format) / 8);
 
         // ogg demuxers give packets without timing
         if (written_pts <= 1 && sh_audio->pts == MP_NOPTS_VALUE) {
             if (!did_retry) {
                 // Try to read more data to see packets that have pts
-                int res = decode_audio(sh_audio, ao_data.bps);
+                int res = decode_audio(sh_audio, ao->bps);
                 if (res < 0)
                     return res;
                 did_retry = true;
@@ -2353,7 +2347,7 @@ static int audio_start_sync(struct MPContext *mpctx, int playsize)
             return res;
     }
     int fillbyte = 0;
-    if ((ao_data.format & AF_FORMAT_SIGN_MASK) == AF_FORMAT_US)
+    if ((ao->format & AF_FORMAT_SIGN_MASK) == AF_FORMAT_US)
         fillbyte = 0x80;
     if (bytes >= playsize) {
         /* This case could fall back to the one below with
@@ -2362,9 +2356,9 @@ static int audio_start_sync(struct MPContext *mpctx, int playsize)
          * in playsize. */
         char *p = malloc(playsize);
         memset(p, fillbyte, playsize);
-        playsize = mpctx->audio_out->play(p, playsize, 0);
+        playsize = ao_play(ao, p, playsize, 0);
         free(p);
-        mpctx->delay += opts->playback_speed*playsize/(double)ao_data.bps;
+        mpctx->delay += opts->playback_speed*playsize/(double)ao->bps;
         return ASYNC_PLAY_DONE;
     }
     mpctx->syncing_audio = false;
@@ -2375,39 +2369,31 @@ static int audio_start_sync(struct MPContext *mpctx, int playsize)
 static int fill_audio_out_buffers(struct MPContext *mpctx)
 {
     struct MPOpts *opts = &mpctx->opts;
+    struct ao *ao = mpctx->ao;
     unsigned int t;
     double tt;
     int playsize;
     int playflags=0;
-    int audio_eof=0;
+    bool audio_eof = false;
+    bool partial_fill = false;
     bool format_change = false;
     sh_audio_t * const sh_audio = mpctx->sh_audio;
+    bool modifiable_audio_format = !(ao->format & AF_FORMAT_SPECIAL_MASK);
+    int unitsize = ao->channels * af_fmt2bits(ao->format) / 8;
 
     current_module="play_audio";
 
-    while (1) {
-	int sleep_time;
-	// all the current uses of ao_data.pts seem to be in aos that handle
-	// sync completely wrong; there should be no need to use ao_data.pts
-	// in get_space()
-	ao_data.pts = ((mpctx->sh_video?mpctx->sh_video->timer:0)+mpctx->delay)*90000.0;
-	playsize = mpctx->audio_out->get_space();
-	if (mpctx->sh_video || playsize >= ao_data.outburst)
-	    break;
-
-	// handle audio-only case:
-	// this is where mplayer sleeps during audio-only playback
-	// to avoid 100% CPU use
-	sleep_time = (ao_data.outburst - playsize) * 1000 / ao_data.bps;
-	if (sleep_time < 10) sleep_time = 10; // limit to 100 wakeups per second
-	usec_sleep(sleep_time * 1000);
-    }
+    // all the current uses of ao->pts seem to be in aos that handle
+    // sync completely wrong; there should be no need to use ao->pts
+    // in get_space()
+    ao->pts = ((mpctx->sh_video?mpctx->sh_video->timer:0)+mpctx->delay)*90000.0;
+    playsize = ao_get_space(ao);
 
     // Fill buffer if needed:
     current_module="decode_audio";
     t = GetTimer();
 
-    if (!opts->initial_audio_sync || (ao_data.format & AF_FORMAT_SPECIAL_MASK))
+    if (!opts->initial_audio_sync || !modifiable_audio_format)
         mpctx->syncing_audio = false;
 
     int res;
@@ -2419,23 +2405,33 @@ static int fill_audio_out_buffers(struct MPContext *mpctx)
         if (res == -2)
             format_change = true;
         else if (res == ASYNC_PLAY_DONE)
-            return 1;
-        else if (mpctx->d_audio->eof) {
-            audio_eof = 1;
-            int unitsize = ao_data.channels * af_fmt2bits(ao_data.format) / 8;
-            if (sh_audio->a_out_buffer_len < unitsize)
-                return 0;
-        }
+            return 0;
+        else if (mpctx->d_audio->eof)
+            audio_eof = true;
     }
     t = GetTimer() - t;
     tt = t*0.000001f; audio_time_usage+=tt;
+    if (mpctx->timeline && modifiable_audio_format) {
+        double endpts = mpctx->timeline[mpctx->timeline_part + 1].start;
+        double bytes = (endpts - written_audio_pts(mpctx) + audio_delay)
+            * ao->bps / opts->playback_speed;
+        if (playsize > bytes) {
+            playsize = FFMAX(bytes, 0);
+            playflags |= AOPLAY_FINAL_CHUNK;
+            audio_eof = true;
+            partial_fill = true;
+        }
+    }
+
     if (playsize > sh_audio->a_out_buffer_len) {
+        partial_fill = true;
         playsize = sh_audio->a_out_buffer_len;
         if (audio_eof)
             playflags |= AOPLAY_FINAL_CHUNK;
     }
+    playsize -= playsize % unitsize;
     if (!playsize)
-        return 1;
+        return partial_fill && audio_eof ? -2 : -partial_fill;
 
     // play audio:
     current_module="play_audio";
@@ -2443,15 +2439,15 @@ static int fill_audio_out_buffers(struct MPContext *mpctx)
     // Is this pts value actually useful for the aos that access it?
     // They're obviously badly broken in the way they handle av sync;
     // would not having access to this make them more broken?
-    ao_data.pts = ((mpctx->sh_video?mpctx->sh_video->timer:0)+mpctx->delay)*90000.0;
-    playsize = mpctx->audio_out->play(sh_audio->a_out_buffer, playsize, playflags);
+    ao->pts = ((mpctx->sh_video?mpctx->sh_video->timer:0)+mpctx->delay)*90000.0;
+    playsize = ao_play(ao, sh_audio->a_out_buffer, playsize, playflags);
 
     if (playsize > 0) {
         sh_audio->a_out_buffer_len -= playsize;
         memmove(sh_audio->a_out_buffer, &sh_audio->a_out_buffer[playsize],
                 sh_audio->a_out_buffer_len);
-        mpctx->delay += opts->playback_speed*playsize/(double)ao_data.bps;
-    } else if (audio_eof && mpctx->audio_out->get_delay() < .04) {
+        mpctx->delay += opts->playback_speed*playsize/(double)ao->bps;
+    } else if (audio_eof && ao_get_delay(ao) < .04) {
         // Sanity check to avoid hanging in case current ao doesn't output
         // partial chunks and doesn't check for AOPLAY_FINAL_CHUNK
         mp_msg(MSGT_CPLAYER, MSGL_WARN, "Audio output truncated at end.\n");
@@ -2465,13 +2461,14 @@ static int fill_audio_out_buffers(struct MPContext *mpctx)
     if (format_change) {
         uninit_player(mpctx, INITIALIZED_AO);
         reinit_audio_chain(mpctx);
+        return -1;
     }
 
-    return 1;
+    return -partial_fill;
 }
 
 static int sleep_until_near_frame(struct MPContext *mpctx, float *time_frame,
-                                  float *aq_sleep_time)
+                                  bool sync_to_audio, float *aq_sleep_time)
 {
     struct MPOpts *opts = &mpctx->opts;
     double audio_limit = 2;
@@ -2482,8 +2479,8 @@ static int sleep_until_near_frame(struct MPContext *mpctx, float *time_frame,
 
     *time_frame -= get_relative_time(mpctx); // reset timer
 
-    if (mpctx->sh_audio && !mpctx->d_audio->eof) {
-	float delay = mpctx->audio_out->get_delay();
+    if (sync_to_audio) {
+	float delay = ao_get_delay(mpctx->ao);
 	mp_dbg(MSGT_AVSYNC, MSGL_DBG2, "delay=%f\n", delay);
 
 	if (opts->autosync) {
@@ -2533,6 +2530,8 @@ int reinit_video_chain(struct MPContext *mpctx)
 {
     struct MPOpts *opts = &mpctx->opts;
     sh_video_t * const sh_video = mpctx->sh_video;
+    if (!sh_video)
+        return 0;
     double ar=-1.0;
     //================== Init VIDEO (codec & libvo) ==========================
     if (!opts->fixed_vo || !(mpctx->initialized_flags & INITIALIZED_VO)) {
@@ -2840,8 +2839,8 @@ void pause_player(struct MPContext *mpctx)
     if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok)
 	vo_control(mpctx->video_out, VOCTRL_PAUSE, NULL);
 
-    if (mpctx->audio_out && mpctx->sh_audio)
-	mpctx->audio_out->pause();	// pause audio, keep data if possible
+    if (mpctx->ao && mpctx->sh_audio)
+	ao_pause(mpctx->ao);	// pause audio, keep data if possible
 }
 
 void unpause_player(struct MPContext *mpctx)
@@ -2850,8 +2849,8 @@ void unpause_player(struct MPContext *mpctx)
         return;
     mpctx->paused = 0;
 
-    if (mpctx->audio_out && mpctx->sh_audio)
-        mpctx->audio_out->resume();	// resume audio
+    if (mpctx->ao && mpctx->sh_audio)
+        ao_resume(mpctx->ao);
     if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok
         && !mpctx->step_frames)
         vo_control(mpctx->video_out, VOCTRL_RESUME, NULL);	// resume video
@@ -2984,7 +2983,7 @@ static void reinit_decoders(struct MPContext *mpctx)
     mp_property_do("sub", M_PROPERTY_SET, &(int){mpctx->global_sub_pos}, mpctx);
 }
 
-static void seek_reset(struct MPContext *mpctx)
+static void seek_reset(struct MPContext *mpctx, bool reset_ao)
 {
     if (mpctx->sh_video) {
 	current_module = "seek_video_reset";
@@ -3010,7 +3009,9 @@ static void seek_reset(struct MPContext *mpctx)
     if (mpctx->sh_audio) {
 	current_module = "seek_audio_reset";
         resync_audio_stream(mpctx->sh_audio);
-	mpctx->audio_out->reset(); // stop audio, throwing away buffered data
+        if (reset_ao)
+            // stop audio, throwing away buffered data
+            ao_reset(mpctx->ao);
 	mpctx->sh_audio->a_buffer_len = 0;
 	mpctx->sh_audio->a_out_buffer_len = 0;
 	if (!mpctx->sh_video)
@@ -3042,7 +3043,11 @@ static bool timeline_set_part(struct MPContext *mpctx, int i)
     mpctx->video_offset = n->start - n->source_start;
     if (n->source == p->source)
         return false;
-    uninit_player(mpctx, INITIALIZED_VCODEC | (mpctx->opts.fixed_vo && mpctx->opts.video_id != -2 ? 0 : INITIALIZED_VO) | INITIALIZED_AO | INITIALIZED_ACODEC | INITIALIZED_SUB);
+    enum stop_play_reason orig_stop_play = mpctx->stop_play;
+    if (!mpctx->sh_video && mpctx->stop_play == KEEP_PLAYING)
+        mpctx->stop_play = AT_END_OF_FILE;  // let audio uninit drain data
+    uninit_player(mpctx, INITIALIZED_VCODEC | (mpctx->opts.fixed_vo ? 0 : INITIALIZED_VO) | (mpctx->opts.gapless_audio ? 0 : INITIALIZED_AO) | INITIALIZED_ACODEC | INITIALIZED_SUB);
+    mpctx->stop_play = orig_stop_play;
     mpctx->demuxer = n->source->demuxer;
     mpctx->d_video = mpctx->demuxer->video;
     mpctx->d_audio = mpctx->demuxer->audio;
@@ -3071,7 +3076,8 @@ static double timeline_set_from_time(struct MPContext *mpctx, double pts,
 
 
 // return -1 if seek failed (non-seekable stream?), 0 otherwise
-static int seek(MPContext *mpctx, struct seek_params seek)
+static int seek(MPContext *mpctx, struct seek_params seek,
+                bool timeline_fallthrough)
 {
     struct MPOpts *opts = &mpctx->opts;
 
@@ -3110,7 +3116,7 @@ static int seek(MPContext *mpctx, struct seek_params seek)
             mpctx->stop_play = AT_END_OF_FILE;
             // Clear audio from current position
             if (mpctx->sh_audio) {
-                mpctx->audio_out->reset();
+                ao_reset(mpctx->ao);
                 mpctx->sh_audio->a_buffer_len = 0;
                 mpctx->sh_audio->a_out_buffer_len = 0;
             }
@@ -3136,7 +3142,7 @@ static int seek(MPContext *mpctx, struct seek_params seek)
     if (seekresult == 0)
 	return -1;
 
-    seek_reset(mpctx);
+    seek_reset(mpctx, !timeline_fallthrough);
 
     /* Use the target time as "current position" for further relative
      * seeks etc until a new video frame has been decoded */
@@ -3287,7 +3293,7 @@ int seek_chapter(struct MPContext *mpctx, int chapter, double *seek_pts,
                                        chapter_name);
         if (res >= 0) {
             if (*seek_pts == -1)
-                seek_reset(mpctx);
+                seek_reset(mpctx, true);
             else {
                 mpctx->last_chapter_seek = res;
                 mpctx->last_chapter_pts = *seek_pts;
@@ -3313,6 +3319,7 @@ static void run_playloop(struct MPContext *mpctx)
 {
     struct MPOpts *opts = &mpctx->opts;
     float aq_sleep_time = 0;
+    bool full_audio_buffers = false;
 
     if (opts->chapterrange[1] > 0) {
         int cur_chapter = get_current_chapter(mpctx);
@@ -3329,11 +3336,14 @@ static void run_playloop(struct MPContext *mpctx)
 /*========================== PLAY AUDIO ============================*/
 
     if (mpctx->sh_audio && !mpctx->paused
-        && (!mpctx->restart_playback || !mpctx->sh_video))
-        if (!fill_audio_out_buffers(mpctx))
+        && (!mpctx->restart_playback || !mpctx->sh_video)) {
+        int status = fill_audio_out_buffers(mpctx);
+        full_audio_buffers = status >= 0;
+        if (status == -2)
             // at eof, all audio at least written to ao
             if (!mpctx->sh_video)
                 mpctx->stop_play = AT_END_OF_FILE;
+    }
 
 
     if (!mpctx->sh_video) {
@@ -3351,10 +3361,28 @@ static void run_playloop(struct MPContext *mpctx)
 
         print_status(mpctx, a_pos, false);
 
-        if (end_at.type == END_AT_TIME && end_at.pos < a_pos)
-            mpctx->stop_play = PT_NEXT_ENTRY;
         update_subtitles(mpctx, a_pos, mpctx->video_offset, false);
         update_osd_msg(mpctx);
+        if (end_at.type == END_AT_TIME && end_at.pos < a_pos) {
+            mpctx->stop_play = AT_END_OF_FILE;
+        } else if (mpctx->timeline && mpctx->stop_play == AT_END_OF_FILE
+                   && mpctx->timeline_part + 1 < mpctx->num_timeline_parts
+                   && mpctx->sh_audio) {
+            struct timeline_part *p = mpctx->timeline + mpctx->timeline_part;
+            double delay = ao_get_delay(mpctx->ao);
+            if (!opts->gapless_audio && p->source != (p+1)->source
+                && delay > 0.05) {
+                mpctx->stop_play = KEEP_PLAYING;
+                mp_input_get_cmd(mpctx->input, (delay-.05) * 1000, true);
+            } else {
+                seek(mpctx, (struct seek_params){ .type = MPSEEK_ABSOLUTE,
+                                                  .amount = (p+1)->start },
+                     true);
+            }
+        } else if (!mpctx->stop_play) {
+            int sleep_time = full_audio_buffers || !mpctx->sh_audio ? 100 : 20;
+            mp_input_get_cmd(mpctx->input, sleep_time, true);
+        }
     } else {
 
 /*========================== PLAY VIDEO ============================*/
@@ -3388,7 +3416,8 @@ static void run_playloop(struct MPContext *mpctx)
                 || mpctx->stop_play == AT_END_OF_FILE
                 && mpctx->timeline_part + 1 < mpctx->num_timeline_parts) {
                 seek(mpctx, (struct seek_params){ .type = MPSEEK_ABSOLUTE,
-                                                  .amount = next->start });
+                                                  .amount = next->start },
+                     true);
                 return;
             }
         }
@@ -3415,6 +3444,7 @@ static void run_playloop(struct MPContext *mpctx)
 
         bool frame_time_remaining = sleep_until_near_frame(mpctx,
                                                            &mpctx->time_frame,
+                                                           full_audio_buffers,
                                                            &aq_sleep_time);
 
 //====================== FLIP PAGE (VIDEO BLT): =========================
@@ -3603,218 +3633,12 @@ static void run_playloop(struct MPContext *mpctx)
     }
 
     if (mpctx->seek.type) {
-        seek(mpctx, mpctx->seek);
+        seek(mpctx, mpctx->seek, false);
         mpctx->seek = (struct seek_params){0};
     }
 }
 
 
-static int find_ordered_chapter_sources(struct MPContext *mpctx,
-                                        struct content_source *sources,
-                                        int num_sources,
-                                        unsigned char uid_map[][16])
-{
-    int num_filenames = 0;
-    char **filenames = NULL;
-    if (num_sources > 1) {
-        mp_msg(MSGT_CPLAYER, MSGL_INFO, "This file references data from "
-               "other sources.\n");
-        if (mpctx->stream->type != STREAMTYPE_FILE) {
-            mp_msg(MSGT_CPLAYER, MSGL_WARN, "Playback source is not a "
-                   "normal disk file. Will not search for related files.\n");
-        } else {
-            mp_msg(MSGT_CPLAYER, MSGL_INFO, "Will scan other files in the "
-                   "same directory to find referenced sources.\n");
-            filenames = find_files(mpctx->demuxer->filename, ".mkv",
-                                   &num_filenames);
-        }
-    }
-
-    int num_left = num_sources - 1;
-    for (int i = 0; i < num_filenames && num_left > 0; i++) {
-        mp_msg(MSGT_CPLAYER, MSGL_INFO, "Checking file %s\n",
-               filename_recode(filenames[i]));
-        int format;
-        struct stream *s = open_stream(filenames[i], &mpctx->opts, &format);
-        if (!s)
-            continue;
-        struct demuxer *d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_MATROSKA,
-                                       mpctx->opts.audio_id,
-                                       mpctx->opts.video_id,
-                                       mpctx->opts.sub_id, filenames[i]);
-        if (!d) {
-            free_stream(s);
-            continue;
-        }
-        if (d->file_format == DEMUXER_TYPE_MATROSKA) {
-            for (int i = 1; i < num_sources; i++) {
-                if (sources[i].demuxer)
-                    continue;
-                if (!memcmp(uid_map[i], d->matroska_data.segment_uid, 16)) {
-                    mp_msg(MSGT_CPLAYER, MSGL_INFO,"Match for source %d: %s\n",
-                           i, filename_recode(d->filename));
-                    sources[i].stream = s;
-                    sources[i].demuxer = d;
-                    num_left--;
-                    goto match;
-                }
-            }
-        }
-        free_demuxer(d);
-        free_stream(s);
-        continue;
-    match:
-        ;
-    }
-    talloc_free(filenames);
-    if (num_left) {
-        mp_msg(MSGT_CPLAYER, MSGL_ERR, "Failed to find ordered chapter part!\n"
-               "There will be parts MISSING from the video!\n");
-        for (int i = 1, j = 1; i < num_sources; i++)
-            if (sources[i].demuxer) {
-                sources[j] = sources[i];
-                memcpy(uid_map[j], uid_map[i], 16);
-                j++;
-            }
-    }
-    return num_sources - num_left;
-}
-
-static void build_ordered_chapter_timeline(struct MPContext *mpctx)
-{
-    struct MPOpts *opts = &mpctx->opts;
-
-    if (!opts->ordered_chapters) {
-        mp_msg(MSGT_CPLAYER, MSGL_INFO, "File uses ordered chapters, but "
-               "you have disabled support for them. Ignoring.\n");
-        return;
-    }
-
-    mp_msg(MSGT_CPLAYER, MSGL_INFO, "File uses ordered chapters, will build "
-           "edit timeline.\n");
-
-    struct demuxer *demuxer = mpctx->demuxer;
-    struct matroska_data *m = &demuxer->matroska_data;
-
-    // +1 because sources/uid_map[0] is original file even if all chapters
-    // actually use other sources and need separate entries
-    struct content_source *sources = talloc_array_ptrtype(NULL, sources,
-                                                   m->num_ordered_chapters+1);
-    sources[0].stream = mpctx->stream;
-    sources[0].demuxer = mpctx->demuxer;
-    unsigned char uid_map[m->num_ordered_chapters+1][16];
-    int num_sources = 1;
-    memcpy(uid_map[0], m->segment_uid, 16);
-
-    for (int i = 0; i < m->num_ordered_chapters; i++) {
-        struct matroska_chapter *c = m->ordered_chapters + i;
-        if (!c->has_segment_uid)
-            memcpy(c->segment_uid, m->segment_uid, 16);
-
-        for (int j = 0; j < num_sources; j++)
-            if (!memcmp(c->segment_uid, uid_map[j], 16))
-                goto found1;
-        memcpy(uid_map[num_sources], c->segment_uid, 16);
-        sources[num_sources] = (struct content_source){};
-        num_sources++;
-    found1:
-        ;
-    }
-
-    num_sources = find_ordered_chapter_sources(mpctx, sources, num_sources,
-                                               uid_map);
-
-
-    // +1 for terminating chapter with start time marking end of last real one
-    struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline,
-                                                  m->num_ordered_chapters + 1);
-    struct chapter *chapters = talloc_array_ptrtype(NULL, chapters,
-                                                    m->num_ordered_chapters);
-    uint64_t starttime = 0;
-    uint64_t missing_time = 0;
-    int part_count = 0;
-    int num_chapters = 0;
-    uint64_t prev_part_offset = 0;
-    for (int i = 0; i < m->num_ordered_chapters; i++) {
-        struct matroska_chapter *c = m->ordered_chapters + i;
-
-        int j;
-        for (j = 0; j < num_sources; j++) {
-            if (!memcmp(c->segment_uid, uid_map[j], 16))
-                goto found2;
-        }
-        missing_time += c->end - c->start;
-        continue;
-    found2:;
-        /* Only add a separate part if the time or file actually changes.
-         * Matroska files have chapter divisions that are redundant from
-         * timeline point of view because the same chapter structure is used
-         * both to specify the timeline and for normal chapter information.
-         * Removing a missing inserted external chapter can also cause this.
-         * We allow for a configurable fudge factor because of files which
-         * specify chapter end times that are one frame too early;
-         * we don't want to try seeking over a one frame gap. */
-        int64_t join_diff = c->start - starttime - prev_part_offset;
-        if (part_count == 0
-            || FFABS(join_diff) > opts->chapter_merge_threshold * 1000000
-            || sources + j != timeline[part_count - 1].source) {
-            timeline[part_count].source = sources + j;
-            timeline[part_count].start = starttime / 1e9;
-            timeline[part_count].source_start = c->start / 1e9;
-            prev_part_offset = c->start - starttime;
-            part_count++;
-        } else if (part_count > 0 && join_diff) {
-            /* Chapter was merged at an inexact boundary;
-             * adjust timestamps to match. */
-            mp_msg(MSGT_CPLAYER, MSGL_V, "Merging timeline part %d with "
-                   "offset %d ms.\n", i, (int) join_diff);
-            starttime += join_diff;
-        }
-        chapters[num_chapters].start = starttime / 1e9;
-        chapters[num_chapters].name = talloc_strdup(chapters, c->name);
-        starttime += c->end - c->start;
-        num_chapters++;
-    }
-    timeline[part_count].start = starttime / 1e9;
-
-    if (!part_count) {
-        // None of the parts come from the file itself???
-        talloc_free(sources);
-        talloc_free(timeline);
-        talloc_free(chapters);
-        return;
-    }
-
-    mp_msg(MSGT_CPLAYER, MSGL_V, "Timeline contains %d parts from %d "
-           "sources. Total length %.3f seconds.\n", part_count, num_sources,
-           timeline[part_count].start);
-    if (missing_time)
-        mp_msg(MSGT_CPLAYER, MSGL_ERR, "There are %.3f seconds missing "
-               "from the timeline!\n", missing_time / 1e9);
-    mp_msg(MSGT_CPLAYER, MSGL_V, "Source files:\n");
-    for (int i = 0; i < num_sources; i++)
-        mp_msg(MSGT_CPLAYER, MSGL_V, "%d: %s\n", i,
-               filename_recode(sources[i].demuxer->filename));
-    mp_msg(MSGT_CPLAYER, MSGL_V, "Timeline parts: (number, start, "
-           "source_start, source):\n");
-    for (int i = 0; i < part_count; i++) {
-        struct timeline_part *p = timeline + i;
-        mp_msg(MSGT_CPLAYER, MSGL_V, "%3d %9.3f %9.3f %3td\n", i, p->start,
-               p->source_start, p->source - sources);
-    }
-    mp_msg(MSGT_CPLAYER, MSGL_V, "END %9.3f\n", timeline[part_count].start);
-    mpctx->sources = sources;
-    mpctx->num_sources = num_sources;
-    mpctx->timeline = timeline;
-    mpctx->num_timeline_parts = part_count;
-    mpctx->num_chapters = num_chapters;
-    mpctx->chapters = chapters;
-
-    mpctx->timeline_part = 0;
-    mpctx->demuxer = timeline[0].source->demuxer;
-}
-
-
 static int read_keys(void *ctx, int fd)
 {
     getch2(ctx);
@@ -3839,7 +3663,7 @@ static bool attachment_is_font(struct demux_attachment *att)
     return false;
 }
 
-static int select_audio(demuxer_t *demuxer, int audio_id, char *audio_lang)
+static int select_audio(demuxer_t *demuxer, int audio_id, char **audio_lang)
 {
     if (audio_id == -1)
         audio_id = demuxer_audio_track_by_lang_and_default(demuxer, audio_lang);
@@ -3889,10 +3713,23 @@ if (HAVE_CMOV)
 #endif /* ARCH_X86 */
 }
 
+#ifdef PTW32_STATIC_LIB
+static void detach_ptw32(void)
+{
+    pthread_win32_thread_detach_np();
+    pthread_win32_process_detach_np();
+}
+#endif
+
 /* This preprocessor directive is a hack to generate a mplayer-nomain.o object
  * file for some tools to link against. */
 #ifndef DISABLE_MAIN
 int main(int argc,char* argv[]){
+#ifdef PTW32_STATIC_LIB
+    pthread_win32_process_attach_np();
+    pthread_win32_thread_attach_np();
+    atexit(detach_ptw32);
+#endif
     if (argc > 1 && !strcmp(argv[1], "-leak-report"))
         talloc_enable_leak_report();
 
@@ -4331,33 +4168,19 @@ if (edl_output_filename) {
 //==================== Open VOB-Sub ============================
 
     current_module="vobsub";
-    if (vobsub_name){
-      vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec);
+    if (opts->vobsub_name){
+      vo_vobsub=vobsub_open(opts->vobsub_name,spudec_ifo,1,&vo_spudec);
       if(vo_vobsub==NULL)
         mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load subtitles: %s\n",
-		filename_recode(vobsub_name));
-    } else if (sub_auto && mpctx->filename){
-      /* try to autodetect vobsub from movie filename ::atmos */
-      char *buf = strdup(mpctx->filename), *psub;
-      char *pdot = strrchr(buf, '.');
-      char *pslash = strrchr(buf, '/');
-#if defined(__MINGW32__) || defined(__CYGWIN__)
-      if (!pslash) pslash = strrchr(buf, '\\');
-#endif
-      if (pdot && (!pslash || pdot > pslash))
-        *pdot = '\0';
-      vo_vobsub=vobsub_open(buf,spudec_ifo,0,&vo_spudec);
-      /* try from ~/.mplayer/sub */
-      if(!vo_vobsub && (psub = get_path( "sub/" ))) {
-          const char *bname = mp_basename(buf);
-          int l;
-          l = strlen(psub) + strlen(bname) + 1;
-          psub = realloc(psub,l);
-          strcat(psub,bname);
-          vo_vobsub=vobsub_open(psub,spudec_ifo,0,&vo_spudec);
-          free(psub);
-      }
-      free(buf);
+		filename_recode(opts->vobsub_name));
+    } else if (opts->sub_auto && mpctx->filename){
+        char **vob = find_vob_subtitles(opts, mpctx->filename);
+        for (int i = 0; i < MP_TALLOC_ELEMS(vob); i++) {
+            vo_vobsub = vobsub_open(vob[i], spudec_ifo, 0, &vo_spudec);
+            if (vo_vobsub)
+                break;
+        }
+        talloc_free(vob);
     }
     if(vo_vobsub){
       mpctx->initialized_flags|=INITIALIZED_VOBSUB;
@@ -4372,14 +4195,9 @@ if (edl_output_filename) {
 
   mpctx->stream=NULL;
   mpctx->demuxer=NULL;
-  if (mpctx->d_audio) {
-    //free_demuxer_stream(mpctx->d_audio);
-    mpctx->d_audio=NULL;
-  }
-  if (mpctx->d_video) {
-    //free_demuxer_stream(d_video);
-    mpctx->d_video=NULL;
-  }
+  mpctx->d_audio=NULL;
+  mpctx->d_video=NULL;
+  mpctx->d_sub = NULL;
   mpctx->sh_audio=NULL;
   mpctx->sh_video=NULL;
 
@@ -4562,6 +4380,32 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST)
  if (mpctx->demuxer->matroska_data.ordered_chapters)
      build_ordered_chapter_timeline(mpctx);
 
+ if (mpctx->demuxer->type == DEMUXER_TYPE_EDL)
+     build_edl_timeline(mpctx);
+
+ if (mpctx->timeline) {
+    mpctx->timeline_part = 0;
+    mpctx->demuxer = mpctx->timeline[0].source->demuxer;
+
+    int part_count = mpctx->num_timeline_parts;
+    mp_msg(MSGT_CPLAYER, MSGL_V, "Timeline contains %d parts from %d "
+           "sources. Total length %.3f seconds.\n", part_count,
+           mpctx->num_sources, mpctx->timeline[part_count].start);
+    mp_msg(MSGT_CPLAYER, MSGL_V, "Source files:\n");
+    for (int i = 0; i < mpctx->num_sources; i++)
+        mp_msg(MSGT_CPLAYER, MSGL_V, "%d: %s\n", i,
+               filename_recode(mpctx->sources[i].demuxer->filename));
+    mp_msg(MSGT_CPLAYER, MSGL_V, "Timeline parts: (number, start, "
+           "source_start, source):\n");
+    for (int i = 0; i < part_count; i++) {
+        struct timeline_part *p = mpctx->timeline + i;
+        mp_msg(MSGT_CPLAYER, MSGL_V, "%3d %9.3f %9.3f %3td\n", i, p->start,
+               p->source_start, p->source - mpctx->sources);
+    }
+    mp_msg(MSGT_CPLAYER, MSGL_V, "END %9.3f\n",
+           mpctx->timeline[part_count].start);
+ }
+
  if (!mpctx->sources) {
      mpctx->sources = talloc_ptrtype(NULL, mpctx->sources);
      *mpctx->sources = (struct content_source){.stream = mpctx->stream,
@@ -4595,12 +4439,9 @@ if (ts_prog) {
   mp_property_do("switch_program", M_PROPERTY_SET, &tmp, mpctx);
 }
 // select audio stream
-    if (mpctx->num_sources)
-         for (int i = 0; i < mpctx->num_sources; i++)
-             select_audio(mpctx->sources[i].demuxer, opts->audio_id,
-                          opts->audio_lang);
-    else
-        select_audio(mpctx->d_audio->demuxer, opts->audio_id, opts->audio_lang);
+    for (int i = 0; i < mpctx->num_sources; i++)
+        select_audio(mpctx->sources[i].demuxer->audio->demuxer, opts->audio_id,
+                     opts->audio_lang);
 
 // DUMP STREAMS:
 if((stream_dump_type)&&(stream_dump_type<4)){
@@ -4709,20 +4550,16 @@ if(vo_spudec==NULL &&
 // check .sub
   current_module="read_subtitles_file";
   double sub_fps = mpctx->sh_video ? mpctx->sh_video->fps : 25;
-  if(sub_name){
-    for (i = 0; sub_name[i] != NULL; ++i)
-        add_subtitles(mpctx, sub_name[i], sub_fps, 0);
+  if(opts->sub_name){
+    for (i = 0; opts->sub_name[i] != NULL; ++i)
+        add_subtitles(mpctx, opts->sub_name[i], sub_fps, 0);
   }
-  if(sub_auto) { // auto load sub file ...
-    char *psub = get_path( "sub/" );
-    char **tmp = sub_filenames((psub ? psub : ""), mpctx->filename);
-    int i = 0;
-    free(psub); // release the buffer created by get_path() above
-    while (tmp[i]) {
-        add_subtitles(mpctx, tmp[i], sub_fps, 1);
-        free(tmp[i++]);
-    }
-    free(tmp);
+  if(opts->sub_auto) { // auto load sub file ...
+      char **tmp = find_text_subtitles(opts, mpctx->filename);
+      int nsub = MP_TALLOC_ELEMS(tmp);
+      for (int i = 0; i < nsub; i++)
+          add_subtitles(mpctx, tmp[i], sub_fps, 1);
+      talloc_free(tmp);
   }
   if (mpctx->set_of_sub_size > 0)
       mpctx->sub_counts[SUB_SOURCE_SUBS] = mpctx->set_of_sub_size;
@@ -4741,8 +4578,7 @@ if (select_subtitle(mpctx)) {
 
   print_file_properties(mpctx, mpctx->filename);
 
-  if (mpctx->sh_video)
-      reinit_video_chain(mpctx);
+  reinit_video_chain(mpctx);
   if (mpctx->sh_video) {
     if(mpctx->sh_video->output_flags & VFCAP_SPU && vo_spudec)
       spudec_set_hw_spu(vo_spudec,mpctx->video_out);
@@ -4855,7 +4691,7 @@ if(play_n_frames==0){
 // If there's a timeline force an absolute seek to initialize state
 if (seek_to_sec || mpctx->timeline) {
     queue_seek(mpctx, MPSEEK_ABSOLUTE, seek_to_sec, 0);
-    seek(mpctx, mpctx->seek);
+    seek(mpctx, mpctx->seek, false);
     end_at.pos += seek_to_sec;
 }
 if (opts->chapterrange[0] > 0) {
@@ -4863,7 +4699,7 @@ if (opts->chapterrange[0] > 0) {
     if (seek_chapter(mpctx, opts->chapterrange[0]-1, &pts, NULL) >= 0
         && pts > -1.0) {
         queue_seek(mpctx, MPSEEK_ABSOLUTE, pts, 0);
-        seek(mpctx, mpctx->seek);
+        seek(mpctx, mpctx->seek, false);
     }
 }
 
diff --git a/mplayer/mplayer.h b/mplayer/mplayer.h
index 4f0c927..267b650 100644
--- a/mplayer/mplayer.h
+++ b/mplayer/mplayer.h
@@ -38,10 +38,8 @@ extern char * sub_font_name;
 extern float  font_factor;
 extern double force_fps;
 
-//extern char **sub_name;
 extern float  sub_delay;
 extern float  sub_fps;
-extern int    sub_auto;
 
 extern int stream_cache_size;
 
diff --git a/mplayer/options.h b/mplayer/options.h
index 0fb0a7d..d5cc82c 100644
--- a/mplayer/options.h
+++ b/mplayer/options.h
@@ -31,6 +31,7 @@ typedef struct MPOpts {
 
     int osd_level;
     int osd_duration;
+    char *vobsub_name;
     int auto_quality;
     int benchmark;
     char *stream_dump_name;
@@ -64,8 +65,8 @@ typedef struct MPOpts {
     int audio_id;
     int video_id;
     int sub_id;
-    char *audio_lang;
-    char *sub_lang;
+    char **audio_lang;
+    char **sub_lang;
     int hr_mp3_seek;
 
     char *audio_stream;
@@ -86,6 +87,9 @@ typedef struct MPOpts {
     float screen_size_xy;
     int flip;
     int vd_use_slices;
+    char **sub_name;
+    char **sub_paths;
+    int sub_auto;
     int ass_enabled;
     struct lavc_param {
         int workaround_bugs;
diff --git a/mplayer/osdep/findfiles.c b/mplayer/osdep/findfiles.c
deleted file mode 100644
index 879f6d5..0000000
--- a/mplayer/osdep/findfiles.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <dirent.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "talloc.h"
-
-#if defined(__MINGW32__) || defined(__CYGWIN__)
-static const char dir_separators[] = "/\\:";
-#else
-static const char dir_separators[] = "/";
-#endif
-
-char **find_files(const char *original_file, const char *suffix,
-                  int *num_results_ptr)
-{
-    void *tmpmem = talloc_new(NULL);
-    char *fname = talloc_strdup(tmpmem, original_file);
-    char *basename = NULL;
-    char *next = fname;
-    while (1) {
-        next = strpbrk(next, dir_separators);
-        if (!next)
-            break;
-        basename = next++;
-    }
-    char *directory;
-    if (basename) {
-        directory = fname;
-        *basename++ = 0;
-    } else {
-        directory = ".";
-        basename = fname;
-    }
-
-
-    char **results = talloc_size(NULL, 0);
-    DIR *dp = opendir(directory);
-    struct dirent *ep;
-    char ***names_by_matchlen = talloc_array(tmpmem, char **,
-                                             strlen(basename) + 1);
-    memset(names_by_matchlen, 0, talloc_get_size(names_by_matchlen));
-    int num_results = 0;
-    while ((ep = readdir(dp))) {
-        int suffix_offset = strlen(ep->d_name) - strlen(suffix);
-        // name must end with suffix
-        if (suffix_offset < 0 || strcmp(ep->d_name + suffix_offset, suffix))
-            continue;
-        // don't list the original name
-        if (!strcmp(ep->d_name, basename))
-            continue;
-
-        char *name = talloc_asprintf(results, "%s/%s", directory, ep->d_name);
-        char *s1 = ep->d_name;
-        char *s2 = basename;
-        int matchlen = 0;
-        while (*s1 && *s1++ == *s2++)
-            matchlen++;
-        int oldcount = talloc_get_size(names_by_matchlen[matchlen]) /
-            sizeof(char **);
-        names_by_matchlen[matchlen] = talloc_realloc(names_by_matchlen,
-                                                  names_by_matchlen[matchlen],
-                                                  char *, oldcount + 1);
-        names_by_matchlen[matchlen][oldcount] = name;
-        num_results++;
-    }
-    closedir(dp);
-    results = talloc_realloc(NULL, results, char *, num_results);
-    char **resptr = results;
-    for (int i = strlen(basename); i >= 0; i--) {
-        char **p = names_by_matchlen[i];
-        for (int j = 0; j < talloc_get_size(p) / sizeof(char *); j++)
-            *resptr++ = p[j];
-    }
-    assert(resptr == results + num_results);
-    talloc_free(tmpmem);
-    *num_results_ptr = num_results;
-    return results;
-}
diff --git a/mplayer/osdep/findfiles.h b/mplayer/osdep/findfiles.h
deleted file mode 100644
index 97443e7..0000000
--- a/mplayer/osdep/findfiles.h
+++ /dev/null
@@ -1,2 +0,0 @@
-char **find_files(const char *original_file, const char *suffix,
-                  int *num_results_ptr);
diff --git a/mplayer/path.c b/mplayer/path.c
index 7f4ce88..f97e8a6 100644
--- a/mplayer/path.c
+++ b/mplayer/path.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdbool.h>
 #include "config.h"
 #include "mp_msg.h"
 #include "path.h"
@@ -42,6 +43,8 @@
 #include <sys/cygwin.h>
 #endif
 
+#include "talloc.h"
+
 #include "osdep/osdep.h"
 
 char *get_path(const char *filename){
@@ -194,7 +197,7 @@ void set_codec_path(const char *path)
     needs_free = 1;
 }
 
-const char *mp_basename(const char *path)
+char *mp_basename(const char *path)
 {
     char *s;
 
@@ -207,5 +210,41 @@ const char *mp_basename(const char *path)
         path = s + 1;
 #endif
     s = strrchr(path, '/');
-    return s ? s + 1 : path;
+    return s ? s + 1 : (char *)path;
+}
+
+struct bstr mp_dirname(const char *path)
+{
+    struct bstr ret = {(uint8_t *)path, mp_basename(path) - path};
+    if (ret.len == 0)
+        return BSTR(".");
+    return ret;
+}
+
+char *mp_path_join(void *talloc_ctx, struct bstr p1, struct bstr p2)
+{
+    if (p1.len == 0)
+        return bstrdup0(talloc_ctx, p2);
+    if (p2.len == 0)
+        return bstrdup0(talloc_ctx, p1);
+
+#if HAVE_DOS_PATHS
+    if (p2.len >= 2 && p2.start[1] == ':'
+        || p2.start[0] == '\\' || p2.start[0] == '/')
+#else
+    if (p2.start[0] == '/')
+#endif
+        return bstrdup0(talloc_ctx, p2);   // absolute path
+
+    bool have_separator;
+    int endchar1 = p1.start[p1.len - 1];
+#if HAVE_DOS_PATHS
+    have_separator = endchar1 == '/' || endchar1 == '\\'
+        || p1.len == 2 && endchar1 == ':';     // "X:" only
+#else
+    have_separator = endchar1 == '/';
+#endif
+
+    return talloc_asprintf(talloc_ctx, "%.*s%s%.*s", BSTR_P(p1),
+                           have_separator ? "" : "/", BSTR_P(p2));
 }
diff --git a/mplayer/path.h b/mplayer/path.h
index 349f55e..ffa052d 100644
--- a/mplayer/path.h
+++ b/mplayer/path.h
@@ -21,11 +21,27 @@
 #ifndef MPLAYER_PATH_H
 #define MPLAYER_PATH_H
 
+#include "bstr.h"
+
 extern char *codec_path;
 
 char *get_path(const char *filename);
 void set_path_env(void);
 void set_codec_path(const char *path);
-const char *mp_basename(const char *path);
+
+// Return pointer to filename part of path
+
+char *mp_basename(const char *path);
+
+/* Return struct bstr referencing directory part of path, or if that
+ * would be empty, ".".
+ */
+struct bstr mp_dirname(const char *path);
+
+/* Join two path components and return a newly allocated string
+ * for the result. '/' is inserted between the components if needed.
+ * If p2 is an absolute path then the value of p1 is ignored.
+ */
+char *mp_path_join(void *talloc_ctx, struct bstr p1, struct bstr p2);
 
 #endif /* MPLAYER_PATH_H */
diff --git a/mplayer/po/bg.po b/mplayer/po/bg.po
index 1366dd5..424b0e5 100644
--- a/mplayer/po/bg.po
+++ b/mplayer/po/bg.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Tози codecs.conf е твърде стар и несъвместим 
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -189,211 +189,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Playlist-ът не може да бъде зареден %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -549,7 +549,7 @@ msgstr "[Смесител] Не е достъпна настройка на зв
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -622,7 +622,7 @@ msgstr ""
 " * * * ЗА ПОДРОБНОСТИ, ДОПЪЛНИТЕЛНИ ОПЦИИ И КЛАВИШИ, ВИЖТЕ РЪКОВОДСТВОТО! * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -632,7 +632,7 @@ msgstr ""
 "  Може да е бъг в кода за динамично установяване на процесора...\n"
 "  Моля прочетете DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -644,7 +644,7 @@ msgstr ""
 "  за който е компилиран/оптимизиран.\n"
 "  Проверете това!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -655,7 +655,7 @@ msgstr ""
 "  дизасемблиране с 'gdb'.\n"
 "За подробности - DOCS/HTML/en/bugreports_what.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -669,7 +669,7 @@ msgstr ""
 "  DOCS/HTML/en/bugreports.html и следвайте инструкциите там. Ние не можем\n"
 "  и няма да помогнем, ако не осигурите тази информация, когато съобщавате за бъг.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -720,7 +720,7 @@ msgstr ""
 "Ако нищо не помага, прочетете DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -729,7 +729,7 @@ msgstr ""
 "\n"
 "Излизане от програмата... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -738,97 +738,97 @@ msgstr ""
 "\n"
 "MPlayer е прекъснат от сигнал %d в модул: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "HOME директорията не може да бъде открита.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "Проблем с функция get_path(\"config\") \n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Създава се конфигурационен файл: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Зарежда се конфигурационен файл '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Не могат да бъдат заредени субтитри: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: добавен е файл със субтитри (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Грешка при предварителна инициализация на аудио филтрите!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Аудио устройството не може да бъде отворено/инициализирано -> няма звук.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Не може да бъде намерен подходящ филтър/изходен аудио формат!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux RTC грешка при четене: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Внимание! Softsleep underflow!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Грешка при отваряне/инициализиране на избраното видео устройство (-vo).\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Видео филтъра libmenu не може да бъде отворен без root меню %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  ПАУЗА  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "EDL не може да се ползва без видео, изключва се.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -837,84 +837,84 @@ msgstr ""
 "\n"
 "ФАТАЛНО: Видео филтъра (-vf) или изхода (-vo) не могат да бъдат инициализирани.\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 "Компилиран с динамично установяване на процесора - ВНИМАНИЕ - това не е оптимално!\n"
 "За най-добра производителност, рекомпилирайте MPlayer с --disable-runtime-cpudetection.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Компилиран за x86 процесори с разширения:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Използва се вградения codecs.conf.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Достъпни аудио кодеци:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Достъпни видео кодеци:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Команден ред:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Не може да се зареди шрифт: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Грешка при отваряне на %s: %s (необходими са права за четене).\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Linux RTC грешка при инициализация в ioctl (rtc_irqp_set кд%lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Добавете \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" към системните стартови скриптове.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Linux RTC init грешка в ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Използва се хардуерния RTC таймер (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Менюто е инициализирано: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Менюто не може да бъде инициализирано.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "Внимание: Функцията getch2_init е извикана двукратно!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -923,77 +923,77 @@ msgstr ""
 "\n"
 "Възпроизвеждане на %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "EDL файла [%s] не може да бъде отворен за запис.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Не може да се отвори файл за извличане.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Грешка при запис на файла.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: ФАТАЛНО: Избраният поток липсва!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Видео: Параметрите не могат да бъдат прочетени.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Броя кадри в секунда не е указан или е невалиден, ползвайте опцията -fps .\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Не е открит поток.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Аудио: няма звук\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Видео: няма видео\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "Наложени са %5.3f кадъра в секунда (ftime: %5.3f).\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Започва възпроизвеждането...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1245,28 +1245,28 @@ msgstr "достъпни етикети в"
 msgid "Couldn't find label in plugin library."
 msgstr "Етикета не може да бъде намерен в библиотеката."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Не са указани подопции"
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Не е указан файл с библиотека"
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Не е указан етикет на филтър"
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Не са указани достатъчно контроли от командния ред"
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: Input control #%d е под долната граница от %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: Input control #%d е над горната граница от %0.4f.\n"
@@ -1276,12 +1276,12 @@ msgstr "%s: Input control #%d е над горната граница от %0.4f
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Не може да отвори кодек %s, br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Aудио LAVC, не може да се намери енкодер за кодека %s\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Aудио LAVC, не може да задели контекст!\n"
@@ -1882,27 +1882,27 @@ msgstr "[AO SUN] Не може да бъде отворено устройств
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: вашата звукова карта не поддържа %d канал, %s, %d Hz честота.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Достъпни аудио драйвери:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2116,13 +2116,13 @@ msgstr "Мостри от този формат са нужни за подоб
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Не може да бъде открит кодек '%s' в libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Не може да бъде отворен кодек.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Не може да бъде затворен кодек.\n"
@@ -2347,7 +2347,7 @@ msgstr "INFO: Видеокодек Win32/DShow е инициализиран у
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2706,7 +2706,7 @@ msgstr "Не може да бъде отворен ogg разпределите
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2714,7 +2714,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2722,108 +2722,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2869,27 +2864,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "ПРЕДУПРЕЖДЕНИЕ: Заглавната част на аудио потока %d е редефинирана.\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Открит е аудио поток: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "ПРЕДУПРЕЖДЕНИЕ: Заглавната част на видео потока %d е редефинирана.\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Открит е видео поток: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2897,7 +2892,7 @@ msgstr ""
 "Може би възпроизвеждате non-interleaved поток/файл или кодекът не се е справил?\n"
 "За AVI файлове, опитайте да наложите non-interleaved режим със опцията -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2906,7 +2901,7 @@ msgstr ""
 "\n"
 "Tвърде много аудио пакети в буфера: (%d в %d байта).\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2915,62 +2910,62 @@ msgstr ""
 "\n"
 "Твърде много видео пакети в буфера: (%d в %d байта).\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Не може да се отвори звуков поток: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Не могат да бъдат отворени субтитри: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Не може да бъде отворен аудио разпределител: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Не може да бъде отворен разпределител на субтитри: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Не могат да се превъртат сурови AVI потоци. (Изисква се индекс, опитайте с -idx .)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "Телевизията не може да се превърта! (Могат да се превключват евентуално каналите ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Този файл не може да се превърта.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Информация за клипа:\n"
@@ -4104,7 +4099,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Достъпни пълноекранни режими:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4556,12 +4551,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4760,88 +4755,88 @@ msgstr "Грешка при избор на VCD пътечка."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Не може да бъде отворено DVD устройство: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Има %d заглавия на това DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Невалиден номер на DVD заглавие: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Има %d гледни точки в това DVD заглавие..\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Невалиден номер на гледна точка: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Не може да бъде отворен IFO файла на това DVD заглавие %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Заглавието не може да бъде отворено (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5073,12 +5068,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Библиотеката libsmbclient не може да бъде инициализирана: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "'%s' не може да бъде отворен през LAN\n"
@@ -5554,7 +5549,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/cs.po b/mplayer/po/cs.po
index 2447922..54ae0f3 100644
--- a/mplayer/po/cs.po
+++ b/mplayer/po/cs.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Tento codecs.conf je příliš starý a nekompatibilní s tímto sestave
 msgid "Chapter: (%d) %s"
 msgstr "Kapitola: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "neznámé"
 
@@ -189,211 +189,211 @@ msgstr "Úhel: %d/%d"
 msgid "enabled (EDL)"
 msgstr "zapnuto (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "vypnuto"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "zapnuto"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "intenzivní"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "soubor"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "vestavěné"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "nahoru"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "na střed"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "dolů"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Loop: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Hlasitost"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Ztišení: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V odchylka: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Zvuk: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Váha"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Panscan"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Zůstat navrchu: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Kořenové okno: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Rámeček: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Zahazování snímků: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gama"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Jas"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Kontrast"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Sytost"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Tónování"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "Vertikální synchronizace: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Titulky: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Zdroj titulků: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Umístění titulků: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Zarovnání titulků: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Zpoždění titulků: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Pouze vynucené titulky: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Zvětšení titulků: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "EDL: Začátek vynechaného bloku, stiskněte znovu 'i' pro ukončení bloku.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "EDL: Vynechání zrušeno, poslední start > stop\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "EDL: Konec vynechaného bloku, řádek zapsán.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Zpoždění tit: %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Nemohu načíst playlist %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Kanál: %s"
@@ -556,7 +556,7 @@ msgstr "[Mixer] Ovládání hlasitosti není k dislozici.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Mixer] Stereováha není k dispozici.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -629,7 +629,7 @@ msgstr ""
 " * * * V MAN STRÁNCE NAJDETE PODROBNOSTI, DALŠÍ VOLBY A KLÁVESY * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -639,7 +639,7 @@ msgstr ""
 "  To může být chyba v kódu pro rozpoznání CPU za běhu...\n"
 "  Prosím, přečtěte si DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -651,7 +651,7 @@ msgstr ""
 "  byl přeložen/optimalizován.\n"
 "  Ověřte si to!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -661,7 +661,7 @@ msgstr ""
 "  Přeložte MPlayer s volbou --enable-debug , proveďte 'gdb' backtrace\n"
 "  a disassembly. Detaily najdete v DOCS/HTML/en/bugreports_what.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -675,7 +675,7 @@ msgstr ""
 "  DOCS/HTML/en/bugreports.html a pokračujte podle tam uvedeného návodu. My vám nemůžeme\n"
 "  pomoci, pokud tyto informace neuvedete při ohlašování možné chyby.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -727,7 +727,7 @@ msgstr ""
 "Pokud nic z toho nepomůže, přečtěte si DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -736,7 +736,7 @@ msgstr ""
 "\n"
 "Končím... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -745,97 +745,97 @@ msgstr ""
 "\n"
 "MPlayer přerušen signálem %d v modulu %s.\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Nemohu nalézt domácí adresář.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "Nastal problém s get_path(\"config\")\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Vytvářím konfigurační soubor: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Načítám profil protokolu '%s'\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Načítám profil rozšíření '%s'\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Načítám konfiguraci '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Nemohu načíst titulky: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: Přidán soubor s titulky (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Chyba při předinicializaci řetězce audio filtrů!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Nepodařilo se otevřít/inicializovat audio zařízení -> nebude zvuk.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Nemohu najít odpovídající filtr/ao formát!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Chyba při čtení z Linuxových RTC: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Varování! Podtečení softsleep!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Chyba při otevírání/inicializaci vybraného video_out (-vo) zařízení.\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Nemohu otevřít video filtr libmenu s kořenovým menu %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "===== POZASTAVENO ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "EDL nelze použít bez videa, vypínám.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -844,84 +844,84 @@ msgstr ""
 "\n"
 "Kritická chyba: Nemohu inicializovat video filtry (-vf) nebo video výstup (-vo)!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Přeloženo s detekcí CPU za běhu.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Přeloženo pro CPU x86 s rozšířeními:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Používám zabudovaný výchozí codecs.conf.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Dostupné audio kodeky:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Dostupné video kodeky:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Příkazový řádek:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Nemohu načíst bitmapový font: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Selhalo otevření %s: %s (by mělo být čitelné uživatelem.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Chyba inicializace Linuxových RTC v ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 "Zkuste přidat \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" do startovacích\n"
 " skriptů vašeho systému.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Chyba inicializace Linuxových RTC v ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Pro časování použity linuxové hardwarové RTC (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menu inicializováno: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Selhala inicializace menu.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "VAROVÁNÍ: getch2_init volána dvakrát!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -930,77 +930,77 @@ msgstr ""
 "\n"
 "Přehrávám %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Nelze otevřít EDL soubor [%s] pro zápis.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Nelze otevřít soubor pro dump.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: chyba při zápisu souboru.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: Kritická chyba: Chybí požadovaný datový proud!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: Nelze přečíst vlastnosti.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] fmtsouboru:%d  fourcc:0x%X  velikost:%dx%d  fps:%5.3f  fčas:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Údaj o FPS v hlavičce souboru je špatný nebo chybí, použijte volbu -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Nenalezen datový proud\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: žádný zvuk\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: Žádné video\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS vynuceno na hodnotu %5.3f  (vyn. čas: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Začínám přehrávat...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1256,28 +1256,28 @@ msgstr "dostupné názvy v"
 msgid "Couldn't find label in plugin library."
 msgstr "Nelze nalézt požadovaný název v knihovně pluginů."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Nebyla zadány žádné podvolby."
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Nebyla zadána žádná knihovna."
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Nebyl zadán název žádného filtru."
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Na příkazovém řádku bylo uvedeno málo voleb."
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: Vstupní volič #%d je nižší než minimální hodnota %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: Vstupní volič #%d je vyšší než maximální hodnota %0.4f.\n"
@@ -1287,12 +1287,12 @@ msgstr "%s: Vstupní volič #%d je vyšší než maximální hodnota %0.4f.\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Nelze otevřít kodek %s, br=%d.\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, nemohu najít enkodér pro kodek %s.\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, nemohu alokovat kontext!\n"
@@ -1901,27 +1901,27 @@ msgstr "[AO SUN] Nelze otevřít zvukové zařízení %s, %s  -> nebude zvuk.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: Vaše karta nepodporuje %d kanálové, %s, %d Hz vzorkování.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Dostupná audio rozhraní:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr "Zkouším preferované audio rozhraní '%.*s', předvolby '%s'\n"
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr "Selhala inicializace audio rozhraní '%s'\n"
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr "Takové audio rozhraní není '%.*s'\n"
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr "Zkouším všechna známá audio rozhraní...\n"
@@ -2135,13 +2135,13 @@ msgstr "Vzorky tohoto formátu potřebujeme pro zlepšení podpory. Kontaktujte
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Nemohu najít kodek '%s' v libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Nelze otevřít kodek.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Nelze uzavřít kodek.\n"
@@ -2369,7 +2369,7 @@ msgstr "INFO: Inicializace Win32/DShow videokodeku OK.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] Aritmetický průměr QP: %2.4f, harmonický průměr QP: %2.4f\n"
@@ -2730,7 +2730,7 @@ msgstr "Nelze otevřít Ogg demuxer.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "fill_buffer chyba: špatný demuxer: ani vd, ad nebo sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2738,7 +2738,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2746,29 +2746,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] inicializace zlib selhala.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] zlib dekomprese selhala.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] lzo dekomprese selhala.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2777,19 +2777,19 @@ msgstr ""
 "[mkv] Stopa číslo %u byla zašifrována a dešifrování nebylo dosud\n"
 "[mkv] implementováno. Přeskakuji stopu.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] Nezanámý typ enkódování stopy %u. Přeskakuji stopu.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2798,22 +2798,22 @@ msgstr ""
 "[mkv] Stopa %u byla komprimována pomocí zlib, ale MPlayer nebyl kompilován\n"
 "[mkv] s podporou zlib komprese. Přeskakuji stopu.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] Stopa ID %u: %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] Stopa ID %u: %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2822,12 +2822,12 @@ msgstr ""
 "[mkv] Neznámé/nepodporované ID kodeku (%s) nebo chybějící/vadná CodecPrivate\n"
 "[mkv] data (stopa %u).\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] Stopa FLAC neobsahuje platné hlavičky.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2836,26 +2836,21 @@ msgstr ""
 "[mkv] Neznámé/nepodporované ID audio kodeku '%s' pro stopu %u nebo chybějící/chybná\n"
 "[mkv] private codec data.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] Typ titulků '%s' není podporován.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] Budu přehrávat video stopu %u.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Žádná video stopa nenalezena/požadována.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Žádná audio stopa nenalezena/požadována.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2901,27 +2896,27 @@ msgstr "Uzavírám plugin: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "Čekám až XMMS plugin zahájí přehrávání '%s'...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "VAROVÁNÍ: Hlavička audio proudu %d předefinována!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Nalezen audio proud: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "VAROVÁNÍ: Hlavička video proudu %d předefinována!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Nalezen video proud: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2929,7 +2924,7 @@ msgstr ""
 "Možná přehráváte neprokládaný proud/soubor nebo kodek selhal?\n"
 "V AVI souborech zkuste vynutit neprokládaný režim pomocí volby -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2938,7 +2933,7 @@ msgstr ""
 "\n"
 "Příliš mnoho audio paketů ve vyrovnávací paměti: (%d v %d bajtech)\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2947,62 +2942,62 @@ msgstr ""
 "\n"
 "Příliš mnoho video paketů ve vyrovnávací paměti: (%d v %d bajtech)\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Nemohu otevřít audio proud: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Nemohu otevřít proud s titulky: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Nepovedlo se otevřít audio demuxer: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Nepovedlo se otevřít demuxer pro titulky: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Nelze se posouvat v surových (raw) AVI proudech! (Potřebuji index, zkuste použít volbu -idx.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV vstup neumožňuje posun! (\"Posun\" bude pravděpodobně použit pro změnu kanálů ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Nemohu se posouvat v tomto souboru.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Informace o klipu:\n"
@@ -4178,7 +4173,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Dostupné režimy změny hladiny při celoobrazovkovém zobrazení:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Vybraný video režim %dx%d pro velikost obrazu %dx%d.\n"
@@ -4641,12 +4636,12 @@ msgstr "Server vrátil %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Vyrovnávací paměť nastavena na %d KBajtů\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Selhalo otevření %s.\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4845,88 +4840,88 @@ msgstr "Chyba při výběru VCD stopy."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open, soubor=%s, stopa=%d, dostupné stopy: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Vybrán DVD zvukový kanál: %d jazyk: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "DVD zvuk v požadovaném jazyce nebyl nalezen!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Vybrán DVD titulkový kanál: %d jazyk: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "DVD titulky v požadovaném jazyce nebyly nalezeny!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Nelze otevřít DVD zařízení: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "Nelze otevřít VMG info!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Na tomto DVD je %d titul(ů).\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Neplatné číslo DVD titulu: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Tento DVD titul má %d úhlů pohledu.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Neplatné číslo DVD úhlu pohledu: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Nelze otevřít IFO soubor pro DVD titul %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Nelze otevřít VOBy titulu (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "audio proud: %d formát: %s (%s) jazyk: %s aid: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "počet zvukových kanálů na disku: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "titulky ( sid ): %d jazyk: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "počet sad titulků na disku: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer byl zkompilován bez podpory DVD, končím.\n"
@@ -5158,12 +5153,12 @@ msgstr "[radio] Používám frekvuenci: %.2f.\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] Volání do stream_enable_cache selhalo: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Nelze inicializovat knihovnu libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Nemohu otevřít soubor ze sítě: '%s'\n"
@@ -5649,7 +5644,7 @@ msgstr "tvi_dshow: Vzorkovací kmitočet %d zařízení nepodporuje. Měním na
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "Řetězec se zdá být již eskejpován v url_escape %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/de.po b/mplayer/po/de.po
index c4409ad..3fb2969 100644
--- a/mplayer/po/de.po
+++ b/mplayer/po/de.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Diese codecs.conf ist zu alt und inkompatibel mit dieser Version von MPl
 msgid "Chapter: (%d) %s"
 msgstr "Kapitel: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "unbekannt"
 
@@ -189,211 +189,211 @@ msgstr "Winkel: %d/%d"
 msgid "enabled (EDL)"
 msgstr "aktiviert (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "deaktiviert"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "aktiviert"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "hart"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "Datei"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "eingebettet"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "oben"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "mittig"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "unten"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Endloswiederholung: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Lautstärke"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Stumm: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A/V-Verzögerung: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Ton: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Balance"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Panscan"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Immer im Vordergrund: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Anzeige auf dem Desktop: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Rahmen: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Framedropping: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gamma"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Helligkeit"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Kontrast"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Sättigung"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Farbwertkorrektur"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "VSync: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Untertitel: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Untertitelquelle: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Untertitelposition: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Untertitelausrichtung: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Untertitelverzögerung: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Erzwungene Untertitel: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Untertitelskalierung: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "EDL-Sprung begonnen, drücke 'i' erneut, um den Block zu beenden.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "EDL-Sprung abgebrochen, letzter Start > Stop\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "EDL-Sprung beendet, Zeile geschrieben.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Untertitelverzögerung: %dms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Kann Playlist %s nicht laden.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Kanal: %s"
@@ -556,7 +556,7 @@ msgstr "[Mixer] Keine Lautstärkeregelung verfügbar.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Mixer] Keine Regelung für Balance verfügbar.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -629,7 +629,7 @@ msgstr ""
 " * * * SIEHE MANPAGE FÃœR DETAILS, WEITERE OPTIONEN UND TASTEN * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -640,7 +640,7 @@ msgstr ""
 "  die CPU-Erkennung zur Laufzeit handeln...\n"
 "  Bitte lies DOCS/HTML/de/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -652,7 +652,7 @@ msgstr ""
 "  ausführst als auf der, für die er kompiliert/optimiert wurde.\n"
 "  Überprüfe das!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -663,7 +663,7 @@ msgstr ""
 "  einen Backtrace und eine Disassemblierung. Details dazu findest du\n"
 "  in DOCS/HTML/de/bugreports_what.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -678,7 +678,7 @@ msgstr ""
 "  Wir können und werden dir nicht helfen, wenn du nicht alle dort aufgeführten\n"
 "  Informationen zur Verfügung stellst.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -733,7 +733,7 @@ msgstr ""
 "Wenn dies nicht hilft, lies DOCS/HTML/de/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -742,7 +742,7 @@ msgstr ""
 "\n"
 "Beenden... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -751,97 +751,97 @@ msgstr ""
 "\n"
 "MPlayer wurde durch Signal %d im Modul %s unterbrochen.\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Kann Homeverzeichnis nicht finden.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") fehlgeschlagen.\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Erstelle Konfigurationsdatei: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Lade protokolleigenes Profil '%s'\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Lade erweiterungseigenes Profil '%s'\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Lade Konfiguration '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Kann Untertitel nicht laden: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: Untertiteldatei (%d) hinzugefügt: %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Fehler bei der Vorinitialisierung der Audiofilterkette!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Kann Audiotreiber/Soundkarte nicht öffnen/initialisieren -> kein Ton\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Konnte passenden Filter/passendes ao-Format nicht finden!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux-RTC-Lesefehler: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Warnung! Unterlauf des Softsleep!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Fehler beim Öffnen/Initialisieren des ausgewählten Videoausgabetreibers (-vo).\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Kann den libmenu-Videofilter nicht mit dem Ursprungsmenü %s öffnen.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUSE  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Kann EDL nicht ohne Video verwenden, deaktiviere.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -850,82 +850,82 @@ msgstr ""
 "\n"
 "FATAL: Konnte Videofilter (-vf) oder -ausgabetreiber (-vo) nicht initialisieren.\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "MPlayer mit CPU-Erkennung zur Laufzeit kompiliert.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Kompiliert für x86 CPU mit folgenden Erweiterungen:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Benutze eingebaute Standardwerte für codecs.conf.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Verfügbare Audiocodecs:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Verfügbare Videocodecs:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Kommandozeile:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Kann Bitmap-Schriftdatei nicht laden: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Konnte %s nicht öffnen: %s (sollte für den Benutzer lesbar sein).\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Linux-RTC-Initialisierungsfehler in ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Versuche, \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" zu deinen Systemstartskripten hinzuzufügen.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Linux-RTC-Initialisierungsfehler in ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Verwende Linux Hardware RTC-Timing (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menü initialisiert: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Initialisierung des Menüs fehlgeschlagen.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "WARNUNG: getch2_init doppelt aufgerufen!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -934,77 +934,77 @@ msgstr ""
 "\n"
 "Spiele %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Kann EDL-Datei [%s] nicht zum Schreiben öffnen.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Kann dump-Datei nicht öffnen!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Fehler beim Schreiben der Datei.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATAL: Ausgewählter Stream fehlt!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: Kann Eigenschaften nicht lesen.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] Dateiformat:%d  fourcc:0x%X  Größe:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS ist im Header nicht angegeben (oder ungültig)! Benutze die Option -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Kein Stream gefunden.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: kein Ton!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: kein Video\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS von %5.3f erzwungen (ftime: %5.3f).\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Starte Wiedergabe...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1262,28 +1262,28 @@ msgstr "verfügbare Label in"
 msgid "Couldn't find label in plugin library."
 msgstr "Konnte Label in der Plugin-Bibliothek nicht finden."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Keine Suboptionen angegeben."
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Keine Bibliotheksdatei angegeben."
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Keine Filterlabel angegeben."
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Nicht genügend Bedienelemente in der Kommandozeile angegeben."
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: Input-Kontrolle #%d ist unterhalb der Grenze von %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: Input-Kontrolle #%d ist überhalb der Grenze von %0.4f.\n"
@@ -1293,12 +1293,12 @@ msgstr "%s: Input-Kontrolle #%d ist überhalb der Grenze von %0.4f.\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Konnte Codec %s nicht öffnen, br=%d.\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, konnte Encoder für Codec %s nicht finden.\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, konnte Kontext nicht zuordnen!\n"
@@ -1907,27 +1907,27 @@ msgstr "[AO SUN] Kann Audiogerät %s nicht öffnen, %s  -> nosound.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: Deine Karte unterstützt %d Kanäle nicht, %s, %d Hz Samplerate.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Verfügbare Audioausgabetreiber:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr "Probiere bevorzugten Audiotreiber '%.*s', Optionen '%s'\n"
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr "Konnte Audiotreiber '%s' nicht initialisieren\n"
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr "Kein Audiotreiber '%.*s'\n"
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr "Probiere jeden bekannten Audiotreiber...\n"
@@ -2143,13 +2143,13 @@ msgstr "Beispiele für dieses Format werden gebraucht, um die Unterstützung zu
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Kann Codec '%s' von libavcodec nicht finden...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Konnte Codec nicht öffnen.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Konnte Codec nicht schließen.\n"
@@ -2377,7 +2377,7 @@ msgstr "INFO: Win32/DShow Videocodec-Initialisierung OK.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] Arithmetisches Mittel des QP: %2.4f, Harmonisches Mittel des QP: %2.4f\n"
@@ -2741,7 +2741,7 @@ msgstr "Kann Ogg-Demuxer nicht öffnen.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "fill_buffer-Fehler: schlechter Demuxer: weder vd noch ad oder sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2749,7 +2749,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2757,29 +2757,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] Initialisierung von zlib fehlgeschlagen.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] Dekomprimierung mit zlib fehlgeschlagen.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] Dekomprimierung mit lzo fehlgeschlagen.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2788,19 +2788,19 @@ msgstr ""
 "[mkv] Track Nummer %u wurde verschlüsselt, und Entschlüsselung wurde noch\n"
 "[mkv] nicht implementiert. Ãœberspringe Track.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] Unbekannter Encoding-Typ des Inhalts von Track %u. Ãœberspringe Track.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2809,22 +2809,22 @@ msgstr ""
 "[mkv] Track %u wurde mit zlib komprimiert, mplayer wurde jedoch ohne\n"
 "[mkv] Unterstützung für Komprimierung mit zlib compiliert. Überspringe Track.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] Track-ID %u: %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] Track-ID %u: %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2833,12 +2833,12 @@ msgstr ""
 "[mkv] Unbekannte/nicht unterstützte CodecID (%s) oder fehlende/fehlerhafte\n"
 "[mkv] CodecPrivate-Daten (Track %u).\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] FLAC-Track enthält keine gültigen Header.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2847,26 +2847,21 @@ msgstr ""
 "[mkv]  Unbekannte/nicht unterstützte Audiocodec-ID ID '%s' für Track %u\n"
 "[mkv] oder fehlende/fehlerhafte private codec Daten.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] Untertitel-Typ '%s' wird nicht unterstützt.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] Werde Video-Track %u abspielen.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Kein Video-Track gefunden/gewünscht.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Kein Audio-Track gefunden/gewünscht.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2912,27 +2907,27 @@ msgstr "Plugin geschlossen: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "Warte auf die Wiedergabe des XMMS-Plugins von '%s'...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Warnung! Audiostream-Header %d neu definiert!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Audiostream gefunden: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Warnung! Videostream-Header %d neu definiert!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Videostream gefunden: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2941,7 +2936,7 @@ msgstr ""
 "Codec funktioniert nicht. Versuche bei AVI-Dateien, den nicht-interleaved \n"
 "Modus mit der Option -ni zu erzwingen.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2950,7 +2945,7 @@ msgstr ""
 "\n"
 "Zu viele Audiopakete im Puffer: (%d in %d Bytes).\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2959,62 +2954,62 @@ msgstr ""
 "\n"
 "Zu viele Videopakete im Puffer: (%d in %d Bytes).\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Kann Audiostream nicht öffnen: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Kann Untertitelstream nicht öffnen: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Öffnen des Audio-Demuxers fehlgeschlagen: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Öffnen des Untertitel-Demuxers fehlgeschlagen: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Suche in reinen AVI-Streams nicht durchführbar (Index erforderlich, probiere die '-idx'-Option.).\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV-Input ist nicht durchsuchbar (Suche des Kanals?).\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Kann diese Datei nicht durchsuchen.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Clip-Info:\n"
@@ -4203,7 +4198,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Verfügbare Vollbildschirm-Modi:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Ausgewählter Videomodus %dx%d für Bildgröße %dx%d.\n"
@@ -4667,12 +4662,12 @@ msgstr "Server liefert Fehler %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Cache-Größe auf %d KByte gesetzt.\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Konnte '%s' nicht öffnen.\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4871,88 +4866,88 @@ msgstr "Fehler beim Auswählen des VCD Tracks."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open: Dateiname='%s', Titel=%d, verfügbare Titel: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Ausgewählte DVD-Audiospur: %d Sprache: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "Keine passende DVD-Tonspur gefunden!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Ausgewählte DVD-Untertitelspur: %d Sprache: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "Keine passende Untertitelspur gefunden!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Kann DVD-Laufwerk nicht öffnen: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "Kann VMG-Informationen nicht öffnen!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Es sind %d Titel auf dieser DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Ungültige DVD-Titelnummer: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Es sind %d Kameraeinstellungen diesem DVD-Titel.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Ungültige DVD-Kameraeinstellungsnummer %d.\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Kann die IFO-Datei für den DVD-Titel %d nicht öffnen.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Kann VOB-Dateien des Titels  (VTS_%02d_1.VOB) nicht öffnen.\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "Audio-Stream: %d Format: %s (%s) Sprache: %s aid: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "Anzahl der Audiokanäle auf der Disc: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "Untertitel ( sid ): %d Sprache: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "Anzahl der Untertitel auf der Disc: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer wurde ohne DVD-Unterstützung übersetzt, beende.\n"
@@ -5186,12 +5181,12 @@ msgstr "[Radio] Verwende Frequenz: %.2f\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[Radio] Aufruf zu stream_enable_cache fehlgeschlagen: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Kann die Bibliothek libsmbclient nicht öffnen: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Konnte '%s' nicht über das Netzwerk öffnen.\n"
@@ -5689,7 +5684,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "Zeichenkette scheint bereits im URL-Format %c%c1%c2 'escaped' zu sein.\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/dk.po b/mplayer/po/dk.po
index f629f1e..f9d2b28 100644
--- a/mplayer/po/dk.po
+++ b/mplayer/po/dk.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,211 +179,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -392,7 +392,7 @@ msgstr ""
 "\n"
 "Kunne ikke indlæse afspilningslisten %s\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -534,7 +534,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -606,7 +606,7 @@ msgstr ""
 " * * * SE MANUALEN FOR DETALJER, FLERE (AVANCEREDE) MULIGHEDER OG TASTER * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -616,7 +616,7 @@ msgstr ""
 "  Det kan være en fejl i den nye dynamiske processoroptimeringskode...\n"
 "  Se DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -628,7 +628,7 @@ msgstr ""
 "  MPlayer var kompileret til.\n"
 " Check venligst dette!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  Rekompiler MPlayer med --enable-debug og lav et 'gdb' backtrace og\n"
 "  disassemling. For detaljer læs venligst DOCS/HTML/en/bugreports_what.html#bugreports_crash.b.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -653,7 +653,7 @@ msgstr ""
 "  og vil ikke hjælpe medmindre du følger instruktionerne når du rapporterer \n"
 "  en mulig fejl.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -704,7 +704,7 @@ msgstr ""
 "Hvis intet af dette hjalp, så læs DOCS/HTML/en/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -713,7 +713,7 @@ msgstr ""
 "\n"
 " Afslutter... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -722,97 +722,97 @@ msgstr ""
 "\n"
 "MPlayer afbrudt af signal %d i modul: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Kunne ikke finde hjemmekatalog\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") problem\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Genererer konfigurationsfil: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Kunne ikke indlæse undertekstfil: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Kunne ikke åbne/initialisere lydkortet -> INGEN LYD\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Fejl under åbning/initialisering af den valgte videodriver (-vo)!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUSE  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -821,82 +821,82 @@ msgstr ""
 "\n"
 "FATALT: Kunne ikke initialisere videofiltre (-vf) eller videodriver (-vo)!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Kompileret med dynamisk processoroptimering - NB: dette er ikke optimalt! For at få den bedre ydelse kompiler MPlayer fra kildekode med --disable-runtime-cpudetection\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Kompileret til x86 CPU med udvidelser:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Benytter indbyggede standardværdier for codecs.conf\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Tilgængelige lyd-codecs:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Tilgængelige video-codecs:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Kunne ikke indlæse skrifttype: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Benytter Linux' hardware RTC timer (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -905,77 +905,77 @@ msgstr ""
 "\n"
 "Afspiller %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Kunne ikke åbne dump filen.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Fejl ved skrivning til fil.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATALT: Kunne ikke finde det valgte spor!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: Kunne ikke læse egenskaber\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Billedfrekvensen er enten ikke angivet i filen eller ugyldig. Brug -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Ingen spor fundet\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Lyd: ingen lyd\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: ingen video\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "Billedfrekvens sat til %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "PÃ¥begynder afspilning...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1225,28 +1225,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1256,12 +1256,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1850,27 +1850,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Tilgængelige lyddrivere:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2084,13 +2084,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Kunne ikke finde codec '%s' i libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "kunne ikke åbne codec\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "kunne ikke afslutte codec\n"
@@ -2309,7 +2309,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2666,7 +2666,7 @@ msgstr "Kan ikke åbne ogg demuxe.r\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2674,7 +2674,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2682,108 +2682,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2829,27 +2824,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Advarsel! Lydfilens header %d er blevet omdefineret!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Fandt lydspor: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Advarsel! Videofilens header %d er blevet omdefineret!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Fandt videospor: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2857,7 +2852,7 @@ msgstr ""
 "Måske afspiller du en 'ikke-interleaved' stream/fil ellers der kan være en fejl i afspilleren\n"
 "For AVI filer, prøv at påtvinge non-interleaved tilstand med -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2866,7 +2861,7 @@ msgstr ""
 "\n"
 "DEMUXER: For mange (%d i %d bytes) lydpakker i bufferen!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2875,62 +2870,62 @@ msgstr ""
 "\n"
 "DEMUXER: For mange (%d i %d bytes) videopakker i bufferen!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Kan ikke åbne lydsspor: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Kan ikke åbne spor %s af underteksterne\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Kan ikke åbne lyddemuxer: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Kunne ikke åbne undertekstsdemuxer: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Søgning i rå AVI-filer ikke mulig. (Index kræves, prøv -idx.)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV input er ikke søgbart! (Kunne være du skulle skifte kanal ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Kan ikke søge i denne fil.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Klip info: \n"
@@ -4042,7 +4037,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Tilgængelige fuldskærmstilstande:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4494,12 +4489,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4698,88 +4693,88 @@ msgstr "Fejl i valg af VCD nummer!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Kunne ikke åbne DVD drev: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Der er %d titler på denne DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Ugyldig DVD-titel: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Der er %d vinkler i denne DVD-titel.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Ugyldig DVD-vinkel: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Kunne ikke finde IFO filen for DVD-titel %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Kunne ikke åbne titlen VOBS (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5011,12 +5006,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Kunne ikke initialisere libsmbclient bibliotek: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Kunne ikke åbne netværksadressen '%s'\n"
@@ -5492,7 +5487,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/el.po b/mplayer/po/el.po
index 76f38f8..94655b7 100644
--- a/mplayer/po/el.po
+++ b/mplayer/po/el.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,211 +179,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -392,7 +392,7 @@ msgstr ""
 "\n"
 " Αδύνατη η φόρτωση  της λίστας αναπαραγωγής %s\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -534,7 +534,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -606,7 +606,7 @@ msgstr ""
 " Ανατρέξτε στη σελίδα εγχειριδίου για περισσότερες λεπτομέρειες, πιο προχωρημένες επιλογές και  λίστα με πλήκτρα \n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -616,7 +616,7 @@ msgstr ""
 "  Μπορεί να είναι πρόβλημα στον νέο κώδικα για runtime CPU-αναγνώριση...\n"
 "  Παρακαλούμε διαβάστε το DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -628,7 +628,7 @@ msgstr ""
 "  η μεταγλώττιση/βελτιστοποίηση.\n"
 "  Ελέγξτε το!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  Αναμεταγλωττίστε το MPlayer με --enable-debug και τρέξτε 'gdb' backtrace και\n"
 "  disassembly. Για λεπτομέρειες, δείτε το DOCS/HTML/en/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -652,7 +652,7 @@ msgstr ""
 "  και ακολουθήστε της οδηγίες. Δεν μπορούμε και δεν θα προσφέρουμε βοήθεια εκτός και αν στείλετε\n"
 "  τις πληροφορίες όταν αναφέρετε το πρόβλημα.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -703,7 +703,7 @@ msgstr ""
 "Αν κανένα από αυτά δεν βοηθάει, τότε διαβάστε το DOCS/HTML/en/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -712,7 +712,7 @@ msgstr ""
 "\n"
 " Έξοδος... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -721,97 +721,97 @@ msgstr ""
 "\n"
 " Το MPlayer τερματίστηκε από το σήμα %d στο module: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Μη δυνατή η εύρεση του HOME φακέλου\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") πρόβλημα\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Δημιουργία του αρχείου config: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Μη δυνατότητα φόρτωσης των υποτίτλων: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Αδύνατο το άνοιγμα/αρχικοποίηση του οδηγού του ήχου -> ΧΩΡΙΣ-ΗΧΟ\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Σφάλμα κατά το άνοιγμα/αρχικοποίηση της επιλεγμένης video_out (-vo) συσκευή!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  ΠΑΥΣΗ  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -820,82 +820,82 @@ msgstr ""
 "\n"
 " Σφάλμα: Αδύνατη η αρχικοποίηση του φίλτρου βίντεο (-vf) ή της εξόδου βίντεο (-vo)!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Μετάφραση με αυτόματη αναγνώριση επεξεργαστή - προσοχή, δεν είναι βέλτιστο! Για καλύτερες επιδόσεις, μεταφράστε το mplayer από τον πηγαίο κώδικα με --disable-runtime-cpudetection\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Μετάφραση για x86 επεξεργαστή με τις ακόλουθες επεκτάσεις:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Χρήση του ενσωματωμένου προεπιλεγμένου codecs.conf\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Διαθέσιμα codecs ήχου:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Διαθέσιμα codecs βίντεο:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Μη δυνατότητα φόρτωσης της γραμματοσειράς: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Χρήση του hardware RTC του linux στα (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -904,77 +904,77 @@ msgstr ""
 "\n"
 "Αναπαραγωγή του %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Αδύνατο το άνοιγμα του dump αρχείου!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: σφάλμα εγγραφής αρχείου.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: Σφάλμα: λείπει το επιλεγμένο κανάλι!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Βίντεο: αδύνατη η ανάγνωση ιδιοτήτων\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Μη ορισμένα FPS (ή λάθος) στην επικεφαλίδα! Χρησιμοποιήστε την επιλογή -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Δεν βρέθηκε κανάλι\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Ήχος: μη διαθέσιμο!!!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Βίντεο: δεν υπάρχει βίντεο!!!\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "Τα FPS ρυθμίστηκαν να είναι %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Εκκίνηση αναπαραγωγής...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1224,28 +1224,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1255,12 +1255,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1849,27 +1849,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Διαθέσιμοι οδηγοί για έξοδο ήχου:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2083,13 +2083,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Δεν είναι δυνατό να βρεθεί το '%s' στο libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Αδύνατο το άνοιγμα του codec\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Αδύνατο το κλείσιμο του codec\n"
@@ -2310,7 +2310,7 @@ msgstr "Πληροφορία: το βίντεο codec Win32/DShow αρχικοπ
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2667,7 +2667,7 @@ msgstr "Δεν είναι δυνατό το άνοιγμα του ogg demuxer\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2675,7 +2675,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2683,108 +2683,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2830,27 +2825,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Προειδοποίηση! Η επικεφαλίδα του καναλιού ήχου %d ορίζεται ξανά!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Βρέθηκε κανάλι ήχου: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Προειδοποίηση! Η επικεφαλίδα του καναλιού βίντεο %d ορίζεται ξανά!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Βρέθηκε κανάλι βίντεο: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2858,7 +2853,7 @@ msgstr ""
 "(ίσως αναπαράγεται έναν non-interleaved κανάλι/αρχείο ή απέτυχε το codec)\n"
 "Για .AVI αρχεία, ενεργοποιήστε τη μέθοδο non-interleaved με την επιλογή -ni\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2867,7 +2862,7 @@ msgstr ""
 "\n"
 "DEMUXER: Πολλαπλά (%d σε %d bytes) πακέτα ήχου στον buffer!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2876,62 +2871,62 @@ msgstr ""
 "\n"
 "DEMUXER: Πολλαπλά (%d σε %d bytes) πακέτα βίντεο στον buffer!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Δεν είναι δυνατό το άνοιγμα του καναλιού ήχου: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Δεν είναι δυνατό το άνοιγμα του καναλιού υποτίτλων: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Αποτυχία κατά το άνοιγμα του demuxer ήχου: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Αποτυχία κατά το άνοιγμα του demuxer υποτίτλων: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Μη δυνατή αναζήτηση σε raw .AVI κανάλια! (το index είναι απαραίτητο, δοκιμάστε με την επιλογή -idx!)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV input δεν είναι αναζητήσιμο! (πιθανόν η αναζήτηση να γίνει για την αλλαγή σταθμών ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Αδύνατη η αναζήτηση σε αυτό το αρχείο!  \n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Πληροφορίες του μέσου: \n"
@@ -4049,7 +4044,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Διαθέσιμα επίπεδα αλλαγής σε πλήρη οθόνη:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4501,12 +4496,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4705,88 +4700,88 @@ msgstr "Σφάλμα στην επιλογή του VCD track!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Δεν μπόρεσα να ανοίξω την συσκευή DVD: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Υπάρχουν %d τίτλοι στο DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Άκυρος αριθμός για τον τίτλο του DVD: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Υπάρχουν %d γωνίες σε αυτό τον τίτλο του DVD.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Λάθος αριθμός των γωνιών του DVD: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Δεν είναι δυνατό το άνοιγμα του IFO αρχείο για τον τίτλο του DVD %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Δεν είναι δυνατό το άνοιγμα των VOB (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5018,12 +5013,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Αδύνατη η αρχικοποίηση της βιβλιοθήκης libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Δεν μπόρεσα να ανοίξω από το τοπικό δίκτυο: '%s'\n"
@@ -5499,7 +5494,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/es.po b/mplayer/po/es.po
index 68650a6..0912dd7 100644
--- a/mplayer/po/es.po
+++ b/mplayer/po/es.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "¡El archivo codecs.conf es demasiado viejo y es incompatible con esta v
 msgid "Chapter: (%d) %s"
 msgstr "Capítulo: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "desconocido"
 
@@ -189,211 +189,211 @@ msgstr "Ángulo: %d/%d"
 msgid "enabled (EDL)"
 msgstr "deshabilitado (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "deshabilitado"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "habilitado"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "hard"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "archivo"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "incluido"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "arriba"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "centro"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "abajo"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Loop: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Volumen"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Mudo: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V delay: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Audio: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Balance"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Panscan"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Quedarse arriba: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Rootwin: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Borde: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Framedropping: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gamma"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Brillo"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Contraste"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Saturación"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Hue"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "VSync: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Subtítulos: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Fuente de subtítulos: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Posición de subtítulos: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Alineación de subtítulos: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Retraso de subtítulos: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Sólo subtítulos forzados: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Escalado de subtítulos: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "EDL skip comenzado, presione 'i' denuevo para terminar con el bloque.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "EDL skip cancelado, último comienzo > parada\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "EDL skip terminado, operación guardada.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Sub delay: %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "No fue posible cargar la lista de reproducción %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Canal: %s"
@@ -554,7 +554,7 @@ msgstr "[Mixer] No hay un control de volumen disponible.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Mixer] No hay un control de balance disponible.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -627,7 +627,7 @@ msgstr ""
 " *** REVISE EL MANUAL PARA OTROS DETALLES, OPCIONES (AVANZADAS) Y TECLAS DE CONTROL ***\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -637,7 +637,7 @@ msgstr ""
 "  Esto puede deberse a un defecto en nuestra nueva rutina de autodetección de CPU...\n"
 "  Por favor lee DOCS/HTML/es/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -649,7 +649,7 @@ msgstr ""
 "  la usada para compilarlo o para la cual fue optimizado.\n"
 "  ¡Verifique eso!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -660,7 +660,7 @@ msgstr ""
 "  'gdb' y un desensamblado. Para más detalles, revise\n"
 "  DOCS/HTML/es/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -675,7 +675,7 @@ msgstr ""
 "  se encuentran. No podemos ayudarle a menos que nos provea esa\n"
 "  información cuando reporte algún posible defecto.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -727,7 +727,7 @@ msgstr ""
 "Si nada de eso sirve, revise DOCS/HTML/es/bugreports.html\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -736,7 +736,7 @@ msgstr ""
 "\n"
 "Saliendo... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -745,97 +745,97 @@ msgstr ""
 "\n"
 "MPlayer fue interrumpido con señal %d en el módulo: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "No se puede encontrar el directorio HOME.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "Problema en get_path(\"config\").\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Creando archivo de configuración: %s.\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Cargando el perfil protocol-related '%s'\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Cargando el perfil extension-related '%s'\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Cargando configuración '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "No se pudo cargar subtítulo: %s.\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: se agregó el archivo de subtítulo (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Error en pre-inicialización de cadena de filtros de audio!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "No se puede abrir o inicializar dispositivo de audio, no se reproducirá sonido.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "¡No se encontró filtro o formato de salida concordante!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Error de lectura de Linux RTC: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Advertencia! Softsleep underflow!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Error abriendo/inicializando el dispositivo de la salida de video (-vo)!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "No puedo abrir filtro de video libmenu con el menú principal %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUSA  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Imposible usar EDL sin video.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -844,82 +844,82 @@ msgstr ""
 "\n"
 "FATAL: No fue posible inicializar los filtros (-vf) o la salida de video (-vo)!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Compilado con detección de CPU en tiempo de ejecución - esto no es óptimo! Para obtener mejor rendimiento, recompile MPlayer con --disable-runtime-cpudetection.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Compilado para CPU x86 con extensiones:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Usando codecs.conf interno por omisión.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Codecs de audio disponibles:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Codecs de video disponibles:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Linea de Comando:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "No se pudo cargar typografía: %s.\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Fallo al abrir %s: %s (el usuario debe tener permisos de lectura)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Error iniciando Linux RTC en llamada a ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Pruebe agregando \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" a los scripts de inicio de su sistema.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Error iniciando Linux RTC en llamada a ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Usando el RTC timing por hardware de Linux (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menú inicializado: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Fallo en inicialización del menú.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "ADVERTENCIA: getch2_init llamada dos veces!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -928,77 +928,77 @@ msgstr ""
 "\n"
 "Reproduciendo %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Error tratando de escribir en [%s].\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "No se puede abrir el archivo de dump/volcado.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: error escribiendo el archivo.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATAL: No se encuentró el stream seleccionado.\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Vídeo: no se puede leer las propiedades.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] filefmt:%d  fourcc:0x%X  tamaño:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS no especificado (o inválido) en la cabecera! Usa la opción -fps.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "No encontre ningún stream.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: sin sonido.\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Vídeo: no hay video!\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS forzado a %5.3f  (ftime: %5.3f).\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Comenzando la reproducción...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1250,28 +1250,28 @@ msgstr "Etiquetas disponibles en"
 msgid "Couldn't find label in plugin library."
 msgstr "No se puede encontrar la etiqueta en la biblioteca del plugin."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "No se especificaron subopciones"
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "No se especificó archivo de biblioteca"
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "No se especificó etiqueta del filtro"
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "No se especificaron suficientes controles en la línea de comando"
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: Control de entrada #%d esta abajo del límite inferior que es %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: Control de entrada #%d esta por encima del límite superior que es %0.4f.\n"
@@ -1281,12 +1281,12 @@ msgstr "%s: Control de entrada #%d esta por encima del límite superior que es %
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "No se puede abrir el codec %s, br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "LAVC Audio, no se encuentra el codificador para el codec %s\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "LAVC Audio, ¡no se puede asignar contexto!\n"
@@ -1895,27 +1895,27 @@ msgstr "[AO SUN] Imposible abrir dispositivo de audio %s, %s -> nosound.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: Su tarjeta no soporta el canal %d, %s, %d Hz samplerate.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Controladores de salida de audio disponibles:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr "Intentando controlador de audio preferido '%.*s', opciones '%s'\n"
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr "Fallo al inicializar controlador de audio '%s'\n"
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr "No existe ese controlador de audio '%.*s'\n"
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr "Intentando con todos los controladores de audio conocidos...\n"
@@ -2129,13 +2129,13 @@ msgstr "Se necesitan muestras de este formato para mejorar el soporte. Por favor
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "No se encuentra codec '%s' en libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "No se pudo abrir codec.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "No se pudo cerrar codec.\n"
@@ -2356,7 +2356,7 @@ msgstr "INFO: Inicialización correcta de codec de video Win32/DShow.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] Significado aritmético de QP: %2.4f, significado armónico de QP: %2.4f\n"
@@ -2717,7 +2717,7 @@ msgstr "No se puede abrir el demuxer ogg.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "fill_buffer error: demuxer erroneo: no vd, ad o sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2725,7 +2725,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2733,29 +2733,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] zlib la inicialización ha fallado.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] zlib la descompresión ha fallado.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] lzo la descompresión ha fallado.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2764,19 +2764,19 @@ msgstr ""
 "[mkv] La pista número %u ha sido encriptada y la desencriptación no ha sido\n"
 "[mkv] todavía implementada. Omitiendo la pista.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] Tipo de codificación desconocida para la pista %u. Omitiendo la pista.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2785,22 +2785,22 @@ msgstr ""
 "[mkv] La pista %u ha sido comprimida con zlib pero mplayer no ha sido\n"
 "[mkv] compilado con soporte para compresión con zlib. Omitiendo la pista.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] Pista ID %u: %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] Pista ID %u: %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2809,12 +2809,12 @@ msgstr ""
 "[mkv] CodecID (%s) desconocido/no soportado/erróneo/faltante Codec privado\n"
 "[mkv] datos (pista %u).\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] La pista FLAC no contiene cabeceras válidas.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2823,26 +2823,21 @@ msgstr ""
 "[mkv] Codec de audio ID '%s' desconocido/no soportado para la pista %u\n"
 "[mkv] o erróneo/falta Codec privado.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] El tipo de subtítulos '%s' no está soportado.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] Reproducirá la pista de vídeo %u.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Ninguna pista de vídeo encontrada/deseada.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Ninguna pista de sonido encontrada/deseada.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2888,27 +2883,27 @@ msgstr "Cerrando plugin: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "Esperando a que el plugin XMMS comience la reprodución de '%s'...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Advertencia! Cabecera de stream de audio %d redefinida!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Encontrado stream de audio: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Advertencia! Cabecera de stream de video %d redefinida!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Encontrado stream de vîdeo: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2916,7 +2911,7 @@ msgstr ""
 "¿Estás reproduciendo un stream o archivo 'non-interleaved' o falló el codec?\n"
 " Para archivos .AVI, intente forzar el modo 'non-interleaved' con la opción -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2925,7 +2920,7 @@ msgstr ""
 "\n"
 "DEMUXER: Demasiados (%d en %d bytes) paquetes de audio en el buffer!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2934,62 +2929,62 @@ msgstr ""
 "\n"
 "DEMUXER: Demasiados (%d en %d bytes) paquetes de video en el buffer!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "No se puede abrir stream de audio: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "No se puede abrir stream de subtítulos: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "No se pudo abrir el demuxer de audio: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "No se pudo abrir demuxer de subtítulos: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "No se puede avanzar o retroceder en un stream crudo .AVI (se requiere índice, prueba con -idx).\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "No se puede buscar en la entrada de TV.\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "No se puede avanzar o retroceder en este archivo.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Información de clip: \n"
@@ -4159,7 +4154,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Modos disponibles de cambio a pantalla completa:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Modo de video seleccionado %dx%d para tamaño de imagen %dx%d.\n"
@@ -4622,12 +4617,12 @@ msgstr "El servidor retornó %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Se seteo el tamaño del caché a %d KBytes.\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "No se pudo abrir %s\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4826,88 +4821,88 @@ msgstr "Error seleccionando la pista de VCD!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open, archivo=%s, pista=%d, pistas disponibles: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "DVD, canal de audio seleccionado: %d idioma: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "DVD, no se encontró un idioma coincidente!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "DVD, canal de subtitulos seleccionado: %d idioma: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "DVD, no se encontró un idioma de subtitulo coincidente!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "No se puede abrir el dispositivo de DVD: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "No se pudo abrir la información VMG!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Hay %d títulos en este DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Número de título de DVD inválido: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Hay %d ángulos en este título de DVD.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Número de ángulo de DVD inválido: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "No se pudo abrir archivo IFO para el título de DVD %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "No se pudo abrir VOBS del título (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "stream de audio: %d formato: %s (%s) idioma: %s aid: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "Número de canales de audio en el disco: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "subtítulo ( sid ): %d idioma: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "Número de subtítulos en el disco: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer fue compilado sin soporte para DVD, saliendo.\n"
@@ -5139,12 +5134,12 @@ msgstr "[radio] Utilizando frecuencia: %.2f.\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] Llamada fallida a stream_enable_cache: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "No se puede inicializar la librería libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "No se puede abrir desde la RED: '%s'\n"
@@ -5631,7 +5626,7 @@ msgstr "tvi_dshow: El dispositivo no soporta el Samplerate %d. Probando con el p
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "Al parecer el string ya ha sido escapado en url_scape %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/fr.po b/mplayer/po/fr.po
index 69bd1db..c5567e5 100644
--- a/mplayer/po/fr.po
+++ b/mplayer/po/fr.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Ce fichier codecs.conf est trop vieux et est incompatible avec cette ver
 msgid "Chapter: (%d) %s"
 msgstr "Chapitre : (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "inconnu"
 
@@ -189,211 +189,211 @@ msgstr "Angle: %d/%d"
 msgid "enabled (EDL)"
 msgstr "activé (edl)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "désactivé"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "activé"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "dur"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "fichier"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "inclus"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "haut"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "centre"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "bas"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Boucle: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Volume"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Silence : %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "Delai A-V : %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Audio : %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Balance"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Recadrage"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Reste au dessus : %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Fenêtre racine : %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Bordure : %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Saut d'images : %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gamma"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Brillance"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Contraste"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Saturation"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Tonalité"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "Sync verticale : %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Sous-titres : %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Source des sous-titres : %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Position des sous-titres : %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Alignement des sous-titres : %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Décalage des sous-titres : %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Échelle des sous-titres : %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "EDL saute le début, presse 'i' encore une fois pour fin du bloc.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "Saut EDL annulé, dernier début > arrêt\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "EDL saute la fin, ligne écrite.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Décalage : %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD : %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Impossible de charger la liste de lecture %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Canal : %s"
@@ -554,7 +554,7 @@ msgstr "[Mixer] Aucun contrôle de volume disponible.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Mixer] Aucun contrôle de balance disponible.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -626,7 +626,7 @@ msgstr ""
 " * * * VOIR PAGE MAN POUR DÉTAILS, AUTRES OPTIONS (AVANCÉES) ET TOUCHES * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -636,7 +636,7 @@ msgstr ""
 "  Il y a peut-être un bogue dans notre nouveau code de détection CPU...\n"
 "  Veuillez lire DOCS/HTML/fr/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -648,7 +648,7 @@ msgstr ""
 "  de celui pour lequel il a été compilé/optimisé.\n"
 " Vérifiez !\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -658,7 +658,7 @@ msgstr ""
 "  Recompilez MPlayer avec --enable-debug et faites un backtrace 'gdb' et\n"
 "  désassemblage. Détails : DOCS/HTML/fr/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -672,7 +672,7 @@ msgstr ""
 "  et suivre les instructions. Nous pourrons et voudrons vous aider si vous\n"
 "  fournissiez ces informations en rapportant un bogue possible.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -726,7 +726,7 @@ msgstr ""
 "Si rien de tout cela ne vous aide, lisez DOCS/HTML/fr/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -735,7 +735,7 @@ msgstr ""
 "\n"
 "Sortie... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -744,97 +744,97 @@ msgstr ""
 "\n"
 "MPlayer interrompu par le signal %d dans le module : %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Impossible de trouver le répertoire HOME.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "Problème get_path(\"config\")\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Création du fichier config : %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Chargement du profil de protocol '%s'\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Chargement du profil d'extension '%s'\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Chargement du fichier de configuration '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Ne peut charger les sous-titres : %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB : fichier sous-titres ajouté (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Erreur de pré-initialisation de la chaîne de filtres audio !\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Ne peut ouvrir/initialiser le périphérique audio -> pas de son.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "N'a pas pu trouver une correspondance filtre/ao !\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Erreur de lecture horloge temps réel (RTC) Linux : %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Attention ! Soupassement sommeil léger (time_frame négatif)!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Erreur à l'ouverture/initialisation de la sortie vidéo choisie (-vo).\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Impossible d'ouvrir filtre vidéo libmenu avec menu root %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUSE  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Impossible d'utiliser EDL sans video, désactive.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -843,82 +843,82 @@ msgstr ""
 "\n"
 "FATAL : impossible d'initialiser filtres vidéo (-vf) ou sortie vidéo (-vo).\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Compilé avec détection du CPU à l'exécution.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Compilé pour CPU x86 avec les extensions:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Utilisation du codecs.conf intégré par défaut\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Codecs audio disponibles :\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Codecs vidéo disponibles :\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Ligne de commande :"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Ne peut charger la police : %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Échec à l'ouverture de %s : %s (devrait être lisible par l'utilisateur.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Erreur init RTC Linux dans ioctl (rtc_irqp_set %lu) : %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Essayer ajout \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" au script de démarrage de votre système.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Erreur init RTC Linux dans ioctl (rtc_pie_on) : %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Utilisation de la synchronisation matérielle par RTC (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menu initialisé : %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Échec d'initialisation du menu.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "ATTENTION : getch2_init appelé deux fois !\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -927,77 +927,77 @@ msgstr ""
 "\n"
 "Lecture de %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Impossible d'ouvrir fichier EDL [%s] en écriture.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Impossible d'ouvrir le fichier pour le vidage de la mémoire (dump).\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s : Erreur durant l'écriture du fichier.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "Vidage de la mémoire (dump) : FATAL : flux sélectionné manquant !\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Vidéo : impossible de lire les propriétés\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] filefmt:%d  fourcc:0x%X  taille:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS non spécifié dans l'entête ou invalide ! Utilisez l'option -fps.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Aucun flux trouvé\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio : pas de son\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Vidéo : pas de vidéo\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS forcé à %5.3f  (ftime : %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Démarre la lecture...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1249,28 +1249,28 @@ msgstr "Labels disponibles dans"
 msgid "Couldn't find label in plugin library."
 msgstr "Label introuvable dans lib du plugin."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Aucune sous-option spécifiée"
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Aucun fichier lib spécifié"
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Aucun label de filtre spécifié"
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Pas assez de contrôles spécifiés sur ligne de commande"
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s : Contrôle d'entrée #%d sous limite inférieure de %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s : Contrôle d'entrée #%d sous limite supérieure de %0.4f.\n"
@@ -1280,12 +1280,12 @@ msgstr "%s : Contrôle d'entrée #%d sous limite supérieure de %0.4f.\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Échec de l'ouverture du codec %s, br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, encodeur pour le codec %s introuvable !\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, échec lors de l'allocation du contexte !\n"
@@ -1894,27 +1894,27 @@ msgstr "[AO SUN] Impossible d'ouvrir périphérique audio %s, %s  -> aucun son.\
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup : votre carte ne supporte pas canal %d, %s, %d Hz échantillonnage.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Pilotes de sortie audio disponibles :\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2128,13 +2128,13 @@ msgstr "Échantillons ce format demandés pour améliorer support. Contacter dev
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Impossible de trouver le codec '%s' dans libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Impossible d'ouvrir le codec.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Impossible de fermer le codec.\n"
@@ -2357,7 +2357,7 @@ msgstr "INFO : initialisation réussie du codec vidéo Win32/DShow.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] Moyenne arithmétique de QP : %2.4f, moyenne harmonique de QP : %2.4f\n"
@@ -2718,7 +2718,7 @@ msgstr "Impossible d'ouvrir le demuxer Ogg\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "Erreur fill_buffer : Mauvais demuxer : pas de vd, ad ou sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2726,7 +2726,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2734,29 +2734,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] Echec initialisation de zlib.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] Echec décompression de zlib.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] Echec décompression de lzo.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2765,19 +2765,19 @@ msgstr ""
 "[mkv] Le n° de piste %u a été encrypté et le décryptage n'a pas encore été\n"
 "[mkv] mis en place. Saut de piste.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] Unknown content encoding type for track %u. Saut de piste.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2786,22 +2786,22 @@ msgstr ""
 "[mkv] Piste %u a été compressée avec zlib mais MPlayer n'a pas été compilé\n"
 "[mkv] avec le support de compression pour zlib. Saut de piste.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] Ident. piste %u : %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] Ident. piste %u : %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2810,12 +2810,12 @@ msgstr ""
 "[mkv] Ident. codec inconnue/non supportée (%s) ou données manquantes/mauvais codec privé\n"
 "[mkv] (piste %u).\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] Piste FLAC ne contient pas d'entêtes valides.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2824,26 +2824,21 @@ msgstr ""
 "[mkv] Ident. codec audio '%s' inconnu/non supporté  pour piste %u ou \n"
 "[mkv]données sur codec privé manquantes/erronées.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] Type de sous-titre '%s' non supporté.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] Jouera piste vidéo %u.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Pas de piste vidéo trouvée/voulue.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Pas de piste audio trouvée/voulue.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2889,27 +2884,27 @@ msgstr "Fermeture du plugin : %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "Attente de fermeture du greffon XMMS pour démarrer la lecture de '%s'...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "ATTENTION : Entête du flux audio %d redéfini.\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Flux audio trouvé : %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "ATTENTION : Entête du flux vidéo %d redéfini.\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Flux vidéo trouvé : %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2917,7 +2912,7 @@ msgstr ""
 "Peut-être que vous jouez un flux/fichier non entrelacé, ou que le codec a échoué ?\n"
 "Pour les fichier AVI, essayez de forcer le mode non-entrelacé avec l'option -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2926,7 +2921,7 @@ msgstr ""
 "\n"
 "Trop de paquets audio dans le tampon (%d dans %d octets)\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2935,62 +2930,62 @@ msgstr ""
 "\n"
 "Trop de paquets vidéo dans le tampon (%d dans %d octets)\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Impossible d'ouvrir le flux audio : %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Impossible d'ouvrir le flux des sous-titres : %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Echec à l'ouverture du demuxer audio : %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Echec à l'ouverture du demuxer de sous-titres : %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Impossible de chercher dans un flux AVI brut ! (Index requis, essayez l'option -idx.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "Impossible de rechercher sur l'entrée TV ! (cette opération correspondra sûrement à un changement de chaines ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Impossible de chercher dans ce fichier.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Information sur le clip : \n"
@@ -4160,7 +4155,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Modes de changement de couches plein écran disponibles :\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM : le mode vidéo %dx%d a été choisi pour une taille d'image %dx%d.\n"
@@ -4623,12 +4618,12 @@ msgstr "Serveur retourne %d : %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Grandeur cache réglée à %d KBytes\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Échec à l'ouverture de '%s'\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4827,88 +4822,88 @@ msgstr "Erreur lors du choix de la piste VCD."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "Signal flux ouvert, nom fichier=%s, piste=%d, pistes disponibles : %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Canal audio du DVD choisi: %d langue : %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "Aucun canal audio correspondant sur ce DVD !\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Canal de sous-titres du DVD choisi : %d langue : %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "Aucun sous-titre correspondant sur ce DVD !\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Impossible d'ouvrir le lecteur DVD : %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "Ne peut ouvrir les informations VMG !\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Il y a %d titres sur ce DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Numéro de titre DVD invalide : %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Il y a %d angles sur ce titre DVD.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Numéro d'angle DVD invalide : %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Impossible d'ouvrir le fichier IFO pour le titre DVD %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Impossible d'ouvrir le titre VOBS (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "Flux audio : %d format : %s (%s) langue : %s aide : %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "Nombre du canaux audio sur le disque : %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "Sous-titre ( sid ) : %d langue : %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "Nombre de sous-titres sur le disque : %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer a été compilé sans support pour les DVD - terminaison\n"
@@ -5140,12 +5135,12 @@ msgstr "[radio] Utilise fréquence : %.2f.\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] Echec appel stream_enable_cache : %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Impossible d'initialiser libsmbclient : %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Impossible d'ouvrir depuis le réseau local : '%s'\n"
@@ -5631,7 +5626,7 @@ msgstr "tvi_dshow: Le taux d'échantillonage %d n'est pas supporté par le péri
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "La chaîne semble déjà échappée dans url_escape %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/hu.po b/mplayer/po/hu.po
index 9b481ae..7044965 100644
--- a/mplayer/po/hu.po
+++ b/mplayer/po/hu.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Ez a codecs.conf túl régi és nem kompatibilis az MPlayer ezen kiadás
 msgid "Chapter: (%d) %s"
 msgstr "Fejezet: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "ismeretlen"
 
@@ -189,211 +189,211 @@ msgstr "Szög: %d/%d"
 msgid "enabled (EDL)"
 msgstr "bekapcsolva (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "kikapcsolva"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "bekapcsolva"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "erős"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "fájl"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "beágyazott"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "fent"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "középen"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "alul"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Ismétlés: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr "Mentés: %s"
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Hangerő"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Némít: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V késés: %s ms"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Audió: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Egyensúly"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Panscan"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Mindig felül: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "FÅ‘ablak: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Keret: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Képkocka dobás: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr "Deinterlace: %s"
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gamma"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Fényerő"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Kontraszt"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Telítettség"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Színárnyalat"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "VSync: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Feliratok: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Felirat forrás: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Felirat helye: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Felirat illesztés: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Felirat késés: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Csak kényszerített felirat: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Felirat arány: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "EDL skip eleje, nyomd meg az 'i'-t a blokk befejezéséhez.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "EDL skip visszavonva, az utolsó start > stop\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "EDL skip vége, a sor kiírva.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Felirat késés: %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Lejátszási lista (%s) betöltése sikertelen.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Csatorna: %s"
@@ -554,7 +554,7 @@ msgstr "[Mixer] Hangerő állítás nem lehetséges.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Mixer] Nincs elérhető egyensúly vezérlő.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -626,7 +626,7 @@ msgstr ""
 " * * * A MANPAGE TOVÁBBI RÉSZLETEKET, OPCIÓKAT, BILLENTYŰKET TARTALMAZ! * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -636,7 +636,7 @@ msgstr ""
 "  Lehet hogy a futásidejű CPU detektáló kód hibája...\n"
 "  Olvasd el a DOCS/HTML/hu/bugreports.html fájlt!\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -648,7 +648,7 @@ msgstr ""
 "  fordítás/optimalizálás történt.\n"
 "  Ellenőrizd!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -658,7 +658,7 @@ msgstr ""
 "  Fordítsd újra az MPlayer-t az --enable-debug opcióval, és készíts egy\n"
 "  'gdb' backtrace-t. BÅ‘vebben: DOCS/HTML/hu/bugreports.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -673,7 +673,7 @@ msgstr ""
 "  és nem fogunk segíteni, amíg nem szolgálsz megfelelő információkkal a\n"
 "  hiba bejelentésekor.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -726,7 +726,7 @@ msgstr ""
 "Ha ez sem segít, olvasd el a DOCS/HTML/hu/bugreports.html fájlt.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -735,7 +735,7 @@ msgstr ""
 "\n"
 "Kilépés... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -744,97 +744,97 @@ msgstr ""
 "\n"
 "Az MPlayer futása %d-es szignál miatt megszakadt a(z) %s modulban\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Nem találom a HOME könyvtárat.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") probléma\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Konfigurációs fájl létrehozása: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "'%s' protokol-függő profil betöltése\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "'%s' kiterjesztés-függő profil betöltése\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "'%s' konfiguráció betöltése\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Nem tudom betölteni a feliratot: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: Felirat fájl (%d) hozzáadva: %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Hiba az audio szűrő lánc elő-inicializálásában!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Nem tudom megnyitni az audio-egységet -> nincs hang.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Nem találtam megfelelő szűrőt/ao formátumot!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux RTC olvasási hiba: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Figyelem! Softsleep alulcsordulás!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Hiba a kiválasztott video_out (-vo) egység inicializásakor!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "A libmenu video szűrőt nem sikerült a(z) %s főmenüvel megnyitni.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  SZÃœNET  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Az EDL nem használható video nélkül, letiltva.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -843,82 +843,82 @@ msgstr ""
 "\n"
 "HIBA: Nem sikerült a video filterek (-vf) vagy a video kimenet (-vo) inicializálása!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Futásidejű CPU detektálás használata.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "x86-os CPU - a következő kiterjesztésekkel:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Befordított codecs.conf használata.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Rendelkezésre álló audio codec-ek:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Rendelkezésre álló video codec-ek:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Parancs sor:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Nem tudom betölteni a következő bittérképes betűt: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "%s megnyitása nem sikerült: %s (a felhasználó által olvashatónak kell lennie.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Linux RTC inicializálási hiba az ioctl-ben (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Próbáld ki ezt: \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" hozzáadni a rendszer indító script-jeidhez!\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Linux RTC inicializálási hiba az ioctl-ben (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Linux hardveres RTC időzítés használata (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menü inicializálva: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Menü inicializálás nem sikerült.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "FIGYELEM: getch2_init kétszer lett meghívva!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -927,77 +927,77 @@ msgstr ""
 "\n"
 "%s lejátszása.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Az EDL fájlba [%s] nem lehet írni.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Nem tudom megnyitni a dump fájlt!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: hiba a fájl írásánál.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: VÉGZETES HIBA: a kért stream nem található!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: tulajdonságok beolvasása nem lehetséges.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] filefmt:%d  fourcc:0x%X  méret:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Az FPS (képkocka/mp) érték nincs megadva, vagy hibás! Használd az -fps opciót!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Nem található folyam.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: nincs hang!!!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: nincs video!!!\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS kényszerítve %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Lejátszás indítása...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1249,28 +1249,28 @@ msgstr "használható cimkék"
 msgid "Couldn't find label in plugin library."
 msgstr "A címke nem található a plugin könyvtárban."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Nincs alopció megadva."
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Nincs könyvtárfájl megadva."
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Nincs szűrő címke megadva."
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Nincs elég vezérlő megadva a parancssorban."
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: A(z) #%d bemeneti vezérlő a(z) %0.4f alsó határ alatt van.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: A(z) #%d bemeneti vezérlő a(z) %0.4f felső határ felett van.\n"
@@ -1280,12 +1280,12 @@ msgstr "%s: A(z) #%d bemeneti vezérlő a(z) %0.4f felső határ felett van.\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "A(z) %s codec nem nyitható meg, br=%d.\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audió LAVC, nem található kódoló a(z) %s codec-hez.\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, nem található a kontextus!\n"
@@ -1894,27 +1894,27 @@ msgstr "[AO SUN] %s audio eszköz nem elérhető, %s  -> nincs hang.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: a kártyád nem támogat %d csatornát, %s, %d Hz samplerate-t.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Rendelkezésre álló audio meghajtók:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr "Preferált '%.*s' audió vezérlő próbálása, opciók: '%s'\n"
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr "A(z) '%s' audió vezérlő inicializálása nem sikerült\n"
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr "Nincs ilyen audió vezérlő: '%.*s'\n"
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr "Az összes ismert audió vezérlő kipróbálása...\n"
@@ -2128,13 +2128,13 @@ msgstr "Példa fájlokra van szükségünk ilyen formátummal, hogy jobb legyen
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Nem találom a(z) '%s' nevű kodeket a libavcodec-ben...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Nem tudom megnyitni a codec-et.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Nem tudom lezárni a codec-et.\n"
@@ -2358,7 +2358,7 @@ msgstr "INFO: Win32/DShow video codec inicializálása OK.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] QP aritmetikus közepe: %2.4f, QP harmonikus közepe: %2.4f\n"
@@ -2719,7 +2719,7 @@ msgstr "Ogg demuxer meghívása nem sikerült.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "fill_buffer hiba: hibás demuxer: nem vd, ad vagy sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2727,7 +2727,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2735,29 +2735,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] zlib inicializálás sikertelen.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] zlib kicsomagolás sikertelen.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] lzo kicsomagolás sikertelen.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2766,19 +2766,19 @@ msgstr ""
 "[mkv] A(z) %u. sorszámú sáv titkosított, a visszakódolás pedig még\n"
 "[mkv] nem támogatott. Sáv kihagyása.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] Ismeretlen tartalom kódolási típus a(z) %u. sávban. Sáv kihagyása.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2787,22 +2787,22 @@ msgstr ""
 "[mkv] A(z) %u. sáv zlib-bel lett tömörítve, de az MPlayer\n"
 "[mkv] zlib tömörítés támogatása nélkül lett lefordítva. Sáv kihagyása.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] Track ID %u: %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2811,12 +2811,12 @@ msgstr ""
 "[mkv] Ismeretlen/nem támogatott CodecID (%s) vagy hiányzó/hibás CodecPrivate\n"
 "[mkv] adat (%u. sáv).\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] A FLAC sáv nem tartalmaz érvényes fejlécet.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2825,26 +2825,21 @@ msgstr ""
 "[mkv] Ismeretlen/nem támogatott audió codec ID '%s' a(z) %u. sávban vagy hiányzó/hibás\n"
 "[mkv] privát codec adat.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] A(z) '%s' felirat típus nem támogatott.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] %u. videó sáv lejátszása.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Nem található/nincs kiválasztott videó sáv.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Nem található/nincs kiválasztott audió sáv.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2890,27 +2885,27 @@ msgstr "Plugin lezárása: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "Várakozás a(z) '%s' XMMS plugin általi lejátszására...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Vigyázat! Többszörösen definiált Audio-folyam: %d (Hibás fájl?)\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Megtalált audio folyam: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Vigyázat! Többszörösen definiált Video-folyam: %d (Hibás fájl?)\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Megtalált video folyam: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2918,7 +2913,7 @@ msgstr ""
 "Talán ez egy nem összefésült (interleaved) fájl vagy a codec nem működik jól?\n"
 "AVI fájloknál próbáld meg a non-interleaved mód kényszerítését a -ni opcióval.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2927,7 +2922,7 @@ msgstr ""
 "\n"
 "DEMUXER: Túl sok (%d db, %d bájt) audio-csomag a pufferben!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2936,62 +2931,62 @@ msgstr ""
 "\n"
 "DEMUXER: Túl sok (%d db, %d bájt) video-csomag a pufferben!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Audio folyam megnyitása sikertelen: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Felirat folyam megnyitása sikertelen: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Audio demuxer meghívása sikertelen: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Felirat demuxer meghívása sikertelen: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Nem tudok nyers .AVI-kban tekerni! (index kell, próbáld az -idx kapcsolóval!)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV bemenet nem tekerhető! (Meg kéne csinálni hogy most váltson csatornát ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Nem tudok ebben a fájlban tekerni!\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Klipp info: \n"
@@ -4161,7 +4156,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "A használható teljesképernyős réteg-módok:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: %dx%d kiválasztott videó mód a(z) %dx%d képmérethez.\n"
@@ -4624,12 +4619,12 @@ msgstr "Szerver válasz %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Cache méret beállítva %d KByte-ra\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Nem lehet megnyitni: %s.\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4828,88 +4823,88 @@ msgstr "Hiba a VCD-sáv kiválasztásakor!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open, fájlnév=%s, sáv=%d, elérhető sávok: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Kiválasztott DVD audió csatorna: %d nyelv: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "Nem található megfelelő nyelvű DVD audió!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Kiválasztott DVD felirat csatorna: %d nyelv: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "Nincs megfelelő nyelvű DVD felirat fájl!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Nem tudom megnyitni a DVD eszközt: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "A VMG infót nem lehet megnyitni!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "%d sáv van a DVD-n.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Helytelen DVD sáv: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "%d darab kameraállás van ezen a DVD sávon.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Helytelen DVD kameraállás: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Nem tudom a(z) %d. DVD sávhoz megnyitni az IFO fájlt.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Nem tudom megnyitni a VOBS sávokat (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "audió folyam: %d formátum: %s (%s) nyelv: %s aid: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "audió csatornák száma a lemezen: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "felirat ( sid ): %d nyelv: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "feliratok szám a lemezen: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "Az MPlayer DVD támogatás nélkül lett lefordítva, kilépés.\n"
@@ -5141,12 +5136,12 @@ msgstr "[radio] Használt frekvencia: %.2f.\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] stream_enable_cache hívás sikertelen: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Samba kliens könyvtár nem inicializálható: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Nem nyitható meg a hálózatról: '%s'\n"
@@ -5632,7 +5627,7 @@ msgstr "tvi_dshow: A(z) %d mintavételi rátát nem támogatja az eszköz. Vissz
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "A karakterlánc már escape-ltnek tűnik az url_escape-ben %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/it.po b/mplayer/po/it.po
index 7e0bbf9..7619914 100644
--- a/mplayer/po/it.po
+++ b/mplayer/po/it.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Il codecs.conf è troppo vecchio/incompatibile con questa versione di MP
 msgid "Chapter: (%d) %s"
 msgstr "Capitolo: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "sconosciuto"
 
@@ -189,211 +189,211 @@ msgstr "Angolazione: %d/%d"
 msgid "enabled (EDL)"
 msgstr "abilitato (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "disabilitat"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "abilitat"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "hard - intens"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "incorporati"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "in alto"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "al centro"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "in basso"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Ripetizione: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr "Registrazione: %s"
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Volume"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Muto: %so"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "Ritardo A-V: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Audio: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Bilanciamento"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Panscan"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Resta in primo piano: %so"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Rootwin: %so"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Bordo: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Scarto fotogrammi: %so"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr "Deinterlacciamento: %s"
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gamma"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Luminosità"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Contrasto"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Saturazione"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Tonalità"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "VSync: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Sottotitoli: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Origine sottotitoli: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Posizione sottotitoli: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Allineamento sottotitoli: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Ritardo sottotitoli: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Solo sottotitoli forzati: %si"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Dimensione sottotitoli: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "Tempo di start EDL impostato, ripremere 'i' per impostare lo stop.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "Salto EDL ingnorato, ultimo start > stop\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "Fine del blocco EDL, riga scritta.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Ritardo sottotitoli: %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %so"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Impossibile caricare la playlist %s\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Canale: %s"
@@ -556,7 +556,7 @@ msgstr "[Mixer] Regolazione del volume non disponibile.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Mixer] Controllo del bilanciamento non disponibile.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -628,7 +628,7 @@ msgstr ""
 " * * * VEDI PAGINA MAN PER DETTAGLI, ULTERIORI OPZIONI AVANZATE E TASTI! * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  Potrebbe essere un errore nel codice di rilevamento tipo di processore...\n"
 "  leggi DOCS/HTML/it/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -650,7 +650,7 @@ msgstr ""
 "  diverso da quello per cui è stato compilato/ottimizzato.\n"
 "  Verificalo!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -660,7 +660,7 @@ msgstr ""
 "  Ricompila MPlayer con --enable-debug e crea un backtrace ed un disassemblato\n"
 "  con 'gdb'. Per dettagli DOCS/HTML/it/bugreports_what.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -675,7 +675,7 @@ msgstr ""
 "  aiutarti, e non lo faremo, se non ci dai queste informazioni quando segnali\n"
 "  un possibile problema.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -726,7 +726,7 @@ msgstr ""
 "Se nulla di ciò ti aiuta, allora leggi DOCS/HTML/it/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -735,7 +735,7 @@ msgstr ""
 "\n"
 "In uscita... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -744,97 +744,97 @@ msgstr ""
 "\n"
 "MPlayer interrotto dal segnale %d nel modulo: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Impossibile trovare la HOME directory\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "Problema in get_path(\"config\")\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Creo il file di configurazione: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Carico il profilo '%s' riguardante il protocollo\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Carico il profilo '%s' riguardante l'estensione\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Carico configurazione '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Impossibile caricare i sottotitoli: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: Aggiunto file sottotitoli (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Errore nel pre-init della sequenza di filtri audio!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Impossibile aprire/inizializzare il dispositivo audio -> NESSUN SUONO\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Non trovo il filtro/il formato ao corrispondente!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux RTC: errore di lettura: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Attenzione! Softsleep underflow!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Errore aprendo/inizializzando il dispositivo uscita video (-vo) selezionato!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Non riesco ad aprire il filtro video libmenu col menu base %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUSA  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Non posso usare EDL senza video, disabilitate.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -843,84 +843,84 @@ msgstr ""
 "\n"
 "FATALE: Impossibile inizializzare i filtri video (-vf) o l'output video (-vo)!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Compilato con riconoscimento CPU in esecuzione.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Compilato per CPU x86 con estensioni:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Utilizzo la versione interna predefinita di codecs.conf\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Codec audio disponibili:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Codec video disponibili:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "CommandLine:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Impossibile caricare i font: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Apertura di %s fallita: %s (dovrebbe esser leggibile dall'utente.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Linux RTC: errore di init in ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 "Prova aggiungendo \"echo %lu > /proc/sys/dev/rtc/max-user-freq\"\n"
 "agli script di avvio del sistema.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Linux RTC: errore di init in ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Sto utilizzando la temporizzazione hardware RTC di Linux (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menu inizializzato: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Inizializzazione Menu fallita.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "WARNING: getch2_init chiamata 2 volte!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -929,77 +929,77 @@ msgstr ""
 "\n"
 "Riproduco %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Non posso aprire il file EDL [%s] per la scrittura.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Impossibile aprire il file di dump!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: errore nella scrittura del file.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATALE: manca il flusso selezionato!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: impossibile leggere le proprietà\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS non specificato (o non valido) nell'intestazione! Usa l'opzione -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Nessun flusso trovato.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: nessun suono!!!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: nessun video!!!\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS forzato a %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Inizio la riproduzione...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1251,28 +1251,28 @@ msgstr "etichette disponibili in"
 msgid "Couldn't find label in plugin library."
 msgstr "Non trovo l'etichetta nella libreria plugin."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Nessuna sottoopzione specificata."
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Nessuna libreria specificata."
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Nessuna etichetta di filtro specificata."
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Non sono stati specificati abbastanza controlli sulla riga comando."
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: Il controllo di input #%d è sotto il limite inferiore di %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: Il controllo di input #%d è sopra al limite superiore di %0.4f.\n"
@@ -1282,12 +1282,12 @@ msgstr "%s: Il controllo di input #%d è sopra al limite superiore di %0.4f.\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Non posso aprire il codec %s, br=%d.\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, Non trovo l'encoder per il codec %s.\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, non posso allocare il contesto!\n"
@@ -1896,27 +1896,27 @@ msgstr "[AO SUN] Non posso aprire il dispositivo audio %s, %s  -> no audio.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: la tua scheda non supporta il canale %d, %s, %d Hz samplerate.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Driver di output audio disponibili:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr "Provo con il driver audio preferito '%.*s', opzioni '%s'\n"
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr "Inizializzazione del driver audio '%s' non riuscita\n"
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr "driver audio '%.*s' non trovato\n"
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr "Provo con tutti i driver audio conosciuti...\n"
@@ -2130,13 +2130,13 @@ msgstr "Servono esempi di questo formato per migliorarne il supporto. Contatta s
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Impossibile trovare il codec '%s' in libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "impossibile aprire il codec\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "impossibile chiudere il codec\n"
@@ -2364,7 +2364,7 @@ msgstr "INFO: Win32/DShow inizializzato correttamente.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] Significato aritmetico di QP: %2.4f, significato armonico di QP: %2.4f\n"
@@ -2725,7 +2725,7 @@ msgstr "Impossibile aprire il demuxer Ogg.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "Errore in fill_buffer: cattivo demuxer: non vd, ad o sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2733,7 +2733,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2741,29 +2741,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] inizializzazione zlib fallita.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] decompressione zlib fallita.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] decompressione lzo fallita.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2772,19 +2772,19 @@ msgstr ""
 "[mkv] La traccia numero %u è criptata e la decodifica non è stata ancora\n"
 "[mkv] implementata. Ignoro la traccia.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] Tipo di codifica sconosciuto per la traccia %u. Ignoro la traccia.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2793,22 +2793,22 @@ msgstr ""
 "[mkv] La traccia %u è stata compressa con zlib ma mplayer non è stato compilato\n"
 "[mkv] con il supporto per tale compressione. Ignoro la traccia.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2817,12 +2817,12 @@ msgstr ""
 "[mkv] Codec ID '%s' sconosciuto/non supportato per la traccia %u o dati\n"
 "[mkv] interni del codec mancanti/errati.\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] La traccia FLAC non contiene intestazioni valide.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2831,26 +2831,21 @@ msgstr ""
 "[mkv] Codec audio ID '%s' sconosciuto/non supportato per la traccia %u o dati\n"
 "[mkv] interni del codec mancanti/errati.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] Il tipo di sottotitoli '%s' non è gestito.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] Riprodurrò la traccia video %u.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Nessuna traccia video trovata/voluta.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Nessuna traccia audio trovata/voluta.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2896,27 +2891,27 @@ msgstr "Chiudo plugin: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "Attendo che il plugin XMMS inizi la riproduzione di '%s'...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Avvertimento! Intestazione del flusso audio %d ridefinito!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Trovato flusso audio: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Avvertimento! Intestazione del flusso video %d ridefinito!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Trovato flusso video: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2924,7 +2919,7 @@ msgstr ""
 "Forse stai riproducendo un flusso/file non-interleaved o il codec non funziona?\n"
 "Per i file .AVI, prova a forzare la modalità 'non-interleaved' con l'opz. -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2933,7 +2928,7 @@ msgstr ""
 "\n"
 "DEMUXER: Troppi (%d in %d byte) pacchetti audio nel buffer!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2942,64 +2937,64 @@ msgstr ""
 "\n"
 "DEMUXER: Troppi (%d in %d byte) pacchetti video nel buffer!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Impossibile aprire il flusso audio: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Impossibile aprire il flusso dei sottotitoli: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Errore nell'apertura del demuxer audio: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Errore nell'apertura del demuxer dei sottotitoli: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Impossibile spostarsi nei flussi .AVI grezzi. (richiesto un indice, prova con l'opzione -idx.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr ""
 "Impossibile spostarsi in un programma TV!\n"
 "(Probabilmente lo spostamento verrà usato per cambiare canale ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Impossibile spostarsi in questo file!  \n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Informazioni file multimediale:\n"
@@ -4170,7 +4165,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Modi disponibili a schermo intero:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Scelta modalità video %dx%d per la dimensione immagine %dx%d.\n"
@@ -4633,12 +4628,12 @@ msgstr "Risposta del server %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Dimensione cache impostata a %d KByte\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Apertura di '%s' fallita.\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4837,88 +4832,88 @@ msgstr "Errore nella selezione della traccia del VCD!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open, nomefile=%s, traccia=%d, tracce disponibili: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Scelto canale audio DVD: %d lingua: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "Non trovata la lingua dell'audio DVD corrispondente!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Scelto canale sottotitoli DVD: %d lingua: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "Non trovata la lingua dei sottotitoli DVD corrispondente!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Impossibile aprire il dispositivo DVD: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "Impossibile aprire le informazioni VMG!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Ci sono %d titolo/i su questo DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Numero del titolo del DVD non valido: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Ci sono %d angolazione/i in questo titolo del DVD.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Numero delle angolazioni del DVD non valido: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Impossibile aprire il file IFO per il titolo del DVD %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Impossibile aprire il VOB del titolo (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "flusso audio: %d formato: %s (%s) lingua: %s aid: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "numero di canali audio sul disco: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "sottotitoli ( sid ): %d lingua: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "numero di sottotitoli sul disco: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer è stato compilato senza il supporto per DVD, esco\n"
@@ -5152,12 +5147,12 @@ msgstr "[radio] Uso la frequenza: %.2f.\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] Chiamata a stream_enable_cache fallita: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Impossibile inizializzare la libreria libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Impossibile aprire dalla rete: '%s'\n"
@@ -5643,7 +5638,7 @@ msgstr "tvi_dshow: Campionamento %d non supportato dal dispositivo. Provo con il
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "La stringa sembra essere già filtrata in url_escape %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/ja.po b/mplayer/po/ja.po
index 59a8379..760529e 100644
--- a/mplayer/po/ja.po
+++ b/mplayer/po/ja.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,211 +179,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -392,7 +392,7 @@ msgstr ""
 "\n"
 "プレイリストの読み込みが出来ません %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -534,7 +534,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -606,7 +606,7 @@ msgstr ""
 " * * * man pageに詳細がありますので、確認して下さい。さらに高度で進んだオプションやキーも記載してます * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -616,7 +616,7 @@ msgstr ""
 "  恐らくこれは あたらしいCPU-Detection codeにバグがあります\n"
 "  DOCS/HTML/en/bugreports.html をお読み下さい.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -628,7 +628,7 @@ msgstr ""
 "  compiled/optimized for.\n"
 "  Verify this!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -639,7 +639,7 @@ msgstr ""
 "  --enable-debugをつけてMPlyaerをコンパイルしなおし、gdbで調査しましょう\n"
 "  詳細は DOCS/HTML/en/bugreports.html#bugreports_crash にあります\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -653,7 +653,7 @@ msgstr ""
 "  DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and\n"
 "  won't help unless you provide this information when reporting a possible bug.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -704,7 +704,7 @@ msgstr ""
 "もし、これらを試しても何もこう化が得られない場合は、DOCS/HTML/en/bugreports.html を御覧下さい.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -713,7 +713,7 @@ msgstr ""
 "\n"
 "終了しています... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -722,97 +722,97 @@ msgstr ""
 "\n"
 "MPlayer はシグナル %d によって中断しました.次のモジュールからです: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "ホームディレクトリを見付けることが出来ませんでした.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") で問題が起きました\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "config fileを作成しました: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "サブタイトルをロード出来ません: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "音声デバイスの初期化に失敗しました -> 無音声になります.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "選択された映像出力(-vo)デバイスを開く事が出来ませんでした.\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  停止  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -821,84 +821,84 @@ msgstr ""
 "\n"
 "FATAL: 画像フィルター(-vf)か画像出力(-vo)の初期化に失敗しました.\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 "コンパイル時にRuntime CPU Detectionが試用されています、これは最適ではありません\n"
 "最適なパフォーマスを得るには、--disable-runtime-cpudetectionを有効にしてMPLayerを再コンパイルして下さい\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "x86 CPU 向けにコンパイルされました:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "組み込まれたデフォルトの codecs.conf を利用してます\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "有効な音声コーデック:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "有効な映像コーデック:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "フォントをロード出来ません: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Linux hardware RTC timing (%ldHz) を使っています.\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -907,77 +907,77 @@ msgstr ""
 "\n"
 "%s を再生中\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "dump fileを開けません\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: ファイル書き込みエラー.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr ""
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: プロパティーを読み取れません.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS がヘッダに指定されていないか不正です. -fps オプションを利用して下さい.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "ストリームを見付けることが出来ませんでした.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "音声: 無し\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: 映像がありません\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS forced to be %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "再生開始...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1227,28 +1227,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1258,12 +1258,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1852,27 +1852,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "有効な音声出力ドライバ:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2086,13 +2086,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "'%s' を libavcodecから見付けることが出来ません ...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "コーデックを開くことが出来ません.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "コーデックを閉じることが出来ません.\n"
@@ -2311,7 +2311,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2666,7 +2666,7 @@ msgstr "ogg demuxer を開くことが出来ません.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2674,7 +2674,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2682,108 +2682,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2829,33 +2824,33 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "警告: Audio stream header %d redefined.\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> 音声ストリームが見付かりました: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "警告: Video stream header %d redefined.\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> 映像ストリームが見付かりました: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2864,7 +2859,7 @@ msgstr ""
 "\n"
 "バッファに多過ぎる音声パケットが与えられてます: (%d in %d bytes).\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2873,62 +2868,62 @@ msgstr ""
 "\n"
 "バッファに多過ぎる映像パケットが与えられてます: (%d in %d bytes).\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "音声ストリームを開くことが出来ません: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "サブタイトルストリームを開くことが出来ません: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "audio demuxerを開くこと開くことが出来ません: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "subtitle demuxerを開くことが出来ません: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Cannot seek in raw AVI streams. (Indexが必要です, -idx を試して下さい.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV入力はシークすることは出来ません(シークは恐らくチャンネル選択に相当するのでは? ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "このファイルはシークすることが出来ません.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "クリップ情報:\n"
@@ -4044,7 +4039,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "全画面表示モードへの切替えは可能です:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4496,12 +4491,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4700,88 +4695,88 @@ msgstr ""
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "DVDデバイスを開くことが出来ませんでした: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "このDVDには %d タイトル記録されています.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "不正な DVD タイトル番号です: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "このDVDには %d アングルあります.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "不正なDVDアングル番号です: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Cannot open the IFO file for DVD title %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5013,12 +5008,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "libsmbclient の初期化失敗: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "ローカルエリアネットワークから開くことが出来ませんでした: '%s'\n"
@@ -5494,7 +5489,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/ko.po b/mplayer/po/ko.po
index ad2ec6b..fbff5cf 100644
--- a/mplayer/po/ko.po
+++ b/mplayer/po/ko.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,211 +179,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -392,7 +392,7 @@ msgstr ""
 "\n"
 "재생목록 %s을(를) 열 수 없습니다.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -534,7 +534,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -606,7 +606,7 @@ msgstr ""
 " * * * 더 자세한 (고급) 선택사항 및 조정키는 MAN 페이지를 참조하세요. * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -616,7 +616,7 @@ msgstr ""
 "  런타임 CPU 감지 코드에 버그가 있을 지도 모릅니다...\n"
 "  DOCS/HTML/en/bugreports.html을 참조하세요.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -628,7 +628,7 @@ msgstr ""
 "  종종 일어나는 현상입니다.\n"
 "  확인해 보세요!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  MPlayer를 --enable-debug 옵션으로 다시 컴파일하고, 'gdb' 백트레이스 및\n"
 "  디스어셈블해보세요. 자세한 사항은 DOCS/HTML/en/bugreports_what.html#bugreports_crash를 참조하세요.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -652,7 +652,7 @@ msgstr ""
 "  설명대로 하시기 바랍니다. 가능한 버그를 보고할 땐, 이 정보를 포함하세요.\n"
 "  그렇지 않으면, 도와줄 방법이 없습니다.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -702,7 +702,7 @@ msgstr ""
 "위의 어떤 사항도 도움이 되지 않는다면, DOCS/HTML/en/bugreports.html을 참조하세요.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -711,7 +711,7 @@ msgstr ""
 "\n"
 "종료합니다... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -720,97 +720,97 @@ msgstr ""
 "\n"
 "MPlayer가 %d시그널에 의해 인터럽트되었습니다. - 모듈: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "홈디렉토리를 찾을 수 없습니다.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") 문제 발생\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "설정파일을 만듭니다.: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "자막을 읽어 들일 수 없습니다.: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "오디오 장치를 열거나 초기화할 수 없습니다. -> 소리없음\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "선택한 비디오 출력 (-vo) 장치를 열거나 초기화할 수 없습니다.\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  잠시멈춤  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -819,84 +819,84 @@ msgstr ""
 "\n"
 "치명적 오류: 비디오 필터(-vf) 또는 비디오 출력(-vo)을 초기화할 수 없습니다.\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 "런타임 CPU 감지가 가능하도록 컴파일되었습니다. - 경고 - 이것은 최적 조건이 아닙니다!\n"
 "최상의 성능을 얻기위해선, MPlayer를 --disable-runtime-cpudetection 옵션으로 다시 컴파일하세요.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "확장 x86 CPU용으로 컴파일 되었습니다.:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "내장된 기본 codecs.conf를 사용합니다.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "가능한 오디오 코덱:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "가능한 비디오 코덱:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "폰트를 읽어 들일 수 없습니다.: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "리눅스 하드웨어 RTC 타이밍(%ldHz)을 사용합니다.\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -905,77 +905,77 @@ msgstr ""
 "\n"
 "%s 재생 중...\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "dump파일을 열 수 없습니다.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: 파일 쓰기 오류가 발생했습니다.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: 치명적 : 선택된 스트림이 없습니다!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "비디오: 속성을 읽을 수 없습니다.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "헤더에 FPS가 지정되지 않았거나 유효하지 않습니다. -fps 옵션을 사용하세요.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "스티림을 찾을 수 없습니다.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "오디오: 소리없음\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "비디오: 비디오 없음\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS가 %5.3f (ftime: %5.3f)으로 변경되었습니다.\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "재생을 시작합니다...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1225,28 +1225,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1256,12 +1256,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1850,27 +1850,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "가능한 오디오 출력 드리아버:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2084,13 +2084,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "libavcodec에서 '%s' 코덱을 찾을 수 없습니다...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "코덱을 열 수 없습니다.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "코덱을 닫을 수 없습니다.\n"
@@ -2309,7 +2309,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2666,7 +2666,7 @@ msgstr "ogg 해석기를 열 수 없습니다.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2674,7 +2674,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2682,108 +2682,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2829,27 +2824,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "경고: 오디오 스트림 헤더 %d가 재정의되었습니다.\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> 오디오 스트림을 찾았습니다.: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "경고: 비디오 스트림 헤더 %d가 재정의되었습니다.\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> 비디오 스트림을 찾았습니다.: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2857,7 +2852,7 @@ msgstr ""
 "non-interleaved 스트림/파일을 재생하고있거나 코덱에 문제가 있나요?\n"
 "AVI 파일의 경우, -ni 옵션으로 non-interleaved 모드로 강제 시도해보세요.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2866,7 +2861,7 @@ msgstr ""
 "\n"
 "버퍼에 너무 많은 오디오 패킷이 있습니다.: (%d in %d bytes)\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2875,62 +2870,62 @@ msgstr ""
 "\n"
 "버퍼에 너무 많은 비디오 패킷이 있습니다.: (%d in %d bytes)\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "오디오 스트림을 열 수 없습니다.: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "자막 스트림을 열 수 없습니다.: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "오디오 해석기를 여는데 실패했습니다.: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "자막 해석기를 여는데 실패했습니다.: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "raw AVI 스트림에서는 탐색할 수 없습니다. (인덱스가 필요합니다. -idx 스위치로 시도해보세요.)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV 입력을 찾을 수 없습니다! (채널을 바꾸고 하면 될수도 있습니다. ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "이 파일에서는 탐색할 수 없습니다.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "클립 정보: \n"
@@ -4048,7 +4043,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "가능한 전체화면 레이어 변경 모드:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4500,12 +4495,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4704,88 +4699,88 @@ msgstr "VCD 트랙을 선택하는 도중 에러가 발생했습니다."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "DVD 장치를 열 수 없습니다.: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "이 DVD에는 %d개의 타이틀이 있습니다.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "유효하지 않은 DVD 타이틀 번호입니다.: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "이 DVD 타이틀에는 %d개의 앵글이 있습니다.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "유효하지 않은 DVD 앵글 번호입니다.: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "DVD 타이틀 %d를 위한 IFO파일을 열 수 없습니다.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "타이틀 VOBS (VTS_%02d_1.VOB)를 열 수 없습니다.\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5017,12 +5012,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "libsmbclient 라이브러리를 초기화할 수 없습니다.: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "lan으로 부터 열 수 없습니다.: '%s'\n"
@@ -5498,7 +5493,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/mk.po b/mplayer/po/mk.po
index fd6f5cd..ced4b40 100644
--- a/mplayer/po/mk.po
+++ b/mplayer/po/mk.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,211 +179,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -392,7 +392,7 @@ msgstr ""
 "\n"
 "Не може да ја вчита плејлистата %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -534,7 +534,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -606,7 +606,7 @@ msgstr ""
 " * * * ВИДЕТЕ ЈА MAN СТРАНАТА ЗА ДЕТАЛИ, ПОВЕЌЕ (НАПРЕДНИ) ОПЦИИ И КОПЧИЊА* * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -616,7 +616,7 @@ msgstr ""
 "  Можеби е баг во нашиот нов код за детекција на процесорот при извршувањето..\n"
 "  Ве молиме прочитајте го DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -628,7 +628,7 @@ msgstr ""
 "  компајлиран/оптимизиран.\n"
 "  Потврдете го ова!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  Рекомпалирајте го MPlayer со --enable-debug и направете 'gdb' следењеВОпозадина и\n"
 "  дисасемблирање. Подетално во DOCS/HTML/en/bugreports_what.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -652,7 +652,7 @@ msgstr ""
 "  DOCS/HTML/en/bugreports.html и следете ги инструкциите. Не можеме и нема\n"
 "  да ви помогнеме доколку не ни ја обезбедите оваа информација кога пријавувате можен баг.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -703,7 +703,7 @@ msgstr ""
 "Ако ништо од ова не ви помага, прочитајте го DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -712,7 +712,7 @@ msgstr ""
 "\n"
 "Излегува... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -721,97 +721,97 @@ msgstr ""
 "\n"
 "MPlayer е прекинат од сигналот %d во модулот: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Не може да го пронајде HOME директориумот.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"конфигурирај\") проблем\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Создавање на конфигурациона датотека: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Не може да се вчитаат преводите: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Не може да го отвори/иницијализира аудио уредот -> нема звук.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Грешка при отварањето/иницијализирањето на избраниот излезен видео (-vo) уред.\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  ПАУЗА ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -820,84 +820,84 @@ msgstr ""
 "\n"
 "ФАТАЛНО: Не може да ги иницијализира видео филтерите (-vf) или видео излезот (-vo).\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 "Компајлирано со детекција на процесорот при извршувањето - ВНИМАНИЕ - ова не е оптимално!\n"
 "За да ги добиете најдобрите перформанси, рекомпалирајте го MPlayer со --disable-runtime-cpudetection\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Компајлирано за x86 Процесорите со наставките:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Користи вградени стандардни codecs.conf\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Достапни аудио кодеци:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Достапни видео кодеци:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Не може да се вчита фонтот: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Користење на Линукс хардверско RTC тајмирање (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -906,77 +906,77 @@ msgstr ""
 "\n"
 "Пуштено %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Не може да се отвори датотеката за отпадоци.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Грешка при запишување на датотеката.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "отпадок: ФАТАЛНО: недостига избраниот проток!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Видео: Не може да ги прочита својствата.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS(Frames Per Second) не се специфицирани во хедерот или се невалидни, користете ја -fps опцијата.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Не е пронајден проток.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Аудио: нема звук\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Видео: нема слика\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS присилени да бидат %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Почнува плејбекот...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1226,28 +1226,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1257,12 +1257,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1851,27 +1851,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Достапни излезни аудио драјвери:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2085,13 +2085,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Не може да го пронајде кодекот '%s' во libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Не може да се отвори кодекот.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Не може да се затвори кодекот.\n"
@@ -2314,7 +2314,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2671,7 +2671,7 @@ msgstr "Не може да се отвори ogg демуксерот.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2679,7 +2679,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2687,108 +2687,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2834,27 +2829,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "ПРЕДУПРЕДУВАЊЕ: Предефиниран е хедерот на аудио протокот %d.\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Пронајден е аудио проток: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "ПРЕДУПРЕДУВАЊЕ: Предефиниран е хедерот на видео протокот %d.\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Пронајден е видео проток: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2862,7 +2857,7 @@ msgstr ""
 "Можеби вие пуштате непреклопувачки стрим/датотека или кодекот не работи?\n"
 "За AVI датотеки, обиди се да го присилиш непреклопувачкиот мод со опцијата -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2871,7 +2866,7 @@ msgstr ""
 "\n"
 "Премногу аудио пакети во баферот: (%d во %d бајти).\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2880,62 +2875,62 @@ msgstr ""
 "\n"
 "Премногу видео пакети во баферот: (%d во %d бајти).\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Не може да се отвори аудио протокот: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Не може да се отвори протокот за преводи: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Не успеа да се отвори аудио демуксерот: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Не успеа да се отвори демуксерот за преводи: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Не може да бара во редовите на AVI стримовите. (Потребен е индекс, обидете се со -idx префрлување.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "Влезот за ТВ не е за барање! (Барањето веројатно е за менување на канали ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Не може да бара во оваа датотека.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Информации за клипот:\n"
@@ -4051,7 +4046,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Достапни модови за менување на слојот за цел екран:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4503,12 +4498,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4707,88 +4702,88 @@ msgstr "Грешка во избирањето на VCD датотеката."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Не можеше да се отвори DVD уредот: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Има %d наслови на ова DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Невалиден DVD број на насловот: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Има %d агли на овој DVD наслов.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Невалиден DVD број на аголот: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Не може да ја отвори IFO датотеката за DVD насловот %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Не може да ги отвори насловите на VOB датотеките (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5020,12 +5015,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Не може да ја иницијализира libsmbclient библиотеката: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Не може да отвори од локалната мрежа: '%s'\n"
@@ -5501,7 +5496,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/nb.po b/mplayer/po/nb.po
index 5a8cb00..223d15b 100644
--- a/mplayer/po/nb.po
+++ b/mplayer/po/nb.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,218 +179,218 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
 "Unable to load playlist %s.\n"
 msgstr ""
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -532,7 +532,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -603,14 +603,14 @@ msgstr ""
 " * * * SE PÃ… MANSIDE FOR DETALJER, FLERE (AVANSERTE) VALG OG TASTER! * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
 "  Please read DOCS/HTML/en/bugreports.html.\n"
 msgstr ""
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -618,14 +618,14 @@ msgid ""
 "  Verify this!\n"
 msgstr ""
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
 "  disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.\n"
 msgstr ""
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -634,7 +634,7 @@ msgid ""
 "  won't help unless you provide this information when reporting a possible bug.\n"
 msgstr ""
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -679,7 +679,7 @@ msgstr ""
 "Dersom dette ikke hjelper, les DOCS/HTML/en/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -688,7 +688,7 @@ msgstr ""
 "\n"
 "Avslutter... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -697,179 +697,179 @@ msgstr ""
 "\n"
 "MPlayer avbrutt av signal %d i modul: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Kan ikke finne HOME katalog\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") problem\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Oppretter konfigurasjonsfil: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Kan ikke laste undertitler: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "kunne ikke åpne/initialisere lyd-enhet -> NOSOUND\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr ""
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr ""
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
 "FATAL: Could not initialize video filters (-vf) or video output (-vo).\n"
 msgstr ""
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr ""
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr ""
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr ""
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr ""
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Kan ikke laste skrifttype: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr ""
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -878,77 +878,77 @@ msgstr ""
 "\n"
 "Spiller %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Kan ikke åpne dump fil!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr ""
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATALT: valgte stream mangler!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr ""
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS ikke spesifisert (eller ugyldig) i headeren! Bruk -fps valget!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr ""
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Lyd: ingen lyd!!!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr ""
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS tvunget til %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Starter avspilling...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1198,28 +1198,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1229,12 +1229,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1823,27 +1823,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr ""
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2057,13 +2057,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Kan ikke finne codec '%s' i libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "kunne ikke åpne codec\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "kunne ikke lukke codec\n"
@@ -2282,7 +2282,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2637,7 +2637,7 @@ msgstr ""
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2645,7 +2645,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2653,108 +2653,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2800,33 +2795,33 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Advarsel! lyd stream header %d redefinert!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Advarsel! video stream header %d redefinert!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
 msgstr "(kanskje du spiller av en ikke-interleaved stream/fil eller codec'en feilet)\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2835,7 +2830,7 @@ msgstr ""
 "\n"
 "DEMUXER: For mange (%d i %d bytes) lyd pakker i bufferen!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2844,62 +2839,62 @@ msgstr ""
 "\n"
 "DEMUXER: For mange (%d i %d bytes) video pakker i bufferen!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Kan ikke søke i rå .AVI streams! (index behøves, prøv med -idx valget!)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Kan ikke søke i denne filen!  \n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr ""
@@ -4011,7 +4006,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr ""
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4463,12 +4458,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4667,88 +4662,88 @@ msgstr "Feil under valg av VCD spor!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Kan ikke åpne DVD enhet: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Det er %d titler på denne DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Ugyldig DVD tittelnummer: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Det er %d vinkler i denne DVD tittelen.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Ugyldig DVD vinkel nummer: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Kan ikke åpne IFO filen for DVD tittel %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Kan ikke åpne VOBS tittel (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -4980,12 +4975,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr ""
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr ""
@@ -5461,7 +5456,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/nl.po b/mplayer/po/nl.po
index 5be7218..446401f 100644
--- a/mplayer/po/nl.po
+++ b/mplayer/po/nl.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Dit codecs.conf bestand is te oud en incompatibel met deze versie van MP
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -189,211 +189,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Kon de playlist %s niet laden\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -549,7 +549,7 @@ msgstr "[Mixer] Geen geluidsvolume controle beschikbaar.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -621,7 +621,7 @@ msgstr ""
 " * * * ZIE MANPAGE VOOR DETAILS, OVERIGE (GEAVANCEERDE) OPTIES EN TOETSEN! * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -631,7 +631,7 @@ msgstr ""
 "  Het kan een bug zijn in onze nieuwe runtime CPU-detectie code...\n"
 "  Lees DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -643,7 +643,7 @@ msgstr ""
 "  gecompileerd/geoptimaliseerd.\n"
 "  Verifieer dit!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -653,7 +653,7 @@ msgstr ""
 "  Hercompileer MPlayer met --enable-debug en genereer een 'gdb' backtrace en\n"
 "  disassembly. Voor details, zie DOCS/HTML/en/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -667,7 +667,7 @@ msgstr ""
 "  en volg de instructies. We kunnen en zullen niet helpen tenzij je deze informatie\n"
 "  meelevert bij het rapporteren van een mogelijke bug.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -717,7 +717,7 @@ msgstr ""
 "Als geen van deze oorzaken van toepassingen zijn, lees dan DOCS/HTML/en/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -726,7 +726,7 @@ msgstr ""
 "\n"
 "Bezig met afsluiten... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -735,97 +735,97 @@ msgstr ""
 "\n"
 "MPlayer onderbroken door signaal %d in module: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Kan HOME dir niet vinden\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") probleem\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Bezig met het creëren van configuratie bestand: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Bezig met het laden van de configuratie '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Kan ondertitels niet lezen: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: bestand met ondertitels toegevoegd (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Er is een fout opgetreden bijde pre-initialisatie van de audio filter!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Kon audio device niet open/init -> NOSOUND\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Kon geen geldig(e) filter/ao formaat vinden!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux RTC leesfout: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Waarschuwing! Softsleep underflow!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Fout bij het openen/initialiseren van het gekozen video_out (-vo) apparaat!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Kan de libmenu video filter niet openen met het root menu %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "------ GEPAUZEERD -------"
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Kan EDl niet gebruiken zonder video, daarom wordt het uitgeschakeld.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -834,82 +834,82 @@ msgstr ""
 "\n"
 "FATAAL: Kon de video filters (-vf) of de video uitvoer (-vo) niet initialiseren!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Gecompileerd met RUNTIME CPU detectie - waarschuwing, dit is niet optimaal! Om de best mogelijke performantie te krijgen, hercompileer je mplayer met --disable-runtime-cpudetection\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Gecompileerd voor x86 CPU met de volgende uitbreidingen:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "De standaard ingebouwde codecs.conf wordt gebruikt\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Beschikbare audio codecs:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Beschikbare video codecs:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "CommandLine:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Kan font niet laden: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Kon %s niet openen: %s (moet leesbaar zijn voor deze gebruiker.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Linux RTC initialisatiefout in ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Probeer \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" toe te voegen in de opstartbestanden van uw systeem.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Linux RTC initialisatiefout in ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Er wordt gebruik gemaakt van Linux's hardware RTC timing (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menu geinitialiseerd: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Menu initialisatie mislukt.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "WAARSCHUWING: getch2_init is twee maal opgeroepen!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -918,77 +918,77 @@ msgstr ""
 "\n"
 "Bezig met het afspelen van %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Kan het EDL bestand [%s] niet openen om te schrijven.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Kan dump bestand niet openen!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: fout bij het schrijven van het bestand.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATAL: geselecteerde stream ontbreekt!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: kan eigenschappen niet lezen\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS niet gespecificeerd (of foutief) in de header! Gebruik de optie -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Geen stream gevonden\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: geen geluid!!!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: geen video!!!\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS geforceerd om %5.3f te zijn (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Start afspelen...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1238,28 +1238,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1269,12 +1269,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Kon codec niet openen %s, br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, con geen encoder vinden voor deze codec %s\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, kon geen context toewijzen!\n"
@@ -1873,27 +1873,27 @@ msgstr "[AO SUN] Can't open audio device %s, %s  -> nosound.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Beschikbare audio output drivers:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2107,13 +2107,13 @@ msgstr "Samples van dit formaat zijn gewenst om de ondersteuning ervan te verbet
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Kan codec codec '%s' niet vinden in libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "kon codec niet openen\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "kon codec niet sluiten\n"
@@ -2334,7 +2334,7 @@ msgstr "INFO: Win32/DShow video codec initialisatie OK.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2691,7 +2691,7 @@ msgstr "Kan de Ogg demuxer niet openen\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2699,7 +2699,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2707,108 +2707,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2854,27 +2849,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Waarschuwing! Audio stream header %d geherdefinieerd!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Audio stream gevonden: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Waarschuwing! Video stream header %d geherdefinieerd!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Video stream gevonden: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2882,7 +2877,7 @@ msgstr ""
 "(misschien speel je een non-interleaved stream/bestand of werkte de codec niet)\n"
 "Voor .AVI bestanden probeer je best non-interleaved mode met de optie -ni\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2891,7 +2886,7 @@ msgstr ""
 "\n"
 "DEMUXER: Te veel (%d in %d bytes) audio packetten in de buffer!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2900,62 +2895,62 @@ msgstr ""
 "\n"
 "DEMUXER: Te veel (%d in %d bytes) video packetten in de buffer!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Kan audio stream niet openen: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Kan ondertitelingstream niet openen: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Kan audio demuxer niet openen: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Openen van de ondertiteling demuxer is mislukt: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Kan niet in raw .AVI streams verplaatsen! (index nodig, probeer met de -idx optie!)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV invoer is niet doorzoekbaar! (Waarschijnlijk zal zoeken de kanalen veranderen ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Kan niet verplaatsen in dit bestand!  \n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Clip info: \n"
@@ -4073,7 +4068,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Beschikbare fullscreen modi:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4525,12 +4520,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4729,88 +4724,88 @@ msgstr "Fout bij het selecteren van VCD track!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Kon DVD device niet openen: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Er zijn %d titels op deze DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Foutieve DVD titelnummer: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Er zijn %d gezichtspunten in deze DVD titel.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Foutief DVD gezichtspuntnummer: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Kan het IFO bestand voor DVD titel %d niet openen.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Kan titel VOBS niet openen (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5042,12 +5037,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Kon de libsmbclient bibliotheek niet initialiseren: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Kon netwerkbestand '%s' niet openen\n"
@@ -5523,7 +5518,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/pl.po b/mplayer/po/pl.po
index f263d0f..b9b9cb9 100644
--- a/mplayer/po/pl.po
+++ b/mplayer/po/pl.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Plik codecs.conf jest za stary i niekompatybilny z tym wydaniem MPlayer!
 msgid "Chapter: (%d) %s"
 msgstr "Rozdział: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "nieznany"
 
@@ -189,211 +189,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr "włączony (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "wyłączony"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "włączony"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "mocne"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "góra"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "środek"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "dół"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Głośność"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Wycisz: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "Opóźnienie A-V: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Audio: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Panscan"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Zawsze na wierzchu: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Okno główne: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Ramka: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Pomijanie klatek: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gamma"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Jasność"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Kontrast"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Nasycenie"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Barwa"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "Synchronizacja pionowa: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Napisy: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Pozycja napisów: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Wyrównanie napisów: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Opóźnienie napisów: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Tylko wymuszone napisy: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "Pominięcie EDL rozpoczęte, wciśnij ponownie 'i' by zakończyć blok.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "Pominięcie EDL odwołane, ostatni start > stop\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "Pominięcie EDL zakończone, wiersz zapisany.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Opóźnienie napisów: %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Nie mogę wczytać listy odtwarzania %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Kanał: %s"
@@ -556,7 +556,7 @@ msgstr "[Mixer] Brak kontroli głośności.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -628,7 +628,7 @@ msgstr ""
 " * * * WIĘCEJ OPCJI DOSTĘPNYCH NA STRONIE PODRĘCZNIKA MAN * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  To może być błąd w naszym nowym kodzie detekcji procesora przy starcie...\n"
 "  ProszÄ™ zobacz DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -649,7 +649,7 @@ msgstr ""
 "  To zdarza sie w wypadku gdy MPlayer jest uruchamiany na innym procesorze niż został skompilowany/zoptymalizowany\n"
 "  Sprawdź to!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -659,7 +659,7 @@ msgstr ""
 "  Przekompiluj MPlayera z opcja --enable-debug i wykonaj śledzenie z 'gdb' oraz \n"
 "  zdisassembluj. Szczegóły w DOCS/HTML/pl/bugreports_what.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -673,7 +673,7 @@ msgstr ""
 "  DOCS/HTML/en/bugreports.html i postępuj zgodnie z zawartymi tam instrukcjami. Nie jesteśmy\n"
 "  w stanie pomóc dopóki nie podasz tych danych przy informowaniu o możliwym błędzie.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -725,7 +725,7 @@ msgstr ""
 "Jeśli nie znalazłeś nic pomocnego zobacz DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -734,7 +734,7 @@ msgstr ""
 "\n"
 "WychodzÄ™... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -743,97 +743,97 @@ msgstr ""
 "\n"
 "MPlayer przerwany sygnałem %d w module: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Nie mogę odnaleźć katalogu domowego.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "Problem z get_path(\"config\")\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "TworzÄ™ plik konfiguracyjny: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "WczytujÄ™ konfiguracjÄ™ '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Nie mogę załadować napisów: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: Dodaje plik z napisami (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Błąd preinicjalizacji łańcucha filtru audio!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Nie mogę otworzyć/zainicjować urządzenia audio -> brak dźwięku.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Nie mogę znaleźć pasującego formatu ao/filtra!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "BÅ‚Ä…d odczytu RTC Linuxa : %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Uwaga! niedomiar softsleep !\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "BÅ‚Ä…d przy otwieraniu/inicjalizacji wybranego urzÄ…dzenia video (-vo).\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Nie mogę otworzyć filtru video libmenu z głownym menu %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUZA  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Nie moge użyć EDL bez obrazu, wyłączam.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -842,82 +842,82 @@ msgstr ""
 "\n"
 "Błąd krytyczny: Nie mogę zainicjalizować filtrów (-vf) lub wyjścia video (-vo).\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Skompilowane z wykrywaniem procesora przy starcie.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Skompilowano dla procesora x86 z rozszerzeniami:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Używam wbudowanego codecs.conf.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Dostępne kodeki audio :\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Dostępne kodeki video :\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "WierszPoleceń:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Nie mogę załadować czcionki: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Nie moge otworzyć %s: %s (użytkownik powinien mieć prawo odczytu.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "BÅ‚Ä…d RTC Linuxa w ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Spróbuj dodać \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" do skryptów startowych swojego systemu.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "BÅ‚Ä…d RTC Linuxa w ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Używam sprzętowego zegara RTC (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menu zainicjowane: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Nie mogę zainicjować menu.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "UWAGA: getch2_init wywołany dwukrotnie!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -926,77 +926,77 @@ msgstr ""
 "\n"
 "Odtwarzam %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Nie mogę otworzyć pliku EDL [%s] do zapisu.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Nie mogę otworzyć pliku dump.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: BÅ‚Ä…d zapisu pliku.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: Błąd krytyczny: Wybrany strumień nie istnieje!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Wideo: Nie mogę wczytać właściwości.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Brak wartości FPS w nagłówku lub jest ona nieprawidłowa, użyj opcji -fps <ilość_klatek>.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Nie odnaleziono strumienia.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: brak dźwięku\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Wideo: brak obrazu\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "Wymuszono FPS na %5.3f  (ftime: %5.3f).\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Odtwarzam...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1248,28 +1248,28 @@ msgstr "dostępne etykiety w"
 msgid "Couldn't find label in plugin library."
 msgstr "Nie udało się odnaleźć etykiety w bibliotece wtyczek."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Nie podano podopcji."
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Nie podano pliku biblitek."
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Nie podano etykiety filtru."
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "W wierszu poleceń podano niewystarczającą ilośc opcji."
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: Kontrola wejścia #%d jest poniżej dolnej granicy wynoszącej %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: Input control #%d jest powyżej górnej granicy wynoszącej %0.4f.\n"
@@ -1279,12 +1279,12 @@ msgstr "%s: Input control #%d jest powyżej górnej granicy wynoszącej %0.4f.\n
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Nie udało się otworzyć kodeka %s, br=%d.\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, nie mogę znaleźć kodera dla kodeka %s.\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, nie mogę zaalokować treści!\n"
@@ -1883,27 +1883,27 @@ msgstr "[AO SUN] Nie mogę otworzyć urządzenia audio %s, %s  -> brak dźwięku
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: Twoja karta nie obsługuje %d kanałów, %s, częstotliwości próbkowania %d Hz.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Dostępne wyjściowe sterowniki audio:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2117,13 +2117,13 @@ msgstr "By poprawić obsługę tego formatu potrzebne są próbki. Proszę skont
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Nie mogę odnaleźć kodeka '%s' w libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Nie mogłem otworzyć kodeka.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Nie mogłem zamknąć kodeka.\n"
@@ -2350,7 +2350,7 @@ msgstr "INFO: Inicjalizacja kodeka video Win32/DShow OK.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] Åšrednia arytmetyczna QP: %2.4f, Åšrednia harmoniczna QP: %2.4f\n"
@@ -2711,7 +2711,7 @@ msgstr "BÅ‚Ä…d otwierania Ogg demuxer.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "błąd fill_buffer: zły demuxer: nie vd, ad lub sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2719,7 +2719,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2727,108 +2727,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2874,27 +2869,27 @@ msgstr "Zamykam wtyczkÄ™: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "UWAGA: Nagłówek strumienia audio %d zredefinowany.\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Znalazłem strumień audio: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "UWAGA: Nagłówek strumienia video %d zredefinowany.\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Znalazłem strumień video: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2902,7 +2897,7 @@ msgstr ""
 "Może odtwarzasz strumień/plik bez przeplotu (non-interleaved) albo kodek nie działa?\n"
 "Spróbuj wymusić tryb bez przeplotu dla plików AVI opcją -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2911,7 +2906,7 @@ msgstr ""
 "\n"
 "Za dużo pakietów audio w buforze: (%d w %d bajtach).\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2920,62 +2915,62 @@ msgstr ""
 "\n"
 "Za dużo pakietów video w buforze: (%d w %d bajtach).\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Nie mogę otworzyć strumienia audio: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Nie mogę otworzyć strumienia z napisami: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Otwieranie demuxer'a audio nie powiodło się: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Otwieranie demuxer'a napisów nie powiodło się: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Nie moge przeszukiwać strumieni raw AVI. (Wymagany index, spróbuj przełącznika -idx.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "Nie można przeszukiwać wejścia TV! (Przeszukiwanie prawdopodobnie służy do zmiany kanałów ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Nie mogę przeszukiwać tego pliku.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Informacje o klipie:\n"
@@ -4133,7 +4128,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Dostępne tryby pełnoekranowe:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Wybrano tryb video %dx%d dla obrazu %dx%d.\n"
@@ -4594,12 +4589,12 @@ msgstr "Serwer zwraca %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Rozmiar pamięci podręcznej (cache) ustawiono na %d Kbajtów\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Otwieranie %s nie powiodło się.\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4798,88 +4793,88 @@ msgstr "Błąd wybierania ścieżki VCD."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open, nazwa_pliku=%s, ścieżka=%d, dostępne ścieżki: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Wybrano ścieżkę dźwiękową : %d w języku: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "Brak pasującej ścieżki dźwiękowej!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Wybrano napisy DVD: %d w języku: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "Brak pasujacych napisów!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Nie znaleziono DVD: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "Nie mogę otworzyć informacji VMG!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Na DVD znajduje się %d tytył(ów).\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Błędny numer tytułu DVD: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "To DVD ma %d kątów.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Niepoprawny numer kÄ…ta: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Nie mogę otworzyć pliku IFO dla DVD %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Nie mogę otworzyć tytułu VOBS (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "strumień audio: %d format: %s (%s) język: %s aid: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "ilośc ścieżek dźwiękowych na płycie: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "napisy ( sid ): %d język: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "Ilość napisów: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer został skompilowany bez obsługi DVD support, wychodzę.\n"
@@ -5111,12 +5106,12 @@ msgstr "[radio] Używam częstotliwości: %.2f.\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] Wywołanie stream_enable_cache nie powiodło się: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Nie mogę zainicjować biblioteki libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Nie mogę otworzyć z sieci lokalnej (LAN): '%s'\n"
@@ -5592,7 +5587,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "Łancuch wydaje się być już zakodowany w url_escape %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/pt_BR.po b/mplayer/po/pt_BR.po
index a7cd9ba..b6453e1 100644
--- a/mplayer/po/pt_BR.po
+++ b/mplayer/po/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,211 +179,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -392,7 +392,7 @@ msgstr ""
 "\n"
 "Incapaz de carregar a lista de reprodução %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -534,7 +534,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -613,7 +613,7 @@ msgstr ""
 "* VEJA A PÁGINA DO MANUAL PARA DETALHES, FUTURAS (AVANÇADAS) OPÇÕES E TECLAS *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -623,7 +623,7 @@ msgstr ""
 "  Pode ser um erro no nosso novo código de detecção de CPU em tempo real...\n"
 "  Por favor leia DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -635,7 +635,7 @@ msgstr ""
 "  aquele para o qual foi compilado/otimizado.\n"
 "  Verifique isso!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -645,7 +645,7 @@ msgstr ""
 "  Recompile o MPlayer com --enable-debug e faça um 'gdb backtrace' e\n"
 "  'disassembly'. Para detalhes, veja DOCS/HTML/en/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -659,7 +659,7 @@ msgstr ""
 "  DOCS/HTML/en/bugreports.html e siga as instruções. Nós não podemos e não vamos ajudar\n"
 "  a não ser que você proveja esta informação quando reportar um possível erro.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -711,7 +711,7 @@ msgstr ""
 "Se nenhum destes ajudar você, leia DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -720,7 +720,7 @@ msgstr ""
 "\n"
 "Saindo... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -729,97 +729,97 @@ msgstr ""
 "\n"
 "MPlayer interrompido por sinal %d no módulo %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Diretório HOME não encontrado.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "Problema em get_path(\"config\")\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Criando arquivo de configuração: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Impossível carregar legendas: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Impossível abrir/inicializar o dispositivo de audio -> sem som\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Erro abrindo/inicializando o dispositivo da saída de vídeo (-vo)!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "================= PAUSADO ================="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -828,82 +828,82 @@ msgstr ""
 "\n"
 "FATAL: Impossível inicializar os filtros de vídeo (-vf) ou a saída de vídeo (-vo)!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Compilado com detecção de CPU em tempo real - AVISO - isto não é ideal! Para obter a melhor performance, recompile MPlayer com --disable-runtime-cpudetection\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Compilado para CPU x86 com extenções:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Usando codecs.conf interno padrão\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Codecs de audio disponíveis:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Codecs de vídeo disponíveis:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Impossível carregar fonte: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Usando regulação de tempo Linux hardware RTC (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -912,77 +912,77 @@ msgstr ""
 "\n"
 "Reproduzindo %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Impossível abrir arquivo de dump.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: erro gravando arquivo.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATAL: faltando trilha selecionada!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: impossível ler propriedades\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Quadros por segundo não especificado no cabeçalho ou inválido, use a opção -fps.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Trilha não encontrada\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: sem som.\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Vídeo: sem vídeo\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS (quadros por segundo) forçado a ser %5.3f (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Iníciando reprodução...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1232,28 +1232,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1263,12 +1263,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1857,27 +1857,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Drivers de saída de audio disponíveis:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2091,13 +2091,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Impossível encontrar codec '%s' em libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Impossível abrir codec\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Impossível fechar codec\n"
@@ -2316,7 +2316,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2673,7 +2673,7 @@ msgstr "Impossível abrir o demuxer ogg\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2681,7 +2681,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2689,108 +2689,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2836,27 +2831,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "AVISO! Cabeçalho %d da trilha de audio redefinido!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Trilha de audio encontrada: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "AVISO! Cabeçalho %d da trilha de vídeo redefinido!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Trilha de video encontrada: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2864,7 +2859,7 @@ msgstr ""
 "Talvez você esteja reproduzindo um fluxo/arquivo não-entrelaçado ou o codec falhou?\n"
 "Para arquivos .AVI, tente forçar um modo não-entrelaçado com a opção -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2873,7 +2868,7 @@ msgstr ""
 "\n"
 "Muitos pacotes de audio no buffer: (%d em %d bytes).\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2882,62 +2877,62 @@ msgstr ""
 "\n"
 "Muitos pacotes de audio no buffer: (%d em %d bytes).\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Impossível abrir trilha de audio: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Impossível abrir trilha de legendas: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Falha ao abrir demuxer de audio: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Falha ao abrir demuxer de legendas: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Impossível buscar em fluxos de .AVI brutos! (índice requerido, tente com a opção -idx!)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "Entrada de TV não aceita busca! (Provavelmente a busca será pra mudar de canal ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Impossível buscar neste arquivo!  \n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Informações do clip:\n"
@@ -4049,7 +4044,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr ""
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4501,12 +4496,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4705,88 +4700,88 @@ msgstr "Erro selecionando trilha do VCD!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Impossível abrir dispositivo de DVD: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Existem %d títulos neste DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Número do título do DVD inválido: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Existem %d anglos neste título de DVD.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Número do anglo do DVD inválido: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Impossível abrir o arquivo IFO para o título de DVD %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Impossível abrir título VOBS (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5018,12 +5013,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Impossível inicializar biblioteca libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Impossível abrir da \"lan\": '%s'\n"
@@ -5499,7 +5494,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/ro.po b/mplayer/po/ro.po
index b1b8a28..f96d710 100644
--- a/mplayer/po/ro.po
+++ b/mplayer/po/ro.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -165,8 +165,8 @@ msgstr ""
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -179,211 +179,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -392,7 +392,7 @@ msgstr ""
 "\n"
 "Nu pot sã încarc playlistul %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -534,7 +534,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -610,14 +610,14 @@ msgstr ""
 " * * * VEZI PAGINA MAN PENTRU DETALII, ALTE OPÞIUNI (AVANSATE) ªI TASTE * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
 "  Please read DOCS/HTML/en/bugreports.html.\n"
 msgstr ""
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -625,14 +625,14 @@ msgid ""
 "  Verify this!\n"
 msgstr ""
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
 "  disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.\n"
 msgstr ""
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -647,7 +647,7 @@ msgstr ""
 "  ºi nu te vom ajuta decat dacã asiguri informaþia cerutã acolo cand anunþi\n"
 "  un posibil bug.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -699,7 +699,7 @@ msgstr ""
 "Dacã tot nu reuºeºti, citeºte DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -708,7 +708,7 @@ msgstr ""
 "\n"
 "Ieºire... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -717,99 +717,99 @@ msgstr ""
 "\n"
 "MPlayer a fost întrerupt de semnalul %d în modulul: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Nu gãsesc directorul HOME.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") problem\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr ""
 "Creez fiºierul de configurare: %s\n"
 "Încearcã '-vo help' pentru o listã cu driveri video disponibili.\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr ""
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Nu pot încãrca subtitrarea: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr ""
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr ""
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Nu pot deschide/iniþializa audio -> rulez fãrã sunet.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr ""
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr ""
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr ""
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Eroare la activarea ieºirii video (-vo) aleasã.\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr ""
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUZÃ  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr ""
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -818,82 +818,82 @@ msgstr ""
 "\n"
 "FATAL: Nu pot iniþializa filtrele video (-vf) sau ieºirea video (-vo).\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr ""
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Folosesc 'codecs.conf' built-in.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Codec-uri audio disponibile:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Codec-uri video disponibile:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr ""
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Nu pot încãrca fontul: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr ""
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr ""
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr ""
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Using Linux hardware RTC timing (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr ""
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr ""
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr ""
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -902,77 +902,77 @@ msgstr ""
 "\n"
 "Rulez %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr ""
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr ""
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Eroare la scrierea fiºierului.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr ""
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: Nu pot citi proprietãþile.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS (nr. de cadre pe secundã) nu e specificat în header sau e greºit; foloseºte opþiunea '-fps'.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Nu am gãsit nici un canal.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: fãrã sunet\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: nu existã video\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS forþat la %5.3f  (ftime: %5.3f).\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Rulez...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1222,28 +1222,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1253,12 +1253,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr ""
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr ""
@@ -1847,27 +1847,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Plugin-uri de ieºire audio disponibile:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2081,13 +2081,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Nu gãsesc codecul '%s' în libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Nu pot deschide codecul.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Nu pot închide codecul.\n"
@@ -2306,7 +2306,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2661,7 +2661,7 @@ msgstr "Nu pot deschide demultiplexorul ogg.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2669,7 +2669,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2677,108 +2677,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2824,102 +2819,102 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Canal audio gãsit: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Canal video gãsit: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
 "Too many audio packets in the buffer: (%d in %d bytes).\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
 "Too many video packets in the buffer: (%d in %d bytes).\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Nu pot deschide canalul audio: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Nu pot deschide canalul de subtitrare: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Nu am reuºit sã deschid demultiplexorul audio: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Nu am reuºit sã deschid demultiplexorul subtitrãrii: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Nu pot derula în stream-uri AVI pure. (E nevoie de index, încearcã cu opþiunea '-idx'.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "Nu se poate derula TV! (Derularea probabil va schimba canalul ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Nu pot derula în acest fiºier.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Info despre clip:\n"
@@ -4035,7 +4030,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Moduri fullscreen disponibile:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4487,12 +4482,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4691,88 +4686,88 @@ msgstr "Eroare la alegerea pistei VCD."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Nu pot deschide DVD-ul: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Sunt %d titluri pe acest DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Numãrul titlului DVD greºit: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Sunt %d unghiuri în acest titlu DVD.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Numãrul unghiului greºit: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Nu pot deschide fiºierul IFO pentru titlul %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Nu pot deschide VOB-ul pentru titlu (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5004,12 +4999,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr ""
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Nu pot deschide de pe LAN: '%s'\n"
@@ -5485,7 +5480,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/ru.po b/mplayer/po/ru.po
index 96be29b..b12f5ac 100644
--- a/mplayer/po/ru.po
+++ b/mplayer/po/ru.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Этот codecs.conf слишком стар и несовместим 
 msgid "Chapter: (%d) %s"
 msgstr "Раздел: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "неизвестно"
 
@@ -189,211 +189,211 @@ msgstr "Угол: %d/%d"
 msgid "enabled (EDL)"
 msgstr "включено (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "выключено"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "включено"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "интенсивный"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "из файла"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "внедренные"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "верх"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "центр"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "низ"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Повторять: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Громкость"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Приглушить: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V задержка: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Аудио: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Баланс"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Усечение сторон"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Поверх остальных: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "root-окно: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Рамка: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Пропуск кадров: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Гамма"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Яркость"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Контраст"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Насыщенность"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Цвет"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "Вертикальная синхронизация: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Субтитры: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Источник субтитров: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Позиция субтитров: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Выравнивание субтитров: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Задержка субтитров: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Форсированы только субтитры: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Масштаб субтитров: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "Начало EDL пропуска, нажмите 'i' ещё раз для завершения блока.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "EDL пропуск отменён, последний start > stop\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "Конец EDL пропуска, строка записана.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Задержка субтитров: %d мс"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Не могу загрузить список воспроизведения (плейлист) %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Канал: %s"
@@ -556,7 +556,7 @@ msgstr "[Микшер] Контроль громкости не доступен
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Микшер] Управление балансом недоступно.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -630,7 +630,7 @@ msgstr ""
 " * * * ПОДРОБНЕЕ СМ. ДОКУМЕНТАЦИЮ, О ДОПОЛНИТЕЛЬНЫХ ОПЦИЯХ И КЛЮЧАХ! * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -640,7 +640,7 @@ msgstr ""
 "  Это может быть ошибкой нашего нового кода динамического определения типа CPU...\n"
 "  Пожалуйста, читайте DOCS/HTML/ru/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -652,7 +652,7 @@ msgstr ""
 "  он был скомпилирован/оптимизирован.\n"
 "  Проверьте это!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -663,7 +663,7 @@ msgstr ""
 "  дизассемблирование. Для подробностей, см.\n"
 "DOCS/HTML/ru/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -678,7 +678,7 @@ msgstr ""
 "  Мы не сможем и не будем помогать, пока Вы не предоставите эту информацию,\n"
 "сообщая о возможной ошибке.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -730,7 +730,7 @@ msgstr ""
 "Если ничего не помогло, тогда читайте DOCS/HTML/ru/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -739,7 +739,7 @@ msgstr ""
 "\n"
 "Выходим... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -748,97 +748,97 @@ msgstr ""
 "\n"
 "MPlayer прерван сигналом %d в модуле: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Не могу найти ДОМАШНИЙ каталог\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "проблемы в get_path(\"config\")\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Создание файла конфигурации: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Загружаю профиль для протокола '%s'\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Загружаю профиль для расширения '%s'\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Загружаю конфигурационный файл '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Не могу загрузить субтитры: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "СУБТИТРЫ: добавлен файл субтитров (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Ошибка в цепочке pre-init аудиофильтра!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Не могу открыть/инициализировать аудиоустройство -> без звука.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Не могу найти соответствующий фильтр/формат_аудиовывода!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Ошибка чтения Linux RTC: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Предупреждение! Недопустимо низкое значение программной задержки!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Ошибка при открытии/инициализации выбранного устройства видеовывода (-vo).\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Не могу открыть видеофильтр libmenu с этим корневым меню %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "=== ПРИОСТАНОВЛЕНО ==="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Нельзя использовать EDL без видео, отключаю.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -847,84 +847,84 @@ msgstr ""
 "\n"
 "ФАТАЛЬНАЯ ОШИБКА: Не могу инициализировать видеофильтры (-vf) или видеовывод (-vo).\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Скомпилировано для определения типа процессора во время выполнения.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Скомпилировано для x86 CPU со следующими расширениями:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Используется встроенный codecs.conf.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Доступные аудиокодеки:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Доступные видеокодеки:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Командная строка:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Не могу загрузить побитовый шрифт: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Не могу открыть %s: %s (пользователь должен обладать правом чтения на этот файл).\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Ошибка инициализации Linux RTC в ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr ""
 "Попробуйте добавить \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" \n"
 "в загрузочные скрипты Вашей системы.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Ошибка инициализации Linux RTC в ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Используется аппаратная Linux RTC синхронизация (%ldГц).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Меню инициализировано: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Не могу инициализировать меню.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "ПРЕДУПРЕЖДЕНИЕ: getch2_init вызван дважды!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -933,77 +933,77 @@ msgstr ""
 "\n"
 "Воспроизведение %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Не могу открыть файл EDL [%s] для записи.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Не могу открыть файл дампа!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Ошибка при записи файла.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "дамп: ФАТАЛЬНАЯ ОШИБКА: Выбранный поток потерян!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Видео: Не могу прочитать свойства.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] формат:%d  fourcc:0x%X  размер:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "В заголовке кадры/сек не указаны (или недопустимые)! Используйте опцию -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Поток не найден.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Аудио: без звука\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Видео: нет видео\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "Кадры/сек форсированы в %5.3f (время кадра: %5.3f).\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Начало воспроизведения...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1263,28 +1263,28 @@ msgstr "доступные метки в"
 msgid "Couldn't find label in plugin library."
 msgstr "Не могу найти метку в библиотеке плагина."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Не указаны субопции."
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Не указан файл библиотеки."
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Не указана метка фильтра."
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Недостаточно настроек указано в командной строке."
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: Входной параметр #%d меньше нижней границы %0.4f.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: Входной параметр #%d больше верхней границы %0.4f.\n"
@@ -1294,12 +1294,12 @@ msgstr "%s: Входной параметр #%d больше верхней гр
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Не могу открыть кодек %s, br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Аудио LAVC, не могу найти кодировщик для кодека %s\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Аудио LAVC, не могу разместить контекст!\n"
@@ -1916,27 +1916,27 @@ msgstr ""
 "[AO SUN] инициализация аудио: ваша карта не поддерживает канал %d,\n"
 "%s, частоту дискретизации %d Гц.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Доступные драйвера вывода звука:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr "Пробую предпочтённый аудио драйвер '%.*s' с опциями '%s'\n"
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr "Не могу инициализировать аудио драйвер '%s'\n"
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr "Отсутствует аудио драйвер '%.*s'\n"
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr "Пробую каждый известный аудио драйвер...\n"
@@ -2154,13 +2154,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Не могу найти кодек '%s' в libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Не могу открыть кодек.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Не могу закрыть кодек.\n"
@@ -2390,7 +2390,7 @@ msgstr "ИНФОРМАЦИЯ: Win32/DShow видео кодек успешно 
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] Арифметическое среднее QP: %2.4f, Гармоническое среднее QP: %2.4f\n"
@@ -2754,7 +2754,7 @@ msgstr "Не могу открыть демультиплексор ogg.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "ошибка заполнения_буфера: плохой демультиплексор: не vd, ad или sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2762,7 +2762,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2770,29 +2770,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] ошибка инициализации zlib.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] ошибка zlib распаковки.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] ошибка lzo распаковки.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2801,19 +2801,19 @@ msgstr ""
 "[mkv] Дорожка номер %u зашифрована, а расшифровка еще не \n"
 "[mkv] реализована. Пропуск дорожки.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] Неизвестный тип шифрования содержимого для дорожки %u. Пропуск дорожки.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2822,22 +2822,22 @@ msgstr ""
 "[mkv] Дорожка %u сжата zlib, но mplayer скомпилирован \n"
 "[mkv] без поддержки сжатия zlib. Пропуск дорожки.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] ID дорожки %u: %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] ID дорожки %u: %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2846,12 +2846,12 @@ msgstr ""
 "[mkv] Неизвестный/неподдерживаемый CodecID (%s) или отсутствующие/плохие\n"
 "[mkv] данные CodecPrivate (дорожка %u).\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] Дорожка FLAC не содержит правильных заголовков.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2860,26 +2860,21 @@ msgstr ""
 "[mkv] Неизвестный/неподдерживаемый ID аудио кодека '%s' для дорожки %u или отсутствующие/неверные\n"
 "[mkv] частные данные кодека.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] Тип субтитров '%s' не поддерживается.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] Будет воспроизводиться дорожка %u.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Не найдена/не требуется видео дорожка.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Не найдена/не требуется аудио дорожка.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2925,27 +2920,27 @@ msgstr "Закрываю плагин: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "Ожидание начала воспроизведения '%s' плагином XMMS...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "ПРЕДУПРЕЖДЕНИЕ: Заголовок аудио потока %d переопределён!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Нашёл аудиопоток: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "ПРЕДУПРЕЖДЕНИЕ: Заголовок видео потока %d переопределён!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Нашёл видеопоток: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2953,7 +2948,7 @@ msgstr ""
 "Возможно Вы проигрываете 'неслоёный' поток/файл или неудачный кодек?\n"
 "Для AVI файлов попробуйте форсировать 'неслоёный' режим опцией -ni.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2962,7 +2957,7 @@ msgstr ""
 "\n"
 "Слишком много (%d в %d байтах) аудиопакетов в буфере!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2971,64 +2966,64 @@ msgstr ""
 "\n"
 "Слишком много (%d в %d байтах) видеопакетов в буфере!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Не могу открыть аудиопоток: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Не могу открыть поток субтитров: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Не могу открыть демультиплексор аудио: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Не могу открыть демультиплексор субтитров: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr ""
 "Не могу переместиться в сыром потоке AVI!\n"
 "(требуется индекс, попробуйте с ключом -idx!)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "По ТВ входу нельзя перемещаться! (Возможно, перемещение будет для смены каналов ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Не могу перемещаться в этом файле!\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Информация о клипе:\n"
@@ -4230,7 +4225,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Доступные режимы изменения полноэкранного слоя:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Выбран видеорежим %dx%d для размера изображения %dx%d.\n"
@@ -4695,12 +4690,12 @@ msgstr "Сервер вернул %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Установлен размер кэша %d КБайт(а/ов)\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Не могу открыть %s.\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4901,88 +4896,88 @@ msgstr "Ошибка выбора дорожки VCD!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE открытие_потока, имя файла=%s, дорожка=%d, доступные дорожки: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Выбранный аудиоканал DVD: %d язык: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "Не найден подходящий аудио язык DVD!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Выбранный канал субтитров DVD: %d язык: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "Не найден подходящий язык субтитров DVD!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Не могу открыть DVD: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "Не могу открыть VMG информацию!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "На этом DVD %d роликов.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Недопустимый номер DVD ролика: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "В этом DVD ролике %d углов.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Недопустимый номер DVD угла: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Не могу открыть IFO файл для DVD ролика %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Не могу открыть VOBS ролика (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "аудиопоток: %d формат: %s (%s) язык: %s aid: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "число аудиоканалов на диске: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "субтитры ( sid ): %d язык: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "число субтитров на диске: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer был скомпилирован без поддержки DVD, выходим.\n"
@@ -5214,12 +5209,12 @@ msgstr "[radio] Используется частота: %.2f.\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] Ошибка вызова stream_enable_cache: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Не могу инициализировать библиотеку libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Не могу открыть по сети: '%s'\n"
@@ -5706,7 +5701,7 @@ msgstr "tvi_dshow: Частота дискретизации %d не подде
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "Похоже, что строка уже пропущена в url_escape %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/sk.po b/mplayer/po/sk.po
index 1c56f83..f84c611 100644
--- a/mplayer/po/sk.po
+++ b/mplayer/po/sk.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Súbor codecs.conf je príliš starý a nekompatibilný s touto verziou
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "neznáme"
 
@@ -189,211 +189,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr "zapnuté (edl)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "vypnuté"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "zapnuté"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "hard"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "hore"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "stred"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "dole"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Hlasitosť"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Utlmenie zvuku: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V odchylka: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Panscan"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Vždy navrchu: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Hlavné okno: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Ohraničenie: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Zahadzovanie snímkov: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gama"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Jas"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Kontrast"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Sýtosť"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Tón"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "VSync: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Titulky: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Pozícia tit.: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Zarovnanie tit.: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Spozdenie tit.: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Iba vynútené tit.: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Zpozdenie tit: %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Nemôžem načítať playlist %s\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Kanál: %s"
@@ -554,7 +554,7 @@ msgstr "[Mixer] Ovládanie hlasitosti nie je dostupné.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -626,7 +626,7 @@ msgstr ""
 " * * * * PREČÍTAJTE SI MAN STRÁNKU PRE DETAILY (ĎALŠIE VOĽBY A KLÁVESY)! * * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -636,7 +636,7 @@ msgstr ""
 "  Môže to byť chyba v našom novom kóde na detekciu procesora...\n"
 "  Prosím prečítajte si DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -648,7 +648,7 @@ msgstr ""
 "  skompilovaný/optimalizovaný.\n"
 "  Skontrolujte si to!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -658,7 +658,7 @@ msgstr ""
 "  Prekompilujte MPlayer s --enable-debug a urobte 'gdb' backtrace a\n"
 "  disassemblujte. Pre detaily, pozrite DOCS/HTML/en/bugreports_what.html#bugreports_crash.b.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -672,7 +672,7 @@ msgstr ""
 "  a postupujte podľa inštrukcii. Nemôžeme Vám pomôcť, pokiaľ neposkytnete\n"
 "  tieto informácie pri ohlasovaní možnej chyby.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -723,7 +723,7 @@ msgstr ""
 "Ak nič z tohto nepomohlo, prečítajte si DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -732,7 +732,7 @@ msgstr ""
 "\n"
 "Končím... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -741,97 +741,97 @@ msgstr ""
 "\n"
 "MPlayer prerušený signálom %d v module: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Nemôžem najsť domáci (HOME) adresár\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") problém\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Vytváram konfiguračný súbor: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Čítam konfiguráciu '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Nemôžem načítať titulky: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: pridaný súbor titulkov (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Chyba pri predinicializácii reťazca audio filtrov!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "nemôžem otvoriť/inicializovať audio driver -> TICHO\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Nemožem nájsť zodpovedajúci filter/ao formát!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Chyba pri čítaní z Linuxových RTC: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Pozor! Podtečenie softsleep!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Chyba pri otváraní/inicializácii vybraných video_out (-vo) zariadení!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Nemôžem otvoriť video filter libmenu s koreňovým menu %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUZA  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "EDL sa nedá použiť bez videa, vypínam.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -840,82 +840,82 @@ msgstr ""
 "\n"
 "FATAL: Nemôžem inicializovať video filtre (-vf) alebo video výstup (-vo)!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "Skompilovné s RUNTIME CPU Detection - varovanie, nie je to optimálne! Na získanie max. výkonu, rekompilujte mplayer zo zdrojakov s --disable-runtime-cpudetection\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Skompilované pre x86 CPU s rozšíreniami:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Používam vstavané defaultne codecs.conf\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Dostupné audio kodeky:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Dostupné video kodeky:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Príkazový riadok:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Nemôžem načítať font: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Nepodarilo sa otvoriť %s: %s (malo by to byť čitateľné pre používateľa.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Chyba pri inicializácii Linuxových RTC v ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Skúste pridať \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" do štartovacích skriptov vášho systému.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Chyba pri inicializácii Linuxových RTC v ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Používam Linuxové hardvérové RTC časovanie (%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menu inicializované: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Zlyhala inicializácia menu.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "VAROVANIE: getch2_init je volaná dvakrát!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -924,77 +924,77 @@ msgstr ""
 "\n"
 "Prehrávam %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Nedá sa otvoriť EDL súbor [%s] pre zápis.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Nejde otvoriť súbor pre dump!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: chyba pri zápise súboru.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATAL: požadovaný prúd chýba!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: nemôžem čítať vlastnosti\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "V hlavičke súboru nie je udané (alebo je zlé) FPS! Použite voľbu -fps!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Nenájdený prúd\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: bez zvuku!!!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: žiadne video!!!\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS vnútené na hodnotu %5.3f  (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Začínam prehrávať...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1244,28 +1244,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1275,12 +1275,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Nedá sa otvoriť kódek %s, br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, nemôžem nájsť enkóder pre kódek %s\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, nemôžem alokovať kontext!\n"
@@ -1869,27 +1869,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Dostupné audio výstupné ovládače:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2103,13 +2103,13 @@ msgstr "Potrebujeme vzorky tohto formátu, aby sme zlepšili podporu. Prosím ko
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Nemôžem najsť kodek '%s' v libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "nemôžem otvoriť kodek\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "nemôžem uzavieť kodek\n"
@@ -2330,7 +2330,7 @@ msgstr "INFO: Inicializácia Win32/DShow videokódeku OK.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2689,7 +2689,7 @@ msgstr "Nemôžem otvoriť ogg demuxer\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2697,7 +2697,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2705,108 +2705,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2852,27 +2847,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Upozornenie! Hlavička audio prúdu %d predefinovaná!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Nájdený audio prúd: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Upozornenie! Hlavička video prúdu %d predefinovaná!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Nájdený video prúd: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2880,7 +2875,7 @@ msgstr ""
 "(možno prehrávate neprekladaný prúd/súbor alebo kodek zlyhal)\n"
 "Pre .AVI súbory skúste vynútiť neprekladaný mód voľbou -ni\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2889,7 +2884,7 @@ msgstr ""
 "\n"
 "DEMUXER: Príliš mnoho (%d v %d bajtoch) audio paketov v bufferi!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2898,62 +2893,62 @@ msgstr ""
 "\n"
 "DEMUXER: Príliš mnoho (%d v %d bajtoch) video paketov v bufferi!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Nemôžem otvoriť audio prúd: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Nemôžem otvoriť prúd titulkov: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Nemôžem otvoriť audio demuxer: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Nemôžem otvoriť demuxer titulkov: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Nemôžem sa posúvať v surových (raw) .AVI prúdoch! (Potrebujem index, zkuste použíť voľbu -idx!)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "v TV vstupe nie je možné sa pohybovať! (možno posun bude na zmenu kanálov ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Nemôžem sa posúvať v tomto súbore!  \n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Informácie o klipe: \n"
@@ -4071,7 +4066,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Dostupné zmeny plnoobrazovkových módov:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Zvolený videorežim %dx%d pre obraz velkosti %dx%d.\n"
@@ -4523,12 +4518,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "Zlyhalo otvorenie %s\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4727,88 +4722,88 @@ msgstr "Chyba pri výbere VCD stopy!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Zvolený DVD zvukový kanál: %d jazyk: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "DVD zvuk v požadovanom jazyku nebyl nájdený!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Zvolený DVD titulkový kanál: %d jazyk: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "DVD titulky v požadovanom jazyku neboli nájdené!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Nejde otvoriť DVD zariadenie: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "Nedá sa otvoriť VMG info!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Na tomto DVD je %d titulov.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Neplatné číslo DVD titulu: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Na tomto DVD je %d uhlov pohľadov.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Neplatné číslo uhlu pohľadu DVD: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Nemôžem otvoriť súbor IFO pre DVD titul %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Nemôžem otvoriť VOB súbor (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer bol skompilovaný bez podpory DVD, koniec\n"
@@ -5040,12 +5035,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Nemôžem inicializovať knižnicu libsmbclient: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Nemôžem otvoriť z LAN: '%s'\n"
@@ -5521,7 +5516,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/sv.po b/mplayer/po/sv.po
index 172b484..6a93d3c 100644
--- a/mplayer/po/sv.po
+++ b/mplayer/po/sv.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Denna codecs.conf är för gammal och inkompatibel med denna MPlayer ver
 msgid "Chapter: (%d) %s"
 msgstr ""
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr ""
 
@@ -189,211 +189,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr ""
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr ""
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr ""
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr ""
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr ""
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr ""
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr ""
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr ""
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr ""
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr ""
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr ""
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr ""
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr ""
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr ""
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr ""
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr ""
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr ""
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr ""
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr ""
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr ""
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr ""
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr ""
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr ""
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr ""
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr ""
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr ""
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr ""
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr ""
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr ""
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Oförmögen att ladda spellista %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr ""
@@ -549,7 +549,7 @@ msgstr "[Mixer] Ingen volymkontroll tillgänglig.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -621,7 +621,7 @@ msgstr ""
 " * * * LÄS MANUALEN FÖR FLER DETALJER, MER AVANCERADE ARGUMENT OCH KOMMANDON * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -631,7 +631,7 @@ msgstr ""
 "  Det kan vare en bugg i vår nya \"runtime CPU-detection\" kod...\n"
 "  Var god läs DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -643,7 +643,7 @@ msgstr ""
 "  kompilerad/optimerad för\n"
 "  Verifiera detta!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -653,7 +653,7 @@ msgstr ""
 "  Omkompilera MPlayer med '--enable-debug' och kör en \"'gdb' backtrace\" och\n"
 "  deassemblera. Detaljer återfinns i DOCS/HTML/en/bugreports_what.html#bugreports_crash.\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -668,7 +668,7 @@ msgstr ""
 "  kommer inte att hjälpa dig, om du inte kan befodra denna information när \n"
 "  du rapporterar en trolig bugg.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -719,7 +719,7 @@ msgstr ""
 "Om inget av dessa hjälper, läs DOCS/HTML/en/bugreports.html.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -728,7 +728,7 @@ msgstr ""
 "\n"
 "Stänger ner... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -737,97 +737,97 @@ msgstr ""
 "\n"
 "MPlayer var avbruten av signal %d i modul: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Kan inte lokalisera $HOME-katalog.\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") problem\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Skapar konfigfil: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Laddar konfiguration '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Kan inte ladda vald textning: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "SUB: lade till textningsfil %d: %s \n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Fel vid förinitiering av audiofilter!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Kan inte öppna/initiera audioenhet -> inget ljud.\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Kunde inte finna matchande filter/ao-format!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "'Linux RTC' läsfel: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Varning! Softsleep underflow!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Fel vid öppning/initiering av vald video_out-enhet (-vo).\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Kan inte öppna 'libmenu video filter' med rotmeny %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  PAUSE  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Kan inte använda EDL utan video, inaktiverar.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -836,84 +836,84 @@ msgstr ""
 "\n"
 "FATALT: Kunde inte initiera videofilter (-vf) eller video-ut (-vo).\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 "Kompilerad med \"runtime CPU detection\" - VARNING - detta är inte optimalt!\n"
 "För att få bäst prestanda, omkompilera med '--disable-runtime-cpudetection'.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Kompilerad för x86 med tillägg:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Använder standardinbyggd codecs.conf.\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Tillgängliga audiocodec:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Tillgängliga videocodec:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Kommandorad:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Kan inte ladda font: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Misslyckades att öppna %s: %s (den borde vara läsbar av användaren.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "'Linux RTC' initieringsfel i 'ioctl' rtc_irqp_set %lu: %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Försök lägg till \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" till ditt systems uppstartningsscript.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "'Linux RTC init' fel i 'ioctl' [rtc_pie_on]: %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Använder Linux's hårdvaru-RTC-tidtagning (%ldHz).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Meny initierad: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Menyinitiering misslyckades.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "VARNING: getch2_init anropad dubbelt!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -922,77 +922,77 @@ msgstr ""
 "\n"
 "Spelar %s.\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Kan inte öppna EDL-fil [%s] för skrivning.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Kan inte öppna dumpfil.\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Fel vid skrivning till fil.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATALT: Vald ström ej tillgänglig!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: Kan inte läsa inställningar.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS ej specifierad i filhuvudet eller är icke godkänd, använd argument -fps.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Ingen ström funnen.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Audio: inget ljud\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: ingen video\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS forcerad att vara %5.3f  (ftime: %5.3f).\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Påbörjar uppspelning...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1242,28 +1242,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1273,12 +1273,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Kunde inte öppna codec %s, br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Audio LAVC, kunde inte finna encoder för codec %s\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Audio LAVC, kunde inte allokera kontext!\n"
@@ -1877,27 +1877,27 @@ msgstr "[AO SUN] Kan inte öppna audioenhet %s, %s  -> inget ljud.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] audio_setup: ditt kort hanterar inte %d kanaler, %s, %d Hz samplerate.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Tillgängliga audio-ut-drivrutiner:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2111,13 +2111,13 @@ msgstr "Fler exempel på detta format behövs för att vidare öka support. Var
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Kunde inte finna codec '%s' i libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Kunde inte öppna codec.\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Kunde inte stänga codec\n"
@@ -2342,7 +2342,7 @@ msgstr "INFO: 'Win32/DShow'-videocodecinitiering: OK.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2699,7 +2699,7 @@ msgstr "Oförmögen att öppna oggdemuxern.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2707,7 +2707,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2715,108 +2715,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2862,27 +2857,27 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "VARNING: Audioströmsfilhuvud %d omdefinerad.\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Fann audioström: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "WARNING: Videoströmsfilhuvud %d omdefinerad.\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Fann videoström: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2890,7 +2885,7 @@ msgstr ""
 "Kanske försöker du spela upp en icke-interleaved ström/fil, eller så har decodern falierat?\n"
 "För AVI-filer, försök med att forcera icke-interleaved-lägen med -ni argumentet.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2899,7 +2894,7 @@ msgstr ""
 "\n"
 "Allt för många audiopaket i bufferten: (%d i %d byte).\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2908,62 +2903,62 @@ msgstr ""
 "\n"
 "Allt för många videopaket i bufferten: (%d i %d byte).\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Kan inte öppna audioström: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Kan inte öppna textningsström: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Misslyckades att öppna audiodemuxern: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Misslyckades att öppna textningsdemuxern: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Kan inte söka i råa AVI-strömmar. (Index krävs, försök med '-idx'-switchen.)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV-in är inte sökbar! (Sökning kommer troligen bli för att ändra kanal ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Kan inte söka i denna fil.\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Clip-info:\n"
@@ -4081,7 +4076,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Tillgängliga lägen för fullskärmslager:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4533,12 +4528,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4737,88 +4732,88 @@ msgstr "Fel vid val av VCD-spår."
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Kunde inte öppna DVD-enhet: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Det är %d titlar på denna DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Icke godkänt DVD-titelnummer: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Det är %d vinkar på denna DVD-titel.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Ej godkänd DVD-vinkelsnummer: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Kan inte öppna IFO-fil för DVD-titel %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Kunde inte öppna titel VOBS (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5050,12 +5045,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "Kan inte initiera libsmbclient-bilioteket: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Kunde inte öppna från LAN: '%s'\n"
@@ -5531,7 +5526,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/tr.po b/mplayer/po/tr.po
index 3aa2093..9106c23 100644
--- a/mplayer/po/tr.po
+++ b/mplayer/po/tr.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Bu codecs.conf dosyası çok eski ve bu Mplayer sürümü ile bağdaşm
 msgid "Chapter: (%d) %s"
 msgstr "Kısım: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "bilinmeyen"
 
@@ -189,213 +189,213 @@ msgstr "Açı: %d/%d"
 msgid "enabled (EDL)"
 msgstr "etkin(edl)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "etkisiz"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "etkin"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "sabit"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "dosya"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "gömülü"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "üst"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "orta"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "alt"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Döngü: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Ses"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr " Sessiz: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V gecikmesi: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Ses: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Denge"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Yanaltarama"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Ãœstte kalma: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Ana pencere: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Kenar: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Atlanan kare: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gama"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Parlaklık"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Karşıtlık"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Doygunluk"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Renk"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "VSync: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Altyazılar: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Altyazı kaynağı: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Altyazı konumu: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Altyazı hizalama: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Altyazı gecikmesi: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Sadece zorunlu altyazı:  %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Altyazı ölçeği: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr ""
 "EDL atlaması başlangıcı, bloğu bitirmek için\n"
 "'i' tuşuna tekrar basın.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "EDL atlaması iptal edildi, son başlama > duruş\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "EDL atlaması sonu, satır yazıldı.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Altyazı gecikmesi: %d ms"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -404,7 +404,7 @@ msgstr ""
 "\n"
 "%s çalma listesi yüklenemedi.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Kanal: %s"
@@ -556,7 +556,7 @@ msgstr "[Karıştırıcı] Kullanılabilir ses kontrolü yok.\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[Karıştırıcı] Kullanılabilir denge kontrolü yok.\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -628,7 +628,7 @@ msgstr ""
 " * * AYRINTILAR, DAHA FAZLA (GELİŞMİŞ) SEÇENEKLER VE TUŞLAR İÇİN MAN SAYFALARINA BAKINIZ * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  Yeni runtime CPU-detection kodlarımızda bir hata olabilir...\n"
 "  Lütfen DOCS/HTML/en/bugreports.html sayfasını okuyunuz.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -650,7 +650,7 @@ msgstr ""
 "  MPlayer'ı çalıştırdığınızda bu hata oluşur.\n"
 "  Bunu doğrulayın!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -660,7 +660,7 @@ msgstr ""
 " Mplayer'ı --enable-debug seçeneğiyle yeniden derleyiniz. Bir 'gdb' backtrace ve\n"
 " disassembly oluşturunuz. Ayrıntılar için DOCS/HTML/en/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -674,7 +674,7 @@ msgstr ""
 "  ve yönergeleri izleyiniz. Muhtemel bir hata bildirirken bu bilgileri sağlayamazsanız \n"
 "  yardım edemeyiz ve etmeyeceğiz.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -726,7 +726,7 @@ msgstr ""
 "Bunların hiçbirisi size yardım etmiyorsa DOCS/HTML/en/bugreports.html sayfasını okuyunuz.\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -735,7 +735,7 @@ msgstr ""
 "\n"
 "Çıkılıyor... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -744,97 +744,97 @@ msgstr ""
 "\n"
 "MPlayer %d sinyali tarafından kapatıldı, modül: %s\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Anadizin(HOME) bulunamıyor\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") problemi\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Ayar dosyası oluşturuluyor: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Protokole bağlı profil yükleniyor '%s'\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Uzantıya bağlı profil yükleniyor '%s'\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "'%s' ayarı yükleniyor\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Altyazı açılamıyor: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "ALTYAZI: (%d) altyazı dosyası eklendi : %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Ses filtresi zincirinde başlama öncesi hata!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "Ses aygıtı açılamadı/başlatılamadı -> ses yok\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "filter/ao biçimi eşleşmesi bulunamadı!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux RTC okuma hatası: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Uyarı! softsleep underflow!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Video çıkış (-vo) aygıtı açılış/başlatma hatası!\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "%s root menüsü ile libmenu video filtresi açılamaz.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "--------   DURAKLADI   --------"
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Video olmadan EDL kullanılamaz, devredışı bırakılıyor.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -843,82 +843,82 @@ msgstr ""
 "\n"
 "HATA: Video filtreleri (-vf) veya video çıkışı (-vo) başlatılamadı!\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "MPlayer runtime CPU detection ile derlendi.\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "x86 işlemci için uzantılarla derlendi:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Gömülü codecs.conf dosyası kullanılıyor\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Kullanılabilir ses kodekleri:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Kullanılabilir video kodekleri:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "KomutSatırı:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Yazıtipi açılamıyor: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "%s dosyası açılamadı: %s (kullanıcı için okunabilir olmalı)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "ioctl'de Linux RTC açılış hatası  (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "\"echo %lu > /proc/sys/dev/rtc/max-user-freq\" seçeneğini sistem açılış betiklerine eklemeyi deneyiniz.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "ioctl'de Linux RTC açılış hatası (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Linux donanım RTC zamanlaması kullanılıyor(%ldHz)\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Menü başlatıldı: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr " Menü başlatılamadı.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "UYARI:getch2_init iki defa çağırıldı!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -927,77 +927,77 @@ msgstr ""
 "\n"
 "%s oynatılıyor\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Yazma esnasında [%s] EDL dosyası açılamaz.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "döküm(dump) dosyası açılamıyor!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: dosya yazma hatası.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "döküm: HATA:seçili yayın(stream) hatalı!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Video: Özellikler okunamıyor\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] filefmt:%d  fourcc:0x%X  boyut:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Başlıktaki FPS belirsiz veya geçersiz, -fps seçeneğini kullanınız!\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Yayın(stream) bulunamadı\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Ses: ses yok!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Video: video yok!!!\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS  %5.3f olarak zorlandı (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Çalma başlatılıyor...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1251,28 +1251,28 @@ msgstr "kullanılabilir etiketler"
 msgid "Couldn't find label in plugin library."
 msgstr "Ekyazılım(plugin) kütüphanesinde etiket bulunamadı."
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "Altseçenek belirlenmedi"
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "Kütüphane dosyası belirlenmedi"
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "Filtre etiketi belirlenmedi"
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "Komut satırında tanımlı kontroller yeterli değil"
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: #%d girdi denetimi %0.4f alt sınırının altında.\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: #%d girdi denetimi %0.4f üst sınırının üstünde.\n"
@@ -1282,12 +1282,12 @@ msgstr "%s: #%d girdi denetimi %0.4f üst sınırının üstünde.\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "%s kodeği açılamadı br=%d\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "LAVC Sesi,  %s kodek türü için kodlayıcı bulunmadı.\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "LAVC Sesi,  içerik atanamadı!\n"
@@ -1896,27 +1896,27 @@ msgstr "[AO SUN] %s ses aygıtı açılamıyor, %s  -> ses yok.\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] ses_kurulumu: ses kartınız %d kanalını, %s, %d Hz  örnekleme oranını desteklemiyor.\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Kullanılabilir ses çıktı sürücüleri:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2130,13 +2130,13 @@ msgstr "Bu şekildeki örnekler için geliştirme desteği gerekiyor. Lütfen ge
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr " '%s' kodeği libavcodec içinde bulunamadı...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "kodek açılamadı\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "kodek kapatılamadı\n"
@@ -2363,7 +2363,7 @@ msgstr "BİLGİ: Win32/Dshow video kodek açılışı tamam.\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] QP'nin aritmetik karşılığı : %2.4f, QP'nin harmonik karşılığı: %2.4f\n"
@@ -2726,7 +2726,7 @@ msgstr "ogg ayrıştırıcısı açılamadı\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "tampon_doyum hatası: hatalı ayrıştırıcı: vd değil, ad veya sd.\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2734,7 +2734,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2742,29 +2742,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] zlib başlatması başarısız.\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] zlib çıkarması başarısız.\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] lzo çıkarması başarısız.\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2773,19 +2773,19 @@ msgstr ""
 "[mkv] %u numaralı parça şifrelenmiş ve şifre çözümü henüz\n"
 "[mkv] içeriğe alnmamış. Parça atlanıyor.\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] %u numaralı parça için bilinmeyen içerik şifrelemesi. Parça atlanıyor.\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2794,22 +2794,22 @@ msgstr ""
 "[mkv] %u numaralı parça zlib ile sıkıştırılmış fakat mplayer henüz derlenmemiş zlib sıkıştırma desteğiyle\n"
 "[mkv]. Parça atlanıyor.\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] Parça ID %u: %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] Parça ID %u: %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2818,12 +2818,12 @@ msgstr ""
 "[mkv] Bilinmeyen/desteklenmeyen CodecID (%s) veya eksik/bozuk CodecPrivate\n"
 "[mkv] verisi (parça %u).\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] FLAC parçası geçerli başlıklar içermiyor.\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2832,26 +2832,21 @@ msgstr ""
 "[mkv] Bilinmeyen/desteklenmeyen ses kodeği ID '%s', %u numaralı parça için   veya eksik/hatalı\n"
 "[mkv] özel kodek verisi.\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] '%s' altyazı türü desteklenmiyor.\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] %u numaralı görüntü parçası çalınacak.\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] Hiçbir görüntü parçası bulunmadı/istenmedi.\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] Hiçbir ses parçası bulunmadı/istenmedi.\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2897,27 +2892,27 @@ msgstr "Ekyazılım(plugin) kapatılıyor: %s.\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "XMMS ekyazılımının(plugin) şunu çalmaya başlaması bekleniyor: '%s'...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "UYARI: Ses yayın başlığı %d tekrar tanımlandı!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Bulunan Ses Yayını: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "UYARI: Video yayın başlığı %d tekrar tanımlandı!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Bulunan Video Yayını: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2925,7 +2920,7 @@ msgstr ""
 "Boşluksuz AVI yayını/dosyası oynatıyor olabilirsiniz veya kodek hatalı?\n"
 "AVI dosyaları için -ni seçeneğiyle boşluksuz modu zorlamayı deneyiniz.\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2934,7 +2929,7 @@ msgstr ""
 "\n"
 "AYRIŞTIRICI: Tamponda birçok (%d - %d baytta) ses paketi var!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2943,62 +2938,62 @@ msgstr ""
 "\n"
 "AYRIŞTIRICI: Tamponda birçok  (%d - %d baytta) video paketi var!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Ses yayını açılamıyor: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Altyazı yayını açılamıyor: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Ses ayrıştırıcısı açılamadı: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Altyazı ayrıştırıcısı açılamadı: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Raw AVI yayınında aranamıyor! (İndeks zorunlu, -idx  komutuyla deneyiniz!)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV girdisi aranabilir değil! (Muhtemelen arama kanal değiştirmek için yapılacak ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Bu dosyada aranamıyor!  \n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Klip bilgisi: \n"
@@ -4169,7 +4164,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Kullanılabilir tamekran değiştirme modları:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: Seçili video modu %dx%d:  %dx%d görüntü boyutuna göre. \n"
@@ -4632,12 +4627,12 @@ msgstr "Sunucu dönüşü %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "Önbellek boyutu %d KBayt olarak ayarlanıyor.\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "%s açılamadı\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4836,88 +4831,88 @@ msgstr "VCD seçilirken hata!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE yayın_açık, dosya adı=%s, parça =%d, mevcut parçalar: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "Seçili DVD ses kanalı: %d dil: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "DVD seslendirme dil eşlemi bulunamadı!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "Seçili DVD altyazı kanalı: %dil: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "DVD altyazı dil eşlemi bulunamadı!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "DVD sürücüsü açılamadı: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "VMG info açılamıyor!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Bu DVD üzerinde %d tane başlık var.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Geçersiz DVD başlık numarası: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Bu DVD başlığında %d angle var.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Yanlış DVD angle numarası: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "DVD Başlığı için IFO dosyası açılamıyor %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "VOBS Başlığı açılamıyor (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "Ses akımı: %d biçim: %s (%s) dil: %s yardım: %d.\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "DVD'de bulunan ses kanalları: %d.\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "Altyazı ( sid ): %d dil: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "DVD'de bulunan altyazılaır: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "Mplayer DVD desteği olmadan derlendi, çık\n"
@@ -5151,12 +5146,12 @@ msgstr "[radio] %.2f: Frekansı kullanılıyor\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] %s: stream_enable_cache çağrısı başarılamadı.\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "libsmbclient kütüphanesi başlatılamadı: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Yerel ağdan açılamadı: '%s'\n"
@@ -5642,7 +5637,7 @@ msgstr "tvi_dshow: Örnekleme-oranı %d aygıt tarafından desteklenmiyor. İlk
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "%c%c1%c2 url_atlamasında dizgi zaten atlatılmış görünüyor.\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/uk.po b/mplayer/po/uk.po
index 5c16680..77336ff 100644
--- a/mplayer/po/uk.po
+++ b/mplayer/po/uk.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "Цей codecs.conf застарий та несумісний із ци
 msgid "Chapter: (%d) %s"
 msgstr "Розділ: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "невідомий"
 
@@ -189,211 +189,211 @@ msgstr "Кут: %d/%d"
 msgid "enabled (EDL)"
 msgstr "увімкнено (EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "вимкнено"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "увімкнено"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "інтенсивний"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "файл"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "vobsub"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "вкладено"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "верх"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "центр"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "низ"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "Повтор: %s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "Гучність"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "Вимкнути звук: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V затримка: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "Аудіо: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "Баланс"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "Зріз сторін"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "Звурху інших: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "Вікно-root: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "Рамка: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "Пропуск кадрів: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Гамма"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "Яскравість"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "Контраст"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "Насиченість"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "Колір"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "Вертикальна синхронізація: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "Субтитри: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "Субтитри з: %s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "Позиція субтитрів: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "Вирівнювання субтитрів: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "Затримка субтитрів: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "Форсувати тільки субтитри: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "Масштаб субтитрів: %s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "Старт EDL пропуску, натисніть 'i' знов, щоб завершити блок.\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "Ігнорування EDL відмінено, останній start > stop\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "Кінець EDL пропуску, рядок записано.\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "Затримка субтитрыв: %d мс"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "Неможливо завантажити playlist %s.\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "Канал: %s"
@@ -556,7 +556,7 @@ msgstr ""
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -628,7 +628,7 @@ msgstr ""
 " * * * ДЕТАЛЬНІШЕ ДИВ. ДОКУМЕНТАЦІЮ, ПРО ДОДАТКОВІ ОПЦІЇ І КЛЮЧІ! * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  Може бути помилка у вашому новому коду визначення типу CPU...\n"
 "  Будь-ласка перегляньте DOCS/HTML/en/bugreports.html.\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -650,7 +650,7 @@ msgstr ""
 "  був зібраний/оптимізований.\n"
 "  Перевірте!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -660,7 +660,7 @@ msgstr ""
 "  Зберіть знову MPlayer з --enable-debug а зробіть 'gdb' backtrace та\n"
 "  дизасемблювання. Для довідок, перегляньте DOCS/HTML/en/bugreports_what.html#bugreports_crash\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -674,7 +674,7 @@ msgstr ""
 "  DOCS/HTML/en/bugreports.html та слідкуєте інструкціям. Ми можемо\n"
 "  допомогти лише у разі забезпечення інформація коли доповідаєте про помилку.\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -722,7 +722,7 @@ msgstr ""
 "Якщо нічого не допомогло, тоді читайте DOCS/HTML/en/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -731,7 +731,7 @@ msgstr ""
 "\n"
 "Виходимо... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -740,97 +740,97 @@ msgstr ""
 "\n"
 "MPlayer перерваний сигналом %d у модулі: %s \n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "Не можу знайти домашній каталог\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "проблеми у get_path(\"config\")\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "Створення файлу конфігурації: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "Завантаження профілю для протоколу '%s'\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "Завантаження профілю для розширення '%s'\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "Завантаження конфігурації '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "Не можу завантажити субтитри: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "СУБТИТРИ: Додано файл субтитрів (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "Помилка у ланці pre-init аудіо фільтру!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "не можу відкрити/ініціалізувати аудіо пристрій -> ГРАЮ БЕЗ ЗВУКУ\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "Не можу знайти потрібний фільтр/формат аудіовиводу!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Помилка читання Linux RTC: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "Попередження! Недупустиме низьке значення затримки програми!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "Помилка відкриття/ініціалізації вибраного video_out (-vo) пристрою.\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "Не можу відкрити відео фільтр libmenu з цим кореневим меню %s.\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  ПАУЗА  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "Не можу використати EDL без відео, вимикаю.\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -839,84 +839,84 @@ msgstr ""
 "\n"
 "FATAL: Неможливо ініціалізувати відео фільтри (-vf) або відео вивід (-vo).\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr ""
 "Скомпільвано з автовизначенням CPU - УВАГА - це не оптимально!\n"
 "Для отримання кращих результатів перекомпілюйте MPlayer з --disable-runtime-cpudetection\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "Скомпільовано для x86 CPU з розширеннями:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "Використовую вбудований codecs.conf\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "Доступні аудіо кодеки:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "Доступні відео кодеки:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "Командний рядок:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "Не можу завантажити шрифт: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "Не можу відкрити %s: %s (користувач повинен мати права читання для файлу.)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Помилка ініцілізації Linux RTC у ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "Спробуйте додати \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" до скриптів запуску системи.\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Помилка ініціалізації Linux RTC у ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "Використовую апаратний таймер RTC (%ldГц).\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "Меню ініціалізовано: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "Ініціалізація меню невдале.\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "ПОПЕРЕДЖЕННЯ: getch2_init визвано двічі!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -925,77 +925,77 @@ msgstr ""
 "\n"
 "Програвання %s\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "Не може відкрити EDL файл [%s] для запису.\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "Не можу відкрити файл дампу!!!\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: Помилка запису файлу.\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "dump: FATAL: обраний потік загублений!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "Відео: Неможливо отримати властивості.\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr ""
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "Не вказано чи невірна кількість кадрів, застосуйте опцію -fps.\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "Потік не знайдено.\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "Аудіо: без звуку!!!\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "Відео: без відео\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "Примусово змінена кількість кадрів на секунду на %5.3f (ftime: %5.3f)\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "Початок програвання...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1245,28 +1245,28 @@ msgstr ""
 msgid "Couldn't find label in plugin library."
 msgstr ""
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr ""
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr ""
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr ""
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr ""
@@ -1276,12 +1276,12 @@ msgstr ""
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "Не можу відкрити кодек %s, br=%d.\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "Аудіо LAVC, не можу знайти кодувальщик для кодека %s.\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "Аудіо LAVC, не можу розмістити контекст!\n"
@@ -1870,27 +1870,27 @@ msgstr ""
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr ""
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "Доступні модулі аудіо виводу:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2104,13 +2104,13 @@ msgstr ""
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "Не можу знайти кодек \"%s\" у libavcodec...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "Не зміг відкрити кодек\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "Не зміг закрити кодек\n"
@@ -2332,7 +2332,7 @@ msgstr ""
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr ""
@@ -2691,7 +2691,7 @@ msgstr "Неможливо відкрити ogg demuxer.\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2699,7 +2699,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2707,108 +2707,103 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
 "[mkv] with support for zlib compression. Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
 "[mkv] data (track %u).\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
 "[mkv] private codec data.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr ""
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2854,33 +2849,33 @@ msgstr ""
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "Попередження! Заголовок аудіо потоку %d перевизначений!\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> Знайдено аудіо потік: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "Попередження! Заголовок відео потоку %d перевизначений!\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> Знайдено відео потік: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
 msgstr "(можливо ви програєте неперемежений потік/файл або невдалий кодек)\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2889,7 +2884,7 @@ msgstr ""
 "\n"
 "DEMUXER: Надто багато (%d, %d байтів) аудіо пакетів у буфері!\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2898,62 +2893,62 @@ msgstr ""
 "\n"
 "DEMUXER: Надто багато (%d, %d байтів) відео пакетів у буфері!\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "Неможливо відкрити аудіо потік: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "Неможливо відкрити потік субтитрів: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "Не вдалося відкрити аудіо demuxer: %s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "Не вдалося відкрити demuxer субтитрів: %s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "Не можу переміститися у непроіндексованому потоці .AVI! (вимагається індекс, спробуйте з ключом -idx!)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "Не можу переміщуватися у цьому файлі!\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "Інформація кліпу:\n"
@@ -4107,7 +4102,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "Доступні варіанти повноекранного відеорежиму:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr ""
@@ -4561,12 +4556,12 @@ msgstr ""
 msgid "Cache size set to %d KBytes\n"
 msgstr ""
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr ""
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4765,88 +4760,88 @@ msgstr "Помилка вибору треку на VCD!"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr ""
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "Не зміг відкрити DVD: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr ""
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "Є %d доріжок з титрами на цьому DVD.\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "Неприпустимий номер доріжки титрів на DVD: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "Є %d кутів на цій доріжці з DVD титрами.\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "Неприпустимий номер DVD кута: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "Не можу відкрити IFO файл для DVD титрів %d.\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "Не можу відкрити титри VOBS (VTS_%02d_1.VOB).\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr ""
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr ""
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr ""
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr ""
@@ -5078,12 +5073,12 @@ msgstr ""
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr ""
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr ""
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "Помилка відкриття з мережі: '%s'\n"
@@ -5559,7 +5554,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr ""
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/zh_CN.po b/mplayer/po/zh_CN.po
index 67f0acb..360864d 100644
--- a/mplayer/po/zh_CN.po
+++ b/mplayer/po/zh_CN.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "此 codecs.conf 太旧,与当前发布的 MPlayer 版本不兼容!"
 msgid "Chapter: (%d) %s"
 msgstr "章节:(%d)%s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "未知"
 
@@ -189,211 +189,211 @@ msgstr "视角:%d/%d"
 msgid "enabled (EDL)"
 msgstr "已启用(EDL)"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "已停用"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "已启用"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "强制丢帧"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr "字幕文件"
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr "VOBSUB"
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr "附带字幕"
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "顶部"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "中部"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "底部"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr "循环模式:%s"
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "音量"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "静音:%s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V 延迟: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "音频:%s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr "均衡"
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "全景模式"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "保持在前面:%s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "根窗口:%s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "边框:%s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "丢帧:%s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr "解除隔行扫描:%s"
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "伽玛值"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "亮度"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "对比度"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "饱和度"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "色调"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "垂直刷新同步:%s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "字幕:%s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr "字幕来源:%s"
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "字幕位置:%s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "字幕对齐方式:%s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "字幕延迟:%s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "只用强制使用的字幕:%s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr "字幕缩放:%s"
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "开始 EDL 跳跃,再按键‘i’以指定跳过内容的结尾。\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "取消 EDL 跳跃,上一个开始位置 > 停止位置\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "结束 EDL 跳跃,文本行已写入。\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "字幕延迟:%d 毫秒"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD:%s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "无法装载播放列表 %s\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "频道:%s"
@@ -556,7 +556,7 @@ msgstr "[混音器] 没有可用的音量控制器。\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr "[混音器] 没有可用的均衡控制器。\n"
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -628,7 +628,7 @@ msgstr ""
 " * * * 参见手册相关页面可获取具体内容,及更多(高级)选项和控制键的信息 * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  这可能是我们新的实时 CPU 侦测代码中的一个缺陷...\n"
 "  请阅读 DOCS/zh/bugreports.html。\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -650,7 +650,7 @@ msgstr ""
 "  编译/优化时所针对的 CPU 不同时发生。\n"
 "  检查是否如此!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -660,7 +660,7 @@ msgstr ""
 "  使用 --enable-debug 重新编译 MPlayer 并建立“gdb”反跟踪和\n"
 "  反汇编输出。具体细节见 DOCS/zh/bugreports.html#crash。\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -674,7 +674,7 @@ msgstr ""
 "  并遵循其中的指示去做。除非你在报告一个潜在的缺陷时候提供我们\n"
 "  所需要的信息,否则我们不能也不会帮助你。\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -725,7 +725,7 @@ msgstr ""
 "如果这些一个都帮不了你,请阅读 DOCS/zh/bugreports.html。\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -734,7 +734,7 @@ msgstr ""
 "\n"
 "正在退出...(%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -743,97 +743,97 @@ msgstr ""
 "\n"
 "MPlayer 被 %d 信号中断(位于 %s 模块)\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "找不到 HOME 目录\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") 调用出现问题\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "创建配置文件:%s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr "加载协议相关的配置集‘%s’\n"
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr "加载扩展组件相关的配置集‘%s’\n"
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "正在加载配置 '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "不能加载字幕:%s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "字幕:添加字幕文件(%d):%s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "音频过滤器链预初始设置错误!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "不能打开/初始设置音频设备 -> 禁用声音。\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "没找到匹配的过滤器/音频输出格式!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux RTC 读取错误:%s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "警告!Softsleep 数值下溢!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "打开/初始设置所选的(-vo)视频输出设备出错。\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "不能用根菜单 %s 打开 libmenu 视频过滤器。\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  暂停  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "无视频流时无法使用 EDL,禁用该功能。\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -842,82 +842,82 @@ msgstr ""
 "\n"
 "致命错误:无法初始设置视频过滤器(-vf)或视频输出(-vf)。\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "编译时包含了实时 CPU 类型检测。\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "编译时针对 x86 CPU 扩展指令集优化:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "使用内建默认的 codecs.conf 文件。\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "可用的音频编解码器:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "可用的视频编解码器:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "命令行:"
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "不能加载位图字体:%s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "未能打开 %s:%s(用户应当有权限读取该设备。)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "ioctl (rtc_irqp_set %lu) 中出现 Linux RTC 初始设置错误:%s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "尝试添加 \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" 到你的系统启动脚本中。\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "ioctl (rtc_pie_on) 中出现 Linux RTC 初始置错误:%s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "使用 Linux 的硬件 RTC 计时(%ldHz)。\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "菜单已初始设置:%s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "菜单初始设置失败。\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "警告:getch2_init 被两次调用!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -926,77 +926,77 @@ msgstr ""
 "\n"
 "正在播放 %s。\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "无法打开并写入 EDL 文件 [%s]。\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "打不开内存转储文件。\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s:写入文件出错。\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "内存转储:致命错误:指定的媒体流不存在!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "视频:无法读取视频属性\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] 文件格式:%d  fourcc代码:0x%X  大小:%dx%d  帧速:%5.3f  每帧时长:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS 在文件头中没有指定或者无效,请使用 -fps 选项。\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "找不到流。\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "音频:没有音轨\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "视频:没有视频流\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS 强制设为 %5.3f(ftime:%5.3f)。\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "开始播放...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1248,28 +1248,28 @@ msgstr "可用标签"
 msgid "Couldn't find label in plugin library."
 msgstr "未能在插件库里找到标签。"
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "未指定子选项。"
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "未指定库文件。"
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "未指定过滤器标签。"
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "命令行中指定的控件不足。"
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s:输入控件 #%d 低于下限 %0.4f。\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s:输入控件 #%d 高于上限 %0.4f。\n"
@@ -1279,12 +1279,12 @@ msgstr "%s:输入控件 #%d 高于上限 %0.4f。\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "无法打开编解码器 %s,br=%d。\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "音频 LAVC,无法找到编解码器 %s 对应的编码器。\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "音频 LAVC,无法分配运行环境!\n"
@@ -1893,27 +1893,27 @@ msgstr "[AO SUN] 无法打开音频设备 %s,%s  -> nosound。\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] 音频设置:你的声卡不支持 %d 声道,%s,%d Hz 采样率。\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "可用的音频输出驱动:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr "尝试使用偏好的音频驱动‘%.*s’,选项设为‘%s’\n"
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr "未能初始设置音频驱动‘%s’\n"
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr "无此音频驱动‘%.*s’\n"
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr "尝试每个已知的音频驱动...\n"
@@ -2127,13 +2127,13 @@ msgstr "需要该格式的编码样本以优化相关技术支持。有意请联
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "无法在 libavcodec 中找到解码器‘%s’...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "无法打开解码器。\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "无法关闭解码器。\n"
@@ -2361,7 +2361,7 @@ msgstr "信息: Win32/DShow 视频编解码器初始化成功。\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] QP 的算术平均值: %2.4f, QP 的调和平均值: %2.4f\n"
@@ -2722,7 +2722,7 @@ msgstr "无法打开 Ogg 流分离器。\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "fill_buffer 错误:流分解器错误:非 vd、ad 或 sd。\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2730,7 +2730,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2738,48 +2738,48 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] zlib 初始设置失败。\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] zlib 解压失败。\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] lzo 解压失败。\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
 "[mkv] implemented. Skipping track.\n"
 msgstr "[mkv] 轨道 %u 已加密,但解密还未实现。跳过该轨道。\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] 轨道 %u 内容的编码类型未知。跳过该轨道。\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2788,22 +2788,22 @@ msgstr ""
 "[mkv] 轨道 %u 已经 zlib 压缩,但 mplayer 未以支持 zlib 压缩\n"
 "[mkv] 选项编译。跳过该轨道。\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] 轨道 ID %u:%s (%s) \"%s\",%s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] 轨道 ID %u:%s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2812,12 +2812,12 @@ msgstr ""
 "[mkv] 未知的/不支持的编解码器 ID(%s),也可能是编解码器私有数据\n"
 "[mkv] 缺少/损坏(轨道 %u)。\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] FLAC 轨道未含有效的头部信息。\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2826,26 +2826,21 @@ msgstr ""
 "[mkv] 未知/不支持的音频编解码器 ID‘%s’(轨道 %u),也可能是编解码器\n"
 "[mkv] 私有数据缺少/损坏。\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] 未支持字幕类型‘%s’。\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] 将播放视频轨道 %u。\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] 未找到/不需要视频轨道。\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] 未找到/不需要音频轨道。\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2891,27 +2886,27 @@ msgstr "关闭插件:%s。\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr "等待 XMMS 插件开始播放‘%s’...\n"
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "警告:重复定义了音频流头部 %d。\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> 找到音频流:%d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "警告: 重复定义了视频流头部 %d。\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> 找到视频流:%d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2919,7 +2914,7 @@ msgstr ""
 "可能播放了一个非交错合并的媒体流/文件,或者是编解码运行失败?\n"
 "对于 AVI 文件,可尝试用 -ni 选项强制使用非交错模式。\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2928,7 +2923,7 @@ msgstr ""
 "\n"
 "缓冲中音频包太多(%d 个包存在于 %d 字节中)。\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2937,62 +2932,62 @@ msgstr ""
 "\n"
 "缓冲中视频包太多(%d 个包存在于 %d 字节中)。\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "无法打开音频流:%s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "无法打开字幕流:%s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "未能打开音频分离器:%s\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "未能打开字幕流分离器:%s\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "无法在原生的 AVI 流中定位。(需要索引信息,请尝试使用 -idx 选项。)\n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "电视信号输入无法定位!(定位功能可能应该用于更换频道)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "无法在此文件中定位。\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "媒体剪辑信息:\n"
@@ -4164,7 +4159,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "可用的全屏图层变换模式:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM:已选择视频模式 %dx%d(图像大小 %dx%d)。\n"
@@ -4627,12 +4622,12 @@ msgstr "服务器返回 %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "缓存大小设为 %d K字节\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "未能打开 %s。\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4831,88 +4826,88 @@ msgstr "选择 VCD 轨迹出错。"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open, filename=%s, track=%d, 可用音轨: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "已选 DVD 音频通道: %d 语言: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "未找到匹配的 DVD 音频语言!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "已选 DVD 字幕通道: %d 语言: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "未找到匹配的 DVD 字幕语言!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "无法打开 DVD 设备:%s(%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "打不开 VMG 信息!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "此 DVD 有 %d 个标题。\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "无效的 DVD 标题号: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "此 DVD 标题有 %d 个视角。\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "无效的 DVD 视角号: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "打不开 DVD 标题 %d 的 IFO 文件。\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "打不开标题的 VOBS (VTS_%02d_1.VOB)。\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "音频流: %d 格式: %s (%s) 语言: %s aid: %d。\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "盘上的音频通道数: %d。\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "字幕号(sid): %d 语言: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "盘上的字幕数: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer 编译成不支持 DVD,退出中。\n"
@@ -5144,12 +5139,12 @@ msgstr "[radio] 使用频率: %.2f。\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] 调用 stream_enable_cache 失败: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "无法初始化 libsmbclient 库: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "无法打开局域网内的: '%s'\n"
@@ -5634,7 +5629,7 @@ msgstr "tvi_dshow:设备不支持 %d 采样率。退回到第一个可用的
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "字符串似乎已经经过 url_escape %c%c1%c2 换码了。\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/po/zh_TW.po b/mplayer/po/zh_TW.po
index 7f2f800..2a89eb2 100644
--- a/mplayer/po/zh_TW.po
+++ b/mplayer/po/zh_TW.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-25 00:43+0200\n"
+"POT-Creation-Date: 2011-04-21 08:57+0300\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -175,8 +175,8 @@ msgstr "此 codecs.conf 太舊,與當前的 MPlayer 不兼容!"
 msgid "Chapter: (%d) %s"
 msgstr "章節: (%d) %s"
 
-#: command.c:542 command.c:959 command.c:1031 command.c:1579 command.c:1585
-#: command.c:1588 command.c:1605 libmpdemux/demuxer.c:1394
+#: command.c:542 command.c:959 command.c:1031 command.c:1575 command.c:1581
+#: command.c:1584 command.c:1601 libmpdemux/demuxer.c:1389
 msgid "unknown"
 msgstr "未知"
 
@@ -189,211 +189,211 @@ msgstr ""
 msgid "enabled (EDL)"
 msgstr "已啟用 EDL"
 
-#: command.c:956 command.c:1028 command.c:1333 command.c:1608 command.c:1755
-#: command.c:1846 command.c:2966 m_property.c:269
+#: command.c:956 command.c:1028 command.c:1329 command.c:1604 command.c:1751
+#: command.c:1842 command.c:2962 m_property.c:269
 msgid "disabled"
 msgstr "已停用"
 
-#: command.c:1212
+#: command.c:1208
 #, c-format
 msgid "Capturing not enabled (forgot -capture parameter?)\n"
 msgstr ""
 
-#: command.c:1224
+#: command.c:1220
 #, c-format
 msgid "Error opening capture file: %s\n"
 msgstr ""
 
-#: command.c:1331 command.c:2965 m_property.c:269
+#: command.c:1327 command.c:2961 m_property.c:269
 msgid "enabled"
 msgstr "已啟用"
 
-#: command.c:1332
+#: command.c:1328
 msgid "hard"
 msgstr "强丢幀"
 
-#: command.c:1746
+#: command.c:1742
 msgid "file"
 msgstr ""
 
-#: command.c:1749
+#: command.c:1745
 msgid "vobsub"
 msgstr ""
 
-#: command.c:1752
+#: command.c:1748
 msgid "embedded"
 msgstr ""
 
-#: command.c:1916
+#: command.c:1912
 msgid "top"
 msgstr "頂部"
 
-#: command.c:1916
+#: command.c:1912
 msgid "center"
 msgstr "中部"
 
-#: command.c:1916
+#: command.c:1912
 msgid "bottom"
 msgstr "底部"
 
-#: command.c:2394
+#: command.c:2390
 #, c-format
 msgid "Loop: %s"
 msgstr ""
 
-#: command.c:2396
+#: command.c:2392
 #, c-format
 msgid "Capturing: %s"
 msgstr ""
 
-#: command.c:2399
+#: command.c:2395
 #, c-format
 msgid "Speed: x %6s"
 msgstr ""
 
-#: command.c:2401 sub/sub.c:77
+#: command.c:2397 sub/sub.c:77
 msgid "Volume"
 msgstr "音量"
 
-#: command.c:2402
+#: command.c:2398
 #, c-format
 msgid "Mute: %s"
 msgstr "靜音: %s"
 
-#: command.c:2403
+#: command.c:2399
 #, c-format
 msgid "A-V delay: %s"
 msgstr "A-V 延遲: %s"
 
-#: command.c:2404
+#: command.c:2400
 #, c-format
 msgid "Audio: %s"
 msgstr "音頻: %s"
 
-#: command.c:2405 sub/sub.c:80
+#: command.c:2401 sub/sub.c:80
 msgid "Balance"
 msgstr ""
 
-#: command.c:2407
+#: command.c:2403
 msgid "Panscan"
 msgstr "摇移"
 
-#: command.c:2408
+#: command.c:2404
 #, c-format
 msgid "Stay on top: %s"
 msgstr "總在最前: %s"
 
-#: command.c:2409
+#: command.c:2405
 #, c-format
 msgid "Rootwin: %s"
 msgstr "根窗口: %s"
 
-#: command.c:2410
+#: command.c:2406
 #, c-format
 msgid "Border: %s"
 msgstr "邊框: %s"
 
-#: command.c:2411
+#: command.c:2407
 #, c-format
 msgid "Framedropping: %s"
 msgstr "丢幀: %s"
 
-#: command.c:2412
+#: command.c:2408
 #, c-format
 msgid "Deinterlace: %s"
 msgstr ""
 
-#: command.c:2413
+#: command.c:2409
 #, c-format
 msgid "YUV colorspace: %s"
 msgstr ""
 
-#: command.c:2414
+#: command.c:2410
 msgid "Gamma"
 msgstr "Gamma"
 
-#: command.c:2415 command.c:2435 sub/sub.c:78
+#: command.c:2411 command.c:2431 sub/sub.c:78
 msgid "Brightness"
 msgstr "亮度"
 
-#: command.c:2416 command.c:2438 sub/sub.c:75
+#: command.c:2412 command.c:2434 sub/sub.c:75
 msgid "Contrast"
 msgstr "對比度"
 
-#: command.c:2417 command.c:2437 sub/sub.c:76
+#: command.c:2413 command.c:2433 sub/sub.c:76
 msgid "Saturation"
 msgstr "飽和度"
 
-#: command.c:2418 command.c:2436 sub/sub.c:79
+#: command.c:2414 command.c:2432 sub/sub.c:79
 msgid "Hue"
 msgstr "色調"
 
-#: command.c:2419
+#: command.c:2415
 #, c-format
 msgid "VSync: %s"
 msgstr "視頻同步: %s"
 
-#: command.c:2421 command.c:2423 command.c:2424 command.c:2425 command.c:2429
+#: command.c:2417 command.c:2419 command.c:2420 command.c:2421 command.c:2425
 #, c-format
 msgid "Subtitles: %s"
 msgstr "字幕: %s"
 
-#: command.c:2422
+#: command.c:2418
 #, c-format
 msgid "Sub source: %s"
 msgstr ""
 
-#: command.c:2426
+#: command.c:2422
 #, c-format
 msgid "Sub position: %s/100"
 msgstr "字幕位置: %s/100"
 
-#: command.c:2427
+#: command.c:2423
 #, c-format
 msgid "Sub alignment: %s"
 msgstr "字幕對齊: %s"
 
-#: command.c:2428
+#: command.c:2424
 #, c-format
 msgid "Sub delay: %s"
 msgstr "字幕延遲: %s"
 
-#: command.c:2430
+#: command.c:2426
 #, c-format
 msgid "Forced sub only: %s"
 msgstr "祇用鎖定的字幕: %s"
 
-#: command.c:2432
+#: command.c:2428
 #, c-format
 msgid "Sub Scale: %s"
 msgstr ""
 
-#: command.c:2828
+#: command.c:2824
 #, c-format
 msgid "EDL skip start, press 'i' again to end block.\n"
 msgstr "EDL 跳躍開始, 再按鍵 'i' 以停止。\n"
 
-#: command.c:2831
+#: command.c:2827
 #, c-format
 msgid "EDL skip canceled, last start > stop\n"
 msgstr "EDL 跳躍已取消, 上次開始位置 > 停止位置\n"
 
-#: command.c:2834
+#: command.c:2830
 #, c-format
 msgid "EDL skip end, line written.\n"
 msgstr "EDL 跳躍結束, 綫已寫入。\n"
 
-#: command.c:2942
+#: command.c:2938
 #, c-format
 msgid "Sub delay: %d ms"
 msgstr "字幕延遲: %d 毫秒"
 
-#: command.c:2964
+#: command.c:2960
 #, c-format
 msgid "OSD: %s"
 msgstr "OSD: %s"
 
-#: command.c:3017
+#: command.c:3013
 #, c-format
 msgid ""
 "\n"
@@ -402,7 +402,7 @@ msgstr ""
 "\n"
 "無法裝載播放列表 %s\n"
 
-#: command.c:3067 command.c:3078 command.c:3148 command.c:3188 command.c:3221
+#: command.c:3063 command.c:3074 command.c:3144 command.c:3184 command.c:3217
 #, c-format
 msgid "Channel: %s"
 msgstr "頻道: %s"
@@ -556,7 +556,7 @@ msgstr "[混音器] 没有可用的音量控製。\n"
 msgid "[Mixer] No balance control available.\n"
 msgstr ""
 
-#: mplayer.c:181
+#: mplayer.c:179
 msgid ""
 "Usage:   mplayer [options] [url|path/]filename\n"
 "\n"
@@ -628,7 +628,7 @@ msgstr ""
 " * * *  詳細内容,更多的(高級)選項和控製鍵,請參見手册頁  * * *\n"
 "\n"
 
-#: mplayer.c:221
+#: mplayer.c:219
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It may be a bug in our new runtime CPU-detection code...\n"
@@ -638,7 +638,7 @@ msgstr ""
 "  這可能是我們的新代碼中運行時 CPU-檢測的一個錯誤...\n"
 "  請閲讀 DOCS/zh/bugreports.html。\n"
 
-#: mplayer.c:226
+#: mplayer.c:224
 msgid ""
 "- MPlayer crashed by an 'Illegal Instruction'.\n"
 "  It usually happens when you run it on a CPU different than the one it was\n"
@@ -650,7 +650,7 @@ msgstr ""
 "  編譯/優化時的 CPU 所造成的。\n"
 "  證實它!\n"
 
-#: mplayer.c:232
+#: mplayer.c:230
 msgid ""
 "- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"
 "  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"
@@ -660,7 +660,7 @@ msgstr ""
 "  使用 --enable-debug 重新編譯 MPlayer 并用調試程序“gdb”反跟踪和\n"
 "  反匯編。具體細節看 DOCS/zh/bugreports.html#crash。\n"
 
-#: mplayer.c:237
+#: mplayer.c:235
 msgid ""
 "- MPlayer crashed. This shouldn't happen.\n"
 "  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"
@@ -674,7 +674,7 @@ msgstr ""
 "  并遵循上面的步驟報告錯誤。除非你在報告一個可能的錯誤時候提供我們\n"
 "  所需要的信息, 否則我們不能也不會幚助你。\n"
 
-#: mplayer.c:244
+#: mplayer.c:242
 msgid ""
 "\n"
 "\n"
@@ -725,7 +725,7 @@ msgstr ""
 "如果這些一個都用不上, 閲讀 DOCS/zh/bugreports.html!\n"
 "\n"
 
-#: mplayer.c:775 mplayer.c:779 mplayer.c:783
+#: mplayer.c:765 mplayer.c:769 mplayer.c:773
 #, c-format
 msgid ""
 "\n"
@@ -734,7 +734,7 @@ msgstr ""
 "\n"
 "正在退出... (%s)\n"
 
-#: mplayer.c:835
+#: mplayer.c:825
 #, c-format
 msgid ""
 "\n"
@@ -743,97 +743,97 @@ msgstr ""
 "\n"
 "MPlayer 被 %d 信號中斷(屬于 %s 模塊)\n"
 
-#: mplayer.c:899
+#: mplayer.c:891
 #, c-format
 msgid "Cannot find HOME directory.\n"
 msgstr "找不到主(HOME)目録\n"
 
-#: mplayer.c:908
+#: mplayer.c:900
 #, c-format
 msgid "get_path(\"config\") problem\n"
 msgstr "get_path(\"config\") 問題\n"
 
-#: mplayer.c:911
+#: mplayer.c:903
 #, c-format
 msgid "Creating config file: %s\n"
 msgstr "創建配置文件: %s\n"
 
-#: mplayer.c:941
+#: mplayer.c:933
 #, c-format
 msgid "Loading protocol-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:964 mplayer.c:981
+#: mplayer.c:956 mplayer.c:973
 #, c-format
 msgid "Loading extension-related profile '%s'\n"
 msgstr ""
 
-#: mplayer.c:995
+#: mplayer.c:987
 #, c-format
 msgid "Loading config '%s'\n"
 msgstr "正在裝載配置文件 '%s'\n"
 
-#: mplayer.c:1120 mplayer.c:4337
+#: mplayer.c:1112 mplayer.c:4174
 #, c-format
 msgid "Cannot load subtitles: %s\n"
 msgstr "不能加載字幕: %s\n"
 
-#: mplayer.c:1131
+#: mplayer.c:1123
 #, c-format
 msgid "SUB: Added subtitle file (%d): %s\n"
 msgstr "字幕: 添加字幕文件 (%d): %s\n"
 
-#: mplayer.c:1710
+#: mplayer.c:1707
 #, c-format
 msgid "Error at audio filter chain pre-init!\n"
 msgstr "音頻過濾器鏈預啟動錯誤!\n"
 
-#: mplayer.c:1723
+#: mplayer.c:1716
 #, c-format
 msgid "Could not open/initialize audio device -> no sound.\n"
 msgstr "不能打開/初始化音頻設備 -> 没聲音。\n"
 
-#: mplayer.c:1741
+#: mplayer.c:1734
 #, c-format
 msgid "Couldn't find matching filter/ao format!\n"
 msgstr "没找到匹配的 filter/ao 格式!\n"
 
-#: mplayer.c:2062
+#: mplayer.c:2055
 #, c-format
 msgid "Linux RTC read error: %s\n"
 msgstr "Linux RTC 讀取錯誤: %s\n"
 
-#: mplayer.c:2080
+#: mplayer.c:2073
 #, c-format
 msgid "Warning! Softsleep underflow!\n"
 msgstr "警告! Softsleep 嚮下溢出!\n"
 
-#: mplayer.c:2544
+#: mplayer.c:2543
 #, c-format
 msgid "Error opening/initializing the selected video_out (-vo) device.\n"
 msgstr "打開/初始化 (-vo) 所選的視頻輸出設備出錯。\n"
 
-#: mplayer.c:2562
+#: mplayer.c:2561
 #, c-format
 msgid "Can't open libmenu video filter with root menu %s.\n"
 msgstr "不能用根菜單 %s 打開 libmenu 視頻過濾器。\n"
 
-#: mplayer.c:2879 mplayer.c:2883 mplayer.c:2913 mplayer.c:2918
+#: mplayer.c:2878 mplayer.c:2882 mplayer.c:2912 mplayer.c:2917
 #, c-format
 msgid "  =====  PAUSE  ====="
 msgstr "  =====  暫停  ====="
 
-#: mplayer.c:2912
+#: mplayer.c:2911
 #, c-format
 msgid "%s %d%%"
 msgstr ""
 
-#: mplayer.c:2954
+#: mplayer.c:2953
 #, c-format
 msgid "Cannot use EDL without video, disabling.\n"
 msgstr "没有視頻不能使用 EDL, 取消中。\n"
 
-#: mplayer.c:3372
+#: mplayer.c:3400
 #, c-format
 msgid ""
 "\n"
@@ -842,82 +842,82 @@ msgstr ""
 "\n"
 "致命錯誤: 無法初始化 (-vf) 視頻過濾器或 (-vo) 視頻輸出。\n"
 
-#: mplayer.c:3868
+#: mplayer.c:3692
 #, c-format
 msgid "Compiled with runtime CPU detection.\n"
 msgstr "編譯用了實時 CPU 檢測。\n"
 
-#: mplayer.c:3870
+#: mplayer.c:3694
 #, c-format
 msgid "Compiled for x86 CPU with extensions:"
 msgstr "編譯用了針對 x86 CPU 的擴展指令集:"
 
-#: mplayer.c:4009
+#: mplayer.c:3846
 #, c-format
 msgid "Using built-in default codecs.conf.\n"
 msgstr "使用内建默認的 codecs.conf 文件。\n"
 
-#: mplayer.c:4016
+#: mplayer.c:3853
 #, c-format
 msgid "Available audio codecs:\n"
 msgstr "可用的音頻編解碼器:\n"
 
-#: mplayer.c:4023
+#: mplayer.c:3860
 #, c-format
 msgid "Available video codecs:\n"
 msgstr "可用的視頻編解碼器:\n"
 
-#: mplayer.c:4077
+#: mplayer.c:3914
 #, c-format
 msgid "CommandLine:"
 msgstr "命令行: "
 
-#: mplayer.c:4097
+#: mplayer.c:3934
 #, c-format
 msgid "Cannot load bitmap font: %s\n"
 msgstr "不能加載位圖字體: %s\n"
 
-#: mplayer.c:4125
+#: mplayer.c:3962
 #, c-format
 msgid "Failed to open %s: %s (it should be readable by the user.)\n"
 msgstr "打開 %s 失敗: %s (此文件應該能被用户讀取。)\n"
 
-#: mplayer.c:4131
+#: mplayer.c:3968
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n"
 msgstr "Linux RTC 初始化錯誤在 ioctl (rtc_irqp_set %lu): %s\n"
 
-#: mplayer.c:4132
+#: mplayer.c:3969
 #, c-format
 msgid "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n"
 msgstr "試圖添加 \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" 到你的係統啟動脚本。\n"
 
-#: mplayer.c:4137
+#: mplayer.c:3974
 #, c-format
 msgid "Linux RTC init error in ioctl (rtc_pie_on): %s\n"
 msgstr "Linux RTC 初始化錯誤在 ioctl (rtc_pie_on): %s\n"
 
-#: mplayer.c:4141
+#: mplayer.c:3978
 #, c-format
 msgid "Using Linux hardware RTC timing (%ldHz).\n"
 msgstr "使用 Linux 的硬件 RTC 實計時 (%ldHz)。\n"
 
-#: mplayer.c:4169 mplayer.c:4173 mplayer.c:4177
+#: mplayer.c:4006 mplayer.c:4010 mplayer.c:4014
 #, c-format
 msgid "Menu initialized: %s\n"
 msgstr "菜單已初始化: %s\n"
 
-#: mplayer.c:4179
+#: mplayer.c:4016
 #, c-format
 msgid "Menu init failed.\n"
 msgstr "菜單初始化失敗。\n"
 
-#: mplayer.c:4242
+#: mplayer.c:4079
 #, c-format
 msgid "WARNING: getch2_init called twice!\n"
 msgstr "警告: getch2_init 被調用兩次!\n"
 
-#: mplayer.c:4312
+#: mplayer.c:4149
 #, c-format
 msgid ""
 "\n"
@@ -926,77 +926,77 @@ msgstr ""
 "\n"
 "正在播放 %s。\n"
 
-#: mplayer.c:4326
+#: mplayer.c:4163
 #, c-format
 msgid "Can't open EDL file [%s] for writing.\n"
 msgstr "打不開 EDL 文件 [%s] 寫入。\n"
 
-#: mplayer.c:4421 mplayer.c:4627
+#: mplayer.c:4239 mplayer.c:4468
 #, c-format
 msgid "Cannot open dump file.\n"
 msgstr "打不開轉儲文件。\n"
 
-#: mplayer.c:4432 mplayer.c:4445 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
+#: mplayer.c:4250 mplayer.c:4263 libvo/vo_md5sum.c:80 libvo/vo_pnm.c:99
 #, c-format
 msgid "%s: Error writing file.\n"
 msgstr "%s: 寫文件錯誤。\n"
 
-#: mplayer.c:4448 mplayer.c:4643
+#: mplayer.c:4266 mplayer.c:4484
 #, c-format
 msgid "Stream dump complete.\n"
 msgstr ""
 
-#: mplayer.c:4558
+#: mplayer.c:4376
 #, c-format
 msgid "Failed to recognize file format.\n"
 msgstr ""
 
-#: mplayer.c:4617
+#: mplayer.c:4458
 #, c-format
 msgid "dump: FATAL: Selected stream missing!\n"
 msgstr "轉儲: 致命錯誤: 指定的流不存在!\n"
 
-#: mplayer.c:4654
+#: mplayer.c:4495
 #, c-format
 msgid "Video: Cannot read properties.\n"
 msgstr "視頻: 無法讀取屬性\n"
 
-#: mplayer.c:4657
+#: mplayer.c:4498
 #, c-format
 msgid "[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.3f  ftime:=%6.4f\n"
 msgstr "[V] 文件格式:%d  fourcc:0x%X  大小:%dx%d  幀速:%5.3f  幀時間:=%6.4f\n"
 
-#: mplayer.c:4670
+#: mplayer.c:4511
 #, c-format
 msgid "FPS not specified in the header or invalid, use the -fps option.\n"
 msgstr "FPS 在文件頭中没有指定或者無效,用 -fps 選項。\n"
 
-#: mplayer.c:4678 stream/asf_streaming.c:772
+#: mplayer.c:4519 stream/asf_streaming.c:772
 #, c-format
 msgid "No stream found.\n"
 msgstr "找不到流。\n"
 
-#: mplayer.c:4800
+#: mplayer.c:4636
 #, c-format
 msgid "Audio: no sound\n"
 msgstr "音頻: 没聲音\n"
 
-#: mplayer.c:4807
+#: mplayer.c:4643
 #, c-format
 msgid "Video: no video\n"
 msgstr "視頻: 没視頻\n"
 
-#: mplayer.c:4821
+#: mplayer.c:4657
 #, c-format
 msgid "FPS forced to be %5.3f  (ftime: %5.3f).\n"
 msgstr "FPS 鎖定為 %5.3f  (ftime: %5.3f)。\n"
 
-#: mplayer.c:4834
+#: mplayer.c:4670
 #, c-format
 msgid "Starting playback...\n"
 msgstr "開始播放...\n"
 
-#: mplayer.c:4871
+#: mplayer.c:4707
 #, c-format
 msgid "Option -endpos in MPlayer does not yet support size units.\n"
 msgstr ""
@@ -1248,28 +1248,28 @@ msgstr "可用的標簽"
 msgid "Couldn't find label in plugin library."
 msgstr "在插件庫裏找不到標簽。"
 
-#: libaf/af_ladspa.c:522
+#: libaf/af_ladspa.c:523
 msgid "No suboptions specified."
 msgstr "没有指定子選項標簽。"
 
-#: libaf/af_ladspa.c:534
+#: libaf/af_ladspa.c:535
 msgid "No library file specified."
 msgstr "没有指定庫文件。"
 
-#: libaf/af_ladspa.c:550
+#: libaf/af_ladspa.c:551
 msgid "No filter label specified."
 msgstr "没有指定過濾器標簽。"
 
-#: libaf/af_ladspa.c:586 libaf/af_ladspa.c:593
+#: libaf/af_ladspa.c:587 libaf/af_ladspa.c:594
 msgid "Not enough controls specified on the command line."
 msgstr "命令行指定的控製項不够。"
 
-#: libaf/af_ladspa.c:619
+#: libaf/af_ladspa.c:620
 #, c-format
 msgid "%s: Input control #%d is below lower boundary of %0.4f.\n"
 msgstr "%s: 輸入控製 #%d 低于下限 %0.4f。\n"
 
-#: libaf/af_ladspa.c:625
+#: libaf/af_ladspa.c:626
 #, c-format
 msgid "%s: Input control #%d is above upper boundary of %0.4f.\n"
 msgstr "%s: 輸入控製 #%d 高于上限 %0.4f。\n"
@@ -1279,12 +1279,12 @@ msgstr "%s: 輸入控製 #%d 高于上限 %0.4f。\n"
 msgid "Couldn't open codec %s, br=%d.\n"
 msgstr "打不開編解碼器 %s, br=%d。\n"
 
-#: libaf/af_lavcac3enc.c:292
+#: libaf/af_lavcac3enc.c:293
 #, c-format
 msgid "Audio LAVC, couldn't find encoder for codec %s.\n"
 msgstr "音頻 LAVC, 找不到對應的編碼器 %s。\n"
 
-#: libaf/af_lavcac3enc.c:298
+#: libaf/af_lavcac3enc.c:299
 #, c-format
 msgid "Audio LAVC, couldn't allocate context!\n"
 msgstr "音頻 LAVC, 不能分配上下文!\n"
@@ -1893,27 +1893,27 @@ msgstr "[AO SUN] 無法打開音頻設備 %s, %s  -> 没聲音。\n"
 msgid "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n"
 msgstr "[AO SUN] 音頻設置: 你的聲卡不支持 %d 通道, %s, %d Hz 采様率。\n"
 
-#: libao2/audio_out.c:126
+#: libao2/audio_out.c:127
 #, c-format
 msgid "Available audio output drivers:\n"
 msgstr "可用的音頻輸出驅動:\n"
 
-#: libao2/audio_out.c:152
+#: libao2/audio_out.c:164
 #, c-format
 msgid "Trying preferred audio driver '%.*s', options '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:162
+#: libao2/audio_out.c:182
 #, c-format
 msgid "Failed to initialize audio driver '%s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:167
+#: libao2/audio_out.c:185
 #, c-format
 msgid "No such audio driver '%.*s'\n"
 msgstr ""
 
-#: libao2/audio_out.c:175
+#: libao2/audio_out.c:194
 #, c-format
 msgid "Trying every known audio driver...\n"
 msgstr ""
@@ -2127,13 +2127,13 @@ msgstr "這個格式的采様需要更好的支持。請聯係開發者。\n"
 msgid "Cannot find codec '%s' in libavcodec...\n"
 msgstr "在 libavcodec 中找不到解碼器 '%s'...\n"
 
-#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:386
+#: libmpcodecs/ad_ffmpeg.c:153 libmpcodecs/vd_ffmpeg.c:388
 #: libmpcodecs/vf_lavc.c:77
 #, c-format
 msgid "Could not open codec.\n"
 msgstr "打不開解碼器。\n"
 
-#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:412
+#: libmpcodecs/ad_ffmpeg.c:197 libmpcodecs/vd_ffmpeg.c:414
 #, c-format
 msgid "Could not close codec.\n"
 msgstr "不能關閉解碼器。\n"
@@ -2360,7 +2360,7 @@ msgstr "信息: Win32/DShow 視頻編解碼器初始化成功。\n"
 msgid "Asking decoder to use %d threads if supported.\n"
 msgstr ""
 
-#: libmpcodecs/vd_ffmpeg.c:404
+#: libmpcodecs/vd_ffmpeg.c:406
 #, c-format
 msgid "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
 msgstr "[VD_FFMPEG] QP 的算術平均值: %2.4f, QP 的調和平均值: %2.4f\n"
@@ -2721,7 +2721,7 @@ msgstr "無法打開 Ogg 分路器。\n"
 msgid "fill_buffer error: bad demuxer: not vd, ad or sd.\n"
 msgstr "fill_buffer 錯誤: 分路器錯誤: 不是 vd, ad 或 sd。\n"
 
-#: libmpdemux/demux_lavf.c:663
+#: libmpdemux/demux_lavf.c:665
 #, c-format
 msgid ""
 "[lavf] This looks like an internet radio ogg stream with track changes.\n"
@@ -2729,7 +2729,7 @@ msgid ""
 "You may be able to work around that limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:673
+#: libmpdemux/demux_lavf.c:675
 #, c-format
 msgid ""
 "[lavf] This is the %dth track.\n"
@@ -2737,29 +2737,29 @@ msgid ""
 "You may be able to work around this limitation by using -demuxer ogg.\n"
 msgstr ""
 
-#: libmpdemux/demux_lavf.c:688
+#: libmpdemux/demux_lavf.c:690
 #, c-format
 msgid ""
 "[lavf] Internet radio ogg hack was enabled, but stream characteristics changed.\n"
 "This may or may not work.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:303
+#: libmpdemux/demux_mkv.c:304
 #, c-format
 msgid "[mkv] zlib initialization failed.\n"
 msgstr "[mkv] zlib 初始化失敗。\n"
 
-#: libmpdemux/demux_mkv.c:319
+#: libmpdemux/demux_mkv.c:320
 #, c-format
 msgid "[mkv] zlib decompression failed.\n"
 msgstr "[mkv] zlib 解壓失敗。\n"
 
-#: libmpdemux/demux_mkv.c:348
+#: libmpdemux/demux_mkv.c:349
 #, c-format
 msgid "[mkv] lzo decompression failed.\n"
 msgstr "[mkv] lzo 解壓失敗。\n"
 
-#: libmpdemux/demux_mkv.c:442
+#: libmpdemux/demux_mkv.c:443
 #, c-format
 msgid ""
 "[mkv] Track number %u has been encrypted and decryption has not yet been\n"
@@ -2768,19 +2768,19 @@ msgstr ""
 "[mkv] 軌迹號 %u 已加密但解密還没\n"
 "[mkv] 實現。跳過軌迹。\n"
 
-#: libmpdemux/demux_mkv.c:449
+#: libmpdemux/demux_mkv.c:450
 #, c-format
 msgid "[mkv] Unknown content encoding type for track %u. Skipping track.\n"
 msgstr "[mkv] 軌迹 %u 的内容編碼類型未知。跳過軌迹。\n"
 
-#: libmpdemux/demux_mkv.c:454
+#: libmpdemux/demux_mkv.c:455
 #, c-format
 msgid ""
 "[mkv] Track %u has been compressed with an unknown/unsupported compression\n"
 "[mkv] algorithm (%<PRIu64>). Skipping track.\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:462
+#: libmpdemux/demux_mkv.c:463
 #, c-format
 msgid ""
 "[mkv] Track %u was compressed with zlib but mplayer has not been compiled\n"
@@ -2789,22 +2789,22 @@ msgstr ""
 "[mkv] 軌迹 %u 已用 zlib 壓縮但 mplayer 還没編譯成\n"
 "[mkv] 支持 zlib 壓縮。跳過軌迹。\n"
 
-#: libmpdemux/demux_mkv.c:806
+#: libmpdemux/demux_mkv.c:807
 #, c-format
 msgid "[mkv] Warning: unsupported edition recursion in chapter; will skip on playback!\n"
 msgstr ""
 
-#: libmpdemux/demux_mkv.c:1106
+#: libmpdemux/demux_mkv.c:1107
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s) \"%s\", %s\n"
 msgstr "[mkv] 軌迹 ID %u: %s (%s) \"%s\", %s\n"
 
-#: libmpdemux/demux_mkv.c:1110
+#: libmpdemux/demux_mkv.c:1111
 #, c-format
 msgid "[mkv] Track ID %u: %s (%s), %s\n"
 msgstr "[mkv] 軌迹 ID %u: %s (%s), %s\n"
 
-#: libmpdemux/demux_mkv.c:1243
+#: libmpdemux/demux_mkv.c:1245
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported CodecID (%s) or missing/bad CodecPrivate\n"
@@ -2813,12 +2813,12 @@ msgstr ""
 "[mkv] 未知的/不支持的 CodecID (%s) 或者缺少的/壞的 CodecPrivate\n"
 "[mkv] 數據(軌迹 %u)。\n"
 
-#: libmpdemux/demux_mkv.c:1351
+#: libmpdemux/demux_mkv.c:1355
 #, c-format
 msgid "[mkv] FLAC track does not contain valid headers.\n"
 msgstr "[mkv] FLAC 軌迹没含有效的頭部。\n"
 
-#: libmpdemux/demux_mkv.c:1367
+#: libmpdemux/demux_mkv.c:1371
 #, c-format
 msgid ""
 "[mkv] Unknown/unsupported audio codec ID '%s' for track %u or missing/faulty\n"
@@ -2827,26 +2827,21 @@ msgstr ""
 "[mkv] 未知的/不支持的音頻編解碼器 ID '%s' 對于軌迹 %u 或者缺少的/有缺點的\n"
 "[mkv] 編解碼器私有數據。\n"
 
-#: libmpdemux/demux_mkv.c:1593
+#: libmpdemux/demux_mkv.c:1594
 #, c-format
 msgid "[mkv] Subtitle type '%s' is not supported.\n"
 msgstr "[mkv] 不支持字幕類型 '%s'。\n"
 
-#: libmpdemux/demux_mkv.c:1706
+#: libmpdemux/demux_mkv.c:1707
 #, c-format
 msgid "[mkv] Will play video track %u.\n"
 msgstr "[mkv] 將播放視頻軌迹 %u。\n"
 
-#: libmpdemux/demux_mkv.c:1711
+#: libmpdemux/demux_mkv.c:1712
 #, c-format
 msgid "[mkv] No video track found/wanted.\n"
 msgstr "[mkv] 没有找到/所要的視頻軌迹。\n"
 
-#: libmpdemux/demux_mkv.c:1740
-#, c-format
-msgid "[mkv] No audio track found/wanted.\n"
-msgstr "[mkv] 没有找到/所要的音頻軌迹。\n"
-
 #: libmpdemux/demux_mov.c:1323
 #, c-format
 msgid "MOV: WARNING: too many tracks"
@@ -2892,27 +2887,27 @@ msgstr "關閉插件: %s。\n"
 msgid "Waiting for the XMMS plugin to start playback of '%s'...\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:386
+#: libmpdemux/demuxer.c:388
 #, c-format
 msgid "WARNING: Audio stream header %d redefined.\n"
 msgstr "警告: 音頻流頭部 %d 被重新定義。\n"
 
-#: libmpdemux/demuxer.c:388
+#: libmpdemux/demuxer.c:390
 #, c-format
 msgid "==> Found audio stream: %d\n"
 msgstr "==> 找到音頻流: %d\n"
 
-#: libmpdemux/demuxer.c:425
+#: libmpdemux/demuxer.c:427
 #, c-format
 msgid "WARNING: Video stream header %d redefined.\n"
 msgstr "警告: 視頻流頭部 %d 被重新定義。\n"
 
-#: libmpdemux/demuxer.c:427
+#: libmpdemux/demuxer.c:429
 #, c-format
 msgid "==> Found video stream: %d\n"
 msgstr "==> 找到視頻流: %d\n"
 
-#: libmpdemux/demuxer.c:686
+#: libmpdemux/demuxer.c:688
 msgid ""
 "Maybe you are playing a non-interleaved stream/file or the codec failed?\n"
 "For AVI files, try to force non-interleaved mode with the -ni option.\n"
@@ -2920,7 +2915,7 @@ msgstr ""
 "(也許你播放了一個非交錯的流/文件或者是編解碼失敗)?\n"
 "對于 AVI 文件, 嘗試用 -ni 選項鎖定非交錯模式。\n"
 
-#: libmpdemux/demuxer.c:691 libmpdemux/demuxer.c:856
+#: libmpdemux/demuxer.c:693 libmpdemux/demuxer.c:858
 #, c-format
 msgid ""
 "\n"
@@ -2929,7 +2924,7 @@ msgstr ""
 "\n"
 "緩衝中音頻包太多(%d in %d 字節)。\n"
 
-#: libmpdemux/demuxer.c:698 libmpdemux/demuxer.c:863
+#: libmpdemux/demuxer.c:700 libmpdemux/demuxer.c:865
 #, c-format
 msgid ""
 "\n"
@@ -2938,62 +2933,62 @@ msgstr ""
 "\n"
 "緩衝中視頻包太多(%d in %d 字節)。\n"
 
-#: libmpdemux/demuxer.c:958
+#: libmpdemux/demuxer.c:949
 #, c-format
 msgid "Detected file format: %s (%s)\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:961
+#: libmpdemux/demuxer.c:952
 #, c-format
 msgid "Detected file format: %s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:966
+#: libmpdemux/demuxer.c:957
 #, c-format
 msgid "Opening as detected format \"%s\" failed.\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1110
+#: libmpdemux/demuxer.c:1101
 #, c-format
 msgid "Cannot open audio stream: %s\n"
 msgstr "打不開音頻流: %s\n"
 
-#: libmpdemux/demuxer.c:1131
+#: libmpdemux/demuxer.c:1122
 #, c-format
 msgid "Cannot open subtitle stream: %s\n"
 msgstr "打不開字幕流: %s\n"
 
-#: libmpdemux/demuxer.c:1153
+#: libmpdemux/demuxer.c:1144
 #, c-format
 msgid "Failed to open audio demuxer: %s\n"
 msgstr "打開音頻分路器: %s 失敗\n"
 
-#: libmpdemux/demuxer.c:1167
+#: libmpdemux/demuxer.c:1158
 #, c-format
 msgid "Failed to open subtitle demuxer: %s\n"
 msgstr "打開字幕分路器: %s 失敗\n"
 
-#: libmpdemux/demuxer.c:1202
+#: libmpdemux/demuxer.c:1193
 #, c-format
 msgid "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n"
 msgstr "無法在原始的 AVI 流中搜索。(需要索引, 嘗試使用 -idx 選項。)  \n"
 
-#: libmpdemux/demuxer.c:1205
+#: libmpdemux/demuxer.c:1196
 #, c-format
 msgid "TV input is not seekable! (Seeking will probably be for changing channels ;)\n"
 msgstr "TV 輸入不能搜索! (可能搜索應該用來更換頻道;)\n"
 
-#: libmpdemux/demuxer.c:1208
+#: libmpdemux/demuxer.c:1199
 #, c-format
 msgid "Cannot seek in this file.\n"
 msgstr "不能在此文件中搜索。\n"
 
-#: libmpdemux/demuxer.c:1274
+#: libmpdemux/demuxer.c:1265
 #, c-format
 msgid "Demuxer info %.*s changed to %.*s\n"
 msgstr ""
 
-#: libmpdemux/demuxer.c:1298
+#: libmpdemux/demuxer.c:1289
 #, c-format
 msgid "Clip info:\n"
 msgstr "剪輯信息: \n"
@@ -4163,7 +4158,7 @@ msgstr ""
 msgid "Available fullscreen layer change modes:\n"
 msgstr "可用的全屏層變換模式:\n"
 
-#: libvo/x11_common.c:1640
+#: libvo/x11_common.c:1635
 #, c-format
 msgid "XF86VM: Selected video mode %dx%d for image size %dx%d.\n"
 msgstr "XF86VM: 已選視頻模式 %dx%d (圖像大小 %dx%d)。\n"
@@ -4626,12 +4621,12 @@ msgstr "服務器返回 %d: %s\n"
 msgid "Cache size set to %d KBytes\n"
 msgstr "緩存大小設為 %d K字節\n"
 
-#: stream/stream.c:243
+#: stream/stream.c:245
 #, c-format
 msgid "Failed to open %s.\n"
 msgstr "打開 %s 失敗。\n"
 
-#: stream/stream.c:271
+#: stream/stream.c:273
 #, c-format
 msgid "Error writing capture file: %s\n"
 msgstr ""
@@ -4830,88 +4825,88 @@ msgstr "選擇 VCD 軌迹出錯。"
 msgid "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n"
 msgstr "CUE stream_open, filename=%s, track=%d, 可用音軌: %d -> %d\n"
 
-#: stream/stream_dvd.c:136
+#: stream/stream_dvd.c:135
 #, c-format
 msgid "Selected DVD audio channel: %d language: %c%c\n"
 msgstr "已選 DVD 音頻通道: %d 語言: %c%c\n"
 
-#: stream/stream_dvd.c:144
+#: stream/stream_dvd.c:142
 #, c-format
 msgid "No matching DVD audio language found!\n"
 msgstr "未找到匹配的 DVD 音頻語言!\n"
 
-#: stream/stream_dvd.c:179
+#: stream/stream_dvd.c:176
 #, c-format
 msgid "Selected DVD subtitle channel: %d language: %c%c\n"
 msgstr "已選 DVD 字幕通道: %d 語言: %c%c\n"
 
-#: stream/stream_dvd.c:186
+#: stream/stream_dvd.c:181
 #, c-format
 msgid "No matching DVD subtitle language found!\n"
 msgstr "未找到匹配的 DVD 字幕語言!\n"
 
-#: stream/stream_dvd.c:732 stream/stream_dvd.c:737 stream/stream_dvd.c:757
+#: stream/stream_dvd.c:727 stream/stream_dvd.c:732 stream/stream_dvd.c:752
 #: stream/stream_dvdnav.c:593
 #, c-format
 msgid "Couldn't open DVD device: %s (%s)\n"
 msgstr "打不開 DVD 設備: %s (%s)\n"
 
-#: stream/stream_dvd.c:771
+#: stream/stream_dvd.c:766
 #, c-format
 msgid "Can't open VMG info!\n"
 msgstr "打不開 VMG 信息!\n"
 
-#: stream/stream_dvd.c:808
+#: stream/stream_dvd.c:803
 #, c-format
 msgid "There are %d titles on this DVD.\n"
 msgstr "此 DVD 有 %d 個標題。\n"
 
-#: stream/stream_dvd.c:810
+#: stream/stream_dvd.c:805
 #, c-format
 msgid "Invalid DVD title number: %d\n"
 msgstr "無效的 DVD 標題號: %d\n"
 
-#: stream/stream_dvd.c:821
+#: stream/stream_dvd.c:816
 #, c-format
 msgid "There are %d angles in this DVD title.\n"
 msgstr "此 DVD 標題有 %d 個視角。\n"
 
-#: stream/stream_dvd.c:823
+#: stream/stream_dvd.c:818
 #, c-format
 msgid "Invalid DVD angle number: %d\n"
 msgstr "無效的 DVD 視角號: %d\n"
 
-#: stream/stream_dvd.c:834
+#: stream/stream_dvd.c:829
 #, c-format
 msgid "Cannot open the IFO file for DVD title %d.\n"
 msgstr "打不開 DVD 標題 %d 的 IFO 文件。\n"
 
-#: stream/stream_dvd.c:842
+#: stream/stream_dvd.c:837
 #, c-format
 msgid "Cannot open title VOBS (VTS_%02d_1.VOB).\n"
 msgstr "打不開標題的 VOBS (VTS_%02d_1.VOB)。\n"
 
-#: stream/stream_dvd.c:902 stream/stream_dvdnav.c:560
+#: stream/stream_dvd.c:897 stream/stream_dvdnav.c:560
 #, c-format
 msgid "audio stream: %d format: %s (%s) language: %s aid: %d.\n"
 msgstr "音頻流: %d 格式: %s (%s) 語言: %s aid: %d。\n"
 
-#: stream/stream_dvd.c:916
+#: stream/stream_dvd.c:911
 #, c-format
 msgid "number of audio channels on disk: %d.\n"
 msgstr "盤上的音頻通道數: %d。\n"
 
-#: stream/stream_dvd.c:948
+#: stream/stream_dvd.c:943
 #, c-format
 msgid "subtitle ( sid ): %d language: %s\n"
 msgstr "字幕號(sid): %d 語言: %s\n"
 
-#: stream/stream_dvd.c:954
+#: stream/stream_dvd.c:949
 #, c-format
 msgid "number of subtitles on disk: %d\n"
 msgstr "盤上的字幕數: %d\n"
 
-#: stream/stream_dvd.c:1006
+#: stream/stream_dvd.c:1001
 #, c-format
 msgid "MPlayer was compiled without DVD support, exiting.\n"
 msgstr "MPlayer 編譯成不支持 DVD,退出中。\n"
@@ -5143,12 +5138,12 @@ msgstr "[radio] 使用頻率: %.2f。\n"
 msgid "[radio] Call to stream_enable_cache failed: %s\n"
 msgstr "[radio] 調用 stream_enable_cache 失敗: %s\n"
 
-#: stream/stream_smb.c:138
+#: stream/stream_smb.c:137
 #, c-format
 msgid "Cannot init the libsmbclient library: %d\n"
 msgstr "不能初始 libsmbclient 庫: %d\n"
 
-#: stream/stream_smb.c:145
+#: stream/stream_smb.c:144
 #, c-format
 msgid "Could not open from LAN: '%s'\n"
 msgstr "打不開局域網内的: '%s'\n"
@@ -5624,7 +5619,7 @@ msgstr ""
 msgid "String appears to be already escaped in url_escape %c%c1%c2\n"
 msgstr "字符轉義好像已發生在 url_escape %c%c1%c2\n"
 
-#: sub/ass_mp.c:254
+#: sub/ass_mp.c:244
 #, c-format
 msgid "Refusing to load subtitle file larger than 100 MB: %s\n"
 msgstr ""
diff --git a/mplayer/snapshot_version b/mplayer/snapshot_version
index 8466647..7959c9b 100644
--- a/mplayer/snapshot_version
+++ b/mplayer/snapshot_version
@@ -1 +1 @@
-v2.0
\ No newline at end of file
+v2.0-54-gd33877a
\ No newline at end of file
diff --git a/mplayer/stream/pnm.c b/mplayer/stream/pnm.c
index 40da142..14ffa5d 100644
--- a/mplayer/stream/pnm.c
+++ b/mplayer/stream/pnm.c
@@ -503,7 +503,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) {
   uint8_t  *ptr=p->header;
   uint8_t  *prop_hdr=NULL;
   int      chunk_size,size=0;
-  int      nr;
+  int      nr = 0;
 /*  rmff_header_t *h; */
 
   *need_response=0;
diff --git a/mplayer/stream/stream.c b/mplayer/stream/stream.c
index 6f35252..86dd613 100644
--- a/mplayer/stream/stream.c
+++ b/mplayer/stream/stream.c
@@ -29,6 +29,8 @@
 #include <fcntl.h>
 #include <strings.h>
 
+#include "talloc.h"
+
 #include "config.h"
 
 #if HAVE_WINSOCK2_H
@@ -658,3 +660,35 @@ unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max, int utf
   if(s->eof && ptr == mem) return NULL;
   return mem;
 }
+
+struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
+                                 int max_size, int padding_bytes)
+{
+    if (max_size > 1000000000)
+        abort();
+
+    int bufsize;
+    int total_read = 0;
+    int padding = FFMAX(padding_bytes, 1);
+    char *buf = NULL;
+    if (s->end_pos > max_size)
+        return (struct bstr){NULL, 0};
+    if (s->end_pos > 0)
+        bufsize = s->end_pos + padding;
+    else
+        bufsize = 1000;
+    while (1) {
+        buf = talloc_realloc_size(talloc_ctx, buf, bufsize);
+        int readsize = stream_read(s, buf + total_read, bufsize - total_read);
+        total_read += readsize;
+        if (total_read < bufsize)
+            break;
+        if (bufsize > max_size) {
+            talloc_free(buf);
+            return (struct bstr){NULL, 0};
+        }
+        bufsize = FFMIN(bufsize + (bufsize >> 1), max_size + padding);
+    }
+    buf = talloc_realloc_size(talloc_ctx, buf, total_read + padding);
+    return (struct bstr){buf, total_read};
+}
diff --git a/mplayer/stream/stream.h b/mplayer/stream/stream.h
index cad61d3..94bfb0e 100644
--- a/mplayer/stream/stream.h
+++ b/mplayer/stream/stream.h
@@ -28,6 +28,8 @@
 #include <sys/types.h>
 #include <fcntl.h>
 
+#include "bstr.h"
+
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
@@ -331,6 +333,14 @@ inline static int stream_skip(stream_t *s,off_t len){
 }
 
 struct MPOpts;
+/*
+ * Return allocated buffer for all data until EOF.
+ * If amount of data would be more than max_size return NULL as data ptr.
+ * Make the allocated buffer padding_bytes larger than the data read.
+ * Write number of bytes read at *amount_read.
+ */
+struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
+                                 int max_size, int padding_bytes);
 void stream_reset(stream_t *s);
 int stream_control(stream_t *s, int cmd, void *arg);
 stream_t* new_stream(int fd,int type);
@@ -341,6 +351,9 @@ stream_t *open_stream(const char *filename, struct MPOpts *options,
 stream_t *open_stream_full(const char *filename,int mode,
                            struct MPOpts *options, int *file_format);
 stream_t *open_output_stream(const char *filename, struct MPOpts *options);
+struct demux_stream;
+struct stream *new_ds_stream(struct demux_stream *ds);
+
 /// Set the callback to be used by libstream to check for user
 /// interruption during long blocking operations (cache filling, etc).
 struct input_ctx;
diff --git a/mplayer/stream/stream_dvd.c b/mplayer/stream/stream_dvd.c
index a302da8..f257ab7 100644
--- a/mplayer/stream/stream_dvd.c
+++ b/mplayer/stream/stream_dvd.c
@@ -125,24 +125,21 @@ int dvd_lang_from_aid(stream_t *stream, int id) {
   return 0;
 }
 
-int dvd_aid_from_lang(stream_t *stream, const unsigned char* lang) {
+int dvd_aid_from_lang(stream_t *stream, char **lang) {
   dvd_priv_t *d=stream->priv;
   int code,i;
-  if(lang) {
-    while(strlen(lang)>=2) {
-      code=lang[1]|(lang[0]<<8);
+  for (int n = 0; lang[n]; n++) {
+      code = lang[n][1] | (lang[n][0] << 8);
       for(i=0;i<d->nr_of_channels;i++) {
         if(d->audio_streams[i].language==code) {
           mp_tmsg(MSGT_OPEN,MSGL_INFO,"Selected DVD audio channel: %d language: %c%c\n",
-          d->audio_streams[i].id, lang[0],lang[1]);
+          d->audio_streams[i].id, lang[n][0], lang[n][1]);
           return d->audio_streams[i].id;
         }
         //printf("%X != %X  (%c%c)\n",code,d->audio_streams[i].language,lang[0],lang[1]);
       }
-      lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang;
-    }
-    mp_tmsg(MSGT_OPEN,MSGL_WARN,"No matching DVD audio language found!\n");
   }
+  mp_tmsg(MSGT_OPEN,MSGL_WARN,"No matching DVD audio language found!\n");
   return -1;
 }
 
@@ -169,19 +166,17 @@ int dvd_lang_from_sid(stream_t *stream, int id) {
   return 0;
 }
 
-int dvd_sid_from_lang(stream_t *stream, const unsigned char* lang) {
+int dvd_sid_from_lang(stream_t *stream, char **lang) {
   dvd_priv_t *d=stream->priv;
   int code,i;
-  while(lang && strlen(lang)>=2) {
-    code=lang[1]|(lang[0]<<8);
+  for (int n = 0; lang[n]; n++) {
+    code = lang[n][1] | (lang[n][0] << 8);
     for(i=0;i<d->nr_of_subtitles;i++) {
       if(d->subtitles[i].language==code) {
-        mp_tmsg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n", i, lang[0],lang[1]);
+        mp_tmsg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n", i, lang[n][0], lang[n][1]);
         return d->subtitles[i].id;
       }
     }
-    lang+=2;
-    while (lang[0]==',' || lang[0]==' ') ++lang;
   }
   mp_tmsg(MSGT_OPEN,MSGL_WARN,"No matching DVD subtitle language found!\n");
   return -1;
diff --git a/mplayer/stream/stream_dvd.h b/mplayer/stream/stream_dvd.h
index f0f0b5d..fe52d43 100644
--- a/mplayer/stream/stream_dvd.h
+++ b/mplayer/stream/stream_dvd.h
@@ -59,8 +59,8 @@ typedef struct {
 int dvd_number_of_subs(stream_t *stream);
 int dvd_lang_from_aid(stream_t *stream, int id);
 int dvd_lang_from_sid(stream_t *stream, int id);
-int dvd_aid_from_lang(stream_t *stream, const unsigned char* lang);
-int dvd_sid_from_lang(stream_t *stream, const unsigned char* lang);
+int dvd_aid_from_lang(stream_t *stream, char **lang);
+int dvd_sid_from_lang(stream_t *stream, char **lang);
 int dvd_chapter_from_cell(dvd_priv_t *dvd,int title,int cell);
 
 #endif /* MPLAYER_STREAM_DVD_H */
diff --git a/mplayer/stream/stream_dvdnav.c b/mplayer/stream/stream_dvdnav.c
index 21522f8..b1c51e6 100644
--- a/mplayer/stream/stream_dvdnav.c
+++ b/mplayer/stream/stream_dvdnav.c
@@ -733,14 +733,14 @@ static int mp_dvdnav_get_aid_from_format (stream_t *stream, int index, uint8_t l
  * \param lang: 2-characters language code[s], eventually separated by spaces of commas
  * \return -1 on error, current subtitle id if successful
  */
-int mp_dvdnav_aid_from_lang(stream_t *stream, const unsigned char *language) {
+int mp_dvdnav_aid_from_lang(stream_t *stream, char **language) {
   dvdnav_priv_t * priv = stream->priv;
   int k;
   uint8_t lg;
   uint16_t lang, lcode;
 
-  while(language && strlen(language)>=2) {
-    lcode = (language[0] << 8) | (language[1]);
+  for (int i = 0; language[i]; i++) {
+    lcode = (language[i][0] << 8) | (language[i][1]);
     for(k=0; k<32; k++) {
       lg = dvdnav_get_audio_logical_stream(priv->dvdnav, k);
       if(lg == 0xff) continue;
@@ -748,8 +748,6 @@ int mp_dvdnav_aid_from_lang(stream_t *stream, const unsigned char *language) {
       if(lang != 0xFFFF && lang == lcode)
         return mp_dvdnav_get_aid_from_format (stream, k, lg);
     }
-    language += 2;
-    while(language[0]==',' || language[0]==' ') ++language;
   }
   return -1;
 }
@@ -785,13 +783,13 @@ int mp_dvdnav_lang_from_aid(stream_t *stream, int aid, unsigned char *buf) {
  * \param lang: 2-characters language code[s], eventually separated by spaces of commas
  * \return -1 on error, current subtitle id if successful
  */
-int mp_dvdnav_sid_from_lang(stream_t *stream, const unsigned char *language) {
+int mp_dvdnav_sid_from_lang(stream_t *stream, char **language) {
   dvdnav_priv_t * priv = stream->priv;
   uint8_t lg, k;
   uint16_t lang, lcode;
 
-  while(language && strlen(language)>=2) {
-    lcode = (language[0] << 8) | (language[1]);
+  for (int i = 0; language[i]; i++) {
+    lcode = (language[i][0] << 8) | (language[i][1]);
     for(k=0; k<32; k++) {
       lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k);
       if(lg == 0xff) continue;
@@ -800,8 +798,6 @@ int mp_dvdnav_sid_from_lang(stream_t *stream, const unsigned char *language) {
         return lg;
       }
     }
-    language += 2;
-    while(language[0]==',' || language[0]==' ') ++language;
   }
   return -1;
 }
diff --git a/mplayer/stream/stream_dvdnav.h b/mplayer/stream/stream_dvdnav.h
index 97c2cb6..ae58367 100644
--- a/mplayer/stream/stream_dvdnav.h
+++ b/mplayer/stream/stream_dvdnav.h
@@ -30,9 +30,9 @@ typedef struct {
 
 int mp_dvdnav_number_of_subs(stream_t *stream);
 int mp_dvdnav_aid_from_audio_num(stream_t *stream, int audio_num);
-int mp_dvdnav_aid_from_lang(stream_t *stream, const unsigned char *language);
+int mp_dvdnav_aid_from_lang(stream_t *stream, char **language);
 int mp_dvdnav_lang_from_aid(stream_t *stream, int id, unsigned char *buf);
-int mp_dvdnav_sid_from_lang(stream_t *stream, const unsigned char *language);
+int mp_dvdnav_sid_from_lang(stream_t *stream, char **language);
 int mp_dvdnav_lang_from_sid(stream_t *stream, int sid, unsigned char *buf);
 void mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button);
 void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button);
diff --git a/mplayer/stream/stream_smb.c b/mplayer/stream/stream_smb.c
index 6849407..14791a2 100644
--- a/mplayer/stream/stream_smb.c
+++ b/mplayer/stream/stream_smb.c
@@ -109,7 +109,6 @@ static void close_f(stream_t *s){
 }
 
 static int open_f (stream_t *stream, int mode, void *opts, int* file_format) {
-  struct stream_priv_s *p = (struct stream_priv_s*)opts;
   char *filename;
   mode_t m = 0;
   off_t len;
diff --git a/mplayer/sub/ass_mp.c b/mplayer/sub/ass_mp.c
index 98602ac..78f607b 100644
--- a/mplayer/sub/ass_mp.c
+++ b/mplayer/sub/ass_mp.c
@@ -233,50 +233,28 @@ ASS_Track *mp_ass_read_subdata(ASS_Library *library, sub_data *subdata,
 ASS_Track *mp_ass_read_stream(ASS_Library *library, const char *fname,
                               char *charset)
 {
-    int i;
-    char *buf = NULL;
     ASS_Track *track;
-    size_t sz = 0;
-    size_t buf_alloc = 0;
-    stream_t *fd;
 
-    fd = open_stream(fname, NULL, NULL);
-    if (!fd)
+    struct stream *s = open_stream(fname, NULL, NULL);
+    if (!s)
         // Stream code should have printed an error already
         return NULL;
-    if (fd->end_pos > STREAM_BUFFER_SIZE)
-        /* read entire file if size is known */
-        buf_alloc = fd->end_pos;
-    else
-        buf_alloc = 1000;
-    for (;;) {
-        if (sz > 100000000) {
-            mp_tmsg(MSGT_ASS, MSGL_ERR, "Refusing to load subtitle file "
-                    "larger than 100 MB: %s\n", fname);
-            sz = 0;
-            break;
-        }
-        buf_alloc = FFMAX(buf_alloc, sz + (sz >> 1));
-        buf_alloc = FFMIN(buf_alloc, 100000001);
-        buf = realloc(buf, buf_alloc + 1);
-        i = stream_read(fd, buf + sz, buf_alloc - sz);
-        if (i <= 0)
-            break;
-        sz += i;
-    }
-    free_stream(fd);
-    if (!sz) {
-        free(buf);
+    struct bstr content = stream_read_complete(s, NULL, 100000000, 1);
+    if (content.start == NULL)
+        mp_tmsg(MSGT_ASS, MSGL_ERR, "Refusing to load subtitle file "
+                "larger than 100 MB: %s\n", fname);
+    free_stream(s);
+    if (content.len == 0) {
+        talloc_free(content.start);
         return NULL;
     }
-    buf[sz] = 0;
-    buf = realloc(buf, sz + 1);
-    track = ass_read_memory(library, buf, sz, charset);
+    content.start[content.len] = 0;
+    track = ass_read_memory(library, content.start, content.len, charset);
     if (track) {
         free(track->name);
         track->name = strdup(fname);
     }
-    free(buf);
+    talloc_free(content.start);
     return track;
 }
 
diff --git a/mplayer/sub/find_subfiles.c b/mplayer/sub/find_subfiles.c
new file mode 100644
index 0000000..0de8bc4
--- /dev/null
+++ b/mplayer/sub/find_subfiles.c
@@ -0,0 +1,275 @@
+#include <dirent.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+
+#include "mp_msg.h"
+#include "options.h"
+#include "path.h"
+#include "mpcommon.h"
+#include "sub/find_subfiles.h"
+#include "sub/sub.h"
+
+static struct bstr strip_ext(struct bstr str)
+{
+    int dotpos = bstrrchr(str, '.');
+    if (dotpos < 0)
+        return str;
+    return (struct bstr){str.start, dotpos};
+}
+
+static struct bstr get_ext(struct bstr s)
+{
+    int dotpos = bstrrchr(s, '.');
+    if (dotpos < 0)
+        return (struct bstr){NULL, 0};
+    return bstr_splice(s, dotpos + 1, s.len);
+}
+
+struct subfn {
+    int priority;
+    char *fname;
+};
+
+static int compare_sub_priority(const void *a, const void *b)
+{
+    const struct subfn *s1 = a;
+    const struct subfn *s2 = b;
+    if (s1->priority > s2->priority)
+        return -1;
+    if (s1->priority < s2->priority)
+        return 1;
+    return strcoll(s1->fname, s2->fname);
+}
+
+static struct bstr guess_lang_from_filename(struct bstr name)
+{
+    if (name.len < 2)
+        return (struct bstr){NULL, 0};
+
+    int n = 0;
+    int i = name.len - 1;
+
+    if (name.start[i] == ')' || name.start[i] == ']')
+        i--;
+    while (i >= 0 && isalpha(name.start[i])) {
+        n++;
+        if (n > 3)
+            return (struct bstr){NULL, 0};
+        i--;
+    }
+    if (n < 2)
+        return (struct bstr){NULL, 0};
+    return (struct bstr){name.start + i + 1, n};
+}
+
+struct sub_list {
+    struct subfn subs[MAX_SUBTITLE_FILES];
+    int sid;
+    void *ctx;
+};
+
+/**
+ * @brief Append all the subtitles in the given path matching fname
+ * @param opts MPlayer options
+ * @param slist pointer to the subtitles list tallocated
+ * @param nsub pointer to the number of subtitles
+ * @param path Look for subtitles in this directory
+ * @param fname Subtitle filename (pattern)
+ * @param limit_fuzziness Ignore flag when sub_fuziness == 2
+ */
+static void append_dir_subtitles(struct MPOpts *opts,
+                                 struct subfn **slist, int *nsub,
+                                 struct bstr path, const char *fname,
+                                 int limit_fuzziness)
+{
+    char *sub_exts[] = {"utf", "utf8", "utf-8", "sub", "srt", "smi", "rt", "txt", "ssa", "aqt", "jss", "js", "ass", NULL};
+    void *tmpmem = talloc_new(NULL);
+    FILE *f;
+    assert(strlen(fname) < 1e6);
+
+    struct bstr f_fname = BSTR(mp_basename(fname));
+    struct bstr f_fname_noext = strip_ext(f_fname);
+    bstr_lower(f_fname_noext);
+    struct bstr f_fname_trim = bstr_strip(f_fname_noext);
+
+    // 0 = nothing
+    // 1 = any subtitle file
+    // 2 = any sub file containing movie name
+    // 3 = sub file containing movie name and the lang extension
+    char *path0 = bstrdup0(tmpmem, path);
+    DIR *d = opendir(path0);
+    if (!d)
+        goto out;
+    mp_msg(MSGT_SUBREADER, MSGL_INFO, "Load subtitles in %.*s\n", BSTR_P(path));
+    struct dirent *de;
+    while ((de = readdir(d))) {
+        struct bstr dename = BSTR(de->d_name);
+        void *tmpmem2 = talloc_new(tmpmem);
+
+        // retrieve various parts of the filename
+        struct bstr tmp_fname_noext = bstrdup(tmpmem2, strip_ext(dename));
+        bstr_lower(tmp_fname_noext);
+        struct bstr tmp_fname_ext = get_ext(dename);
+        struct bstr tmp_fname_trim = bstr_strip(tmp_fname_noext);
+
+        // If it's a .sub, check if there is a .idx with the same name. If
+        // there is one, it's certainly a vobsub so we skip it.
+        if (bstrcasecmp(tmp_fname_ext, BSTR("sub")) == 0) {
+            char *idxname = talloc_asprintf(tmpmem2, "%.*s.idx",
+                                            (int)tmp_fname_noext.len,
+                                            de->d_name);
+            char *idx = mp_path_join(tmpmem2, path, BSTR(idxname));
+            f = fopen(idx, "rt");
+            if (f) {
+                fclose(f);
+                goto next_sub;
+            }
+        }
+
+        // does it end with a subtitle extension?
+#ifdef CONFIG_ICONV
+#ifdef CONFIG_ENCA
+        int i = (sub_cp && strncasecmp(sub_cp, "enca", 4) != 0) ? 3 : 0;
+#else
+        int i = sub_cp ? 3 : 0;
+#endif
+#else
+        int i = 0;
+#endif
+        while (1) {
+            if (!sub_exts[i])
+                goto next_sub;
+            if (bstrcasecmp(BSTR(sub_exts[i]), tmp_fname_ext) == 0)
+                break;
+            i++;
+        }
+
+        // we have a (likely) subtitle file
+        int prio = 0;
+        if (opts->sub_lang) {
+            if (bstr_startswith(tmp_fname_trim, f_fname_trim)) {
+                struct bstr lang = guess_lang_from_filename(tmp_fname_trim);
+                if (lang.len) {
+                    for (int n = 0; opts->sub_lang[n]; n++) {
+                        if (bstr_startswith(lang,
+                                            BSTR(opts->sub_lang[n]))) {
+                            prio = 4; // matches the movie name + lang extension
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        if (!prio && bstrcmp(tmp_fname_trim, f_fname_trim) == 0)
+            prio = 3; // matches the movie name
+        if (!prio && bstr_find(tmp_fname_trim, f_fname_trim) >= 0
+            && sub_match_fuzziness >= 1)
+            prio = 2; // contains the movie name
+        if (!prio) {
+            // doesn't contain the movie name
+            // don't try in the mplayer subtitle directory
+            if (!limit_fuzziness && sub_match_fuzziness >= 2) {
+                prio = 1;
+            }
+        }
+
+        mp_msg(MSGT_SUBREADER, MSGL_DBG2, "Potential sub file: "
+               "\"%s\"  Priority: %d\n", de->d_name, prio);
+        if (prio) {
+            prio += prio;
+#ifdef CONFIG_ICONV
+            if (i < 3) // prefer UTF-8 coded
+                prio++;
+#endif
+            char *subpath = mp_path_join(*slist, path, dename);
+            if ((f = fopen(subpath, "rt"))) {
+                MP_GROW_ARRAY(*slist, *nsub);
+                struct subfn *sub = *slist + (*nsub)++;
+
+                fclose(f);
+                sub->priority = prio;
+                sub->fname    = subpath;
+            } else
+                talloc_free(subpath);
+        }
+
+    next_sub:
+        talloc_free(tmpmem2);
+    }
+    closedir(d);
+
+ out:
+    talloc_free(tmpmem);
+}
+
+char **find_text_subtitles(struct MPOpts *opts, const char *fname)
+{
+    char **subnames = NULL;
+    struct subfn *slist = talloc_array_ptrtype(NULL, slist, 1);
+    int n = 0;
+
+    // Load subtitles from current media directory
+    append_dir_subtitles(opts, &slist, &n, mp_dirname(fname), fname, 0);
+
+    // Load subtitles in dirs specified by sub-paths option
+    if (opts->sub_paths) {
+        for (int i = 0; opts->sub_paths[i]; i++) {
+            char *path = mp_path_join(slist, mp_dirname(fname),
+                                      BSTR(opts->sub_paths[i]));
+            append_dir_subtitles(opts, &slist, &n, BSTR(path), fname, 0);
+        }
+    }
+
+    // Load subtitles in ~/.mplayer/sub limiting sub fuzziness
+    char *mp_subdir = get_path("sub/");
+    if (mp_subdir)
+        append_dir_subtitles(opts, &slist, &n, BSTR(mp_subdir), fname, 1);
+    free(mp_subdir);
+
+    // Sort subs by priority and append them
+    qsort(slist, n, sizeof(*slist), compare_sub_priority);
+
+    subnames = talloc_array_ptrtype(NULL, subnames, n);
+    for (int i = 0; i < n; i++)
+        subnames[i] = talloc_strdup(subnames, slist[i].fname);
+
+    talloc_free(slist);
+    return subnames;
+}
+
+char **find_vob_subtitles(struct MPOpts *opts, const char *fname)
+{
+    char **vobs = talloc_array_ptrtype(NULL, vobs, 1);
+    int n = 0;
+
+    // Potential vobsub in the media directory
+    struct bstr bname = BSTR(mp_basename(fname));
+    int pdot = bstrrchr(bname, '.');
+    if (pdot >= 0)
+        bname.len = pdot;
+    vobs[n++] = mp_path_join(vobs, mp_dirname(fname), bname);
+
+    // Potential vobsubs in directories specified by sub-paths option
+    if (opts->sub_paths) {
+        for (int i = 0; opts->sub_paths[i]; i++) {
+            char *path = mp_path_join(NULL, mp_dirname(fname),
+                                      BSTR(opts->sub_paths[i]));
+            MP_GROW_ARRAY(vobs, n);
+            vobs[n++] = mp_path_join(vobs, BSTR(path), bname);
+            talloc_free(path);
+        }
+    }
+
+    // Potential vobsub in ~/.mplayer/sub
+    char *mp_subdir = get_path("sub/");
+    if (mp_subdir) {
+        MP_GROW_ARRAY(vobs, n);
+        vobs[n++] = mp_path_join(vobs, BSTR(mp_subdir), bname);
+    }
+
+    free(mp_subdir);
+    MP_RESIZE_ARRAY(NULL, vobs, n);
+    return vobs;
+}
diff --git a/mplayer/sub/find_subfiles.h b/mplayer/sub/find_subfiles.h
new file mode 100644
index 0000000..c93164c
--- /dev/null
+++ b/mplayer/sub/find_subfiles.h
@@ -0,0 +1,29 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_FIND_SUBFILES_H
+#define MPLAYER_FIND_SUBFILES_H
+
+#define MAX_SUBTITLE_FILES 128
+
+struct MPOpts;
+
+char **find_text_subtitles(struct MPOpts *opts, const char *fname);
+char **find_vob_subtitles(struct MPOpts *opts, const char *fname);
+
+#endif /* MPLAYER_FINDFILES_H */
diff --git a/mplayer/sub/sub.c b/mplayer/sub/sub.c
index c9368a4..3edbb02 100644
--- a/mplayer/sub/sub.c
+++ b/mplayer/sub/sub.c
@@ -718,7 +718,7 @@ inline static void vo_update_text_sub(struct osd_state *osd, mp_osd_obj_t* obj,i
 	    // reading the subtitle words from vo_sub->text[]
           while (*t) {
             if (sub_utf8)
-              c = utf8_get_char(&t);
+              c = utf8_get_char((const char **)&t);
             else if ((c = *t++) >= 0x80 && sub_unicode)
               c = (c<<8) + *t++;
 	      if (k==MAX_UCS){
diff --git a/mplayer/sub/subreader.c b/mplayer/sub/subreader.c
index 1f9294e..6acecb5 100644
--- a/mplayer/sub/subreader.c
+++ b/mplayer/sub/subreader.c
@@ -24,8 +24,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
-
 #include <sys/types.h>
 #include <dirent.h>
 
@@ -1856,284 +1854,6 @@ if ((suboverlap_enabled == 2) ||
     return subt_data;
 }
 
-#if 0
-char * strreplace( char * in,char * what,char * whereof )
-{
- int i;
- char * tmp;
-
- if ( ( in == NULL )||( what == NULL )||( whereof == NULL )||( ( tmp=strstr( in,what ) ) == NULL ) ) return NULL;
- for( i=0;i<strlen( whereof );i++ ) tmp[i]=whereof[i];
- if ( strlen( what ) > strlen( whereof ) ) tmp[i]=0;
- return in;
-}
-#endif
-
-
-static void strcpy_trim(char *d, char *s)
-{
-    // skip leading whitespace
-    while (*s && isspace(*s)) {
-	s++;
-    }
-    for (;;) {
-	// copy word
-	while (*s && !isspace(*s)) {
-	    *d = tolower(*s);
-	    s++; d++;
-	}
-	if (*s == 0) break;
-	// trim excess whitespace
-	while (*s && isspace(*s)) {
-	    s++;
-	}
-	if (*s == 0) break;
-	*d++ = ' ';
-    }
-    *d = 0;
-}
-
-static void strcpy_strip_ext(char *d, char *s)
-{
-    char *tmp = strrchr(s,'.');
-    if (!tmp) {
-	strcpy(d, s);
-	return;
-    } else {
-	strncpy(d, s, tmp-s);
-	d[tmp-s] = 0;
-    }
-    while (*d) {
-	*d = tolower(*d);
-	d++;
-    }
-}
-
-static void strcpy_get_ext(char *d, char *s)
-{
-    char *tmp = strrchr(s,'.');
-    if (!tmp) {
-	strcpy(d, "");
-	return;
-    } else {
-	strcpy(d, tmp+1);
-   }
-}
-
-static int whiteonly(char *s)
-{
-    while (*s) {
-	if (!isspace(*s)) return 0;
-	s++;
-  }
-    return 1;
-}
-
-typedef struct subfn
-{
-    int priority;
-    char *fname;
-} subfn;
-
-static int compare_sub_priority(const void *a, const void *b)
-{
-    if (((const subfn*)a)->priority > ((const subfn*)b)->priority) {
-	return -1;
-    } else if (((const subfn*)a)->priority < ((const subfn*)b)->priority) {
-	return 1;
-    } else {
-	return strcoll(((const subfn*)a)->fname, ((const subfn*)b)->fname);
-    }
-}
-
-char** sub_filenames(const char* path, char *fname)
-{
-    char *f_dir, *f_fname, *f_fname_noext, *f_fname_trim, *tmp, *tmp_sub_id;
-    char *tmp_fname_noext, *tmp_fname_trim, *tmp_fname_ext, *tmpresult;
-
-    int len, pos, found, i, j;
-    char * sub_exts[] = {  "utf", "utf8", "utf-8", "sub", "srt", "smi", "rt", "txt", "ssa", "aqt", "jss", "js", "ass", NULL};
-    subfn *result;
-    char **result2;
-
-    int subcnt;
-
-    FILE *f;
-
-    DIR *d;
-    struct dirent *de;
-
-    len = (strlen(fname) > 256 ? strlen(fname) : 256)
-	+(strlen(path) > 256 ? strlen(path) : 256)+2;
-
-    f_dir = malloc(len);
-    f_fname = malloc(len);
-    f_fname_noext = malloc(len);
-    f_fname_trim = malloc(len);
-
-    tmp_fname_noext = malloc(len);
-    tmp_fname_trim = malloc(len);
-    tmp_fname_ext = malloc(len);
-
-    tmpresult = malloc(len);
-
-    result = calloc(MAX_SUBTITLE_FILES, sizeof(*result));
-
-    subcnt = 0;
-
-    tmp = strrchr(fname,'/');
-#if HAVE_DOS_PATHS
-    if(!tmp)tmp = strrchr(fname,'\\');
-    if(!tmp)tmp = strrchr(fname,':');
-#endif
-
-    // extract filename & dirname from fname
-    if (tmp) {
-	strcpy(f_fname, tmp+1);
-	pos = tmp - fname;
-	strncpy(f_dir, fname, pos+1);
-	f_dir[pos+1] = 0;
-    } else {
-	strcpy(f_fname, fname);
-	strcpy(f_dir, "./");
-    }
-
-    strcpy_strip_ext(f_fname_noext, f_fname);
-    strcpy_trim(f_fname_trim, f_fname_noext);
-
-    /* The code using sub language here is broken - it assumes strict
-     * "videoname languagename" syntax for the subtitle file, which is
-     * very unlikely to match especially if language name uses "en,de"
-     * syntax... */
-    tmp_sub_id = NULL;
-#if 0
-    if (dvdsub_lang && !whiteonly(dvdsub_lang)) {
-	tmp_sub_id = malloc(strlen(dvdsub_lang)+1);
-	strcpy_trim(tmp_sub_id, dvdsub_lang);
-    }
-#endif
-
-    // 0 = nothing
-    // 1 = any subtitle file
-    // 2 = any sub file containing movie name
-    // 3 = sub file containing movie name and the lang extension
-    for (j = 0; j <= 1; j++) {
-	d = opendir(j == 0 ? f_dir : path);
-	if (d) {
-	    while ((de = readdir(d))) {
-		// retrieve various parts of the filename
-		strcpy_strip_ext(tmp_fname_noext, de->d_name);
-		strcpy_get_ext(tmp_fname_ext, de->d_name);
-		strcpy_trim(tmp_fname_trim, tmp_fname_noext);
-
-		// does it end with a subtitle extension?
-		found = 0;
-#ifdef CONFIG_ICONV
-#ifdef CONFIG_ENCA
-		for (i = ((sub_cp && strncasecmp(sub_cp, "enca", 4) != 0) ? 3 : 0); sub_exts[i]; i++) {
-#else
-		for (i = (sub_cp ? 3 : 0); sub_exts[i]; i++) {
-#endif
-#else
-		for (i = 0; sub_exts[i]; i++) {
-#endif
-		    if (strcasecmp(sub_exts[i], tmp_fname_ext) == 0) {
-			found = 1;
-			break;
-		    }
-		}
-
-		// we have a (likely) subtitle file
-		if (found) {
-		    int prio = 0;
-		    if (!prio && tmp_sub_id)
-		    {
-			sprintf(tmpresult, "%s %s", f_fname_trim, tmp_sub_id);
-			if (strcmp(tmp_fname_trim, tmpresult) == 0 && sub_match_fuzziness >= 1) {
-			    // matches the movie name + lang extension
-			    prio = 5;
-			}
-		    }
-		    if (!prio && strcmp(tmp_fname_trim, f_fname_trim) == 0) {
-			// matches the movie name
-			prio = 4;
-		    }
-		    if (!prio && (tmp = strstr(tmp_fname_trim, f_fname_trim)) && (sub_match_fuzziness >= 1)) {
-			// contains the movie name
-			tmp += strlen(f_fname_trim);
-			if (tmp_sub_id && strstr(tmp, tmp_sub_id)) {
-			    // with sub_id specified prefer localized subtitles
-			    prio = 3;
-			} else if ((tmp_sub_id == NULL) && whiteonly(tmp)) {
-			    // without sub_id prefer "plain" name
-			    prio = 3;
-			} else {
-			    // with no localized subs found, try any else instead
-			    prio = 2;
-			}
-		    }
-		    if (!prio) {
-			// doesn't contain the movie name
-			// don't try in the mplayer subtitle directory
-			if ((j == 0) && (sub_match_fuzziness >= 2)) {
-			    prio = 1;
-			}
-		    }
-
-                    mp_msg(MSGT_SUBREADER, MSGL_DBG2, "Potential sub file: "
-                           "\"%s\"  Priority: %d\n", de->d_name, prio);
-		    if (prio) {
-			prio += prio;
-#ifdef CONFIG_ICONV
-			if (i<3){ // prefer UTF-8 coded
-			    prio++;
-			}
-#endif
-			sprintf(tmpresult, "%s%s", j == 0 ? f_dir : path, de->d_name);
-//			fprintf(stderr, "%s priority %d\n", tmpresult, prio);
-			if ((f = fopen(tmpresult, "rt"))) {
-			    fclose(f);
-			    result[subcnt].priority = prio;
-			    result[subcnt].fname = strdup(tmpresult);
-			    subcnt++;
-			}
-		    }
-
-		}
-		if (subcnt >= MAX_SUBTITLE_FILES) break;
-	    }
-	    closedir(d);
-	}
-
-    }
-
-    free(tmp_sub_id);
-
-    free(f_dir);
-    free(f_fname);
-    free(f_fname_noext);
-    free(f_fname_trim);
-
-    free(tmp_fname_noext);
-    free(tmp_fname_trim);
-    free(tmp_fname_ext);
-
-    free(tmpresult);
-
-    qsort(result, subcnt, sizeof(subfn), compare_sub_priority);
-
-    result2 = calloc(subcnt + 1, sizeof(*result2));
-
-    for (i = 0; i < subcnt; i++) {
-	result2[i] = result[i].fname;
-    }
-    result2[subcnt] = NULL;
-
-    free(result);
-
-    return result2;
-}
-
 void list_sub_file(sub_data* subd){
     int i,j;
     subtitle *subs = subd->subtitles;
diff --git a/mplayer/sub/subreader.h b/mplayer/sub/subreader.h
index 9c7465d..079238a 100644
--- a/mplayer/sub/subreader.h
+++ b/mplayer/sub/subreader.h
@@ -48,8 +48,6 @@ extern int sub_match_fuzziness;
 // One of the SUB_* constant above
 extern int sub_format;
 
-#define MAX_SUBTITLE_FILES 128
-
 #define SUB_MAX_TEXT 12
 #define SUB_ALIGNMENT_BOTTOMLEFT       1
 #define SUB_ALIGNMENT_BOTTOMCENTER     2
@@ -97,7 +95,6 @@ void subcp_close (void); /* for demux_ogg.c */
 const char* guess_buffer_cp(unsigned char* buffer, int buflen, const char *preferred_language, const char *fallback);
 const char* guess_cp(struct stream *st, const char *preferred_language, const char *fallback);
 #endif
-char ** sub_filenames(const char *path, char *fname);
 void list_sub_file(sub_data* subd);
 void dump_srt(sub_data* subd, float fps);
 void dump_mpsub(sub_data* subd, float fps);
diff --git a/mplayer/sub/vobsub.c b/mplayer/sub/vobsub.c
index 08efa3a..a2fc94f 100644
--- a/mplayer/sub/vobsub.c
+++ b/mplayer/sub/vobsub.c
@@ -1109,20 +1109,22 @@ int vobsub_get_index_by_id(void *vobhandle, int id)
     return j;
 }
 
-int vobsub_set_from_lang(void *vobhandle, unsigned char * lang)
+int vobsub_set_from_lang(void *vobhandle, char **lang)
 {
     int i;
     vobsub_t *vob= vobhandle;
-    while (lang && strlen(lang) >= 2) {
+    if (!lang)
+        goto end;
+    for (int n = 0; lang[n]; n++) {
         for (i = 0; i < vob->spu_streams_size; i++)
             if (vob->spu_streams[i].id)
-                if ((strncmp(vob->spu_streams[i].id, lang, 2) == 0)) {
+                if ((strncmp(vob->spu_streams[i].id, lang[n], 2) == 0)) {
                     vobsub_id = i;
                     mp_msg(MSGT_VOBSUB, MSGL_INFO, "Selected VOBSUB language: %d language: %s\n", i, vob->spu_streams[i].id);
                     return 0;
                 }
-        lang+=2;while (lang[0]==',' || lang[0]==' ') ++lang;
     }
+end:
     mp_msg(MSGT_VOBSUB, MSGL_WARN, "No matching VOBSUB language found!\n");
     return -1;
 }
diff --git a/mplayer/sub/vobsub.h b/mplayer/sub/vobsub.h
index b076e4b..3cef134 100644
--- a/mplayer/sub/vobsub.h
+++ b/mplayer/sub/vobsub.h
@@ -41,7 +41,7 @@ unsigned int vobsub_rgb_to_yuv(unsigned int rgb);
 void *vobsub_out_open(const char *basename, const unsigned int *palette, unsigned int orig_width, unsigned int orig_height, const char *id, unsigned int index);
 void vobsub_out_output(void *me, const unsigned char *packet, int len, double pts);
 void vobsub_out_close(void *me);
-int vobsub_set_from_lang(void *vobhandle, unsigned char * lang);
+int vobsub_set_from_lang(void *vobhandle, char **lang);
 void vobsub_seek(void * vobhandle, float pts);
 
 #endif /* MPLAYER_VOBSUB_H */
diff --git a/mplayer/timeline/tl_edl.c b/mplayer/timeline/tl_edl.c
new file mode 100644
index 0000000..99b9dda
--- /dev/null
+++ b/mplayer/timeline/tl_edl.c
@@ -0,0 +1,398 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <inttypes.h>
+#include <ctype.h>
+
+#include "talloc.h"
+
+#include "mp_core.h"
+#include "mp_msg.h"
+#include "libmpdemux/demuxer.h"
+#include "path.h"
+#include "bstr.h"
+#include "mpcommon.h"
+
+
+struct edl_source {
+    struct bstr id;
+    char *filename;
+    int lineno;
+};
+
+struct edl_time {
+    int64_t start;
+    int64_t end;
+    bool implied_start;
+    bool implied_end;
+};
+
+struct edl_part {
+    struct edl_time tl;
+    struct edl_time src;
+    int64_t duration;
+    int id;
+    int lineno;
+};
+
+static int find_edl_source(struct edl_source *sources, int num_sources,
+                           struct bstr name)
+{
+    for (int i = 0; i < num_sources; i++)
+        if (!bstrcmp(sources[i].id, name))
+            return i;
+    return -1;
+}
+
+void build_edl_timeline(struct MPContext *mpctx)
+{
+    const struct bstr file_prefix = BSTR("<");
+    void *tmpmem = talloc_new(NULL);
+
+    struct bstr *lines = bstr_splitlines(tmpmem, mpctx->demuxer->file_contents);
+    int linec = MP_TALLOC_ELEMS(lines);
+    struct bstr header = BSTR("mplayer EDL file, version ");
+    if (!linec || !bstr_startswith(lines[0], header)) {
+        mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Bad EDL header!\n");
+        goto out;
+    }
+    struct bstr version = bstr_strip(bstr_cut(lines[0], header.len));
+    if (bstrcmp(BSTR("2"), version)) {
+        mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Unsupported EDL file version!\n");
+        goto out;
+    }
+    int num_sources = 0;
+    int num_parts = 0;
+    for (int i = 1; i < linec; i++) {
+        if (bstr_startswith(lines[i], file_prefix)) {
+            num_sources++;
+        } else {
+            int comment = bstrchr(lines[i], '#');
+            if (comment >= 0)
+                lines[i] = bstr_splice(lines[i], 0, comment);
+            if (bstr_strip(lines[i]).len)
+                num_parts++;
+        }
+    }
+    if (!num_parts) {
+        mp_msg(MSGT_CPLAYER, MSGL_ERR, "No parts in timeline!\n");
+        goto out;
+    }
+
+    // Parse source filename definitions
+
+    struct edl_source *edl_ids = talloc_array_ptrtype(tmpmem, edl_ids,
+                                                      num_sources);
+    num_sources = 0;
+    for (int i = 1; i < linec; i++) {
+        struct bstr line = lines[i];
+        if (!bstr_startswith(line, file_prefix))
+            continue;
+        line = bstr_cut(line, file_prefix.len);
+        struct bstr id = bstr_split(line, WHITESPACE, &line);
+        if (find_edl_source(edl_ids, num_sources, id) >= 0) {
+            mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Repeated ID on line %d!\n",
+                   i+1);
+            goto out;
+        }
+        if (!isalpha(*id.start)) {
+            mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Invalid ID on line %d!\n",
+                   i+1);
+            goto out;
+        }
+        char *filename = mp_basename(bstrdup0(tmpmem, bstr_strip(line)));
+        if (!strlen(filename)) {
+            mp_msg(MSGT_CPLAYER, MSGL_ERR,
+                   "EDL: Invalid filename on line %d!\n", i+1);
+            goto out;
+        }
+        struct bstr dirname = mp_dirname(mpctx->demuxer->filename);
+        char *fullname = mp_path_join(tmpmem, dirname, BSTR(filename));
+        edl_ids[num_sources++] = (struct edl_source){id, fullname, i+1};
+    }
+
+    // Parse timeline part definitions
+
+    struct edl_part *parts = talloc_array_ptrtype(tmpmem, parts, num_parts);
+    int total_parts = num_parts;
+    num_parts = 0;
+    for (int i = 1; i < linec; i++) {
+        struct bstr line = bstr_strip(lines[i]);
+        if (!line.len || bstr_startswith(line, file_prefix))
+            continue;
+        parts[num_parts] = (struct edl_part){{-1, -1}, {-1, -1}, 0, -1};
+        parts[num_parts].lineno = i + 1;
+        for (int s = 0; s < 2; s++) {
+            struct edl_time *p = !s ? &parts[num_parts].tl :
+                &parts[num_parts].src;
+            while (1) {
+                struct bstr t = bstr_split(line, WHITESPACE, &line);
+                if (!t.len) {
+                    if (!s && num_parts < total_parts - 1) {
+                        mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: missing source "
+                               "identifier on line %d (not last)!\n", i+1);
+                        goto out;
+                    }
+                    break;
+                }
+                if (isalpha(*t.start)) {
+                    if (s)
+                        goto bad;
+                    parts[num_parts].id = find_edl_source(edl_ids, num_sources,
+                                                          t);
+                    if (parts[num_parts].id < 0) {
+                        mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Undefined source "
+                               "identifier on line %d!\n", i+1);
+                        goto out;
+                    }
+                    break;
+                }
+                while (t.len) {
+                    struct bstr next;
+                    struct bstr arg = bstr_split(t, "+-", &next);
+                    if (!arg.len) {
+                        next = bstr_split(line, WHITESPACE, &line);
+                        arg = bstr_split(next, "+-", &next);
+                    }
+                    if (!arg.len)
+                        goto bad;
+                    int64_t val;
+                    if (!bstrcmp(arg, BSTR("*")))
+                        val = -1;
+                    else if (isdigit(*arg.start)) {
+                        val = bstrtoll(arg, &arg, 10) * 1000000000;
+                        if (arg.len && *arg.start == '.') {
+                            int len = arg.len - 1;
+                            arg = bstr_splice(arg, 1, 10);
+                            int64_t val2 = bstrtoll(arg, &arg, 10);
+                            if (arg.len)
+                                goto bad;
+                            for (; len < 9; len++)
+                                val2 *= 10;
+                            val += val2;
+                        }
+                    } else
+                        goto bad;
+                    int c = *t.start;
+                    if (isdigit(c) || c == '*') {
+                        if (val < 0)
+                            p->implied_start = true;
+                        else
+                            p->start = val;
+                    } else if (c == '-') {
+                        if (val < 0)
+                            p->implied_end = true;
+                        else
+                            p->end = val;
+                    } else if (c == '+') {
+                        if (val < 0)
+                            goto bad;
+                        if (val == 0) {
+                            mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: zero duration "
+                                   "on line %d!\n", i+1);
+                            goto out;
+                        }
+                        parts[num_parts].duration = val;
+                    } else
+                        goto bad;
+                    t = next;
+                }
+            }
+        }
+        num_parts++;
+        continue;
+    bad:
+        mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Malformed line %d!\n", i+1);
+        goto out;
+    }
+
+    // Fill in implied start/stop/duration values
+
+    int64_t *times = talloc_zero_array(tmpmem, int64_t, num_sources);
+    while (1) {
+        int64_t time = 0;
+        for (int i = 0; i < num_parts; i++) {
+            for (int s = 0; s < 2; s++) {
+                struct edl_time *p = s ? &parts[i].tl : &parts[i].src;
+                if (!s && parts[i].id == -1)
+                    continue;
+                int64_t *t = s ? &time : times + parts[i].id;
+                p->implied_start |= s && *t >= 0;
+                if (p->implied_start && p->start >= 0 && *t >= 0
+                    && p->start != *t) {
+                    mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Inconsistent line "
+                           "%d!\n", parts[i].lineno);
+                    goto out;
+                }
+                if (p->start >= 0)
+                    *t = p->start;
+                if (p->implied_start)
+                    p->start = *t;
+                if (*t >= 0 && parts[i].duration)
+                    *t += parts[i].duration;
+                else
+                    *t = -1;
+                if (p->end >= 0)
+                    *t = p->end;
+            }
+        }
+        for (int i = 0; i < num_sources; i++)
+            times[i] = -1;
+        time = -1;
+        for (int i = num_parts - 1; i >= 0; i--) {
+            for (int s = 0; s < 2; s++) {
+                struct edl_time *p = s ? &parts[i].tl : &parts[i].src;
+                if (!s && parts[i].id == -1)
+                    continue;
+                int64_t *t = s ? &time : times + parts[i].id;
+                p->implied_end |= s && *t >= 0;
+                if (p->implied_end && p->end >= 0 && *t >=0 && p->end != *t) {
+                    mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Inconsistent line "
+                           "%d!\n", parts[i].lineno);
+                    goto out;
+                }
+                if (p->end >= 0)
+                    *t = p->end;
+                if (p->implied_end)
+                    p->end = *t;
+                if (*t >= 0 && parts[i].duration) {
+                    *t -= parts[i].duration;
+                    if (t < 0) {
+                        mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Negative time "
+                               "on line %d!\n", parts[i].lineno);
+                        goto out;
+                    }
+                } else
+                    *t = -1;
+                if (p->start >= 0)
+                    *t = p->start;
+            }
+        }
+        int missing_duration = -1;
+        int missing_srcstart = -1;
+        bool anything_done = false;
+        for (int i = 0; i < num_parts; i++) {
+            int64_t duration = parts[i].duration;
+            if (parts[i].tl.start >= 0 && parts[i].tl.end >= 0) {
+                int64_t duration2 = parts[i].tl.end - parts[i].tl.start;
+                if (duration && duration != duration2)
+                    goto incons;
+                duration = duration2;
+                if (duration <= 0)
+                    goto neg;
+            }
+            if (parts[i].src.start >= 0 && parts[i].src.end >= 0) {
+                int64_t duration2 = parts[i].src.end - parts[i].src.start;
+                if (duration && duration != duration2) {
+                incons:
+                    mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Inconsistent line "
+                           "%d!\n", i+1);
+                    goto out;
+                }
+                duration = duration2;
+                if (duration <= 0) {
+                neg:
+                    mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: duration <= 0 on "
+                           "line %d!\n", parts[i].lineno);
+                    goto out;
+                }
+            }
+            if (parts[i].id == -1)
+                continue;
+            if (!duration)
+                missing_duration = i;
+            else if (!parts[i].duration)
+                anything_done = true;
+            parts[i].duration = duration;
+            if (duration && parts[i].src.start < 0)
+                if (parts[i].src.end < 0)
+                    missing_srcstart = i;
+                else
+                    parts[i].src.start = parts[i].src.end - duration;
+        }
+        if (!anything_done) {
+            if (missing_duration >= 0) {
+                mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Could not determine "
+                        "duration for line %d!\n",
+                        parts[missing_duration].lineno);
+                goto out;
+            }
+            if (missing_srcstart >= 0) {
+                mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: no source start time for "
+                       "line %d!\n", parts[missing_srcstart].lineno);
+                    goto out;
+            }
+            break;
+        }
+    }
+
+    // Open source files
+
+    struct content_source *sources = talloc_array_ptrtype(NULL, sources,
+                                                          num_sources + 1);
+    mpctx->sources = sources;
+    sources[0].stream = mpctx->stream;
+    sources[0].demuxer = mpctx->demuxer;
+    mpctx->num_sources = 1;
+
+    for (int i = 0; i < num_sources; i++) {
+        int format = 0;
+        struct stream *s = open_stream(edl_ids[i].filename, &mpctx->opts,
+                                       &format);
+        if (!s)
+            goto openfail;
+        struct demuxer *d = demux_open(&mpctx->opts, s, format,
+                                       mpctx->opts.audio_id,
+                                       mpctx->opts.video_id,
+                                       mpctx->opts.sub_id,
+                                       edl_ids[i].filename);
+        if (!d) {
+            free_stream(s);
+        openfail:
+            mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Could not open source "
+                   "file on line %d!\n", edl_ids[i].lineno);
+            goto out;
+        }
+        sources[mpctx->num_sources].stream = s;
+        sources[mpctx->num_sources].demuxer = d;
+        mpctx->num_sources++;
+    }
+
+    // Write final timeline structure
+
+    struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline,
+                                                          num_parts + 1);
+    int64_t starttime = 0;
+    for (int i = 0; i < num_parts; i++) {
+        timeline[i].start = starttime / 1e9;
+        starttime += parts[i].duration;
+        timeline[i].source_start = parts[i].src.start / 1e9;
+        timeline[i].source = sources + parts[i].id + 1;
+    }
+    if (parts[num_parts - 1].id != -1) {
+        timeline[num_parts].start = starttime / 1e9;
+        num_parts++;
+    }
+    mpctx->timeline = timeline;
+    mpctx->num_timeline_parts = num_parts - 1;
+
+ out:
+    talloc_free(tmpmem);
+}
diff --git a/mplayer/timeline/tl_matroska.c b/mplayer/timeline/tl_matroska.c
new file mode 100644
index 0000000..03b6cc3
--- /dev/null
+++ b/mplayer/timeline/tl_matroska.c
@@ -0,0 +1,271 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <inttypes.h>
+#include <assert.h>
+#include <dirent.h>
+#include <libavutil/common.h>
+
+#include "talloc.h"
+
+#include "mp_core.h"
+#include "mp_msg.h"
+#include "libmpdemux/demuxer.h"
+#include "path.h"
+#include "bstr.h"
+#include "mpcommon.h"
+
+static char **find_files(const char *original_file, const char *suffix)
+{
+    void *tmpmem = talloc_new(NULL);
+    char *basename = mp_basename(original_file);
+    struct bstr directory = mp_dirname(original_file);
+    char **results = talloc_size(NULL, 0);
+    char *dir_zero = bstrdup0(tmpmem, directory);
+    DIR *dp = opendir(dir_zero);
+    if (!dp) {
+        talloc_free(tmpmem);
+        return results;
+    }
+    struct dirent *ep;
+    char ***names_by_matchlen = talloc_zero_array(tmpmem, char **,
+                                                  strlen(basename) + 1);
+    int num_results = 0;
+    while ((ep = readdir(dp))) {
+        int suffix_offset = strlen(ep->d_name) - strlen(suffix);
+        // name must end with suffix
+        if (suffix_offset < 0 || strcmp(ep->d_name + suffix_offset, suffix))
+            continue;
+        // don't list the original name
+        if (!strcmp(ep->d_name, basename))
+            continue;
+
+        char *name = mp_path_join(results, directory, BSTR(ep->d_name));
+        char *s1 = ep->d_name;
+        char *s2 = basename;
+        int matchlen = 0;
+        while (*s1 && *s1++ == *s2++)
+            matchlen++;
+        int oldcount = MP_TALLOC_ELEMS(names_by_matchlen[matchlen]);
+        names_by_matchlen[matchlen] = talloc_realloc(names_by_matchlen,
+                                                  names_by_matchlen[matchlen],
+                                                  char *, oldcount + 1);
+        names_by_matchlen[matchlen][oldcount] = name;
+        num_results++;
+    }
+    closedir(dp);
+    results = talloc_realloc(NULL, results, char *, num_results);
+    char **resptr = results;
+    for (int i = strlen(basename); i >= 0; i--) {
+        char **p = names_by_matchlen[i];
+        for (int j = 0; j < talloc_get_size(p) / sizeof(char *); j++)
+            *resptr++ = p[j];
+    }
+    assert(resptr == results + num_results);
+    talloc_free(tmpmem);
+    return results;
+}
+
+static int find_ordered_chapter_sources(struct MPContext *mpctx,
+                                        struct content_source *sources,
+                                        int num_sources,
+                                        unsigned char uid_map[][16])
+{
+    int num_filenames = 0;
+    char **filenames = NULL;
+    if (num_sources > 1) {
+        mp_msg(MSGT_CPLAYER, MSGL_INFO, "This file references data from "
+               "other sources.\n");
+        if (mpctx->stream->type != STREAMTYPE_FILE) {
+            mp_msg(MSGT_CPLAYER, MSGL_WARN, "Playback source is not a "
+                   "normal disk file. Will not search for related files.\n");
+        } else {
+            mp_msg(MSGT_CPLAYER, MSGL_INFO, "Will scan other files in the "
+                   "same directory to find referenced sources.\n");
+            filenames = find_files(mpctx->demuxer->filename, ".mkv");
+            num_filenames = MP_TALLOC_ELEMS(filenames);
+        }
+    }
+
+    int num_left = num_sources - 1;
+    for (int i = 0; i < num_filenames && num_left > 0; i++) {
+        mp_msg(MSGT_CPLAYER, MSGL_INFO, "Checking file %s\n",
+               filename_recode(filenames[i]));
+        int format = 0;
+        struct stream *s = open_stream(filenames[i], &mpctx->opts, &format);
+        if (!s)
+            continue;
+        struct demuxer *d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_MATROSKA,
+                                       mpctx->opts.audio_id,
+                                       mpctx->opts.video_id,
+                                       mpctx->opts.sub_id, filenames[i]);
+        if (!d) {
+            free_stream(s);
+            continue;
+        }
+        if (d->file_format == DEMUXER_TYPE_MATROSKA) {
+            for (int i = 1; i < num_sources; i++) {
+                if (sources[i].demuxer)
+                    continue;
+                if (!memcmp(uid_map[i], d->matroska_data.segment_uid, 16)) {
+                    mp_msg(MSGT_CPLAYER, MSGL_INFO,"Match for source %d: %s\n",
+                           i, filename_recode(d->filename));
+                    sources[i].stream = s;
+                    sources[i].demuxer = d;
+                    num_left--;
+                    goto match;
+                }
+            }
+        }
+        free_demuxer(d);
+        free_stream(s);
+        continue;
+    match:
+        ;
+    }
+    talloc_free(filenames);
+    if (num_left) {
+        mp_msg(MSGT_CPLAYER, MSGL_ERR, "Failed to find ordered chapter part!\n"
+               "There will be parts MISSING from the video!\n");
+        for (int i = 1, j = 1; i < num_sources; i++)
+            if (sources[i].demuxer) {
+                sources[j] = sources[i];
+                memcpy(uid_map[j], uid_map[i], 16);
+                j++;
+            }
+    }
+    return num_sources - num_left;
+}
+
+void build_ordered_chapter_timeline(struct MPContext *mpctx)
+{
+    struct MPOpts *opts = &mpctx->opts;
+
+    if (!opts->ordered_chapters) {
+        mp_msg(MSGT_CPLAYER, MSGL_INFO, "File uses ordered chapters, but "
+               "you have disabled support for them. Ignoring.\n");
+        return;
+    }
+
+    mp_msg(MSGT_CPLAYER, MSGL_INFO, "File uses ordered chapters, will build "
+           "edit timeline.\n");
+
+    struct demuxer *demuxer = mpctx->demuxer;
+    struct matroska_data *m = &demuxer->matroska_data;
+
+    // +1 because sources/uid_map[0] is original file even if all chapters
+    // actually use other sources and need separate entries
+    struct content_source *sources = talloc_array_ptrtype(NULL, sources,
+                                                   m->num_ordered_chapters+1);
+    sources[0].stream = mpctx->stream;
+    sources[0].demuxer = mpctx->demuxer;
+    unsigned char uid_map[m->num_ordered_chapters+1][16];
+    int num_sources = 1;
+    memcpy(uid_map[0], m->segment_uid, 16);
+
+    for (int i = 0; i < m->num_ordered_chapters; i++) {
+        struct matroska_chapter *c = m->ordered_chapters + i;
+        if (!c->has_segment_uid)
+            memcpy(c->segment_uid, m->segment_uid, 16);
+
+        for (int j = 0; j < num_sources; j++)
+            if (!memcmp(c->segment_uid, uid_map[j], 16))
+                goto found1;
+        memcpy(uid_map[num_sources], c->segment_uid, 16);
+        sources[num_sources] = (struct content_source){};
+        num_sources++;
+    found1:
+        ;
+    }
+
+    num_sources = find_ordered_chapter_sources(mpctx, sources, num_sources,
+                                               uid_map);
+
+
+    // +1 for terminating chapter with start time marking end of last real one
+    struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline,
+                                                  m->num_ordered_chapters + 1);
+    struct chapter *chapters = talloc_array_ptrtype(NULL, chapters,
+                                                    m->num_ordered_chapters);
+    uint64_t starttime = 0;
+    uint64_t missing_time = 0;
+    int part_count = 0;
+    int num_chapters = 0;
+    uint64_t prev_part_offset = 0;
+    for (int i = 0; i < m->num_ordered_chapters; i++) {
+        struct matroska_chapter *c = m->ordered_chapters + i;
+
+        int j;
+        for (j = 0; j < num_sources; j++) {
+            if (!memcmp(c->segment_uid, uid_map[j], 16))
+                goto found2;
+        }
+        missing_time += c->end - c->start;
+        continue;
+    found2:;
+        /* Only add a separate part if the time or file actually changes.
+         * Matroska files have chapter divisions that are redundant from
+         * timeline point of view because the same chapter structure is used
+         * both to specify the timeline and for normal chapter information.
+         * Removing a missing inserted external chapter can also cause this.
+         * We allow for a configurable fudge factor because of files which
+         * specify chapter end times that are one frame too early;
+         * we don't want to try seeking over a one frame gap. */
+        int64_t join_diff = c->start - starttime - prev_part_offset;
+        if (part_count == 0
+            || FFABS(join_diff) > opts->chapter_merge_threshold * 1000000
+            || sources + j != timeline[part_count - 1].source) {
+            timeline[part_count].source = sources + j;
+            timeline[part_count].start = starttime / 1e9;
+            timeline[part_count].source_start = c->start / 1e9;
+            prev_part_offset = c->start - starttime;
+            part_count++;
+        } else if (part_count > 0 && join_diff) {
+            /* Chapter was merged at an inexact boundary;
+             * adjust timestamps to match. */
+            mp_msg(MSGT_CPLAYER, MSGL_V, "Merging timeline part %d with "
+                   "offset %d ms.\n", i, (int) join_diff);
+            starttime += join_diff;
+        }
+        chapters[num_chapters].start = starttime / 1e9;
+        chapters[num_chapters].name = talloc_strdup(chapters, c->name);
+        starttime += c->end - c->start;
+        num_chapters++;
+    }
+    timeline[part_count].start = starttime / 1e9;
+
+    if (!part_count) {
+        // None of the parts come from the file itself???
+        talloc_free(sources);
+        talloc_free(timeline);
+        talloc_free(chapters);
+        return;
+    }
+
+    if (missing_time)
+        mp_msg(MSGT_CPLAYER, MSGL_ERR, "There are %.3f seconds missing "
+               "from the timeline!\n", missing_time / 1e9);
+    mpctx->sources = sources;
+    mpctx->num_sources = num_sources;
+    mpctx->timeline = timeline;
+    mpctx->num_timeline_parts = part_count;
+    mpctx->num_chapters = num_chapters;
+    mpctx->chapters = chapters;
+}
diff --git a/script/update b/script/update
index 86aad2d..6a55a40 100755
--- a/script/update
+++ b/script/update
@@ -1,12 +1,32 @@
 #!/usr/bin/env python
 
+import os
 from os import path
 from subprocess import check_call
 
-from helpers import GitWrapper
+from helpers import GitWrapper, run_command
 
 def main():
     git = GitWrapper()
+
+    # Currently only ffmpeg-mt is supported. When upgrading from
+    # previous versions force it enabled.
+    switch_to_mt = not path.exists('ffmpeg-mt-enabled')
+    if switch_to_mt:
+        open('ffmpeg-mt-enabled', 'w').close()
+        if path.exists('ffmpeg-mt-disabled'):
+            os.remove('ffmpeg-mt-disabled')
+        # Allow setups where both ffmpeg and ffmpeg-mt are checked out
+        # simultaneously, and leave the directories alone in that case.
+        if path.exists('ffmpeg/.git') and not path.exists('ffmpeg-mt/.git'):
+            # fmpeg-mt should be an empty directory if things are right
+            os.rmdir('ffmpeg-mt')
+            os.rename('ffmpeg', 'ffmpeg-mt')
+            os.mkdir('ffmpeg')
+    # libswscale has changed from a submodule to a normal subdirectory
+    if path.exists('ffmpeg-mt/libswscale/.git'):
+        os.system('cd ffmpeg-mt && rm -rf libswscale')
+
     config = git.get_config()
     submodules = git.get_submodules()
     # Update existing submodules, but don't check out new ones
@@ -20,4 +40,11 @@ def main():
         check_call('git submodule update --init'.split())
     git.foreach_submodule(cmd)
 
+    if switch_to_mt:
+        print
+        print "Currently only ffmpeg-mt version is maintained."
+        print "This repository has been automatically switched from ffmpeg to ffmpeg-mt."
+        print "This should work OK on single-core machines too."
+        print "You should run ./clean before recompiling due to the switch."
+
 main()
diff --git a/wrapper_export_version b/wrapper_export_version
index c70b95d..2f0edc5 100644
--- a/wrapper_export_version
+++ b/wrapper_export_version
@@ -1 +1 @@
-e41ba824049a27e4a0bf1b72248b09782edba3e1
+8c4c758d2c8c4e92f02817be6649de7c5d1e5415

-- 
mplayer2 packaging



More information about the pkg-multimedia-commits mailing list